Last updated

API / geotoolkit3d / util / Attributes / Attributes

Class: Attributes

util.Attributes.Attributes

Utility class offering various functions to manipulate attributes and threejs materials.

Table of contents

Constructors
Methods

Contents

Constructors

new Attributes()

new Attributes()

Methods

getClassName

getClassName(): string

Returns

string


computeBoundingBoxFromIndexedBuffer

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.

Parameters

Name Type
positionBufferBufferAttribute
indexBufferBufferAttribute
Optional targetBox3

Returns

Box3


createLineMaterial

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

Parameters

Name Type Description
styleTypeThe style to use to create a material

Returns

LineBasicMaterial | LineDashedMaterial

The created material


createMeshMaterial

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().

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColor | FillStyle | Options | ColorThe color or FillStyle to build a material for. Most known color format are accepted, such as RgbaColor, HSVColor, Three.js Color and so on.

Returns

MeshLambertMaterial

The created material


createPhongMeshMaterial

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().

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColor | FillStyle | Options | ColorThe color or FillStyle to build a material for. Most known color format are accepted, such as RgbaColor, HSVColor, Three.js Color and so on.

Returns

MeshPhongMaterial

The created material


createUintTypedArray

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.

Parameters

Name Type Description
maxValuenumberThe maximum value for determining the type of the unsigned integer array. Depending on the value, the method selects the appropriate typed array.
arraySizenumberThe array size.

Returns

Uint8Array | Uint16Array | Uint32Array

A typed array of unsigned integers accommodating to the specified maximum value.


fitUintTypedArray

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.

Parameters

Name Type Description
arraynumber[] | Uint8Array | Uint16Array | Uint32Arraythe array.
Optional maxIndexnumberthe maximum index value if it is known. If not defined, the given array will be parsed to evaluate the max index value.

Returns

Uint8Array | Uint16Array | Uint32Array

the Uint BufferAttribute


getClassName

Static getClassName(): string

Returns

string


getThreeColor

Static getThreeColor(color): Object

Convert most known color representation to the Three.js color format, with separated opacity and RGB values.

Parameters

Name Type Description
colorstring | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Colora color representation in most known color formats.

Returns

Object

NameType
colorColor
opacitynumber

getThreeColorFromCssRgba

Static getThreeColorFromCssRgba(color): Object

Convert a css-color or RgbaColor to a THREE.js color, with separated opacity and RGB values.

Parameters

Name Type Description
colorstring | RgbaColorThe color in css format or RgbaColor format.

Returns

Object

A json containing the converted color and the corresponding opacity

NameType
colorColor
opacitynumber

updateMeshMaterial

Static updateMeshMaterial(material, color): ColorMaterial

Updates the given material color with the given FillStyle/Color.

Parameters

Name Type Description
materialColorMaterialThe material to update.
colorstring | RgbaColor | HsvColor | HlsColor | FillStyle | Options | Colora color representation in most known color formats.

Returns

ColorMaterial

The updated material