Example:
// 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 = SuperMap3D.BoxGeometry.fromDimensions({
vertexFormat : SuperMap3D.VertexFormat.POSITION_AND_NORMAL,
dimensions : new SuperMap3D.Cartesian3(1000000.0, 1000000.0, 500000.0)
});
var instanceBottom = new SuperMap3D.GeometryInstance({
geometry : geometry,
modelMatrix : SuperMap3D.Matrix4.multiplyByTranslation(SuperMap3D.Transforms.eastNorthUpToFixedFrame(
SuperMap3D.Cartesian3.fromDegrees(-75.59777, 40.03883)), new SuperMap3D.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap3D.Matrix4()),
attributes : {
color : SuperMap3D.ColorGeometryInstanceAttribute.fromColor(SuperMap3D.Color.AQUA)
},
id : 'bottom'
});
var instanceTop = new SuperMap3D.GeometryInstance({
geometry : geometry,
modelMatrix : SuperMap3D.Matrix4.multiplyByTranslation(SuperMap3D.Transforms.eastNorthUpToFixedFrame(
SuperMap3D.Cartesian3.fromDegrees(-75.59777, 40.03883)), new SuperMap3D.Cartesian3(0.0, 0.0, 3000000.0), new SuperMap3D.Matrix4()),
attributes : {
color : SuperMap3D.ColorGeometryInstanceAttribute.fromColor(SuperMap3D.Color.AQUA)
},
id : 'top'
});
See: