Material
ClassAn asset that describes how visual objects should appear.
- Available on all platforms
Index
Remarks
Each Material is a collection of Pass which define the actual rendering passes. Materials are used by MaterialMeshVisual for drawing meshes in the scene.
Example
// Gets the first pass of a material on a sprite and plays the animation from its texture
var sprite = script.getSceneObject().getFirstComponent(SpriteVisual.getTypeName());
var material = sprite.getMaterial(0);
material.getPass(0).baseTex.control.play(-1,0.0);
// Print number of passes
print("Pass count = " + material.getPassCount().toString());
Extends
Properties
mainPass
mainPass:
Pass
The first Pass of the Material, or null if the Material has no passes.
Default Value
null
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
clone()
clone():
Material
Returns a copy of the Material.
Returns
Material
getPass()
getPass(
index):Pass
Returns the Pass of the Material at index index.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
getPassCount()
getPassCount():
number
Returns the number of Pass for the Material.
Returns
number
getTypeName()
staticgetTypeName():TypeName<Material>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<Material>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean