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 |
Properties:
| Name | Type | Description |
|---|---|---|
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! |
Members
-
blendState
-
The blend state used for this material.
- See:
-
cullMode
-
Defines how back-face culling is applied. One of
CullMode. -
debugMode
-
Allows setting the output to something different than the lit material, such as normals.
-
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.
-
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 slotNamestring The name of the texture as it appears in the shader code.
textureTexture2D The texture to assign
-
setTextureArray(slotName, texture)
-
Assigns a texture array to the shaders with a given name.
Parameters:
Name Type Description slotNamestring The name of the texture array as it appears in the shader code.
textureArray An Array of
Texture2Dobjects -
setUniform(name, value [, overwrite])
-
Sets a uniform value to the shaders.
Parameters:
Name Type Argument Description nameThe uniform name as it appears in the shader code.
valueThe 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 nameThe uniform array name as it appears in the shader code.
valueAn array of values.
overwrite(Optional) If the value was already set, ignore the new value.