Skip to main content

Model

class Model

Data class for loaded 3d model

constructor

new Model()

Create new Model instance

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
{src: string, scenes: THREE.Object3D[], center?: typeof AUTO | Array<number | string>, parser?: GLTFParser | null, animations?: THREE.AnimationClip[], annotations?: Annotation[], variants?: Array<{name: string}>, fixSkinnedBbox?: boolean, castShadow?: boolean, receiveShadow?: boolean}

Properties

src

readonly

Source URL of this model

Type: string

scene

readonly

Scene of the model, see THREE.Group

animations

readonly

THREE.AnimationClips inside model

annotations

readonly

Annotations included inside the model

meshes

readonly

THREE.Meshes inside model if there's any.

bbox

readonly

Get a copy of model's current bounding box

Type: THREE#Box3

See:

center

readonly

Center of the model

Type: THREE#Vector3

See:

castShadow

Whether the model's meshes gets rendered into shadow map

Type: boolean

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
valboolean
model.castShadow = true;

receiveShadow

Whether the model's mesh materials receive shadows

Type: boolean

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
valboolean
model.receiveShadow = true;

Methods

reduceVertices

Executes a user-supplied "reducer" callback function on each vertex of the model, in order, passing in the return value from the calculation on the preceding element.

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
callbackfn(previousVal: T, currentVal: THREE.Vector3) => T
initialValT

_getAllMeshes

Get all THREE.Meshes inside model if there's any.

Returns: THREE.Mesh[]

  • Meshes found at model's scene