API / geotoolkit3d / util / Attributes / Attributes
util.Attributes.Attributes
Utility class offering various functions to manipulate attributes and threejs materials.
Constructors
Methods
Methods
▸ getClassName(): string
string
▸ Static computeBoundingBoxFromIndexedBuffer(positionBuffer, indexBuffer, target?): Box3
Compute the 3D bounding box, but only considering the triangles indexed by the given index buffer.
This is useful when the BufferAttribute can include invalid data such as surfaces having NaN elevations in some Z values.
| Name | Type |
|---|---|
positionBuffer | BufferAttribute |
indexBuffer | BufferAttribute |
Optional target | Box3 |
Box3
▸ Static createLineMaterial(style): LineBasicMaterial | LineDashedMaterial
Builds a line material for the given linestyle.
Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes.
Note that supported patterns are only the simple regular ones.
Per THREEJS requirements for the LineDashedMaterial you will also have to call line.computeLineDistances() on your THREE.Line object.
Note that style.width is not supported on windows-webgl.
See:
https://threejs.org/docs/#api/en/objects/Line.computeLineDistances
http://alteredqualia.com/tmp/webgl-linewidth-test/
http://en.wikipedia.org/wiki/WebGL#Desktop_browsers
https://code.google.com/p/angleproject/issues/detail?id=334
| Name | Type | Description |
|---|---|---|
style | Type | The style to use to create a material |
LineBasicMaterial | LineDashedMaterial
The created material
▸ Static createMeshMaterial(color): MeshLambertMaterial
Build a mesh material (Lambertian reflectance) for the given fillstyle.
Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes.
To update the material color, please use Attributes.updateMeshMaterial().
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Color | The color or FillStyle to build a material for. Most known color format are accepted, such as RgbaColor, HSVColor, Three.js Color and so on. |
MeshLambertMaterial
The created material
▸ Static createPhongMeshMaterial(color): MeshPhongMaterial
Build a mesh material (Phong reflectance) for the given color/fillstyle.
Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes.
To update the material color, please use Attributes.updateMeshMaterial().
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Color | The color or FillStyle to build a material for. Most known color format are accepted, such as RgbaColor, HSVColor, Three.js Color and so on. |
MeshPhongMaterial
The created material
▸ Static createUintTypedArray(maxValue, arraySize): Uint8Array | Uint16Array | Uint32Array
Creates and returns a typed array of unsigned integers (Uint8Array, Uint16Array, or Uint32Array) that can represent the provided maximum value.
| Name | Type | Description |
|---|---|---|
maxValue | number | The maximum value for determining the type of the unsigned integer array. Depending on the value, the method selects the appropriate typed array. |
arraySize | number | The array size. |
Uint8Array | Uint16Array | Uint32Array
A typed array of unsigned integers accommodating to the specified maximum value.
▸ Static fitUintTypedArray(array, maxIndex?): Uint8Array | Uint16Array | Uint32Array
Fit the given index array to the smallest precision needed to be able to represent the maximum index.
This ensure memory savings if the maximum index is below Uint16 or Uint8 max value.
Return the same array if the type is already a good fit.
| Name | Type | Description |
|---|---|---|
array | number[] | Uint8Array | Uint16Array | Uint32Array | the array. |
Optional maxIndex | number | the maximum index value if it is known. If not defined, the given array will be parsed to evaluate the max index value. |
Uint8Array | Uint16Array | Uint32Array
the Uint BufferAttribute
▸ Static getClassName(): string
string
▸ Static getThreeColor(color): Object
Convert most known color representation to the Three.js color format, with separated opacity and RGB values.
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Color | a color representation in most known color formats. |
Object
| Name | Type |
|---|---|
color | Color |
opacity | number |
▸ Static getThreeColorFromCssRgba(color): Object
Convert a css-color or RgbaColor to a THREE.js color, with separated opacity and RGB values.
| Name | Type | Description |
|---|---|---|
color | string | RgbaColor | The color in css format or RgbaColor format. |
Object
A json containing the converted color and the corresponding opacity
| Name | Type |
|---|---|
color | Color |
opacity | number |
▸ Static updateMeshMaterial(material, color): ColorMaterial
Updates the given material color with the given FillStyle/Color.
| Name | Type | Description |
|---|---|---|
material | ColorMaterial | The material to update. |
color | string | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Color | a color representation in most known color formats. |
The updated material