Class GoldbergMesh
Hierarchy (View Summary)
- Mesh
- GoldbergMesh
Index
Properties
Accessors
Methods
Properties
action Manager
Gets or sets the current action manager
alpha Index
Gets or sets the alpha index used to sort transparent meshes
always Select As Active Mesh
True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)
animations
Gets a list of Animations associated with the node
culling Strategy
The culling strategy to use to check whether the mesh must be rendered or not. This value can be changed at any time and will be used on the next render mesh selection. The possible values are :
- AbstractMesh.CULLINGSTRATEGY_STANDARD
- AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY
- AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION
- AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY Please read each static variable documentation to get details about the culling process.
custom Mark As Dirty
Allow user to specify custom mechanism for mark as dirty
decal Map
Gets or sets the decal map for this mesh
defined Facing Forward
Gets or sets the orientation for POV movement & rotation
delay Loading File
Gets the file containing delay loading data for this mesh
delay Load State
Gets the delay loading state of the mesh (when delay loading is turned on)
do Not Sync Bounding Info
Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)
edges Color
Defines edge color used when edgesRenderer is enabled
edges Renderer
Gets the edgesRenderer associated with the mesh
edges Share With Instances
true to use the edge renderer for all instances of this mesh
edges Width
Defines edge width used when edgesRenderer is enabled
ellipsoid
Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))
ellipsoid Offset
Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))
enable Pointer Move Events
Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)
force Rendering When Occluded
Flag to force rendering the mesh even if occluded
goldberg Data
Defines the specific Goldberg data used in this mesh construction.
id
Gets or sets the id of the node
ignore Camera Max Z
Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default) You should not mix meshes that have this property set to true with meshes that have it set to false if they all write to the depth buffer, because the z-values are not comparable in the two cases and you will get rendering artifacts if you do. You can set the property to true for meshes that do not write to the depth buffer, or set the same value (either false or true) otherwise. Note this will reduce performance when set to true.
ignore Non Uniform Scaling
Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored. By default the system will update normals to compensate
inspectable Custom Properties
List of inspectable custom properties (used by the Inspector)
instanced Buffers
Object used to store instanced buffers defined by user
instances
Gets the list of instances created from this mesh it is not supposed to be modified manually. Note also that the order of the InstancedMesh wihin the array is not significant and might change.
is Blocker
Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)
is Near Grabbable
Gets or sets a boolean indicating if the mesh can be grabbed. Default is false. Setting this to true, while using the XR near interaction feature, will trigger a pointer event when the mesh is grabbed. Grabbing means that the controller is using the squeeze or main trigger button to grab the mesh. This is different from nearPickable which only triggers the event when the mesh is touched by the controller
is Near Pickable
Gets or sets a boolean indicating if the mesh can be near picked (touched by the XR controller or hands). Default is false
is Occluded
Gets or sets whether the mesh is occluded or not, it is used also to set the initial state of the mesh to be occluded or not
is Occlusion Query In Progress
Flag to check the progress status of the query
is Pickable
Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default value is determined by AbstractMesh.DefaultIsPickable (true unless changed).
metadata
Gets or sets an object used to store user defined information for the node
name
Gets or sets the name of the node
occlusion For Render Pass Id
This number indicates the render pass id used to run the occlusion query. The default value is -1, which means run the occlusion query in all render passes.
occlusion Query Algorithm Type
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.
- 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.
occlusion Retry Count
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 retrieved, the query result indicates if the object is visible within the scene or not and based on that Babylon.Js engine decides to show or hide the object. The default value is -1 which means don't break the query and wait till the result
occlusion Type
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 within 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.
on Accessibility Tag Changed Observable
Observable fired when an accessibility tag is changed
on After World Matrix Update Observable
An event triggered after the world matrix is updated
on Collide Observable
An event triggered when this mesh collides with another one
on Collision Position Change Observable
An event triggered when the collision's position changes
on Dispose Observable
An event triggered when the mesh is disposed
on LOD Level Selection
User defined function used to change how LOD level selection is done
on Material Changed Observable
An event triggered when material is changed
on Mesh Ready Observable
Will notify when the mesh is completely ready, including materials. Observers added to this observable will be removed once triggered
on Ready
Callback raised when the node is ready to be used
on Rebuild Observable
An event triggered when the mesh is rebuilt.
outline Color
Defines color to use when rendering outline
outline Width
Define width to use when rendering outline
overlay Alpha
Defines alpha to use when rendering overlay
overlay Color
Defines color to use when rendering overlay
physics Body
Gets or sets the physics body associated with this node.
physics Impostor
Gets or sets impostor used for physic simulation
re Integrate Rotation Into Rotation Quaternion
Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both
render Outline
Gets or sets a boolean indicating if the outline must be rendered as well
render Overlay
Gets or sets a boolean indicating if the overlay must be rendered as well
reserved Data Store
For internal use only. Please do not use.
scaling Determinant
Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube
show Bounding Box
Gets or sets a boolean indicating if the bounding box must be rendered as well (false by default)
show Sub Meshes Bounding Box
Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default)
state
Gets or sets a string used to store user defined state for the node
sub Meshes
Gets or sets the list of subMeshes
thin Instance Allow Automatic Static Buffer Recreation
Indicates that a buffer created as static should be recreated if the buffer is updated (by calling thinInstanceSetMatrixAt or thinInstanceSetAttributeAt, for eg.) If this flag is false (the default behavior), a buffer created as "static" won't show any update done to it, and will stay the same as it was created. Note however that recreating a buffer each time there's a change will have some performance cost, that's why it is set to false by default. You should set this flag to true only if your static buffers should change infrequently. If they change frequently, you should create your buffers as "dynamic" instead.
thin Instance Count
Gets / sets the number of thin instances to display. Note that you can't set a number higher than what the underlying buffer can handle.
thin Instance Enable Picking
Gets or sets a boolean defining if we want picking to pick thin instances as well
unique Id
Gets or sets the unique id of the node
use Octree For Collisions
Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default)
use Octree For Picking
Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default)
use Octree For Rendering Selection
Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default)
Static ReadonlyBACKSIDE
Mesh side orientation : usually the internal or back surface
StaticBillboard Use Parent Orientation
Child transform with Billboard flags should or should not apply parent rotation (default if off)
Static ReadonlyBOTTOM
Mesh tile positioning : part tiles on bottom
Static ReadonlyCAP_ ALL
Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
Static ReadonlyCAP_ END
Mesh cap setting : one cap at the end of the mesh
Static ReadonlyCAP_ START
Mesh cap setting : one cap at the beginning of the mesh
Static ReadonlyCENTER
Mesh tile positioning : part tiles same on left/right or top/bottom
Static ReadonlyCULLINGSTRATEGY_ BOUNDINGSPHERE_ ONLY
Culling strategy : Bounding Sphere Only. This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested. It's also less accurate than the standard because some not visible objects can still be selected. Test : is the bounding sphere outside the frustum ? If not, then the cullable object is in the frustum.
Static ReadonlyCULLINGSTRATEGY_ OPTIMISTIC_ INCLUSION
Culling strategy : Optimistic Inclusion. This in an inclusion test first, then the standard exclusion test. This can be faster when a cullable object is expected to be almost always in the camera frustum. This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside. Anyway, it's as accurate as the standard strategy. Test : Is the cullable object bounding sphere center in the frustum ? If not, apply the default culling strategy.
Static ReadonlyCULLINGSTRATEGY_ OPTIMISTIC_ INCLUSION_ THEN_ BSPHERE_ ONLY
Culling strategy : Optimistic Inclusion then Bounding Sphere Only. This in an inclusion test first, then the bounding sphere only exclusion test. This can be the fastest test when a cullable object is expected to be almost always in the camera frustum. This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it. It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy. Test : Is the cullable object bounding sphere center in the frustum ? If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.
Static ReadonlyCULLINGSTRATEGY_ STANDARD
Default culling strategy : this is an exclusion test and it's the more accurate. Test order : Is the bounding sphere outside the frustum ? If not, are the bounding box vertices outside the frustum ? It not, then the cullable object is in the frustum.
StaticDefault Is Pickable
Gets or sets the default value for isPickable for newly created meshes. When set to false, all meshes created after the change will not be pickable by default. Individual meshes can still override this by setting their own isPickable property.
Static ReadonlyDEFAULTSIDE
Mesh side orientation : by default, FRONTSIDE
Static ReadonlyDOUBLESIDE
Mesh side orientation : both internal and external or front and back surfaces
Static ReadonlyFLIP_ N_ ROTATE_ ROW
Mesh pattern setting : rotate pattern and rotate
Static ReadonlyFLIP_ N_ ROTATE_ TILE
Mesh pattern setting : flip and rotate alternate tiles on each row or column
Static ReadonlyFLIP_ ROW
Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows
Static ReadonlyFLIP_ TILE
Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column
Static ReadonlyFRONTSIDE
Mesh side orientation : usually the external or front surface
StaticINSTANCEDMESH_ SORT_ TRANSPARENT
Indicates that the instanced meshes should be sorted from back to front before rendering if their material is transparent
Static ReadonlyLEFT
Mesh tile positioning : part tiles on left
Static ReadonlyNO_ CAP
Mesh cap setting : no cap
Static ReadonlyNO_ FLIP
Mesh pattern setting : no flip or rotate
StaticOCCLUSION_ ALGORITHM_ TYPE_ ACCURATE
Use an accurate occlusion algorithm
StaticOCCLUSION_ ALGORITHM_ TYPE_ CONSERVATIVE
Use a conservative occlusion algorithm
StaticOCCLUSION_ TYPE_ NONE
No occlusion
StaticOCCLUSION_ TYPE_ OPTIMISTIC
Occlusion set to optimistic
StaticOCCLUSION_ TYPE_ STRICT
Occlusion set to strict
Static ReadonlyRIGHT
Mesh tile positioning : part tiles on right
Static ReadonlyROTATE_ ROW
Mesh pattern setting : rotate (180degs) all tiles on alternate rows
Static ReadonlyROTATE_ TILE
Mesh pattern setting : rotate (180degs) alternate tiles on each row or column
Static ReadonlyTOP
Mesh tile positioning : part tiles on top
Accessors
absolute Position
-
Returns the current mesh absolute position. Returns a Vector3.
Returns Vector3
absolute Rotation Quaternion
-
Returns the current mesh absolute rotation. Returns a Quaternion.
Returns Quaternion
absolute Scaling
-
Returns the current mesh absolute scaling. Returns a Vector3.
Returns Vector3
accessibility Tag
animation Properties Override
-
Gets or sets the animation properties override
Returns Nullable<AnimationPropertiesOverride>
-
Parameters
- value: Nullable<AnimationPropertiesOverride>
Returns void
apply Fog
-
get applyFog(): boolean
Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default)
Returns boolean
-
set applyFog(value: boolean): void
Parameters
- value: boolean
Returns void
are Normals Frozen
-
get areNormalsFrozen(): boolean
Gets a boolean indicating if the normals aren't to be recomputed on next mesh
positionsarray update. This property is pertinent only for updatable parametric shapes.Returns boolean
baked Vertex Animation Manager
-
Gets or sets the baked vertex animation manager
Returns Nullable<IBakedVertexAnimationManager>
-
Parameters
- value: Nullable<IBakedVertexAnimationManager>
Returns void
behaviors
billboard Mode
-
get billboardMode(): number
Gets or sets the billboard mode. Default is 0.
Value Type Description 0 BILLBOARDMODE_NONE 1 BILLBOARDMODE_X 2 BILLBOARDMODE_Y 4 BILLBOARDMODE_Z 7 BILLBOARDMODE_ALL Returns number
-
set billboardMode(value: number): void
Parameters
- value: number
Returns void
check Collisions
-
get checkCollisions(): boolean
Gets or sets a boolean indicating that this mesh can be used in the collision engine
Returns boolean
-
set checkCollisions(collisionEnabled: boolean): void
Parameters
- collisionEnabled: boolean
Returns void
clone Mesh Map
collider
-
Gets Collider object used to compute collisions (not physics)
Returns Nullable<Collider>
collision Group
-
get collisionGroup(): number
Gets or sets the current collision group mask (-1 by default). A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0
Returns number
-
set collisionGroup(mask: number): void
Parameters
- mask: number
Returns void
collision Mask
-
get collisionMask(): number
Gets or sets a collision mask used to mask collisions (default is -1). A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0
Returns number
-
set collisionMask(mask: number): void
Parameters
- mask: number
Returns void
collision Response
-
get collisionResponse(): boolean
Gets or sets a collision response flag (default is true). when collisionResponse is false, events are still triggered but colliding entity has no response This helps creating trigger volume when user wants collision feedback events but not position/velocity to respond to the collision.
Returns boolean
-
set collisionResponse(response: boolean): void
Parameters
- response: boolean
Returns void
collision Retry Count
-
get collisionRetryCount(): number
number of collision detection tries. Change this value if not all collisions are detected and handled properly
Returns number
-
set collisionRetryCount(retryCount: number): void
Parameters
- retryCount: number
Returns void
compute Bones Using Shaders
-
get computeBonesUsingShaders(): boolean
Returns boolean
-
set computeBonesUsingShaders(value: boolean): void
Parameters
- value: boolean
Returns void
do Not Serialize
-
get doNotSerialize(): boolean
Gets or sets a boolean used to define if the node must be serialized
Returns boolean
-
set doNotSerialize(value: boolean): void
Parameters
- value: boolean
Returns void
enable Distant Picking
-
get enableDistantPicking(): boolean
When enabled, decompose picking matrices for better precision with large values for mesh position and scling
Returns boolean
-
set enableDistantPicking(value: boolean): void
Parameters
- value: boolean
Returns void
facet Depth Sort From
facet Nb
-
get facetNb(): number
Gets the number of facets in the mesh
Returns number
forced Instance Count
-
get forcedInstanceCount(): number
Gets or sets the forced number of instances to display. If 0 (default value), the number of instances is not forced and depends on the draw type (regular / instance / thin instances mesh)
Returns number
-
set forcedInstanceCount(count: number): void
Parameters
- count: number
Returns void
force World Matrix Instanced Buffer Update
-
get forceWorldMatrixInstancedBufferUpdate(): boolean
Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode)
Returns boolean
-
set forceWorldMatrixInstancedBufferUpdate(value: boolean): void
Parameters
- value: boolean
Returns void
forward
-
The forward direction of that transform in world space.
Returns Vector3
geometry
has Bounding Info
-
get hasBoundingInfo(): boolean
Returns true if there is already a bounding info
Returns boolean
has Instances
-
get hasInstances(): boolean
Returns boolean
has LOD Levels
-
get hasLODLevels(): boolean
Gets a boolean indicating if this mesh has LOD
Returns boolean
has Thin Instances
-
get hasThinInstances(): boolean
Returns boolean
has Vertex Alpha
-
get hasVertexAlpha(): boolean
Gets or sets a boolean indicating that this mesh needs to use vertex alpha data to render. This property is misnamed and should be
useVertexAlpha. Note that the mesh will be rendered with alpha blending when this flag is set even if vertex alpha data is missing from the geometry.Returns boolean
-
set hasVertexAlpha(value: boolean): void
Parameters
- value: boolean
Returns void
infinite Distance
-
get infiniteDistance(): boolean
Gets or sets the distance of the object to max, often used by skybox
Returns boolean
-
set infiniteDistance(value: boolean): void
Parameters
- value: boolean
Returns void
inherit Visibility
-
get inheritVisibility(): boolean
-
set inheritVisibility(value: boolean): void
Parameters
- value: boolean
Returns void
is An Instance
-
get isAnInstance(): boolean
Gets a boolean indicating if this mesh is an instance or a regular mesh
Returns boolean
is Blocked
-
get isBlocked(): boolean
Returns boolean
is Facet Data Enabled
-
get isFacetDataEnabled(): boolean
gets a boolean indicating if facetData is enabled
Returns boolean
is Un Indexed
-
get isUnIndexed(): boolean
Gets or sets a boolean indicating that this mesh does not use index buffer
Returns boolean
-
set isUnIndexed(value: boolean): void
Parameters
- value: boolean
Returns void
is Visible
-
get isVisible(): boolean
-
set isVisible(value: boolean): void
Parameters
- value: boolean
Returns void
is World Matrix Frozen
-
get isWorldMatrixFrozen(): boolean
True if the World matrix has been frozen.
Returns boolean
layer Mask
-
get layerMask(): number
Gets or sets the current layer mask (default is 0x0FFFFFFF)
Returns number
-
set layerMask(value: number): void
Parameters
- value: number
Returns void
light Sources
-
Gets the list of lights affecting that mesh
Returns Light[]
manual Update Of Previous World Matrix Instanced Buffer
-
get manualUpdateOfPreviousWorldMatrixInstancedBuffer(): boolean
Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual
Returns boolean
-
set manualUpdateOfPreviousWorldMatrixInstancedBuffer(value: boolean): void
Parameters
- value: boolean
Returns void
manual Update Of World Matrix Instanced Buffer
-
get manualUpdateOfWorldMatrixInstancedBuffer(): boolean
Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual
Returns boolean
-
set manualUpdateOfWorldMatrixInstancedBuffer(value: boolean): void
Parameters
- value: boolean
Returns void
material
mesh Blending Tag
-
get meshBlendingTag(): number
Gets or sets the packed mesh-blending tag for this mesh.
Group ID occupies bits 0..5 and radius class occupies bits 6..7. Use PackMeshBlendingTag to construct the value. Group 0 disables blending; valid participating groups are 1..63. Meshes in the same nonzero group are treated as one logical surface and do not blend together. This visual-only property does not alter geometry, collision queries, depth, normals, or shadows.
Returns number
-
set meshBlendingTag(value: number): void
Parameters
- value: number
Returns void
morph Target Manager
-
Gets or sets the morph target manager
Returns Nullable<MorphTargetManager>
-
Parameters
- value: Nullable<MorphTargetManager>
Returns void
must Depth Sort Facets
-
get mustDepthSortFacets(): boolean
Gets or sets a boolean indicating that the facets must be depth sorted on next call to
updateFacetData(). Works only for updatable meshes. Doesn't work with multi-materialsReturns boolean
-
set mustDepthSortFacets(sort: boolean): void
Parameters
- sort: boolean
Returns void
non Uniform Scaling
-
get nonUniformScaling(): boolean
True if the scaling property of this object is non uniform eg. (1,2,1)
Returns boolean
num Bone Influencers
-
get numBoneInfluencers(): number
Gets or sets the number of allowed bone influences per vertex (4 by default)
Returns number
-
set numBoneInfluencers(value: number): void
Parameters
- value: number
Returns void
on After Render Observable
-
An event triggered after rendering the mesh
Returns Observable<Mesh>
on Before Bind Observable
-
An event triggered before binding the mesh
Returns Observable<Mesh>
on Before Draw
-
set onBeforeDraw(callback: () => void): void
Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead
Parameters
- callback: () => void
Returns void
on Before Draw Observable
-
An event triggered before drawing the mesh
Returns Observable<Mesh>
on Before Render Observable
-
An event triggered before rendering the mesh
Returns Observable<Mesh>
on Between Pass Observable
-
An event triggeredbetween rendering pass when using separateCullingPass = true
Returns Observable<SubMesh>
on Cloned Observable
-
An event triggered when the node is cloned
Returns Observable<Node>
on Collide
-
Set a function to call when this mesh collides with another one
Parameters
- callback: (collidedMesh?: AbstractMesh) => void
Returns void
on Collision Position Change
-
set onCollisionPositionChange(callback: () => void): void
Set a function to call when the collision's position changes
Parameters
- callback: () => void
Returns void
on Dispose
-
set onDispose(callback: () => void): void
Sets a callback that will be raised when the node will be disposed
Parameters
- callback: () => void
Returns void
on Effective Enabled State Changed Observable
-
An event triggered when the effective enabled state of the node changes, i.e. whenever the value returned by isEnabled changes. Unlike onEnabledStateChangedObservable, this fires for changes caused by an ancestor's enabled state as well as this node's own state. The observable is created on first access, so no cost is incurred for nodes that never observe it.
Returns Observable<boolean>
on Enabled State Changed Observable
-
An event triggered when the enabled state of the node changes. This only reflects changes to the node's own enabled flag (as set via setEnabled), not changes inherited from an ancestor. Use onEffectiveEnabledStateChangedObservable to also be notified when an ancestor's enabled state changes the effective enabled state.
Returns Observable<boolean>
override Material Side Orientation
-
get overrideMaterialSideOrientation(): number
Returns number
-
set overrideMaterialSideOrientation(value: number): void
Parameters
- value: number
Returns void
overriden Instance Count
-
set overridenInstanceCount(count: number): void
Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
Parameters
- count: number
Returns void
override Rendering Fill Mode
parent
-
Gets or sets the parent of the node (without keeping the current position in the scene)
Returns void
partitioning B Box Ratio
-
get partitioningBBoxRatio(): number
The ratio (float) to apply to the bounding box size to set to the partitioning space. Ex : 1.01 (default) the partitioning space is 1% bigger than the bounding box
Returns number
-
set partitioningBBoxRatio(ratio: number): void
Parameters
- ratio: number
Returns void
partitioning Subdivisions
-
get partitioningSubdivisions(): number
Gets or set the number (integer) of subdivisions per axis in the partitioning space
Returns number
-
set partitioningSubdivisions(nb: number): void
Parameters
- nb: number
Returns void
pointer Over Disable Mesh Testing
-
get pointerOverDisableMeshTesting(): boolean
Gets or sets the property which disables the test that is checking that the mesh under the pointer is the same than the previous time we tested for it (default: false). Set this property to true if you want thin instances picking to be reported accurately when moving over the mesh. Note that setting this property to true will incur some performance penalties when dealing with pointer events for this mesh so use it sparingly.
Returns boolean
-
set pointerOverDisableMeshTesting(disable: boolean): void
Parameters
- disable: boolean
Returns void
position
previous World Matrix Instanced Buffer
-
get previousWorldMatrixInstancedBuffer(): Float32Array
Gets the array buffer used to store the instanced buffer used for instances' previous world matrices
Returns Float32Array
raw Bounding Info
-
Parameters
- boundingInfo: Nullable<BoundingInfo>
Returns void
receive Shadows
-
get receiveShadows(): boolean
Gets or sets a boolean indicating that this mesh can receive realtime shadows
Returns boolean
-
set receiveShadows(value: boolean): void
Parameters
- value: boolean
Returns void
rendering Group Id
-
get renderingGroupId(): number
Specifies the rendering group id for this mesh (0 by default)
Returns number
-
set renderingGroupId(value: number): void
Parameters
- value: number
Returns void
right
-
The right direction of that transform in world space.
Returns Vector3
rotation
rotation Quaternion
-
Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null). If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
Returns Nullable<Quaternion>
-
Parameters
- quaternion: Nullable<Quaternion>
Returns void
scaling
side Orientation
-
get sideOrientation(): number
Use this property to change the original side orientation defined at construction time Material.sideOrientation will override this value if set User will still be able to change the material sideOrientation afterwards if they really need it
Returns number
-
set sideOrientation(value: number): void
Parameters
- value: number
Returns void
skeleton
-
Gets or sets a skeleton to apply skinning transformations
Returns void
source
surrounding Meshes
-
Gets or sets current surrounding meshes (null by default).
By default collision detection is tested against every mesh in the scene. It is possible to set surroundingMeshes to a defined list of meshes and then only these specified meshes will be tested for the collision.
Note: if set to an empty array no collision will happen when this mesh is moved.
Returns Nullable<AbstractMesh[]>
-
Parameters
- meshes: Nullable<AbstractMesh[]>
Returns void
up
-
The up direction of that transform in world space.
Returns Vector3
use Bones
-
get useBones(): boolean
Gets a boolean indicating if this mesh has skinning data and an attached skeleton
Returns boolean
use LOD Screen Coverage
-
get useLODScreenCoverage(): boolean
Determines if the LOD levels are intended to be calculated using screen coverage (surface area ratio) instead of distance.
Returns boolean
-
set useLODScreenCoverage(value: boolean): void
Parameters
- value: boolean
Returns void
use Vertex Colors
-
get useVertexColors(): boolean
Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry)
Returns boolean
-
set useVertexColors(value: boolean): void
Parameters
- value: boolean
Returns void
visibility
-
get visibility(): number
Gets or sets mesh visibility between 0 and 1 (default is 1)
Returns number
-
set visibility(value: number): void
Gets or sets mesh visibility between 0 and 1 (default is 1)
Parameters
- value: number
Returns void
world Matrix From Cache
-
Returns directly the latest state of the mesh World matrix. A Matrix is returned.
Returns Matrix
world Matrix Instanced Buffer
-
get worldMatrixInstancedBuffer(): Float32Array
Gets the array buffer used to store the instanced buffer used for instances' world matrices
Returns Float32Array
StaticBILLBOARDMODE_ ALL
-
get BILLBOARDMODE_ALL(): number
Billboard on all axes
Returns number
StaticBILLBOARDMODE_ NONE
-
get BILLBOARDMODE_NONE(): number
No billboard
Returns number
StaticBILLBOARDMODE_ USE_ POSITION
-
get BILLBOARDMODE_USE_POSITION(): number
Billboard on using position instead of orientation
Returns number
StaticBILLBOARDMODE_ X
-
get BILLBOARDMODE_X(): number
Billboard on X axis
Returns number
StaticBILLBOARDMODE_ Y
-
get BILLBOARDMODE_Y(): number
Billboard on Y axis
Returns number
StaticBILLBOARDMODE_ Z
-
get BILLBOARDMODE_Z(): number
Billboard on Z axis
Returns number
Methods
_ invalidate Instance Vertex Array Object
-
Invalidate VertexArrayObjects belonging to the mesh (but not to the Geometry of the mesh).
Returns void
add Behavior
add Child
-
Adds the passed mesh as a child to the current mesh. The node will remain exactly where it is and its position / rotation will be updated accordingly. This method is equivalent to calling setParent().
Parameters
- mesh: TransformNode
defines the child mesh
- preserveScalingSign: boolean = false
if true, keep scaling sign of child. Otherwise, scaling sign might change.
Returns this
the current mesh
- mesh: TransformNode
add LOD Level
-
Add a mesh as LOD level triggered at the given distance.
Parameters
- distanceOrScreenCoverage: number
Either distance from the center of the object to show this level or the screen coverage if
useScreenCoverageis set totrue. If screen coverage, value is a fraction of the screen's total surface, between 0 and 1. Example Playground for distance https://playground.babylonjs.com/#QE7KM#197 Example Playground for screen coverage https://playground.babylonjs.com/#QE7KM#196 - mesh: Nullable<Mesh>
The mesh to be added as LOD level (can be null)
Returns Mesh
This mesh (for chaining)
- distanceOrScreenCoverage: number
add Rotation
-
Adds a rotation step to the mesh current rotation. x, y, z are Euler angles expressed in radians. This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set. This means this rotation is made in the mesh local space only. It's useful to set a custom rotation order different from the BJS standard one YXZ. Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis.
mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3);Note that
addRotation()accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values. Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles.Parameters
- x: number
Rotation to add
- y: number
Rotation to add
- z: number
Rotation to add
Returns TransformNode
the TransformNode.
- x: number
align With Normal
apply Angular Impulse
-
Apply a physic angular impulse to the mesh
Parameters
- angularImpulse: Vector3
defines the torque to apply
Returns TransformNode
the current mesh
- angularImpulse: Vector3
apply Displacement Map
-
applyDisplacementMap(
url: string,
minHeight: number,
maxHeight: number,
onSuccess?: (mesh: Mesh) => void,
uvOffset?: Vector2,
uvScale?: Vector2,
forceUpdate?: boolean,
onError?: (message?: string, exception?: any) => void,
): MeshModifies the mesh geometry according to a displacement map. A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex. The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
Parameters
- url: string
is a string, the URL from the image file is to be downloaded.
- minHeight: number
is the lower limit of the displacement.
- maxHeight: number
is the upper limit of the displacement.
OptionalonSuccess: (mesh: Mesh) => voidis an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
OptionaluvOffset: Vector2is an optional vector2 used to offset UV.
OptionaluvScale: Vector2is an optional vector2 used to scale UV.
- forceUpdate: boolean = false
defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.
OptionalonError: (message?: string, exception?: any) => voiddefines a callback called when an error occurs during the processing of the request.
Returns Mesh
the Mesh.
- url: string
apply Displacement Map From Buffer
-
applyDisplacementMapFromBuffer(
buffer: Uint8Array,
heightMapWidth: number,
heightMapHeight: number,
minHeight: number,
maxHeight: number,
uvOffset?: Vector2,
uvScale?: Vector2,
forceUpdate?: boolean,
): MeshModifies the mesh geometry according to a displacementMap buffer. A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex. The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
Parameters
- buffer: Uint8Array
is a
Uint8Arraybuffer containing series ofUint8lower than 255, the red, green, blue and alpha values of each successive pixel. - heightMapWidth: number
is the width of the buffer image.
- heightMapHeight: number
is the height of the buffer image.
- minHeight: number
is the lower limit of the displacement.
- maxHeight: number
is the upper limit of the displacement.
OptionaluvOffset: Vector2is an optional vector2 used to offset UV.
OptionaluvScale: Vector2is an optional vector2 used to scale UV.
- forceUpdate: boolean = false
defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.
Returns Mesh
the Mesh.
- buffer: Uint8Array
apply Impulse
apply Skeleton
apply Torque
-
Apply a physic torque to the mesh
Parameters
- torque: Vector3
defines the torque to apply
Returns TransformNode
the current mesh
- torque: Vector3
attach To Bone
-
Attach the current TransformNode to another TransformNode associated with a bone
Parameters
- bone: Bone
Bone affecting the TransformNode
- affectedTransformNode: TransformNode
TransformNode associated with the bone
Returns TransformNode
this object
- bone: Bone
bake Current Transform Into Vertices
-
bakeCurrentTransformIntoVertices(
bakeIndependentlyOfChildren?: boolean,
forceUnique?: boolean,
): MeshModifies the mesh geometry according to its own current World Matrix. The mesh World Matrix is then reset. This method returns nothing but really modifies the mesh even if it's originally not set as updatable. Note that, under the hood, this method sets a new VertexBuffer each call.
Parameters
- bakeIndependentlyOfChildren: boolean = true
indicates whether to preserve all child nodes' World Matrix during baking
- forceUnique: boolean = false
indicates whether to force the mesh geometry to be unique
Returns Mesh
the current mesh
- bakeIndependentlyOfChildren: boolean = true
bake Transform Into Vertices
-
Modifies the mesh geometry according to the passed transformation matrix. This method returns nothing, but it really modifies the mesh even if it's originally not set as updatable. The mesh normals are modified using the same transformation. Note that, under the hood, this method sets a new VertexBuffer each call.
Parameters
- transform: DeepImmutable<Matrix>
defines the transform matrix to use
Returns Mesh
the current mesh
- transform: DeepImmutable<Matrix>
begin Animation
-
beginAnimation(
name: string,
loop?: boolean,
speedRatio?: number,
onAnimationEnd?: () => void,
): Nullable<Animatable>Will start the animation sequence
Parameters
- name: string
defines the range frames for animation sequence
Optionalloop: booleandefines if the animation should loop (false by default)
OptionalspeedRatio: numberdefines the speed factor in which to run the animation (1 by default)
OptionalonAnimationEnd: () => voiddefines a function to be executed when the animation ended (undefined by default)
Returns Nullable<Animatable>
the object created for this animation. If range does not exist, it will return null
- name: string
build Bounding Info
-
buildBoundingInfo(
minimum: DeepImmutable<Vector3>,
maximum: DeepImmutable<Vector3>,
worldMatrix?: DeepImmutableObject<Matrix>,
): BoundingInfoCreates a new bounding info for the mesh
Parameters
- minimum: DeepImmutable<Vector3>
min vector of the bounding box/sphere
- maximum: DeepImmutable<Vector3>
max vector of the bounding box/sphere
OptionalworldMatrix: DeepImmutableObject<Matrix>defines the new world matrix
Returns BoundingInfo
the new bounding info
- minimum: DeepImmutable<Vector3>
calc Move POV
-
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 definedFacingForwardSearch | See definedFacingForwardSearch.
Parameters
- amountRight: number
defines the distance on the right axis
- amountUp: number
defines the distance on the up axis
- amountForward: number
defines the distance on the forward axis
Returns Vector3
the new displacement vector
- amountRight: number
calc Rotate POV
-
Calculate relative rotation change from the point of view of behind the front of the mesh. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.
Parameters
- flipBack: number
defines the flip
- twirlClockwise: number
defines the twirl
- tiltRight: number
defines the tilt
Returns Vector3
the new rotation vector
- flipBack: number
clean Matrix Weights
-
Renormalize the mesh and patch it up if there are no weights Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1. However in the case of zero weights then we set just a single influence to 1. We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.
Returns void
clone
-
clone(
name?: string,
newParent?: Nullable<Node> | MeshCloneOptions,
doNotCloneChildren?: boolean,
clonePhysicsImpostor?: boolean,
): MeshReturns a new Mesh object generated from the current mesh properties. This method must not get confused with createInstance()
Parameters
- name: string = ""
is a string, the name given to the new mesh
- newParent: Nullable<Node> | MeshCloneOptions = null
can be any Node object (default
null) or an instance of MeshCloneOptions. If the latter, doNotCloneChildren and clonePhysicsImpostor are unused. OptionaldoNotCloneChildren: booleanallows/denies the recursive cloning of the original mesh children if any (default
false)- clonePhysicsImpostor: boolean = true
allows/denies the cloning in the same time of the original mesh
bodyused by the physics engine, if any (defaulttrue)
Returns Mesh
a new mesh
- name: string = ""
compute World Matrix
convert To Flat Shaded Mesh
-
Modify the mesh to get a flat shading rendering. This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result. Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
Returns Mesh
current mesh
convert To Un Indexed Mesh
-
This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers. In other words, more vertices, no more indices and a single bigger VBO. The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
Returns Mesh
current mesh
copy Vertices Data
-
copyVerticesData(
kind: string,
vertexData: { [kind: string]: Float32Array<ArrayBufferLike> },
): voidCopies the requested vertex data kind into the given vertex data map. Float data is constructed if the map doesn't have the data.
Parameters
- kind: string
defines the vertex data kind to use
- vertexData: { [kind: string]: Float32Array<ArrayBufferLike> }
defines the map that stores the resulting data
Returns void
- kind: string
create Animation Range
-
Creates an animation range for this node
Parameters
- name: string
defines the name of the range
- from: number
defines the starting key
- to: number
defines the end key
Returns void
- name: string
create Instance
-
Creates a new InstancedMesh object from the mesh model.
Parameters
- name: string
defines the name of the new instance
Returns InstancedMesh
a new InstancedMesh
- name: string
create Normals
-
Creates new normals data for the mesh
Parameters
- updatable: boolean
defines if the normal vertex buffer must be flagged as updatable
Returns AbstractMesh
the current mesh
- updatable: boolean
create Or Update Submeshes Octree
-
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
Parameters
OptionalmaxCapacity: numberdefines the maximum size of each block (64 by default)
OptionalmaxDepth: numberdefines the maximum depth to use (no more than 2 levels by default)
Returns Octree<SubMesh>
the new octree
delete Animation Range
-
Delete a specific animation range
Parameters
- name: string
defines the name of the range to delete
- deleteFrames: boolean = true
defines if animation frames from the range must be deleted as well
Returns void
- name: string
detach From Bone
-
Detach the transform node if its associated with a bone
Parameters
- resetToPreviousParent: boolean = false
Indicates if the parent that was in effect when attachToBone was called should be set back or if we should set parent to null instead (defaults to the latter)
Returns TransformNode
this object
- resetToPreviousParent: boolean = false
direct Render
disable Edges Rendering
disable Facet Data
dispose
-
Releases resources associated with this mesh.
Parameters
OptionaldoNotRecurse: booleanSet to true to not recurse into each children (recurse into each children by default)
- disposeMaterialAndTextures: boolean = false
Set to true to also dispose referenced materials and textures (false by default)
Returns void
enable Edges Rendering
-
enableEdgesRendering(
epsilon?: number,
checkVerticesInsteadOfIndices?: boolean,
options?: IEdgesRendererOptions,
): AbstractMeshEnables the edge rendering mode on the mesh. This mode makes the mesh edges visible
Parameters
Optionalepsilon: numberdefines the maximal distance between two angles to detect a face
OptionalcheckVerticesInsteadOfIndices: booleanindicates that we should check vertex list directly instead of faces
Optionaloptions: IEdgesRendererOptionsoptions to the edge renderer
Returns AbstractMesh
the currentAbstractMesh
flip Faces
-
Inverses facet orientations. Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
Parameters
- flipNormals: boolean = false
will also inverts the normals
Returns Mesh
current mesh
- flipNormals: boolean = false
force Shared Vertices
-
Force adjacent facets to share vertices and remove any facets that have all vertices in a line This will undo any application of covertToFlatShadedMesh Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
Returns void
freeze Normals
-
This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next
positionsarray update.Returns Mesh
the current mesh
freeze World Matrix
-
Prevents the World matrix to be computed any longer. Please note that the "moral" contract is that the world matrix is not going to be updated anymore. It is up to the developer to force updates. You trade flexibility for performance. If you want to update it, you have to unfreeze it first.
Parameters
Returns TransformNode
the TransformNode.
get Absolute Pivot Point
-
Returns a new Vector3 set with the mesh pivot point World coordinates.
Returns Vector3
a new Vector3 set with the mesh pivot point World coordinates.
get Absolute Pivot Point To Ref
-
Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates.
Parameters
- result: Vector3
vector3 to store the result
Returns TransformNode
this TransformNode.
- result: Vector3
get Absolute Position
get Animatables
-
Returns as a new array populated with the mesh material and/or skeleton, if any.
Returns IAnimatable[]
an array of IAnimatable
get Animation By Name
get Animation Range
-
Get an animation range by name
Parameters
- name: string
defines the name of the animation range to look for
Returns Nullable<AnimationRange>
null if not found else the requested animation range
- name: string
get Animation Ranges
-
Gets the list of all animation ranges defined on this node
Returns Nullable<AnimationRange>[]
an array
get Behavior By Name
get Bounding Info
-
Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined. Note that it returns a shallow bounding of the mesh (i.e. it does not include children). However, if the mesh contains thin instances, it will be expanded to include them. If you want the "raw" bounding data instead, then use
getRawBoundingInfo(). To get the full bounding of all children, callgetHierarchyBoundingVectorsinstead.Returns BoundingInfo
a BoundingInfo
get Child Meshes
-
getChildMeshes<T extends AbstractMesh>(
directDescendantsOnly?: boolean,
predicate?: (node: Node) => node is T,
): T[]Get all child-meshes of this node
Type Parameters
- T extends AbstractMesh
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)
Optionalpredicate: (node: Node) => node is Tdefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns T[]
an array of AbstractMesh
-
getChildMeshes(
directDescendantsOnly?: boolean,
predicate?: (node: Node) => boolean,
): AbstractMesh[]Get all child-meshes of this node
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: false)
Optionalpredicate: (node: Node) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns AbstractMesh[]
an array of AbstractMesh
get Children
-
getChildren<T extends Node>(
predicate?: (node: Node) => node is T,
directDescendantsOnly?: boolean,
): T[]Get all direct children of this node
Type Parameters
- T extends Node
Parameters
Optionalpredicate: (node: Node) => node is Tdefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)
Returns T[]
an array of Node
-
Get all direct children of this node
Parameters
Optionalpredicate: (node: Node) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered (Default: true)
Returns Node[]
an array of Node
get Child Transform Nodes
-
getChildTransformNodes(
directDescendantsOnly?: boolean,
predicate?: (node: Node) => boolean,
): TransformNode[]Get all child-transformNodes of this node
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optionalpredicate: (node: Node) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns TransformNode[]
an array of TransformNode
get Class Name
-
Gets the class name
Returns string
the string "Mesh".
get Closest Facet At Coordinates
-
getClosestFacetAtCoordinates(
x: number,
y: number,
z: number,
projected?: Vector3,
checkFace?: boolean,
facing?: boolean,
): Nullable<number>Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found
Parameters
- x: number
defines x coordinate
- y: number
defines y coordinate
- z: number
defines z coordinate
Optionalprojected: Vector3sets as the (x,y,z) world projection on the facet
- checkFace: boolean = false
if 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
- facing: boolean = true
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
Returns Nullable<number>
the face index if found (or null instead)
- x: number
get Closest Facet At Local Coordinates
-
getClosestFacetAtLocalCoordinates(
x: number,
y: number,
z: number,
projected?: Vector3,
checkFace?: boolean,
facing?: boolean,
): Nullable<number>Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found
Parameters
- x: number
defines x coordinate
- y: number
defines y coordinate
- z: number
defines z coordinate
Optionalprojected: Vector3sets as the (x,y,z) local projection on the facet
- checkFace: boolean = false
if 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
- facing: boolean = true
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
Returns Nullable<number>
the face index if found (or null instead)
- x: number
get Connected Particle Systems
-
This function returns all of the particle systems in the scene that use the mesh as an emitter.
Returns IParticleSystem[]
an array of particle systems in the scene that use the mesh as an emitter
get Descendants
-
getDescendants<T extends Node>(
directDescendantsOnly?: boolean,
predicate?: (node: Node) => node is T,
): T[]Will return all nodes that have this node as ascendant
Type Parameters
- T extends Node
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optionalpredicate: (node: Node) => node is Tdefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns T[]
all children nodes of all types
-
Will return all nodes that have this node as ascendant
Parameters
OptionaldirectDescendantsOnly: booleandefines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
Optionalpredicate: (node: Node) => booleandefines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
Returns Node[]
all children nodes of all types
get Direction
-
Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh. This Vector3 is expressed in the World space.
Parameters
- localAxis: Vector3
axis to rotate
Returns Vector3
a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh.
- localAxis: Vector3
get Direction To Ref
-
Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh. localAxis is expressed in the mesh local space. result is computed in the World space from the mesh World matrix.
Returns TransformNode
this TransformNode.
get Distance To Camera
get Emitted Particle Systems
-
Returns an array populated with IParticleSystem objects whose the mesh is the emitter
Returns IParticleSystem[]
an array of IParticleSystem
get Engine
get Facet Data Parameters
-
Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
Returns any
the parameters
get Facet Local Normals
-
Returns the facetLocalNormals array. The normals are expressed in the mesh local spac
Returns Vector3[]
an array of Vector3
get Facet Local Partitioning
-
Returns the facetLocalPartitioning array
Returns number[][]
an array of array of numbers
get Facet Local Positions
-
Returns the facetLocalPositions array. The facet positions are expressed in the mesh local space
Returns Vector3[]
an array of Vector3
get Facet Normal
-
Returns the i-th facet normal in the world system. This method allocates a new Vector3 per call
Parameters
- i: number
defines the facet index
Returns Vector3
a new Vector3
- i: number
get Facet Normal To Ref
-
Sets the reference Vector3 with the i-th facet normal in the world system
Parameters
- i: number
defines the facet index
- ref: Vector3
defines the target vector
Returns GoldbergMesh
the current mesh
- i: number
get Facet Position
-
Returns the i-th facet position in the world system. This method allocates a new Vector3 per call
Parameters
- i: number
defines the facet index
Returns Vector3
a new Vector3
- i: number
get Facet Position To Ref
-
Sets the reference Vector3 with the i-th facet position in the world system
Parameters
- i: number
defines the facet index
- ref: Vector3
defines the target vector
Returns AbstractMesh
the current mesh
- i: number
get Facets At Local Coordinates
-
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)
Parameters
- x: number
defines x coordinate
- y: number
defines y coordinate
- z: number
defines z coordinate
Returns Nullable<number[]>
the array of facet indexes
- x: number
get Hierarchy Bounding Vectors
-
getHierarchyBoundingVectors(
includeDescendants?: boolean,
predicate?: Nullable<(abstractMesh: AbstractMesh) => boolean>,
): { max: Vector3; min: Vector3 }Return the minimum and maximum world vectors of the entire hierarchy under current node
Parameters
- includeDescendants: boolean = true
Include bounding info from descendants as well (true by default)
- predicate: Nullable<(abstractMesh: AbstractMesh) => boolean> = null
defines a callback function that can be customize to filter what meshes should be included in the list used to compute the bounding vectors
Returns { max: Vector3; min: Vector3 }
the new bounding vectors
- includeDescendants: boolean = true
get Hierarchy Emitted Particle Systems
-
Returns an array populated with IParticleSystem objects whose the mesh or its children are the emitter
Returns IParticleSystem[]
an array of IParticleSystem
get Indices
-
Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
Parameters
OptionalcopyWhenShared: booleanIf true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
OptionalforceCopy: booleandefines a boolean indicating that the returned array must be cloned upon returning it
Returns Nullable<IndicesArray>
the indices array or an empty array if the mesh has no geometry
get LOD
-
Returns the registered LOD mesh distant from the parameter
cameraposition if any, else returns the current mesh.Parameters
- camera: Camera
defines the camera to use to compute distance
OptionalboundingSphere: BoundingSpheredefines a custom bounding sphere to use instead of the one from this mesh
Returns Nullable<AbstractMesh>
This mesh (for chaining)
- camera: Camera
get LOD Level At Distance
get LOD Levels
-
Gets the list of MeshLODLevel associated with the current mesh
Returns MeshLODLevel[]
an array of MeshLODLevel
get Material For Render Pass
-
Gets the material used to render the mesh in a specific render pass
Parameters
- renderPassId: number
render pass id
Returns Material | undefined
material used for the render pass. If no specific material is used for this render pass, undefined is returned (meaning mesh.material is used for this pass)
- renderPassId: number
get Mesh Uniform Buffer
get Normals Data
-
Get the normals vertex data and optionally apply skeleton and morphing.
Parameters
- applySkeleton: boolean = false
defines whether to apply the skeleton
- applyMorph: boolean = false
defines whether to apply the morph target
Returns Nullable<FloatArray>
the normals data
- applySkeleton: boolean = false
get Physics Body
-
Returns Nullable<PhysicsBody>
get Physics Impostor
get Pivot Matrix
get Pivot Point
-
Returns a new Vector3 set with the mesh pivot point coordinates in the local space.
Returns Vector3
the pivot point
get Pivot Point To Ref
-
Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space.
Parameters
- result: Vector3
the vector3 to store the result
Returns TransformNode
this TransformNode.
- result: Vector3
get Pose Matrix
get Position Data
-
getPositionData(
applySkeleton?: boolean,
applyMorph?: boolean,
data?: Nullable<FloatArray>,
): Nullable<FloatArray>Get the position vertex data and optionally apply skeleton and morphing.
Parameters
- applySkeleton: boolean = false
defines whether to apply the skeleton
- applyMorph: boolean = false
defines whether to apply the morph target
- data: Nullable<FloatArray> = null
defines the position data to apply the skeleton and morph to
Returns Nullable<FloatArray>
the position data
- applySkeleton: boolean = false
get Position Expressed In Local Space
-
Returns the mesh position in the local space from the current World matrix values.
Returns Vector3
a new Vector3.
get Position In Camera Space
get Raw Bounding Info
-
Returns the bounding info unnafected by instance data.
Returns BoundingInfo
the bounding info of the mesh unaffected by instance data.
get Scene
get Total Indices
-
Returns a positive integer : the total number of indices in this mesh geometry.
Returns number
the number of indices or zero if the mesh has no geometry.
get Total Vertices
-
Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
Returns number
the total number of vertices
get Vertex Buffer
-
Returns the mesh VertexBuffer object from the requested
kindParameters
- kind: string
defines which buffer to read from (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.NormalKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
OptionalbypassInstanceData: booleandefines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
Returns Nullable<VertexBuffer>
a FloatArray or null if the mesh has no vertex buffer for this kind.
- kind: string
get Vertices Data
-
getVerticesData(
kind: string,
copyWhenShared?: boolean,
forceCopy?: boolean,
bypassInstanceData?: boolean,
): Nullable<FloatArray>Returns the content of an associated vertex buffer
Parameters
- kind: string
defines which buffer to read from (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
OptionalcopyWhenShared: booleandefines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one
OptionalforceCopy: booleandefines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is
OptionalbypassInstanceData: booleandefines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
Returns Nullable<FloatArray>
a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.
- kind: string
get Vertices Data Kinds
-
Returns a string which contains the list of existing
kindsof Vertex Data associated with this mesh.Parameters
OptionalbypassInstanceData: booleandefines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
Returns string[]
an array of strings
get World Matrix
increase Vertices
-
Increase the number of facets and hence vertices in a mesh Vertex normals are interpolated from existing vertex normals Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
Parameters
- numberPerEdge: number = 1
the number of new vertices to add to each edge of a facet, optional default 1
Returns void
- numberPerEdge: number = 1
instantiate Hierarchy
-
instantiateHierarchy(
newParent?: Nullable<TransformNode>,
options?: {
doNotInstantiate: boolean | ((node: TransformNode) => boolean);
},
onNewNodeCreated?: (source: TransformNode, clone: TransformNode) => void,
): Nullable<TransformNode>Instantiate (when possible) or clone that node with its hierarchy
Parameters
- newParent: Nullable<TransformNode> = null
defines the new parent to use for the instance (or clone)
Optionaloptions: { doNotInstantiate: boolean | ((node: TransformNode) => boolean) }defines options to configure how copy is done
OptionalonNewNodeCreated: (source: TransformNode, clone: TransformNode) => voiddefines an option callback to call when a clone or an instance is created
Returns Nullable<TransformNode>
an instance (or a clone) of the current node with its hierarchy
- newParent: Nullable<TransformNode> = null
intersects
-
intersects(
ray: Ray,
fastCheck?: boolean,
trianglePredicate?: TrianglePickingPredicate,
onlyBoundingInfo?: boolean,
worldToUse?: Matrix,
skipBoundingInfo?: boolean,
): PickingInfoChecks if the passed Ray intersects with the mesh. A mesh triangle can be picked both from its front and back sides, irrespective of orientation.
Parameters
- ray: Ray
defines the ray to use. It should be in the mesh's LOCAL coordinate space.
OptionalfastCheck: booleandefines if fast mode (but less precise) must be used (false by default)
OptionaltrianglePredicate: TrianglePickingPredicatedefines an optional predicate used to select faces when a mesh intersection is detected
- onlyBoundingInfo: boolean = false
defines a boolean indicating if picking should only happen using bounding info (false by default)
OptionalworldToUse: Matrixdefines the world matrix to use to get the world coordinate of the intersection point
- skipBoundingInfo: boolean = false
a boolean indicating if we should skip the bounding info check
Returns PickingInfo
the picking info
- ray: Ray
intersects Mesh
-
intersectsMesh(
mesh: AbstractMesh | SolidParticle,
precise?: boolean,
includeDescendants?: boolean,
): booleanTrue if the mesh intersects another mesh or a SolidParticle object
Parameters
- mesh: AbstractMesh | SolidParticle
defines a target mesh or SolidParticle to test
- precise: boolean = false
Unless the parameter
preciseis set totruethe intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes) OptionalincludeDescendants: booleanCan be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes
Returns boolean
true if there is an intersection
- mesh: AbstractMesh | SolidParticle
intersects Point
-
Returns true if the passed point (Vector3) is inside the mesh bounding box
Parameters
- point: Vector3
defines the point to test
Returns boolean
true if there is an intersection
- point: Vector3
is Completely In Frustum
-
Returns
trueif 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.Parameters
- frustumPlanes: Plane[]
defines the frustum to test
Returns boolean
true if the mesh is completely in the frustum planes
- frustumPlanes: Plane[]
is Descendant Of
-
Is this node a descendant of the given node? The function will iterate up the hierarchy until the ancestor was found or no more parents defined
Parameters
- ancestor: Node
defines the parent node to inspect
Returns boolean
a boolean indicating if this node is a descendant of the given node
- ancestor: Node
is Disposed
-
Gets a boolean indicating if the node has been disposed
Returns boolean
true if the node was disposed
is Enabled
-
Is this node enabled? If the node has a parent, all ancestors will be checked and false will be returned if any are false (not enabled), otherwise will return true
Parameters
- checkAncestors: boolean = true
indicates if this method should check the ancestors. The default is to check the ancestors. If set to false, the method will return the value of this node without checking ancestors
Returns boolean
whether this node (and its parent) is enabled
Remarks
To observe changes to the value returned when calling this with
checkAncestorsset to true (the default, i.e. the effective enabled state), subscribe to onEffectiveEnabledStateChangedObservable. To observe changes to the value returned when calling this withcheckAncestorsset to false (i.e. this node's own enabled state only), subscribe to onEnabledStateChangedObservable. - checkAncestors: boolean = true
is In Frustum
-
Returns
trueif 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 frustumParameters
- frustumPlanes: Plane[]
defines the frustum to test
Returns boolean
true if the mesh is in the frustum planes
- frustumPlanes: Plane[]
is Ready
-
Determine if the current mesh is ready to be rendered
Parameters
- completeCheck: boolean = false
defines if a complete check (including materials and lights) has to be done (false by default)
- forceInstanceSupport: boolean = false
will check if the mesh will be ready when used with instances (false by default)
Returns boolean
true if all associated assets are ready (material, textures, shaders)
- completeCheck: boolean = false
is Using Pivot Matrix
-
return true if a pivot has been set
Returns boolean
true if a pivot matrix is used
is Using Post Multiply Pivot Matrix
-
Returns boolean
true if pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect.
is Vertex Buffer Updatable
-
Returns a boolean defining if the vertex data for the requested
kindis updatable.Parameters
- kind: string
defines which buffer to check (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
OptionalbypassInstanceData: booleandefines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
Returns boolean
a boolean
- kind: string
is Vertices Data Present
-
Tests if a specific vertex buffer is associated with this mesh
Parameters
- kind: string
defines which buffer to check (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.NormalKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
OptionalbypassInstanceData: booleandefines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
Returns boolean
a boolean
- kind: string
is World Matrix Camera Dependent
-
Returns whether the transform node world matrix computation needs the camera information to be computed. This is the case when the node is a billboard or has an infinite distance for instance.
Returns boolean
true if the world matrix computation needs the camera information to be computed
locally Translate
-
Translates the mesh along the passed Vector3 in its local space.
Parameters
- vector3: Vector3
the distance to translate in localspace
Returns TransformNode
the TransformNode.
- vector3: Vector3
look At
-
lookAt(
targetPoint: Vector3,
yawCor?: number,
pitchCor?: number,
rollCor?: number,
space?: Space,
): TransformNodeOrients a mesh towards a target point. Mesh must be drawn facing user.
Parameters
- targetPoint: Vector3
the position (must be in same space as current mesh) to look at
- yawCor: number = 0
optional yaw (y-axis) correction in radians
- pitchCor: number = 0
optional pitch (x-axis) correction in radians
- rollCor: number = 0
optional roll (z-axis) correction in radians
- space: Space = Space.LOCAL
the chosen space of the target
Returns TransformNode
the TransformNode.
- targetPoint: Vector3
make Geometry Unique
mark As Dirty
-
Flag the AbstractMesh as dirty (Forcing it to update everything)
Parameters
Optionalproperty: stringif set to "rotation" the objects rotationQuaternion will be set to null
Returns AbstractMesh
this AbstractMesh
mark Vertices Data As Updatable
-
Flags an associated vertex buffer as updatable
Parameters
- kind: string
defines which buffer to use (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
- updatable: boolean = true
defines if the updated vertex buffer must be flagged as updatable
Returns void
- kind: string
move POV
-
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 definedFacingForwardSearch | See definedFacingForwardSearch.
Parameters
- amountRight: number
defines the distance on the right axis
- amountUp: number
defines the distance on the up axis
- amountForward: number
defines the distance on the forward axis
Returns AbstractMesh
the current mesh
- amountRight: number
move With Collisions
-
Move the mesh using collision engine
Parameters
- displacement: Vector3
defines the requested displacement vector
- slideOnCollide: boolean = true
If true, the mesh will slide along a collider's surface. If false, it will stop moving at the first collision. (true by default)
Returns AbstractMesh
the current mesh
- displacement: Vector3
normalize To Unit Cube
-
normalizeToUnitCube(
includeDescendants?: boolean,
ignoreRotation?: boolean,
predicate?: Nullable<(node: AbstractMesh) => boolean>,
): AbstractMeshUniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)
Parameters
- includeDescendants: boolean = true
Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false
- ignoreRotation: boolean = false
ignore rotation when computing the scale (ie. object will be axis aligned). Default is false
Optionalpredicate: Nullable<(node: AbstractMesh) => boolean>predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling
Returns AbstractMesh
the current mesh
- includeDescendants: boolean = true
optimize Indices
-
Optimization of the mesh's indices, in case a mesh has duplicated vertices. The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes. This should be used together with the simplification to avoid disappearing triangles.
Parameters
OptionalsuccessCallback: (mesh?: Mesh) => voidan optional success callback to be called after the optimization finished.
Returns Mesh
the current mesh
optimize Indices Async
-
Optimize the indices order so that we keep the faces with similar indices together
Returns Promise<AbstractMesh>
the current mesh
place On Goldberg Face At
refresh Bounding Info
-
refreshBoundingInfo(
applySkeletonOrOptions?: boolean | IMeshDataOptions,
applyMorph?: boolean,
): MeshThis method recomputes and sets a new BoundingInfo to the mesh unless it is locked. This means the mesh underlying bounding box and sphere are recomputed.
Parameters
- applySkeletonOrOptions: boolean | IMeshDataOptions = false
defines whether to apply the skeleton before computing the bounding info or a set of options
- applyMorph: boolean = false
defines whether to apply the morph target before computing the bounding info
Returns Mesh
the current mesh
- applySkeletonOrOptions: boolean | IMeshDataOptions = false
register After Render
-
Registers for this mesh a javascript function called just after the rendering is complete
Parameters
- func: (mesh: AbstractMesh) => void
defines the function to call after rendering this mesh
Returns Mesh
the current mesh
- func: (mesh: AbstractMesh) => void
register After World Matrix Update
-
If you'd like to be called back after the mesh position, rotation or scaling has been updated.
Parameters
- func: (mesh: TransformNode) => void
callback function to add
Returns TransformNode
the TransformNode.
- func: (mesh: TransformNode) => void
register Before Render
-
Registers for this mesh a javascript function called just before the rendering process
Parameters
- func: (mesh: AbstractMesh) => void
defines the function to call before rendering this mesh
Returns Mesh
the current mesh
- func: (mesh: AbstractMesh) => void
register Instanced Buffer
-
Register a custom buffer that will be instanced
Parameters
- kind: string
defines the buffer kind
- stride: number
defines the stride in floats
Returns void
- kind: string
related Goldberg Face
-
Gets the related Goldberg face from pole infos
Parameters
- poleOrShared: number
Defines the pole index or the shared face index if the fromPole parameter is passed in
OptionalfromPole: numberDefines an optional pole index to find the related info from
Returns number
the goldberg face number
- poleOrShared: number
release Sub Meshes
-
Disposes all the submeshes of the current mesh
Parameters
- immediate: boolean = false
should dispose the effects immediately or not
Returns AbstractMesh
the current mesh
- immediate: boolean = false
remove Behavior
remove Child
-
Removes the passed mesh from the current mesh children list
Parameters
- mesh: TransformNode
defines the child mesh
- preserveScalingSign: boolean = false
if true, keep scaling sign of child. Otherwise, scaling sign might change.
Returns this
the current mesh
- mesh: TransformNode
remove LOD Level
remove Vertices Data
-
Delete a vertex buffer associated with this mesh
Parameters
- kind: string
defines which buffer to delete (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
Returns void
- kind: string
render
-
Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager
Parameters
- subMesh: SubMesh
defines the subMesh to render
- enableAlphaMode: boolean
defines if alpha mode can be changed
OptionaleffectiveMeshReplacement: AbstractMeshdefines an optional mesh used to provide info for the rendering
Returns Mesh
the current mesh
- subMesh: SubMesh
render With Render Pass Id
-
renderWithRenderPassId(
renderPassId?: number,
enableAlphaMode?: boolean,
effectiveMeshReplacement?: AbstractMesh,
subMesh?: SubMesh,
checkFrustumCulling?: boolean,
): GoldbergMeshTriggers the draw call for the mesh (or a submesh), for a specific render pass id
Parameters
OptionalrenderPassId: numberdefines the render pass id to use to draw the mesh / submesh. If not provided, use the current renderPassId of the engine.
OptionalenableAlphaMode: booleandefines if alpha mode can be changed (default: false)
OptionaleffectiveMeshReplacement: AbstractMeshdefines an optional mesh used to provide info for the rendering (default: undefined)
OptionalsubMesh: SubMeshdefines the subMesh to render. If not provided, draw all mesh submeshes (default: undefined)
- checkFrustumCulling: boolean = true
defines if frustum culling must be checked (default: true). If you know the mesh is in the frustum (or if you don't care!), you can pass false to optimize.
Returns GoldbergMesh
the current mesh
reset Draw Cache
-
Resets the draw wrappers cache for all submeshes of this abstract mesh
Parameters
OptionalpassId: numberIf provided, releases only the draw wrapper corresponding to this render pass id
- immediate: boolean = false
If true, the effect will be released immediately, otherwise it will be released at the next frame
Returns void
reset Local Matrix
-
Resets this nodeTransform's local matrix to Matrix.Identity().
Parameters
- independentOfChildren: boolean = true
indicates if all child nodeTransform's world-space transform should be preserved.
Returns void
- independentOfChildren: boolean = true
rotate
-
Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space. space (default LOCAL) can be either Space.LOCAL, either Space.WORLD. Note that the property
rotationQuaternionis then automatically updated and the propertyrotationis set to (0,0,0) and no longer used. The passed axis is also normalized.Parameters
Returns TransformNode
the TransformNode.
rotate Around
-
Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space. Note that the property
rotationQuaternionis then automatically updated and the propertyrotationis set to (0,0,0) and no longer used. The passed axis is also normalized. . Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htmParameters
Returns TransformNode
the TransformNode
rotate POV
-
Perform relative rotation change from the point of view of behind the front of the mesh. Supports definition of mesh facing forward or backward definedFacingForwardSearch | See definedFacingForwardSearch.
Parameters
- flipBack: number
defines the flip
- twirlClockwise: number
defines the twirl
- tiltRight: number
defines the tilt
Returns AbstractMesh
the current mesh
- flipBack: number
serialize
-
Serialize current mesh
Parameters
- serializationObject: any
defines the object which will receive the serialization data
Returns void
- serializationObject: any
serialize Animation Ranges
-
Serialize animation ranges into a JSON compatible object
Returns any
serialization object
set Absolute Position
-
Sets the mesh absolute position in the World from a Vector3 or an Array(3).
Parameters
- absolutePosition: Vector3
the absolute position to set
Returns TransformNode
the TransformNode.
- absolutePosition: Vector3
set Bounding Info
-
Overwrite the current bounding info
Parameters
- boundingInfo: BoundingInfo
defines the new bounding info
Returns AbstractMesh
the current mesh
- boundingInfo: BoundingInfo
set Direction
-
setDirection(
localAxis: Vector3,
yawCor?: number,
pitchCor?: number,
rollCor?: number,
): TransformNodeSets this transform node rotation to the given local axis.
Parameters
- localAxis: Vector3
the axis in local space
- yawCor: number = 0
optional yaw (y-axis) correction in radians
- pitchCor: number = 0
optional pitch (x-axis) correction in radians
- rollCor: number = 0
optional roll (z-axis) correction in radians
Returns TransformNode
this TransformNode
- localAxis: Vector3
set Enabled
-
Set the enabled state of this node
Parameters
- value: boolean
defines the new enabled state
Returns void
- value: boolean
set Goldberg Face Colors
-
Set new goldberg face colors
Parameters
- colorRange: (number | Color4)[][]
the new color to apply to the mesh
Returns void
- colorRange: (number | Color4)[][]
set Goldberg Face U Vs
-
set new goldberg face UVs
Parameters
- uvRange: (number | Vector2)[][]
the new UVs to apply to the mesh
Returns void
- uvRange: (number | Vector2)[][]
set Index Buffer
-
setIndexBuffer(
indexBuffer: DataBuffer,
totalVertices: number,
totalIndices: number,
is32Bits?: Nullable<boolean>,
): voidSets the index buffer of this mesh.
Parameters
- indexBuffer: DataBuffer
Defines the index buffer to use for this mesh
- totalVertices: number
Defines the total number of vertices used by the buffer
- totalIndices: number
Defines the total number of indices in the index buffer
- is32Bits: Nullable<boolean> = null
Defines if the indices are 32 bits. If null (default), the value is guessed from the number of vertices
Returns void
- indexBuffer: DataBuffer
set Indices
-
setIndices(
indices: IndicesArray,
totalVertices?: Nullable<number>,
updatable?: boolean,
dontForceSubMeshRecreation?: boolean,
): AbstractMeshSet the index buffer of this mesh
Parameters
- indices: IndicesArray
defines the source data
- totalVertices: Nullable<number> = null
defines the total number of vertices referenced by this index data (can be null)
- updatable: boolean = false
defines if the updated index buffer must be flagged as updatable (default is false)
- dontForceSubMeshRecreation: boolean = false
defines a boolean indicating that we don't want to force the recreation of sub-meshes if we don't have to (false by default)
Returns AbstractMesh
the current mesh
- indices: IndicesArray
set Material By Id
-
Sets the mesh material by the material or multiMaterial
idpropertyParameters
- id: string
is a string identifying the material or the multiMaterial
Returns Mesh
the current mesh
- id: string
set Material By ID
-
Sets the mesh material by the material or multiMaterial
idpropertyParameters
- id: string
is a string identifying the material or the multiMaterial
Returns Mesh
the current mesh
- id: string
set Material For Render Pass
-
Sets the material to be used to render the mesh in a specific render pass
Parameters
- renderPassId: number
render pass id
Optionalmaterial: Materialmaterial to use for this render pass. If undefined is passed, no specific material will be used for this render pass but the regular material will be used instead (mesh.material)
Returns void
- renderPassId: number
set Normals For CPU Skinning
-
Prepare internal normal array for software CPU skinning
Returns Nullable<Float32Array<ArrayBufferLike>>
original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
set Parent
-
setParent(
node: Nullable<Node>,
preserveScalingSign?: boolean,
updatePivot?: boolean,
): TransformNodeDefines the passed node as the parent of the current node. The node will remain exactly where it is and its position / rotation will be updated accordingly. If you don't want to preserve the current rotation / position, assign the parent through parent accessor. Note that if the mesh has a pivot matrix / point defined it will be applied after the parent was updated. In that case the node will not remain in the same space as it is, as the pivot will be applied. To avoid this, you can set updatePivot to true and the pivot will be updated to identity
Parameters
Returns TransformNode
this TransformNode.
set Physics Link With
-
setPhysicsLinkWith(
otherMesh: Mesh,
pivot1: Vector3,
pivot2: Vector3,
options?: any,
): AbstractMesh
set Pivot Matrix
-
Sets a new pivot matrix to the current node
Parameters
- matrix: DeepImmutable<Matrix>
defines the new pivot matrix to use
- postMultiplyPivotMatrix: boolean = true
defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect
Returns TransformNode
the current TransformNode
- matrix: DeepImmutable<Matrix>
set Pivot Point
-
Sets a new pivot point to the current node
Parameters
Returns TransformNode
the current TransformNode
set Positions For CPU Skinning
-
Prepare internal position array for software CPU skinning
Returns Nullable<Float32Array<ArrayBufferLike>>
original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh
set Position With Local Vector
-
Sets the mesh position in its local space.
Parameters
- vector3: Vector3
the position to set in localspace
Returns TransformNode
the TransformNode.
- vector3: Vector3
set Pre Transform Matrix
-
Sets a new matrix to apply before all other transformation
Parameters
- matrix: Matrix
defines the transform matrix
Returns TransformNode
the current TransformNode
- matrix: Matrix
set Vertices Buffer
-
setVerticesBuffer(
buffer: VertexBuffer,
disposeExistingBuffer?: boolean,
totalVertices?: Nullable<number>,
): MeshSets the mesh global Vertex Buffer
Parameters
- buffer: VertexBuffer
defines the buffer to use
- disposeExistingBuffer: boolean = true
disposes the existing buffer, if any (default: true)
- totalVertices: Nullable<number> = null
defines the total number of vertices for position kind (could be null)
Returns Mesh
the current mesh
- buffer: VertexBuffer
set Vertices Data
-
setVerticesData(
kind: string,
data: FloatArray,
updatable?: boolean,
stride?: number,
): AbstractMeshCopy a FloatArray into a specific associated vertex buffer
Parameters
- kind: string
defines which buffer to write to (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
- data: FloatArray
defines the data source
- updatable: boolean = false
defines if the updated vertex buffer must be flagged as updatable
Optionalstride: numberdefines the data stride size (can be null)
Returns AbstractMesh
the current mesh
- kind: string
simplify
-
simplify(
settings: ISimplificationSettings[],
parallelProcessing?: boolean,
simplificationType?: QUADRATIC,
successCallback?: (mesh?: Mesh, submeshIndex?: number) => void,
): MeshSimplify the mesh according to the given array of settings. Function will return immediately and will simplify async
Parameters
- settings: ISimplificationSettings[]
a collection of simplification settings
OptionalparallelProcessing: booleanshould all levels calculate parallel or one after the other
OptionalsimplificationType: QUADRATICthe type of simplification to run
OptionalsuccessCallback: (mesh?: Mesh, submeshIndex?: number) => voidoptional success callback to be called after the simplification finished processing all settings
Returns Mesh
the current mesh
- settings: ISimplificationSettings[]
subdivide
-
This function will subdivide the mesh into multiple submeshes
Parameters
- count: number
defines the expected number of submeshes
Returns void
- count: number
synchronize Instances
-
Synchronises all the mesh instance submeshes to the current mesh submeshes, if any. After this call, all the mesh instances have the same submeshes than the current mesh.
Returns Mesh
the current mesh
thin Instance Add
-
thinInstanceAdd(
matrix: DeepImmutableObject<Matrix> | DeepImmutableObject<Matrix>[],
refresh?: boolean,
): numberCreates a new thin instance
Parameters
- matrix: DeepImmutableObject<Matrix> | DeepImmutableObject<Matrix>[]
the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create
Optionalrefresh: booleantrue to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance
Returns number
the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc
- matrix: DeepImmutableObject<Matrix> | DeepImmutableObject<Matrix>[]
thin Instance Add Self
-
Adds the transformation (matrix) of the current mesh as a thin instance
Parameters
Optionalrefresh: booleantrue to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance
Returns number
the thin instance index number
thin Instance Buffer Updated
-
Synchronize the gpu buffers with a thin instance buffer. Call this method if you update later on the buffers passed to thinInstanceSetBuffer
Parameters
- kind: string
name of the attribute to update. Use "matrix" to update the buffer of matrices
Returns void
- kind: string
thin Instance Get World Matrices
-
Gets the list of world matrices
Returns Matrix[]
an array containing all the world matrices from the thin instances
thin Instance Partial Buffer Update
-
thinInstancePartialBufferUpdate(
kind: string,
dataOrLength: number | Float32Array<ArrayBufferLike>,
offset: number,
): voidApplies a partial update to a buffer directly on the GPU Note that the buffer located on the CPU is NOT updated! It's up to you to update it (or not) with the same data you pass to this method
Parameters
- kind: string
name of the attribute to update. Use "matrix" to update the buffer of matrices
- dataOrLength: number | Float32Array<ArrayBufferLike>
the data to set in the GPU buffer, or the length (in elements) of data to update starting from the offset. If you pass a length (number), it is the number of elements to update. For example, if kind is "matrix" and you pass 2 as length, it will update 2 matrices (2*16 floats) in the GPU buffer starting from the offset; in this case offset should also be expressed as a number of elements. If you pass a Float32Array, offset is interpreted in floats in the underlying GPU buffer, consistent with low-level buffer update methods such as updateDirectly.
- offset: number
the offset in the GPU buffer where to update the data:
- when dataOrLength is a number, this is an element offset (for example, a matrix index);
- when dataOrLength is a Float32Array, this is a float offset in the underlying buffer.
Returns void
- kind: string
thin Instance Refresh Bounding Info
-
thinInstanceRefreshBoundingInfo(
forceRefreshParentInfo?: boolean,
applySkeleton?: boolean,
applyMorph?: boolean,
applyBakedVertexAnimation?: boolean,
): voidRefreshes the bounding info, taking into account all the thin instances defined
Parameters
OptionalforceRefreshParentInfo: booleantrue to force recomputing the mesh bounding info and use it to compute the aggregated bounding info
OptionalapplySkeleton: booleandefines whether to apply the skeleton before computing the bounding info
OptionalapplyMorph: booleandefines whether to apply the morph target before computing the bounding info
OptionalapplyBakedVertexAnimation: booleandefines whether to apply baked vertex animation before computing the bounding info
Returns void
thin Instance Register Attribute
-
Registers a custom attribute to be used with thin instances
Parameters
- kind: string
name of the attribute
- stride: number
size in floats of the attribute
Returns void
- kind: string
thin Instance Set Attribute At
-
Sets the value of a custom attribute for a thin instance
Parameters
- kind: string
name of the attribute
- index: number
index of the thin instance
- value: number[]
value to set
Optionalrefresh: booleantrue to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance
Returns void
- kind: string
thin Instance Set Buffer
-
thinInstanceSetBuffer(
kind: string,
buffer: Nullable<Float32Array<ArrayBufferLike>>,
stride?: number,
staticBuffer?: boolean,
): voidSets a buffer to be used with thin instances. This method is a faster way to setup multiple instances than calling thinInstanceAdd repeatedly
Parameters
- kind: string
name of the attribute. Use "matrix" to setup the buffer of matrices
- buffer: Nullable<Float32Array<ArrayBufferLike>>
buffer to set
Optionalstride: numbersize in floats of each value of the buffer
OptionalstaticBuffer: booleanindicates that the buffer is static, so that you won't change it after it is set (better performances - true by default)
Returns void
- kind: string
thin Instance Set Matrix At
-
thinInstanceSetMatrixAt(
index: number,
matrix: DeepImmutableObject<Matrix>,
refresh?: boolean,
): voidSets the matrix of a thin instance
Parameters
- index: number
index of the thin instance
- matrix: DeepImmutableObject<Matrix>
matrix to set
Optionalrefresh: booleantrue to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance
Returns void
- index: number
to Left Handed
-
Invert the geometry to move from a right handed system to a left handed one.
Returns Mesh
the current mesh
to String
-
Returns a description of this mesh
Parameters
OptionalfullDetails: booleandefine if full details about this mesh must be used
Returns string
a descriptive string representing this mesh
transfer To Effect
-
Transfer the mesh values to its UBO.
Parameters
- world: Matrix
The world matrix associated with the mesh
Returns void
- world: Matrix
translate
-
Translates the mesh along the axis vector for the passed distance in the given space. space (default LOCAL) can be either Space.LOCAL, either Space.WORLD.
Parameters
Returns TransformNode
the TransformNode.
unfreeze Normals
-
This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen
Returns Mesh
the current mesh
unfreeze World Matrix
unregister After Render
-
Disposes a previously registered javascript function called after the rendering.
Parameters
- func: (mesh: AbstractMesh) => void
defines the function to remove
Returns Mesh
the current mesh
- func: (mesh: AbstractMesh) => void
unregister After World Matrix Update
-
Removes a registered callback function.
Parameters
- func: (mesh: TransformNode) => void
callback function to remove
Returns TransformNode
the TransformNode.
- func: (mesh: TransformNode) => void
unregister Before Render
-
Disposes a previously registered javascript function called before the rendering
Parameters
- func: (mesh: AbstractMesh) => void
defines the function to remove
Returns Mesh
the current mesh
- func: (mesh: AbstractMesh) => void
update Facet Data
-
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 AbstractMesh
the current mesh
update Goldberg Face Colors
-
Updates new goldberg face colors
Parameters
- colorRange: (number | Color4)[][]
the new color to apply to the mesh
Returns void
- colorRange: (number | Color4)[][]
update Goldberg Face U Vs
-
Updates new goldberg face UVs
Parameters
- uvRange: (number | Vector2)[][]
the new UVs to apply to the mesh
Returns void
- uvRange: (number | Vector2)[][]
update Indices
-
Update the current index buffer
Parameters
- indices: IndicesArray
defines the source data
Optionaloffset: numberdefines the offset in the index buffer where to store the new data (can be null)
- gpuMemoryOnly: boolean = false
defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)
Returns AbstractMesh
the current mesh
- indices: IndicesArray
update Mesh Positions
-
This method updates the vertex positions of an updatable mesh according to the
positionFunctionreturned values.Parameters
- positionFunction: (data: FloatArray) => void
is a simple JS function what is passed the mesh
positionsarray. It doesn't need to return anything - computeNormals: boolean = true
is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update
Returns Mesh
the current mesh
- positionFunction: (data: FloatArray) => void
update Pose Matrix
-
Copies the parameter passed Matrix into the mesh Pose matrix.
Parameters
- matrix: Matrix
the matrix to copy the pose from
Returns TransformNode
this TransformNode.
- matrix: Matrix
update Vertices Data
-
updateVerticesData(
kind: string,
data: FloatArray,
updateExtends?: boolean,
makeItUnique?: boolean,
): AbstractMeshUpdate a specific associated vertex buffer
Parameters
- kind: string
defines which buffer to write to (positions, indices, normals, etc). Possible
kindvalues :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
- data: FloatArray
defines the data source
OptionalupdateExtends: booleandefines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind
OptionalmakeItUnique: booleandefines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)
Returns AbstractMesh
the current mesh
- kind: string
validate Skinning
-
ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights, or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let the user know there was an issue with importing the mesh
Returns { report: string; skinned: boolean; valid: boolean }
a validation object with skinned, valid and report string
StaticAdd Node Constructor
-
Add a new node constructor
Parameters
- type: string
defines the type name of the node to construct
- constructorFunc: NodeConstructor
defines the constructor function
Returns void
- type: string
StaticCenter
-
Returns the center of the
{min:Vector3, max:Vector3}or the center of MinMax vector3 computed from a mesh arrayParameters
- meshesOrMinMaxVector: AbstractMesh[] | { max: Vector3; min: Vector3 }
could be an array of meshes or a
{min:Vector3, max:Vector3}object
Returns Vector3
a vector3
- meshesOrMinMaxVector: AbstractMesh[] | { max: Vector3; min: Vector3 }
StaticConstruct
StaticCreate Box
-
CreateBox(
_name: string,
_size: number,
_scene: Nullable<Scene>,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a box mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _size: number
sets the size (float) of each box side (default 1)
- _scene: Nullable<Scene>
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Capsule
-
Creates a Capsule Mesh
Parameters
- _name: string
defines the name of the mesh.
- _options: ICreateCapsuleOptions
the constructors options used to shape the mesh.
- _scene: Scene
defines the scene the mesh is scoped to.
Returns Mesh
the capsule mesh
- _name: string
StaticCreate Cylinder
-
CreateCylinder(
_name: string,
_height: number,
_diameterTop: number,
_diameterBottom: number,
_tessellation: number,
_subdivisions: any,
_scene?: Scene,
_updatable?: any,
_sideOrientation?: number,
): MeshCreates a cylinder or a cone mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _height: number
sets the height size (float) of the cylinder/cone (float, default 2)
- _diameterTop: number
set the top cap diameter (floats, default 1)
- _diameterBottom: number
set the bottom cap diameter (floats, default 1). This value can't be zero
- _tessellation: number
sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance
- _subdivisions: any
sets the number of rings along the cylinder height (positive integer, default 1)
Optional_scene: Scenedefines the hosting scene
Optional_updatable: anydefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Dashed Lines
-
CreateDashedLines(
_name: string,
_points: Vector3[],
_dashSize: number,
_gapSize: number,
_dashNb: number,
_scene: Nullable<Scene>,
_updatable?: boolean,
_instance?: LinesMesh,
): LinesMeshCreates a dashed line mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _points: Vector3[]
is an array successive Vector3
- _dashSize: number
is the size of the dashes relatively the dash number (positive float, default 3)
- _gapSize: number
is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)
- _dashNb: number
is the intended total number of dashes (positive integer, default 200)
- _scene: Nullable<Scene>
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_instance: LinesMeshis an instance of an existing LineMesh object to be updated with the passed
pointsparameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)
Returns LinesMesh
a new Mesh
- _name: string
StaticCreate Decal
-
CreateDecal(
_name: string,
_sourceMesh: AbstractMesh,
_position: Vector3,
_normal: Vector3,
_size: Vector3,
_angle: number,
): MeshCreates a decal mesh. . A decal is a mesh usually applied as a model onto the surface of another mesh
Parameters
- _name: string
defines the name of the mesh
- _sourceMesh: AbstractMesh
defines the mesh receiving the decal
- _position: Vector3
sets the position of the decal in world coordinates
- _normal: Vector3
sets the normal of the mesh where the decal is applied onto in world coordinates
- _size: Vector3
sets the decal scaling
- _angle: number
sets the angle to rotate the decal
Returns Mesh
a new Mesh
- _name: string
StaticCreate Disc
-
CreateDisc(
_name: string,
_radius: number,
_tessellation: number,
_scene: Nullable<Scene>,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a plane polygonal mesh. By default, this is a disc.
Parameters
- _name: string
defines the name of the mesh to create
- _radius: number
sets the radius size (float) of the polygon (default 0.5)
- _tessellation: number
sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc
- _scene: Nullable<Scene>
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Ground
-
CreateGround(
_name: string,
_width: number,
_height: number,
_subdivisions: number,
_scene?: Scene,
_updatable?: boolean,
): MeshCreates a ground mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _width: number
set the width of the ground
- _height: number
set the height of the ground
- _subdivisions: number
sets the number of subdivisions per side
Optional_scene: Scenedefines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Returns Mesh
a new Mesh
- _name: string
StaticCreate Ground From Height Map
-
CreateGroundFromHeightMap(
_name: string,
_url: string,
_width: number,
_height: number,
_subdivisions: number,
_minHeight: number,
_maxHeight: number,
_scene: Scene,
_updatable?: boolean,
_onReady?: (mesh: GroundMesh) => void,
_alphaFilter?: number,
): GroundMeshCreates a ground mesh from a height map.
Parameters
- _name: string
defines the name of the mesh to create
- _url: string
sets the URL of the height map image resource
- _width: number
set the ground width size
- _height: number
set the ground height size
- _subdivisions: number
sets the number of subdivision per side
- _minHeight: number
is the minimum altitude on the ground
- _maxHeight: number
is the maximum altitude on the ground
- _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_onReady: (mesh: GroundMesh) => voidis a callback function that will be called once the mesh is built (the height map download can last some time)
Optional_alphaFilter: numberwill filter any data where the alpha channel is below this value, defaults 0 (all data visible)
Returns GroundMesh
a new Mesh
- _name: string
StaticCreate Hemisphere
-
Creates a hemisphere mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _segments: number
sets the sphere number of horizontal stripes (positive integer, default 32)
- _diameter: number
sets the diameter size (float) of the sphere (default 1)
Optional_scene: Scenedefines the hosting scene
Returns Mesh
a new Mesh
- _name: string
StaticCreate Ico Sphere
-
CreateIcoSphere(
_name: string,
_options: {
flat?: boolean;
radius?: number;
sideOrientation?: number;
subdivisions?: number;
updatable?: boolean;
},
_scene: Scene,
): MeshCreates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided
- The parameter
radiussets the radius size (float) of the icosphere (default 1) - You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters
radiusX,radiusYandradiusZ(all by default have the same value thanradius) - The parameter
subdivisionssets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size - The parameter
flat(boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface - You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
- If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters
frontUVsandbackUVs(Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation - The mesh can be set to updatable with the boolean parameter
updatable(default false) if its internal geometry is supposed to change once created
Parameters
- _name: string
defines the name of the mesh
- _options: {
flat?: boolean;
radius?: number;
sideOrientation?: number;
subdivisions?: number;
updatable?: boolean;
}defines the options used to create the mesh
- _scene: Scene
defines the hosting scene
Returns Mesh
a new Mesh
- The parameter
StaticCreate Lathe
-
CreateLathe(
_name: string,
_shape: Vector3[],
_radius: number,
_tessellation: number,
_scene: Scene,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates lathe mesh. The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.
Parameters
- _name: string
defines the name of the mesh to create
- _shape: Vector3[]
is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero
- _radius: number
is the radius value of the lathe
- _tessellation: number
is the side number of the lathe.
- _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Lines
-
CreateLines(
_name: string,
_points: Vector3[],
_scene: Nullable<Scene>,
_updatable: boolean,
_instance?: Nullable<LinesMesh>,
): LinesMeshCreates a line mesh..
Parameters
- _name: string
defines the name of the mesh to create
- _points: Vector3[]
is an array successive Vector3
- _scene: Nullable<Scene>
defines the hosting scene
- _updatable: boolean
defines if the mesh must be flagged as updatable
Optional_instance: Nullable<LinesMesh>is an instance of an existing LineMesh object to be updated with the passed
pointsparameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).
Returns LinesMesh
a new Mesh
- _name: string
StaticCreate Plane
-
CreatePlane(
_name: string,
_size: number,
_scene: Scene,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a plane mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _size: number
sets the size (float) of both sides of the plane at once (default 1)
- _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Polygon
-
CreatePolygon(
_name: string,
_shape: Vector3[],
_scene: Scene,
_holes?: Vector3[][],
_updatable?: boolean,
_sideOrientation?: number,
_earcutInjection?: any,
): MeshCreates a polygon mesh.Please consider using the same method from the MeshBuilder class instead The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh. The parameter
shapeis a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors. You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE The mesh can be set to updatable with the boolean parameterupdatable(default false) if its internal geometry is supposed to change once created. Remember you can only change the shape positions, not their number when updating a polygon.Parameters
- _name: string
defines the name of the mesh to create
- _shape: Vector3[]
is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors
- _scene: Scene
defines the hosting scene
Optional_holes: Vector3[][]is a required array of arrays of successive Vector3 used to defines holes in the polygon
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_earcutInjection: anycan be used to inject your own earcut reference
Returns Mesh
a new Mesh
- _name: string
StaticCreate Polyhedron
-
CreatePolyhedron(
_name: string,
_options: {
custom?: any;
faceColors?: Color4[];
faceUV?: Vector4[];
sideOrientation?: number;
size?: number;
sizeX?: number;
sizeY?: number;
sizeZ?: number;
type?: number;
updatable?: boolean;
},
_scene: Scene,
): MeshCreates a polyhedron mesh. .
- The parameter
type(positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type - The parameter
size(positive float, default 1) sets the polygon size - You can overwrite the
sizeon each dimension bu using the parameterssizeX,sizeYorsizeZ(positive floats, default tosizevalue) - You can build other polyhedron types than the 15 embbeded ones by setting the parameter
custom(polyhedronObject, default null). If you set the parametercustom, this overwrittes the parametertype - A
polyhedronObjectis a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron - You can set the color and the UV of each side of the polyhedron with the parameters
faceColors(Color4, default(1, 1, 1, 1)) and faceUV (Vector4, default(0, 0, 1, 1)) - To understand how to set
faceUVorfaceColors, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/texturePerBoxFace - The parameter
flat(boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case,faceColorsandfaceUVare ignored - You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
- If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters
frontUVsandbackUVs(Vector4). Detail here : https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation - The mesh can be set to updatable with the boolean parameter
updatable(default false) if its internal geometry is supposed to change once created
Parameters
- _name: string
defines the name of the mesh to create
- _options: {
custom?: any;
faceColors?: Color4[];
faceUV?: Vector4[];
sideOrientation?: number;
size?: number;
sizeX?: number;
sizeY?: number;
sizeZ?: number;
type?: number;
updatable?: boolean;
}defines the options used to create the mesh
- _scene: Scene
defines the hosting scene
Returns Mesh
a new Mesh
- The parameter
StaticCreate Ribbon
-
CreateRibbon(
_name: string,
_pathArray: Vector3[][],
_closeArray: boolean,
_closePath: boolean,
_offset: number,
_scene?: Scene,
_updatable?: boolean,
_sideOrientation?: number,
_instance?: Mesh,
): MeshCreates a ribbon mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _pathArray: Vector3[][]
is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
- _closeArray: boolean
creates a seam between the first and the last paths of the path array (default is false)
- _closePath: boolean
creates a seam between the first and the last points of each path of the path array
- _offset: number
is taken in account only if the
pathArrayis containing a single path Optional_scene: Scenedefines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_instance: Meshdefines an instance of an existing Ribbon object to be updated with the passed
pathArrayparameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Sphere
-
CreateSphere(
_name: string,
_segments: number,
_diameter: number,
_scene?: Scene,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a sphere mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _segments: number
sets the sphere number of horizontal stripes (positive integer, default 32)
- _diameter: number
sets the diameter size (float) of the sphere (default 1)
Optional_scene: Scenedefines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Tiled Ground
-
CreateTiledGround(
_name: string,
_xmin: number,
_zmin: number,
_xmax: number,
_zmax: number,
_subdivisions: { h: number; w: number },
_precision: { h: number; w: number },
_scene: Scene,
_updatable?: boolean,
): MeshCreates a tiled ground mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _xmin: number
set the ground minimum X coordinate
- _zmin: number
set the ground minimum Y coordinate
- _xmax: number
set the ground maximum X coordinate
- _zmax: number
set the ground maximum Z coordinate
- _subdivisions: { h: number; w: number }
is an object
{w: positive integer, h: positive integer}(default{w: 6, h: 6}).wandhare the numbers of subdivisions on the ground width and height. Each subdivision is called a tile - _precision: { h: number; w: number }
is an object
{w: positive integer, h: positive integer}(default{w: 2, h: 2}).wandhare the numbers of subdivisions on the ground width and height of each tile - _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Returns Mesh
a new Mesh
- _name: string
StaticCreate Torus
-
CreateTorus(
_name: string,
_diameter: number,
_thickness: number,
_tessellation: number,
_scene?: Scene,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a torus mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _diameter: number
sets the diameter size (float) of the torus (default 1)
- _thickness: number
sets the diameter size of the tube of the torus (float, default 0.5)
- _tessellation: number
sets the number of torus sides (positive integer, default 16)
Optional_scene: Scenedefines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Torus Knot
-
CreateTorusKnot(
_name: string,
_radius: number,
_tube: number,
_radialSegments: number,
_tubularSegments: number,
_p: number,
_q: number,
_scene?: Scene,
_updatable?: boolean,
_sideOrientation?: number,
): MeshCreates a torus knot mesh.
Parameters
- _name: string
defines the name of the mesh to create
- _radius: number
sets the global radius size (float) of the torus knot (default 2)
- _tube: number
sets the diameter size of the tube of the torus (float, default 0.5)
- _radialSegments: number
sets the number of sides on each tube segments (positive integer, default 32)
- _tubularSegments: number
sets the number of tubes to decompose the knot into (positive integer, default 32)
- _p: number
the number of windings on X axis (positive integers, default 2)
- _q: number
the number of windings on Y axis (positive integers, default 3)
Optional_scene: Scenedefines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Returns Mesh
a new Mesh
- _name: string
StaticCreate Tube
-
CreateTube(
_name: string,
_path: Vector3[],
_radius: number,
_tessellation: number,
_radiusFunction: (i: number, distance: number) => number,
_cap: number,
_scene: Scene,
_updatable?: boolean,
_sideOrientation?: number,
_instance?: Mesh,
): MeshCreates a tube mesh. The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.
Parameters
- _name: string
defines the name of the mesh to create
- _path: Vector3[]
is a required array of successive Vector3. It is the curve used as the axis of the tube
- _radius: number
sets the tube radius size
- _tessellation: number
is the number of sides on the tubular surface
- _radiusFunction: (i: number, distance: number) => number
is a custom function. If it is not null, it overrides the parameter
radius. This function is called on each point of the tube path and is passed the indexiof the i-th point and the distance of this point from the first point of the path - _cap: number
sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
- _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_instance: Meshis an instance of an existing Tube object to be updated with the passed
pathArrayparameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)
Returns Mesh
a new Mesh
- _name: string
StaticExtend To Goldberg
StaticExtrude Polygon
-
ExtrudePolygon(
_name: string,
_shape: Vector3[],
_depth: number,
_scene: Scene,
_holes?: Vector3[][],
_updatable?: boolean,
_sideOrientation?: number,
_earcutInjection?: any,
): MeshCreates an extruded polygon mesh, with depth in the Y direction..
Parameters
- _name: string
defines the name of the mesh to create
- _shape: Vector3[]
is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors
- _depth: number
defines the height of extrusion
- _scene: Scene
defines the hosting scene
Optional_holes: Vector3[][]is a required array of arrays of successive Vector3 used to defines holes in the polygon
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_earcutInjection: anycan be used to inject your own earcut reference
Returns Mesh
a new Mesh
- _name: string
StaticExtrude Shape
-
ExtrudeShape(
_name: string,
_shape: Vector3[],
_path: Vector3[],
_scale: number,
_rotation: number,
_cap: number,
_scene: Nullable<Scene>,
_updatable?: boolean,
_sideOrientation?: number,
_instance?: Mesh,
): MeshCreates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.
Parameters
- _name: string
defines the name of the mesh to create
- _shape: Vector3[]
is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis
- _path: Vector3[]
is a required array of successive Vector3. This is the axis curve the shape is extruded along
- _scale: number
is the value to scale the shape
- _rotation: number
is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve
- _cap: number
sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
- _scene: Nullable<Scene>
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_instance: Meshis an instance of an existing ExtrudedShape object to be updated with the passed
shape,path,scaleorrotationparameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)
Returns Mesh
a new Mesh
- _name: string
StaticExtrude Shape Custom
-
ExtrudeShapeCustom(
_name: string,
_shape: Vector3[],
_path: Vector3[],
_scaleFunction: Nullable<(i: number, distance: number) => number>,
_rotationFunction: Nullable<(i: number, distance: number) => number>,
_ribbonCloseArray: boolean,
_ribbonClosePath: boolean,
_cap: number,
_scene: Scene,
_updatable?: boolean,
_sideOrientation?: number,
_instance?: Mesh,
): MeshCreates an custom extruded shape mesh. The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.
Parameters
- _name: string
defines the name of the mesh to create
- _shape: Vector3[]
is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis
- _path: Vector3[]
is a required array of successive Vector3. This is the axis curve the shape is extruded along
- _scaleFunction: Nullable<(i: number, distance: number) => number>
is a custom Javascript function called on each path point
- _rotationFunction: Nullable<(i: number, distance: number) => number>
is a custom Javascript function called on each path point
- _ribbonCloseArray: boolean
forces the extrusion underlying ribbon to close all the paths in its
pathArray - _ribbonClosePath: boolean
forces the extrusion underlying ribbon to close its
pathArray - _cap: number
sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
- _scene: Scene
defines the hosting scene
Optional_updatable: booleandefines if the mesh must be flagged as updatable
Optional_sideOrientation: numberdefines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
Optional_instance: Meshis an instance of an existing ExtrudedShape object to be updated with the passed
shape,path,scaleorrotationparameters (https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape)
Returns Mesh
a new Mesh
- _name: string
StaticMerge Meshes
-
MergeMeshes(
meshes: Mesh[],
disposeSource?: boolean,
allow32BitsIndices?: boolean,
meshSubclass?: Mesh,
subdivideWithSubMeshes?: boolean,
multiMultiMaterials?: boolean,
): Nullable<Mesh>Merge the array of meshes into a single mesh for performance reasons.
Parameters
- meshes: Mesh[]
array of meshes with the vertices to merge. Entries cannot be empty meshes.
- disposeSource: boolean = true
when true (default), dispose of the vertices from the source meshes.
Optionalallow32BitsIndices: booleanwhen the sum of the vertices > 64k, this must be set to true.
OptionalmeshSubclass: Mesh(optional) can be set to a Mesh where the merged vertices will be inserted.
OptionalsubdivideWithSubMeshes: booleanwhen true (false default), subdivide mesh into subMeshes.
OptionalmultiMultiMaterials: booleanwhen true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.
Returns Nullable<Mesh>
a new mesh
- meshes: Mesh[]
StaticMerge Meshes Async
-
MergeMeshesAsync(
meshes: Mesh[],
disposeSource?: boolean,
allow32BitsIndices?: boolean,
meshSubclass?: Mesh,
subdivideWithSubMeshes?: boolean,
multiMultiMaterials?: boolean,
): Promise<any>Merge the array of meshes into a single mesh for performance reasons.
Parameters
- meshes: Mesh[]
array of meshes with the vertices to merge. Entries cannot be empty meshes.
- disposeSource: boolean = true
when true (default), dispose of the vertices from the source meshes.
Optionalallow32BitsIndices: booleanwhen the sum of the vertices > 64k, this must be set to true.
OptionalmeshSubclass: Mesh(optional) can be set to a Mesh where the merged vertices will be inserted.
OptionalsubdivideWithSubMeshes: booleanwhen true (false default), subdivide mesh into subMeshes.
OptionalmultiMultiMaterials: booleanwhen true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.
Returns Promise<any>
a new mesh
- meshes: Mesh[]
StaticMin Max
-
Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates
Parameters
- meshes: AbstractMesh[]
defines the list of meshes to scan
Returns { max: Vector3; min: Vector3 }
an object
{min:Vector3, max:Vector3} - meshes: AbstractMesh[]
StaticParse
-
Parses a serialized goldberg mesh
Parameters
- parsedMesh: any
the serialized mesh
- scene: Scene
the scene to create the goldberg mesh in
Returns GoldbergMesh
the created goldberg mesh
- parsedMesh: any
Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
See
https://en.wikipedia.org/wiki/Goldberg_polyhedron