cesium 0.21 → 0.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/Assets/Textures/moonSmall.jpg +0 -0
- data/app/assets/javascripts/Cesium.js +10 -1
- data/app/assets/javascripts/Core/Cartesian2.js +28 -0
- data/app/assets/javascripts/Core/Cartesian3.js +28 -0
- data/app/assets/javascripts/Core/Cartesian4.js +28 -0
- data/app/assets/javascripts/Core/CatmullRomSpline.js +3 -3
- data/app/assets/javascripts/Core/Clock.js +7 -7
- data/app/assets/javascripts/Core/Color.js +1 -1
- data/app/assets/javascripts/Core/ComponentDatatype.js +11 -7
- data/app/assets/javascripts/Core/CorridorGeometryLibrary.js +23 -29
- data/app/assets/javascripts/Core/Ellipsoid.js +6 -0
- data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +5 -4
- data/app/assets/javascripts/Core/Event.js +2 -1
- data/app/assets/javascripts/Core/ExtentGeometry.js +1 -1
- data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +1 -1
- data/app/assets/javascripts/Core/GeometryAttributes.js +1 -1
- data/app/assets/javascripts/Core/GeometryInstance.js +2 -2
- data/app/assets/javascripts/Core/GeometryPipeline.js +10 -7
- data/app/assets/javascripts/Core/HermiteSpline.js +1 -1
- data/app/assets/javascripts/Core/Iau2000Orientation.js +132 -0
- data/app/assets/javascripts/Core/IauOrientationAxes.js +98 -0
- data/app/assets/javascripts/Core/IauOrientationParameters.js +48 -0
- data/app/assets/javascripts/Core/IntersectionTests.js +5 -5
- data/app/assets/javascripts/Core/JulianDate.js +27 -5
- data/app/assets/javascripts/Core/Math.js +9 -0
- data/app/assets/javascripts/Core/Matrix2.js +1 -142
- data/app/assets/javascripts/Core/Matrix3.js +168 -153
- data/app/assets/javascripts/Core/Matrix4.js +0 -249
- data/app/assets/javascripts/Core/NearFarScalar.js +13 -0
- data/app/assets/javascripts/Core/PolygonGeometry.js +1 -1
- data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +2 -2
- data/app/assets/javascripts/Core/PolygonPipeline.js +2 -2
- data/app/assets/javascripts/Core/PolylinePipeline.js +7 -3
- data/app/assets/javascripts/Core/PolylineVolumeGeometry.js +239 -0
- data/app/assets/javascripts/Core/PolylineVolumeGeometryLibrary.js +404 -0
- data/app/assets/javascripts/Core/PolylineVolumeOutlineGeometry.js +154 -0
- data/app/assets/javascripts/Core/Quaternion.js +37 -10
- data/app/assets/javascripts/Core/Shapes.js +26 -2
- data/app/assets/javascripts/Core/Simon1994PlanetaryPositions.js +3 -3
- data/app/assets/javascripts/Core/TimeInterval.js +28 -17
- data/app/assets/javascripts/Core/TimeIntervalCollection.js +30 -0
- data/app/assets/javascripts/Core/Transforms.js +5 -5
- data/app/assets/javascripts/Core/WallGeometryLibrary.js +2 -2
- data/app/assets/javascripts/Core/getFilenameFromUri.js +37 -0
- data/app/assets/javascripts/DynamicScene/ColorMaterialProperty.js +2 -2
- data/app/assets/javascripts/DynamicScene/CzmlDataSource.js +96 -18
- data/app/assets/javascripts/DynamicScene/DataSource.js +8 -0
- data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +15 -3
- data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +6 -1
- data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +1 -1
- data/app/assets/javascripts/DynamicScene/DynamicLabel.js +12 -1
- data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +5 -0
- data/app/assets/javascripts/DynamicScene/DynamicObject.js +44 -17
- data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +3 -3
- data/app/assets/javascripts/DynamicScene/DynamicPoint.js +12 -1
- data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +11 -2
- data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +10 -30
- data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +5 -20
- data/app/assets/javascripts/DynamicScene/GeoJsonDataSource.js +26 -8
- data/app/assets/javascripts/DynamicScene/GridMaterialProperty.js +2 -2
- data/app/assets/javascripts/DynamicScene/ImageMaterialProperty.js +2 -2
- data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +66 -0
- data/app/assets/javascripts/DynamicScene/PositionProperty.js +3 -3
- data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +1 -1
- data/app/assets/javascripts/DynamicScene/SampledProperty.js +14 -8
- data/app/assets/javascripts/Renderer/AutomaticUniforms.js +4 -3
- data/app/assets/javascripts/Renderer/Context.js +16 -2
- data/app/assets/javascripts/Renderer/UniformState.js +14 -14
- data/app/assets/javascripts/Scene/Billboard.js +102 -26
- data/app/assets/javascripts/Scene/BillboardCollection.js +69 -16
- data/app/assets/javascripts/Scene/Camera.js +7 -7
- data/app/assets/javascripts/Scene/CameraController.js +23 -12
- data/app/assets/javascripts/Scene/CameraFlightPath.js +11 -11
- data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -1
- data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -2
- data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +79 -24
- data/app/assets/javascripts/Scene/ExtentPrimitive.js +17 -1
- data/app/assets/javascripts/Scene/Label.js +94 -18
- data/app/assets/javascripts/Scene/LabelCollection.js +6 -2
- data/app/assets/javascripts/Scene/Moon.js +150 -0
- data/app/assets/javascripts/Scene/Polygon.js +18 -1
- data/app/assets/javascripts/Scene/Polyline.js +32 -13
- data/app/assets/javascripts/Scene/PolylineCollection.js +7 -6
- data/app/assets/javascripts/Scene/Primitive.js +2 -2
- data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +12 -0
- data/app/assets/javascripts/Scene/Scene.js +122 -14
- data/app/assets/javascripts/Scene/SceneTransforms.js +2 -2
- data/app/assets/javascripts/Scene/SceneTransitioner.js +4 -4
- data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1 -1
- data/app/assets/javascripts/Scene/SkyBox.js +53 -48
- data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +2 -2
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +36 -14
- data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +27 -9
- data/app/assets/javascripts/Shaders/Builtin/Functions/phong.glsl +13 -0
- data/app/assets/javascripts/Shaders/Builtin/Functions/phong.js +10 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +24 -0
- data/app/assets/javascripts/Shaders/EllipsoidFS.js +21 -1
- data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +30 -9
- data/app/assets/javascripts/Widgets/HomeButton/HomeButtonViewModel.js +6 -5
- data/app/assets/javascripts/Widgets/Viewer/Viewer.js +13 -0
- data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +46 -4
- data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +16 -8
- data/app/assets/javascripts/Workers/createPolylineVolumeGeometry.js +23 -0
- data/app/assets/javascripts/Workers/createPolylineVolumeOutlineGeometry.js +23 -0
- data/lib/cesium/version.rb +1 -1
- metadata +15 -5
- data/test/dummy/tmp/pids/server.pid +0 -1
@@ -20,24 +20,26 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
20
20
|
*
|
21
21
|
* @demo <a href="http://cesium.agi.com/Cesium/Apps/Sandcastle/index.html?src=Polylines.html">Cesium Sandcastle Polyline Demo</a>
|
22
22
|
*/
|
23
|
-
var Polyline = function(
|
24
|
-
|
23
|
+
var Polyline = function(options, polylineCollection) {
|
24
|
+
options = defaultValue(options, EMPTY_OBJECT);
|
25
25
|
|
26
|
-
this._show = defaultValue(
|
27
|
-
this._width = defaultValue(
|
26
|
+
this._show = defaultValue(options.show, true);
|
27
|
+
this._width = defaultValue(options.width, 1.0);
|
28
28
|
|
29
|
-
this._material =
|
29
|
+
this._material = options.material;
|
30
30
|
if (!defined(this._material)) {
|
31
31
|
this._material = Material.fromType(Material.ColorType);
|
32
32
|
this._material.uniforms.color = new Color(1.0, 1.0, 1.0, 1.0);
|
33
33
|
}
|
34
34
|
|
35
|
-
var positions =
|
35
|
+
var positions = options.positions;
|
36
36
|
if (!defined(positions)) {
|
37
37
|
positions = [];
|
38
38
|
}
|
39
39
|
|
40
40
|
this._positions = positions;
|
41
|
+
this._length = positions.length;
|
42
|
+
this._id = options.id;
|
41
43
|
|
42
44
|
var modelMatrix;
|
43
45
|
if (defined(this._polylineCollection)) {
|
@@ -53,7 +55,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
53
55
|
this._polylineCollection = polylineCollection;
|
54
56
|
this._dirty = false;
|
55
57
|
this._pickId = undefined;
|
56
|
-
this._pickIdThis =
|
58
|
+
this._pickIdThis = options._pickIdThis;
|
57
59
|
this._boundingVolume = BoundingSphere.fromPoints(this._positions);
|
58
60
|
this._boundingVolume2D = new BoundingSphere(); // modified in PolylineCollection
|
59
61
|
};
|
@@ -149,11 +151,12 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
149
151
|
throw new DeveloperError('value is required.');
|
150
152
|
}
|
151
153
|
|
152
|
-
if (this._positions.length !== value.length) {
|
154
|
+
if (this._positions.length !== value.length || this._positions.length !== this._length) {
|
153
155
|
makeDirty(this, POSITION_SIZE_INDEX);
|
154
156
|
}
|
155
157
|
|
156
158
|
this._positions = value;
|
159
|
+
this._length = value.length;
|
157
160
|
this._boundingVolume = BoundingSphere.fromPoints(this._positions, this._boundingVolume);
|
158
161
|
makeDirty(this, POSITION_INDEX);
|
159
162
|
|
@@ -173,7 +176,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
173
176
|
var segmentLengths = this._segments.lengths;
|
174
177
|
|
175
178
|
var positionsChanged = this._propertiesChanged[POSITION_INDEX] > 0 || this._propertiesChanged[POSITION_SIZE_INDEX] > 0;
|
176
|
-
if (!
|
179
|
+
if (!Matrix4.equals(modelMatrix, this._modelMatrix) || positionsChanged) {
|
177
180
|
this._segments = PolylinePipeline.wrapLongitude(this._positions, modelMatrix);
|
178
181
|
}
|
179
182
|
|
@@ -222,9 +225,10 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
222
225
|
if (!defined(material)) {
|
223
226
|
throw new DeveloperError('material is required.');
|
224
227
|
}
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
+
if (this._material !== material) {
|
229
|
+
this._material = material;
|
230
|
+
makeDirty(this, MATERIAL_INDEX);
|
231
|
+
}
|
228
232
|
};
|
229
233
|
|
230
234
|
/**
|
@@ -271,10 +275,25 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Boundi
|
|
271
275
|
}
|
272
276
|
};
|
273
277
|
|
278
|
+
/**
|
279
|
+
* Returns the user-defined object returned when the polyline is picked.
|
280
|
+
*
|
281
|
+
* @memberof Polyline
|
282
|
+
*
|
283
|
+
* @returns {Object} The user-defined object returned when the polyline is picked.
|
284
|
+
*/
|
285
|
+
Polyline.prototype.getId = function() {
|
286
|
+
return this._id;
|
287
|
+
};
|
288
|
+
|
289
|
+
/**
|
290
|
+
* @private
|
291
|
+
*/
|
274
292
|
Polyline.prototype.getPickId = function(context) {
|
275
293
|
if (!defined(this._pickId)) {
|
276
294
|
this._pickId = context.createPickId({
|
277
|
-
primitive : defaultValue(this._pickIdThis, this)
|
295
|
+
primitive : defaultValue(this._pickIdThis, this),
|
296
|
+
id : this._id
|
278
297
|
});
|
279
298
|
}
|
280
299
|
return this._pickId;
|
@@ -114,8 +114,8 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/combine', 'Co
|
|
114
114
|
* @see Transforms.eastNorthUpToFixedFrame
|
115
115
|
* @see czm_model
|
116
116
|
*/
|
117
|
-
this.modelMatrix = Matrix4.
|
118
|
-
this._modelMatrix = Matrix4.
|
117
|
+
this.modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
|
118
|
+
this._modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
|
119
119
|
|
120
120
|
this._rs = undefined;
|
121
121
|
|
@@ -401,6 +401,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/combine', 'Co
|
|
401
401
|
this._polylinesUpdated = false;
|
402
402
|
}
|
403
403
|
|
404
|
+
properties = this._propertiesChanged;
|
404
405
|
for ( var k = 0; k < NUMBER_OF_PROPERTIES; ++k) {
|
405
406
|
properties[k] = 0;
|
406
407
|
}
|
@@ -477,7 +478,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/combine', 'Co
|
|
477
478
|
var polyline = polylines[s];
|
478
479
|
var mId = createMaterialId(polyline._material);
|
479
480
|
if (mId !== currentId) {
|
480
|
-
if (defined(currentId)) {
|
481
|
+
if (defined(currentId) && count > 0) {
|
481
482
|
if (commandIndex >= commandsLength) {
|
482
483
|
command = new DrawCommand();
|
483
484
|
command.owner = polylineCollection;
|
@@ -918,10 +919,10 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/combine', 'Co
|
|
918
919
|
var mode = frameState.mode;
|
919
920
|
var projection = frameState.scene2D.projection;
|
920
921
|
|
921
|
-
if (collection._mode !== mode || (collection._projection !== projection) || (!
|
922
|
+
if (collection._mode !== mode || (collection._projection !== projection) || (!Matrix4.equals(collection._modelMatrix, collection.modelMatrix))) {
|
922
923
|
collection._mode = mode;
|
923
924
|
collection._projection = projection;
|
924
|
-
collection._modelMatrix = collection.modelMatrix
|
925
|
+
collection._modelMatrix = Matrix4.clone(collection.modelMatrix);
|
925
926
|
collection._createVertexArray = true;
|
926
927
|
}
|
927
928
|
}
|
@@ -1330,7 +1331,7 @@ define(['Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/combine', 'Co
|
|
1330
1331
|
|
1331
1332
|
for ( var n = 0; n < length; ++n) {
|
1332
1333
|
position = positions[n];
|
1333
|
-
p =
|
1334
|
+
p = Matrix4.multiplyByPoint(modelMatrix, position);
|
1334
1335
|
newPositions.push(projection.project(ellipsoid.cartesianToCartographic(Cartesian3.fromCartesian4(p))));
|
1335
1336
|
}
|
1336
1337
|
|
@@ -41,7 +41,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/defineProperties', 'Core/Deve
|
|
41
41
|
* </p>
|
42
42
|
* <p>
|
43
43
|
* Combining multiple instances into one primitive is called batching, and significantly improves performance for static data.
|
44
|
-
* Instances can be individually picked; {@link
|
44
|
+
* Instances can be individually picked; {@link Scene#pick} returns their {@link GeometryInstance#id}. Using
|
45
45
|
* per-instance appearances like {@link PerInstanceColorAppearance}, each instance can also have a unique color.
|
46
46
|
* </p>
|
47
47
|
* <p>
|
@@ -195,7 +195,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/defineProperties', 'Core/Deve
|
|
195
195
|
*
|
196
196
|
* @see czm_model
|
197
197
|
*/
|
198
|
-
this.modelMatrix = Matrix4.
|
198
|
+
this.modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
|
199
199
|
|
200
200
|
/**
|
201
201
|
* Determines if the primitive will be shown. This affects all geometry
|
@@ -159,6 +159,17 @@ define(['Core/clone', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/d
|
|
159
159
|
*/
|
160
160
|
this.intersectionWidth = defaultValue(options.intersectionWidth, 5.0);
|
161
161
|
|
162
|
+
/**
|
163
|
+
* User-defined object returned when the sensors is picked.
|
164
|
+
*
|
165
|
+
* @type Object
|
166
|
+
*
|
167
|
+
* @default undefined
|
168
|
+
*
|
169
|
+
* @see Scene#pick
|
170
|
+
*/
|
171
|
+
this.id = options.id;
|
172
|
+
|
162
173
|
var customSensorOptions = clone(options);
|
163
174
|
customSensorOptions._pickIdThis = defaultValue(options._pickIdThis, this);
|
164
175
|
this._customSensor = new CustomSensorVolume(customSensorOptions);
|
@@ -188,6 +199,7 @@ define(['Core/clone', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/d
|
|
188
199
|
s.material = this.material;
|
189
200
|
s.intersectionColor = this.intersectionColor;
|
190
201
|
s.intersectionWidth = this.intersectionWidth;
|
202
|
+
s.id = this.id;
|
191
203
|
|
192
204
|
if ((this._xHalfAngle !== this.xHalfAngle) || (this._yHalfAngle !== this.yHalfAngle)) {
|
193
205
|
|
@@ -1,10 +1,11 @@
|
|
1
1
|
/*global define*/
|
2
|
-
define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/GeographicProjection', 'Core/Ellipsoid', 'Core/Occluder', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Intersect', 'Core/Interval', 'Core/Matrix4', 'Core/JulianDate', 'Core/EllipsoidGeometry', 'Core/GeometryInstance', 'Core/GeometryPipeline', 'Core/ColorGeometryInstanceAttribute', 'Renderer/Context', 'Renderer/ClearCommand', 'Renderer/PassState', 'Scene/Camera', 'Scene/ScreenSpaceCameraController', 'Scene/CompositePrimitive', 'Scene/CullingVolume', 'Scene/AnimationCollection', 'Scene/SceneMode', 'Scene/SceneTransforms', 'Scene/FrameState', 'Scene/OrthographicFrustum', 'Scene/PerspectiveOffCenterFrustum', 'Scene/FrustumCommands', 'Scene/Primitive', 'Scene/PerInstanceColorAppearance', 'Scene/SunPostProcess', 'Scene/CreditDisplay'], function(
|
2
|
+
define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/DeveloperError', 'Core/GeographicProjection', 'Core/Ellipsoid', 'Core/Occluder', 'Core/BoundingRectangle', 'Core/BoundingSphere', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Intersect', 'Core/Interval', 'Core/Matrix4', 'Core/JulianDate', 'Core/EllipsoidGeometry', 'Core/GeometryInstance', 'Core/GeometryPipeline', 'Core/ColorGeometryInstanceAttribute', 'Core/ShowGeometryInstanceAttribute', 'Renderer/Context', 'Renderer/ClearCommand', 'Renderer/PassState', 'Scene/Camera', 'Scene/ScreenSpaceCameraController', 'Scene/CompositePrimitive', 'Scene/CullingVolume', 'Scene/AnimationCollection', 'Scene/SceneMode', 'Scene/SceneTransforms', 'Scene/FrameState', 'Scene/OrthographicFrustum', 'Scene/PerspectiveOffCenterFrustum', 'Scene/FrustumCommands', 'Scene/Primitive', 'Scene/PerInstanceColorAppearance', 'Scene/SunPostProcess', 'Scene/CreditDisplay'], function(
|
3
3
|
CesiumMath,
|
4
4
|
Color,
|
5
5
|
defaultValue,
|
6
6
|
defined,
|
7
7
|
destroyObject,
|
8
|
+
DeveloperError,
|
8
9
|
GeographicProjection,
|
9
10
|
Ellipsoid,
|
10
11
|
Occluder,
|
@@ -20,6 +21,7 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
20
21
|
GeometryInstance,
|
21
22
|
GeometryPipeline,
|
22
23
|
ColorGeometryInstanceAttribute,
|
24
|
+
ShowGeometryInstanceAttribute,
|
23
25
|
Context,
|
24
26
|
ClearCommand,
|
25
27
|
PassState,
|
@@ -140,6 +142,14 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
140
142
|
this.sunBloom = true;
|
141
143
|
this._sunBloom = undefined;
|
142
144
|
|
145
|
+
/**
|
146
|
+
* The {@link Moon}
|
147
|
+
*
|
148
|
+
* @type Moon
|
149
|
+
* @default undefined
|
150
|
+
*/
|
151
|
+
this.moon = undefined;
|
152
|
+
|
143
153
|
/**
|
144
154
|
* The background color, which is only visible if there is no sky box, i.e., {@link Scene#skyBox} is undefined.
|
145
155
|
*
|
@@ -148,7 +158,7 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
148
158
|
*
|
149
159
|
* @see Scene#skyBox
|
150
160
|
*/
|
151
|
-
this.backgroundColor = Color.
|
161
|
+
this.backgroundColor = Color.clone(Color.BLACK);
|
152
162
|
|
153
163
|
/**
|
154
164
|
* The current mode of the scene.
|
@@ -602,7 +612,11 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
602
612
|
}
|
603
613
|
}
|
604
614
|
|
605
|
-
function
|
615
|
+
function isVisible(command, frameState) {
|
616
|
+
if (!defined(command)) {
|
617
|
+
return;
|
618
|
+
}
|
619
|
+
|
606
620
|
var occluder = (frameState.mode === SceneMode.SCENE3D) ? frameState.occluder: undefined;
|
607
621
|
var cullingVolume = frameState.cullingVolume;
|
608
622
|
|
@@ -613,11 +627,14 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
613
627
|
}
|
614
628
|
cullingVolume = scratchCullingVolume;
|
615
629
|
|
630
|
+
var modelMatrix = defaultValue(command.modelMatrix, Matrix4.IDENTITY);
|
631
|
+
var transformedBV = command.boundingVolume.transform(modelMatrix); //TODO: Remove this allocation.
|
632
|
+
|
616
633
|
return ((defined(command)) &&
|
617
634
|
((!defined(command.boundingVolume)) ||
|
618
635
|
!command.cull ||
|
619
|
-
((cullingVolume.getVisibility(
|
620
|
-
(!defined(occluder) || occluder.isBoundingSphereVisible(
|
636
|
+
((cullingVolume.getVisibility(transformedBV) !== Intersect.OUTSIDE) &&
|
637
|
+
(!defined(occluder) || occluder.isBoundingSphereVisible(transformedBV)))));
|
621
638
|
}
|
622
639
|
|
623
640
|
function executeCommands(scene, passState, clearColor) {
|
@@ -643,7 +660,8 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
643
660
|
var skyBoxCommand = (frameState.passes.color && defined(scene.skyBox)) ? scene.skyBox.update(context, frameState) : undefined;
|
644
661
|
var skyAtmosphereCommand = (frameState.passes.color && defined(scene.skyAtmosphere)) ? scene.skyAtmosphere.update(context, frameState) : undefined;
|
645
662
|
var sunCommand = (frameState.passes.color && defined(scene.sun)) ? scene.sun.update(context, frameState) : undefined;
|
646
|
-
var sunVisible =
|
663
|
+
var sunVisible = isVisible(sunCommand, frameState);
|
664
|
+
|
647
665
|
|
648
666
|
if (sunVisible && scene.sunBloom) {
|
649
667
|
passState.framebuffer = scene._sunPostProcess.update(context);
|
@@ -715,6 +733,18 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
715
733
|
}
|
716
734
|
}
|
717
735
|
|
736
|
+
function updatePrimitives(scene) {
|
737
|
+
var context = scene._context;
|
738
|
+
var frameState = scene._frameState;
|
739
|
+
var commandList = scene._commandList;
|
740
|
+
|
741
|
+
scene._primitives.update(context, frameState, commandList);
|
742
|
+
|
743
|
+
if (defined(scene.moon)) {
|
744
|
+
scene.moon.update(context, frameState, commandList);
|
745
|
+
}
|
746
|
+
}
|
747
|
+
|
718
748
|
/**
|
719
749
|
* DOC_TBA
|
720
750
|
* @memberof Scene
|
@@ -750,12 +780,10 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
750
780
|
frameState.creditDisplay.beginFrame();
|
751
781
|
|
752
782
|
var context = this._context;
|
753
|
-
|
754
783
|
us.update(context, frameState);
|
755
784
|
|
756
785
|
this._commandList.length = 0;
|
757
|
-
|
758
|
-
|
786
|
+
updatePrimitives(this);
|
759
787
|
createPotentiallyVisibleSet(this, 'colorList');
|
760
788
|
|
761
789
|
var passState = this._passState;
|
@@ -847,12 +875,26 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
847
875
|
var scratchColorZero = new Color(0.0, 0.0, 0.0, 0.0);
|
848
876
|
|
849
877
|
/**
|
850
|
-
*
|
878
|
+
* Returns an object with a `primitive` property that contains the first (top) primitive in the scene
|
879
|
+
* at a particular window coordinate or undefined if nothing is at the location. Other properties may
|
880
|
+
* potentially be set depending on the type of primitive.
|
881
|
+
*
|
851
882
|
* @memberof Scene
|
883
|
+
*
|
884
|
+
* @param {Cartesian2} windowPosition Window coordinates to perform picking on.
|
885
|
+
*
|
886
|
+
* @returns {Object} Object containing the picked primitive.
|
887
|
+
*
|
888
|
+
* @exception {DeveloperError} windowPosition is undefined.
|
889
|
+
*
|
852
890
|
*/
|
853
891
|
Scene.prototype.pick = function(windowPosition) {
|
892
|
+
if(!defined(windowPosition)) {
|
893
|
+
throw new DeveloperError('windowPosition is undefined.');
|
894
|
+
}
|
895
|
+
|
854
896
|
var context = this._context;
|
855
|
-
var
|
897
|
+
var us = this.getUniformState();
|
856
898
|
var frameState = this._frameState;
|
857
899
|
|
858
900
|
var drawingBufferPosition = SceneTransforms.transformWindowToDrawingBuffer(context, windowPosition);
|
@@ -866,9 +908,10 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
866
908
|
frameState.cullingVolume = getPickCullingVolume(this, drawingBufferPosition, rectangleWidth, rectangleHeight);
|
867
909
|
frameState.passes.pick = true;
|
868
910
|
|
869
|
-
|
870
|
-
|
871
|
-
|
911
|
+
us.update(context, frameState);
|
912
|
+
|
913
|
+
this._commandList.length = 0;
|
914
|
+
updatePrimitives(this);
|
872
915
|
createPotentiallyVisibleSet(this, 'pickList');
|
873
916
|
|
874
917
|
scratchRectangle.x = drawingBufferPosition.x - ((rectangleWidth - 1.0) * 0.5);
|
@@ -880,6 +923,71 @@ define(['Core/Math', 'Core/Color', 'Core/defaultValue', 'Core/defined', 'Core/de
|
|
880
923
|
return object;
|
881
924
|
};
|
882
925
|
|
926
|
+
/**
|
927
|
+
* Returns a list of objects, each containing a `primitive` property, for all primitives at
|
928
|
+
* a particular window coordinate position. Other properties may also be set depending on the
|
929
|
+
* type of primitive. The primitives in the list are ordered by their visual order in the
|
930
|
+
* scene (front to back).
|
931
|
+
*
|
932
|
+
* @memberof Scene
|
933
|
+
*
|
934
|
+
* @param {Cartesian2} windowPosition Window coordinates to perform picking on.
|
935
|
+
*
|
936
|
+
* @returns {Array} Array of objects, each containing 1 picked primitives.
|
937
|
+
*
|
938
|
+
* @exception {DeveloperError} windowPosition is undefined.
|
939
|
+
*
|
940
|
+
* @example
|
941
|
+
* var pickedObjects = Scene.drillPick(new Cartesian2(100.0, 200.0));
|
942
|
+
*/
|
943
|
+
Scene.prototype.drillPick = function(windowPosition) {
|
944
|
+
// PERFORMANCE_IDEA: This function calls each primitive's update for each pass. Instead
|
945
|
+
// we could update the primitive once, and then just execute their commands for each pass,
|
946
|
+
// and cull commands for picked primitives. e.g., base on the command's owner.
|
947
|
+
if (!defined(windowPosition)) {
|
948
|
+
throw new DeveloperError('windowPosition is undefined.');
|
949
|
+
}
|
950
|
+
|
951
|
+
var pickedObjects = [];
|
952
|
+
|
953
|
+
var pickedResult = this.pick(windowPosition);
|
954
|
+
while (defined(pickedResult) && defined(pickedResult.primitive)) {
|
955
|
+
var primitive = pickedResult.primitive;
|
956
|
+
pickedObjects.push(pickedResult);
|
957
|
+
|
958
|
+
// hide the picked primitive and call picking again to get the next primitive
|
959
|
+
if (defined(primitive.show)) {
|
960
|
+
primitive.show = false;
|
961
|
+
} else if (typeof primitive.setShow === 'function') {
|
962
|
+
primitive.setShow(false);
|
963
|
+
} else if (typeof primitive.getGeometryInstanceAttributes === 'function') {
|
964
|
+
var attributes = primitive.getGeometryInstanceAttributes(pickedResult.id);
|
965
|
+
if (defined(attributes) && defined(attributes.show)) {
|
966
|
+
attributes.show = ShowGeometryInstanceAttribute.toValue(false);
|
967
|
+
}
|
968
|
+
}
|
969
|
+
|
970
|
+
pickedResult = this.pick(windowPosition);
|
971
|
+
}
|
972
|
+
|
973
|
+
// unhide the picked primitives
|
974
|
+
for (var i = 0; i < pickedObjects.length; ++i) {
|
975
|
+
var p = pickedObjects[i].primitive;
|
976
|
+
if (defined(p.show)) {
|
977
|
+
p.show = true;
|
978
|
+
} else if (typeof p.setShow === 'function') {
|
979
|
+
p.setShow(true);
|
980
|
+
} else if (typeof p.getGeometryInstanceAttributes === 'function') {
|
981
|
+
var attr = p.getGeometryInstanceAttributes(pickedObjects[i].id);
|
982
|
+
if (defined(attr) && defined(attr.show)) {
|
983
|
+
attr.show = ShowGeometryInstanceAttribute.toValue(true);
|
984
|
+
}
|
985
|
+
}
|
986
|
+
}
|
987
|
+
|
988
|
+
return pickedObjects;
|
989
|
+
};
|
990
|
+
|
883
991
|
/**
|
884
992
|
* DOC_TBA
|
885
993
|
* @memberof Scene
|
@@ -68,7 +68,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Cartog
|
|
68
68
|
|
69
69
|
// View-projection matrix to transform from world coordinates to clip coordinates
|
70
70
|
var viewProjection = scene.getUniformState().getViewProjection();
|
71
|
-
|
71
|
+
Matrix4.multiplyByPoint(viewProjection, actualPosition, positionCC);
|
72
72
|
|
73
73
|
return SceneTransforms.clipToWindowCoordinates(scene.getContext(), positionCC, result);
|
74
74
|
};
|
@@ -117,7 +117,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Cartog
|
|
117
117
|
|
118
118
|
// View-projection matrix to transform from world coordinates to clip coordinates
|
119
119
|
var viewProjection = scene.getUniformState().getViewProjection();
|
120
|
-
|
120
|
+
Matrix4.multiplyByPoint(viewProjection, actualPosition, positionCC);
|
121
121
|
|
122
122
|
return SceneTransforms.clipToDrawingBufferCoordinates(scene.getContext(), positionCC, result);
|
123
123
|
};
|
@@ -333,12 +333,12 @@ define(['Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Develop
|
|
333
333
|
var dir = new Cartesian4(camera.direction.x, camera.direction.y, camera.direction.z, 0.0);
|
334
334
|
var up = new Cartesian4(camera.up.x, camera.up.y, camera.up.z, 0.0);
|
335
335
|
|
336
|
-
var frame =
|
336
|
+
var frame = Matrix4.multiply(Matrix4.inverseTransformation(transform), camera.transform);
|
337
337
|
camera.transform = Matrix4.clone(transform);
|
338
338
|
|
339
|
-
camera.position = Cartesian3.fromCartesian4(
|
340
|
-
camera.direction = Cartesian3.fromCartesian4(
|
341
|
-
camera.up = Cartesian3.fromCartesian4(
|
339
|
+
camera.position = Cartesian3.fromCartesian4(Matrix4.multiplyByVector(frame, pos));
|
340
|
+
camera.direction = Cartesian3.fromCartesian4(Matrix4.multiplyByVector(frame, dir));
|
341
|
+
camera.up = Cartesian3.fromCartesian4(Matrix4.multiplyByVector(frame, up));
|
342
342
|
camera.right = Cartesian3.cross(camera.direction, camera.up);
|
343
343
|
}
|
344
344
|
|