Constructor
new MeshInstance(node, mesh, material)
Create a new mesh instance.
Parameters:
Name | Type | Description |
---|---|---|
node |
pc.GraphNode | The graph node defining the transform for this instance. |
mesh |
pc.Mesh | The graphics mesh being instanced. |
material |
pc.Material | The material used to render this instance. |
Properties:
Name | Type | Description |
---|---|---|
aabb |
pc.BoundingBox | The world space axis-aligned bounding box for this mesh instance. |
castShadow |
Boolean | Controls whether the mesh instance casts shadows. Defaults to false. |
visible |
Boolean | Enable rendering for this mesh instance. Use visible property to enable/disable rendering without overhead of removing from scene. But note that the mesh instance is still in the hierarchy and still in the draw call list. |
material |
pc.Material | The material used by this mesh instance. |
renderStyle |
Number | The render style of the mesh instance. Can be:
|
cull |
Boolean | Controls whether the mesh instance can be culled by with frustum culling (pc.CameraComponent#frustumCulling). |
drawOrder |
Number | Use this value to affect rendering order of mesh instances. Only used when mesh instances are added to a pc.Layer with pc.Layer#opaqueSortMode or pc.Layer#transparentSortMode (depending on the material) set to pc.SORTMODE_MANUAL. |
visibleThisFrame |
Boolean | Read this value in pc.Layer#onPostCull to determine if the object is actually going to be rendered. |
- Source:
Example
// Create a mesh instance pointing to a 1x1x1 'cube' mesh
var mesh = pc.createBox(graphicsDevice);
var material = new pc.StandardMaterial();
var node = new pc.GraphNode();
var meshInstance = new pc.MeshInstance(node, mesh, material);
Members
mask :Number
Mask controlling which pc.LightComponents light this mesh instance, which pc.CameraComponent sees it and in which pc.Layer it is rendered.
Defaults to 1.
Type:
- Number
- Source: