new Material(geometryVertexShader, geometryFragmentShader [, lightingModel])
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
geometryVertexShader |
The vertex code for the geometry stage. |
||
geometryFragmentShader |
The fragment code for the geometry stage. |
||
lightingModel |
<optional> |
The |
Members
-
blendState
-
The blend state used for this material.
- See:
-
cullMode
-
Defines how back-face culling is applied. One of
CullMode
. -
elementType
-
An
ElementType
to describe the type of elements to render. -
fixedLights
-
Allows setting a specific set of lights to this material, avoiding having to figure out lighting dynamically. This will cause all lighting to happen in a single pass, which is generally much faster than any other option.
-
lightingModel
-
The {@options LightingModel} used to light this material.
-
name
-
The name of the material.
-
renderOrder
-
A Number that can force the order in which the material is rendered. Higher values will be rendered later!
-
writeColor
-
Defines whether or not this material should write color information. This should only be used for some special cases.
-
writeDepth
-
Defines whether or not this material should write depth information.
Methods
-
setTexture(slotName, texture)
-
Assigns a texture to the shaders with a given name.
Parameters:
Name Type Description slotName
string The name of the texture as it appears in the shader code.
texture
Texture2D The texture to assign
-
setTextureArray(slotName, texture)
-
Assigns a texture array to the shaders with a given name.
Parameters:
Name Type Description slotName
string The name of the texture array as it appears in the shader code.
texture
Array An Array of
Texture2D
objects -
setUniform(name, value [, overwrite])
-
Sets a uniform value to the shaders.
Parameters:
Name Type Argument Description name
The uniform name as it appears in the shader code.
value
The uniform value. For vectors, this can be a
Float2
,Float4
, or an Arrayoverwrite
<optional>
If the value was already set, ignore the new value. Defaults to true.
-
setUniformArray(name, value, overwrite)
-
Sets the value for a uniform array to the shaders.
Parameters:
Name Type Description name
The uniform array name as it appears in the shader code.
value
An array of values.
overwrite
(Optional) If the value was already set, ignore the new value.