CLASSES
TagsA - Z

Geometry

Geometry

Description

class Geometry

The Geometry class

Constructor

new Geometry(id, scene, vertexData, updatable, mesh)

The Geometry constructor

Parameters

Name Type Description
id string Given this id to the new geometry object
scene Scene the platform
optional vertexData VertexData send all elements of vertices
optional updatable boolean @param updatable

Members

id : string

delayLoadState : number

delayLoadingFile : string

onGeometryUpdated : (geometry: Geometry, kind: string) => void

boundingBias : Vector2

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 The Bias Vector

extend : { minimum: Vector3, maximum: Vector3 }

doNotSerialize : boolean

Methods

getScene() → Scene

Get the scene

getEngine() → Engine

Get the engine

isReady() → boolean

True if is ready, false if is not

setAllVerticesData(vertexData, updatable) → void

Set all vertices data

Parameters

Name Type Description
vertexData VertexData send all elements of vertices
optional updatable boolean @param updatable

setVerticesData(kind, data, updatable, stride) → void

Set vertices data

Parameters

Name Type Description
kind string @param kind
data number[] @param data
optional updatable boolean @param updatable

setVerticesBuffer(buffer) → void

Parameters

Name Type Description
buffer VertexBuffer

updateVerticesDataDirectly(kind, data, offset) → void

Update vertices data directly

Parameters

Name Type Description
kind string @param kind
data Float32Array @param data
offset number

updateVerticesData(kind, data, updateExtends) → void

Update vertices data

Parameters

Name Type Description
kind string @param kind
data number[] @param data
optional updateExtends boolean @param updateExtends

getTotalVertices() → number

Get total vertices

getVerticesData(kind, copyWhenShared) → number[]

Get total vertices data

Parameters

Name Type Description
kind string @param kind
optional copyWhenShared boolean

getVertexBuffer(kind) → VertexBuffer

Get vertex buffer for this kind

Parameters

Name Type Description
kind string @param kind

getVertexBuffers() → { [key: string]: VertexBuffer }

Get vertex buffers, use all element of vertex buffer

isVerticesDataPresent(kind) → boolean

Return true if vertices data are present

Parameters

Name Type Description
kind string @param kind

getVerticesDataKinds() → string[]

Get the kinds of vertices data

setIndices(indices, totalVertices) → void

Set indices

Parameters

Name Type Description
indices number[] @param indices
optional totalVertices number

getTotalIndices() → number

Get all indices

getIndices(copyWhenShared) → number[]

Get the last indices

Parameters

Name Type Description
optional copyWhenShared boolean

getIndexBuffer() → WebGLBuffer

Get index buffer

releaseForMesh(mesh, shouldDispose) → void

Release for mesh

Parameters

Name Type Description
mesh Mesh the mesh
optional shouldDispose boolean true if mesh is dispose, false if is not.

applyToMesh(mesh) → void

Apply to a mesh

Parameters

Name Type Description
mesh Mesh the mesh

load(scene, onLoaded) → void

Load function

Parameters

Name Type Description
scene Scene the platform
optional onLoaded () => void @param onLoaded

toLeftHanded() → void

Invert the geometry to move from a right handed system to a left handed one.

isDisposed() → boolean

dispose() → void

Dispose this geometry object

copy(id) → Geometry

Copy function

Parameters

Name Type Description
id string Given this id to the new geometry object

serialize() → any

serializeVerticeData() → any

static ExtractFromMesh(mesh, id) → Geometry

Extract From Mesh

Parameters

Name Type Description
mesh Mesh the mesh
id string Given this id to the new geometry object

static RandomId() → string

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"

static ImportGeometry(parsedGeometry, mesh) → void

Parameters

Name Type Description
parsedGeometry any
mesh Mesh the mesh

static Parse(parsedVertexData, scene, rootUrl) → Geometry

Parameters

Name Type Description
parsedVertexData any
scene Scene the platform
rootUrl string