Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SubMesh

Defines a subdivision inside a mesh

Hierarchy

  • SubMesh

Implements

Index

Constructors

constructor

  • new SubMesh(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean, addToMesh?: boolean): SubMesh
  • Creates a new submesh

    Parameters

    • materialIndex: number

      defines the material index to use

    • verticesStart: number

      defines vertex index start

    • verticesCount: number

      defines vertices count

    • indexStart: number

      defines index start

    • indexCount: number

      defines indices count

    • mesh: AbstractMesh

      defines the parent mesh

    • Optional renderingMesh: Mesh

      defines an optional rendering mesh

    • Optional createBoundingBox: boolean

      defines if bounding box should be created for this submesh

    • Optional addToMesh: boolean

      defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)

    Returns SubMesh

Properties

indexCountSearch playground for indexCount

indexCount: number

indices count

indexStartSearch playground for indexStart

indexStart: number

index start

materialIndexSearch playground for materialIndex

materialIndex: number

the material index to use

verticesCountSearch playground for verticesCount

verticesCount: number

vertices count

verticesStartSearch playground for verticesStart

verticesStart: number

vertex index start

Accessors

IsGlobal

  • get IsGlobal(): boolean
  • Returns true if this submesh covers the entire parent mesh

    ignorenaming

    Returns boolean

effect

  • Gets associated (main) effect (possibly the effect override if defined)

    Returns Nullable<Effect>

materialDefines

  • Gets material defines used by the effect associated to the sub mesh

    Returns Nullable<MaterialDefines>

  • Sets material defines used by the effect associated to the sub mesh

    Parameters

    Returns any

Methods

canIntersectsSearch playground for canIntersects

  • canIntersects(ray: Ray): boolean
  • Checks if the submesh intersects with a ray

    Parameters

    • ray: Ray

      defines the ray to test

    Returns boolean

    true is the passed ray intersects the submesh bounding box

cloneSearch playground for clone

  • Creates a new submesh from the passed mesh

    Parameters

    • newMesh: AbstractMesh

      defines the new hosting mesh

    • Optional newRenderingMesh: Mesh

      defines an optional rendering mesh

    Returns SubMesh

    the new submesh

disposeSearch playground for dispose

  • dispose(): void
  • Release associated resources

    Returns void

getBoundingInfoSearch playground for getBoundingInfo

  • Returns the submesh BoundingInfo object

    Returns BoundingInfo

    current bounding info (or mesh's one if the submesh is global)

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the class name

    Returns string

    the string "SubMesh".

getEffectiveMeshSearch playground for getEffectiveMesh

  • Returns the effective mesh of the submesh

    Returns AbstractMesh

    the effective mesh (could be different from parent mesh)

getMaterialSearch playground for getMaterial

  • Returns the submesh material

    Parameters

    • Optional getDefaultMaterial: boolean

      Defines whether or not to get the default material if nothing has been defined.

    Returns Nullable<Material>

    null or the current material

getMeshSearch playground for getMesh

  • Returns the mesh of the current submesh

    Returns AbstractMesh

    the parent mesh

getRenderingMeshSearch playground for getRenderingMesh

  • getRenderingMesh(): Mesh
  • Returns the rendering mesh of the submesh

    Returns Mesh

    the rendering mesh (could be different from parent mesh)

getReplacementMeshSearch playground for getReplacementMesh

  • Returns the replacement mesh of the submesh

    Returns Nullable<AbstractMesh>

    the replacement mesh (could be different from parent mesh)

intersectsSearch playground for intersects

  • Intersects current submesh with a ray

    Parameters

    • ray: Ray

      defines the ray to test

    • positions: Vector3[]

      defines mesh's positions array

    • indices: IndicesArray

      defines mesh's indices array

    • Optional fastCheck: boolean

      defines if the first intersection will be used (and not the closest)

    • Optional trianglePredicate: TrianglePickingPredicate

      defines an optional predicate used to select faces when a mesh intersection is detected

    Returns Nullable<IntersectionInfo>

    intersection info or null if no intersection

isCompletelyInFrustumSearch playground for isCompletelyInFrustum

  • isCompletelyInFrustum(frustumPlanes: Plane[]): boolean
  • True is the submesh bounding box is completely inside the frustum defined by the passed array of planes

    Parameters

    • frustumPlanes: Plane[]

      defines the frustum planes

    Returns boolean

    true if the submesh is inside the frustum

isInFrustumSearch playground for isInFrustum

  • isInFrustum(frustumPlanes: Plane[]): boolean
  • True is the submesh bounding box intersects the frustum defined by the passed array of planes.

    Parameters

    • frustumPlanes: Plane[]

      defines the frustum planes

    Returns boolean

    true if the submesh is intersecting with the frustum

projectToRefSearch playground for projectToRef

  • Projects a point on this submesh and stores the result in "ref"

    Parameters

    • vector: Vector3

      point to project

    • positions: Vector3[]

      defines mesh's positions array

    • indices: IndicesArray

      defines mesh's indices array

    • ref: Vector3

      vector that will store the result

    Returns number

    distance from the point and the submesh, or -1 if the mesh rendering mode doesn't support projections

refreshBoundingInfoSearch playground for refreshBoundingInfo

  • Sets a new updated BoundingInfo object to the submesh

    Parameters

    • Optional data: Nullable<FloatArray>

      defines an optional position array to use to determine the bounding info

    Returns SubMesh

    the SubMesh

renderSearch playground for render

  • render(enableAlphaMode: boolean): SubMesh
  • Renders the submesh

    Parameters

    • enableAlphaMode: boolean

      defines if alpha needs to be used

    Returns SubMesh

    the submesh

resetDrawCacheSearch playground for resetDrawCache

  • resetDrawCache(passId?: number): void
  • Resets the draw wrappers cache

    Parameters

    • Optional passId: number

      If provided, releases only the draw wrapper corresponding to this render pass id

    Returns void

setBoundingInfoSearch playground for setBoundingInfo

  • Sets the submesh BoundingInfo

    Parameters

    • boundingInfo: BoundingInfo

      defines the new bounding info to use

    Returns SubMesh

    the SubMesh

setEffectSearch playground for setEffect

  • Sets associated effect (effect used to render this submesh)

    Parameters

    • effect: Nullable<Effect>

      defines the effect to associate with

    • Optional defines: Nullable<string | MaterialDefines>

      defines the set of defines used to compile this effect

    • Optional materialContext: IMaterialContext

      material context associated to the effect

    • Optional resetContext: boolean

      true to reset the draw context

    Returns void

updateBoundingInfoSearch playground for updateBoundingInfo

  • Updates the submesh BoundingInfo

    Parameters

    Returns SubMesh

    the submesh

Static AddToMeshSearch playground for AddToMesh

  • AddToMesh(materialIndex: number, verticesStart: number, verticesCount: number, indexStart: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean): SubMesh
  • Add a new submesh to a mesh

    Parameters

    • materialIndex: number

      defines the material index to use

    • verticesStart: number

      defines vertex index start

    • verticesCount: number

      defines vertices count

    • indexStart: number

      defines index start

    • indexCount: number

      defines indices count

    • mesh: AbstractMesh

      defines the parent mesh

    • Optional renderingMesh: Mesh

      defines an optional rendering mesh

    • Optional createBoundingBox: boolean

      defines if bounding box should be created for this submesh

    Returns SubMesh

    the new submesh

Static CreateFromIndicesSearch playground for CreateFromIndices

  • CreateFromIndices(materialIndex: number, startIndex: number, indexCount: number, mesh: AbstractMesh, renderingMesh?: Mesh, createBoundingBox?: boolean): SubMesh
  • Creates a new submesh from indices data

    Parameters

    • materialIndex: number

      the index of the main mesh material

    • startIndex: number

      the index where to start the copy in the mesh indices array

    • indexCount: number

      the number of indices to copy then from the startIndex

    • mesh: AbstractMesh

      the main mesh to create the submesh from

    • Optional renderingMesh: Mesh

      the optional rendering mesh

    • Optional createBoundingBox: boolean

      defines if bounding box should be created for this submesh

    Returns SubMesh

    a new submesh

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method