Class MeshInstance_EX

Hierarchy

  • MeshInstance
    • MeshInstance_EX

Constructors

  • Create a new MeshInstance instance.

    Example

    // Create a mesh instance pointing to a 1x1x1 'cube' mesh
    var mesh = pc.createBox(graphicsDevice);
    var material = new pc.StandardMaterial();

    var meshInstance = new pc.MeshInstance(mesh, material);

    var entity = new pc.Entity();
    entity.addComponent('render', {
    meshInstances: [meshInstance]
    });

    // Add the entity to the scene hierarchy
    this.app.scene.root.addChild(entity);

    Parameters

    • mesh: Mesh

      The graphics mesh to instance.

    • material: Material

      The material to use for this mesh instance.

    • Optional node: GraphNode

      The graph node defining the transform for this instance. This parameter is optional when used with RenderComponent and will use the node the component is attached to.

    Returns MeshInstance_EX

Properties

_aabb: any
_aabbVer: number
_calculateSortDistance: any
_key: number[]
_layer: any
_lightHash: number
_mesh: Mesh
_noDepthDrawGl1: boolean
_receiveShadow: boolean
_screenSpace: boolean
_shaderDefs: number
_staticLightList: any
_staticSource: any
_updateAabb: boolean
_updateAabbFunc: any
castShadow: boolean
cull: boolean

Controls whether the mesh instance can be culled by frustum culling (CameraComponent#frustumCulling).

drawOrder: number

Use this value to affect rendering order of mesh instances. Only used when mesh instances are added to a Layer with Layer#opaqueSortMode or Layer#transparentSortMode (depending on the material) set to SORTMODE_MANUAL.

flipFaces: boolean
instancingData: InstancingData
isStatic: boolean
isVisibleFunc: any
node: GraphNode

The graph node defining the transform for this instance.

parameters: {}

Type declaration

    stencilBack: any
    stencilFront: any
    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.

    visibleThisFrame: boolean

    Read this value in Layer#onPostCull to determine if the object is actually going to be rendered.

    lightmapParamNames: string[]

    Accessors

    • get aabb(): any
    • Returns any

    • set aabb(arg: any): void
    • The world space axis-aligned bounding box for this mesh instance.

      Parameters

      • arg: any

      Returns void

    • get calculateSortDistance(): any
    • Returns any

    • set calculateSortDistance(arg: any): void
    • In some circumstances mesh instances are sorted by a distance calculation to determine their rendering order. Set this callback to override the default distance calculation, which gives the dot product of the camera forward vector and the vector between the camera position and the center of the mesh instance's axis-aligned bounding box. This option can be particularly useful for rendering transparent meshes in a better order than default.

      Parameters

      • arg: any

      Returns void

    • get instancingCount(): number
    • Returns number

    • set instancingCount(arg: number): void
    • Number of instances when using hardware instancing to render the mesh.

      Parameters

      • arg: number

      Returns void

    • get key(): number
    • Returns number

    • set key(arg: number): void
    • Parameters

      • arg: number

      Returns void

    • get layer(): any
    • Returns any

    • set layer(arg: any): void
    • Parameters

      • arg: any

      Returns void

    • get mask(): number
    • Returns number

    • set mask(arg: number): void
    • Mask controlling which LightComponents light this mesh instance, which CameraComponent sees it and in which Layer it is rendered. Defaults to 1.

      Parameters

      • arg: number

      Returns void

    • get material(): Material
    • Returns Material

    • set material(arg: Material): void
    • The material used by this mesh instance.

      Parameters

      • arg: Material

      Returns void

    • get mesh(): Mesh
    • Returns Mesh

    • set mesh(arg: Mesh): void
    • The graphics mesh being instanced.

      Parameters

      • arg: Mesh

      Returns void

    • get morphInstance(): MorphInstance
    • Returns MorphInstance

    • set morphInstance(arg: MorphInstance): void
    • The morph instance managing morphing of this mesh instance, or null if morphing is not used.

      Parameters

      • arg: MorphInstance

      Returns void

    • get receiveShadow(): boolean
    • Returns boolean

    • set receiveShadow(arg: boolean): void
    • Parameters

      • arg: boolean

      Returns void

    • get renderStyle(): number
    • Returns number

    • set renderStyle(arg: number): void
    • The render style of the mesh instance. Can be:

      • RENDERSTYLE_SOLID
      • RENDERSTYLE_WIREFRAME
      • RENDERSTYLE_POINTS

      Defaults to RENDERSTYLE_SOLID.

      Parameters

      • arg: number

      Returns void

    • get screenSpace(): boolean
    • Returns boolean

    • set screenSpace(arg: boolean): void
    • Parameters

      • arg: boolean

      Returns void

    • get skinInstance(): SkinInstance
    • Returns SkinInstance

    • set skinInstance(arg: SkinInstance): void
    • The skin instance managing skinning of this mesh instance, or null if skinning is not used.

      Parameters

      • arg: SkinInstance

      Returns void

    Methods

    • Parameters

      • camera: any

      Returns any

    • Returns void

    • Returns void

    • Deletes a shader parameter on a mesh instance.

      Parameters

      • name: string

        The name of the parameter to delete.

      Returns void

    • Returns void

    • Retrieves the specified shader parameter from a mesh instance.

      Returns

      The named parameter.

      Parameters

      • name: string

        The name of the parameter to query.

      Returns object

    • Returns {}

      • 检测射线与此meshInstance的交点

        Returns

        交点集合

        Parameters

        • worldRay: Ray

          要求交的射线

        • Optional intersects: intersect[]

          交点集合(不传则创建新的数组)

        Returns intersect[]

      • Parameters

        • aabb: any

        Returns void

      • Sets up MeshInstance to be rendered using Hardware Instancing.

        Parameters

        • vertexBuffer: VertexBuffer

          Vertex buffer to hold per-instance vertex data (usually world matrices). Pass null to turn off hardware instancing.

        Returns void

      • Parameters

        • value: any

        Returns void

      • Sets a shader parameter on a mesh instance. Note that this parameter will take precedence over parameter of the same name if set on Material this mesh instance uses for rendering.

        Parameters

        • name: string

          The name of the parameter to set.

        • data: number | number[] | Texture

          The value for the specified parameter.

        • Optional passFlags: number

          Mask describing which passes the material should be included in.

        Returns void

      • Parameters

        • device: any
        • passFlag: any

        Returns void

      • Parameters

        • name: any
        • texture: any

        Returns void

      • Returns void

      • Parameters

        • meshInstances: any
        • renderStyle: any

        Returns void