UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

31 lines (28 loc) 1.12 kB
import { Vec3 } from '../../core/math/vec3.js'; import { BoundingBox } from '../../core/shape/bounding-box.js'; import { GSplatOctree } from './gsplat-octree.js'; class GSplatOctreeResource { /** * Destroys the octree resource and cleans up all associated resources. */ destroy() { this.octree?.destroy(); this.octree = null; } /** * @param {string} assetFileUrl - The file URL of the container asset. * @param {object} data - Parsed JSON data. * @param {object} assetLoader - Asset loader instance (framework-level object). */ constructor(assetFileUrl, data, assetLoader){ /** @type {BoundingBox} */ this.aabb = new BoundingBox(); /** * Version counter for centers array changes. Always 0 for octree resources (static). * * @type {number} * @ignore */ this.centersVersion = 0; this.octree = new GSplatOctree(assetFileUrl, data); this.octree.assetLoader = assetLoader; this.aabb.setMinMax(new Vec3(data.tree.bound.min), new Vec3(data.tree.bound.max)); } } export { GSplatOctreeResource };