Geometry instancing allows one Geometry object to be positions in several
different locations and colored uniquely. For example, one BoxGeometry can
be instanced several times, each with a different modelMatrix to change
its position, rotation, and scale.
alias GeometryInstance
The options object takes the following properties
{Geometry} options.geometry The geometry to instance.
{Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix that transforms to transform the geometry from model to world coordinates.
// Create geometry for a box, and two instances that refer to it.
// One instance positions the box on the bottom and colored aqua.
// The other instance positions the box on the top and color white.
var geometry = Cesium.BoxGeometry.fromDimensions({
vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL,
dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0)
});
var instanceBottom = new Cesium.GeometryInstance({
geometry : geometry,
modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
},
id : 'bottom'
});
var instanceTop = new Cesium.GeometryInstance({
geometry : geometry,
modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 3000000.0), new Cesium.Matrix4()),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA)
},
id : 'top'
});
Geometry instancing allows one Geometry object to be positions in several different locations and colored uniquely. For example, one BoxGeometry can be instanced several times, each with a different
modelMatrix
to change its position, rotation, and scale.alias GeometryInstance
// Create geometry for a box, and two instances that refer to it. // One instance positions the box on the bottom and colored aqua. // The other instance positions the box on the top and color white. var geometry = Cesium.BoxGeometry.fromDimensions({ vertexFormat : Cesium.VertexFormat.POSITION_AND_NORMAL, dimensions : new Cesium.Cartesian3(1000000.0, 1000000.0, 500000.0) }); var instanceBottom = new Cesium.GeometryInstance({ geometry : geometry, modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame( Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 1000000.0), new Cesium.Matrix4()), attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA) }, id : 'bottom' }); var instanceTop = new Cesium.GeometryInstance({ geometry : geometry, modelMatrix : Cesium.Matrix4.multiplyByTranslation(Cesium.Transforms.eastNorthUpToFixedFrame( Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883)), new Cesium.Cartesian3(0.0, 0.0, 3000000.0), new Cesium.Matrix4()), attributes : { color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.AQUA) }, id : 'top' });
Geometry