cesium 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/Cesium.js +5 -2
- data/app/assets/javascripts/Core/Cartesian2.js +58 -0
- data/app/assets/javascripts/Core/Cartesian3.js +67 -7
- data/app/assets/javascripts/Core/Cartesian4.js +63 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +183 -163
- data/app/assets/javascripts/Core/CorridorGeometry.js +2 -2
- data/app/assets/javascripts/Core/Ellipsoid.js +16 -0
- data/app/assets/javascripts/Core/ExtentGeometry.js +9 -2
- data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +2 -2
- data/app/assets/javascripts/Core/GeometryPipeline.js +23 -23
- data/app/assets/javascripts/Core/HermiteSpline.js +260 -155
- data/app/assets/javascripts/Core/IndexDatatype.js +43 -34
- data/app/assets/javascripts/Core/LinearSpline.js +118 -0
- data/app/assets/javascripts/Core/Math.js +34 -3
- data/app/assets/javascripts/Core/Matrix2.js +26 -0
- data/app/assets/javascripts/Core/Matrix3.js +98 -0
- data/app/assets/javascripts/Core/Matrix4.js +42 -0
- data/app/assets/javascripts/Core/ObjectOrientedBoundingBox.js +396 -0
- data/app/assets/javascripts/Core/PolygonGeometry.js +87 -47
- data/app/assets/javascripts/Core/PolygonGeometryLibrary.js +20 -17
- data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +68 -40
- data/app/assets/javascripts/Core/PolygonPipeline.js +19 -9
- data/app/assets/javascripts/Core/PrimitiveType.js +33 -36
- data/app/assets/javascripts/Core/Quaternion.js +147 -1
- data/app/assets/javascripts/Core/QuaternionSpline.js +160 -0
- data/app/assets/javascripts/Core/Spline.js +121 -0
- data/app/assets/javascripts/Core/Transforms.js +0 -2
- data/app/assets/javascripts/Core/loadArrayBuffer.js +5 -1
- data/app/assets/javascripts/Core/loadBlob.js +5 -1
- data/app/assets/javascripts/Core/loadText.js +4 -1
- data/app/assets/javascripts/Core/loadWithXhr.js +30 -14
- data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +2 -2
- data/app/assets/javascripts/Renderer/AutomaticUniforms.js +41 -41
- data/app/assets/javascripts/Renderer/Context.js +171 -201
- data/app/assets/javascripts/Renderer/CubeMapFace.js +2 -2
- data/app/assets/javascripts/Renderer/DrawCommand.js +2 -2
- data/app/assets/javascripts/Renderer/PixelFormat.js +22 -28
- data/app/assets/javascripts/Renderer/ShaderProgram.js +65 -46
- data/app/assets/javascripts/Renderer/Texture.js +1 -1
- data/app/assets/javascripts/Renderer/TextureMagnificationFilter.js +7 -9
- data/app/assets/javascripts/Renderer/TextureMinificationFilter.js +19 -25
- data/app/assets/javascripts/Renderer/TextureWrap.js +11 -13
- data/app/assets/javascripts/Renderer/UniformDatatype.js +29 -29
- data/app/assets/javascripts/Renderer/VertexArray.js +43 -35
- data/app/assets/javascripts/Scene/ArcGisMapServerImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/BillboardCollection.js +10 -1
- data/app/assets/javascripts/Scene/CameraFlightPath.js +58 -101
- data/app/assets/javascripts/Scene/CentralBody.js +1 -4
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -2
- data/app/assets/javascripts/Scene/CesiumTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -3
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +20 -5
- data/app/assets/javascripts/Scene/EllipsoidSurfaceAppearance.js +1 -2
- data/app/assets/javascripts/Scene/FrameState.js +1 -3
- data/app/assets/javascripts/Scene/GoogleEarthImageryProvider.js +2 -5
- data/app/assets/javascripts/Scene/OpenStreetMapImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/OrthographicFrustum.js +1 -2
- data/app/assets/javascripts/Scene/PerspectiveOffCenterFrustum.js +1 -2
- data/app/assets/javascripts/Scene/Polygon.js +1 -3
- data/app/assets/javascripts/Scene/Polyline.js +5 -2
- data/app/assets/javascripts/Scene/PolylineCollection.js +4 -6
- data/app/assets/javascripts/Scene/Primitive.js +19 -13
- data/app/assets/javascripts/Scene/PrimitivePipeline.js +1 -1
- data/app/assets/javascripts/Scene/Scene.js +7 -10
- data/app/assets/javascripts/Scene/SceneTransforms.js +1 -3
- data/app/assets/javascripts/Scene/SceneTransitioner.js +11 -11
- data/app/assets/javascripts/Scene/SingleTileImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/TexturePool.js +1 -1
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/Scene/VRTheWorldTerrainProvider.js +1 -2
- data/app/assets/javascripts/Scene/ViewportQuad.js +1 -3
- data/app/assets/javascripts/Scene/WebMapServiceImageryProvider.js +1 -2
- data/app/assets/javascripts/ThirdParty/knockout-3.0.0.js +6 -3
- data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +4 -3
- data/app/assets/javascripts/Widgets/SceneModePicker/SceneModePickerViewModel.js +1 -1
- data/app/assets/javascripts/Widgets/Viewer/Viewer.js +5 -5
- data/app/assets/javascripts/Widgets/Viewer/viewerDragDropMixin.js +13 -13
- data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +6 -6
- data/app/assets/javascripts/Widgets/widgets.css +1 -1
- data/lib/cesium/version.rb +1 -1
- metadata +6 -3
- data/app/assets/javascripts/Core/OrientationInterpolator.js +0 -106
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/HermiteSpline', 'Core/Math', 'Core/Matrix3', 'Core/
|
|
2
|
+
define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/HermiteSpline', 'Core/Math', 'Core/Matrix3', 'Core/Quaternion', 'Core/QuaternionSpline', 'Scene/PerspectiveFrustum', 'Scene/PerspectiveOffCenterFrustum', 'Scene/SceneMode', 'ThirdParty/Tween'], function(
|
|
3
3
|
Cartesian2,
|
|
4
4
|
Cartesian3,
|
|
5
5
|
clone,
|
|
@@ -9,8 +9,8 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
9
9
|
HermiteSpline,
|
|
10
10
|
CesiumMath,
|
|
11
11
|
Matrix3,
|
|
12
|
-
OrientationInterpolator,
|
|
13
12
|
Quaternion,
|
|
13
|
+
QuaternionSpline,
|
|
14
14
|
PerspectiveFrustum,
|
|
15
15
|
PerspectiveOffCenterFrustum,
|
|
16
16
|
SceneMode,
|
|
@@ -69,28 +69,6 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
69
69
|
return Math.max(dx, dy);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
function createSpline(points) {
|
|
73
|
-
if (points.length > 2) {
|
|
74
|
-
return new HermiteSpline(points);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// only two points, use linear interpolation
|
|
78
|
-
var p = points[0];
|
|
79
|
-
var q = points[1];
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
getControlPoints : function() {
|
|
83
|
-
return points;
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
evaluate : function(time, result) {
|
|
87
|
-
time = CesiumMath.clamp(time, p.time, q.time);
|
|
88
|
-
var t = (time - p.time) / (q.time - p.time);
|
|
89
|
-
return Cartesian3.lerp(p.point, q.point, t, result);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
72
|
function createPath3D(camera, ellipsoid, start, end, duration) {
|
|
95
73
|
// get minimum altitude from which the whole ellipsoid is visible
|
|
96
74
|
var radius = ellipsoid.getMaximumRadius();
|
|
@@ -120,28 +98,12 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
120
98
|
var axis, angle, rotation, middle;
|
|
121
99
|
if (Cartesian3.magnitude(end) > maxStartAlt && dot > 0.75) {
|
|
122
100
|
middle = Cartesian3.add(Cartesian3.multiplyByScalar(Cartesian3.subtract(start, end), 0.5), end);
|
|
123
|
-
|
|
124
|
-
points = [{
|
|
125
|
-
point : start
|
|
126
|
-
}, {
|
|
127
|
-
point : middle
|
|
128
|
-
}, {
|
|
129
|
-
point : end
|
|
130
|
-
}];
|
|
101
|
+
points = [ start, middle, end ];
|
|
131
102
|
} else if (Cartesian3.magnitude(start) > maxStartAlt && dot > 0) {
|
|
132
103
|
middle = Cartesian3.add(Cartesian3.multiplyByScalar(Cartesian3.subtract(start, aboveEnd), 0.5), aboveEnd);
|
|
133
|
-
|
|
134
|
-
points = [{
|
|
135
|
-
point : start
|
|
136
|
-
}, {
|
|
137
|
-
point : middle
|
|
138
|
-
}, {
|
|
139
|
-
point : end
|
|
140
|
-
}];
|
|
104
|
+
points = [ start, middle, end ];
|
|
141
105
|
} else {
|
|
142
|
-
points = [
|
|
143
|
-
point : start
|
|
144
|
-
}];
|
|
106
|
+
points = [ start ];
|
|
145
107
|
|
|
146
108
|
angle = Math.acos(Cartesian3.dot(Cartesian3.normalize(afterStart), Cartesian3.normalize(aboveEnd)));
|
|
147
109
|
axis = Cartesian3.cross(aboveEnd, afterStart);
|
|
@@ -153,50 +115,58 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
153
115
|
var startCondition = angle - increment;
|
|
154
116
|
for ( var i = startCondition; i > 0.0; i = i - increment) {
|
|
155
117
|
rotation = Matrix3.fromQuaternion(Quaternion.fromAxisAngle(axis, i));
|
|
156
|
-
points.push(
|
|
157
|
-
point : Matrix3.multiplyByVector(rotation, aboveEnd)
|
|
158
|
-
});
|
|
118
|
+
points.push(Matrix3.multiplyByVector(rotation, aboveEnd));
|
|
159
119
|
}
|
|
160
120
|
|
|
161
|
-
points.push(
|
|
162
|
-
point : end
|
|
163
|
-
});
|
|
121
|
+
points.push(end);
|
|
164
122
|
}
|
|
165
123
|
|
|
124
|
+
var times = new Array(points.length);
|
|
166
125
|
var scalar = duration / (points.length - 1);
|
|
167
126
|
for ( var k = 0; k < points.length; ++k) {
|
|
168
|
-
|
|
127
|
+
times[k] = k * scalar;
|
|
169
128
|
}
|
|
170
129
|
|
|
171
|
-
return
|
|
130
|
+
return new HermiteSpline({
|
|
131
|
+
points : points,
|
|
132
|
+
times : times
|
|
133
|
+
});
|
|
172
134
|
}
|
|
135
|
+
|
|
173
136
|
var direction3D = new Cartesian3();
|
|
174
137
|
var right3D = new Cartesian3();
|
|
175
138
|
var up3D = new Cartesian3();
|
|
176
139
|
var quat3D = new Quaternion();
|
|
177
|
-
|
|
178
|
-
|
|
140
|
+
|
|
141
|
+
function createOrientations3D(camera, path, endDirection, endUp) {
|
|
142
|
+
var points = path.points;
|
|
143
|
+
var orientations = new Array(points.length);
|
|
144
|
+
orientations[0] = createQuaternion(camera.direction, camera.up);
|
|
145
|
+
|
|
179
146
|
var point;
|
|
180
147
|
var length = points.length - 1;
|
|
181
148
|
for (var i = 1; i < length; ++i) {
|
|
182
149
|
point = points[i];
|
|
183
|
-
Cartesian3.normalize(Cartesian3.negate(point
|
|
150
|
+
Cartesian3.normalize(Cartesian3.negate(point, direction3D), direction3D);
|
|
184
151
|
Cartesian3.normalize(Cartesian3.cross(direction3D, Cartesian3.UNIT_Z, right3D), right3D);
|
|
185
152
|
Cartesian3.cross(right3D, direction3D, up3D);
|
|
186
|
-
|
|
153
|
+
orientations[i] = createQuaternion(direction3D, up3D, quat3D);
|
|
187
154
|
}
|
|
188
155
|
|
|
189
156
|
point = points[length];
|
|
190
157
|
if (defined(endDirection) && defined(endUp)) {
|
|
191
|
-
|
|
158
|
+
orientations[length] = createQuaternion(endDirection, endUp);
|
|
192
159
|
} else {
|
|
193
|
-
Cartesian3.normalize(Cartesian3.negate(point
|
|
160
|
+
Cartesian3.normalize(Cartesian3.negate(point, direction3D), direction3D);
|
|
194
161
|
Cartesian3.normalize(Cartesian3.cross(direction3D, Cartesian3.UNIT_Z, right3D), right3D);
|
|
195
162
|
Cartesian3.cross(right3D, direction3D, up3D);
|
|
196
|
-
|
|
163
|
+
orientations[length] = createQuaternion(direction3D, up3D, quat3D);
|
|
197
164
|
}
|
|
198
165
|
|
|
199
|
-
return new
|
|
166
|
+
return new QuaternionSpline({
|
|
167
|
+
points : orientations,
|
|
168
|
+
times : path.times
|
|
169
|
+
});
|
|
200
170
|
}
|
|
201
171
|
|
|
202
172
|
function createUpdate3D(frameState, destination, duration, direction, up) {
|
|
@@ -204,14 +174,14 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
204
174
|
var ellipsoid = frameState.scene2D.projection.getEllipsoid();
|
|
205
175
|
|
|
206
176
|
var path = createPath3D(camera, ellipsoid, camera.position, destination, duration);
|
|
207
|
-
var orientations = createOrientations3D(camera, path
|
|
177
|
+
var orientations = createOrientations3D(camera, path, direction, up);
|
|
208
178
|
|
|
209
179
|
var update = function(value) {
|
|
210
180
|
var time = value.time;
|
|
211
181
|
var orientation = orientations.evaluate(time);
|
|
212
182
|
Matrix3.fromQuaternion(orientation, rotMatrix);
|
|
213
183
|
|
|
214
|
-
camera.position = path.evaluate(time
|
|
184
|
+
camera.position = path.evaluate(time);
|
|
215
185
|
camera.right = Matrix3.getRow(rotMatrix, 0, camera.right);
|
|
216
186
|
camera.up = Matrix3.getRow(rotMatrix, 1, camera.up);
|
|
217
187
|
camera.direction = Cartesian3.negate(Matrix3.getRow(rotMatrix, 2, camera.direction), camera.direction);
|
|
@@ -244,28 +214,12 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
244
214
|
var middle;
|
|
245
215
|
if (end.z > maxStartAlt) {
|
|
246
216
|
middle = Cartesian3.add(Cartesian3.multiplyByScalar(Cartesian3.subtract(start, end), 0.5), end);
|
|
247
|
-
|
|
248
|
-
points = [{
|
|
249
|
-
point : start
|
|
250
|
-
}, {
|
|
251
|
-
point : middle
|
|
252
|
-
}, {
|
|
253
|
-
point : end
|
|
254
|
-
}];
|
|
217
|
+
points = [ start, middle, end ];
|
|
255
218
|
} else if (start.z > maxStartAlt) {
|
|
256
219
|
middle = Cartesian3.add(Cartesian3.multiplyByScalar(Cartesian3.subtract(start, aboveEnd), 0.5), aboveEnd);
|
|
257
|
-
|
|
258
|
-
points = [{
|
|
259
|
-
point : start
|
|
260
|
-
}, {
|
|
261
|
-
point : middle
|
|
262
|
-
}, {
|
|
263
|
-
point : end
|
|
264
|
-
}];
|
|
220
|
+
points = [ start, middle, end ];
|
|
265
221
|
} else {
|
|
266
|
-
points = [
|
|
267
|
-
point : start
|
|
268
|
-
}];
|
|
222
|
+
points = [ start ];
|
|
269
223
|
|
|
270
224
|
var v = Cartesian3.subtract(afterStart, aboveEnd);
|
|
271
225
|
var distance = Cartesian3.magnitude(v);
|
|
@@ -274,45 +228,49 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
274
228
|
var increment = incrementPercentage * distance;
|
|
275
229
|
var startCondition = distance - increment;
|
|
276
230
|
for ( var i = startCondition; i > 0.0; i = i - increment) {
|
|
277
|
-
points.push(
|
|
278
|
-
point : Cartesian3.add(Cartesian3.multiplyByScalar(v, i), aboveEnd)
|
|
279
|
-
});
|
|
231
|
+
points.push(Cartesian3.add(Cartesian3.multiplyByScalar(v, i), aboveEnd));
|
|
280
232
|
}
|
|
281
233
|
|
|
282
|
-
points.push(
|
|
283
|
-
point : end
|
|
284
|
-
});
|
|
234
|
+
points.push(end);
|
|
285
235
|
}
|
|
286
236
|
|
|
237
|
+
var times = new Array(points.length);
|
|
287
238
|
var scalar = duration / (points.length - 1);
|
|
288
239
|
for ( var k = 0; k < points.length; ++k) {
|
|
289
|
-
|
|
240
|
+
times[k] = k * scalar;
|
|
290
241
|
}
|
|
291
242
|
|
|
292
|
-
return
|
|
243
|
+
return new HermiteSpline({
|
|
244
|
+
points : points,
|
|
245
|
+
times : times
|
|
246
|
+
});
|
|
293
247
|
}
|
|
294
248
|
|
|
295
249
|
var direction2D = Cartesian3.negate(Cartesian3.UNIT_Z);
|
|
296
250
|
var right2D = Cartesian3.normalize(Cartesian3.cross(direction2D, Cartesian3.UNIT_Y));
|
|
297
251
|
var up2D = Cartesian3.cross(right2D, direction2D);
|
|
298
252
|
var quat = createQuaternion(direction2D, up2D);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
var
|
|
253
|
+
|
|
254
|
+
function createOrientations2D(camera, path, endDirection, endUp) {
|
|
255
|
+
var points = path.points;
|
|
256
|
+
var orientations = new Array(points.length);
|
|
257
|
+
orientations[0] = createQuaternion(camera.direction, camera.up);
|
|
258
|
+
|
|
302
259
|
var length = points.length - 1;
|
|
303
260
|
for (var i = 1; i < length; ++i) {
|
|
304
|
-
|
|
305
|
-
point.orientation = quat;
|
|
261
|
+
orientations[i] = quat;
|
|
306
262
|
}
|
|
307
263
|
|
|
308
|
-
point = points[length];
|
|
309
264
|
if (defined(endDirection) && defined(endUp)) {
|
|
310
|
-
|
|
265
|
+
orientations[length] = createQuaternion(endDirection, endUp);
|
|
311
266
|
} else {
|
|
312
|
-
|
|
267
|
+
orientations[length] = quat;
|
|
313
268
|
}
|
|
314
269
|
|
|
315
|
-
return new
|
|
270
|
+
return new QuaternionSpline({
|
|
271
|
+
points : orientations,
|
|
272
|
+
times : path.times
|
|
273
|
+
});
|
|
316
274
|
}
|
|
317
275
|
|
|
318
276
|
function createUpdateCV(frameState, destination, duration, direction, up) {
|
|
@@ -320,7 +278,7 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
320
278
|
var ellipsoid = frameState.scene2D.projection.getEllipsoid();
|
|
321
279
|
|
|
322
280
|
var path = createPath2D(camera, ellipsoid, Cartesian3.clone(camera.position), destination, duration);
|
|
323
|
-
var orientations = createOrientations2D(camera, path
|
|
281
|
+
var orientations = createOrientations2D(camera, path, direction, up);
|
|
324
282
|
|
|
325
283
|
var update = function(value) {
|
|
326
284
|
var time = value.time;
|
|
@@ -344,8 +302,7 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
344
302
|
start.z = camera.frustum.right - camera.frustum.left;
|
|
345
303
|
|
|
346
304
|
var path = createPath2D(camera, ellipsoid, start, destination, duration);
|
|
347
|
-
var
|
|
348
|
-
var orientations = createOrientations2D(camera, points, Cartesian3.negate(Cartesian3.UNIT_Z), up);
|
|
305
|
+
var orientations = createOrientations2D(camera, path, Cartesian3.negate(Cartesian3.UNIT_Z), up);
|
|
349
306
|
|
|
350
307
|
var height = camera.position.z;
|
|
351
308
|
|
|
@@ -354,7 +311,7 @@ define(['Core/Cartesian2', 'Core/Cartesian3', 'Core/clone', 'Core/defaultValue',
|
|
|
354
311
|
var orientation = orientations.evaluate(time);
|
|
355
312
|
Matrix3.fromQuaternion(orientation, rotMatrix);
|
|
356
313
|
|
|
357
|
-
camera.position = path.evaluate(time
|
|
314
|
+
camera.position = path.evaluate(time);
|
|
358
315
|
var zoom = camera.position.z;
|
|
359
316
|
camera.position.z = height;
|
|
360
317
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/buildModuleUrl', 'Core/combine', 'Core/loadImage', 'Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartographic', 'Core/ComponentDatatype', 'Core/Ellipsoid', 'Core/Extent', 'Core/FeatureDetection', 'Core/GeographicProjection', 'Core/Geometry', 'Core/GeometryAttribute', 'Core/Intersect', 'Core/Math', 'Core/Matrix4', 'Core/Occluder', 'Core/PrimitiveType', 'Core/Transforms', 'Renderer/BufferUsage', 'Renderer/ClearCommand', 'Renderer/CommandLists', 'Renderer/DepthFunction', 'Renderer/DrawCommand', 'Renderer/createShaderSource', 'Scene/CentralBodySurface', 'Scene/CentralBodySurfaceShaderSet', 'Scene/
|
|
2
|
+
define(['Core/buildModuleUrl', 'Core/combine', 'Core/loadImage', 'Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartographic', 'Core/ComponentDatatype', 'Core/Ellipsoid', 'Core/Extent', 'Core/FeatureDetection', 'Core/GeographicProjection', 'Core/Geometry', 'Core/GeometryAttribute', 'Core/Intersect', 'Core/Math', 'Core/Matrix4', 'Core/Occluder', 'Core/PrimitiveType', 'Core/Transforms', 'Renderer/BufferUsage', 'Renderer/ClearCommand', 'Renderer/CommandLists', 'Renderer/DepthFunction', 'Renderer/DrawCommand', 'Renderer/createShaderSource', 'Scene/CentralBodySurface', 'Scene/CentralBodySurfaceShaderSet', 'Scene/EllipsoidTerrainProvider', 'Scene/ImageryLayerCollection', 'Scene/SceneMode', 'Scene/TerrainProvider', 'Shaders/CentralBodyFS', 'Shaders/CentralBodyFSDepth', 'Shaders/CentralBodyFSPole', 'Shaders/CentralBodyVS', 'Shaders/CentralBodyVSDepth', 'Shaders/CentralBodyVSPole', 'ThirdParty/when'], function(
|
|
3
3
|
buildModuleUrl,
|
|
4
4
|
combine,
|
|
5
5
|
loadImage,
|
|
@@ -32,13 +32,10 @@ define(['Core/buildModuleUrl', 'Core/combine', 'Core/loadImage', 'Core/defaultVa
|
|
|
32
32
|
createShaderSource,
|
|
33
33
|
CentralBodySurface,
|
|
34
34
|
CentralBodySurfaceShaderSet,
|
|
35
|
-
CreditDisplay,
|
|
36
35
|
EllipsoidTerrainProvider,
|
|
37
36
|
ImageryLayerCollection,
|
|
38
|
-
Material,
|
|
39
37
|
SceneMode,
|
|
40
38
|
TerrainProvider,
|
|
41
|
-
ViewportQuad,
|
|
42
39
|
CentralBodyFS,
|
|
43
40
|
CentralBodyFSDepth,
|
|
44
41
|
CentralBodyFSPole,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', 'Core/FeatureDetection', 'Core/DeveloperError', 'Core/
|
|
2
|
+
define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', 'Core/FeatureDetection', 'Core/DeveloperError', 'Core/EllipsoidalOccluder', 'Core/Intersect', 'Core/Matrix4', 'Core/PrimitiveType', 'Core/Queue', 'Core/WebMercatorProjection', 'Renderer/DrawCommand', 'Scene/ImageryLayer', 'Scene/ImageryState', 'Scene/SceneMode', 'Scene/TerrainProvider', 'Scene/TileReplacementQueue', 'Scene/TileState', 'ThirdParty/when'], function(
|
|
3
3
|
defaultValue,
|
|
4
4
|
defined,
|
|
5
5
|
destroyObject,
|
|
@@ -9,7 +9,6 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Boundin
|
|
|
9
9
|
Cartesian4,
|
|
10
10
|
FeatureDetection,
|
|
11
11
|
DeveloperError,
|
|
12
|
-
Ellipsoid,
|
|
13
12
|
EllipsoidalOccluder,
|
|
14
13
|
Intersect,
|
|
15
14
|
Matrix4,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/defaultValue', 'Core/defined', 'Core/loadArrayBuffer', 'Core/throttleRequestByServer', 'Core/
|
|
2
|
+
define(['Core/defaultValue', 'Core/defined', 'Core/loadArrayBuffer', 'Core/throttleRequestByServer', 'Core/DeveloperError', 'Core/Event', 'Scene/Credit', 'Scene/GeographicTilingScheme', 'Scene/HeightmapTerrainData', 'Scene/TerrainProvider', 'ThirdParty/when'], function(
|
|
3
3
|
defaultValue,
|
|
4
4
|
defined,
|
|
5
5
|
loadArrayBuffer,
|
|
6
6
|
throttleRequestByServer,
|
|
7
|
-
writeTextToCanvas,
|
|
8
7
|
DeveloperError,
|
|
9
8
|
Event,
|
|
10
9
|
Credit,
|
|
@@ -49,8 +49,11 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
|
|
|
49
49
|
this._pickCommand = new DrawCommand();
|
|
50
50
|
this._commandLists = new CommandLists();
|
|
51
51
|
|
|
52
|
+
this._boundingSphere = new BoundingSphere();
|
|
53
|
+
this._boundingSphereWC = new BoundingSphere();
|
|
54
|
+
|
|
52
55
|
this._frontFaceColorCommand.primitiveType = PrimitiveType.TRIANGLES;
|
|
53
|
-
this._frontFaceColorCommand.boundingVolume =
|
|
56
|
+
this._frontFaceColorCommand.boundingVolume = this._boundingSphereWC;
|
|
54
57
|
this._frontFaceColorCommand.owner = this;
|
|
55
58
|
|
|
56
59
|
this._backFaceColorCommand.primitiveType = this._frontFaceColorCommand.primitiveType;
|
|
@@ -117,6 +120,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
|
|
|
117
120
|
* sensor.modelMatrix = Transforms.eastNorthUpToFixedFrame(center);
|
|
118
121
|
*/
|
|
119
122
|
this.modelMatrix = Matrix4.clone(defaultValue(options.modelMatrix, Matrix4.IDENTITY));
|
|
123
|
+
this._modelMatrix = new Matrix4();
|
|
120
124
|
|
|
121
125
|
/**
|
|
122
126
|
* DOC_TBA
|
|
@@ -268,7 +272,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
|
|
|
268
272
|
boundingVolumePositions.push(p);
|
|
269
273
|
}
|
|
270
274
|
|
|
271
|
-
BoundingSphere.fromPoints(boundingVolumePositions, customSensorVolume.
|
|
275
|
+
BoundingSphere.fromPoints(boundingVolumePositions, customSensorVolume._boundingSphere);
|
|
272
276
|
|
|
273
277
|
return positions;
|
|
274
278
|
}
|
|
@@ -423,7 +427,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
|
|
|
423
427
|
}
|
|
424
428
|
|
|
425
429
|
// Recreate vertex buffer when directions change
|
|
426
|
-
|
|
430
|
+
var directionsChanged = this._directionsDirty || (this._bufferUsage !== this.bufferUsage);
|
|
431
|
+
if (directionsChanged) {
|
|
427
432
|
this._directionsDirty = false;
|
|
428
433
|
this._bufferUsage = this.bufferUsage;
|
|
429
434
|
this._va = this._va && this._va.destroy();
|
|
@@ -443,6 +448,15 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
|
|
|
443
448
|
var pass = frameState.passes;
|
|
444
449
|
this._commandLists.removeAll();
|
|
445
450
|
|
|
451
|
+
var modelMatrixChanged = !Matrix4.equals(this.modelMatrix, this._modelMatrix);
|
|
452
|
+
if (modelMatrixChanged) {
|
|
453
|
+
Matrix4.clone(this.modelMatrix, this._modelMatrix);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (directionsChanged || modelMatrixChanged) {
|
|
457
|
+
BoundingSphere.transform(this._boundingSphere, this.modelMatrix, this._boundingSphereWC);
|
|
458
|
+
}
|
|
459
|
+
|
|
446
460
|
this._frontFaceColorCommand.modelMatrix = this.modelMatrix;
|
|
447
461
|
this._backFaceColorCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix;
|
|
448
462
|
this._pickCommand.modelMatrix = this._frontFaceColorCommand.modelMatrix;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/
|
|
2
|
+
define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/combine', 'Core/defined', 'Core/DeveloperError', 'Core/destroyObject', 'Core/Matrix4', 'Core/BoundingSphere', 'Core/PrimitiveType', 'Renderer/CullFace', 'Renderer/BlendingState', 'Renderer/BufferUsage', 'Renderer/CommandLists', 'Renderer/DrawCommand', 'Renderer/createShaderSource', 'Scene/Material', 'Scene/SceneMode', 'Shaders/EllipsoidVS', 'Shaders/EllipsoidFS'], function(
|
|
3
3
|
defaultValue,
|
|
4
4
|
BoxGeometry,
|
|
5
5
|
Cartesian3,
|
|
6
|
-
Cartesian4,
|
|
7
6
|
combine,
|
|
8
7
|
defined,
|
|
9
8
|
DeveloperError,
|
|
@@ -78,6 +77,7 @@ define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/Cartes
|
|
|
78
77
|
* @see EllipsoidPrimitive#modelMatrix
|
|
79
78
|
*/
|
|
80
79
|
this.center = Cartesian3.clone(defaultValue(options.center, Cartesian3.ZERO));
|
|
80
|
+
this._center = new Cartesian3();
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* The radius of the ellipsoid along the <code>x</code>, <code>y</code>, and <code>z</code> axes in the ellipsoid's model coordinates.
|
|
@@ -120,6 +120,7 @@ define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/Cartes
|
|
|
120
120
|
* @see czm_model
|
|
121
121
|
*/
|
|
122
122
|
this.modelMatrix = Matrix4.clone(defaultValue(options.modelMatrix, Matrix4.IDENTITY));
|
|
123
|
+
this._modelMatrix = new Matrix4();
|
|
123
124
|
this._computedModelMatrix = new Matrix4();
|
|
124
125
|
|
|
125
126
|
/**
|
|
@@ -281,6 +282,8 @@ define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/Cartes
|
|
|
281
282
|
this._va = getVertexArray(context);
|
|
282
283
|
}
|
|
283
284
|
|
|
285
|
+
var boundingSphereDirty = false;
|
|
286
|
+
|
|
284
287
|
var radii = this.radii;
|
|
285
288
|
if (!Cartesian3.equals(this._radii, radii)) {
|
|
286
289
|
Cartesian3.clone(radii, this._radii);
|
|
@@ -290,11 +293,23 @@ define(['Core/defaultValue', 'Core/BoxGeometry', 'Core/Cartesian3', 'Core/Cartes
|
|
|
290
293
|
r.y = 1.0 / (radii.y * radii.y);
|
|
291
294
|
r.z = 1.0 / (radii.z * radii.z);
|
|
292
295
|
|
|
293
|
-
|
|
296
|
+
boundingSphereDirty = true;
|
|
294
297
|
}
|
|
295
298
|
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
if (!Matrix4.equals(this.modelMatrix, this._modelMatrix) || !Cartesian3.equals(this.center, this._center)) {
|
|
300
|
+
Matrix4.clone(this.modelMatrix, this._modelMatrix);
|
|
301
|
+
Cartesian3.clone(this.center, this._center);
|
|
302
|
+
|
|
303
|
+
// Translate model coordinates used for rendering such that the origin is the center of the ellipsoid.
|
|
304
|
+
Matrix4.multiplyByTranslation(this.modelMatrix, this.center, this._computedModelMatrix);
|
|
305
|
+
boundingSphereDirty = true;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (boundingSphereDirty) {
|
|
309
|
+
Cartesian3.clone(Cartesian3.ZERO, this._boundingSphere.center);
|
|
310
|
+
this._boundingSphere.radius = Cartesian3.getMaximumComponent(radii);
|
|
311
|
+
BoundingSphere.transform(this._boundingSphere, this._computedModelMatrix, this._boundingSphere);
|
|
312
|
+
}
|
|
298
313
|
|
|
299
314
|
var ellipsoidCommandLists = this._commandLists;
|
|
300
315
|
ellipsoidCommandLists.removeAll();
|