Class: TexturedMaterial

TexturedMaterial(webglContext, optionsopt)

`TexturedMaterial` renders geometry using a single diffuse texture (sampler2D) and UV coordinates.

Constructor

new TexturedMaterial(webglContext, optionsopt)

Parameters:
Name Type Attributes Description
webglContext WebGL2RenderingContext WebGL2 rendering context used to create shaders and upload uniforms.
options TexturedMaterialOptions <optional>
Optional configuration for the material.
Source:

Classes

TexturedMaterial

Members

diffuseTexture

Returns the current diffuse texture.
Source:

Methods

apply(matrix4)

Uploads uniforms and binds the texture for a draw call.
Parameters:
Name Type Description
matrix4 Float32Array Model-View-Projection matrix (4x4).
Source:

dispose()

Disposes GPU resources owned by the material.
Source:

setDiffuseTexture(texture, optionsopt)

Replaces the diffuse texture.
Parameters:
Name Type Attributes Description
texture Texture2D New texture instance.
options Object <optional>
Optional ownership configuration.
Properties
Name Type Attributes Default Description
ownsTexture boolean <optional>
false If true, dispose will dispose the texture.
Source: