Class Geometry
Hierarchy
- Geometry
Implements
Index
Constructors
Properties
Accessors
Methods
- apply
To Mesh - clear
Cached Data - copy
- dispose
- get
Engine - get
Index Buffer - get
Indices - get
Scene - get
Total Indices - get
Total Vertices - get
Vertex Buffer - get
Vertex Buffers - get
Vertices Data - get
Vertices Data Kinds - is
Disposed - is
Ready - is
Vertex Buffer Updatable - is
Vertices Data Present - load
- release
For Mesh - remove
Vertices Data - serialize
- serialize
Vertice Data - set
All Vertices Data - set
Indices - set
Vertices Buffer - set
Vertices Data - to
Left Handed - update
Indices - update
Vertices Data - update
Vertices Data Directly - Create
Geometry For Mesh - Extract
From Mesh - Parse
- Random
Id
Constructors
constructor
Creates a new geometry
Parameters
id: string
defines the unique ID
Optional scene: Scene
defines the hosting scene
Optional vertexData: VertexData
defines the VertexData used to get geometry data
Optional updatable: boolean
defines if geometry must be updatable (false by default)
Optional mesh: Nullable<Mesh>
defines the mesh that will be associated with the geometry
Returns Geometry
Properties
delay Load StateSearch playground for delayLoadState
Gets the delay loading state of the geometry (none by default which means not delayed)
delay Loading FileSearch playground for delayLoadingFile
Gets the file containing the data to load when running in delay load state
idSearch playground for id
Gets or sets the ID of the geometry
on Geometry UpdatedSearch playground for onGeometryUpdated
Type declaration
Callback called when the geometry is updated
Parameters
geometry: Geometry
Optional kind: string
Returns void
unique IdSearch playground for uniqueId
Gets or sets the unique ID of the geometry
use Bounding Info From GeometrySearch playground for useBoundingInfoFromGeometry
If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)
Accessors
bounding Bias
Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
Returns Vector2
Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
Parameters
value: Vector2
Returns void
do Not Serialize
Gets a value indicating that the geometry should not be serialized
Returns boolean
extend
meshes
Get the list of meshes using this geometry
Returns Mesh[]
Methods
apply To MeshSearch playground for applyToMesh
Apply current geometry to a given mesh
Parameters
mesh: Mesh
defines the mesh to apply geometry to
Returns void
clear Cached DataSearch playground for clearCachedData
Release any memory retained by the cached data on the Geometry.
Call this function to reduce memory footprint of the mesh. Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)
Returns void
copySearch playground for copy
Clone the current geometry into a new geometry
Parameters
id: string
defines the unique ID of the new geometry
Returns Geometry
a new geometry object
disposeSearch playground for dispose
Free all associated resources
Returns void
get EngineSearch playground for getEngine
Gets the hosting engine
Returns Engine
the hosting Engine
get Index BufferSearch playground for getIndexBuffer
Gets the index buffer
Returns Nullable<DataBuffer>
the index buffer
get IndicesSearch playground for getIndices
Gets the index buffer array
Parameters
Optional copyWhenShared: boolean
defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
Optional forceCopy: boolean
defines a boolean indicating that the returned array must be cloned upon returning it
Returns Nullable<IndicesArray>
the index buffer array
get SceneSearch playground for getScene
Gets the hosting scene
Returns Scene
the hosting Scene
get Total IndicesSearch playground for getTotalIndices
Return the total number of indices
Returns number
the total number of indices
get Total VerticesSearch playground for getTotalVertices
Gets total number of vertices
Returns number
the total number of vertices
get Vertex BufferSearch playground for getVertexBuffer
Gets a specific vertex buffer
Parameters
kind: string
defines the data kind (Position, normal, etc...)
Returns Nullable<VertexBuffer>
a VertexBuffer
get Vertex BuffersSearch playground for getVertexBuffers
Returns all vertex buffers
Returns Nullable<{}>
an object holding all vertex buffers indexed by kind
get Vertices DataSearch playground for getVerticesData
Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.
Parameters
kind: string
defines the data kind (Position, normal, etc...)
Optional copyWhenShared: boolean
defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
Optional forceCopy: boolean
defines a boolean indicating that the returned array must be cloned upon returning it
Returns Nullable<FloatArray>
a float array containing vertex data
get Vertices Data KindsSearch playground for getVerticesDataKinds
Gets a list of all attached data kinds (Position, normal, etc...)
Returns string[]
a list of string containing all kinds
is DisposedSearch playground for isDisposed
Gets a value indicating if the geometry is disposed
Returns boolean
true if the geometry was disposed
is ReadySearch playground for isReady
Defines if the geometry is ready to use
Returns boolean
true if the geometry is ready to be used
is Vertex Buffer UpdatableSearch playground for isVertexBufferUpdatable
Returns a boolean defining if the vertex data for the requested
kind
is updatableParameters
kind: string
defines the data kind (Position, normal, etc...)
Returns boolean
true if the vertex buffer with the specified kind is updatable
is Vertices Data PresentSearch playground for isVerticesDataPresent
Gets a boolean indicating if specific vertex buffer is present
Parameters
kind: string
defines the data kind (Position, normal, etc...)
Returns boolean
true if data is present
loadSearch playground for load
Load the geometry if it was flagged as delay loaded
Parameters
scene: Scene
defines the hosting scene
Optional onLoaded: (() => void)
defines a callback called when the geometry is loaded
Returns void
Returns void
release For MeshSearch playground for releaseForMesh
Release the associated resources for a specific mesh
Parameters
mesh: Mesh
defines the source mesh
Optional shouldDispose: boolean
defines if the geometry must be disposed if there is no more mesh pointing to it
Returns void
remove Vertices DataSearch playground for removeVerticesData
Removes a specific vertex data
Parameters
kind: string
defines the data kind (Position, normal, etc...)
Returns void
serializeSearch playground for serialize
Serialize the current geometry info (and not the vertices data) into a JSON object
Returns any
a JSON representation of the current geometry data (without the vertices data)
serialize Vertice DataSearch playground for serializeVerticeData
Serialize all vertices data into a JSON object
Returns any
a JSON representation of the current geometry data
set All Vertices DataSearch playground for setAllVerticesData
Affects all geometry data in one call
Parameters
vertexData: VertexData
defines the geometry data
Optional updatable: boolean
defines if the geometry must be flagged as updatable (false as default)
Returns void
set IndicesSearch playground for setIndices
Creates a new index buffer
Parameters
indices: IndicesArray
defines the indices to store in the index buffer
Optional totalVertices: Nullable<number>
defines the total number of vertices (could be null)
Optional updatable: boolean
defines if the index buffer must be flagged as updatable (false by default)
Returns void
set Vertices BufferSearch playground for setVerticesBuffer
Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data
Parameters
buffer: VertexBuffer
defines the vertex buffer to use
Optional totalVertices: Nullable<number>
defines the total number of vertices for position kind (could be null)
Optional disposeExistingBuffer: boolean
disposes the existing buffer, if any (default: true)
Returns void
set Vertices DataSearch playground for setVerticesData
Set specific vertex data
Parameters
kind: string
defines the data kind (Position, normal, etc...)
data: FloatArray
defines the vertex data to use
Optional updatable: boolean
defines if the vertex must be flagged as updatable (false as default)
Optional stride: number
defines the stride to use (0 by default). This value is deduced from the kind value if not specified
Returns void
to Left HandedSearch playground for toLeftHanded
Invert the geometry to move from a right handed system to a left handed one.
Returns void
update IndicesSearch playground for updateIndices
Update index buffer
Parameters
indices: IndicesArray
defines the indices to store in the index buffer
Optional offset: number
defines the offset in the target buffer where to store the data
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 void
update Vertices DataSearch playground for updateVerticesData
Update a specific vertex buffer This function will create a new buffer if the current one is not updatable
Parameters
kind: string
defines the data kind (Position, normal, etc...)
data: FloatArray
defines the data to use
Optional updateExtends: boolean
defines if the geometry extends must be recomputed (false by default)
Returns void
update Vertices Data DirectlySearch playground for updateVerticesDataDirectly
Update a specific vertex buffer This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array It will do nothing if the buffer is not updatable
Parameters
kind: string
defines the data kind (Position, normal, etc...)
data: DataArray
defines the data to use
offset: number
defines the offset in the target buffer where to store the data
Optional useBytes: boolean
set to true if the offset is in bytes
Returns void
Static Create Geometry For MeshSearch playground for CreateGeometryForMesh
Static Extract From MeshSearch playground for ExtractFromMesh
Static ParseSearch playground for Parse
Static Random IdSearch playground for RandomId
You should now use Tools.RandomId(), this method is still here for legacy reasons. Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523 Be aware Math.random() could cause collisions, but: "All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide"
Returns string
a string containing a new GUID
Class used to store geometry data (vertex buffers + index buffer)