cesium 0.21 → 0.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/Assets/Textures/moonSmall.jpg +0 -0
  3. data/app/assets/javascripts/Cesium.js +10 -1
  4. data/app/assets/javascripts/Core/Cartesian2.js +28 -0
  5. data/app/assets/javascripts/Core/Cartesian3.js +28 -0
  6. data/app/assets/javascripts/Core/Cartesian4.js +28 -0
  7. data/app/assets/javascripts/Core/CatmullRomSpline.js +3 -3
  8. data/app/assets/javascripts/Core/Clock.js +7 -7
  9. data/app/assets/javascripts/Core/Color.js +1 -1
  10. data/app/assets/javascripts/Core/ComponentDatatype.js +11 -7
  11. data/app/assets/javascripts/Core/CorridorGeometryLibrary.js +23 -29
  12. data/app/assets/javascripts/Core/Ellipsoid.js +6 -0
  13. data/app/assets/javascripts/Core/EllipsoidTangentPlane.js +5 -4
  14. data/app/assets/javascripts/Core/Event.js +2 -1
  15. data/app/assets/javascripts/Core/ExtentGeometry.js +1 -1
  16. data/app/assets/javascripts/Core/ExtentOutlineGeometry.js +1 -1
  17. data/app/assets/javascripts/Core/GeometryAttributes.js +1 -1
  18. data/app/assets/javascripts/Core/GeometryInstance.js +2 -2
  19. data/app/assets/javascripts/Core/GeometryPipeline.js +10 -7
  20. data/app/assets/javascripts/Core/HermiteSpline.js +1 -1
  21. data/app/assets/javascripts/Core/Iau2000Orientation.js +132 -0
  22. data/app/assets/javascripts/Core/IauOrientationAxes.js +98 -0
  23. data/app/assets/javascripts/Core/IauOrientationParameters.js +48 -0
  24. data/app/assets/javascripts/Core/IntersectionTests.js +5 -5
  25. data/app/assets/javascripts/Core/JulianDate.js +27 -5
  26. data/app/assets/javascripts/Core/Math.js +9 -0
  27. data/app/assets/javascripts/Core/Matrix2.js +1 -142
  28. data/app/assets/javascripts/Core/Matrix3.js +168 -153
  29. data/app/assets/javascripts/Core/Matrix4.js +0 -249
  30. data/app/assets/javascripts/Core/NearFarScalar.js +13 -0
  31. data/app/assets/javascripts/Core/PolygonGeometry.js +1 -1
  32. data/app/assets/javascripts/Core/PolygonOutlineGeometry.js +2 -2
  33. data/app/assets/javascripts/Core/PolygonPipeline.js +2 -2
  34. data/app/assets/javascripts/Core/PolylinePipeline.js +7 -3
  35. data/app/assets/javascripts/Core/PolylineVolumeGeometry.js +239 -0
  36. data/app/assets/javascripts/Core/PolylineVolumeGeometryLibrary.js +404 -0
  37. data/app/assets/javascripts/Core/PolylineVolumeOutlineGeometry.js +154 -0
  38. data/app/assets/javascripts/Core/Quaternion.js +37 -10
  39. data/app/assets/javascripts/Core/Shapes.js +26 -2
  40. data/app/assets/javascripts/Core/Simon1994PlanetaryPositions.js +3 -3
  41. data/app/assets/javascripts/Core/TimeInterval.js +28 -17
  42. data/app/assets/javascripts/Core/TimeIntervalCollection.js +30 -0
  43. data/app/assets/javascripts/Core/Transforms.js +5 -5
  44. data/app/assets/javascripts/Core/WallGeometryLibrary.js +2 -2
  45. data/app/assets/javascripts/Core/getFilenameFromUri.js +37 -0
  46. data/app/assets/javascripts/DynamicScene/ColorMaterialProperty.js +2 -2
  47. data/app/assets/javascripts/DynamicScene/CzmlDataSource.js +96 -18
  48. data/app/assets/javascripts/DynamicScene/DataSource.js +8 -0
  49. data/app/assets/javascripts/DynamicScene/DynamicBillboard.js +15 -3
  50. data/app/assets/javascripts/DynamicScene/DynamicBillboardVisualizer.js +6 -1
  51. data/app/assets/javascripts/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js +1 -1
  52. data/app/assets/javascripts/DynamicScene/DynamicLabel.js +12 -1
  53. data/app/assets/javascripts/DynamicScene/DynamicLabelVisualizer.js +5 -0
  54. data/app/assets/javascripts/DynamicScene/DynamicObject.js +44 -17
  55. data/app/assets/javascripts/DynamicScene/DynamicObjectView.js +3 -3
  56. data/app/assets/javascripts/DynamicScene/DynamicPoint.js +12 -1
  57. data/app/assets/javascripts/DynamicScene/DynamicPointVisualizer.js +11 -2
  58. data/app/assets/javascripts/DynamicScene/DynamicPolyline.js +10 -30
  59. data/app/assets/javascripts/DynamicScene/DynamicPolylineVisualizer.js +5 -20
  60. data/app/assets/javascripts/DynamicScene/GeoJsonDataSource.js +26 -8
  61. data/app/assets/javascripts/DynamicScene/GridMaterialProperty.js +2 -2
  62. data/app/assets/javascripts/DynamicScene/ImageMaterialProperty.js +2 -2
  63. data/app/assets/javascripts/DynamicScene/PolylineOutlineMaterialProperty.js +66 -0
  64. data/app/assets/javascripts/DynamicScene/PositionProperty.js +3 -3
  65. data/app/assets/javascripts/DynamicScene/ReferenceProperty.js +1 -1
  66. data/app/assets/javascripts/DynamicScene/SampledProperty.js +14 -8
  67. data/app/assets/javascripts/Renderer/AutomaticUniforms.js +4 -3
  68. data/app/assets/javascripts/Renderer/Context.js +16 -2
  69. data/app/assets/javascripts/Renderer/UniformState.js +14 -14
  70. data/app/assets/javascripts/Scene/Billboard.js +102 -26
  71. data/app/assets/javascripts/Scene/BillboardCollection.js +69 -16
  72. data/app/assets/javascripts/Scene/Camera.js +7 -7
  73. data/app/assets/javascripts/Scene/CameraController.js +23 -12
  74. data/app/assets/javascripts/Scene/CameraFlightPath.js +11 -11
  75. data/app/assets/javascripts/Scene/CentralBodySurface.js +1 -1
  76. data/app/assets/javascripts/Scene/CustomSensorVolume.js +17 -2
  77. data/app/assets/javascripts/Scene/EllipsoidPrimitive.js +79 -24
  78. data/app/assets/javascripts/Scene/ExtentPrimitive.js +17 -1
  79. data/app/assets/javascripts/Scene/Label.js +94 -18
  80. data/app/assets/javascripts/Scene/LabelCollection.js +6 -2
  81. data/app/assets/javascripts/Scene/Moon.js +150 -0
  82. data/app/assets/javascripts/Scene/Polygon.js +18 -1
  83. data/app/assets/javascripts/Scene/Polyline.js +32 -13
  84. data/app/assets/javascripts/Scene/PolylineCollection.js +7 -6
  85. data/app/assets/javascripts/Scene/Primitive.js +2 -2
  86. data/app/assets/javascripts/Scene/RectangularPyramidSensorVolume.js +12 -0
  87. data/app/assets/javascripts/Scene/Scene.js +122 -14
  88. data/app/assets/javascripts/Scene/SceneTransforms.js +2 -2
  89. data/app/assets/javascripts/Scene/SceneTransitioner.js +4 -4
  90. data/app/assets/javascripts/Scene/ScreenSpaceCameraController.js +1 -1
  91. data/app/assets/javascripts/Scene/SkyBox.js +53 -48
  92. data/app/assets/javascripts/Scene/TileMapServiceImageryProvider.js +2 -2
  93. data/app/assets/javascripts/Shaders/BillboardCollectionVS.glsl +36 -14
  94. data/app/assets/javascripts/Shaders/BillboardCollectionVS.js +27 -9
  95. data/app/assets/javascripts/Shaders/Builtin/Functions/phong.glsl +13 -0
  96. data/app/assets/javascripts/Shaders/Builtin/Functions/phong.js +10 -0
  97. data/app/assets/javascripts/Shaders/EllipsoidFS.glsl +24 -0
  98. data/app/assets/javascripts/Shaders/EllipsoidFS.js +21 -1
  99. data/app/assets/javascripts/Widgets/CesiumWidget/CesiumWidget.js +30 -9
  100. data/app/assets/javascripts/Widgets/HomeButton/HomeButtonViewModel.js +6 -5
  101. data/app/assets/javascripts/Widgets/Viewer/Viewer.js +13 -0
  102. data/app/assets/javascripts/Widgets/Viewer/viewerDynamicObjectMixin.js +46 -4
  103. data/app/assets/javascripts/Workers/cesiumWorkerBootstrapper.js +16 -8
  104. data/app/assets/javascripts/Workers/createPolylineVolumeGeometry.js +23 -0
  105. data/app/assets/javascripts/Workers/createPolylineVolumeOutlineGeometry.js +23 -0
  106. data/lib/cesium/version.rb +1 -1
  107. metadata +15 -5
  108. data/test/dummy/tmp/pids/server.pid +0 -1
@@ -1,10 +1,11 @@
1
1
  /*global define*/
2
- define(['Core/createGuid', 'Core/Cartographic', 'Core/Color', 'Core/defined', 'Core/DeveloperError', 'Core/RuntimeError', 'Core/Ellipsoid', 'Core/Event', 'Core/loadJson', 'DynamicScene/ConstantProperty', 'DynamicScene/DynamicObject', 'DynamicScene/DynamicPoint', 'DynamicScene/DynamicPolyline', 'DynamicScene/DynamicPolygon', 'DynamicScene/ColorMaterialProperty', 'DynamicScene/DynamicObjectCollection', 'ThirdParty/when', 'ThirdParty/topojson'], function(
2
+ define(['Core/createGuid', 'Core/Cartographic', 'Core/Color', 'Core/defined', 'Core/DeveloperError', 'Core/getFilenameFromUri', 'Core/RuntimeError', 'Core/Ellipsoid', 'Core/Event', 'Core/loadJson', 'DynamicScene/ConstantProperty', 'DynamicScene/DynamicObject', 'DynamicScene/DynamicPoint', 'DynamicScene/DynamicPolyline', 'DynamicScene/DynamicPolygon', 'DynamicScene/ColorMaterialProperty', 'DynamicScene/DynamicObjectCollection', 'ThirdParty/when', 'ThirdParty/topojson'], function(
3
3
  createGuid,
4
4
  Cartographic,
5
5
  Color,
6
6
  defined,
7
7
  DeveloperError,
8
+ getFilenameFromUri,
8
9
  RuntimeError,
9
10
  Ellipsoid,
10
11
  Event,
@@ -203,26 +204,26 @@ define(['Core/createGuid', 'Core/Cartographic', 'Core/Color', 'Core/defined', 'C
203
204
  //default line
204
205
  var defaultLine = new DynamicObject('GeoJsonDataSource.defaultLine');
205
206
  var polyline = new DynamicPolyline();
206
- polyline.color = new ConstantProperty(Color.YELLOW);
207
+ var material = new ColorMaterialProperty();
208
+ material.color = new ConstantProperty(Color.YELLOW);
209
+ polyline.material = material;
207
210
  polyline.width = new ConstantProperty(2);
208
- polyline.outlineColor = new ConstantProperty(Color.BLACK);
209
- polyline.outlineWidth = new ConstantProperty(1);
210
211
  defaultLine.polyline = polyline;
211
212
 
212
213
  //default polygon
213
214
  var defaultPolygon = new DynamicObject('GeoJsonDataSource.defaultPolygon');
214
215
 
215
216
  polyline = new DynamicPolyline();
216
- polyline.color = new ConstantProperty(Color.YELLOW);
217
+ material = new ColorMaterialProperty();
218
+ material.color = new ConstantProperty(Color.YELLOW);
219
+ polyline.material = material;
217
220
  polyline.width = new ConstantProperty(1);
218
- polyline.outlineColor = new ConstantProperty(Color.BLACK);
219
- polyline.outlineWidth = new ConstantProperty(0);
220
221
  defaultPolygon.polyline = polyline;
221
222
 
222
223
  var polygon = new DynamicPolygon();
223
224
  defaultPolygon.polygon = polygon;
224
225
 
225
- var material = new ColorMaterialProperty();
226
+ material = new ColorMaterialProperty();
226
227
  material.color = new ConstantProperty(new Color(1.0, 1.0, 0.0, 0.1));
227
228
  polygon.material = material;
228
229
 
@@ -247,6 +248,18 @@ define(['Core/createGuid', 'Core/Cartographic', 'Core/Color', 'Core/defined', 'C
247
248
  * @type {DynamicObject}
248
249
  */
249
250
  this.defaultPolygon = defaultPolygon;
251
+
252
+ this._name = undefined;
253
+ };
254
+
255
+ /**
256
+ * Gets the name of this data source.
257
+ * @memberof GeoJsonDataSource
258
+ *
259
+ * @returns {String} The name.
260
+ */
261
+ GeoJsonDataSource.prototype.getName = function() {
262
+ return this._name;
250
263
  };
251
264
 
252
265
  /**
@@ -343,6 +356,11 @@ define(['Core/createGuid', 'Core/Cartographic', 'Core/Color', 'Core/defined', 'C
343
356
  throw new DeveloperError('geoJson is required.');
344
357
  }
345
358
 
359
+ this._name = undefined;
360
+ if (defined(source)) {
361
+ this._name = getFilenameFromUri(source);
362
+ }
363
+
346
364
  var typeHandler = geoJsonObjectTypes[geoJson.type];
347
365
  if (!defined(typeHandler)) {
348
366
  throw new DeveloperError('Unsupported GeoJSON object type: ' + geoJson.type);
@@ -43,7 +43,7 @@ define(['Core/Cartesian2', 'Core/Color', 'Core/defined', 'DynamicScene/ConstantP
43
43
 
44
44
  /**
45
45
  * Gets the {@link Material} type at the provided time.
46
- * @memberof MaterialProperty
46
+ * @memberof GridMaterialProperty
47
47
  *
48
48
  * @param {JulianDate} time The time for which to retrieve the type.
49
49
  * @type {String} The type of material.
@@ -54,7 +54,7 @@ define(['Core/Cartesian2', 'Core/Color', 'Core/defined', 'DynamicScene/ConstantP
54
54
 
55
55
  /**
56
56
  * Gets the value of the property at the provided time.
57
- * @memberof MaterialProperty
57
+ * @memberof GridMaterialProperty
58
58
  *
59
59
  * @param {JulianDate} time The time for which to retrieve the value.
60
60
  * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
@@ -26,7 +26,7 @@ define(['Core/Cartesian2', 'Core/defined', 'DynamicScene/ConstantProperty'], fun
26
26
 
27
27
  /**
28
28
  * Gets the {@link Material} type at the provided time.
29
- * @memberof MaterialProperty
29
+ * @memberof ImageMaterialProperty
30
30
  *
31
31
  * @param {JulianDate} time The time for which to retrieve the type.
32
32
  * @type {String} The type of material.
@@ -37,7 +37,7 @@ define(['Core/Cartesian2', 'Core/defined', 'DynamicScene/ConstantProperty'], fun
37
37
 
38
38
  /**
39
39
  * Gets the value of the property at the provided time.
40
- * @memberof MaterialProperty
40
+ * @memberof ImageMaterialProperty
41
41
  *
42
42
  * @param {JulianDate} time The time for which to retrieve the value.
43
43
  * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
@@ -0,0 +1,66 @@
1
+ /*global define*/
2
+ define(['Core/Color', 'Core/defined', 'DynamicScene/ConstantProperty'], function(
3
+ Color,
4
+ defined,
5
+ ConstantProperty) {
6
+ "use strict";
7
+
8
+ /**
9
+ * A {@link MaterialProperty} that maps to polyline outline {@link Material} uniforms.
10
+ * @alias PolylineOutlineMaterialProperty
11
+ * @constructor
12
+ */
13
+ var PolylineOutlineMaterialProperty = function() {
14
+ /**
15
+ * A {@link Color} {@link Property} which determines the polyline's color.
16
+ * @type {Property}
17
+ * @default new ConstantProperty(Color.WHITE)
18
+ */
19
+ this.color = new ConstantProperty(Color.WHITE);
20
+ /**
21
+ * A {@link Color} {@link Property} which determines the polyline's outline color.
22
+ * @type {Property}
23
+ * @default new ConstantProperty(Color.BLACK)
24
+ */
25
+ this.outlineColor = new ConstantProperty(Color.BLACK);
26
+ /**
27
+ * A Number {@link Property} which determines the polyline's outline width.
28
+ * @type {Property}
29
+ * @default new ConstantProperty(1)
30
+ */
31
+ this.outlineWidth = new ConstantProperty(1);
32
+ };
33
+
34
+ /**
35
+ * Gets the {@link Material} type at the provided time.
36
+ * @memberof PolylineOutlineMaterialProperty
37
+ *
38
+ * @param {JulianDate} time The time for which to retrieve the type.
39
+ * @type {String} The type of material.
40
+ */
41
+ PolylineOutlineMaterialProperty.prototype.getType = function(time) {
42
+ return 'PolylineOutline';
43
+ };
44
+
45
+ /**
46
+ * Gets the value of the property at the provided time.
47
+ * @memberof PolylineOutlineMaterialProperty
48
+ *
49
+ * @param {JulianDate} time The time for which to retrieve the value.
50
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
51
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
52
+ *
53
+ * @exception {DeveloperError} time is required.
54
+ */
55
+ PolylineOutlineMaterialProperty.prototype.getValue = function(time, result) {
56
+ if (!defined(result)) {
57
+ result = {};
58
+ }
59
+ result.color = defined(this.color) ? this.color.getValue(time, result.color) : undefined;
60
+ result.outlineColor = defined(this.outlineColor) ? this.outlineColor.getValue(time, result.outlineColor) : undefined;
61
+ result.outlineWidth = defined(this.outlineWidth) ? this.outlineWidth.getValue(time) : undefined;
62
+ return result;
63
+ };
64
+
65
+ return PolylineOutlineMaterialProperty;
66
+ });
@@ -83,12 +83,12 @@ define(['Core/Cartesian3', 'Core/defined', 'Core/defineProperties', 'Core/Develo
83
83
  icrfToFixed = Transforms.computeTemeToPseudoFixedMatrix(time, scratchMatrix3);
84
84
  }
85
85
  if (inputFrame === ReferenceFrame.INERTIAL) {
86
- return icrfToFixed.multiplyByVector(value, result);
86
+ return Matrix3.multiplyByVector(icrfToFixed, value, result);
87
87
  }
88
88
  if (inputFrame === ReferenceFrame.FIXED) {
89
- return icrfToFixed.transpose(scratchMatrix3).multiplyByVector(value, result);
89
+ return Matrix3.multiplyByVector(Matrix3.transpose(icrfToFixed, scratchMatrix3), value, result);
90
90
  }
91
91
  };
92
92
 
93
93
  return PositionProperty;
94
- });
94
+ });
@@ -103,4 +103,4 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError'], function(
103
103
  };
104
104
 
105
105
  return ReferenceProperty;
106
- });
106
+ });
@@ -52,28 +52,29 @@ define(['Core/binarySearch', 'Core/defaultValue', 'Core/defined', 'Core/definePr
52
52
  return epoch.addSeconds(date);
53
53
  }
54
54
 
55
+ var timesSpliceArgs = [];
56
+ var valuesSpliceArgs = [];
57
+
55
58
  var mergeNewSamples = function(epoch, times, values, newData, packedLength) {
56
59
  var newDataIndex = 0;
57
60
  var i;
58
61
  var prevItem;
59
62
  var timesInsertionPoint;
60
63
  var valuesInsertionPoint;
61
- var timesSpliceArgs;
62
- var valuesSpliceArgs;
63
64
  var currentTime;
64
65
  var nextTime;
65
66
 
66
67
  while (newDataIndex < newData.length) {
67
68
  currentTime = convertDate(newData[newDataIndex], epoch);
68
69
  timesInsertionPoint = binarySearch(times, currentTime, JulianDate.compare);
70
+ var timesSpliceArgsCount = 0;
71
+ var valuesSpliceArgsCount = 0;
69
72
 
70
73
  if (timesInsertionPoint < 0) {
71
74
  //Doesn't exist, insert as many additional values as we can.
72
75
  timesInsertionPoint = ~timesInsertionPoint;
73
- timesSpliceArgs = [];
74
76
 
75
77
  valuesInsertionPoint = timesInsertionPoint * packedLength;
76
- valuesSpliceArgs = [];
77
78
  prevItem = undefined;
78
79
  nextTime = times[timesInsertionPoint];
79
80
  while (newDataIndex < newData.length) {
@@ -81,17 +82,22 @@ define(['Core/binarySearch', 'Core/defaultValue', 'Core/defined', 'Core/definePr
81
82
  if ((defined(prevItem) && JulianDate.compare(prevItem, currentTime) >= 0) || (defined(nextTime) && JulianDate.compare(currentTime, nextTime) >= 0)) {
82
83
  break;
83
84
  }
84
- timesSpliceArgs.push(currentTime);
85
+ timesSpliceArgs[timesSpliceArgsCount++] = currentTime;
85
86
  newDataIndex = newDataIndex + 1;
86
87
  for (i = 0; i < packedLength; i++) {
87
- valuesSpliceArgs.push(newData[newDataIndex]);
88
+ valuesSpliceArgs[valuesSpliceArgsCount++] = newData[newDataIndex];
88
89
  newDataIndex = newDataIndex + 1;
89
90
  }
90
91
  prevItem = currentTime;
91
92
  }
92
93
 
93
- arrayInsert(values, valuesInsertionPoint, valuesSpliceArgs);
94
- arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
94
+ if (timesSpliceArgsCount > 0) {
95
+ valuesSpliceArgs.length = valuesSpliceArgsCount;
96
+ arrayInsert(values, valuesInsertionPoint, valuesSpliceArgs);
97
+
98
+ timesSpliceArgs.length = timesSpliceArgsCount;
99
+ arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
100
+ }
95
101
  } else {
96
102
  //Found an exact match
97
103
  for (i = 0; i < packedLength; i++) {
@@ -1,6 +1,7 @@
1
1
  /*global define*/
2
- define(['Core/Cartesian3', 'Renderer/UniformDatatype'],function(
2
+ define(['Core/Cartesian3', 'Core/Matrix4', 'Renderer/UniformDatatype'],function(
3
3
  Cartesian3,
4
+ Matrix4,
4
5
  UniformDatatype) {
5
6
  "use strict";
6
7
 
@@ -1398,7 +1399,7 @@ define(['Core/Cartesian3', 'Renderer/UniformDatatype'],function(
1398
1399
  },
1399
1400
 
1400
1401
  getValue : function(uniformState) {
1401
- return uniformState.getInverseView().getTranslation(viewerPositionWCScratch);
1402
+ return Matrix4.getTranslation(uniformState.getInverseView(), viewerPositionWCScratch);
1402
1403
  }
1403
1404
  },
1404
1405
 
@@ -1522,4 +1523,4 @@ define(['Core/Cartesian3', 'Renderer/UniformDatatype'],function(
1522
1523
  }
1523
1524
  }
1524
1525
  };
1525
- });
1526
+ });
@@ -83,6 +83,20 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/destro
83
83
  }
84
84
  }
85
85
 
86
+ function makeGetterSetter(gl, propertyName, logFunc) {
87
+ return {
88
+ get : function() {
89
+ var value = gl[propertyName];
90
+ logFunc(gl, 'get: ' + propertyName, value);
91
+ return gl[propertyName];
92
+ },
93
+ set : function(value) {
94
+ gl[propertyName] = value;
95
+ logFunc(gl, 'set: ' + propertyName, value);
96
+ }
97
+ };
98
+ }
99
+
86
100
  function wrapGL(gl, logFunc) {
87
101
  if (!logFunc) {
88
102
  return gl;
@@ -110,7 +124,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/destro
110
124
  if (typeof property === 'function') {
111
125
  glWrapper[propertyName] = wrapFunction(property);
112
126
  } else {
113
- glWrapper[propertyName] = property;
127
+ Object.defineProperty(glWrapper, propertyName, makeGetterSetter(gl, propertyName, logFunc));
114
128
  }
115
129
  }
116
130
 
@@ -2495,7 +2509,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/destro
2495
2509
  *
2496
2510
  * @memberof Context
2497
2511
  *
2498
- * @see Context#pick
2512
+ * @see Scene#pick
2499
2513
  */
2500
2514
  Context.prototype.createPickFramebuffer = function() {
2501
2515
  return new PickFramebuffer(this);
@@ -25,20 +25,20 @@ define(['Core/Matrix3', 'Core/Matrix4', 'Core/Cartesian2', 'Core/Cartesian3', 'C
25
25
  var UniformState = function() {
26
26
  this._viewport = new BoundingRectangle();
27
27
  this._viewportDirty = false;
28
- this._viewportOrthographicMatrix = Matrix4.IDENTITY.clone();
29
- this._viewportTransformation = Matrix4.IDENTITY.clone();
30
-
31
- this._model = Matrix4.IDENTITY.clone();
32
- this._view = Matrix4.IDENTITY.clone();
33
- this._inverseView = Matrix4.IDENTITY.clone();
34
- this._projection = Matrix4.IDENTITY.clone();
35
- this._infiniteProjection = Matrix4.IDENTITY.clone();
28
+ this._viewportOrthographicMatrix = Matrix4.clone(Matrix4.IDENTITY);
29
+ this._viewportTransformation = Matrix4.clone(Matrix4.IDENTITY);
30
+
31
+ this._model = Matrix4.clone(Matrix4.IDENTITY);
32
+ this._view = Matrix4.clone(Matrix4.IDENTITY);
33
+ this._inverseView = Matrix4.clone(Matrix4.IDENTITY);
34
+ this._projection = Matrix4.clone(Matrix4.IDENTITY);
35
+ this._infiniteProjection = Matrix4.clone(Matrix4.IDENTITY);
36
36
  this._entireFrustum = new Cartesian2();
37
37
  this._currentFrustum = new Cartesian2();
38
38
  this._pixelSize = 0.0;
39
39
 
40
40
  this._frameState = undefined;
41
- this._temeToPseudoFixed = Matrix3.IDENTITY.clone();
41
+ this._temeToPseudoFixed = Matrix3.clone(Matrix4.IDENTITY);
42
42
 
43
43
  // Derived members
44
44
  this._view3DDirty = true;
@@ -378,7 +378,7 @@ define(['Core/Matrix3', 'Core/Matrix4', 'Core/Cartesian2', 'Core/Cartesian3', 'C
378
378
  if (this._inverseModelDirty) {
379
379
  this._inverseModelDirty = false;
380
380
 
381
- this._model.inverse(this._inverseModel);
381
+ Matrix4.inverse(this._model, this._inverseModel);
382
382
  }
383
383
 
384
384
  return this._inverseModel;
@@ -1015,7 +1015,7 @@ define(['Core/Matrix3', 'Core/Matrix4', 'Core/Cartesian2', 'Core/Cartesian3', 'C
1015
1015
  if (uniformState._encodedCameraPositionMCDirty) {
1016
1016
  uniformState._encodedCameraPositionMCDirty = false;
1017
1017
 
1018
- uniformState.getInverseModel().multiplyByPoint(uniformState._cameraPosition, cameraPositionMC);
1018
+ Matrix4.multiplyByPoint(uniformState.getInverseModel(), uniformState._cameraPosition, cameraPositionMC);
1019
1019
  EncodedCartesian3.fromCartesian(cameraPositionMC, uniformState._encodedCameraPositionMC);
1020
1020
  }
1021
1021
  }
@@ -1131,9 +1131,9 @@ define(['Core/Matrix3', 'Core/Matrix4', 'Core/Cartesian2', 'Core/Cartesian3', 'C
1131
1131
  var enuToFixed = Transforms.eastNorthUpToFixedFrame(position3D, ellipsoid, view2Dto3DMatrix4Scratch);
1132
1132
 
1133
1133
  // Transform each camera direction to the fixed axes.
1134
- enuToFixed.multiplyByVector(r, r);
1135
- enuToFixed.multiplyByVector(u, u);
1136
- enuToFixed.multiplyByVector(d, d);
1134
+ Matrix4.multiplyByVector(enuToFixed, r, r);
1135
+ Matrix4.multiplyByVector(enuToFixed, u, u);
1136
+ Matrix4.multiplyByVector(enuToFixed, d, d);
1137
1137
 
1138
1138
  // Compute the view matrix based on the new fixed-frame camera position and directions.
1139
1139
  if (!defined(result)) {
@@ -1,5 +1,5 @@
1
1
  /*global define*/
2
- define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', 'Core/NearFarScalar', 'Scene/HorizontalOrigin', 'Scene/VerticalOrigin', 'Scene/SceneMode', 'Scene/SceneTransforms'], function(
2
+ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color', 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Cartesian4', 'Core/NearFarScalar', 'Core/Matrix4', 'Scene/HorizontalOrigin', 'Scene/VerticalOrigin', 'Scene/SceneMode', 'Scene/SceneTransforms'], function(
3
3
  defaultValue,
4
4
  defined,
5
5
  DeveloperError,
@@ -8,6 +8,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
8
8
  Cartesian3,
9
9
  Cartesian4,
10
10
  NearFarScalar,
11
+ Matrix4,
11
12
  HorizontalOrigin,
12
13
  VerticalOrigin,
13
14
  SceneMode,
@@ -38,6 +39,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
38
39
  * and add new billboards instead of modifying each one.
39
40
  *
40
41
  * @exception {DeveloperError} scaleByDistance.far must be greater than scaleByDistance.near
42
+ * @exception {DeveloperError} translucencyByDistance.far must be greater than translucencyByDistance.near
41
43
  *
42
44
  * @see BillboardCollection
43
45
  * @see BillboardCollection#add
@@ -47,33 +49,39 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
47
49
  *
48
50
  * @demo <a href="http://cesium.agi.com/Cesium/Apps/Sandcastle/index.html?src=Billboards.html">Cesium Sandcastle Billboard Demo</a>
49
51
  */
50
- var Billboard = function(description, billboardCollection) {
51
- description = defaultValue(description, EMPTY_OBJECT);
52
+ var Billboard = function(options, billboardCollection) {
53
+ options = defaultValue(options, EMPTY_OBJECT);
52
54
 
53
- if (defined(description.scaleByDistance) && description.scaleByDistance.far <= description.scaleByDistance.near) {
55
+ if (defined(options.scaleByDistance) && options.scaleByDistance.far <= options.scaleByDistance.near) {
54
56
  throw new DeveloperError('scaleByDistance.far must be greater than scaleByDistance.near.');
55
57
  }
58
+ if (defined(options.translucencyByDistance) &&
59
+ options.translucencyByDistance.far <= options.translucencyByDistance.near) {
60
+ throw new DeveloperError('translucencyByDistance.far must be greater than translucencyByDistance.near.');
61
+ }
56
62
 
57
- this._show = defaultValue(description.show, true);
63
+ this._show = defaultValue(options.show, true);
58
64
 
59
- this._position = Cartesian3.clone(defaultValue(description.position, Cartesian3.ZERO));
65
+ this._position = Cartesian3.clone(defaultValue(options.position, Cartesian3.ZERO));
60
66
  this._actualPosition = Cartesian3.clone(this._position); // For columbus view and 2D
61
67
 
62
- this._pixelOffset = Cartesian2.clone(defaultValue(description.pixelOffset, Cartesian2.ZERO));
63
- this._eyeOffset = Cartesian3.clone(defaultValue(description.eyeOffset, Cartesian3.ZERO));
64
- this._verticalOrigin = defaultValue(description.verticalOrigin, VerticalOrigin.CENTER);
65
- this._horizontalOrigin = defaultValue(description.horizontalOrigin, HorizontalOrigin.CENTER);
66
- this._scale = defaultValue(description.scale, 1.0);
67
- this._imageIndex = defaultValue(description.imageIndex, -1);
68
- this._color = Color.clone(defaultValue(description.color, Color.WHITE));
69
- this._rotation = defaultValue(description.rotation, 0.0);
70
- this._alignedAxis = Cartesian3.clone(defaultValue(description.alignedAxis, Cartesian3.ZERO));
71
- this._width = description.width;
72
- this._height = description.height;
73
- this._scaleByDistance = description.scaleByDistance;
68
+ this._pixelOffset = Cartesian2.clone(defaultValue(options.pixelOffset, Cartesian2.ZERO));
69
+ this._eyeOffset = Cartesian3.clone(defaultValue(options.eyeOffset, Cartesian3.ZERO));
70
+ this._verticalOrigin = defaultValue(options.verticalOrigin, VerticalOrigin.CENTER);
71
+ this._horizontalOrigin = defaultValue(options.horizontalOrigin, HorizontalOrigin.CENTER);
72
+ this._scale = defaultValue(options.scale, 1.0);
73
+ this._imageIndex = defaultValue(options.imageIndex, -1);
74
+ this._color = Color.clone(defaultValue(options.color, Color.WHITE));
75
+ this._rotation = defaultValue(options.rotation, 0.0);
76
+ this._alignedAxis = Cartesian3.clone(defaultValue(options.alignedAxis, Cartesian3.ZERO));
77
+ this._width = options.width;
78
+ this._height = options.height;
79
+ this._scaleByDistance = options.scaleByDistance;
80
+ this._translucencyByDistance = options.translucencyByDistance;
81
+ this._id = options.id;
74
82
 
75
83
  this._pickId = undefined;
76
- this._pickIdThis = description._pickIdThis;
84
+ this._pickIdThis = options._pickIdThis;
77
85
  this._billboardCollection = billboardCollection;
78
86
  this._dirty = false;
79
87
  this._index = -1; //Used only by BillboardCollection
@@ -91,7 +99,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
91
99
  var ROTATION_INDEX = Billboard.ROTATION_INDEX = 9;
92
100
  var ALIGNED_AXIS_INDEX = Billboard.ALIGNED_AXIS_INDEX = 10;
93
101
  var SCALE_BY_DISTANCE_INDEX = Billboard.SCALE_BY_DISTANCE_INDEX = 11;
94
- Billboard.NUMBER_OF_PROPERTIES = 12;
102
+ var TRANSLUCENCY_BY_DISTANCE_INDEX = Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX = 12;
103
+ Billboard.NUMBER_OF_PROPERTIES = 13;
95
104
 
96
105
  function makeDirty(billboard, propertyChanged) {
97
106
  var billboardCollection = billboard._billboardCollection;
@@ -104,7 +113,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
104
113
  Billboard.prototype.getPickId = function(context) {
105
114
  if (!defined(this._pickId)) {
106
115
  this._pickId = context.createPickId({
107
- primitive : defaultValue(this._pickIdThis, this)
116
+ primitive : defaultValue(this._pickIdThis, this),
117
+ id : this._id
108
118
  });
109
119
  }
110
120
 
@@ -317,6 +327,59 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
317
327
  this._scaleByDistance = NearFarScalar.clone(scale, this._scaleByDistance);
318
328
  };
319
329
 
330
+ /**
331
+ * Returns the near and far translucency properties of a Billboard based on the billboard's distance from the camera.
332
+ *
333
+ * @memberof Billboard
334
+ *
335
+ * @returns {NearFarScalar} The near/far translucency values based on camera distance to the billboard
336
+ *
337
+ * @see Billboard#setTranslucencyByDistance
338
+ */
339
+ Billboard.prototype.getTranslucencyByDistance = function() {
340
+ return this._translucencyByDistance;
341
+ };
342
+
343
+ /**
344
+ * Sets near and far translucency properties of a Billboard based on the billboard's distance from the camera.
345
+ * A billboard's translucency will interpolate between the {@link NearFarScalar#nearValue} and
346
+ * {@link NearFarScalar#farValue} while the camera distance falls within the upper and lower bounds
347
+ * of the specified {@link NearFarScalar#near} and {@link NearFarScalar#far}.
348
+ * Outside of these ranges the billboard's translucency remains clamped to the nearest bound. If undefined,
349
+ * translucencyByDistance will be disabled.
350
+ *
351
+ * @memberof Billboard
352
+ *
353
+ * @param {NearFarScalar} translucency The configuration of near and far distances and their respective translucency values
354
+ *
355
+ * @exception {DeveloperError} far distance must be greater than near distance.
356
+ *
357
+ * @see Billboard#getTranslucencyByDistance
358
+ *
359
+ * @example
360
+ * // Example 1.
361
+ * // Set a billboard's translucency to 1.0 when the
362
+ * // camera is 1500 meters from the billboard and disappear as
363
+ * // the camera distance approaches 8.0e6 meters.
364
+ * b.setTranslucencyByDistance(new NearFarScalar(1.5e2, 1.0, 8.0e6, 0.0));
365
+ *
366
+ * // Example 2.
367
+ * // disable translucency by distance
368
+ * b.setTranslucencyByDistance(undefined);
369
+ */
370
+ Billboard.prototype.setTranslucencyByDistance = function(translucency) {
371
+ if (NearFarScalar.equals(this._translucencyByDistance, translucency)) {
372
+ return;
373
+ }
374
+
375
+ if (translucency.far <= translucency.near) {
376
+ throw new DeveloperError('far distance must be greater than near distance.');
377
+ }
378
+
379
+ makeDirty(this, TRANSLUCENCY_BY_DISTANCE_INDEX);
380
+ this._translucencyByDistance = NearFarScalar.clone(translucency, this._translucencyByDistance);
381
+ };
382
+
320
383
  /**
321
384
  * Returns the 3D Cartesian offset applied to this billboard in eye coordinates.
322
385
  *
@@ -773,13 +836,24 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
773
836
  }
774
837
  };
775
838
 
839
+ /**
840
+ * Returns the user-defined object returned when the billboard is picked.
841
+ *
842
+ * @memberof Billboard
843
+ *
844
+ * @returns {Object} The user-defined object returned when the billboard is picked.
845
+ */
846
+ Billboard.prototype.getId = function() {
847
+ return this._id;
848
+ };
849
+
776
850
  var tempCartesian4 = new Cartesian4();
777
851
  Billboard._computeActualPosition = function(position, frameState, modelMatrix) {
778
852
  if (frameState.mode === SceneMode.SCENE3D) {
779
853
  return position;
780
854
  }
781
855
 
782
- modelMatrix.multiplyByPoint(position, tempCartesian4);
856
+ Matrix4.multiplyByPoint(modelMatrix, position, tempCartesian4);
783
857
  return SceneTransforms.computeActualWgs84Position(frameState, tempCartesian4);
784
858
  };
785
859
 
@@ -790,8 +864,8 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
790
864
  var projection = camera.frustum.projectionMatrix;
791
865
 
792
866
  // Model to eye coordinates
793
- var mv = view.multiply(modelMatrix);
794
- var positionEC = mv.multiplyByPoint(position);
867
+ var mv = Matrix4.multiply(view, modelMatrix);
868
+ var positionEC = Matrix4.multiplyByPoint(mv, position);
795
869
 
796
870
  // Apply eye offset, e.g., czm_eyeOffset
797
871
  var zEyeOffset = Cartesian3.multiplyComponents(eyeOffset, Cartesian3.normalize(positionEC));
@@ -799,7 +873,7 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
799
873
  positionEC.y += eyeOffset.y + zEyeOffset.y;
800
874
  positionEC.z += zEyeOffset.z;
801
875
 
802
- var positionCC = projection.multiplyByVector(positionEC); // clip coordinates
876
+ var positionCC = Matrix4.multiplyByVector(projection, positionEC); // clip coordinates
803
877
  var positionWC = SceneTransforms.clipToWindowCoordinates(context, positionCC);
804
878
 
805
879
  // Apply pixel offset
@@ -873,7 +947,9 @@ define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Color'
873
947
  Color.equals(this._color, other._color) &&
874
948
  Cartesian2.equals(this._pixelOffset, other._pixelOffset) &&
875
949
  Cartesian3.equals(this._eyeOffset, other._eyeOffset) &&
876
- NearFarScalar.equals(this._scaleByDistance, other._scaleByDistance);
950
+ NearFarScalar.equals(this._scaleByDistance, other._scaleByDistance) &&
951
+ NearFarScalar.equals(this._translucencyByDistance, other._translucencyByDistance) &&
952
+ this._id === other._id;
877
953
  };
878
954
 
879
955
  Billboard.prototype._destroy = function() {