UNPKG

lingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

49 lines 1.82 kB
import { applyMixins } from "@lincode/utils"; import { foundManagerDefaults, foundManagerSchema } from "../../interface/IFoundManager"; import VisibleMixin from "./mixins/VisibleMixin"; import SimpleObjectManager from "./SimpleObjectManager"; import TexturedStandardMixin from "./mixins/TexturedStandardMixin"; import { Cancellable } from "@lincode/promiselikes"; import { materialDefaultsMap } from "../../collections/materialDefaultsMap"; class FoundManager extends SimpleObjectManager { static componentName = "find"; static defaults = foundManagerDefaults; static schema = foundManagerSchema; _materialParams; _defaults; constructor(mesh, owner) { super(mesh); owner?.$appendNode(this); this.$ghost(false); this._name = mesh.name; if (!("material" in mesh)) return; this._defaults = materialDefaultsMap.get(mesh.material); if (!this._defaults) return; this._materialParams = Object.values(this._defaults); } retargeted; retargetAnimations() { if (this.retargeted) return; const states = this.parent.$animationStates; for (const animationManager of Object.values(states.managerRecord)) this.animations[animationManager.name] = this.watch(animationManager.retarget(this, states)); this.retargeted = true; } get animation() { return super.animation; } set animation(val) { this.retargetAnimations(); super.animation = val; } $addToRaycastSet(set) { set.add(this.object3d); return new Cancellable(() => set.delete(this.object3d)); } } applyMixins(FoundManager, [VisibleMixin, TexturedStandardMixin]); export default FoundManager; //# sourceMappingURL=FoundManager.js.map