Constructor
new GLTFModel(parts)
| Name | Type | Description |
|---|---|---|
parts | Array.<GLTFPart> | @param {Array |
- Source
Members
animations :Array.<GLTFAnimation>
- Array.<GLTFAnimation>
| Type | Description |
|---|---|
| Array.<GLTFAnimation> | The animations, play one through createObject's GLTFObject |
- Source
bounds :Object|undefined
- Object |
undefined
- Source
mesh
Properties| Type | Description |
|---|---|
| Mesh | Every part combined, each tinted with its material color; the texture is textureInfo, and blending and unlit stay with the parts, which createObject draws |
- Source
parts
Properties| Type | Description |
|---|---|
| Array.<GLTFPart> | One per primitive of every node that has a mesh |
- Source
textureInfo :TextureInfo|undefined
- TextureInfo |
undefined
| Type | Description |
|---|---|
| TextureInfo | | The texture to draw mesh with, when every part uses the same one |
- Source
Methods
center() → {GLTFModel}
Move every part so the center of the model's bounds is on the origin, like Mesh.center
- Source
- Type:
- GLTFModel
createObject(pos3Dopt) → {GLTFObject}
Make an object at a position with a child per part, so each keeps its own texture, color and blending, and the model's animations can play on it; the way to show a model with windows or other see through parts, which the combined mesh draws solid, or one that moves
| Name | Type | Attributes | Description |
|---|---|---|---|
pos3D | Vector3 | <optional> |
- Source
- The root, move and turn it and the parts follow
- Type:
- GLTFObject
dispose()
Free the GPU buffers of every part's mesh and of the combined mesh, and the textures, for a model that is done with, like a level's models when the next level loads
- Destroy the objects createObject made from it first; a mesh drawn again only uploads again, but a freed texture is gone
- Source
fit(sizeopt) → {GLTFModel}
Scale every part evenly so the model's largest extent is a size, like Mesh.fit, for models of unknown units
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
size | number | <optional> | 1 |
- Source
- Type:
- GLTFModel
getAnimation(animation) → {GLTFAnimation|undefined}
Find an animation by name or number
| Name | Type | Description |
|---|---|---|
animation | string | |
- Source
- Type:
- GLTFAnimation |
undefined
getBounds() → {Object}
The box around every part, measured once and again after transform, so change the model through that
- Source
- Type:
- Object
getPose(animation, time) → {Array.<Matrix4>}
How far each part has moved from its resting place at a time in an animation, one matrix per part
- createObject's GLTFObject calls this as it plays, a game only needs it to pose something by hand
| Name | Type | Description |
|---|---|---|
animation | GLTFAnimation | |
time | number | Seconds into it |
- Source
- Type:
- Array.<Matrix4>
transform(matrix) → {GLTFModel}
Move, turn or scale every part and the combined mesh together
| Name | Type | Description |
|---|---|---|
matrix | Matrix4 | | Transform, or just an offset to move by |
- Source
- Type:
- GLTFModel