@@ -186,10 +186,12 @@ defineSuite([
186
186
} ) ;
187
187
188
188
function addZoomTo ( model ) {
189
- model . zoomTo = function ( ) {
189
+ model . zoomTo = function ( zoom ) {
190
+ zoom = defaultValue ( zoom , 4.0 ) ;
191
+
190
192
var camera = scene . camera ;
191
193
var center = Matrix4 . multiplyByPoint ( model . modelMatrix , model . boundingSphere . center , new Cartesian3 ( ) ) ;
192
- var r = 4.0 * Math . max ( model . boundingSphere . radius , camera . frustum . near ) ;
194
+ var r = zoom * Math . max ( model . boundingSphere . radius , camera . frustum . near ) ;
193
195
camera . lookAt ( center , new HeadingPitchRange ( 0.0 , 0.0 , r ) ) ;
194
196
} ;
195
197
}
@@ -2735,28 +2737,61 @@ defineSuite([
2735
2737
2736
2738
it ( 'renders with the KHR_materials_pbrSpecularGlossiness extension' , function ( ) {
2737
2739
return loadModel ( boomBoxPbrSpecularGlossinessUrl ) . then ( function ( model ) {
2740
+ model . show = false ;
2741
+ model . zoomTo ( 2.0 ) ;
2742
+
2743
+ var originalColor ;
2744
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2745
+ originalColor = rgba ;
2746
+ } ) ;
2747
+
2738
2748
model . show = true ;
2739
- model . zoomTo ( ) ;
2740
2749
2741
- scene . renderForSpecs ( ) ;
2750
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2751
+ expect ( rgba ) . not . toEqual ( originalColor ) ;
2752
+ } ) ;
2753
+
2754
+ primitives . remove ( model ) ;
2742
2755
} ) ;
2743
2756
} ) ;
2744
2757
2745
2758
it ( 'renders with the KHR_materials_pbrSpecularGlossiness extension with defaults' , function ( ) {
2746
2759
return loadModel ( boomBoxPbrSpecularGlossinessDefaultsUrl ) . then ( function ( model ) {
2760
+ model . show = false ;
2761
+ model . zoomTo ( 2.0 ) ;
2762
+
2763
+ var originalColor ;
2764
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2765
+ originalColor = rgba ;
2766
+ } ) ;
2767
+
2747
2768
model . show = true ;
2748
- model . zoomTo ( ) ;
2749
2769
2750
- scene . renderForSpecs ( ) ;
2770
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2771
+ expect ( rgba ) . not . toEqual ( originalColor ) ;
2772
+ } ) ;
2773
+
2774
+ primitives . remove ( model ) ;
2751
2775
} ) ;
2752
2776
} ) ;
2753
2777
2754
2778
it ( 'renders with the KHR_materials_pbrSpecularGlossiness extension when no textures are found' , function ( ) {
2755
2779
return loadModel ( boomBoxPbrSpecularGlossinessNoTextureUrl ) . then ( function ( model ) {
2780
+ model . show = false ;
2781
+ model . zoomTo ( 2.0 ) ;
2782
+
2783
+ var originalColor ;
2784
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2785
+ originalColor = rgba ;
2786
+ } ) ;
2787
+
2756
2788
model . show = true ;
2757
- model . zoomTo ( ) ;
2758
2789
2759
- scene . renderForSpecs ( ) ;
2790
+ expect ( scene ) . toRenderAndCall ( function ( rgba ) {
2791
+ expect ( rgba ) . not . toEqual ( originalColor ) ;
2792
+ } ) ;
2793
+
2794
+ primitives . remove ( model ) ;
2760
2795
} ) ;
2761
2796
} ) ;
2762
2797
0 commit comments