Skip to content

Commit

Permalink
Merge pull request #44 from AnalyticalGraphicsInc/sensorDome-dynamicS…
Browse files Browse the repository at this point in the history
…cene

DynamicScene & CZML domeSurfaceMaterial support
  • Loading branch information
fstoner committed Jan 23, 2014
2 parents 0fac322 + 7879562 commit d58c0cd
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Source/DynamicScene/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ define([
processMaterialPacketData(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
processMaterialPacketData(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
processMaterialPacketData(cone, 'ellipsoidHorizonSurfaceMaterial', coneData.ellipsoidHorizonSurfaceMaterial, interval, sourceUri);
processMaterialPacketData(cone, 'domeSurfaceMaterial', coneData.domeSurfaceMaterial, interval, sourceUri);
processPacketData(SensorVolumePortionToDisplay, cone, 'portionToDisplay', coneData.portionToDisplay, interval, sourceUri);
}

Expand Down Expand Up @@ -1099,6 +1100,7 @@ define([
processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri);
processMaterialPacketData(pyramid, 'material', pyramidData.material, interval, sourceUri);
processMaterialPacketData(pyramid, 'ellipsoidHorizonSurfaceMaterial', pyramidData.ellipsoidHorizonSurfaceMaterial, interval, sourceUri);
processMaterialPacketData(pyramid, 'domeSurfaceMaterial', pyramidData.domeSurfaceMaterial, interval, sourceUri);
processPacketData(SensorVolumePortionToDisplay, pyramid, 'portionToDisplay', pyramidData.portionToDisplay, interval, sourceUri);

if (defined(pyramidData.directions)) {
Expand Down
10 changes: 10 additions & 0 deletions Source/DynamicScene/DynamicCone.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ define(['../Core/defaultValue',
this._innerMaterial = undefined;
this._outerMaterial = undefined;
this._ellipsoidHorizonSurfaceMaterial = undefined;
this._domeSurfaceMaterial = undefined;
this._portionToDisplay = undefined;
this._intersectionColor = undefined;
this._intersectionWidth = undefined;
Expand Down Expand Up @@ -106,6 +107,13 @@ define(['../Core/defaultValue',
*/
ellipsoidHorizonSurfaceMaterial : createDynamicPropertyDescriptor('ellipsoidHorizonSurfaceMaterial', '_ellipsoidHorizonSurfaceMaterial'),

/**
* Gets or sets the {@link MaterialProperty} specifying the the surface appearance of the sensor's dome.
* @memberof DynamicCone.prototype
* @type {MaterialProperty}
*/
domeSurfaceMaterial : createDynamicPropertyDescriptor('domeSurfaceMaterial', '_domeSurfaceMaterial'),

/**
* Gets or sets the {@link SensorVolumePortionToDisplay} specifying the portion of the sensor to display.
* @memberof DynamicCone.prototype
Expand Down Expand Up @@ -173,6 +181,7 @@ define(['../Core/defaultValue',
result.innerMaterial = this.innerMaterial;
result.outerMaterial = this.outerMaterial;
result.ellipsoidHorizonSurfaceMaterial = this.ellipsoidHorizonSurfaceMaterial;
result.domeSurfaceMaterial = this.domeSurfaceMaterial;
result.portionToDisplay = this.portionToDisplay;
return result;
};
Expand Down Expand Up @@ -205,6 +214,7 @@ define(['../Core/defaultValue',
this.innerMaterial = defaultValue(this.innerMaterial, source.innerMaterial);
this.outerMaterial = defaultValue(this.outerMaterial, source.outerMaterial);
this.ellipsoidHorizonSurfaceMaterial = defaultValue(this.ellipsoidHorizonSurfaceMaterial, source.ellipsoidHorizonSurfaceMaterial);
this.domeSurfaceMaterial = defaultValue(this.domeSurfaceMaterial, source.domeSurfaceMaterial);
this.portionToDisplay = defaultValue(this.portionToDisplay, source.portionToDisplay);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ define([

cone.material = MaterialProperty.getValue(time, dynamicCone._outerMaterial, cone.material);
cone.ellipsoidHorizonSurfaceMaterial = MaterialProperty.getValue(time, dynamicCone._ellipsoidHorizonSurfaceMaterial, cone.ellipsoidHorizonSurfaceMaterial);
cone.domeSurfaceMaterial = MaterialProperty.getValue(time, dynamicCone._domeSurfaceMaterial, cone.domeSurfaceMaterial);

property = dynamicCone._intersectionColor;
if (defined(property)) {
Expand Down
10 changes: 10 additions & 0 deletions Source/DynamicScene/DynamicPyramid.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define(['../Core/defaultValue',
this._intersectionColor = undefined;
this._intersectionWidth = undefined;
this._ellipsoidHorizonSurfaceMaterial = undefined;
this._domeSurfaceMaterial = undefined;
this._portionToDisplay = undefined;
this._material = undefined;
this._propertyChanged = new Event();
Expand Down Expand Up @@ -101,6 +102,13 @@ define(['../Core/defaultValue',
*/
ellipsoidHorizonSurfaceMaterial : createDynamicPropertyDescriptor('ellipsoidHorizonSurfaceMaterial', '_ellipsoidHorizonSurfaceMaterial'),

/**
* Gets or sets the {@link MaterialProperty} specifying the the surface appearance of the sensor's dome.
* @memberof DynamicCone.prototype
* @type {MaterialProperty}
*/
domeSurfaceMaterial : createDynamicPropertyDescriptor('domeSurfaceMaterial', '_domeSurfaceMaterial'),

/**
* Gets or sets the {@link SensorVolumePortionToDisplay} specifying the portion of the sensor to display.
* @memberof DynamicCone.prototype
Expand Down Expand Up @@ -128,6 +136,7 @@ define(['../Core/defaultValue',
result.intersectionWidth = this.intersectionWidth;
result.material = this.material;
result.ellipsoidHorizonSurfaceMaterial = this.ellipsoidHorizonSurfaceMaterial;
result.domeSurfaceMaterial = this.domeSurfaceMaterial;
result.portionToDisplay = this.portionToDisplay;
return result;
};
Expand Down Expand Up @@ -155,6 +164,7 @@ define(['../Core/defaultValue',
this.intersectionWidth = defaultValue(this.intersectionWidth, source.intersectionWidth);
this.material = defaultValue(this.material, source.material);
this.ellipsoidHorizonSurfaceMaterial = defaultValue(this.ellipsoidHorizonSurfaceMaterial, source.ellipsoidHorizonSurfaceMaterial);
this.domeSurfaceMaterial = defaultValue(this.domeSurfaceMaterial, source.domeSurfaceMaterial);
this.portionToDisplay = defaultValue(this.portionToDisplay, source.portionToDisplay);
};

Expand Down
1 change: 1 addition & 0 deletions Source/DynamicScene/DynamicPyramidVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ define([

pyramid.material = MaterialProperty.getValue(time, dynamicPyramid._material, pyramid.material);
pyramid.ellipsoidHorizonSurfaceMaterial = MaterialProperty.getValue(time, dynamicPyramid._ellipsoidHorizonSurfaceMaterial, pyramid.ellipsoidHorizonSurfaceMaterial);
pyramid.domeSurfaceMaterial = MaterialProperty.getValue(time, dynamicPyramid._domeSurfaceMaterial, pyramid.domeSurfaceMaterial);

var property = dynamicPyramid._intersectionColor;
if (defined(property)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/CustomSensorVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ define([
* sensor.domeSurfaceMaterial.uniforms.color = new Color(1.0, 1.0, 0.0, 1.0);
*
* // 2. Change material to horizontal stripes
* sensor.dommeSurfaceMaterial = Material.fromType(Material.StripeType);
* sensor.domeSurfaceMaterial = Material.fromType(Material.StripeType);
*
* @see <a href='https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric'>Fabric</a>
*/
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/RectangularPyramidSensorVolume.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ define([
* sensor.domeSurfaceMaterial.uniforms.color = new Color(1.0, 1.0, 0.0, 1.0);
*
* // 2. Change material to horizontal stripes
* sensor.dommeSurfaceMaterial = Material.fromType(Material.StripeType);
* sensor.domeSurfaceMaterial = Material.fromType(Material.StripeType);
*
* @see <a href='https://github.com/AnalyticalGraphicsInc/cesium/wiki/Fabric'>Fabric</a>
*/
Expand Down
8 changes: 8 additions & 0 deletions Specs/DynamicScene/DynamicConeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defineSuite([
source.capMaterial = new ColorMaterialProperty();
source.innerMaterial = new ColorMaterialProperty();
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();
source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);
source.outerMaterial = new ColorMaterialProperty();
source.innerHalfAngle = new ConstantProperty(1);
Expand All @@ -40,6 +41,7 @@ defineSuite([
expect(target.capMaterial).toBe(source.capMaterial);
expect(target.innerMaterial).toBe(source.innerMaterial);
expect(target.ellipsoidHorizonSurfaceMaterial).toBe(source.ellipsoidHorizonSurfaceMaterial);
expect(target.domeSurfaceMaterial).toBe(source.domeSurfaceMaterial);
expect(target.portionToDisplay).toBe(source.portionToDisplay);
expect(target.outerMaterial).toBe(source.outerMaterial);
expect(target.innerHalfAngle).toBe(source.innerHalfAngle);
Expand All @@ -58,6 +60,7 @@ defineSuite([
source.capMaterial = new ColorMaterialProperty();
source.innerMaterial = new ColorMaterialProperty();
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();
source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);
source.outerMaterial = new ColorMaterialProperty();
source.innerHalfAngle = new ConstantProperty(1);
Expand All @@ -73,6 +76,7 @@ defineSuite([
var capMaterial = new ColorMaterialProperty();
var innerMaterial = new ColorMaterialProperty();
var ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
var domeSurfaceMaterial = new ColorMaterialProperty();
var portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);
var outerMaterial = new ColorMaterialProperty();
var innerHalfAngle = new ConstantProperty(1);
Expand All @@ -89,6 +93,7 @@ defineSuite([
target.capMaterial = capMaterial;
target.innerMaterial = innerMaterial;
target.ellipsoidHorizonSurfaceMaterial = ellipsoidHorizonSurfaceMaterial;
target.domeSurfaceMaterial = domeSurfaceMaterial;
target.portionToDisplay = portionToDisplay;
target.outerMaterial = outerMaterial;
target.innerHalfAngle = innerHalfAngle;
Expand All @@ -106,6 +111,7 @@ defineSuite([
expect(target.capMaterial).toBe(capMaterial);
expect(target.innerMaterial).toBe(innerMaterial);
expect(target.ellipsoidHorizonSurfaceMaterial).toBe(ellipsoidHorizonSurfaceMaterial);
expect(target.domeSurfaceMaterial).toBe(domeSurfaceMaterial);
expect(target.portionToDisplay).toBe(portionToDisplay);
expect(target.outerMaterial).toBe(outerMaterial);
expect(target.innerHalfAngle).toBe(innerHalfAngle);
Expand All @@ -124,6 +130,7 @@ defineSuite([
source.capMaterial = new ColorMaterialProperty();
source.innerMaterial = new ColorMaterialProperty();
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();
source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);
source.outerMaterial = new ColorMaterialProperty();
source.innerHalfAngle = new ConstantProperty(1);
Expand All @@ -140,6 +147,7 @@ defineSuite([
expect(result.capMaterial).toBe(source.capMaterial);
expect(result.innerMaterial).toBe(source.innerMaterial);
expect(result.ellipsoidHorizonSurfaceMaterial).toBe(source.ellipsoidHorizonSurfaceMaterial);
expect(result.domeSurfaceMaterial).toBe(source.domeSurfaceMaterial);
expect(result.portionToDisplay).toBe(source.portionToDisplay);
expect(result.outerMaterial).toBe(source.outerMaterial);
expect(result.innerHalfAngle).toBe(source.innerHalfAngle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ defineSuite([
cone.showIntersection = new ConstantProperty(true);
cone.radius = new ConstantProperty(123.5);
cone.show = new ConstantProperty(true);
cone.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
cone.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty(Color.RED);
cone.domeSurfaceMaterial = new ColorMaterialProperty(Color.BLUE);
cone.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);

cone.outerMaterial = new ColorMaterialProperty();
Expand All @@ -163,6 +164,7 @@ defineSuite([
expect(c.material.uniforms).toEqual(testObject.cone.outerMaterial.getValue(time));
expect(c.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time)), testObject.position.getValue(time)));
expect(c.ellipsoidHorizonSurfaceMaterial.uniforms).toEqual(cone.ellipsoidHorizonSurfaceMaterial.getValue(time));
expect(c.domeSurfaceMaterial.uniforms).toEqual(cone.domeSurfaceMaterial.getValue(time));
expect(c.portionToDisplay).toEqual(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);

cone.show.value = false;
Expand Down
10 changes: 10 additions & 0 deletions Specs/DynamicScene/DynamicPyramidSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ defineSuite([
source.showIntersection = new ConstantProperty(true);
source.intersectionWidth = new ConstantProperty(1);
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();
source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);

var target = new DynamicPyramid();
Expand All @@ -39,6 +40,7 @@ defineSuite([
expect(target.showIntersection).toBe(source.showIntersection);
expect(target.intersectionWidth).toBe(source.intersectionWidth);
expect(target.ellipsoidHorizonSurfaceMaterial).toBe(source.ellipsoidHorizonSurfaceMaterial);
expect(target.domeSurfaceMaterial).toBe(source.domeSurfaceMaterial);
expect(target.portionToDisplay).toBe(source.portionToDisplay);
});

Expand All @@ -52,6 +54,8 @@ defineSuite([
source.showIntersection = new ConstantProperty(true);
source.intersectionWidth = new ConstantProperty(1);
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();

source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);

var material = new ColorMaterialProperty();
Expand All @@ -62,6 +66,8 @@ defineSuite([
var showIntersection = new ConstantProperty(true);
var intersectionWidth = new ConstantProperty(1);
var ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
var domeSurfaceMaterial = new ColorMaterialProperty();

var portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);

var target = new DynamicPyramid();
Expand All @@ -73,6 +79,7 @@ defineSuite([
target.showIntersection = showIntersection;
target.intersectionWidth = intersectionWidth;
target.ellipsoidHorizonSurfaceMaterial = ellipsoidHorizonSurfaceMaterial;
target.domeSurfaceMaterial = domeSurfaceMaterial;
target.portionToDisplay = portionToDisplay;

target.merge(source);
Expand All @@ -85,6 +92,7 @@ defineSuite([
expect(target.showIntersection).toBe(showIntersection);
expect(target.intersectionWidth).toBe(intersectionWidth);
expect(target.ellipsoidHorizonSurfaceMaterial).toBe(ellipsoidHorizonSurfaceMaterial);
expect(target.domeSurfaceMaterial).toBe(domeSurfaceMaterial);
expect(target.portionToDisplay).toBe(portionToDisplay);
});

Expand All @@ -98,6 +106,7 @@ defineSuite([
source.showIntersection = new ConstantProperty(true);
source.intersectionWidth = new ConstantProperty(1);
source.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
source.domeSurfaceMaterial = new ColorMaterialProperty();
source.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.COMPLETE);

var result = source.clone();
Expand All @@ -109,6 +118,7 @@ defineSuite([
expect(result.showIntersection).toBe(source.showIntersection);
expect(result.intersectionWidth).toBe(source.intersectionWidth);
expect(result.ellipsoidHorizonSurfaceMaterial).toBe(source.ellipsoidHorizonSurfaceMaterial);
expect(result.domeSurfaceMaterial).toBe(source.domeSurfaceMaterial);
expect(result.portionToDisplay).toBe(source.portionToDisplay);
});

Expand Down
6 changes: 4 additions & 2 deletions Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ defineSuite([
pyramid.showIntersection = new ConstantProperty(true);
pyramid.radius = new ConstantProperty(123.5);
pyramid.show = new ConstantProperty(true);
pyramid.material = new ColorMaterialProperty();
pyramid.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty();
pyramid.material = new ColorMaterialProperty(Color.WHITE);
pyramid.ellipsoidHorizonSurfaceMaterial = new ColorMaterialProperty(Color.RED);
pyramid.domeSurfaceMaterial = new ColorMaterialProperty(Color.BLUE);
pyramid.portionToDisplay = new ConstantProperty(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);
visualizer.update(time);

Expand All @@ -151,6 +152,7 @@ defineSuite([
expect(p.material.uniforms).toEqual(testObject.pyramid.material.getValue(time));
expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time)), testObject.position.getValue(time)));
expect(p.ellipsoidHorizonSurfaceMaterial.uniforms).toEqual(testObject.pyramid.ellipsoidHorizonSurfaceMaterial.getValue(time));
expect(p.domeSurfaceMaterial.uniforms).toEqual(testObject.pyramid.domeSurfaceMaterial.getValue(time));
expect(p.portionToDisplay).toEqual(SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON);

pyramid.show.value = false;
Expand Down

0 comments on commit d58c0cd

Please sign in to comment.