cesium 0.21 → 0.21.1
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/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
|
@@ -29,6 +29,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
29
29
|
* @param {Number} [options.textureRotationAngle=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
|
|
30
30
|
* @param {Boolean} [options.show=true] Determines if this primitive will be shown.
|
|
31
31
|
* @param {Material} [options.material=undefined] The surface appearance of the primitive.
|
|
32
|
+
* @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick}
|
|
32
33
|
* @param {Boolean} [options.asynchronous=true] Determines if the extent will be created asynchronously or block until ready.
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
@@ -136,6 +137,18 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
136
137
|
*/
|
|
137
138
|
this.material = defaultValue(options.material, material);
|
|
138
139
|
|
|
140
|
+
/**
|
|
141
|
+
* User-defined object returned when the extent is picked.
|
|
142
|
+
*
|
|
143
|
+
* @type Object
|
|
144
|
+
*
|
|
145
|
+
* @default undefined
|
|
146
|
+
*
|
|
147
|
+
* @see Scene#pick
|
|
148
|
+
*/
|
|
149
|
+
this.id = options.id;
|
|
150
|
+
this._id = undefined;
|
|
151
|
+
|
|
139
152
|
/**
|
|
140
153
|
* Determines if the geometry instances will be created and batched on
|
|
141
154
|
* a web worker.
|
|
@@ -174,7 +187,8 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
174
187
|
(this._granularity !== this.granularity) ||
|
|
175
188
|
(this._height !== this.height) ||
|
|
176
189
|
(this._rotation !== this.rotation) ||
|
|
177
|
-
(this._textureRotationAngle !== this.textureRotationAngle)
|
|
190
|
+
(this._textureRotationAngle !== this.textureRotationAngle) ||
|
|
191
|
+
(this._id !== this.id)) {
|
|
178
192
|
|
|
179
193
|
this._extent = Extent.clone(this.extent, this._extent);
|
|
180
194
|
this._ellipsoid = this.ellipsoid;
|
|
@@ -182,6 +196,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
182
196
|
this._height = this.height;
|
|
183
197
|
this._rotation = this.rotation;
|
|
184
198
|
this._textureRotationAngle = this.textureRotationAngle;
|
|
199
|
+
this._id = this.id;
|
|
185
200
|
|
|
186
201
|
var instance = new GeometryInstance({
|
|
187
202
|
geometry : new ExtentGeometry({
|
|
@@ -193,6 +208,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
193
208
|
rotation : this.rotation,
|
|
194
209
|
stRotation : this.textureRotationAngle
|
|
195
210
|
}),
|
|
211
|
+
id : this.id,
|
|
196
212
|
pickPrimitive : this
|
|
197
213
|
});
|
|
198
214
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*global define*/
|
|
2
|
-
define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Color', 'Core/defined', 'Scene/Billboard', 'Scene/LabelStyle', 'Scene/HorizontalOrigin', 'Scene/VerticalOrigin'], function(
|
|
2
|
+
define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Color', 'Core/defined', 'Core/NearFarScalar', 'Scene/Billboard', 'Scene/LabelStyle', 'Scene/HorizontalOrigin', 'Scene/VerticalOrigin'], function(
|
|
3
3
|
defaultValue,
|
|
4
4
|
DeveloperError,
|
|
5
5
|
Cartesian2,
|
|
6
6
|
Cartesian3,
|
|
7
7
|
Color,
|
|
8
8
|
defined,
|
|
9
|
+
NearFarScalar,
|
|
9
10
|
Billboard,
|
|
10
11
|
LabelStyle,
|
|
11
12
|
HorizontalOrigin,
|
|
@@ -35,27 +36,36 @@ define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Car
|
|
|
35
36
|
* @alias Label
|
|
36
37
|
* @internalConstructor
|
|
37
38
|
*
|
|
39
|
+
* @exception {DeveloperError} translucencyByDistance.far must be greater than translucencyByDistance.near
|
|
40
|
+
*
|
|
38
41
|
* @see LabelCollection
|
|
39
42
|
* @see LabelCollection#add
|
|
40
43
|
*
|
|
41
44
|
* @demo <a href="http://cesium.agi.com/Cesium/Apps/Sandcastle/index.html?src=Labels.html">Cesium Sandcastle Labels Demo</a>
|
|
42
45
|
*/
|
|
43
|
-
var Label = function(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
46
|
+
var Label = function(options, labelCollection) {
|
|
47
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
48
|
+
|
|
49
|
+
if (defined(options.translucencyByDistance) &&
|
|
50
|
+
options.translucencyByDistance.far <= options.translucencyByDistance.near) {
|
|
51
|
+
throw new DeveloperError('translucencyByDistance.far must be greater than translucencyByDistance.near.');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
this._text = defaultValue(options.text, '');
|
|
55
|
+
this._show = defaultValue(options.show, true);
|
|
56
|
+
this._font = defaultValue(options.font, '30px sans-serif');
|
|
57
|
+
this._fillColor = Color.clone(defaultValue(options.fillColor, Color.WHITE));
|
|
58
|
+
this._outlineColor = Color.clone(defaultValue(options.outlineColor, Color.BLACK));
|
|
59
|
+
this._outlineWidth = defaultValue(options.outlineWidth, 1.0);
|
|
60
|
+
this._style = defaultValue(options.style, LabelStyle.FILL);
|
|
61
|
+
this._verticalOrigin = defaultValue(options.verticalOrigin, VerticalOrigin.BOTTOM);
|
|
62
|
+
this._horizontalOrigin = defaultValue(options.horizontalOrigin, HorizontalOrigin.LEFT);
|
|
63
|
+
this._pixelOffset = Cartesian2.clone(defaultValue(options.pixelOffset, Cartesian2.ZERO));
|
|
64
|
+
this._eyeOffset = Cartesian3.clone(defaultValue(options.eyeOffset, Cartesian3.ZERO));
|
|
65
|
+
this._position = Cartesian3.clone(defaultValue(options.position, Cartesian3.ZERO));
|
|
66
|
+
this._scale = defaultValue(options.scale, 1.0);
|
|
67
|
+
this._id = options.id;
|
|
68
|
+
this._translucencyByDistance = options.translucencyByDistance;
|
|
59
69
|
|
|
60
70
|
this._labelCollection = labelCollection;
|
|
61
71
|
this._glyphs = [];
|
|
@@ -440,6 +450,59 @@ define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Car
|
|
|
440
450
|
}
|
|
441
451
|
};
|
|
442
452
|
|
|
453
|
+
/**
|
|
454
|
+
* Returns the near and far translucency properties of a Label based on the label's distance from the camera.
|
|
455
|
+
*
|
|
456
|
+
* @memberof Label
|
|
457
|
+
*
|
|
458
|
+
* @returns {NearFarScalar} The near/far translucency values based on camera distance to the billboard
|
|
459
|
+
*
|
|
460
|
+
* @see Label#setTranslucencyByDistance
|
|
461
|
+
*/
|
|
462
|
+
Label.prototype.getTranslucencyByDistance = function() {
|
|
463
|
+
return this._translucencyByDistance;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Sets near and far translucency properties of a Label based on the Label's distance from the camera.
|
|
468
|
+
* A label's translucency will interpolate between the {@link NearFarScalar#nearValue} and
|
|
469
|
+
* {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds
|
|
470
|
+
* of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}.
|
|
471
|
+
* Outside of these ranges the label's translucency remains clamped to the nearest bound. If undefined,
|
|
472
|
+
* translucencyByDistance will be disabled.
|
|
473
|
+
*
|
|
474
|
+
* @memberof Label
|
|
475
|
+
*
|
|
476
|
+
* @param {NearFarScalar} translucency The configuration of near and far distances and their respective translucency values
|
|
477
|
+
*
|
|
478
|
+
* @exception {DeveloperError} far distance must be greater than near distance.
|
|
479
|
+
*
|
|
480
|
+
* @see Label#getTranslucencyByDistance
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* // Example 1.
|
|
484
|
+
* // Set a label's translucencyByDistance to 1.0 when the
|
|
485
|
+
* // camera is 1500 meters from the label and disappear as
|
|
486
|
+
* // the camera distance approaches 8.0e6 meters.
|
|
487
|
+
* text.setTranslucencyByDistance(new NearFarScalar(1.5e2, 1.0, 8.0e6, 0.0));
|
|
488
|
+
*
|
|
489
|
+
* // Example 2.
|
|
490
|
+
* // disable translucency by distance
|
|
491
|
+
* text.setTranslucencyByDistance(undefined);
|
|
492
|
+
*/
|
|
493
|
+
Label.prototype.setTranslucencyByDistance = function(value) {
|
|
494
|
+
if (NearFarScalar.equals(this._translucencyByDistance, value)) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
if (value.far <= value.near) {
|
|
499
|
+
throw new DeveloperError('far distance must be greater than near distance.');
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
this._translucencyByDistance = NearFarScalar.clone(value, this._translucencyByDistance);
|
|
503
|
+
rebindAllGlyphs(this);
|
|
504
|
+
};
|
|
505
|
+
|
|
443
506
|
/**
|
|
444
507
|
* Returns the 3D Cartesian offset applied to this label in eye coordinates.
|
|
445
508
|
*
|
|
@@ -610,6 +673,17 @@ define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Car
|
|
|
610
673
|
return this._scale;
|
|
611
674
|
};
|
|
612
675
|
|
|
676
|
+
/**
|
|
677
|
+
* Returns the user-defined object returned when the label is picked.
|
|
678
|
+
*
|
|
679
|
+
* @memberof Label
|
|
680
|
+
*
|
|
681
|
+
* @returns {Object} The user-defined object returned when the label is picked.
|
|
682
|
+
*/
|
|
683
|
+
Label.prototype.getId = function() {
|
|
684
|
+
return this._id;
|
|
685
|
+
};
|
|
686
|
+
|
|
613
687
|
/**
|
|
614
688
|
* Sets the uniform scale that is multiplied with the label's size in pixels.
|
|
615
689
|
* A scale of <code>1.0</code> does not change the size of the label; a scale greater than
|
|
@@ -715,7 +789,9 @@ define(['Core/defaultValue', 'Core/DeveloperError', 'Core/Cartesian2', 'Core/Car
|
|
|
715
789
|
Color.equals(this._fillColor, other._fillColor) &&
|
|
716
790
|
Color.equals(this._outlineColor, other._outlineColor) &&
|
|
717
791
|
Cartesian2.equals(this._pixelOffset, other._pixelOffset) &&
|
|
718
|
-
Cartesian3.equals(this._eyeOffset, other._eyeOffset)
|
|
792
|
+
Cartesian3.equals(this._eyeOffset, other._eyeOffset) &&
|
|
793
|
+
NearFarScalar.equals(this._translucencyByDistance, other._translucencyByDistance) &&
|
|
794
|
+
this._id === other._id;
|
|
719
795
|
};
|
|
720
796
|
|
|
721
797
|
/**
|
|
@@ -64,6 +64,8 @@ define(['Core/DeveloperError', 'Core/defined', 'Core/destroyObject', 'Core/Carte
|
|
|
64
64
|
if (defined(billboard)) {
|
|
65
65
|
billboard.setShow(false);
|
|
66
66
|
billboard.setImageIndex(-1);
|
|
67
|
+
// Destroy pickId to allow setting _pickIdThis and _id when the billboard is reused.
|
|
68
|
+
billboard._pickId = billboard._pickId && billboard._pickId.destroy();
|
|
67
69
|
labelCollection._spareBillboards.push(billboard);
|
|
68
70
|
glyph.billboard = undefined;
|
|
69
71
|
}
|
|
@@ -166,9 +168,11 @@ define(['Core/DeveloperError', 'Core/defined', 'Core/destroyObject', 'Core/Carte
|
|
|
166
168
|
billboard.setVerticalOrigin(label._verticalOrigin);
|
|
167
169
|
billboard.setScale(label._scale);
|
|
168
170
|
billboard._pickIdThis = label;
|
|
171
|
+
billboard._id = label._id;
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
glyph.billboard.setImageIndex(glyphTextureInfo.index);
|
|
175
|
+
glyph.billboard.setTranslucencyByDistance(label._translucencyByDistance);
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
|
|
@@ -324,7 +328,7 @@ define(['Core/DeveloperError', 'Core/defined', 'Core/destroyObject', 'Core/Carte
|
|
|
324
328
|
* text : 'Up'
|
|
325
329
|
* });
|
|
326
330
|
*/
|
|
327
|
-
this.modelMatrix = Matrix4.
|
|
331
|
+
this.modelMatrix = Matrix4.clone(Matrix4.IDENTITY);
|
|
328
332
|
};
|
|
329
333
|
|
|
330
334
|
/**
|
|
@@ -363,7 +367,7 @@ define(['Core/DeveloperError', 'Core/defined', 'Core/destroyObject', 'Core/Carte
|
|
|
363
367
|
* eyeOffset : Cartesian3.ZERO,
|
|
364
368
|
* horizontalOrigin : HorizontalOrigin.LEFT,
|
|
365
369
|
* verticalOrigin : VerticalOrigin.BOTTOM,
|
|
366
|
-
* scale : 1.0
|
|
370
|
+
* scale : 1.0
|
|
367
371
|
* });
|
|
368
372
|
*
|
|
369
373
|
* // Example 2: Specify only the label's cartographic position,
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*global define*/
|
|
2
|
+
define(['Core/buildModuleUrl', 'Core/Cartesian3', 'Core/defaultValue', 'Core/defined', 'Core/destroyObject', 'Core/Ellipsoid', 'Core/IauOrientationAxes', 'Core/Matrix3', 'Core/Matrix4', 'Core/Simon1994PlanetaryPositions', 'Core/Transforms', 'Scene/EllipsoidPrimitive', 'Scene/Material'], function(
|
|
3
|
+
buildModuleUrl,
|
|
4
|
+
Cartesian3,
|
|
5
|
+
defaultValue,
|
|
6
|
+
defined,
|
|
7
|
+
destroyObject,
|
|
8
|
+
Ellipsoid,
|
|
9
|
+
IauOrientationAxes,
|
|
10
|
+
Matrix3,
|
|
11
|
+
Matrix4,
|
|
12
|
+
Simon1994PlanetaryPositions,
|
|
13
|
+
Transforms,
|
|
14
|
+
EllipsoidPrimitive,
|
|
15
|
+
Material) {
|
|
16
|
+
"use strict";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Draws the Moon in 3D.
|
|
20
|
+
* @alias Moon
|
|
21
|
+
* @constructor
|
|
22
|
+
*
|
|
23
|
+
* @param {Boolean} [options.show=true] Determines whether the moon will be rendered.
|
|
24
|
+
* @param {String} [options.textureUrl=buildModuleUrl('Assets/Textures/moonSmall.jpg')] The moon texture.
|
|
25
|
+
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.MOON] The moon ellipsoid.
|
|
26
|
+
* @param {Boolean} [options.onlySunLighting=true] Use the sun as the only light source.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* scene.moon = new Moon();
|
|
30
|
+
*/
|
|
31
|
+
var Moon = function(options) {
|
|
32
|
+
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
|
|
33
|
+
|
|
34
|
+
var url = options.textureUrl;
|
|
35
|
+
if (!defined(url)) {
|
|
36
|
+
url = buildModuleUrl('Assets/Textures/moonSmall.jpg');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Determines if the moon will be shown.
|
|
41
|
+
*
|
|
42
|
+
* @type {Boolean}
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
this.show = defaultValue(options.show, true);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The moon texture.
|
|
49
|
+
* @type {String}
|
|
50
|
+
* @default buildModuleUrl('Assets/Textures/moonSmall.jpg')
|
|
51
|
+
*/
|
|
52
|
+
this.textureUrl = url;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The moon ellipsoid.
|
|
56
|
+
* @type {Ellipsoid}
|
|
57
|
+
* @default Ellipsoid.MOON
|
|
58
|
+
*/
|
|
59
|
+
this.ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.MOON);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Use the sun as the only light source.
|
|
63
|
+
* @type {Boolean}
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
this.onlySunLighting = defaultValue(options.onlySunLighting, true);
|
|
67
|
+
|
|
68
|
+
this._ellipsoidPrimitive = new EllipsoidPrimitive({
|
|
69
|
+
radii : this.ellipsoid.getRadii(),
|
|
70
|
+
material : Material.fromType(Material.ImageType),
|
|
71
|
+
onlySunLighting : this.onlySunLighting,
|
|
72
|
+
_owner : this,
|
|
73
|
+
_executeInClosestFrustum : false,
|
|
74
|
+
_writeDepth : true
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
this._axes = new IauOrientationAxes();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var icrfToFixed = new Matrix3();
|
|
81
|
+
var rotationScratch = new Matrix3();
|
|
82
|
+
var translationScratch = new Cartesian3();
|
|
83
|
+
|
|
84
|
+
Moon.prototype.update = function(context, frameState, commandList) {
|
|
85
|
+
if (!this.show) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var ellipsoidPrimitive = this._ellipsoidPrimitive;
|
|
90
|
+
ellipsoidPrimitive.material.uniforms.image = this.textureUrl;
|
|
91
|
+
ellipsoidPrimitive.onlySunLighting = this.onlySunLighting;
|
|
92
|
+
|
|
93
|
+
var date = frameState.time;
|
|
94
|
+
if (!defined(Transforms.computeIcrfToFixedMatrix(date, icrfToFixed))) {
|
|
95
|
+
Transforms.computeTemeToPseudoFixedMatrix(date, icrfToFixed);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var rotation = this._axes.evaluate(date, rotationScratch);
|
|
99
|
+
Matrix3.transpose(rotation, rotation);
|
|
100
|
+
Matrix3.multiply(icrfToFixed, rotation, rotation);
|
|
101
|
+
|
|
102
|
+
var translation = Simon1994PlanetaryPositions.ComputeMoonPositionInEarthInertialFrame(date, translationScratch);
|
|
103
|
+
Matrix3.multiplyByVector(icrfToFixed, translation, translation);
|
|
104
|
+
|
|
105
|
+
Matrix4.fromRotationTranslation(rotation, translation, ellipsoidPrimitive.modelMatrix);
|
|
106
|
+
ellipsoidPrimitive.update(context, frameState, commandList);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
111
|
+
* <br /><br />
|
|
112
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
113
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
114
|
+
*
|
|
115
|
+
* @memberof Moon
|
|
116
|
+
*
|
|
117
|
+
* @returns {Boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
|
|
118
|
+
*
|
|
119
|
+
* @see Moon#destroy
|
|
120
|
+
*/
|
|
121
|
+
Moon.prototype.isDestroyed = function() {
|
|
122
|
+
return false;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
127
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
128
|
+
* <br /><br />
|
|
129
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
130
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
131
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
132
|
+
*
|
|
133
|
+
* @memberof Moon
|
|
134
|
+
*
|
|
135
|
+
* @returns {undefined}
|
|
136
|
+
*
|
|
137
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
138
|
+
*
|
|
139
|
+
* @see Moon#isDestroyed
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* moon = moon && moon.destroy();
|
|
143
|
+
*/
|
|
144
|
+
Moon.prototype.destroy = function() {
|
|
145
|
+
this._ellipsoid = this._ellipsoid && this._ellipsoid.destroy();
|
|
146
|
+
return destroyObject(this);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return Moon;
|
|
150
|
+
});
|
|
@@ -30,6 +30,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
30
30
|
* @param {Number} [options.textureRotationAngle=0.0] The rotation of the texture coordinates, in radians. A positive rotation is counter-clockwise.
|
|
31
31
|
* @param {Boolean} [options.show=true] Determines if this primitive will be shown.
|
|
32
32
|
* @param {Material} [options.material=undefined] The surface appearance of the primitive.
|
|
33
|
+
* @param {Object} [options.id=undefined] A user-defined object to return when the instance is picked with {@link Scene#pick}
|
|
33
34
|
* @param {Boolean} [options.asynchronous=true] Determines if the extent will be created asynchronously or block until ready.
|
|
34
35
|
*
|
|
35
36
|
* @exception {DeveloperError} Either options.positions or options.polygonHierarchy can be provided, but not both.
|
|
@@ -139,6 +140,18 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
139
140
|
*/
|
|
140
141
|
this.material = defaultValue(options.material, material);
|
|
141
142
|
|
|
143
|
+
/**
|
|
144
|
+
* User-defined object returned when the polygon is picked.
|
|
145
|
+
*
|
|
146
|
+
* @type Object
|
|
147
|
+
*
|
|
148
|
+
* @default undefined
|
|
149
|
+
*
|
|
150
|
+
* @see Scene#pick
|
|
151
|
+
*/
|
|
152
|
+
this.id = options.id;
|
|
153
|
+
this._id = undefined;
|
|
154
|
+
|
|
142
155
|
/**
|
|
143
156
|
* Determines if the geometry instances will be created and batched on
|
|
144
157
|
* a web worker.
|
|
@@ -289,13 +302,15 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
289
302
|
(this._ellipsoid !== this.ellipsoid) ||
|
|
290
303
|
(this._granularity !== this.granularity) ||
|
|
291
304
|
(this._height !== this.height) ||
|
|
292
|
-
(this._textureRotationAngle !== this.textureRotationAngle)
|
|
305
|
+
(this._textureRotationAngle !== this.textureRotationAngle) ||
|
|
306
|
+
(this._id !== this.id)) {
|
|
293
307
|
|
|
294
308
|
this._createPrimitive = false;
|
|
295
309
|
this._ellipsoid = this.ellipsoid;
|
|
296
310
|
this._granularity = this.granularity;
|
|
297
311
|
this._height = this.height;
|
|
298
312
|
this._textureRotationAngle = this.textureRotationAngle;
|
|
313
|
+
this._id = this.id;
|
|
299
314
|
|
|
300
315
|
this._primitive = this._primitive && this._primitive.destroy();
|
|
301
316
|
|
|
@@ -314,6 +329,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
314
329
|
ellipsoid : this.ellipsoid,
|
|
315
330
|
granularity : this.granularity
|
|
316
331
|
}),
|
|
332
|
+
id : this.id,
|
|
317
333
|
pickPrimitive : this
|
|
318
334
|
});
|
|
319
335
|
} else {
|
|
@@ -326,6 +342,7 @@ define(['Core/DeveloperError', 'Core/defaultValue', 'Core/defined', 'Core/Color'
|
|
|
326
342
|
ellipsoid : this.ellipsoid,
|
|
327
343
|
granularity : this.granularity
|
|
328
344
|
}),
|
|
345
|
+
id : this.id,
|
|
329
346
|
pickPrimitive : this
|
|
330
347
|
});
|
|
331
348
|
}
|