UNPKG

@pmndrs/xr

Version:
15 lines (14 loc) 475 B
import { Mesh } from 'three'; import { updateXRMeshGeometry } from '../mesh.js'; export class XRMeshModel extends Mesh { constructor(mesh) { super(updateXRMeshGeometry(mesh, undefined)); this.onBeforeRender = () => { const newGeometry = updateXRMeshGeometry(mesh, this.geometry); if (newGeometry != this.geometry) { this.geometry.dispose(); } this.geometry = newGeometry; }; } }