API / geotoolkit3d / util / Attributes / Attributes
util.Attributes.Attributes
Utility class offering various functions to manipulate attributes and threejs materials.<br> <br>
Constructors
- [new Attributes()](/solutions/geotoolkit/GeoToolkit_JS/apis/classes/geotoolkit3d.util-5.attributes.attributes.md#new attributes())
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.<br> 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.<br> Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes.<br> <br> Note that supported patterns are only the simple regular ones.<br> Per THREEJS requirements for the LineDashedMaterial you will also have to call line.computeLineDistances() on your THREE.Line object.<br> <br> Note that style.width is not supported on windows-webgl.<br> See:<br> https://threejs.org/docs/#api/en/objects/Line.computeLineDistances<br> http://alteredqualia.com/tmp/webgl-linewidth-test/<br> http://en.wikipedia.org/wiki/WebGL#Desktop_browsers<br> https://code.google.com/p/angleproject/issues/detail?id=334<br> <br>
| 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.<br> Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes. <br> 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.<br> Note that current implementation assumes that the given style is immutable and therefore will not listen to its changes. <br> 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.<br> This ensure memory savings if the maximum index is below Uint16 or Uint8 max value.<br> 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 getNewTypedArray(sourceTypedArray, size): any[] | TypedArray
Return a new typed array of the same type as "sourceTypedArray", of size specified by "size".
| Name | Type |
|---|---|
sourceTypedArray | any[] | TypedArray |
size | number |
any[] | TypedArray
▸ 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.<br>
| 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