B.Render.Material()

Describes a rendering method of a mesh. The material defines a set of passes for the stage grid.

To create the object use device.material().

METHODS:

device()

Returns linked rendering device.

RETURNS:

name()

Returns string name.

RETURNS:

{string}

pass(stage, pass)

Sets a pass to a stage.

PARAMETERS:

{string | B.Render.Stage} stage

object or string name

{B.Render.Pass | null} pass

RETURNS:

pass(array, pass)

Sets a pass to a set of stage.

PARAMETERS:

{Array.<(string|B.Render.Stage)>} array

of stage objects or string names

{B.Render.Pass | null} pass

RETURNS:

pass(stage)

Gets a pass from a stage.

PARAMETERS:

{string | B.Render.Stage} stage

object or string name

RETURNS:

{B.Render.Pass | null}

uniforms()

Returns array of uniforms names.

RETURNS:

{Array.<string>}

uniform(name, value)

Sets uniform value.

material.
    uniform("someNumber", 1.5).
    uniform("someVector2", B.Math.makeVector2(1, 2)).
    uniform("someVector3", B.Math.makeVector3(1, 2, 3)).
    uniform("someVector4", B.Math.makeVector4(1, 2, 3, 4)).
    uniform("someColor", B.Math.makeColor(1, 0, 0, 0.5)).
    uniform("someMatrix3", B.Math.makeMatrix3().setRotationX(Math.PI)).
    uniform("someMatrix4", B.Math.makeMatrix4().setTranslation(1, 2, 3)).
    uniform("someTexture", dev.makeTexture(image)).
    uniform("someTexture", dev.stage("someStage").output().color()).
    uniform("someDepth", dev.stage("someStage").output().depth());

material.uniform("someScalar", null); // removing

PARAMETERS:

RETURNS:

uniform(name)

Gets uniform value.

PARAMETERS:

{string} name

RETURNS:

free()

Frees all internal data and detach the resource from linked rendering device.

Note: it also removes all instances which have this material.

METHODS: