Class SubMesh
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new SubMesh(
materialIndex: number,
verticesStart: number,
verticesCount: number,
indexStart: number,
indexCount: number,
mesh: AbstractMesh,
renderingMesh?: Mesh,
createBoundingBox?: boolean,
addToMesh?: boolean,
): SubMeshCreates 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
OptionalrenderingMesh: Meshdefines an optional rendering mesh
- createBoundingBox: boolean = true
defines if bounding box should be created for this submesh
- addToMesh: boolean = true
defines a boolean indicating that the submesh must be added to the mesh.subMeshes array (true by default)
Returns SubMesh
- materialIndex: number
Properties
index Count
indices count
index Start
index start
material Index
the material index to use
vertices Count
vertices count
vertices Start
vertex index start
Accessors
effect
Is Global
-
get IsGlobal(): boolean
IgnorenamingReturns true if this submesh covers the entire parent mesh
Returns boolean
material Defines
-
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
- defines: Nullable<MaterialDefines>
Returns void
Methods
can Intersects
-
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
- ray: Ray
clone
-
Creates a new submesh from the passed mesh
Parameters
- newMesh: AbstractMesh
defines the new hosting mesh
OptionalnewRenderingMesh: Meshdefines an optional rendering mesh
Returns SubMesh
the new submesh
- newMesh: AbstractMesh
dispose
-
Release associated resources
Parameters
- immediate: boolean = false
If true, the effect will be disposed immediately (false by default)
Returns void
- immediate: boolean = false
get Bounding Info
-
Returns the submesh BoundingInfo object
Returns BoundingInfo
current bounding info (or mesh's one if the submesh is global)
get Class Name
-
Gets the class name
Returns string
the string "SubMesh".
get Effective Mesh
-
Returns the effective mesh of the submesh
Returns AbstractMesh
the effective mesh (could be different from parent mesh)
get Material
-
Returns the submesh material
Parameters
- getDefaultMaterial: boolean = true
Defines whether or not to get the default material if nothing has been defined.
OptionalpassId: numberOptional render pass id to get the material with. If undefined, the engine's current render pass id is used.
Returns Nullable<Material>
null or the current material
- getDefaultMaterial: boolean = true
get Mesh
get Rendering Mesh
-
Returns the rendering mesh of the submesh
Returns Mesh
the rendering mesh (could be different from parent mesh)
get Replacement Mesh
-
Returns the replacement mesh of the submesh
Returns Nullable<AbstractMesh>
the replacement mesh (could be different from parent mesh)
intersects
-
intersects(
ray: Ray,
positions: Vector3[],
indices: IndicesArray,
fastCheck?: boolean,
trianglePredicate?: TrianglePickingPredicate,
): Nullable<IntersectionInfo>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
OptionalfastCheck: booleandefines if the first intersection will be used (and not the closest)
OptionaltrianglePredicate: TrianglePickingPredicatedefines an optional predicate used to select faces when a mesh intersection is detected
Returns Nullable<IntersectionInfo>
intersection info or null if no intersection
- ray: Ray
is Completely In Frustum
-
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
- frustumPlanes: Plane[]
is In Frustum
-
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
- frustumPlanes: Plane[]
project To Ref
-
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
- vector: Vector3
refresh Bounding Info
-
Sets a new updated BoundingInfo object to the submesh
Parameters
- data: Nullable<FloatArray> = null
defines an optional position array to use to determine the bounding info
Returns SubMesh
the SubMesh
- data: Nullable<FloatArray> = null
render
-
Renders the submesh
Parameters
- enableAlphaMode: boolean
defines if alpha needs to be used
Returns SubMesh
the submesh
- enableAlphaMode: boolean
reset Draw Cache
-
Resets the draw wrappers cache
Parameters
OptionalpassId: numberIf provided, releases only the draw wrapper corresponding to this render pass id
- immediate: boolean = false
If true, the draw wrapper will dispose the effect immediately (false by default)
Returns void
set Bounding Info
-
Sets the submesh BoundingInfo
Parameters
- boundingInfo: BoundingInfo
defines the new bounding info to use
Returns SubMesh
the SubMesh
- boundingInfo: BoundingInfo
set Effect
-
setEffect(
effect: Nullable<Effect>,
defines?: Nullable<string | MaterialDefines>,
materialContext?: IMaterialContext,
resetContext?: boolean,
): voidSets associated effect (effect used to render this submesh)
Parameters
- effect: Nullable<Effect>
defines the effect to associate with
- defines: Nullable<string | MaterialDefines> = null
defines the set of defines used to compile this effect
OptionalmaterialContext: IMaterialContextmaterial context associated to the effect
- resetContext: boolean = true
true to reset the draw context
Returns void
- effect: Nullable<Effect>
update Bounding Info
-
Updates the submesh BoundingInfo
Parameters
- world: DeepImmutable<Matrix>
defines the world matrix to use to update the bounding info
Returns SubMesh
the submesh
- world: DeepImmutable<Matrix>
StaticAdd To Mesh
-
AddToMesh(
materialIndex: number,
verticesStart: number,
verticesCount: number,
indexStart: number,
indexCount: number,
mesh: AbstractMesh,
renderingMesh?: Mesh,
createBoundingBox?: boolean,
): SubMeshAdd 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
OptionalrenderingMesh: Meshdefines an optional rendering mesh
- createBoundingBox: boolean = true
defines if bounding box should be created for this submesh
Returns SubMesh
the new submesh
- materialIndex: number
StaticCreate From Indices
-
CreateFromIndices(
materialIndex: number,
startIndex: number,
indexCount: number,
mesh: AbstractMesh,
renderingMesh?: Mesh,
createBoundingBox?: boolean,
): SubMeshCreates 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
OptionalrenderingMesh: Meshthe optional rendering mesh
- createBoundingBox: boolean = true
defines if bounding box should be created for this submesh
Returns SubMesh
a new submesh
- materialIndex: number
Defines a subdivision inside a mesh