Skip to main content

Class: Material

Defined in: rendering/materials/material.ts:19

Extended by

Constructors

Constructor

new Material(vertexShaderSource, fragmentShaderSource, gl): Material

Defined in: rendering/materials/material.ts:25

Parameters

vertexShaderSource

string

fragmentShaderSource

string

gl

WebGL2RenderingContext

Returns

Material

Properties

program

readonly program: WebGLProgram

Defined in: rendering/materials/material.ts:20

Methods

bind()

bind(gl): void

Defined in: rendering/materials/material.ts:42

Binds the material (program, uniforms, textures).

Parameters

gl

WebGL2RenderingContext

Returns

void


setColorUniform()

setColorUniform(name, color): void

Defined in: rendering/materials/material.ts:122

Sets a color uniform as a float32 array using the color's RGBA values.

Parameters

name

string

color

Color

Returns

void


setUniform()

setUniform(name, value): void

Defined in: rendering/materials/material.ts:109

Sets a uniform value (number, vec2, matrix, texture, etc.).

Parameters

name

string

value

UniformValue

Returns

void


setVectorUniform()

setVectorUniform(name, vector): void

Defined in: rendering/materials/material.ts:129

Sets a vector2 or Vector3 uniform as a float32 array using the vector's elements.

Parameters

name

string

vector

Vector2 | Vector3

Returns

void