Geometry

Geometry

Description

class Geometry

Constructor

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

Parameters

Name Type Description
id string
scene Scene
optional vertexData VertexData
optional updatable boolean

Members

id : string

delayLoadState : number

delayLoadingFile : Nullable<string>

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

Parameters

Name Type Description
geometry Geometry
optional kind string

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

static CreateGeometryForMesh(mesh) Geometry

Parameters

Name Type Description
mesh Mesh

getScene() Scene

getEngine() Engine

isReady() boolean

setAllVerticesData(vertexData, updatable) void

Parameters

Name Type Description
vertexData VertexData
optional updatable boolean

setVerticesData(kind, data, updatable, stride) void

Parameters

Name Type Description
kind string
data FloatArray
optional updatable boolean

removeVerticesData(kind) void

Parameters

Name Type Description
kind string

setVerticesBuffer(buffer) void

Parameters

Name Type Description
buffer VertexBuffer

updateVerticesDataDirectly(kind, data, offset) void

Parameters

Name Type Description
kind string
data Float32Array
offset number

updateVerticesData(kind, data, updateExtends) void

Parameters

Name Type Description
kind string
data FloatArray
optional updateExtends boolean

getTotalVertices() number

getVerticesData(kind, copyWhenShared, forceCopy) Nullable<FloatArray>

Parameters

Name Type Description
kind string
optional copyWhenShared boolean
optional forceCopy boolean

isVertexBufferUpdatable(kind) boolean

Returns a boolean defining if the vertex data for the requested kind is updatable.

Possible kind values :

Parameters

Name Type Description
kind string

getVertexBuffer(kind) Nullable<VertexBuffer>

Parameters

Name Type Description
kind string

getVertexBuffers() Nullable<{ [key: string]: VertexBuffer }>

isVerticesDataPresent(kind) boolean

Parameters

Name Type Description
kind string

getVerticesDataKinds() string[]

updateIndices(indices, offset) void

Parameters

Name Type Description
indices IndicesArray
optional offset number

setIndices(indices, totalVertices, updatable) void

Parameters

Name Type Description
indices IndicesArray
optional totalVertices Nullable<number>
optional updatable boolean

getTotalIndices() number

getIndices(copyWhenShared) Nullable<IndicesArray>

Parameters

Name Type Description
optional copyWhenShared boolean

getIndexBuffer() Nullable<WebGLBuffer>

releaseForMesh(mesh, shouldDispose) void

Parameters

Name Type Description
mesh Mesh
optional shouldDispose boolean

applyToMesh(mesh) void

Parameters

Name Type Description
mesh Mesh

load(scene, onLoaded) void

Parameters

Name Type Description
scene Scene
optional onLoaded

toLeftHanded() void

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

isDisposed() boolean

dispose() void

copy(id) Geometry

Parameters

Name Type Description
id string

serialize() any

serializeVerticeData() any

static ExtractFromMesh(mesh, id) Nullable<Geometry>

Parameters

Name Type Description
mesh Mesh
id string

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

static Parse(parsedVertexData, scene, rootUrl) Nullable<Geometry>

Parameters

Name Type Description
parsedVertexData any
scene Scene
rootUrl string