GLTFLoader
This component asynchronously loads glTF file. Assets may be provided either in JSON (.gltf
) or binary (.glb
) format. External files store textures (.jpg
, .png
) and additional binary data (.bin
).
A glTF asset may deliver one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and/or cameras.
<GLTFLoader>
behaves as a <Group>
.
Example
template
<GLTFLoader
url="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF-Binary/Avocado.glb"
:position="[0, -3, 0]"
:scale="[100, 100, 100]"
/>
Props
Prop name | Description | Type | Default |
---|---|---|---|
castShadow | Whether the object gets rendered into shadow map. | boolean | false |
enableRaycasting | Component will emit mouse events when raycasting is enabled | boolean | false |
name | Name of the Group. | string | "" |
onClick | Callback to be fired when Group content clicked. | TSFunctionType | () => null |
onMouseMove | Callback to be fired when mouse-moving over Group content. | TSFunctionType | () => null |
onMouseEnter | Callback to be fired when Group content entered by mouse. | TSFunctionType | () => null |
onMouseLeave | Callback to be fired when Group content left by mouse. | TSFunctionType | () => null |
position | A Vector3Like representing the object's local position. | Vector3Like | [0, 0, 0] |
receiveShadow | Whether the material receives shadows. | boolean | false |
rotation | A Vector3Like representing local rotation (see Euler angles), in radians. | Vector3Like | [0, 0, 0] |
scale | A Vector3Like representing the object's local scale. | Vector3Like | [1, 1, 1] |
url | A string containing the path/URL of the .obj file. | string |
Events
Event name | Properties | Description |
---|---|---|
load | group Group - An instance of THREE.Group | Emitted when OBJ file is successfuly loaded, parsed and added to the scene. |
progress | Emmited on XHR progress | |
error | Emitted on XHR error or OBJ parsing error |
Slots
Name | Description | Bindings |
---|---|---|
default |
Expose
three
Exposes
THREE.Group
entity containing Mesh[] loaded by theGLTFLoader