Class: Material

Material(webglContext, shaderProgram, optionsopt)

Base material that owns a shader program, opacity and wireframe flag.

Constructor

new Material(webglContext, shaderProgram, optionsopt)

Parameters:
Name Type Attributes Description
webglContext WebGL2RenderingContext WebGL2 rendering context used to create and manage GPU resources.
shaderProgram ShaderProgram Compiled and linked shader program used by this material for rendering.
options MaterialOptions <optional>
Material options.
Source:

Classes

Material

Members

isDisposed

Indicates whether this material has been disposed.
Source:

opacity

Returns the current opacity multiplier.
Source:

shaderProgram

Source:

webglContext

Source:

Methods

dispose()

Releases GPU resources owned by this material. If ownsShaderProgram is true, the underlying shader program will be disposed as well.
Source:

isTransparent() → {boolean}

Source:
Returns:
True, when opacity is lower than `1.0`.
Type
boolean

isWireframeEnabled() → {boolean}

Source:
Returns:
- True, when wireframe rendering is enabled and false for solid rendering.
Type
boolean

setOpacity(value)

Sets opacity multiplier (alpha).
Parameters:
Name Type Description
value number Opacity multiplier in [0..1].
Source:

setWireframeEnabled(enabled)

Enables or disables wireframe rendering.
Parameters:
Name Type Description
enabled boolean When true, switches material to wireframe mode. When false, uses solid rendering.
Source:

toggleWireframe()

Toggles wireframe mode.
Source:

use()

Makes this material's shader program active.
Source: