VertexData

Description

class VertexData

Members

positions : Nullable<FloatArray>

normals : Nullable<FloatArray>

tangents : Nullable<FloatArray>

uvs : Nullable<FloatArray>

uvs2 : Nullable<FloatArray>

uvs3 : Nullable<FloatArray>

uvs4 : Nullable<FloatArray>

uvs5 : Nullable<FloatArray>

uvs6 : Nullable<FloatArray>

colors : Nullable<FloatArray>

matricesIndices : Nullable<FloatArray>

matricesWeights : Nullable<FloatArray>

matricesIndicesExtra : Nullable<FloatArray>

matricesWeightsExtra : Nullable<FloatArray>

indices : Nullable<IndicesArray>

Methods

set(data, kind) void

Parameters

Name Type Description
data FloatArray
kind string

applyToMesh(mesh, updatable) VertexData

Associates the vertexData to the passed Mesh.

Sets it as updatable or not (default false).

Returns the VertexData.

Parameters

Name Type Description
mesh Mesh
optional updatable boolean

applyToGeometry(geometry, updatable) VertexData

Associates the vertexData to the passed Geometry.

Sets it as updatable or not (default false).

Returns the VertexData.

Parameters

Name Type Description
geometry Geometry
optional updatable boolean

updateMesh(mesh, updateExtends, makeItUnique) VertexData

Updates the associated mesh.

Returns the VertexData.

Parameters

Name Type Description
mesh Mesh
optional updateExtends boolean
optional makeItUnique boolean

updateGeometry(geometry, updateExtends, makeItUnique) VertexData

Updates the associated geometry.

Returns the VertexData.

Parameters

Name Type Description
geometry Geometry
optional updateExtends boolean
optional makeItUnique boolean

transform(matrix) VertexData

Transforms each position and each normal of the vertexData according to the passed Matrix.

Returns the VertexData.

Parameters

Name Type Description
matrix Matrix

merge(other, options) VertexData

Merges the passed VertexData into the current one.

Returns the modified VertexData.

Parameters

Name Type Description
other VertexData
optional options { tangentLength: number }

serialize() any

Serializes the VertexData.

Returns a serialized object.

static ExtractFromMesh(mesh, copyWhenShared, forceCopy) VertexData

Returns the object VertexData associated to the passed mesh.

Parameters

Name Type Description
mesh Mesh
optional copyWhenShared boolean
optional forceCopy boolean

static ExtractFromGeometry(geometry, copyWhenShared, forceCopy) VertexData

Returns the object VertexData associated to the passed geometry.

Parameters

Name Type Description
geometry Geometry
optional copyWhenShared boolean
optional forceCopy boolean

static CreateRibbon(options) VertexData

Creates the vertexData of the Ribbon.

Parameters

Name Type Description
options { pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4, invertUV: boolean, uvs: Vector2[], colors: Color4[] }

static CreateBox(options) VertexData

Creates the VertexData of the Box.

Parameters

Name Type Description
options { size: number, width: number, height: number, depth: number, faceUV: Vector4[], faceColors: Color4[], sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateSphere(options) VertexData

Creates the VertexData of the Sphere.

Parameters

Name Type Description
options { segments: number, diameter: number, diameterX: number, diameterY: number, diameterZ: number, arc: number, slice: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateCylinder(options) VertexData

Creates the VertexData of the Cylinder or Cone.

Parameters

Name Type Description
options { height: number, diameterTop: number, diameterBottom: number, diameter: number, tessellation: number, subdivisions: number, arc: number, faceColors: Color4[], faceUV: Vector4[], hasRings: boolean, enclose: boolean, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateTorus(options) VertexData

Creates the VertexData of the Torus.

Parameters

Name Type Description
options { diameter: number, thickness: number, tessellation: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateLineSystem(options) VertexData

Creates the VertexData of the LineSystem.

Parameters

Name Type Description
options { lines: Vector3[][], colors: Nullable<Color4[][]> }

static CreateDashedLines(options) VertexData

Create the VertexData of the DashedLines.

Parameters

Name Type Description
options { points: Vector3[], dashSize: number, gapSize: number, dashNb: number }

static CreateGround(options) VertexData

Creates the VertexData of the Ground.

Parameters

Name Type Description
options { width: number, height: number, subdivisions: number, subdivisionsX: number, subdivisionsY: number }

static CreateTiledGround(options) VertexData

Creates the VertexData of the TiledGround.

Parameters

Name Type Description
options { xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { w: number, h: number }, precision: { w: number, h: number } }

static CreateGroundFromHeightMap(options) VertexData

Creates the VertexData of the Ground designed from a heightmap.

Parameters

Name Type Description
options { width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, colorFilter: Color3, buffer: Uint8Array, bufferWidth: number, bufferHeight: number }

static CreatePlane(options) VertexData

Creates the VertexData of the Plane.

Parameters

Name Type Description
options { size: number, width: number, height: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateDisc(options) VertexData

Creates the VertexData of the Disc or regular Polygon.

Parameters

Name Type Description
options { radius: number, tessellation: number, arc: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreatePolygon(polygon, sideOrientation, fUV, fColors, frontUVs, backUVs) VertexData

Re-creates the VertexData of the Polygon for sideOrientation.

Parameters

Name Type Description
polygon Mesh
sideOrientation number
optional fUV Vector4[]
optional fColors Color4[]
optional frontUVs Vector4

static CreateIcoSphere(options) VertexData

Creates the VertexData of the IcoSphere.

Parameters

Name Type Description
options { radius: number, radiusX: number, radiusY: number, radiusZ: number, flat: boolean, subdivisions: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreatePolyhedron(options) VertexData

Creates the VertexData of the Polyhedron.

Parameters

Name Type Description
options { type: number, size: number, sizeX: number, sizeY: number, sizeZ: number, custom: any, faceUV: Vector4[], faceColors: Color4[], flat: boolean, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static CreateTorusKnot(options) VertexData

Creates the VertexData of the Torus Knot.

Parameters

Name Type Description
options { radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation: number, frontUVs: Vector4, backUVs: Vector4 }

static ComputeNormals(positions, indices, normals, options) void

options (optional) :

facetPositions : optional array of facet positions (vector3)

facetNormals : optional array of facet normals (vector3)

facetPartitioning : optional partitioning array. facetPositions is required for facetPartitioning computation

subDiv : optional partitioning data about subdivsions on each axis (int), required for facetPartitioning computation

ratio : optional partitioning ratio / bounding box, required for facetPartitioning computation

bbSize : optional bounding box size data, required for facetPartitioning computation

bInfo : optional bounding info, required for facetPartitioning computation

useRightHandedSystem: optional boolean to for right handed system computation

depthSort : optional boolean to enable the facet depth sort computation

distanceTo : optional Vector3 to compute the facet depth from this location

depthSortedFacets : optional array of depthSortedFacets to store the facet distances from the reference location

Parameters

Name Type Description
positions any
indices any
normals any

static ImportVertexData(parsedVertexData, geometry) void

Creates a new VertexData from the imported parameters.

Parameters

Name Type Description
parsedVertexData any
geometry Geometry