import {element, type ElementAttributes} from '@lume/element' import {Element3D, type Element3DAttributes} from '../core/Element3D.js' import {autoDefineElements} from '../LumeConfig.js' import type {ElementWithBehaviors} from '../behaviors/ElementWithBehaviors.js' import type {GltfModelBehavior, GltfModelBehaviorAttributes} from '../behaviors/index.js' export type GltfModelAttributes = Element3DAttributes | GltfModelBehaviorAttributes /** * @element lume-gltf-model * @class GltfModel - * * Defines the `` element, short for ``, for loading 3D models in the glTF format (`.gltf` or * `.glb` files). * * See [`GltfModelBehavior`](../behaviors/mesh-behaviors/models/GltfModelBehavior) * for attributes/properties available on this element. * * HTML Example: * * ```html * * * * * ``` * * JavaScript Example: * * ```js * const scene = new Scene * scene.webgl = true * document.body.append(scene) * const model = new GltfModel * model.src = 'path/to/model.gltf' * model.on('MODEL_LOAD', () => console.log('loaded')) * scene.add(model) * ``` */ export @element('lume-gltf-model', autoDefineElements) class GltfModel extends Element3D { override initialBehaviors = {model: 'gltf'} } export interface GltfModel extends ElementWithBehaviors {} declare module 'solid-js' { namespace JSX { interface IntrinsicElements { 'lume-gltf-model': ElementAttributes } } } declare global { interface HTMLElementTagNameMap { 'lume-gltf-model': GltfModel } }