Values and type information for per-instance geometry attributes.
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Object with the following properties:
|
Throws:
-
DeveloperError : options.componentsPerAttribute must be between 1 and 4.
Example:
var instance = new SuperMap3D.GeometryInstance({
geometry : SuperMap3D.BoxGeometry.fromDimensions({
dimensions : new SuperMap3D.Cartesian3(1000000.0, 1000000.0, 500000.0)
}),
modelMatrix : SuperMap3D.Matrix4.multiplyByTranslation(SuperMap3D.Transforms.eastNorthUpToFixedFrame(
SuperMap3D.Cartesian3.fromDegrees(0.0, 0.0)), new SuperMap3D.Cartesian3(0.0, 0.0, 1000000.0), new SuperMap3D.Matrix4()),
id : 'box',
attributes : {
color : new SuperMap3D.GeometryInstanceAttribute({
componentDatatype : SuperMap3D.ComponentDatatype.UNSIGNED_BYTE,
componentsPerAttribute : 4,
normalize : true,
value : [255, 255, 0, 255]
})
}
});
See:
Members
-
componentDatatype : ComponentDatatype
-
The datatype of each component in the attribute, e.g., individual elements in
GeometryInstanceAttribute#value
.-
Default Value:
undefined
-
A number between 1 and 4 that defines the number of components in an attributes. For example, a position attribute with x, y, and z components would have 3 as shown in the code example.
-
Default Value:
undefined
Example:
show : new SuperMap3D.GeometryInstanceAttribute({ componentDatatype : SuperMap3D.ComponentDatatype.UNSIGNED_BYTE, componentsPerAttribute : 1, normalize : true, value : [1.0] })
-
When
true
andcomponentDatatype
is an integer format, indicate that the components should be mapped to the range [0, 1] (unsigned) or [-1, 1] (signed) when they are accessed as floating-point for rendering.This is commonly used when storing colors using
ComponentDatatype.UNSIGNED_BYTE
.-
Default Value:
false
Example:
attribute.componentDatatype = SuperMap3D.ComponentDatatype.UNSIGNED_BYTE; attribute.componentsPerAttribute = 4; attribute.normalize = true; attribute.value = [ SuperMap3D.Color.floatToByte(color.red), SuperMap3D.Color.floatToByte(color.green), SuperMap3D.Color.floatToByte(color.blue), SuperMap3D.Color.floatToByte(color.alpha) ];
-
The values for the attributes stored in a typed array. In the code example, every three elements in
values
defines one attributes sincecomponentsPerAttribute
is 3.-
Default Value:
undefined
Example:
show : new SuperMap3D.GeometryInstanceAttribute({ componentDatatype : SuperMap3D.ComponentDatatype.UNSIGNED_BYTE, componentsPerAttribute : 1, normalize : true, value : [1.0] })