Constructor
new BasicMaterial()
Create a BasicMaterial.
Extends
Members
acceptLight :Boolean
Whether the material is affected by lights. If set true, renderer will try to upload light uniforms.
Type:
- Boolean
- Overrides
- Default Value
- false
alphaMap :t3d.Texture2D
The alpha map.
Type:
- Overrides
- Default Value
- null
alphaMapCoord :Number
Define the UV chanel for the alpha map to use starting from 0 and defaulting to 0.
Type:
- Number
- Overrides
- Default Value
- 0
alphaMapTransform :t3d.Matrix3
The uv-transform matrix of alpha map.
Type:
- Overrides
- Default Value
- t3d.Matrix3()
alphaTest :Number
Sets the alpha value to be used when running an alpha test. The material will not be renderered if the opacity is lower than this value.
Type:
- Number
- Overrides
- Default Value
- 0
alphaToCoverage :Boolean
Enables alpha to coverage. Can only be used when MSAA is enabled.
Type:
- Boolean
- Overrides
- Default Value
- false
aoMap :t3d.Texture2D
The red channel of this texture is used as the ambient occlusion map.
Type:
- Overrides
- Default Value
- null
aoMapCoord :Number
Define the UV chanel for the ao map to use starting from 0 and defaulting to 0.
Type:
- Number
- Overrides
- Default Value
- 0
aoMapIntensity :Number
Intensity of the ambient occlusion effect.
Type:
- Number
- Overrides
- Default Value
- 1
aoMapTransform :t3d.Matrix3
The uv-transform matrix of ao map.
Type:
- Overrides
- Default Value
- t3d.Matrix3()
blendDst :t3d.BLEND_FACTOR
Blending destination. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- t3d.BLEND_FACTOR.ONE_MINUS_SRC_ALPHA
blendDstAlpha :t3d.BLEND_FACTOR
The transparency of the t3d.Material#blendDst. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- null
blendEquation :t3d.BLEND_EQUATION
Blending equation to use when applying blending. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- t3d.BLEND_EQUATION.ADD
blendEquationAlpha :t3d.BLEND_EQUATION
The tranparency of the t3d.Material#blendEquation. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- null
blendSrc :t3d.BLEND_FACTOR
Blending source. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- t3d.BLEND_FACTOR.SRC_ALPHA
blendSrcAlpha :t3d.BLEND_FACTOR
The transparency of the t3d.Material#blendSrc. The t3d.Material#blending must be set to t3d.BLEND_TYPE.CUSTOM for this to have any effect.
Type:
- Overrides
- Default Value
- null
blending :t3d.BLEND_TYPE
Which blending to use when displaying objects with this material. This must be set to t3d.BLEND_TYPE.CUSTOM to use custom blendSrc, blendDst or blendEquation.
Type:
- Overrides
- Default Value
- t3d.BLEND_TYPE.NORMAL
bumpMap :t3d.Texture2D
The texture to create a bump map. The black and white values map to the perceived depth in relation to the lights. Bump doesn't actually affect the geometry of the object, only the lighting.
Type:
- Overrides
- Default Value
- null
bumpScale :Number
How much the bump map affects the material. Typical ranges are 0-1.
Type:
- Number
- Overrides
- Default Value
- 1
clippingPlanes :Array.<t3d.Plane>
User-defined clipping planes specified as t3d.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose signed distance to the plane is negative are clipped (not rendered).
Type:
- Array.<t3d.Plane>
- Overrides
- Default Value
- null
colorWrite :Boolean
Whether to render the material's color. This can be used in conjunction with a mesh's renderOrder property to create invisible objects that occlude other objects.
Type:
- Boolean
- Overrides
- Default Value
- true
defines :Object
Custom defines of the shader. Only valid when the material type is t3d.MATERIAL_TYPE.SHADER.
Type:
- Object
- Overrides
- Default Value
- {}
depthFunc :t3d.COMPARE_FUNC
Which depth function to use. See the t3d.COMPARE_FUNC constants for all possible values.
Type:
- Overrides
- Default Value
- t3d.COMPARE_FUNC.LEQUAL
depthTest :Boolean
Whether to have depth test enabled when rendering this material.
Type:
- Boolean
- Overrides
- Default Value
- true
depthWrite :Boolean
Whether rendering this material has any effect on the depth buffer. When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
Type:
- Boolean
- Overrides
- Default Value
- true
diffuse :t3d.Color3
The diffuse color.
Type:
- Overrides
- Default Value
- t3d.Color3(0xffffff)
diffuseMap :t3d.Texture2D
The diffuse map.
Type:
- Overrides
- Default Value
- null
diffuseMapCoord :Number
Define the UV chanel for the diffuse map to use starting from 0 and defaulting to 0.
Type:
- Number
- Overrides
- Default Value
- 0
diffuseMapTransform :t3d.Matrix3
The uv-transform matrix of diffuse map. This will also affect other maps that cannot be individually specified uv transform, such as normalMap, bumpMap, etc.
Type:
- Overrides
- Default Value
- t3d.Matrix3()
dithering :Boolean
Whether to apply dithering to the color to remove the appearance of banding.
Type:
- Boolean
- Overrides
- Default Value
- false
drawMode :t3d.DRAW_MODE
Determines how the mesh triangles are constructed from the vertices.
Type:
- Overrides
- Default Value
- t3d.DRAW_MODE.TRIANGLES
emissive :t3d.Color3
Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
Type:
- Overrides
- Default Value
- t3d.Color3(0x000000)
emissiveMap :t3d.Texture2D
Set emissive (glow) map. The emissive map color is modulated by the emissive color. If you have an emissive map, be sure to set the emissive color to something other than black.
Type:
- Overrides
- Default Value
- null
emissiveMapCoord :Number
Define the UV chanel for the emissive map to use starting from 0 and defaulting to 0.
Type:
- Number
- Overrides
- Default Value
- 0
emissiveMapTransform :t3d.Matrix3
The uv-transform matrix of emissive map.
Type:
- Overrides
- Default Value
- t3d.Matrix3()
envMap :t3d.TextureCube|null|undefined
The environment map. If set to undefined, then the material will not inherit envMap from scene.environment.
Type:
- t3d.
TextureCube |null | undefined
- Overrides
- Default Value
- null
envMapCombine :t3d.ENVMAP_COMBINE_TYPE
How to combine the result of the surface's color with the environment map, if any. This has no effect in a t3d.PBRMaterial.
- Overrides
- Default Value
- t3d.ENVMAP_COMBINE_TYPE.MULTIPLY
envMapIntensity :Number
Scales the effect of the environment map by multiplying its color. This can effect both the diffuse and specular components of environment map.
Type:
- Number
- Overrides
- Default Value
- 1
fog :Boolean
Whether the material is affected by fog.
Type:
- Boolean
- Overrides
- Default Value
- true
forceUpdateUniforms :Boolean
Whether the material uniforms need to be updated every draw call. If set false, the material uniforms are only updated once per frame , this can help optimize performance.
Type:
- Boolean
- Overrides
- Default Value
- true
fragmentShader :String
Custom GLSL code for fragment shader. Only valid when the material type is t3d.MATERIAL_TYPE.SHADER.
Type:
- String
- Overrides
- Default Value
- ""
(readonly) id :Number
Unique number for this material instance.
Type:
- Number
- Overrides
needsUpdate :Boolean
Specifies that the material needs to be recompiled. This property is automatically set to true when instancing a new material.
Type:
- Boolean
- Overrides
- Default Value
- true
normalMap :t3d.Texture2D
The normal map.
Type:
- Overrides
- Default Value
- null
normalScale :t3d.Vector2
How much the normal map affects the material. Typical ranges are 0-1.
Type:
- Overrides
- Default Value
- t3d.Vector2(1,1)
opacity :Number
Float in the range of 0.0 - 1.0 indicating how transparent the material is. A value of 0.0 indicates fully transparent, 1.0 is fully opaque.
Type:
- Number
- Overrides
- Default Value
- 1
polygonOffset :Boolean
Whether to use polygon offset. This corresponds to the GL_POLYGON_OFFSET_FILL WebGL feature.
Type:
- Boolean
- Overrides
- Default Value
- false
polygonOffsetFactor :Number
Sets the polygon offset factor.
Type:
- Number
- Overrides
- Default Value
- 0
polygonOffsetUnits :Number
Sets the polygon offset units.
Type:
- Number
- Overrides
- Default Value
- 0
precision :String
Override the renderer's default precision for this material. Can be "highp", "mediump" or "lowp".
Type:
- String
- Overrides
- Default Value
- null
premultipliedAlpha :Boolean
Whether to premultiply the alpha (transparency) value.
Type:
- Boolean
- Overrides
- Default Value
- false
shaderName :String
Custom shader name. This naming can help ShaderMaterial to optimize the length of the index hash string. It is valid only when the material type is t3d.MATERIAL_TYPE.SHADER. Otherwise, if the material is a built-in type, the name of the shader will always be equal to the material type.
Type:
- String
- Overrides
- Default Value
- ""
shading :t3d.SHADING_TYPE
Define whether the material is rendered with flat shading or smooth shading.
Type:
- Overrides
- Default Value
- t3d.SHADING_TYPE.SMOOTH_SHADING
side :t3d.DRAW_SIDE
Defines which side of faces will be rendered - front, back or double.
Type:
- Overrides
- Default Value
- t3d.DRAW_SIDE.FRONT
stencilFail :t3d.OPERATION
Which stencil operation to perform when the comparison function returns false. See the t3d.OPERATION constants for all possible values.
Type:
- Overrides
- Default Value
- t3d.OPERATION.KEEP
stencilFailBack :t3d.OPERATION|null
Which stencil operation to perform when the comparison function returns false. See the t3d.OPERATION constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
- t3d.
OPERATION |null
- Overrides
- Default Value
- null
stencilFunc :t3d.COMPARE_FUNC
The stencil comparison function to use. See the t3d.COMPARE_FUNC constants for all possible values.
Type:
- Overrides
- Default Value
- t3d.COMPARE_FUNC.ALWAYS
stencilFuncBack :t3d.COMPARE_FUNC|null
The stencil comparison function to use. See the t3d.COMPARE_FUNC constants for all possible values. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
- t3d.
COMPARE_FUNC |null
- Overrides
- Default Value
- null
stencilFuncMask :Number
The bit mask to use when comparing against the stencil buffer.
Type:
- Number
- Overrides
- Default Value
- 0xFF
stencilFuncMaskBack :Number|null
The bit mask to use when comparing against the stencil buffer. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
- Number |
null
- Overrides
- Default Value
- null
stencilRef :Number
The value to use when performing stencil comparisons or stencil operations.
Type:
- Number
- Overrides
- Default Value
- 0
stencilRefBack :Number|null
The value to use when performing stencil comparisons or stencil operations. You can explicitly specify the two-sided stencil function state by defining stencilFuncBack, stencilRefBack and stencilFuncMaskBack.
Type:
- Number |
null
- Overrides
- Default Value
- null
stencilTest :Boolean
Whether stencil operations are performed against the stencil buffer. In order to perform writes or comparisons against the stencil buffer this value must be true.
Type:
- Boolean
- Overrides
- Default Value
- false
stencilWriteMask :Number
The bit mask to use when writing to the stencil buffer.
Type:
- Number
- Overrides
- Default Value
- 0xFF
stencilZFail :t3d.OPERATION
Which stencil operation to perform when the comparison function returns true but the depth test fails. See the t3d.OPERATION constants for all possible values.
Type:
- Overrides
- Default Value
- t3d.OPERATION.KEEP
stencilZFailBack :t3d.OPERATION|null
Which stencil operation to perform when the comparison function returns true but the depth test fails. See the t3d.OPERATION constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
- t3d.
OPERATION |null
- Overrides
- Default Value
- null
stencilZPass :t3d.OPERATION
Which stencil operation to perform when the comparison function returns true and the depth test passes. See the t3d.OPERATION constants for all possible values.
Type:
- Overrides
- Default Value
- t3d.OPERATION.KEEP
stencilZPassBack :t3d.OPERATION|null
Which stencil operation to perform when the comparison function returns true and the depth test passes. See the t3d.OPERATION constants for all possible values. You can explicitly specify the two-sided stencil op state by defining stencilFailBack, stencilZFailBack and stencilZPassBack.
Type:
- t3d.
OPERATION |null
- Overrides
- Default Value
- null
transparent :Boolean
Defines whether this material is transparent. This has an effect on rendering as transparent objects need special treatment and are rendered after non-transparent objects. When set to true, the extent to which the material is transparent is controlled by setting it's blending property.
Type:
- Boolean
- Overrides
- Default Value
- false
type :t3d.MATERIAL_TYPE
Type of the material.
Type:
- Overrides
- Default Value
- t3d.MATERIAL_TYPE.SHADER
uniforms :Object
Custom uniforms of the shader. Only valid when the material type is t3d.MATERIAL_TYPE.SHADER.
Type:
- Object
- Overrides
- Default Value
- {}
uuid :String
UUID of this material instance. This gets automatically assigned, so this shouldn't be edited.
Type:
- String
- Overrides
vertexColors :t3d.VERTEX_COLOR
Defines whether vertex coloring is used.
Type:
- Overrides
- Default Value
- t3d.VERTEX_COLOR.NONE
vertexShader :String
Custom GLSL code for vertex shader. Only valid when the material type is t3d.MATERIAL_TYPE.SHADER.
Type:
- String
- Overrides
- Default Value
- ""
vertexTangents :Boolean
Defines whether precomputed vertex tangents, which must be provided in a vec4 "tangent" attribute, are used. When disabled, tangents are derived automatically. Using precomputed tangents will give more accurate normal map details in some cases, such as with mirrored UVs.
Type:
- Boolean
- Overrides
- Default Value
- false
Methods
addEventListener(type, listener, thisObjectopt)
Adds a listener to an event type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type | String | The type of event to listen to. | ||
listener | function | The function that gets called when the event is fired. | ||
thisObject | Object | <optional> | this | The Object of calling listener method. |
- Overrides
clone() → {t3d.Material}
Return a new material with the same parameters as this material.
- Overrides
Returns:
- Type:
- t3d.
Material
copy(source) → {t3d.Material}
Copy the parameters from the passed material into this material.
Parameters:
Name | Type | Description |
---|---|---|
source | t3d. | The material to be copied. |
- Overrides
Returns:
- Type:
- t3d.
Material
dispatchEvent(event)
Fire an event.
Parameters:
Name | Type | Description |
---|---|---|
event | Object | The event that gets fired. |
- Overrides
dispose()
This disposes the material. Textures of a material don't get disposed. These needs to be disposed by Texture.
- Overrides
removeEventListener(type, listener, thisObjectopt)
Removes a listener from an event type.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type | String | The type of the listener that gets removed. | ||
listener | function | The listener function that gets removed. | ||
thisObject | Object | <optional> | this | thisObject - The Object of calling listener method. |
- Overrides