每個(gè)實(shí)例的幾何圖形顏色的值和類型信息。
new ColorGeometryInstanceAttribute(red, green, blue, alpha)
Parameters:
red
(Number)
(default 1.0
)
紅色部分。
green
(Number)
(default 1.0
)
綠色組件。
blue
(Number)
(default 1.0
)
藍(lán)色部分。
alpha
(Number)
(default 1.0
)
阿爾法分量。
Example
var instance = new bmgl.GeometryInstance({
geometry : bmgl.BoxGeometry.fromDimensions({
dimensions : new bmgl.Cartesian3(1000000.0, 1000000.0, 500000.0)
}),
modelMatrix : bmgl.Matrix4.multiplyByTranslation(bmgl.Transforms.eastNorthUpToFixedFrame(
bmgl.Cartesian3.fromDegrees(0.0, 0.0)), new bmgl.Cartesian3(0.0, 0.0, 1000000.0), new bmgl.Matrix4()),
id : 'box',
attributes : {
color : new bmgl.ColorGeometryInstanceAttribute(red, green, blue, alpha)
}
});
Members
(readonly) componentDatatype : ComponentDatatype
屬性中每個(gè)組件的數(shù)據(jù)類型,例如
ColorGeometryInstanceAttribute#value
中的單個(gè)元素。
-
Default Value:
ComponentDatatype.UNSIGNED_BYTE
(readonly) componentsPerAttribute : Number
屬性中的組件數(shù),即
ColorGeometryInstanceAttribute#value
。
-
Default Value:
4
(readonly) normalize : Boolean
當(dāng)
true
和componentDatatype
為整數(shù)格式時(shí),表示當(dāng)組件作為浮點(diǎn)進(jìn)行渲染訪問時(shí),應(yīng)將它們映射到范圍[0,1](無符號)或[-1,1](有符號)中。
-
Default Value:
true
value : Uint8Array
存儲在類型化數(shù)組中的屬性值。
-
Default Value:
[255, 255, 255, 255]
Methods
(static) equals(left, right) → {Boolean}
比較提供的ColorGeometryInstanceAttributes,如果它們相等,則返回
true
,否則返回false
。
Parameters:
根據(jù)提供的
Color
創(chuàng)建新的ColorGeometryInstanceAttribute
實(shí)例。
Parameters:
Example
var instance = new bmgl.GeometryInstance({
geometry : geometry,
attributes : {
color : bmgl.ColorGeometryInstanceAttribute.fromColor(bmgl.Color.CORNFLOWERBLUE),
}
});
將顏色轉(zhuǎn)換為可用于指定顏色屬性的類型化數(shù)組。
Parameters:
result
(Uint8Array)
存儲結(jié)果的數(shù)組,如果未定義,將創(chuàng)建一個(gè)新實(shí)例。
Example
var attributes = primitive.getGeometryInstanceAttributes('an id');
attributes.color = bmgl.ColorGeometryInstanceAttribute.toValue(bmgl.Color.AQUA, attributes.color);