-
Notifications
You must be signed in to change notification settings - Fork 103
Material
daemonburrito edited this page May 3, 2011
·
8 revisions
The Material class is used to apply color, texture and other surface properties to a Mesh's Face.
Parameters:
init - This can be undefined, a single string representing the name of the Material or an object constructor. The object constructor parameters are equivalent to the object structure with the exception of Material.textures[]
being in the format Material.textures[enums.texture.map.COLOR] = [[Texture]];
Object Constructor:
- init object
-
diffuse
- Diffuse Material color, default:[1.0,1.0,1.0]
-
specular
- Specular Material color, default:[0.5, 0.5, 0.5]
-
color
- Material color, default:[1.0,1.0,1.0]
-
ambient
- Ambient emission color, default:[0.0,0.0,0.0]
-
opacity
- Opacity, default:1.0
-
shininess
- Shininess, default:1.0
-
max_smooth
- Maximum smoothing angle for this material during[[Mesh]].calculateNormals()
for automatic edge splitting. default:60.0
-
name
- Name of this material, used for retrieving materials by name. -
textures
- texture configuration object-
color
- Texture to use for this material'senums.texture.map.COLOR
binding. -
envsphere
- Texture to use for this material'senums.texture.map.ENVSPHERE
binding. -
normal
- Texture to use for this material'senums.texture.map.NORMAL
binding. -
bump
- Texture to use for this material'senums.texture.map.BUMP
binding. -
reflect
- Texture to use for this material'senums.texture.map.REFLECT
binding. -
specular
- Texture to use for this material'senums.texture.map.SPECULAR
binding. -
ambient
- Texture to use for this material'senums.texture.map.AMBIENT
binding. -
alpha
- Texture to use for this material'senums.texture.map.ALPHA
binding.
-
-
Purpose:
Apply Texture texture to the given texture_type of this material.
Parameters:
- texture - A Texture based class that will be used as the image source.
-
texture_type - (optional) The destination texture type in this material. It can be one of several CubicVR.enums:
-
enums.texture.map.COLOR
- apply to COLOR channel (default) -
enums.texture.map.SPECULAR
- apply to SPECULAR channel -
enums.texture.map.NORMAL
- apply to NORMAL channel, affects surface lighting -
enums.texture.map.BUMP
- apply to BUMP (or parallax) channel providing heights for a holographic depth effect -
enums.texture.map.REFLECT
- apply to REFLECT to determine areas reflections such as ENVSPHERE will be applied -
enums.texture.map.ENVSPHERE
- apply to ENVSPHERE to provide a spherical map reflection -
enums.texture.map.AMBIENT
- apply to AMBIENT to provide an ambient emission (brightness regardless of lighting) -
enums.texture.map.ALPHA
- apply as ALPHA clipping or ALPHA transparency depending on material opacity
-
Returns:
none