class AbstractMesh extends TransformNode
Name | Type | Description | |
---|---|---|---|
name | string | ||
optional | scene | Nullable<Scene> |
Read-only : the number of facets in the mesh
The number (integer) of subdivisions per axis in the partioning space
The ratio (float) to apply to the bouding box size to set to the partioning space.
Ex : 1.01 (default) the partioning space is 1% bigger than the bounding box.
Boolean : must the facet be depth sorted on next call to updateFacetData()
?
Works only for updatable meshes.
Doesn't work with multi-materials.
The location (Vector3) where the facet depth sort must be computed from.
By default, the active camera position.
Used only when facet depth sort is enabled.
Read-only boolean : is the feature facetData enabled ?
An event triggered when this mesh collides with another one
@type {BABYLON.Observable}
An event triggered when the collision's position changes
@type {BABYLON.Observable}
An event triggered when material is changed
@type {BABYLON.Observable}
This property determines the type of occlusion query algorithm to run in WebGl, you can use:
AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE which is mapped to GL_ANY_SAMPLES_PASSED.
or
AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE (Default Value) which is mapped to GL_ANY_SAMPLES_PASSED_CONSERVATIVE which is a false positive algorithm that is faster than GL_ANY_SAMPLES_PASSED but less accurate.
for more info check WebGl documentations
This property is responsible for starting the occlusion query within the Mesh or not, this property is also used to determine what should happen when the occlusionRetryCount is reached. It has supports 3 values:
OCCLUSION_TYPE_NONE (Default Value): this option means no occlusion query whith the Mesh.
OCCLUSION_TYPE_OPTIMISTIC: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken show the mesh.
OCCLUSION_TYPE_STRICT: this option is means use occlusion query and if occlusionRetryCount is reached and the query is broken restore the last state of the mesh occlusion if the mesh was visible then show the mesh if was hidden then hide don't show.
This number indicates the number of allowed retries before stop the occlusion query, this is useful if the occlusion query is taking long time before to the query result is retireved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decideds to show or hide the object.
The default value is -1 which means don't break the query and wait till the result.
Property isOccluded : Gets or sets whether the mesh is occluded or not, it is used also to set the intial state of the mesh to be occluded or not.
Flag to check the progress status of the query
True if the mesh must be rendered in any case.
This scene's action manager
@type {BABYLON.ActionManager}
Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
Default : (1.0, 1.0, 1.0)
Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
Default : (1.0, 1.0, 1.0)
Returns true if the mesh is blocked. Used by the class Mesh.
Returns the boolean false
by default.
Property checkCollisions : Boolean, whether the camera should check the collisions against the mesh.
Default false
.
Gets Collider object used to compute collisions (not physics)
Boolean : true if the mesh has been disposed.
Returns the string "AbstractMesh"
Name | Type | Description | |
---|---|---|---|
optional | fullDetails | boolean |
Disables the mesh edger rendering mode.
Returns the AbstractMesh.
Enables the edge rendering mode on the mesh.
This mode makes the mesh edges visible.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
optional | epsilon | number | |
optional | checkVerticesInsteadOfIndices | boolean |
Returns the mesh itself by default, used by the class Mesh.
Returned type : AbstractMesh
Name | Type | Description | |
---|---|---|---|
camera | Camera |
Returns 0 by default, used by the class Mesh.
Returns an integer.
Returns null by default, used by the class Mesh.
Returned type : integer array
Returns the array of the requested vertex data kind. Used by the class Mesh. Returns null here.
Returned type : float array or Float32Array
Name | Type | Description | |
---|---|---|---|
kind | string |
Sets the vertex data of the mesh geometry for the requested kind
.
If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
The data
are either a numeric array either a Float32Array.
The parameter updatable
is passed as is to the underlying Geometry object constructor (if initianilly none) or updater.
The parameter stride
is an optional positive integer, it is usually automatically deducted from the kind
(3 for positions or normals, 2 for UV, etc).
Note that a new underlying VertexBuffer object is created each call.
If the kind
is the PositionKind
, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
* Possible `kind` values :
BABYLON.VertexBuffer.PositionKind
BABYLON.VertexBuffer.UVKind
BABYLON.VertexBuffer.UV2Kind
BABYLON.VertexBuffer.UV3Kind
BABYLON.VertexBuffer.UV4Kind
BABYLON.VertexBuffer.UV5Kind
BABYLON.VertexBuffer.UV6Kind
BABYLON.VertexBuffer.ColorKind
BABYLON.VertexBuffer.MatricesIndicesKind
BABYLON.VertexBuffer.MatricesIndicesExtraKind
BABYLON.VertexBuffer.MatricesWeightsKind
BABYLON.VertexBuffer.MatricesWeightsExtraKind
* Returns the [Mesh](/classes/3.1/Mesh).
Name | Type | Description | |
---|---|---|---|
kind | string | ||
data | FloatArray | ||
optional | updatable | boolean |
Updates the existing vertex data of the mesh geometry for the requested kind
.
If the mesh has no geometry, it is simply returned as it is.
The data
are either a numeric array either a Float32Array.
No new underlying VertexBuffer object is created.
If the kind
is the PositionKind
and if updateExtends
is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
If the parameter makeItUnique
is true, a new global geometry is created from this positions and is set to the mesh.
* Possible `kind` values :
BABYLON.VertexBuffer.PositionKind
BABYLON.VertexBuffer.UVKind
BABYLON.VertexBuffer.UV2Kind
BABYLON.VertexBuffer.UV3Kind
BABYLON.VertexBuffer.UV4Kind
BABYLON.VertexBuffer.UV5Kind
BABYLON.VertexBuffer.UV6Kind
BABYLON.VertexBuffer.ColorKind
BABYLON.VertexBuffer.MatricesIndicesKind
BABYLON.VertexBuffer.MatricesIndicesExtraKind
BABYLON.VertexBuffer.MatricesWeightsKind
BABYLON.VertexBuffer.MatricesWeightsExtraKind
* Returns the [Mesh](/classes/3.1/Mesh).
Name | Type | Description | |
---|---|---|---|
kind | string | ||
data | FloatArray | ||
optional | updateExtends | boolean |
Sets the mesh indices.
Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
If the mesh has no geometry, a new Geometry object is created and set to the mesh.
This method creates a new index buffer each call.
Returns the Mesh.
Name | Type | Description | |
---|---|---|---|
indices | IndicesArray | ||
totalVertices | Nullable<number> |
Returns a boolean
Name | Type | Description | |
---|---|---|---|
kind | string |
Returns the mesh BoundingInfo object or creates a new one and returns it if undefined.
Returns a BoundingInfo
Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units).
Name | Type | Description | |
---|---|---|---|
optional | includeDescendants | boolean | Take the hierarchy's bounding box instead of the mesh's bounding box. |
Sets a mesh new object BoundingInfo.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
boundingInfo | BoundingInfo |
Returns the latest update of the World matrix
Returns a Matrix.
Perform relative position change from the point of view of behind the front of the mesh.
This is performed taking into account the meshes current rotation, so you do not have to care.
Supports definition of mesh facing forward or backward.
* Returns the [AbstractMesh](/classes/3.1/AbstractMesh).
Name | Type | Description | |
---|---|---|---|
amountRight | number | ||
amountUp | number | ||
amountForward | number |
Calculate relative position change from the point of view of behind the front of the mesh.
This is performed taking into account the meshes current rotation, so you do not have to care.
Supports definition of mesh facing forward or backward.
* Returns a new [Vector3](/classes/3.1/Vector3).
Name | Type | Description | |
---|---|---|---|
amountRight | number | ||
amountUp | number | ||
amountForward | number |
Perform relative rotation change from the point of view of behind the front of the mesh.
Supports definition of mesh facing forward or backward.
* Returns the [AbstractMesh](/classes/3.1/AbstractMesh).
Name | Type | Description | |
---|---|---|---|
flipBack | number | ||
twirlClockwise | number | ||
tiltRight | number |
Calculate relative rotation change from the point of view of behind the front of the mesh.
Supports definition of mesh facing forward or backward.
* Returns a new [Vector3](/classes/3.1/Vector3).
Name | Type | Description | |
---|---|---|---|
flipBack | number | ||
twirlClockwise | number | ||
tiltRight | number |
Return the minimum and maximum world vectors of the entire hierarchy under current mesh
Name | Type | Description | |
---|---|---|---|
optional | includeDescendants | boolean | Include bounding info from descendants as well (true by default). |
Returns true
if the mesh is within the frustum defined by the passed array of planes.
A mesh is in the frustum if its bounding box intersects the frustum.
Boolean returned.
Name | Type | Description | |
---|---|---|---|
frustumPlanes | Plane[] |
Returns true
if the mesh is completely in the frustum defined be the passed array of planes.
A mesh is completely in the frustum if its bounding box it completely inside the frustum.
Boolean returned.
Name | Type | Description | |
---|---|---|---|
frustumPlanes | Plane[] |
True if the mesh intersects another mesh or a SolidParticle object.
Unless the parameter precise
is set to true
the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)
includeDescendants can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes
Returns a boolean.
Name | Type | Description | |
---|---|---|---|
mesh | AbstractMesh or SolidParticle | ||
optional | precise | boolean | |
optional | includeDescendants | boolean |
Returns true if the passed point (Vector3) is inside the mesh bounding box.
Returns a boolean.
Name | Type | Description | |
---|---|---|---|
point | Vector3 |
Name | Type | Description | |
---|---|---|---|
optional | camera | Nullable<Camera> |
Returns the distance from the mesh to the active camera.
Returns a float.
Name | Type | Description | |
---|---|---|---|
optional | camera | Nullable<Camera> |
Name | Type | Description | |
---|---|---|---|
force | Vector3 | ||
contactPoint | Vector3 |
Name | Type | Description | |
---|---|---|---|
otherMesh | Mesh | ||
pivot1 | Vector3 | ||
pivot2 | Vector3 |
Name | Type | Description | |
---|---|---|---|
displacement | Vector3 |
This function will create an octree to help to select the right submeshes for rendering, picking and collision computations.
Please note that you must have a decent number of submeshes to get performance improvements when using an octree.
Returns an Octree of submeshes.
Name | Type | Description | |
---|---|---|---|
optional | maxCapacity | number | |
optional | maxDepth | number |
Checks if the passed Ray intersects with the mesh.
Returns an object PickingInfo.
Name | Type | Description | |
---|---|---|---|
ray | Ray | ||
optional | fastCheck | boolean |
Clones the mesh, used by the class Mesh.
Just returns null
for an AbstractMesh.
Name | Type | Description | |
---|---|---|---|
name | string | ||
newParent | Node | ||
optional | doNotCloneChildren | boolean |
Disposes all the mesh submeshes.
Returns the AbstractMesh.
Disposes the AbstractMesh.
By default, all the mesh children are also disposed unless the parameter doNotRecurse
is set to true
.
Returns nothing.
Name | Type | Description | |
---|---|---|---|
optional | doNotRecurse | boolean | |
optional | disposeMaterialAndTextures | boolean |
Adds the passed mesh as a child to the current mesh.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
mesh | AbstractMesh |
Removes the passed mesh from the current mesh children list.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
mesh | AbstractMesh |
Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
This method can be called within the render loop.
You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation.
Returns the AbstractMesh.
Returns the facetLocalNormals array.
The normals are expressed in the mesh local space.
Returns the facetLocalPositions array.
The facet positions are expressed in the mesh local space.
Returns the facetLocalPartioning array.
Returns the i-th facet position in the world system.
This method allocates a new Vector3 per call.
Name | Type | Description | |
---|---|---|---|
i | number |
Sets the reference Vector3 with the i-th facet position in the world system.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
i | number | ||
ref | Vector3 |
Returns the i-th facet normal in the world system.
This method allocates a new Vector3 per call.
Name | Type | Description | |
---|---|---|---|
i | number |
Sets the reference Vector3 with the i-th facet normal in the world system.
Returns the AbstractMesh.
Name | Type | Description | |
---|---|---|---|
i | number | ||
ref | Vector3 |
Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system).
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number |
Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found.
If the parameter projected (vector3) is passed, it is set as the (x,y,z) World projection on the facet.
If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number | ||
optional | projected | Vector3 | |
optional | checkFace | boolean |
Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found.
If the parameter projected (vector3) is passed, it is set as the (x,y,z) local projection on the facet.
If checkFace is true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned.
If facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position.
If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position.
Name | Type | Description | |
---|---|---|---|
x | number | ||
y | number | ||
z | number | ||
optional | projected | Vector3 | |
optional | checkFace | boolean |
Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
Disables the feature FacetData and frees the related memory.
Returns the AbstractMesh.
Updates the AbstractMesh indices array. Actually, used by the Mesh object.
Returns the mesh.
Name | Type | Description | |
---|---|---|---|
indices | IndicesArray |
The mesh Geometry. Actually used by the Mesh object.
Returns a blank geometry object.
Creates new normals data for the mesh.
Name | Type | Description | |
---|---|---|---|
updatable | boolean | . |
Align the mesh with a normal.
Returns the mesh.
Name | Type | Description | |
---|---|---|---|
normal | undefined | ||
optional | upDirection | undefined |