Class LinesMesh
Hierarchy
-
Mesh
- LinesMesh
Implements
Index
Constructors
Properties
- alpha
- color
- delay
Load State - delay
Loading File - edges
Share With Instances - ignore
Camera MaxZ - instanced
Buffers - instances
- intersection
Threshold - onLODLevel
Selection - override
Material Side Orientation - thin
Instance Count - thin
Instance Enable Picking - use
Vertex Alpha - use
Vertex Color - BACKSIDE
- BOTTOM
- CAP_
ALL - CAP_
END - CAP_
START - CENTER
- DEFAULTSIDE
- DOUBLESIDE
- FLIP_
N_ROTATE_ ROW - FLIP_
N_ROTATE_ TILE - FLIP_
ROW - FLIP_
TILE - FRONTSIDE
- LEFT
- NO_
CAP - NO_
FLIP - RIGHT
- ROTATE_
ROW - ROTATE_
TILE - TOP
Accessors
- are
Normals Frozen - clone
Mesh Map - compute
Bones Using Shaders - geometry
- has
Instances - hasLODLevels
- has
Thin Instances - is
Blocked - is
UnIndexed - manual
Update OfWorld Matrix Instanced Buffer - morph
Target Manager - on
After Render Observable - on
Before Bind Observable - on
Before Draw - on
Before Draw Observable - on
Before Render Observable - overriden
Instance Count - source
- world
Matrix Instanced Buffer
Methods
- addLODLevel
- apply
Displacement Map - apply
Displacement Map From Buffer - apply
Skeleton - bake
Current Transform Into Vertices - bake
Transform Into Vertices - clean
Matrix Weights - clone
- convert
ToFlat Shaded Mesh - convert
ToUn Indexed Mesh - create
Instance - dispose
- enable
Edges Rendering - flip
Faces - force
Shared Vertices - freeze
Normals - get
Animatables - get
Class Name - get
Emitted Particle Systems - get
Hierarchy Emitted Particle Systems - get
Indices - getLOD
- getLODLevel
AtDistance - getLODLevels
- get
Total Indices - get
Total Vertices - get
Vertex Buffer - get
Vertices Data - get
Vertices Data Kinds - increase
Vertices - instantiate
Hierarchy - is
InFrustum - is
Ready - is
Vertex Buffer Updatable - is
Vertices Data Present - make
Geometry Unique - mark
Vertices Data AsUpdatable - optimize
Indices - refresh
Bounding Info - register
After Render - register
Before Render - register
Instanced Buffer - removeLODLevel
- remove
Vertices Data - render
- serialize
- set
Indices - set
Material ByID - set
Normals ForCPUSkinning - set
Positions ForCPUSkinning - set
Vertices Buffer - set
Vertices Data - simplify
- subdivide
- synchronize
Instances - thin
Instance Add - thin
Instance Add Self - thin
Instance Buffer Updated - thin
Instance Get World Matrices - thin
Instance Partial Buffer Update - thin
Instance Refresh Bounding Info - thin
Instance Register Attribute - thin
Instance Set Attribute At - thin
Instance Set Buffer - thin
Instance Set Matrix At - to
Left Handed - to
String - unfreeze
Normals - unregister
After Render - unregister
Before Render - update
Indices - update
Mesh Positions - update
Vertices Data - validate
Skinning - Center
- Create
Box - Create
Capsule - Create
Cylinder - Create
Dashed Lines - Create
Decal - Create
Disc - Create
Ground - Create
Ground From Height Map - Create
Hemisphere - Create
Ico Sphere - Create
Lathe - Create
Lines - Create
Plane - Create
Polygon - Create
Polyhedron - Create
Ribbon - Create
Sphere - Create
Tiled Ground - Create
Torus - Create
Torus Knot - Create
Tube - Extrude
Polygon - Extrude
Shape - Extrude
Shape Custom - Merge
Meshes - Min
Max - Parse
Constructors
constructor
-
Creates a new LinesMesh
Parameters
-
name: string
defines the name
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional parent: Nullable<Node>
defines the parent mesh if any
-
Optional source: Nullable<LinesMesh>
defines the optional source LinesMesh used to clone data from
-
Optional doNotCloneChildren: boolean
When cloning, skip cloning child meshes of source, default False. When false, achieved by calling a clone(), also passing False. This will make creation of children, recursive.
-
Optional useVertexColor: boolean | undefined
defines if this LinesMesh supports vertex color
-
Optional useVertexAlpha: boolean | undefined
defines if this LinesMesh supports vertex alpha
Returns LinesMesh
-
Properties
alphaSearch playground for alpha
Alpha of the line (Default: 1)
colorSearch playground for color
Color of the line (Default: White)
delay Load StateSearch playground for delayLoadState
Gets the delay loading state of the mesh (when delay loading is turned on)
delay Loading FileSearch playground for delayLoadingFile
Gets the file containing delay loading data for this mesh
edges Share With InstancesSearch playground for edgesShareWithInstances
true to use the edge renderer for all instances of this mesh
ignore Camera MaxZSearch playground for ignoreCameraMaxZ
Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default) Note this will reduce performance when set to true.
instanced BuffersSearch playground for instancedBuffers
Object used to store instanced buffers defined by user
Type declaration
-
[key: string]: any
instancesSearch playground for 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.
intersection ThresholdSearch playground for intersectionThreshold
The intersection Threshold is the margin applied when intersection a segment of the LinesMesh with a Ray. This margin is expressed in world space coordinates, so its value may vary. Default value is 0.1
onLODLevel SelectionSearch playground for onLODLevelSelection
User defined function used to change how LOD level selection is done
override Material Side OrientationSearch playground for overrideMaterialSideOrientation
Use this property to change the original side orientation defined at construction time
thin Instance CountSearch playground for thinInstanceCount
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 PickingSearch playground for thinInstanceEnablePicking
Gets or sets a boolean defining if we want picking to pick thin instances as well
Optional Readonly use Vertex AlphaSearch playground for useVertexAlpha
If vertex alpha should be applied to the mesh
Optional Readonly use Vertex ColorSearch playground for useVertexColor
If vertex color should be applied to the mesh
Static Readonly BACKSIDESearch playground for BACKSIDE
Mesh side orientation : usually the internal or back surface
Static Readonly BOTTOMSearch playground for BOTTOM
Mesh tile positioning : part tiles on bottom
Static Readonly CAP_ ALLSearch playground for CAP_ALL
Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
Static Readonly CAP_ ENDSearch playground for CAP_END
Mesh cap setting : one cap at the end of the mesh
Static Readonly CAP_ STARTSearch playground for CAP_START
Mesh cap setting : one cap at the beginning of the mesh
Static Readonly CENTERSearch playground for CENTER
Mesh tile positioning : part tiles same on left/right or top/bottom
Static Readonly DEFAULTSIDESearch playground for DEFAULTSIDE
Mesh side orientation : by default, FRONTSIDE
Static Readonly DOUBLESIDESearch playground for DOUBLESIDE
Mesh side orientation : both internal and external or front and back surfaces
Static Readonly FLIP_ N_ROTATE_ ROWSearch playground for FLIP_N_ROTATE_ROW
Mesh pattern setting : rotate pattern and rotate
Static Readonly FLIP_ N_ROTATE_ TILESearch playground for FLIP_N_ROTATE_TILE
Mesh pattern setting : flip and rotate alternate tiles on each row or column
Static Readonly FLIP_ ROWSearch playground for FLIP_ROW
Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows
Static Readonly FLIP_ TILESearch playground for FLIP_TILE
Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column
Static Readonly FRONTSIDESearch playground for FRONTSIDE
Mesh side orientation : usually the external or front surface
Static Readonly LEFTSearch playground for LEFT
Mesh tile positioning : part tiles on left
Static Readonly NO_ CAPSearch playground for NO_CAP
Mesh cap setting : no cap
Static Readonly NO_ FLIPSearch playground for NO_FLIP
Mesh pattern setting : no flip or rotate
Static Readonly RIGHTSearch playground for RIGHT
Mesh tile positioning : part tiles on right
Static Readonly ROTATE_ ROWSearch playground for ROTATE_ROW
Mesh pattern setting : rotate (180degs) all tiles on alternate rows
Static Readonly ROTATE_ TILESearch playground for ROTATE_TILE
Mesh pattern setting : rotate (180degs) alternate tiles on each row or column
Static Readonly TOPSearch playground for TOP
Mesh tile positioning : part tiles on top
Accessors
are Normals Frozen
-
Gets a boolean indicating if the normals aren't to be recomputed on next mesh
positions
array update. This property is pertinent only for updatable parametric shapes.Returns boolean
clone Mesh Map
-
Gets the list of clones of this mesh The scene must have been constructed with useClonedMeshMap=true for this to work! Note that useClonedMeshMap=true is the default setting
Returns Nullable<{}>
compute Bones Using Shaders
-
Returns boolean
-
Parameters
-
value: boolean
Returns any
-
geometry
has Instances
-
Returns boolean
hasLODLevels
-
Gets a boolean indicating if this mesh has LOD
Returns boolean
has Thin Instances
-
Returns boolean
is Blocked
-
Returns boolean
is UnIndexed
-
Gets or sets a boolean indicating that this mesh does not use index buffer
Returns boolean
-
Gets or sets a boolean indicating that this mesh does not use index buffer
Parameters
-
value: boolean
Returns any
-
manual Update OfWorld Matrix Instanced Buffer
-
Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual
Returns boolean
-
Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual
Parameters
-
value: boolean
Returns any
-
morph Target Manager
-
Gets or sets the morph target manager
Returns Nullable<MorphTargetManager>
-
Gets or sets the morph target manager
Parameters
-
value: Nullable<MorphTargetManager>
Returns any
-
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
-
Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead
Parameters
-
callback: () => void
-
-
Returns void
-
-
Returns any
-
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>
overriden Instance Count
-
Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
Parameters
-
count: number
Returns any
-
source
world Matrix Instanced Buffer
-
Gets the array buffer used to store the instanced buffer used for instances' world matrices
Returns Float32Array
Methods
addLODLevelSearch playground for addLODLevel
apply Displacement MapSearch playground for applyDisplacementMap
-
Modifies 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.
-
Optional onSuccess: (mesh: Mesh) => void
is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
-
-
Parameters
-
mesh: Mesh
Returns void
-
-
-
-
Optional uvOffset: Vector2
is an optional vector2 used to offset UV.
-
Optional uvScale: Vector2
is an optional vector2 used to scale UV.
-
Optional forceUpdate: boolean
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.
-
apply Displacement Map From BufferSearch playground for applyDisplacementMapFromBuffer
-
Modifies 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
Uint8Array
buffer containing series ofUint8
lower 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.
-
Optional uvOffset: Vector2
is an optional vector2 used to offset UV.
-
Optional uvScale: Vector2
is an optional vector2 used to scale UV.
-
Optional forceUpdate: boolean
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.
-
apply SkeletonSearch playground for applySkeleton
bake Current Transform Into VerticesSearch playground for bakeCurrentTransformIntoVertices
-
Modifies 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
-
Optional bakeIndependenlyOfChildren: boolean
indicates whether to preserve all child nodes' World Matrix during baking
Returns Mesh
the current mesh
-
bake Transform Into VerticesSearch playground for bakeTransformIntoVertices
-
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: Matrix
defines the transform matrix to use
Returns Mesh
the current mesh
-
clean Matrix WeightsSearch playground for cleanMatrixWeights
-
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
cloneSearch playground for clone
convert ToFlat Shaded MeshSearch playground for convertToFlatShadedMesh
-
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 ToUn Indexed MeshSearch playground for convertToUnIndexedMesh
-
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
create InstanceSearch playground for createInstance
-
Creates a new InstancedLinesMesh object from the mesh model.
Parameters
-
name: string
defines the name of the new instance
Returns InstancedLinesMesh
a new InstancedLinesMesh
-
disposeSearch playground for dispose
-
Disposes of the line mesh
Parameters
-
Optional doNotRecurse: boolean
If children should be disposed
Returns void
-
enable Edges RenderingSearch playground for enableEdgesRendering
-
Enables the edge rendering mode on the mesh. This mode makes the mesh edges visible
Parameters
-
Optional epsilon: number
defines the maximal distance between two angles to detect a face
-
Optional checkVerticesInsteadOfIndices: boolean
indicates that we should check vertex list directly instead of faces
Returns AbstractMesh
the currentAbstractMesh
-
flip FacesSearch playground for flipFaces
-
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
-
Optional flipNormals: boolean
will also inverts the normals
Returns Mesh
current mesh
-
force Shared VerticesSearch playground for forceSharedVertices
-
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 NormalsSearch playground for freezeNormals
-
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
positions
array update.Returns Mesh
the current mesh
get AnimatablesSearch playground for getAnimatables
-
Returns as a new array populated with the mesh material and/or skeleton, if any.
Returns IAnimatable[]
an array of IAnimatable
get Class NameSearch playground for getClassName
-
Returns the string "LineMesh"
Returns string
get Emitted Particle SystemsSearch playground for getEmittedParticleSystems
-
Returns an array populated with IParticleSystem objects whose the mesh is the emitter
Returns IParticleSystem[]
an array of IParticleSystem
get Hierarchy Emitted Particle SystemsSearch playground for getHierarchyEmittedParticleSystems
-
Returns an array populated with IParticleSystem objects whose the mesh or its children are the emitter
Returns IParticleSystem[]
an array of IParticleSystem
get IndicesSearch playground for getIndices
-
Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
Parameters
-
Optional copyWhenShared: boolean
If 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.
-
Optional forceCopy: boolean
defines 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
-
getLODSearch playground for getLOD
-
Returns the registered LOD mesh distant from the parameter
camera
position if any, else returns the current mesh.Parameters
-
camera: Camera
defines the camera to use to compute distance
-
Optional boundingSphere: BoundingSphere
defines a custom bounding sphere to use instead of the one from this mesh
Returns Nullable<AbstractMesh>
This mesh (for chaining)
-
getLODLevel AtDistanceSearch playground for getLODLevelAtDistance
getLODLevelsSearch playground for getLODLevels
-
Gets the list of MeshLODLevel associated with the current mesh
Returns MeshLODLevel[]
an array of MeshLODLevel
get Total IndicesSearch playground for getTotalIndices
-
Returns a positive integer : the total number of indices in this mesh geometry.
Returns number
the numner of indices or zero if the mesh has no geometry.
get Total VerticesSearch playground for getTotalVertices
-
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 BufferSearch playground for getVertexBuffer
-
Returns the mesh VertexBuffer object from the requested
kind
Parameters
-
kind: string
defines which buffer to read from (positions, indices, normals, etc). Possible
kind
values :- 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
Returns Nullable<VertexBuffer>
a FloatArray or null if the mesh has no vertex buffer for this kind.
-
get Vertices DataSearch playground for getVerticesData
-
Returns the content of an associated vertex buffer
Parameters
-
kind: string
defines which buffer to read from (positions, indices, normals, etc). Possible
kind
values :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
-
Optional copyWhenShared: boolean
defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one
-
Optional forceCopy: boolean
defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is
Returns Nullable<FloatArray>
a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.
-
get Vertices Data KindsSearch playground for getVerticesDataKinds
-
Returns a string which contains the list of existing
kinds
of Vertex Data associated with this mesh.Returns string[]
an array of strings
increase VerticesSearch playground for increaseVertices
-
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
the number of new vertices to add to each edge of a facet, optional default 1
Returns void
-
instantiate HierarchySearch playground for instantiateHierarchy
-
Parameters
-
Optional newParent: Nullable<TransformNode>
-
Optional options: { doNotInstantiate: boolean }
-
do
Not Instantiate: boolean
-
-
Optional onNewNodeCreated: (source: TransformNode, clone: TransformNode) => void
-
-
Parameters
-
source: TransformNode
-
clone: TransformNode
Returns void
-
-
-
Returns Nullable<TransformNode>
-
is InFrustumSearch playground for isInFrustum
-
Returns
true
if the mesh is within the frustum defined by the passed array of planes. A mesh is in the frustum if its bounding box intersects the frustumParameters
-
frustumPlanes: Plane[]
defines the frustum to test
Returns boolean
true if the mesh is in the frustum planes
-
is ReadySearch playground for isReady
-
Returns boolean
is Vertex Buffer UpdatableSearch playground for isVertexBufferUpdatable
-
Returns a boolean defining if the vertex data for the requested
kind
is updatable.Parameters
-
kind: string
defines which buffer to check (positions, indices, normals, etc). Possible
kind
values :- 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 boolean
a boolean
-
is Vertices Data PresentSearch playground for isVerticesDataPresent
-
Tests if a specific vertex buffer is associated with this mesh
Parameters
-
kind: string
defines which buffer to check (positions, indices, normals, etc). Possible
kind
values :- 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
Returns boolean
a boolean
-
make Geometry UniqueSearch playground for makeGeometryUnique
-
Creates a un-shared specific occurence of the geometry for the mesh.
Returns Mesh
the current mesh
mark Vertices Data AsUpdatableSearch playground for markVerticesDataAsUpdatable
-
Flags an associated vertex buffer as updatable
Parameters
-
kind: string
defines which buffer to use (positions, indices, normals, etc). Possible
kind
values :- VertexBuffer.PositionKind
- VertexBuffer.UVKind
- VertexBuffer.UV2Kind
- VertexBuffer.UV3Kind
- VertexBuffer.UV4Kind
- VertexBuffer.UV5Kind
- VertexBuffer.UV6Kind
- VertexBuffer.ColorKind
- VertexBuffer.MatricesIndicesKind
- VertexBuffer.MatricesIndicesExtraKind
- VertexBuffer.MatricesWeightsKind
- VertexBuffer.MatricesWeightsExtraKind
-
Optional updatable: boolean
defines if the updated vertex buffer must be flagged as updatable
Returns void
-
optimize IndicesSearch playground for optimizeIndices
-
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
-
Optional successCallback: (mesh?: Mesh) => void
an optional success callback to be called after the optimization finished.
-
-
Parameters
-
Optional mesh: Mesh
Returns void
-
-
-
Returns Mesh
the current mesh
-
refresh Bounding InfoSearch playground for refreshBoundingInfo
-
This 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
-
Optional applySkeleton: boolean
defines whether to apply the skeleton before computing the bounding info
Returns Mesh
the current mesh
-
register After RenderSearch playground for registerAfterRender
-
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
-
-
Parameters
-
mesh: AbstractMesh
Returns void
-
-
-
Returns Mesh
the current mesh
-
register Before RenderSearch playground for registerBeforeRender
-
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
-
-
Parameters
-
mesh: AbstractMesh
Returns void
-
-
-
Returns Mesh
the current mesh
-
register Instanced BufferSearch playground for registerInstancedBuffer
-
Register a custom buffer that will be instanced
Parameters
-
kind: string
defines the buffer kind
-
stride: number
defines the stride in floats
Returns void
-
removeLODLevelSearch playground for removeLODLevel
remove Vertices DataSearch playground for removeVerticesData
-
Delete a vertex buffer associated with this mesh
Parameters
-
kind: string
defines which buffer to delete (positions, indices, normals, etc). Possible
kind
values :- 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
-
renderSearch playground for 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
-
Optional effectiveMeshReplacement: AbstractMesh
defines an optional mesh used to provide info for the rendering
Returns Mesh
the current mesh
-
serializeSearch playground for serialize
-
Serialize current mesh
Parameters
-
serializationObject: any
defines the object which will receive the serialization data
Returns void
-
set IndicesSearch playground for setIndices
-
Set the index buffer of this mesh
Parameters
-
indices: IndicesArray
defines the source data
-
Optional totalVertices: Nullable<number>
defines the total number of vertices referenced by this index data (can be null)
-
Optional updatable: boolean
defines if the updated index buffer must be flagged as updatable (default is false)
Returns AbstractMesh
the current mesh
-
set Material ByIDSearch playground for setMaterialByID
-
Sets the mesh material by the material or multiMaterial
id
propertyParameters
-
id: string
is a string identifying the material or the multiMaterial
Returns Mesh
the current mesh
-
set Normals ForCPUSkinningSearch playground for setNormalsForCPUSkinning
-
Prepare internal normal array for software CPU skinning
Returns Float32Array
original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
set Positions ForCPUSkinningSearch playground for setPositionsForCPUSkinning
-
Prepare internal position array for software CPU skinning
Returns Float32Array
original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh
set Vertices BufferSearch playground for setVerticesBuffer
-
Sets the mesh global Vertex Buffer
Parameters
-
buffer: VertexBuffer
defines the buffer to use
Returns Mesh
the current mesh
-
set Vertices DataSearch playground for setVerticesData
-
Copy a FloatArray into a specific associated vertex buffer
Parameters
-
kind: string
defines which buffer to write to (positions, indices, normals, etc). Possible
kind
values :- 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
-
Optional updatable: boolean
defines if the updated vertex buffer must be flagged as updatable
-
Optional stride: number
defines the data stride size (can be null)
Returns AbstractMesh
the current mesh
-
simplifySearch playground for simplify
-
Simplify the mesh according to the given array of settings. Function will return immediately and will simplify async
Parameters
-
settings: Array<ISimplificationSettings>
a collection of simplification settings
-
Optional parallelProcessing: boolean
should all levels calculate parallel or one after the other
-
Optional simplificationType: SimplificationType
the type of simplification to run
-
Optional successCallback: (mesh?: Mesh, submeshIndex?: number) => void
optional success callback to be called after the simplification finished processing all settings
-
-
Parameters
-
Optional mesh: Mesh
-
Optional submeshIndex: number
Returns void
-
-
-
Returns Mesh
the current mesh
-
subdivideSearch playground for subdivide
-
This function will subdivide the mesh into multiple submeshes
Parameters
-
count: number
defines the expected number of submeshes
Returns void
-
synchronize InstancesSearch playground for synchronizeInstances
-
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 AddSearch playground for thinInstanceAdd
-
Creates a new thin instance
Parameters
-
matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>
the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create
-
refresh: boolean
true 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
-
thin Instance Add SelfSearch playground for thinInstanceAddSelf
-
Adds the transformation (matrix) of the current mesh as a thin instance
Parameters
-
refresh: boolean
true 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 UpdatedSearch playground for thinInstanceBufferUpdated
-
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
-
thin Instance Get World MatricesSearch playground for thinInstanceGetWorldMatrices
-
Gets the list of world matrices
Returns Matrix[]
an array containing all the world matrices from the thin instances
thin Instance Partial Buffer UpdateSearch playground for thinInstancePartialBufferUpdate
-
Applies 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
-
data: Float32Array
the data to set in the GPU buffer
-
offset: number
the offset in the GPU buffer where to update the data
Returns void
-
thin Instance Refresh Bounding InfoSearch playground for thinInstanceRefreshBoundingInfo
-
Refreshes the bounding info, taking into account all the thin instances defined
Parameters
-
forceRefreshParentInfo: boolean
true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info
Returns void
-
thin Instance Register AttributeSearch playground for thinInstanceRegisterAttribute
-
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
-
thin Instance Set Attribute AtSearch playground for thinInstanceSetAttributeAt
-
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: Array<number>
value to set
-
refresh: boolean
true 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
-
thin Instance Set BufferSearch playground for thinInstanceSetBuffer
-
Sets 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>
buffer to set
-
stride: number
size in floats of each value of the buffer
-
staticBuffer: boolean
indicates that the buffer is static, so that you won't change it after it is set (better performances - false by default)
Returns void
-
thin Instance Set Matrix AtSearch playground for thinInstanceSetMatrixAt
-
Sets the matrix of a thin instance
Parameters
-
index: number
index of the thin instance
-
matrix: DeepImmutableObject<Matrix>
matrix to set
-
refresh: boolean
true 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
-
to Left HandedSearch playground for toLeftHanded
-
Invert the geometry to move from a right handed system to a left handed one.
Returns Mesh
the current mesh
to StringSearch playground for toString
-
Returns a description of this mesh
Parameters
-
Optional fullDetails: boolean
define if full details about this mesh must be used
Returns string
a descriptive string representing this mesh
-
unfreeze NormalsSearch playground for unfreezeNormals
-
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
unregister After RenderSearch playground for unregisterAfterRender
-
Disposes a previously registered javascript function called after the rendering.
Parameters
-
func: (mesh: AbstractMesh) => void
defines the function to remove
-
-
Parameters
-
mesh: AbstractMesh
Returns void
-
-
-
Returns Mesh
the current mesh
-
unregister Before RenderSearch playground for unregisterBeforeRender
-
Disposes a previously registered javascript function called before the rendering
Parameters
-
func: (mesh: AbstractMesh) => void
defines the function to remove
-
-
Parameters
-
mesh: AbstractMesh
Returns void
-
-
-
Returns Mesh
the current mesh
-
update IndicesSearch playground for updateIndices
-
Update the current index buffer
Parameters
-
indices: IndicesArray
defines the source data
-
Optional offset: number
defines the offset in the index buffer where to store the new data (can be null)
-
Optional gpuMemoryOnly: boolean
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
-
update Mesh PositionsSearch playground for updateMeshPositions
-
This method updates the vertex positions of an updatable mesh according to the
positionFunction
returned values.Parameters
-
positionFunction: (data: FloatArray) => void
is a simple JS function what is passed the mesh
positions
array. It doesn't need to return anything-
-
Parameters
-
data: FloatArray
Returns void
-
-
-
-
Optional computeNormals: boolean
is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update
Returns Mesh
the current mesh
-
update Vertices DataSearch playground for updateVerticesData
-
Update a specific associated vertex buffer
Parameters
-
kind: string
defines which buffer to write to (positions, indices, normals, etc). Possible
kind
values :- 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
-
Optional updateExtends: boolean
defines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind
-
Optional makeItUnique: boolean
defines 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
-
validate SkinningSearch playground for validateSkinning
-
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
-
report: string
-
skinned: boolean
-
valid: boolean
-
Static CenterSearch playground for Center
-
Returns the center of the
{min:
Vector3, max:
Vector3}
or the center of MinMax vector3 computed from a mesh arrayParameters
-
meshesOrMinMaxVector: { max: Vector3; min: Vector3 } | AbstractMesh[]
could be an array of meshes or a
{min:
Vector3, max:
Vector3}
object
Returns Vector3
a vector3
-
Static Create BoxSearch playground for CreateBox
-
Creates a box mesh. Please consider using the same method from the MeshBuilder class instead
Parameters
-
name: string
defines the name of the mesh to create
-
size: number
sets the size (float) of each box side (default 1)
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create CapsuleSearch playground for CreateCapsule
-
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
-
Static Create CylinderSearch playground for CreateCylinder
-
Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead
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: Scene
defines the hosting scene
-
Optional updatable: any
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create Dashed LinesSearch playground for CreateDashedLines
-
Creates a dashed line mesh. Please consider using the same method from the MeshBuilder class instead
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)
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional instance: LinesMesh
is an instance of an existing LineMesh object to be updated with the passed
points
parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)
Returns LinesMesh
a new Mesh
-
Static Create DecalSearch playground for CreateDecal
-
Creates a decal mesh. Please consider using the same method from the MeshBuilder class instead. 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
-
Static Create DiscSearch playground for CreateDisc
-
Creates a plane polygonal mesh. By default, this is a disc. Please consider using the same method from the MeshBuilder class instead
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
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create GroundSearch playground for CreateGround
-
Creates a ground mesh. Please consider using the same method from the MeshBuilder class instead
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: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
Returns Mesh
a new Mesh
-
Static Create Ground From Height MapSearch playground for CreateGroundFromHeightMap
-
Creates a ground mesh from a height map. Please consider using the same method from the MeshBuilder class instead
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: boolean
defines if the mesh must be flagged as updatable
-
Optional onReady: (mesh: GroundMesh) => void
is a callback function that will be called once the mesh is built (the height map download can last some time)
-
-
Parameters
-
mesh: GroundMesh
Returns void
-
-
-
-
Optional alphaFilter: number
will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
Returns GroundMesh
a new Mesh
-
Static Create HemisphereSearch playground for CreateHemisphere
-
Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead
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: Scene
defines the hosting scene
Returns Mesh
a new Mesh
-
Static Create Ico SphereSearch playground for CreateIcoSphere
-
Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided
- The parameter
radius
sets 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
,radiusY
andradiusZ
(all by default have the same value thanradius
) - The parameter
subdivisions
sets the number of subdivisions (postive 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
frontUVs
andbackUVs
(Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#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
-
Optional flat?: boolean
-
Optional radius?: number
-
Optional side
Orientation?: number -
Optional subdivisions?: number
-
Optional updatable?: boolean
-
-
scene: Scene
defines the hosting scene
Returns Mesh
a new Mesh
- The parameter
Static Create LatheSearch playground for CreateLathe
-
Creates lathe mesh. The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe. Please consider using the same method from the MeshBuilder class instead
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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create LinesSearch playground for CreateLines
-
Creates a line mesh. Please consider using the same method from the MeshBuilder class instead.
Parameters
-
name: string
defines the name of the mesh to create
-
points: Vector3[]
is an array successive Vector3
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional 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
points
parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).
Returns LinesMesh
a new Mesh
-
Static Create PlaneSearch playground for CreatePlane
-
Creates a plane mesh. Please consider using the same method from the MeshBuilder class instead
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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create PolygonSearch playground for CreatePolygon
-
Creates 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
shape
is 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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional earcutInjection: any
can be used to inject your own earcut reference
Returns Mesh
a new Mesh
-
Static Create PolyhedronSearch playground for CreatePolyhedron
-
Creates a polyhedron mesh. Please consider using the same method from the MeshBuilder class instead.
- The parameter
type
(positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded 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
size
on each dimension bu using the parameterssizeX
,sizeY
orsizeZ
(positive floats, default tosize
value) - 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
polyhedronObject
is 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
faceUV
orfaceColors
, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors - 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,faceColors
andfaceUV
are 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
frontUVs
andbackUVs
(Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#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
Static Create RibbonSearch playground for CreateRibbon
-
Creates a ribbon mesh. Please consider using the same method from the MeshBuilder class instead
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
pathArray
is containing a single path -
Optional scene: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional instance: Mesh
defines an instance of an existing Ribbon object to be updated with the passed
pathArray
parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)
Returns Mesh
a new Mesh
-
Static Create SphereSearch playground for CreateSphere
-
Creates a sphere mesh. Please consider using the same method from the MeshBuilder class instead
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: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create Tiled GroundSearch playground for CreateTiledGround
-
Creates a tiled ground mesh. Please consider using the same method from the MeshBuilder class instead
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}
).w
andh
are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile-
h: number
-
w: number
-
-
precision: { h: number; w: number }
is an object
{w: positive integer, h: positive integer}
(default{w: 2, h: 2}
).w
andh
are the numbers of subdivisions on the ground width and height of each tile-
h: number
-
w: number
-
-
scene: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
Returns Mesh
a new Mesh
-
Static Create TorusSearch playground for CreateTorus
-
Creates a torus mesh. Please consider using the same method from the MeshBuilder class instead
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 (postive integer, default 16)
-
Optional scene: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create Torus KnotSearch playground for CreateTorusKnot
-
Creates a torus knot mesh. Please consider using the same method from the MeshBuilder class instead
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: Scene
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
Returns Mesh
a new Mesh
-
Static Create TubeSearch playground for CreateTube
-
Creates a tube mesh. The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead
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 overwrittes the parameter
radius
. This function is called on each point of the tube path and is passed the indexi
of the i-th point and the distance of this point from the first point of the path-
-
Parameters
-
i: number
-
distance: number
Returns number
-
-
-
-
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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional instance: Mesh
is an instance of an existing Tube object to be updated with the passed
pathArray
parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)
Returns Mesh
a new Mesh
-
Static Extrude PolygonSearch playground for ExtrudePolygon
-
Creates an extruded polygon mesh, with depth in the Y direction. Please consider using the same method from the MeshBuilder class instead.
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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional earcutInjection: any
can be used to inject your own earcut reference
Returns Mesh
a new Mesh
-
Static Extrude ShapeSearch playground for ExtrudeShape
-
Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters. Please consider using the same method from the MeshBuilder class instead
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
-
Optional scene: Nullable<Scene>
defines the hosting scene
-
Optional updatable: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional instance: Mesh
is an instance of an existing ExtrudedShape object to be updated with the passed
shape
,path
,scale
orrotation
parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)
Returns Mesh
a new Mesh
-
Static Extrude Shape CustomSearch playground for ExtrudeShapeCustom
-
Creates 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. Please consider using the same method from the MeshBuilder class instead
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: Function
is a custom Javascript function called on each path point
-
rotationFunction: Function
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: boolean
defines if the mesh must be flagged as updatable
-
Optional sideOrientation: number
defines the mesh side orientation (https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation)
-
Optional instance: Mesh
is an instance of an existing ExtrudedShape object to be updated with the passed
shape
,path
,scale
orrotation
parameters (https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape)
Returns Mesh
a new Mesh
-
Static Merge MeshesSearch playground for MergeMeshes
-
Merge the array of meshes into a single mesh for performance reasons.
Parameters
-
meshes: Array<Mesh>
defines he vertices source. They should all be of the same material. Entries can empty
-
Optional disposeSource: boolean
when true (default), dispose of the vertices from the source meshes
-
Optional allow32BitsIndices: boolean
when the sum of the vertices > 64k, this must be set to true
-
Optional meshSubclass: Mesh
when set, vertices inserted into this Mesh. Meshes can then be merged into a Mesh sub-class.
-
Optional subdivideWithSubMeshes: boolean
when true (false default), subdivide mesh to his subMesh array with meshes source.
-
Optional multiMultiMaterials: boolean
when true (false default), subdivide mesh and accept multiple multi materials, ignores subdivideWithSubMeshes.
Returns Nullable<Mesh>
a new mesh
-
Static Min MaxSearch playground for MinMax
-
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}
-
Line mesh
https://doc.babylonjs.com/babylon101/parametric_shapes