diff --git a/Apps/Sandcastle/gallery/development/Ground Polyline Material.html b/Apps/Sandcastle/gallery/development/Ground Polyline Material.html new file mode 100644 index 000000000000..5d6348eb4ce4 --- /dev/null +++ b/Apps/Sandcastle/gallery/development/Ground Polyline Material.html @@ -0,0 +1,96 @@ + + +
+ + + + + +
*
- * Only to be used with GeometryInstances containing {@link GroundPolylineGeometry}
+ * Only to be used with GeometryInstances containing {@link GroundPolylineGeometry}.
*
* @param {Object} [options] Object with the following properties:
* @param {Array|GeometryInstance} [options.geometryInstances] GeometryInstances containing GroundPolylineGeometry
* @param {Appearance} [options.appearance] The Appearance used to render the polyline. Defaults to a white color {@link Material} on a {@link PolylineMaterialAppearance}.
* @param {Boolean} [options.show=true] Determines if this primitive will be shown.
- * @param {Boolean} [options.vertexCacheOptimize=false] When true
, geometry vertices are optimized for the pre and post-vertex-shader caches.
* @param {Boolean} [options.interleave=false] When true
, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.
- * @param {Boolean} [options.compressVertices=true] When true
, the geometry vertices are compressed, which will save memory.
* @param {Boolean} [options.releaseGeometryInstances=true] When true
, the primitive does not keep a reference to the input geometryInstances
to save memory.
* @param {Boolean} [options.allowPicking=true] When true
, each geometry instance will only be pickable with {@link Scene#pick}. When false
, GPU memory is saved.
* @param {Boolean} [options.asynchronous=true] Determines if the primitive will be created asynchronously or block until ready. If false initializeTerrainHeights() must be called first.
* @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Determines if this primitive's commands' bounding spheres are shown.
- * @param {Boolean} [options.debugShowShadowVolume=false] For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be true
on
- * creation for the volumes to be created before the geometry is released or options.releaseGeometryInstance must be false
.
+ * @param {Boolean} [options.debugShowShadowVolume=false] For debugging only. Determines if the shadow volume for each geometry in the primitive is drawn. Must be true
on creation to have effect.
*
+ * @example
+ * // 1. Draw a polyline on terrain with a basic color material
+ *
+ * var instance = new Cesium.GeometryInstance({
+ * geometry : new Cesium.GroundPolylineGeometry({
+ * positions : Cesium.Cartesian3.fromDegreesArray([
+ * -112.1340164450331, 36.05494287836128,
+ * -112.08821010582645, 36.097804071380715
+ * ]),
+ * width : 4.0
+ * }),
+ * id : 'object returned when this instance is picked and to get/set per-instance attributes'
+ * });
+ *
+ * scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
+ * geometryInstances : instance,
+ * appearance : new Cesium.PolylineMaterialAppearance({
+ * material : Cesium.Material.fromType('Color')
+ * })
+ * }));
+ *
+ * // 2. Draw a looped polyline on terrain with per-instance color and a distance display condition.
+ * // Distance display conditions for polylines on terrain are based on an approximate terrain height
+ * // instead of true terrain height.
+ *
+ * var instance = new Cesium.GeometryInstance({
+ * geometry : new Cesium.GroundPolylineGeometry({
+ * positions : Cesium.Cartesian3.fromDegreesArray([
+ * -112.1340164450331, 36.05494287836128,
+ * -112.08821010582645, 36.097804071380715,
+ * -112.13296079730024, 36.168769146801104
+ * ]),
+ * loop : true,
+ * width : 4.0
+ * }),
+ * attributes : {
+ * color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString('green').withAlpha(0.7)),
+ distanceDisplayCondition : new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(1000, 30000)
+ * },
+ * id : 'object returned when this instance is picked and to get/set per-instance attributes'
+ * });
+ *
+ * scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({
+ * geometryInstances : instance,
+ * appearance : Cesium.PolylineColorAppearance()
+ * }));
*/
function GroundPolylinePrimitive(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
@@ -146,12 +181,12 @@ define([
this._primitiveOptions = {
geometryInstances : undefined,
appearance : undefined,
- vertexCacheOptimize : defaultValue(options.vertexCacheOptimize, false),
+ vertexCacheOptimize : false,
interleave : defaultValue(options.interleave, false),
releaseGeometryInstances : defaultValue(options.releaseGeometryInstances, true),
allowPicking : defaultValue(options.allowPicking, true),
asynchronous : defaultValue(options.asynchronous, true),
- compressVertices : defaultValue(options.compressVertices, true),
+ compressVertices : false,
_createShaderProgramFunction : undefined,
_createCommandsFunction : undefined,
_updateAndQueueCommandsFunction : undefined
@@ -191,22 +226,6 @@ define([
}
defineProperties(GroundPolylinePrimitive.prototype, {
- /**
- * When true
, geometry vertices are optimized for the pre and post-vertex-shader caches.
- *
- * @memberof GroundPolylinePrimitive.prototype
- *
- * @type {Boolean}
- * @readonly
- *
- * @default true
- */
- vertexCacheOptimize : {
- get : function() {
- return this._primitiveOptions.vertexCacheOptimize;
- }
- },
-
/**
* Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
*
@@ -271,22 +290,6 @@ define([
}
},
- /**
- * When true
, geometry vertices are compressed, which will save memory.
- *
- * @memberof GroundPolylinePrimitive.prototype
- *
- * @type {Boolean}
- * @readonly
- *
- * @default true
- */
- compressVertices : {
- get : function() {
- return this._primitiveOptions.compressVertices;
- }
- },
-
/**
* Determines if the primitive is complete and ready to render. If this property is
* true, the primitive will be rendered the next time that {@link GroundPolylinePrimitive#update}
diff --git a/Specs/Scene/GroundPolylinePrimitiveSpec.js b/Specs/Scene/GroundPolylinePrimitiveSpec.js
index d6806506ea59..4386e892259d 100644
--- a/Specs/Scene/GroundPolylinePrimitiveSpec.js
+++ b/Specs/Scene/GroundPolylinePrimitiveSpec.js
@@ -1,6 +1,5 @@
defineSuite([
'Scene/GroundPolylinePrimitive',
- 'Core/ApproximateTerrainHeights',
'Core/Color',
'Core/ColorGeometryInstanceAttribute',
'Core/Cartesian3',
@@ -21,7 +20,6 @@ defineSuite([
'Specs/pollToPromise'
], function(
GroundPolylinePrimitive,
- ApproximateTerrainHeights,
Color,
ColorGeometryInstanceAttribute,
Cartesian3,
@@ -160,9 +158,7 @@ defineSuite([
expect(groundPolylinePrimitive.geometryInstances).not.toBeDefined();
expect(groundPolylinePrimitive.appearance instanceof PolylineMaterialAppearance).toBe(true);
expect(groundPolylinePrimitive.show).toEqual(true);
- expect(groundPolylinePrimitive.vertexCacheOptimize).toEqual(false);
expect(groundPolylinePrimitive.interleave).toEqual(false);
- expect(groundPolylinePrimitive.compressVertices).toEqual(true);
expect(groundPolylinePrimitive.releaseGeometryInstances).toEqual(true);
expect(groundPolylinePrimitive.allowPicking).toEqual(true);
expect(groundPolylinePrimitive.asynchronous).toEqual(true);
@@ -176,9 +172,7 @@ defineSuite([
groundPolylinePrimitive = new GroundPolylinePrimitive({
geometryInstances : geometryInstances,
show : false,
- vertexCacheOptimize : true,
interleave : true,
- compressVertices : false,
releaseGeometryInstances : false,
allowPicking : false,
asynchronous : false,
@@ -188,9 +182,7 @@ defineSuite([
expect(groundPolylinePrimitive.geometryInstances).toEqual(geometryInstances);
expect(groundPolylinePrimitive.show).toEqual(false);
- expect(groundPolylinePrimitive.vertexCacheOptimize).toEqual(true);
expect(groundPolylinePrimitive.interleave).toEqual(true);
- expect(groundPolylinePrimitive.compressVertices).toEqual(false);
expect(groundPolylinePrimitive.releaseGeometryInstances).toEqual(false);
expect(groundPolylinePrimitive.allowPicking).toEqual(false);
expect(groundPolylinePrimitive.asynchronous).toEqual(false);