cesium 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/Cesium.js +5 -2
  3. data/app/assets/javascripts/Core/Cartesian2.js +58 -0
  4. data/app/assets/javascripts/Core/Cartesian3.js +67 -7
  5. data/app/assets/javascripts/Core/Cartesian4.js +63 -0
  6. data/app/assets/javascripts/Core/CatmullRomSpline.js +183 -163
  7. data/app/assets/javascripts/Core/CorridorGeometry.js +2 -2
  8. data/app/assets/javascripts/Core/Ellipsoid.js +16 -0
  9. data/app/assets/javascripts/Core/ExtentGeometry.js +9 -2
  10. data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +2 -2
  11. data/app/assets/javascripts/Core/GeometryPipeline.js +23 -23
  12. data/app/assets/javascripts/Core/HermiteSpline.js +260 -155
  13. data/app/assets/javascripts/Core/IndexDatatype.js +43 -34
  14. data/app/assets/javascripts/Core/LinearSpline.js +118 -0
  15. data/app/assets/javascripts/Core/Math.js +34 -3
  16. data/app/assets/javascripts/Core/Matrix2.js +26 -0
  17. data/app/assets/javascripts/Core/Matrix3.js +98 -0
  18. data/app/assets/javascripts/Core/Matrix4.js +42 -0
  19. data/app/assets/javascripts/Core/ObjectOrientedBoundingBox.js +396 -0
  20. data/app/assets/javascripts/Core/PolygonGeometry.js +87 -47
  21. data/app/assets/javascripts/Core/PolygonGeometryLibrary.js +20 -17
  22. data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +68 -40
  23. data/app/assets/javascripts/Core/PolygonPipeline.js +19 -9
  24. data/app/assets/javascripts/Core/PrimitiveType.js +33 -36
  25. data/app/assets/javascripts/Core/Quaternion.js +147 -1
  26. data/app/assets/javascripts/Core/QuaternionSpline.js +160 -0
  27. data/app/assets/javascripts/Core/Spline.js +121 -0
  28. data/app/assets/javascripts/Core/Transforms.js +0 -2
  29. data/app/assets/javascripts/Core/loadArrayBuffer.js +5 -1
  30. data/app/assets/javascripts/Core/loadBlob.js +5 -1
  31. data/app/assets/javascripts/Core/loadText.js +4 -1
  32. data/app/assets/javascripts/Core/loadWithXhr.js +30 -14
  33. data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +2 -2
  34. data/app/assets/javascripts/Renderer/AutomaticUniforms.js +41 -41
  35. data/app/assets/javascripts/Renderer/Context.js +171 -201
  36. data/app/assets/javascripts/Renderer/CubeMapFace.js +2 -2
  37. data/app/assets/javascripts/Renderer/DrawCommand.js +2 -2
  38. data/app/assets/javascripts/Renderer/PixelFormat.js +22 -28
  39. data/app/assets/javascripts/Renderer/ShaderProgram.js +65 -46
  40. data/app/assets/javascripts/Renderer/Texture.js +1 -1
  41. data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +7 -9
  42. data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +19 -25
  43. data/app/assets/javascripts/Renderer/TextureWrap.js +11 -13
  44. data/app/assets/javascripts/Renderer/UniformDatatype.js +29 -29
  45. data/app/assets/javascripts/Renderer/VertexArray.js +43 -35
  46. data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +1 -2
  47. data/app/assets/javascripts/Scene/BillboardCollection.js +10 -1
  48. data/app/assets/javascripts/Scene/CameraFlightPath.js +58 -101
  49. data/app/assets/javascripts/Scene/CentralBody.js +1 -4
  50. data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -2
  51. data/app/assets/javascripts/Scene/CesiumTerrainProvider.js +1 -2
  52. data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -3
  53. data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +20 -5
  54. data/app/assets/javascripts/Scene/EllipsoidSurfaceAppearance.js +1 -2
  55. data/app/assets/javascripts/Scene/FrameState.js +1 -3
  56. data/app/assets/javascripts/Scene/GoogleEarthImageryProvider.js +2 -5
  57. data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +1 -2
  58. data/app/assets/javascripts/Scene/OrthographicFrustum.js +1 -2
  59. data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +1 -2
  60. data/app/assets/javascripts/Scene/Polygon.js +1 -3
  61. data/app/assets/javascripts/Scene/Polyline.js +5 -2
  62. data/app/assets/javascripts/Scene/PolylineCollection.js +4 -6
  63. data/app/assets/javascripts/Scene/Primitive.js +19 -13
  64. data/app/assets/javascripts/Scene/PrimitivePipeline.js +1 -1
  65. data/app/assets/javascripts/Scene/Scene.js +7 -10
  66. data/app/assets/javascripts/Scene/SceneTransforms.js +1 -3
  67. data/app/assets/javascripts/Scene/SceneTransitioner.js +11 -11
  68. data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +1 -2
  69. data/app/assets/javascripts/Scene/TexturePool.js +1 -1
  70. data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +1 -2
  71. data/app/assets/javascripts/Scene/VRTheWorldTerrainProvider.js +1 -2
  72. data/app/assets/javascripts/Scene/ViewportQuad.js +1 -3
  73. data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +1 -2
  74. data/app/assets/javascripts/ThirdParty/knockout-3.0.0.js +6 -3
  75. data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +4 -3
  76. data/app/assets/javascripts/Widgets/SceneModePicker/SceneModePickerViewModel.js +1 -1
  77. data/app/assets/javascripts/Widgets/Viewer/Viewer.js +5 -5
  78. data/app/assets/javascripts/Widgets/Viewer/viewerDragDropMixin.js +13 -13
  79. data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +6 -6
  80. data/app/assets/javascripts/Widgets/widgets.css +1 -1
  81. data/lib/cesium/version.rb +1 -1
  82. metadata +6 -3
  83. data/app/assets/javascripts/Core/OrientationInterpolator.js +0 -106
@@ -1,5 +1,5 @@
1
1
  /*global define*/
2
- define(['Core/Enumeration'], function(Enumeration) {
2
+ define(function() {
3
3
  "use strict";
4
4
 
5
5
  /**
@@ -9,31 +9,29 @@ define(['Core/Enumeration'], function(Enumeration) {
9
9
  */
10
10
  var TextureWrap = {
11
11
  /**
12
- * DOC_TBA
12
+ * 0x812F. Clamps texture coordinates to the normalized range [0, 1].
13
13
  *
14
- * @type {Enumeration}
14
+ * @type {Number}
15
15
  * @constant
16
- * @default 0x812F
17
16
  */
18
- CLAMP_TO_EDGE : new Enumeration(0x812F, 'CLAMP_TO_EDGE'),
17
+ CLAMP_TO_EDGE : 0x812F,
19
18
 
20
19
  /**
21
- * DOC_TBA
20
+ * 0x2901. Repeats texture coordinates outside the normalized range [0, 1] by ignoring the integer part.
22
21
  *
23
- * @type {Enumeration}
22
+ * @type {Number}
24
23
  * @constant
25
- * @default 0x2901
26
24
  */
27
- REPEAT : new Enumeration(0x2901, 'REPEAT'),
25
+ REPEAT : 0x2901,
28
26
 
29
27
  /**
30
- * DOC_TBA
28
+ * 0x8370. Mirror repeats texture coordinates outside the normalized range [0, 1], using the
29
+ * integer part of the texture coordinate if it is even, or 1.0 minus the fractional part if it is odd.
31
30
  *
32
- * @type {Enumeration}
31
+ * @type {Number}
33
32
  * @constant
34
- * @default 0x8370
35
33
  */
36
- MIRRORED_REPEAT : new Enumeration(0x8370, 'MIRRORED_REPEAT'),
34
+ MIRRORED_REPEAT : 0x8370,
37
35
 
38
36
  /**
39
37
  * DOC_TBA
@@ -20,7 +20,7 @@ define(['Core/Enumeration'], function(Enumeration) {
20
20
  getGLSL : function() {
21
21
  return 'float';
22
22
  }
23
- }), // FLOAT
23
+ }),
24
24
 
25
25
  /**
26
26
  * A <code>vec2</code> uniform: a two-component floating-point vector.
@@ -29,11 +29,11 @@ define(['Core/Enumeration'], function(Enumeration) {
29
29
  * @constant
30
30
  * @default 0x8B50
31
31
  */
32
- FLOAT_VECTOR2 : new Enumeration(0x8B50, 'FLOAT_VECTOR2', {
32
+ FLOAT_VEC2 : new Enumeration(0x8B50, 'FLOAT_VEC2', {
33
33
  getGLSL : function() {
34
34
  return 'vec2';
35
35
  }
36
- }), // FLOAT_VEC2
36
+ }),
37
37
 
38
38
  /**
39
39
  * A <code>vec3</code> uniform: a three-component floating-point vector.
@@ -42,11 +42,11 @@ define(['Core/Enumeration'], function(Enumeration) {
42
42
  * @constant
43
43
  * @default 0x8B51
44
44
  */
45
- FLOAT_VECTOR3 : new Enumeration(0x8B51, 'FLOAT_VECTOR3', {
45
+ FLOAT_VEC3 : new Enumeration(0x8B51, 'FLOAT_VEC3', {
46
46
  getGLSL : function() {
47
47
  return 'vec3';
48
48
  }
49
- }), // FLOAT_VEC3
49
+ }),
50
50
 
51
51
  /**
52
52
  * A <code>vec4</code> uniform: a four-component floating-point vector.
@@ -55,11 +55,11 @@ define(['Core/Enumeration'], function(Enumeration) {
55
55
  * @constant
56
56
  * @default 0x8B52
57
57
  */
58
- FLOAT_VECTOR4 : new Enumeration(0x8B52, 'FLOAT_VECTOR4', {
58
+ FLOAT_VEC4 : new Enumeration(0x8B52, 'FLOAT_VEC4', {
59
59
  getGLSL : function() {
60
60
  return 'vec4';
61
61
  }
62
- }), // FLOAT_VEC4
62
+ }),
63
63
 
64
64
  /**
65
65
  * An <code>int</code> uniform.
@@ -72,7 +72,7 @@ define(['Core/Enumeration'], function(Enumeration) {
72
72
  getGLSL : function() {
73
73
  return 'int';
74
74
  }
75
- }), // INT
75
+ }),
76
76
 
77
77
  /**
78
78
  * An <code>ivec2</code> uniform: a two-component integer vector.
@@ -81,11 +81,11 @@ define(['Core/Enumeration'], function(Enumeration) {
81
81
  * @constant
82
82
  * @default 0x8B53
83
83
  */
84
- INT_VECTOR2 : new Enumeration(0x8B53, 'INT_VECTOR2', {
84
+ INT_VEC2 : new Enumeration(0x8B53, 'INT_VEC2', {
85
85
  getGLSL : function() {
86
86
  return 'ivec2';
87
87
  }
88
- }), // INT_VEC2
88
+ }),
89
89
 
90
90
  /**
91
91
  * An <code>ivec3</code> uniform: a three-component integer vector.
@@ -94,11 +94,11 @@ define(['Core/Enumeration'], function(Enumeration) {
94
94
  * @constant
95
95
  * @default 0x8B54
96
96
  */
97
- INT_VECTOR3 : new Enumeration(0x8B54, 'INT_VECTOR3', {
97
+ INT_VEC3 : new Enumeration(0x8B54, 'INT_VEC3', {
98
98
  getGLSL : function() {
99
99
  return 'ivec3';
100
100
  }
101
- }), // INT_VEC3
101
+ }),
102
102
 
103
103
  /**
104
104
  * An <code>ivec4</code> uniform: a four-component integer vector.
@@ -107,11 +107,11 @@ define(['Core/Enumeration'], function(Enumeration) {
107
107
  * @constant
108
108
  * @default 0x8B55
109
109
  */
110
- INT_VECTOR4 : new Enumeration(0x8B55, 'INT_VECTOR4', {
110
+ INT_VEC4 : new Enumeration(0x8B55, 'INT_VEC4', {
111
111
  getGLSL : function() {
112
112
  return 'ivec4';
113
113
  }
114
- }), // INT_VEC4
114
+ }),
115
115
 
116
116
  /**
117
117
  * A <code>bool</code> uniform.
@@ -124,7 +124,7 @@ define(['Core/Enumeration'], function(Enumeration) {
124
124
  getGLSL : function() {
125
125
  return 'bool';
126
126
  }
127
- }), // BOOL
127
+ }),
128
128
 
129
129
  /**
130
130
  * A <code>bvec2</code> uniform: a two-component boolean vector.
@@ -133,11 +133,11 @@ define(['Core/Enumeration'], function(Enumeration) {
133
133
  * @constant
134
134
  * @default 0x8B57
135
135
  */
136
- BOOL_VECTOR2 : new Enumeration(0x8B57, 'BOOL_VECTOR2', {
136
+ BOOL_VEC2 : new Enumeration(0x8B57, 'BOOL_VEC2', {
137
137
  getGLSL : function() {
138
138
  return 'bvec2';
139
139
  }
140
- }), // BOOL_VEC2
140
+ }),
141
141
 
142
142
  /**
143
143
  * A <code>bvec3</code> uniform: a three-component boolean vector.
@@ -146,11 +146,11 @@ define(['Core/Enumeration'], function(Enumeration) {
146
146
  * @constant
147
147
  * @default 0x8B58
148
148
  */
149
- BOOL_VECTOR3 : new Enumeration(0x8B58, 'BOOL_VECTOR3', {
149
+ BOOL_VEC3 : new Enumeration(0x8B58, 'BOOL_VEC3', {
150
150
  getGLSL : function() {
151
151
  return 'bvec3';
152
152
  }
153
- }), // BOOL_VEC3
153
+ }),
154
154
 
155
155
  /**
156
156
  * A <code>bvec4</code> uniform: a four-component boolean vector.
@@ -159,11 +159,11 @@ define(['Core/Enumeration'], function(Enumeration) {
159
159
  * @constant
160
160
  * @default 0x8B59
161
161
  */
162
- BOOL_VECTOR4 : new Enumeration(0x8B59, 'BOOL_VECTOR4', {
162
+ BOOL_VEC4 : new Enumeration(0x8B59, 'BOOL_VEC4', {
163
163
  getGLSL : function() {
164
164
  return 'bvec4';
165
165
  }
166
- }), // BOOL_VEC4
166
+ }),
167
167
 
168
168
  /**
169
169
  * An <code>mat2</code> uniform: a 2x2 floating-point matrix.
@@ -172,11 +172,11 @@ define(['Core/Enumeration'], function(Enumeration) {
172
172
  * @constant
173
173
  * @default 0x8B5A
174
174
  */
175
- FLOAT_MATRIX2 : new Enumeration(0x8B5A, 'FLOAT_MATRIX2', {
175
+ FLOAT_MAT2 : new Enumeration(0x8B5A, 'FLOAT_MAT2', {
176
176
  getGLSL : function() {
177
177
  return 'mat2';
178
178
  }
179
- }), // FLOAT_MAT2
179
+ }),
180
180
 
181
181
  /**
182
182
  * An <code>mat3</code> uniform: a 3x3 floating-point matrix.
@@ -185,11 +185,11 @@ define(['Core/Enumeration'], function(Enumeration) {
185
185
  * @constant
186
186
  * @default 0x8B5B
187
187
  */
188
- FLOAT_MATRIX3 : new Enumeration(0x8B5B, 'FLOAT_MATRIX3', {
188
+ FLOAT_MAT3 : new Enumeration(0x8B5B, 'FLOAT_MAT3', {
189
189
  getGLSL : function() {
190
190
  return 'mat3';
191
191
  }
192
- }), // FLOAT_MAT3
192
+ }),
193
193
 
194
194
  /**
195
195
  * An <code>mat4</code> uniform: a 4x4 floating-point matrix.
@@ -198,11 +198,11 @@ define(['Core/Enumeration'], function(Enumeration) {
198
198
  * @constant
199
199
  * @default 0x8B5C
200
200
  */
201
- FLOAT_MATRIX4 : new Enumeration(0x8B5C, 'FLOAT_MATRIX4', {
201
+ FLOAT_MAT4 : new Enumeration(0x8B5C, 'FLOAT_MAT4', {
202
202
  getGLSL : function() {
203
203
  return 'mat4';
204
204
  }
205
- }), // FLOAT_MAT4
205
+ }),
206
206
 
207
207
  /**
208
208
  * A <code>sampler2D</code> uniform: an opaque type to access 2D textures.
@@ -215,7 +215,7 @@ define(['Core/Enumeration'], function(Enumeration) {
215
215
  getGLSL : function() {
216
216
  return 'sampler2D';
217
217
  }
218
- }), // SAMPLER_2D
218
+ }),
219
219
 
220
220
  /**
221
221
  * A <code>samplerCube</code> uniform: an opaque type to access cube-map textures.
@@ -228,7 +228,7 @@ define(['Core/Enumeration'], function(Enumeration) {
228
228
  getGLSL : function() {
229
229
  return 'samplerCube';
230
230
  }
231
- }) // SAMPLER_CUBE
231
+ })
232
232
  };
233
233
 
234
234
  return UniformDatatype;
@@ -8,11 +8,14 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
8
8
  "use strict";
9
9
 
10
10
  function addAttribute(attributes, attribute, index) {
11
- if (!attribute.vertexBuffer && !attribute.value) {
11
+ var hasVertexBuffer = defined(attribute.vertexBuffer);
12
+ var hasValue = defined(attribute.value);
13
+
14
+ if (!hasVertexBuffer && !hasValue) {
12
15
  throw new DeveloperError('attribute must have a vertexBuffer or a value.');
13
16
  }
14
17
 
15
- if (attribute.vertexBuffer && attribute.value) {
18
+ if (hasVertexBuffer && hasValue) {
16
19
  throw new DeveloperError('attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.');
17
20
  }
18
21
 
@@ -22,21 +25,18 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
22
25
  (componentsPerAttribute !== 2) &&
23
26
  (componentsPerAttribute !== 3) &&
24
27
  (componentsPerAttribute !== 4)) {
25
- if (attribute.value) {
28
+ if (hasValue) {
26
29
  throw new DeveloperError('attribute.value.length must be in the range [1, 4].');
27
30
  }
28
31
 
29
32
  throw new DeveloperError('attribute.componentsPerAttribute must be in the range [1, 4].');
30
33
  }
31
34
 
32
- if (attribute.componentDatatype) {
33
- var datatype = attribute.componentDatatype;
34
- if (!ComponentDatatype.validate(datatype)) {
35
- throw new DeveloperError('attribute must have a valid componentDatatype or not specify it.');
36
- }
35
+ if (defined(attribute.componentDatatype) && !ComponentDatatype.validate(attribute.componentDatatype)) {
36
+ throw new DeveloperError('attribute must have a valid componentDatatype or not specify it.');
37
37
  }
38
38
 
39
- if (attribute.strideInBytes && (attribute.strideInBytes > 255)) {
39
+ if (defined(attribute.strideInBytes) && (attribute.strideInBytes > 255)) {
40
40
  // WebGL limit. Not in GL ES.
41
41
  throw new DeveloperError('attribute must have a strideInBytes less than or equal to 255 or not specify it.');
42
42
  }
@@ -46,15 +46,15 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
46
46
  index : defaultValue(attribute.index, index),
47
47
  enabled : defaultValue(attribute.enabled, true),
48
48
  vertexBuffer : attribute.vertexBuffer,
49
- value : attribute.value ? attribute.value.slice(0) : undefined,
49
+ value : hasValue ? attribute.value.slice(0) : undefined,
50
50
  componentsPerAttribute : componentsPerAttribute,
51
- componentDatatype : attribute.componentDatatype || ComponentDatatype.FLOAT,
52
- normalize : attribute.normalize || false,
53
- offsetInBytes : attribute.offsetInBytes || 0,
54
- strideInBytes : attribute.strideInBytes || 0
51
+ componentDatatype : defaultValue(attribute.componentDatatype, ComponentDatatype.FLOAT),
52
+ normalize : defaultValue(attribute.normalize, false),
53
+ offsetInBytes : defaultValue(attribute.offsetInBytes, 0),
54
+ strideInBytes : defaultValue(attribute.strideInBytes, 0)
55
55
  };
56
56
 
57
- if (attr.vertexBuffer) {
57
+ if (hasVertexBuffer) {
58
58
  // Common case: vertex buffer for per-vertex data
59
59
  attr.vertexAttrib = function(gl) {
60
60
  gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer._getBuffer());
@@ -117,15 +117,32 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
117
117
  *
118
118
  * @internalConstructor
119
119
  *
120
+ * @exception {DeveloperError} attributes is required.
121
+ *
120
122
  * @see {@link Context#createVertexArray}
121
123
  * @see {@link Context#createVertexArrayFromGeometry}
122
124
  */
123
125
  var VertexArray = function(gl, vertexArrayObject, attributes, indexBuffer) {
126
+ if (!defined(attributes)) {
127
+ throw new DeveloperError('attributes is required.');
128
+ }
129
+
130
+ var i;
124
131
  var vaAttributes = [];
132
+ var numberOfVertices = 1; // if every attribute is backed by a single value
125
133
 
126
- if (defined(attributes)) {
127
- for ( var i = 0; i < attributes.length; ++i) {
128
- addAttribute(vaAttributes, attributes[i], i);
134
+ for (i = 0; i < attributes.length; ++i) {
135
+ addAttribute(vaAttributes, attributes[i], i);
136
+ }
137
+
138
+ for (i = 0; i < vaAttributes.length; ++i) {
139
+ var attribute = vaAttributes[i];
140
+
141
+ if (defined(attribute.vertexBuffer)) {
142
+ // This assumes that each vertex buffer in the vertex array has the same number of vertices.
143
+ var bytes = attribute.strideInBytes || (attribute.componentsPerAttribute * attribute.componentDatatype.sizeInBytes);
144
+ numberOfVertices = attribute.vertexBuffer.getSizeInBytes() / bytes;
145
+ break;
129
146
  }
130
147
  }
131
148
 
@@ -150,6 +167,12 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
150
167
  vertexArrayObject.bindVertexArrayOES(null);
151
168
  }
152
169
 
170
+ /**
171
+ * @readonly
172
+ * @private
173
+ */
174
+ this.numberOfVertices = numberOfVertices;
175
+
153
176
  this._gl = gl;
154
177
  this._vaoExtension = vertexArrayObject;
155
178
  this._vao = vao;
@@ -225,21 +248,6 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
225
248
  }
226
249
  };
227
250
 
228
- /**
229
- * This assumes that each vertex buffer in the vertex array has the same number of vertices.
230
- * @private
231
- */
232
- VertexArray.prototype._getNumberOfVertices = function() {
233
- if (this._attributes.length > 0) {
234
- var attribute = this._attributes[0];
235
- var bytes = attribute.strideInBytes || (attribute.componentsPerAttribute * attribute.componentDatatype.sizeInBytes);
236
-
237
- return attribute.vertexBuffer.getSizeInBytes() / bytes;
238
- }
239
-
240
- return 0;
241
- };
242
-
243
251
  /**
244
252
  * Returns true if this object was destroyed; otherwise, false.
245
253
  * <br /><br />
@@ -297,13 +305,13 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
297
305
  var attributes = this._attributes;
298
306
  for ( var i = 0; i < attributes.length; ++i) {
299
307
  var vertexBuffer = attributes[i].vertexBuffer;
300
- if (vertexBuffer && !vertexBuffer.isDestroyed() && vertexBuffer.getVertexArrayDestroyable()) {
308
+ if (defined(vertexBuffer) && !vertexBuffer.isDestroyed() && vertexBuffer.getVertexArrayDestroyable()) {
301
309
  vertexBuffer.destroy();
302
310
  }
303
311
  }
304
312
 
305
313
  var indexBuffer = this._indexBuffer;
306
- if (indexBuffer && !indexBuffer.isDestroyed() && indexBuffer.getVertexArrayDestroyable()) {
314
+ if (defined(indexBuffer) && !indexBuffer.isDestroyed() && indexBuffer.getVertexArrayDestroyable()) {
307
315
  indexBuffer.destroy();
308
316
  }
309
317
 
@@ -1,9 +1,8 @@
1
1
  /*global define*/
2
- define(['Core/defaultValue', 'Core/defined', 'Core/jsonp', 'Core/writeTextToCanvas', 'Core/Cartesian2', 'Core/DeveloperError', 'Core/Event', 'Scene/DiscardMissingTileImagePolicy', 'Scene/GeographicTilingScheme', 'Scene/ImageryProvider', 'Scene/TileProviderError', 'Scene/WebMercatorTilingScheme', 'Scene/Credit', 'ThirdParty/when'], function(
2
+ define(['Core/defaultValue', 'Core/defined', 'Core/jsonp', 'Core/Cartesian2', 'Core/DeveloperError', 'Core/Event', 'Scene/DiscardMissingTileImagePolicy', 'Scene/GeographicTilingScheme', 'Scene/ImageryProvider', 'Scene/TileProviderError', 'Scene/WebMercatorTilingScheme', 'Scene/Credit', 'ThirdParty/when'], function(
3
3
  defaultValue,
4
4
  defined,
5
5
  jsonp,
6
- writeTextToCanvas,
7
6
  Cartesian2,
8
7
  DeveloperError,
9
8
  Event,
@@ -151,8 +151,10 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/defaultValue'
151
151
  this._allHorizontalCenter = true;
152
152
 
153
153
  this._baseVolume = new BoundingSphere();
154
+ this._baseVolumeWC = new BoundingSphere();
154
155
  this._baseVolume2D = new BoundingSphere();
155
156
  this._boundingVolume = new BoundingSphere();
157
+ this._boundingVolumeDirty = false;
156
158
 
157
159
  this._colorCommands = [];
158
160
  this._pickCommands = [];
@@ -707,6 +709,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/defaultValue'
707
709
 
708
710
  if (billboardCollection._mode === SceneMode.SCENE3D) {
709
711
  billboardCollection._baseVolume.expand(position, billboardCollection._baseVolume);
712
+ billboardCollection._boundingVolumeDirty = true;
710
713
  }
711
714
 
712
715
  EncodedCartesian3.fromCartesian(position, writePositionScratch);
@@ -943,6 +946,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/defaultValue'
943
946
  var boundingVolume;
944
947
  if (frameState.mode === SceneMode.SCENE3D) {
945
948
  boundingVolume = billboardCollection._baseVolume;
949
+ billboardCollection._boundingVolumeDirty = true;
946
950
  } else {
947
951
  boundingVolume = billboardCollection._baseVolume2D;
948
952
  }
@@ -1173,11 +1177,16 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/defaultValue'
1173
1177
  return;
1174
1178
  }
1175
1179
 
1180
+ if (this._boundingVolumeDirty) {
1181
+ this._boundingVolumeDirty = false;
1182
+ BoundingSphere.transform(this._baseVolume, this.modelMatrix, this._baseVolumeWC);
1183
+ }
1184
+
1176
1185
  var boundingVolume;
1177
1186
  var modelMatrix = Matrix4.IDENTITY;
1178
1187
  if (frameState.mode === SceneMode.SCENE3D) {
1179
1188
  modelMatrix = this.modelMatrix;
1180
- boundingVolume = BoundingSphere.clone(this._baseVolume, this._boundingVolume);
1189
+ boundingVolume = BoundingSphere.clone(this._baseVolumeWC, this._boundingVolume);
1181
1190
  } else {
1182
1191
  boundingVolume = BoundingSphere.clone(this._baseVolume2D, this._boundingVolume);
1183
1192
  }