@combos-fun/plugin-renderer-3d 0.1.2 → 0.1.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -733,7 +733,7 @@ var Renderer3DSystem = Renderer3DSystem$1;
733
733
  /** Auto-generated by scripts/build-package.mjs — do not edit. */
734
734
  Object.assign(Renderer3DSystem, {
735
735
  packageName: "@combos-fun/plugin-renderer-3d",
736
- packageVersion: "0.1.2",
736
+ packageVersion: "0.1.4-beta.0",
737
737
  });
738
738
 
739
739
  class Renderer3D extends engine.System {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d.cjs.js","sources":["../lib/tagObject3D.ts","../lib/hierarchy.ts","../lib/pose.ts","../lib/ThreeContext.ts","../lib/Renderer3DManager.ts","../lib/Transform3D.ts","../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer3D.ts","../lib/Transform3DSystem.ts","../lib/Render3D.ts","../lib/Render3DSystem.ts","../lib/Camera3D.ts","../lib/Camera3DSystem.ts","../lib/Light3D.ts","../lib/Light3DSystem.ts","../lib/namedResource.ts"],"sourcesContent":["import type { Object3D } from 'three';\n\nexport const COMBOS_GAME_OBJECT_ID = 'combosGameObjectId';\nexport const COMBOS_TRANSFORM3D = 'combosTransform3D';\n\nexport function isTransform3DRoot(object: Object3D | null | undefined): boolean {\n return !!object?.userData?.[COMBOS_TRANSFORM3D];\n}\n\n/** Stamp a Three.js object (and its children) so Event3D raycasts can resolve the GameObject. */\nexport function tagObject3D(object: Object3D, gameObjectId: number): void {\n object.traverse((child) => {\n child.userData[COMBOS_GAME_OBJECT_ID] = gameObjectId;\n });\n}\n\nexport function gameObjectIdFromObject3D(object: Object3D | null | undefined): number | undefined {\n let current = object;\n while (current) {\n const id = current.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof id === 'number') {\n return id;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/** Resolve a raycast hit to a GameObject id. */\nexport function gameObjectIdFromIntersection(intersection: {\n object?: Object3D;\n} | null | undefined): number | undefined {\n return gameObjectIdFromObject3D(intersection?.object);\n}\n","import type { GameObject } from '@combos-fun/engine';\n\n/** True when this GameObject is a scene root (no 3D parent). */\nexport function is3DSceneParent(gameObject: GameObject | undefined | null): boolean {\n if (!gameObject) return true;\n const parent = gameObject.parent;\n return !parent || parent === gameObject.scene;\n}\n\nexport function has3DChildGameObjects(gameObject: GameObject | undefined | null): boolean {\n return (gameObject?.children?.length ?? 0) > 0;\n}\n","export interface PoseLike {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport function readPose(pose: PoseLike) {\n return {\n positionX: pose.positionX ?? 0,\n positionY: pose.positionY ?? 0,\n positionZ: pose.positionZ ?? 0,\n rotationX: pose.rotationX ?? 0,\n rotationY: pose.rotationY ?? 0,\n rotationZ: pose.rotationZ ?? 0,\n scaleX: pose.scaleX ?? 1,\n scaleY: pose.scaleY ?? 1,\n scaleZ: pose.scaleZ ?? 1,\n };\n}\n\nexport function poseKeyOf(pose: PoseLike): string {\n const r = readPose(pose);\n return [\n r.positionX, r.positionY, r.positionZ,\n r.rotationX, r.rotationY, r.rotationZ,\n r.scaleX, r.scaleY, r.scaleZ,\n ].join(',');\n}\n\nexport function copyPose(from: PoseLike, to: PoseLike) {\n const r = readPose(from);\n to.positionX = r.positionX;\n to.positionY = r.positionY;\n to.positionZ = r.positionZ;\n to.rotationX = r.rotationX;\n to.rotationY = r.rotationY;\n to.rotationZ = r.rotationZ;\n to.scaleX = r.scaleX;\n to.scaleY = r.scaleY;\n to.scaleZ = r.scaleZ;\n}\n\nexport function isIdentityPose(pose: PoseLike): boolean {\n const r = readPose(pose);\n return r.positionX === 0 && r.positionY === 0 && r.positionZ === 0\n && r.rotationX === 0 && r.rotationY === 0 && r.rotationZ === 0\n && r.scaleX === 1 && r.scaleY === 1 && r.scaleZ === 1;\n}\n\nexport function seedTransform3D(visual: PoseLike, transform: PoseLike) {\n if (isIdentityPose(transform) && !isIdentityPose(visual)) {\n copyPose(visual, transform);\n }\n}\n\n/**\n * Keep a visual component's pose fields and a sibling Transform3D in sync.\n * Returns true when the visual Object3D should still apply pose itself\n * (no Transform3D root yet).\n */\nexport class VisualPoseBridge {\n lastVisual = '';\n lastRoot = '';\n\n sync(visual: PoseLike, root?: PoseLike | null): boolean {\n if (!root) return true;\n if (this.lastVisual === '' && this.lastRoot === '') {\n seedTransform3D(visual, root);\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n const visualKey = poseKeyOf(visual);\n const rootKey = poseKeyOf(root);\n if (visualKey !== this.lastVisual && rootKey === this.lastRoot) {\n copyPose(visual, root);\n }\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n}\n","import {\n Scene,\n PerspectiveCamera,\n WebGLRenderer,\n Clock,\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n Fog,\n AnimationMixer,\n AnimationClip,\n Mesh,\n Material,\n Group,\n Euler,\n Vector3,\n ACESFilmicToneMapping,\n LinearToneMapping,\n ReinhardToneMapping,\n CineonToneMapping,\n NoToneMapping,\n PCFSoftShadowMap,\n} from 'three';\nimport type { Light, Object3D, ToneMapping } from 'three';\nimport type { GameObject } from '@combos-fun/engine';\nimport { tagObject3D, COMBOS_GAME_OBJECT_ID, COMBOS_TRANSFORM3D, isTransform3DRoot } from './tagObject3D';\nimport { is3DSceneParent } from './hierarchy';\nimport type { PoseLike } from './pose';\nimport { readPose } from './pose';\n\nexport type ToneMappingKind = 'none' | 'aces' | 'linear' | 'reinhard' | 'cineon';\n\nexport interface FogParams {\n color?: number;\n near?: number;\n far?: number;\n}\n\nexport interface HemisphereLightParams {\n skyColor?: number;\n groundColor?: number;\n intensity?: number;\n}\n\nexport interface ThreeContextParams {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width: number;\n height: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n fog?: boolean | FogParams;\n hemisphereLight?: boolean | HemisphereLightParams;\n shadows?: boolean;\n toneMapping?: ToneMappingKind;\n toneMappingExposure?: number;\n ambientIntensity?: number;\n directionalIntensity?: number;\n}\n\nexport interface Transform3DLike extends PoseLike {\n worldPositionX?: number;\n worldPositionY?: number;\n worldPositionZ?: number;\n worldRotationX?: number;\n worldRotationY?: number;\n worldRotationZ?: number;\n}\n\nconst TONE_MAPPING: Record<ToneMappingKind, ToneMapping> = {\n none: NoToneMapping,\n aces: ACESFilmicToneMapping,\n linear: LinearToneMapping,\n reinhard: ReinhardToneMapping,\n cineon: CineonToneMapping,\n};\n\nconst _world = new Vector3();\nconst _euler = new Euler();\n\nexport default class ThreeContext {\n scene: Scene;\n camera: PerspectiveCamera;\n fallbackCamera: PerspectiveCamera;\n renderer: WebGLRenderer;\n clock: Clock;\n mixers: Map<number, AnimationMixer> = new Map();\n models: Map<number, Group> = new Map();\n /** Root Object3D for each GameObject that has a 3D node. */\n nodes: Map<number, Object3D> = new Map();\n shadows: boolean;\n defaultLights: Object3D[] = [];\n\n constructor(params: ThreeContextParams) {\n const {\n canvas,\n container,\n width,\n height,\n antialias = true,\n backgroundColor = 0x000000,\n backgroundAlpha = 1,\n } = params;\n\n this.scene = new Scene();\n this.shadows = !!params.shadows;\n\n this.camera = new PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 5;\n this.fallbackCamera = this.camera;\n\n const rendererOpts: any = { antialias };\n if (canvas) {\n rendererOpts.canvas = canvas;\n }\n if (backgroundAlpha < 1) {\n rendererOpts.alpha = true;\n }\n\n this.renderer = new WebGLRenderer(rendererOpts);\n this.renderer.setSize(width, height);\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setClearColor(backgroundColor, backgroundAlpha);\n this.renderer.toneMapping = TONE_MAPPING[params.toneMapping ?? 'aces'] ?? ACESFilmicToneMapping;\n this.renderer.toneMappingExposure = params.toneMappingExposure ?? 1;\n if (this.shadows) {\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = PCFSoftShadowMap;\n }\n\n if (!canvas && container) {\n container.appendChild(this.renderer.domElement);\n }\n\n const ambientLight = new AmbientLight(0xffffff, params.ambientIntensity ?? 0.6);\n this.scene.add(ambientLight);\n this.defaultLights.push(ambientLight);\n\n const directionalLight = new DirectionalLight(0xffffff, params.directionalIntensity ?? 0.8);\n directionalLight.position.set(5, 10, 7.5);\n if (this.shadows) {\n directionalLight.castShadow = true;\n directionalLight.shadow.mapSize.set(1024, 1024);\n }\n this.scene.add(directionalLight);\n this.defaultLights.push(directionalLight);\n\n if (params.hemisphereLight !== false) {\n const hemi = typeof params.hemisphereLight === 'object' ? params.hemisphereLight : {};\n const hemisphereLight = new HemisphereLight(\n hemi.skyColor ?? 0xffffff,\n hemi.groundColor ?? 0x444444,\n hemi.intensity ?? 0.35,\n );\n this.scene.add(hemisphereLight);\n this.defaultLights.push(hemisphereLight);\n }\n\n if (params.fog) {\n const fog = typeof params.fog === 'object' ? params.fog : {};\n this.scene.fog = new Fog(fog.color ?? backgroundColor, fog.near ?? 8, fog.far ?? 40);\n }\n\n this.clock = new Clock();\n }\n\n update() {\n const delta = this.clock.getDelta();\n for (const mixer of this.mixers.values()) {\n mixer.update(delta);\n }\n this.renderer.render(this.scene, this.camera);\n }\n\n hasTransform3DRoot(id: number): boolean {\n return isTransform3DRoot(this.nodes.get(id));\n }\n\n applyModelShadows(object: Object3D) {\n if (!this.shadows) return;\n object.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.isMesh) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n });\n }\n\n attachParsedModel(\n id: number,\n model: Group,\n animations?: AnimationClip[],\n gameObject?: GameObject,\n ): Group {\n tagObject3D(model, id);\n this.applyModelShadows(model);\n this.models.set(id, model);\n this.attachVisual(id, model, gameObject);\n\n if (animations && animations.length > 0) {\n const mixer = new AnimationMixer(model);\n this.mixers.set(id, mixer);\n model.userData.animations = animations;\n }\n\n return model;\n }\n\n object3DFor(id: number): Object3D | undefined {\n return this.nodes.get(id);\n }\n\n /** Place a GameObject's root Object3D under the nearest ancestor visual (or the scene). */\n attachObject3D(id: number, object: Object3D, gameObject?: GameObject): void {\n const prev = this.nodes.get(id);\n if (prev && prev !== object) {\n this.rehomeRegisteredChildren(prev);\n prev.parent?.remove(prev);\n }\n this.nodes.set(id, object);\n const parentNode = this.findParentNode(gameObject);\n if (object.parent !== parentNode) {\n parentNode.add(object);\n }\n if (gameObject) {\n this.adoptChildGameObjects(gameObject, object);\n }\n }\n\n /**\n * Attach a visual / camera / light under the Transform3D root when one exists.\n * Otherwise the object itself becomes the GameObject root (legacy path).\n */\n attachVisual(id: number, object: Object3D, gameObject?: GameObject): void {\n tagObject3D(object, id);\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n if (object.parent !== root) {\n root.add(object);\n }\n return;\n }\n this.attachObject3D(id, object, gameObject);\n }\n\n detachVisual(id: number, object: Object3D): Object3D | undefined {\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n object.parent?.remove(object);\n return object;\n }\n if (root === object) {\n return this.detachObject3D(id);\n }\n object.parent?.remove(object);\n return object;\n }\n\n /** Remove a registered node without disposing it; child GameObject nodes stay in the scene. */\n detachObject3D(id: number): Object3D | undefined {\n const object = this.nodes.get(id);\n if (!object) return undefined;\n this.rehomeRegisteredChildren(object);\n object.parent?.remove(object);\n this.nodes.delete(id);\n return object;\n }\n\n reparentGameObject(gameObject: GameObject): void {\n const object = this.nodes.get(gameObject.id);\n if (!object) return;\n const parentNode = this.findParentNode(gameObject);\n if (object.parent === parentNode) return;\n parentNode.add(object);\n }\n\n findParentNode(gameObject?: GameObject): Object3D {\n if (!gameObject || is3DSceneParent(gameObject)) {\n return this.scene;\n }\n let current = gameObject.parent;\n while (current && current !== gameObject.scene) {\n const node = this.nodes.get(current.id);\n if (node) return node;\n current = current.parent;\n }\n return this.scene;\n }\n\n adoptChildGameObjects(gameObject: GameObject, object: Object3D): void {\n const children = gameObject.children;\n if (!children) return;\n for (const childGo of children) {\n if (!childGo) continue;\n const childNode = this.nodes.get(childGo.id);\n if (childNode && childNode.parent !== object) {\n object.add(childNode);\n }\n }\n }\n\n ensureTransformRoot(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const existing = this.nodes.get(gameObject.id);\n if (isTransform3DRoot(existing)) {\n this.applyTransformPose(existing, transform);\n return existing;\n }\n\n const group = new Group();\n group.name = gameObject.name;\n group.userData[COMBOS_TRANSFORM3D] = true;\n tagObject3D(group, gameObject.id);\n\n if (existing && existing !== group) {\n if (isIdentityPoseObject(transform)) {\n transform.positionX = existing.position.x;\n transform.positionY = existing.position.y;\n transform.positionZ = existing.position.z;\n transform.rotationX = existing.rotation.x;\n transform.rotationY = existing.rotation.y;\n transform.rotationZ = existing.rotation.z;\n transform.scaleX = existing.scale.x;\n transform.scaleY = existing.scale.y;\n transform.scaleZ = existing.scale.z;\n }\n const parent = existing.parent || this.scene;\n parent.add(group);\n group.add(existing);\n existing.position.set(0, 0, 0);\n existing.rotation.set(0, 0, 0);\n existing.scale.set(1, 1, 1);\n this.nodes.set(gameObject.id, group);\n this.adoptChildGameObjects(gameObject, group);\n } else {\n this.attachObject3D(gameObject.id, group, gameObject);\n }\n\n this.applyTransformPose(group, transform);\n return group;\n }\n\n applyTransform3D(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const root = this.ensureTransformRoot(gameObject, transform);\n this.applyTransformPose(root, transform);\n root.updateWorldMatrix(true, false);\n root.getWorldPosition(_world);\n transform.worldPositionX = _world.x;\n transform.worldPositionY = _world.y;\n transform.worldPositionZ = _world.z;\n _euler.setFromRotationMatrix(root.matrixWorld);\n transform.worldRotationX = _euler.x;\n transform.worldRotationY = _euler.y;\n transform.worldRotationZ = _euler.z;\n return root;\n }\n\n private applyTransformPose(root: Object3D, transform: Transform3DLike) {\n const pose = readPose(transform);\n root.position.set(pose.positionX, pose.positionY, pose.positionZ);\n root.rotation.set(pose.rotationX, pose.rotationY, pose.rotationZ);\n root.scale.set(pose.scaleX, pose.scaleY, pose.scaleZ);\n }\n\n removeDefaultLights() {\n if (!this.defaultLights.length) return;\n for (const light of this.defaultLights) {\n light.parent?.remove(light);\n (light as Light).dispose?.();\n }\n this.defaultLights = [];\n }\n\n setActiveCamera(camera: PerspectiveCamera) {\n const prev = this.camera;\n this.camera = camera;\n if (prev) {\n camera.aspect = prev.aspect;\n }\n camera.updateProjectionMatrix();\n }\n\n restoreFallbackCamera() {\n if (this.camera !== this.fallbackCamera) {\n this.setActiveCamera(this.fallbackCamera);\n }\n }\n\n private rehomeRegisteredChildren(object: Object3D): void {\n for (const child of [...object.children]) {\n const childId = child.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof childId === 'number' && this.nodes.get(childId) === child) {\n this.scene.add(child);\n }\n }\n }\n\n playAnimation(id: number, animationIndex: number, speed: number) {\n const mixer = this.mixers.get(id);\n const model = this.models.get(id);\n if (!mixer || !model) return;\n\n mixer.stopAllAction();\n const animations = model.userData.animations as AnimationClip[];\n if (animations && animations[animationIndex]) {\n const action = mixer.clipAction(animations[animationIndex]);\n action.timeScale = speed;\n action.play();\n }\n }\n\n stopAnimation(id: number) {\n const mixer = this.mixers.get(id);\n if (mixer) mixer.stopAllAction();\n }\n\n removeModel(id: number) {\n const model = this.models.get(id);\n if (model) {\n this.detachVisual(id, model);\n model.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.geometry) {\n mesh.geometry.dispose();\n }\n if (mesh.material) {\n const materials = Array.isArray(mesh.material)\n ? mesh.material as Material[]\n : [mesh.material as Material];\n materials.forEach(m => m.dispose());\n }\n });\n this.models.delete(id);\n }\n const mixer = this.mixers.get(id);\n if (mixer) {\n mixer.stopAllAction();\n this.mixers.delete(id);\n }\n }\n\n resize(width: number, height: number) {\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n if (this.fallbackCamera !== this.camera) {\n this.fallbackCamera.aspect = width / height;\n this.fallbackCamera.updateProjectionMatrix();\n }\n this.renderer.setSize(width, height);\n }\n\n destroy() {\n for (const id of this.models.keys()) {\n this.removeModel(id);\n }\n this.removeDefaultLights();\n this.renderer.dispose();\n this.renderer.domElement.remove();\n this.nodes.clear();\n this.scene = null;\n this.camera = null;\n this.fallbackCamera = null;\n this.renderer = null;\n this.clock = null;\n }\n}\n\nfunction isIdentityPoseObject(transform: Transform3DLike): boolean {\n const pose = readPose(transform);\n return pose.positionX === 0 && pose.positionY === 0 && pose.positionZ === 0\n && pose.rotationX === 0 && pose.rotationY === 0 && pose.rotationZ === 0\n && pose.scaleX === 1 && pose.scaleY === 1 && pose.scaleZ === 1;\n}\n","import { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\n\nexport default class Renderer3DManager {\n game: Game;\n rendererSystem: Renderer3DSystem;\n renderers: Renderer3D[] = [];\n\n constructor({ game, rendererSystem }: { game: Game; rendererSystem: Renderer3DSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n\n register(...renderers: Renderer3D[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this;\n renderer.threeContext = this.rendererSystem.threeContext;\n this.renderers.push(renderer);\n }\n }\n\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (!props) continue;\n\n if (changed.type === OBSERVER_TYPE.ADD || changed.type === OBSERVER_TYPE.REMOVE) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject.name}, ${changed.componentName} error.`,\n changed,\n e,\n );\n }\n continue;\n }\n\n // CHANGE type: check if the changed prop matches\n const index = props.findIndex((prop) => {\n if (typeof prop === 'string' && typeof changed.prop === 'string') {\n return prop === changed.prop;\n }\n // Deep comparison for object-style props\n return JSON.stringify(prop) === JSON.stringify(changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject?.name}, ${changed.componentName} componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[component.name];\n if (props) {\n try {\n renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(\n `gameObject: ${gameObject.name}, ${component.name} update error`,\n e,\n );\n }\n }\n }\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Transform3DParams {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport default class Transform3D extends Component<Transform3DParams> {\n static componentName: string = 'Transform3D';\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleX',\n description: 'Scale on X.',\n editor: 'number-stepper',\n })\n scaleX: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n\n worldPositionX: number = 0;\n worldPositionY: number = 0;\n worldPositionZ: number = 0;\n worldRotationX: number = 0;\n worldRotationY: number = 0;\n worldRotationZ: number = 0;\n\n init(obj?: Transform3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { System, decorators, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type { ComponentChanged, GameObject, UpdateParams } from '@combos-fun/engine';\nimport ThreeContext from './ThreeContext';\nimport type { ThreeContextParams } from './ThreeContext';\nimport Renderer3DManager from './Renderer3DManager';\nimport Transform3D from './Transform3D';\n\nexport interface Renderer3DSystemParams extends Partial<ThreeContextParams> {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width?: number;\n height?: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n})\nexport default class Renderer3DSystem extends System<Renderer3DSystemParams> {\n static systemName = 'Renderer3DSystem';\n name: string = 'Renderer3DSystem';\n threeContext: ThreeContext;\n rendererManager: Renderer3DManager;\n\n init(params?: Renderer3DSystemParams) {\n const opts = params || {};\n const width = opts.width || 750;\n const height = opts.height || 1334;\n\n this.threeContext = new ThreeContext({\n canvas: opts.canvas,\n container: opts.container,\n width,\n height,\n antialias: opts.antialias,\n backgroundColor: opts.backgroundColor,\n backgroundAlpha: opts.backgroundAlpha,\n fog: opts.fog,\n hemisphereLight: opts.hemisphereLight,\n shadows: opts.shadows,\n toneMapping: opts.toneMapping,\n toneMappingExposure: opts.toneMappingExposure,\n ambientIntensity: opts.ambientIntensity,\n directionalIntensity: opts.directionalIntensity,\n });\n\n this.game.canvas = this.threeContext.renderer.domElement;\n\n this.rendererManager = new Renderer3DManager({\n game: this.game,\n rendererSystem: this,\n });\n }\n\n update(e?: UpdateParams) {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.handleHierarchyChange(changed);\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (transform) {\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private handleHierarchyChange(changed: ComponentChanged) {\n if (changed.componentName !== 'GameObject') return;\n if (changed.type !== OBSERVER_TYPE.CHANGE && changed.type !== OBSERVER_TYPE.ADD) return;\n this.ensureTransform3D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform3D(changed.gameObject.parent);\n this.threeContext?.reparentGameObject(changed.gameObject);\n }\n\n private ensureTransform3D(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext?.ensureTransformRoot(gameObject, transform);\n }\n\n lateUpdate() {\n this.threeContext?.update();\n }\n\n resize(width: number, height: number) {\n this.threeContext?.resize(width, height);\n }\n\n onDestroy(): void {\n this.threeContext?.destroy();\n this.threeContext = null;\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer3DSystem from './system';\n\nObject.assign(Renderer3DSystem, {\n packageName: \"@combos-fun/plugin-renderer-3d\",\n packageVersion: \"0.1.2\",\n});\n","import { Game, PureObserverInfo, ComponentChanged, System, GameObject, UpdateParams } from '@combos-fun/engine';\nimport type Renderer3DManager from './Renderer3DManager';\nimport type ThreeContext from './ThreeContext';\n\nexport default class Renderer3D<T extends {} = {}> extends System<T> {\n name: string;\n game: Game;\n static observerInfo: PureObserverInfo;\n observerInfo: PureObserverInfo;\n rendererManager: Renderer3DManager;\n threeContext: ThreeContext;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer3D & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n componentChanged(_changed: ComponentChanged) {}\n rendererUpdate(_gameObject: GameObject) {}\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {};\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Transform3D from './Transform3D';\n\nconst POSE_PROPS = new Set([\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n]);\n\n@decorators.componentObserver({\n Transform3D: [\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n ],\n GameObject: ['parent'],\n})\nexport default class Transform3DSystem extends Renderer3D {\n static systemName = 'Transform3DSystem';\n name: string = 'Transform3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.ensureOn(changed.gameObject);\n if (changed.gameObject.parent) this.ensureOn(changed.gameObject.parent);\n this.threeContext.reparentGameObject(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.threeContext.ensureTransformRoot(changed.gameObject, changed.component as Transform3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.threeContext.detachObject3D(changed.gameObject.id);\n } else if (POSE_PROPS.has(changed.prop?.prop?.[0])) {\n this.threeContext.applyTransform3D(changed.gameObject, changed.component as Transform3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) return;\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n\n private ensureOn(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext.ensureTransformRoot(gameObject, transform);\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Render3DParams {\n visible?: boolean;\n opacity?: number;\n renderOrder?: number;\n sortableChildren?: boolean;\n}\n\nexport default class Render3D extends Component<Render3DParams> {\n static componentName: string = 'Render3D';\n\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'visible',\n description: 'Whether this object is drawn.',\n editor: 'toggle',\n })\n visible: boolean = true;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Render3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Render3D',\n label: 'renderOrder',\n description: 'Draw order; higher values render on top.',\n editor: 'number-stepper',\n })\n renderOrder: number = 0;\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'sortableChildren',\n description: 'When on, children are sorted by their render order before drawing.',\n editor: 'toggle',\n })\n sortableChildren: boolean = false;\n\n init(obj?: Render3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport type { Material, Mesh, Object3D } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Render3D from './Render3D';\n\n@decorators.componentObserver({\n Render3D: ['visible', 'opacity', 'renderOrder', 'sortableChildren'],\n})\nexport default class Render3DSystem extends Renderer3D {\n static systemName = 'Render3DSystem';\n name: string = 'Render3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Render3D') return;\n if (changed.type === OBSERVER_TYPE.REMOVE) {\n const root = this.threeContext.object3DFor(changed.gameObject.id);\n if (root) this.apply(root, { visible: true, opacity: 1, renderOrder: 0, sortableChildren: false } as Render3D);\n return;\n }\n this.applyTo(changed.gameObject, changed.component as Render3D);\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Render3D) as Render3D;\n if (!component) return;\n this.applyTo(gameObject, component);\n }\n\n private applyTo(gameObject: GameObject, component: Render3D) {\n const root = this.threeContext.object3DFor(gameObject.id);\n if (!root) return;\n this.apply(root, component);\n if (component.sortableChildren) {\n this.sortChildren(gameObject, root);\n }\n }\n\n private apply(root: Object3D, component: Render3D) {\n root.visible = component.visible;\n root.traverse((child) => {\n child.renderOrder = component.renderOrder;\n const mesh = child as Mesh;\n if (!mesh.isMesh || !mesh.material) return;\n const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];\n for (const material of materials as Material[]) {\n const mat = material as Material & { opacity?: number; transparent?: boolean };\n if (typeof mat.opacity === 'number') {\n mat.opacity = component.opacity;\n mat.transparent = component.opacity < 1;\n }\n }\n });\n }\n\n private sortChildren(gameObject: GameObject, root: Object3D) {\n const ranked = gameObject.children\n ?.map((childGo) => {\n if (!childGo) return null;\n const node = this.threeContext.object3DFor(childGo.id);\n if (!node || node.parent !== root) return null;\n const render = childGo.getComponent(Render3D) as Render3D | undefined;\n return { node, order: render?.renderOrder ?? 0 };\n })\n .filter((item): item is { node: Object3D; order: number } => !!item)\n .sort((a, b) => a.order - b.order);\n if (!ranked?.length) return;\n for (const item of ranked) {\n root.add(item.node);\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Camera3DParams {\n fov?: number;\n near?: number;\n far?: number;\n active?: boolean;\n lookAtX?: number;\n lookAtY?: number;\n lookAtZ?: number;\n lookAt?: boolean;\n}\n\nexport default class Camera3D extends Component<Camera3DParams> {\n static componentName: string = 'Camera3D';\n\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'fov',\n description: 'Vertical field of view in degrees.',\n editor: 'number-stepper',\n })\n fov: number = 75;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Camera3D',\n label: 'near',\n description: 'Near clipping plane.',\n editor: 'number-stepper',\n })\n near: number = 0.1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'far',\n description: 'Far clipping plane.',\n editor: 'number-stepper',\n })\n far: number = 1000;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'active',\n description: 'Use this camera for rendering.',\n editor: 'toggle',\n })\n active: boolean = true;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'lookAt',\n description: 'Point the camera at lookAtX/Y/Z each frame.',\n editor: 'toggle',\n })\n lookAt: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtX',\n description: 'World-space look-at target on X.',\n editor: 'number-stepper',\n })\n lookAtX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtY',\n description: 'World-space look-at target on Y.',\n editor: 'number-stepper',\n })\n lookAtY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtZ',\n description: 'World-space look-at target on Z.',\n editor: 'number-stepper',\n })\n lookAtZ: number = 0;\n\n init(obj?: Camera3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport { PerspectiveCamera } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Camera3D from './Camera3D';\nimport Transform3D from './Transform3D';\nimport { isIdentityPose } from './pose';\n\n@decorators.componentObserver({\n Camera3D: ['fov', 'near', 'far', 'active', 'lookAt', 'lookAtX', 'lookAtY', 'lookAtZ'],\n})\nexport default class Camera3DSystem extends Renderer3D {\n static systemName = 'Camera3DSystem';\n name: string = 'Camera3DSystem';\n\n private cameras = new Map<number, PerspectiveCamera>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Camera3D') return;\n const component = changed.component as Camera3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else {\n this.sync(changed.gameObject, component);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Camera3D) as Camera3D;\n const camera = this.cameras.get(gameObject.id);\n if (!component || !camera) return;\n if (component.lookAt) {\n camera.lookAt(component.lookAtX, component.lookAtY, component.lookAtZ);\n }\n }\n\n private mount(gameObject: GameObject, component: Camera3D) {\n this.ensureTransform(gameObject);\n const camera = new PerspectiveCamera(\n component.fov,\n this.threeContext.camera.aspect,\n component.near,\n component.far,\n );\n this.threeContext.attachVisual(gameObject.id, camera, gameObject);\n this.cameras.set(gameObject.id, camera);\n this.sync(gameObject, component);\n }\n\n private sync(gameObject: GameObject, component: Camera3D) {\n const camera = this.cameras.get(gameObject.id);\n if (!camera) return;\n camera.fov = component.fov;\n camera.near = component.near;\n camera.far = component.far;\n camera.updateProjectionMatrix();\n if (component.active) {\n this.threeContext.setActiveCamera(camera);\n } else if (this.threeContext.camera === camera) {\n this.activateAnother(gameObject.id);\n }\n }\n\n private unmount(id: number) {\n const camera = this.cameras.get(id);\n if (!camera) return;\n this.threeContext.detachVisual(id, camera);\n this.cameras.delete(id);\n if (this.threeContext.camera === camera) {\n this.activateAnother(id);\n }\n }\n\n private activateAnother(exceptId: number) {\n for (const [id, camera] of this.cameras) {\n if (id === exceptId) continue;\n const go = this.game.gameObjects.find((item) => item.id === id);\n const component = go?.getComponent(Camera3D) as Camera3D | undefined;\n if (component?.active) {\n this.threeContext.setActiveCamera(camera);\n return;\n }\n }\n this.threeContext.restoreFallbackCamera();\n }\n\n private ensureTransform(gameObject: GameObject) {\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n transform.positionZ = 5;\n gameObject.addComponent(transform);\n return;\n }\n if (isIdentityPose(transform)) {\n transform.positionZ = 5;\n }\n }\n\n onDestroy() {\n for (const [id] of this.cameras) {\n this.unmount(id);\n }\n this.cameras.clear();\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport type Light3DKind = 'ambient' | 'directional' | 'hemisphere' | 'point' | 'spot';\n\nexport interface Light3DParams {\n type?: Light3DKind | string;\n color?: number;\n intensity?: number;\n castShadow?: boolean;\n skyColor?: number;\n groundColor?: number;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n}\n\nexport default class Light3D extends Component<Light3DParams> {\n static componentName: string = 'Light3D';\n\n @Field({\n type: 'string',\n group: 'Light3D',\n label: 'type',\n description: 'Light kind.',\n editor: 'enum',\n enumOptions: ['ambient', 'directional', 'hemisphere', 'point', 'spot'],\n })\n type: string = 'directional';\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'color',\n description: 'Light color (hex).',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'number',\n step: 0.05,\n group: 'Light3D',\n label: 'intensity',\n description: 'Light intensity.',\n editor: 'number-stepper',\n })\n intensity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Light3D',\n label: 'castShadow',\n description: 'Whether this light casts shadows.',\n editor: 'toggle',\n })\n castShadow: boolean = false;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'skyColor',\n description: 'Hemisphere sky color (hex).',\n editor: 'number-stepper',\n })\n skyColor: number = 0xffffff;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'groundColor',\n description: 'Hemisphere ground color (hex).',\n editor: 'number-stepper',\n })\n groundColor: number = 0x444444;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'distance',\n description: 'Range for point and spot lights. 0 means no limit.',\n editor: 'number-stepper',\n })\n distance: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'decay',\n description: 'Intensity falloff for point and spot lights.',\n editor: 'number-stepper',\n })\n decay: number = 2;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Light3D',\n label: 'angle',\n description: 'Spot light cone angle in radians.',\n editor: 'number-stepper',\n })\n angle: number = Math.PI / 3;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Light3D',\n label: 'penumbra',\n description: 'Spot light soft edge (0–1).',\n editor: 'number-slider',\n })\n penumbra: number = 0;\n\n init(obj?: Light3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport {\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n PointLight,\n SpotLight,\n} from 'three';\nimport type { Light } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Light3D from './Light3D';\nimport Transform3D from './Transform3D';\n\n@decorators.componentObserver({\n Light3D: [\n 'type', 'color', 'intensity', 'castShadow',\n 'skyColor', 'groundColor', 'distance', 'decay', 'angle', 'penumbra',\n ],\n})\nexport default class Light3DSystem extends Renderer3D {\n static systemName = 'Light3DSystem';\n name: string = 'Light3DSystem';\n\n private lights = new Map<number, Light>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Light3D') return;\n const component = changed.component as Light3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else if (changed.prop?.prop?.[0] === 'type') {\n this.unmount(changed.gameObject.id);\n this.mount(changed.gameObject, component);\n } else {\n this.sync(changed.gameObject.id, component);\n }\n }\n\n rendererUpdate(_gameObject: GameObject) {}\n\n private mount(gameObject: GameObject, component: Light3D) {\n this.ensureTransform(gameObject);\n if (this.lights.size === 0) {\n this.threeContext.removeDefaultLights();\n }\n const light = this.createLight(component);\n this.threeContext.attachVisual(gameObject.id, light, gameObject);\n this.lights.set(gameObject.id, light);\n this.sync(gameObject.id, component);\n }\n\n private createLight(component: Light3D): Light {\n switch (component.type) {\n case 'ambient':\n return new AmbientLight(component.color, component.intensity);\n case 'hemisphere':\n return new HemisphereLight(component.skyColor, component.groundColor, component.intensity);\n case 'point':\n return new PointLight(component.color, component.intensity, component.distance, component.decay);\n case 'spot':\n return new SpotLight(\n component.color,\n component.intensity,\n component.distance,\n component.angle,\n component.penumbra,\n component.decay,\n );\n case 'directional':\n default:\n return new DirectionalLight(component.color, component.intensity);\n }\n }\n\n private sync(id: number, component: Light3D) {\n const light = this.lights.get(id);\n if (!light) return;\n if ('color' in light && (light as DirectionalLight).color) {\n (light as DirectionalLight).color.set(component.color);\n }\n light.intensity = component.intensity;\n if (light instanceof HemisphereLight) {\n light.color.set(component.skyColor);\n light.groundColor.set(component.groundColor);\n }\n if (light instanceof PointLight || light instanceof SpotLight) {\n light.distance = component.distance;\n light.decay = component.decay;\n }\n if (light instanceof SpotLight) {\n light.angle = component.angle;\n light.penumbra = component.penumbra;\n }\n if ('castShadow' in light) {\n (light as DirectionalLight).castShadow = !!(component.castShadow && this.threeContext.shadows);\n }\n }\n\n private unmount(id: number) {\n const light = this.lights.get(id);\n if (!light) return;\n this.threeContext.detachVisual(id, light);\n light.dispose?.();\n this.lights.delete(id);\n }\n\n private ensureTransform(gameObject: GameObject) {\n if (gameObject.getComponent(Transform3D)) return;\n gameObject.addComponent(new Transform3D());\n }\n\n onDestroy() {\n for (const [id] of this.lights) {\n this.unmount(id);\n }\n this.lights.clear();\n }\n}\n","import { resource } from '@combos-fun/engine';\nimport type { ResourceStruct } from '@combos-fun/engine';\nimport { SRGBColorSpace, Texture } from 'three';\n\nexport async function requireNamedResource(name: string): Promise<ResourceStruct> {\n const trimmed = String(name ?? '').trim();\n if (!trimmed) {\n throw new Error('resource name is required; register it with resource.addResource');\n }\n const res = await resource.getResource(trimmed);\n if (!res || !res.name) {\n throw new Error(\n `Unknown resource \"${trimmed}\"; register it with resource.addResource first`,\n );\n }\n return res;\n}\n\nexport function textureFromResourceImage(res: ResourceStruct): Texture {\n const image = res.data?.image as HTMLImageElement | undefined;\n if (!image) {\n throw new Error(\n `Resource \"${res.name}\" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`,\n );\n }\n const texture = new Texture(image);\n texture.colorSpace = SRGBColorSpace;\n texture.needsUpdate = true;\n return texture;\n}\n\nexport async function textureFromNamedImage(name: string): Promise<Texture> {\n // Always build a Three.Texture from data.image so 2D Pixi\n // registerInstance(IMAGE) is never overwritten or reused.\n return textureFromResourceImage(await requireNamedResource(name));\n}\n"],"names":["NoToneMapping","ACESFilmicToneMapping","LinearToneMapping","ReinhardToneMapping","CineonToneMapping","Vector3","Euler","Scene","PerspectiveCamera","WebGLRenderer","PCFSoftShadowMap","AmbientLight","DirectionalLight","HemisphereLight","Fog","Clock","AnimationMixer","Group","OBSERVER_TYPE","Component","__decorate","Field","Renderer3DSystem","System","decorators","PointLight","SpotLight","resource","Texture","SRGBColorSpace"],"mappings":";;;;;;;AAEO,MAAM,qBAAqB,GAAG;AAC9B,MAAM,kBAAkB,GAAG;AAE5B,SAAU,iBAAiB,CAAC,MAAmC,EAAA;IACnE,OAAO,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAC;AACjD;AAEA;AACM,SAAU,WAAW,CAAC,MAAgB,EAAE,YAAoB,EAAA;AAChE,IAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAI;AACxB,QAAA,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,YAAY;AACtD,IAAA,CAAC,CAAC;AACJ;AAEM,SAAU,wBAAwB,CAAC,MAAmC,EAAA;IAC1E,IAAI,OAAO,GAAG,MAAM;IACpB,OAAO,OAAO,EAAE;QACd,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,qBAAqB,CAAC;AACpD,QAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;AAC1B,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,GAAG,OAAO,CAAC,MAAM;IAC1B;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;AACM,SAAU,4BAA4B,CAAC,YAEzB,EAAA;AAClB,IAAA,OAAO,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC;AACvD;;AC/BA;AACM,SAAU,eAAe,CAAC,UAAyC,EAAA;AACvE,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,IAAI;AAC5B,IAAA,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM;IAChC,OAAO,CAAC,MAAM,IAAI,MAAM,KAAK,UAAU,CAAC,KAAK;AAC/C;AAEM,SAAU,qBAAqB,CAAC,UAAyC,EAAA;IAC7E,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC;A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IAAI;AAC1B,IAAA,OAAO,OAAO;AAChB;AAEO,eAAe,qBAAqB,CAAC,IAAY,EAAA;;;IAGtD,OAAO,wBAAwB,CAAC,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d.cjs.js","sources":["../lib/tagObject3D.ts","../lib/hierarchy.ts","../lib/pose.ts","../lib/ThreeContext.ts","../lib/Renderer3DManager.ts","../lib/Transform3D.ts","../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer3D.ts","../lib/Transform3DSystem.ts","../lib/Render3D.ts","../lib/Render3DSystem.ts","../lib/Camera3D.ts","../lib/Camera3DSystem.ts","../lib/Light3D.ts","../lib/Light3DSystem.ts","../lib/namedResource.ts"],"sourcesContent":["import type { Object3D } from 'three';\n\nexport const COMBOS_GAME_OBJECT_ID = 'combosGameObjectId';\nexport const COMBOS_TRANSFORM3D = 'combosTransform3D';\n\nexport function isTransform3DRoot(object: Object3D | null | undefined): boolean {\n return !!object?.userData?.[COMBOS_TRANSFORM3D];\n}\n\n/** Stamp a Three.js object (and its children) so Event3D raycasts can resolve the GameObject. */\nexport function tagObject3D(object: Object3D, gameObjectId: number): void {\n object.traverse((child) => {\n child.userData[COMBOS_GAME_OBJECT_ID] = gameObjectId;\n });\n}\n\nexport function gameObjectIdFromObject3D(object: Object3D | null | undefined): number | undefined {\n let current = object;\n while (current) {\n const id = current.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof id === 'number') {\n return id;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/** Resolve a raycast hit to a GameObject id. */\nexport function gameObjectIdFromIntersection(intersection: {\n object?: Object3D;\n} | null | undefined): number | undefined {\n return gameObjectIdFromObject3D(intersection?.object);\n}\n","import type { GameObject } from '@combos-fun/engine';\n\n/** True when this GameObject is a scene root (no 3D parent). */\nexport function is3DSceneParent(gameObject: GameObject | undefined | null): boolean {\n if (!gameObject) return true;\n const parent = gameObject.parent;\n return !parent || parent === gameObject.scene;\n}\n\nexport function has3DChildGameObjects(gameObject: GameObject | undefined | null): boolean {\n return (gameObject?.children?.length ?? 0) > 0;\n}\n","export interface PoseLike {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport function readPose(pose: PoseLike) {\n return {\n positionX: pose.positionX ?? 0,\n positionY: pose.positionY ?? 0,\n positionZ: pose.positionZ ?? 0,\n rotationX: pose.rotationX ?? 0,\n rotationY: pose.rotationY ?? 0,\n rotationZ: pose.rotationZ ?? 0,\n scaleX: pose.scaleX ?? 1,\n scaleY: pose.scaleY ?? 1,\n scaleZ: pose.scaleZ ?? 1,\n };\n}\n\nexport function poseKeyOf(pose: PoseLike): string {\n const r = readPose(pose);\n return [\n r.positionX, r.positionY, r.positionZ,\n r.rotationX, r.rotationY, r.rotationZ,\n r.scaleX, r.scaleY, r.scaleZ,\n ].join(',');\n}\n\nexport function copyPose(from: PoseLike, to: PoseLike) {\n const r = readPose(from);\n to.positionX = r.positionX;\n to.positionY = r.positionY;\n to.positionZ = r.positionZ;\n to.rotationX = r.rotationX;\n to.rotationY = r.rotationY;\n to.rotationZ = r.rotationZ;\n to.scaleX = r.scaleX;\n to.scaleY = r.scaleY;\n to.scaleZ = r.scaleZ;\n}\n\nexport function isIdentityPose(pose: PoseLike): boolean {\n const r = readPose(pose);\n return r.positionX === 0 && r.positionY === 0 && r.positionZ === 0\n && r.rotationX === 0 && r.rotationY === 0 && r.rotationZ === 0\n && r.scaleX === 1 && r.scaleY === 1 && r.scaleZ === 1;\n}\n\nexport function seedTransform3D(visual: PoseLike, transform: PoseLike) {\n if (isIdentityPose(transform) && !isIdentityPose(visual)) {\n copyPose(visual, transform);\n }\n}\n\n/**\n * Keep a visual component's pose fields and a sibling Transform3D in sync.\n * Returns true when the visual Object3D should still apply pose itself\n * (no Transform3D root yet).\n */\nexport class VisualPoseBridge {\n lastVisual = '';\n lastRoot = '';\n\n sync(visual: PoseLike, root?: PoseLike | null): boolean {\n if (!root) return true;\n if (this.lastVisual === '' && this.lastRoot === '') {\n seedTransform3D(visual, root);\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n const visualKey = poseKeyOf(visual);\n const rootKey = poseKeyOf(root);\n if (visualKey !== this.lastVisual && rootKey === this.lastRoot) {\n copyPose(visual, root);\n }\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n}\n","import {\n Scene,\n PerspectiveCamera,\n WebGLRenderer,\n Clock,\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n Fog,\n AnimationMixer,\n AnimationClip,\n Mesh,\n Material,\n Group,\n Euler,\n Vector3,\n ACESFilmicToneMapping,\n LinearToneMapping,\n ReinhardToneMapping,\n CineonToneMapping,\n NoToneMapping,\n PCFSoftShadowMap,\n} from 'three';\nimport type { Light, Object3D, ToneMapping } from 'three';\nimport type { GameObject } from '@combos-fun/engine';\nimport { tagObject3D, COMBOS_GAME_OBJECT_ID, COMBOS_TRANSFORM3D, isTransform3DRoot } from './tagObject3D';\nimport { is3DSceneParent } from './hierarchy';\nimport type { PoseLike } from './pose';\nimport { readPose } from './pose';\n\nexport type ToneMappingKind = 'none' | 'aces' | 'linear' | 'reinhard' | 'cineon';\n\nexport interface FogParams {\n color?: number;\n near?: number;\n far?: number;\n}\n\nexport interface HemisphereLightParams {\n skyColor?: number;\n groundColor?: number;\n intensity?: number;\n}\n\nexport interface ThreeContextParams {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width: number;\n height: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n fog?: boolean | FogParams;\n hemisphereLight?: boolean | HemisphereLightParams;\n shadows?: boolean;\n toneMapping?: ToneMappingKind;\n toneMappingExposure?: number;\n ambientIntensity?: number;\n directionalIntensity?: number;\n}\n\nexport interface Transform3DLike extends PoseLike {\n worldPositionX?: number;\n worldPositionY?: number;\n worldPositionZ?: number;\n worldRotationX?: number;\n worldRotationY?: number;\n worldRotationZ?: number;\n}\n\nconst TONE_MAPPING: Record<ToneMappingKind, ToneMapping> = {\n none: NoToneMapping,\n aces: ACESFilmicToneMapping,\n linear: LinearToneMapping,\n reinhard: ReinhardToneMapping,\n cineon: CineonToneMapping,\n};\n\nconst _world = new Vector3();\nconst _euler = new Euler();\n\nexport default class ThreeContext {\n scene: Scene;\n camera: PerspectiveCamera;\n fallbackCamera: PerspectiveCamera;\n renderer: WebGLRenderer;\n clock: Clock;\n mixers: Map<number, AnimationMixer> = new Map();\n models: Map<number, Group> = new Map();\n /** Root Object3D for each GameObject that has a 3D node. */\n nodes: Map<number, Object3D> = new Map();\n shadows: boolean;\n defaultLights: Object3D[] = [];\n\n constructor(params: ThreeContextParams) {\n const {\n canvas,\n container,\n width,\n height,\n antialias = true,\n backgroundColor = 0x000000,\n backgroundAlpha = 1,\n } = params;\n\n this.scene = new Scene();\n this.shadows = !!params.shadows;\n\n this.camera = new PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 5;\n this.fallbackCamera = this.camera;\n\n const rendererOpts: any = { antialias };\n if (canvas) {\n rendererOpts.canvas = canvas;\n }\n if (backgroundAlpha < 1) {\n rendererOpts.alpha = true;\n }\n\n this.renderer = new WebGLRenderer(rendererOpts);\n this.renderer.setSize(width, height);\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setClearColor(backgroundColor, backgroundAlpha);\n this.renderer.toneMapping = TONE_MAPPING[params.toneMapping ?? 'aces'] ?? ACESFilmicToneMapping;\n this.renderer.toneMappingExposure = params.toneMappingExposure ?? 1;\n if (this.shadows) {\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = PCFSoftShadowMap;\n }\n\n if (!canvas && container) {\n container.appendChild(this.renderer.domElement);\n }\n\n const ambientLight = new AmbientLight(0xffffff, params.ambientIntensity ?? 0.6);\n this.scene.add(ambientLight);\n this.defaultLights.push(ambientLight);\n\n const directionalLight = new DirectionalLight(0xffffff, params.directionalIntensity ?? 0.8);\n directionalLight.position.set(5, 10, 7.5);\n if (this.shadows) {\n directionalLight.castShadow = true;\n directionalLight.shadow.mapSize.set(1024, 1024);\n }\n this.scene.add(directionalLight);\n this.defaultLights.push(directionalLight);\n\n if (params.hemisphereLight !== false) {\n const hemi = typeof params.hemisphereLight === 'object' ? params.hemisphereLight : {};\n const hemisphereLight = new HemisphereLight(\n hemi.skyColor ?? 0xffffff,\n hemi.groundColor ?? 0x444444,\n hemi.intensity ?? 0.35,\n );\n this.scene.add(hemisphereLight);\n this.defaultLights.push(hemisphereLight);\n }\n\n if (params.fog) {\n const fog = typeof params.fog === 'object' ? params.fog : {};\n this.scene.fog = new Fog(fog.color ?? backgroundColor, fog.near ?? 8, fog.far ?? 40);\n }\n\n this.clock = new Clock();\n }\n\n update() {\n const delta = this.clock.getDelta();\n for (const mixer of this.mixers.values()) {\n mixer.update(delta);\n }\n this.renderer.render(this.scene, this.camera);\n }\n\n hasTransform3DRoot(id: number): boolean {\n return isTransform3DRoot(this.nodes.get(id));\n }\n\n applyModelShadows(object: Object3D) {\n if (!this.shadows) return;\n object.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.isMesh) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n });\n }\n\n attachParsedModel(\n id: number,\n model: Group,\n animations?: AnimationClip[],\n gameObject?: GameObject,\n ): Group {\n tagObject3D(model, id);\n this.applyModelShadows(model);\n this.models.set(id, model);\n this.attachVisual(id, model, gameObject);\n\n if (animations && animations.length > 0) {\n const mixer = new AnimationMixer(model);\n this.mixers.set(id, mixer);\n model.userData.animations = animations;\n }\n\n return model;\n }\n\n object3DFor(id: number): Object3D | undefined {\n return this.nodes.get(id);\n }\n\n /** Place a GameObject's root Object3D under the nearest ancestor visual (or the scene). */\n attachObject3D(id: number, object: Object3D, gameObject?: GameObject): void {\n const prev = this.nodes.get(id);\n if (prev && prev !== object) {\n this.rehomeRegisteredChildren(prev);\n prev.parent?.remove(prev);\n }\n this.nodes.set(id, object);\n const parentNode = this.findParentNode(gameObject);\n if (object.parent !== parentNode) {\n parentNode.add(object);\n }\n if (gameObject) {\n this.adoptChildGameObjects(gameObject, object);\n }\n }\n\n /**\n * Attach a visual / camera / light under the Transform3D root when one exists.\n * Otherwise the object itself becomes the GameObject root (legacy path).\n */\n attachVisual(id: number, object: Object3D, gameObject?: GameObject): void {\n tagObject3D(object, id);\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n if (object.parent !== root) {\n root.add(object);\n }\n return;\n }\n this.attachObject3D(id, object, gameObject);\n }\n\n detachVisual(id: number, object: Object3D): Object3D | undefined {\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n object.parent?.remove(object);\n return object;\n }\n if (root === object) {\n return this.detachObject3D(id);\n }\n object.parent?.remove(object);\n return object;\n }\n\n /** Remove a registered node without disposing it; child GameObject nodes stay in the scene. */\n detachObject3D(id: number): Object3D | undefined {\n const object = this.nodes.get(id);\n if (!object) return undefined;\n this.rehomeRegisteredChildren(object);\n object.parent?.remove(object);\n this.nodes.delete(id);\n return object;\n }\n\n reparentGameObject(gameObject: GameObject): void {\n const object = this.nodes.get(gameObject.id);\n if (!object) return;\n const parentNode = this.findParentNode(gameObject);\n if (object.parent === parentNode) return;\n parentNode.add(object);\n }\n\n findParentNode(gameObject?: GameObject): Object3D {\n if (!gameObject || is3DSceneParent(gameObject)) {\n return this.scene;\n }\n let current = gameObject.parent;\n while (current && current !== gameObject.scene) {\n const node = this.nodes.get(current.id);\n if (node) return node;\n current = current.parent;\n }\n return this.scene;\n }\n\n adoptChildGameObjects(gameObject: GameObject, object: Object3D): void {\n const children = gameObject.children;\n if (!children) return;\n for (const childGo of children) {\n if (!childGo) continue;\n const childNode = this.nodes.get(childGo.id);\n if (childNode && childNode.parent !== object) {\n object.add(childNode);\n }\n }\n }\n\n ensureTransformRoot(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const existing = this.nodes.get(gameObject.id);\n if (isTransform3DRoot(existing)) {\n this.applyTransformPose(existing, transform);\n return existing;\n }\n\n const group = new Group();\n group.name = gameObject.name;\n group.userData[COMBOS_TRANSFORM3D] = true;\n tagObject3D(group, gameObject.id);\n\n if (existing && existing !== group) {\n if (isIdentityPoseObject(transform)) {\n transform.positionX = existing.position.x;\n transform.positionY = existing.position.y;\n transform.positionZ = existing.position.z;\n transform.rotationX = existing.rotation.x;\n transform.rotationY = existing.rotation.y;\n transform.rotationZ = existing.rotation.z;\n transform.scaleX = existing.scale.x;\n transform.scaleY = existing.scale.y;\n transform.scaleZ = existing.scale.z;\n }\n const parent = existing.parent || this.scene;\n parent.add(group);\n group.add(existing);\n existing.position.set(0, 0, 0);\n existing.rotation.set(0, 0, 0);\n existing.scale.set(1, 1, 1);\n this.nodes.set(gameObject.id, group);\n this.adoptChildGameObjects(gameObject, group);\n } else {\n this.attachObject3D(gameObject.id, group, gameObject);\n }\n\n this.applyTransformPose(group, transform);\n return group;\n }\n\n applyTransform3D(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const root = this.ensureTransformRoot(gameObject, transform);\n this.applyTransformPose(root, transform);\n root.updateWorldMatrix(true, false);\n root.getWorldPosition(_world);\n transform.worldPositionX = _world.x;\n transform.worldPositionY = _world.y;\n transform.worldPositionZ = _world.z;\n _euler.setFromRotationMatrix(root.matrixWorld);\n transform.worldRotationX = _euler.x;\n transform.worldRotationY = _euler.y;\n transform.worldRotationZ = _euler.z;\n return root;\n }\n\n private applyTransformPose(root: Object3D, transform: Transform3DLike) {\n const pose = readPose(transform);\n root.position.set(pose.positionX, pose.positionY, pose.positionZ);\n root.rotation.set(pose.rotationX, pose.rotationY, pose.rotationZ);\n root.scale.set(pose.scaleX, pose.scaleY, pose.scaleZ);\n }\n\n removeDefaultLights() {\n if (!this.defaultLights.length) return;\n for (const light of this.defaultLights) {\n light.parent?.remove(light);\n (light as Light).dispose?.();\n }\n this.defaultLights = [];\n }\n\n setActiveCamera(camera: PerspectiveCamera) {\n const prev = this.camera;\n this.camera = camera;\n if (prev) {\n camera.aspect = prev.aspect;\n }\n camera.updateProjectionMatrix();\n }\n\n restoreFallbackCamera() {\n if (this.camera !== this.fallbackCamera) {\n this.setActiveCamera(this.fallbackCamera);\n }\n }\n\n private rehomeRegisteredChildren(object: Object3D): void {\n for (const child of [...object.children]) {\n const childId = child.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof childId === 'number' && this.nodes.get(childId) === child) {\n this.scene.add(child);\n }\n }\n }\n\n playAnimation(id: number, animationIndex: number, speed: number) {\n const mixer = this.mixers.get(id);\n const model = this.models.get(id);\n if (!mixer || !model) return;\n\n mixer.stopAllAction();\n const animations = model.userData.animations as AnimationClip[];\n if (animations && animations[animationIndex]) {\n const action = mixer.clipAction(animations[animationIndex]);\n action.timeScale = speed;\n action.play();\n }\n }\n\n stopAnimation(id: number) {\n const mixer = this.mixers.get(id);\n if (mixer) mixer.stopAllAction();\n }\n\n removeModel(id: number) {\n const model = this.models.get(id);\n if (model) {\n this.detachVisual(id, model);\n model.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.geometry) {\n mesh.geometry.dispose();\n }\n if (mesh.material) {\n const materials = Array.isArray(mesh.material)\n ? mesh.material as Material[]\n : [mesh.material as Material];\n materials.forEach(m => m.dispose());\n }\n });\n this.models.delete(id);\n }\n const mixer = this.mixers.get(id);\n if (mixer) {\n mixer.stopAllAction();\n this.mixers.delete(id);\n }\n }\n\n resize(width: number, height: number) {\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n if (this.fallbackCamera !== this.camera) {\n this.fallbackCamera.aspect = width / height;\n this.fallbackCamera.updateProjectionMatrix();\n }\n this.renderer.setSize(width, height);\n }\n\n destroy() {\n for (const id of this.models.keys()) {\n this.removeModel(id);\n }\n this.removeDefaultLights();\n this.renderer.dispose();\n this.renderer.domElement.remove();\n this.nodes.clear();\n this.scene = null;\n this.camera = null;\n this.fallbackCamera = null;\n this.renderer = null;\n this.clock = null;\n }\n}\n\nfunction isIdentityPoseObject(transform: Transform3DLike): boolean {\n const pose = readPose(transform);\n return pose.positionX === 0 && pose.positionY === 0 && pose.positionZ === 0\n && pose.rotationX === 0 && pose.rotationY === 0 && pose.rotationZ === 0\n && pose.scaleX === 1 && pose.scaleY === 1 && pose.scaleZ === 1;\n}\n","import { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\n\nexport default class Renderer3DManager {\n game: Game;\n rendererSystem: Renderer3DSystem;\n renderers: Renderer3D[] = [];\n\n constructor({ game, rendererSystem }: { game: Game; rendererSystem: Renderer3DSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n\n register(...renderers: Renderer3D[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this;\n renderer.threeContext = this.rendererSystem.threeContext;\n this.renderers.push(renderer);\n }\n }\n\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (!props) continue;\n\n if (changed.type === OBSERVER_TYPE.ADD || changed.type === OBSERVER_TYPE.REMOVE) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject.name}, ${changed.componentName} error.`,\n changed,\n e,\n );\n }\n continue;\n }\n\n // CHANGE type: check if the changed prop matches\n const index = props.findIndex((prop) => {\n if (typeof prop === 'string' && typeof changed.prop === 'string') {\n return prop === changed.prop;\n }\n // Deep comparison for object-style props\n return JSON.stringify(prop) === JSON.stringify(changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject?.name}, ${changed.componentName} componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[component.name];\n if (props) {\n try {\n renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(\n `gameObject: ${gameObject.name}, ${component.name} update error`,\n e,\n );\n }\n }\n }\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Transform3DParams {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport default class Transform3D extends Component<Transform3DParams> {\n static componentName: string = 'Transform3D';\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleX',\n description: 'Scale on X.',\n editor: 'number-stepper',\n })\n scaleX: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n\n worldPositionX: number = 0;\n worldPositionY: number = 0;\n worldPositionZ: number = 0;\n worldRotationX: number = 0;\n worldRotationY: number = 0;\n worldRotationZ: number = 0;\n\n init(obj?: Transform3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { System, decorators, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type { ComponentChanged, GameObject, UpdateParams } from '@combos-fun/engine';\nimport ThreeContext from './ThreeContext';\nimport type { ThreeContextParams } from './ThreeContext';\nimport Renderer3DManager from './Renderer3DManager';\nimport Transform3D from './Transform3D';\n\nexport interface Renderer3DSystemParams extends Partial<ThreeContextParams> {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width?: number;\n height?: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n})\nexport default class Renderer3DSystem extends System<Renderer3DSystemParams> {\n static systemName = 'Renderer3DSystem';\n name: string = 'Renderer3DSystem';\n threeContext: ThreeContext;\n rendererManager: Renderer3DManager;\n\n init(params?: Renderer3DSystemParams) {\n const opts = params || {};\n const width = opts.width || 750;\n const height = opts.height || 1334;\n\n this.threeContext = new ThreeContext({\n canvas: opts.canvas,\n container: opts.container,\n width,\n height,\n antialias: opts.antialias,\n backgroundColor: opts.backgroundColor,\n backgroundAlpha: opts.backgroundAlpha,\n fog: opts.fog,\n hemisphereLight: opts.hemisphereLight,\n shadows: opts.shadows,\n toneMapping: opts.toneMapping,\n toneMappingExposure: opts.toneMappingExposure,\n ambientIntensity: opts.ambientIntensity,\n directionalIntensity: opts.directionalIntensity,\n });\n\n this.game.canvas = this.threeContext.renderer.domElement;\n\n this.rendererManager = new Renderer3DManager({\n game: this.game,\n rendererSystem: this,\n });\n }\n\n update(e?: UpdateParams) {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.handleHierarchyChange(changed);\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (transform) {\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private handleHierarchyChange(changed: ComponentChanged) {\n if (changed.componentName !== 'GameObject') return;\n if (changed.type !== OBSERVER_TYPE.CHANGE && changed.type !== OBSERVER_TYPE.ADD) return;\n this.ensureTransform3D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform3D(changed.gameObject.parent);\n this.threeContext?.reparentGameObject(changed.gameObject);\n }\n\n private ensureTransform3D(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext?.ensureTransformRoot(gameObject, transform);\n }\n\n lateUpdate() {\n this.threeContext?.update();\n }\n\n resize(width: number, height: number) {\n this.threeContext?.resize(width, height);\n }\n\n onDestroy(): void {\n this.threeContext?.destroy();\n this.threeContext = null;\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer3DSystem from './system';\n\nObject.assign(Renderer3DSystem, {\n packageName: \"@combos-fun/plugin-renderer-3d\",\n packageVersion: \"0.1.4-beta.0\",\n});\n","import { Game, PureObserverInfo, ComponentChanged, System, GameObject, UpdateParams } from '@combos-fun/engine';\nimport type Renderer3DManager from './Renderer3DManager';\nimport type ThreeContext from './ThreeContext';\n\nexport default class Renderer3D<T extends {} = {}> extends System<T> {\n name: string;\n game: Game;\n static observerInfo: PureObserverInfo;\n observerInfo: PureObserverInfo;\n rendererManager: Renderer3DManager;\n threeContext: ThreeContext;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer3D & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n componentChanged(_changed: ComponentChanged) {}\n rendererUpdate(_gameObject: GameObject) {}\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {};\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Transform3D from './Transform3D';\n\nconst POSE_PROPS = new Set([\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n]);\n\n@decorators.componentObserver({\n Transform3D: [\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n ],\n GameObject: ['parent'],\n})\nexport default class Transform3DSystem extends Renderer3D {\n static systemName = 'Transform3DSystem';\n name: string = 'Transform3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.ensureOn(changed.gameObject);\n if (changed.gameObject.parent) this.ensureOn(changed.gameObject.parent);\n this.threeContext.reparentGameObject(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.threeContext.ensureTransformRoot(changed.gameObject, changed.component as Transform3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.threeContext.detachObject3D(changed.gameObject.id);\n } else if (POSE_PROPS.has(changed.prop?.prop?.[0])) {\n this.threeContext.applyTransform3D(changed.gameObject, changed.component as Transform3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) return;\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n\n private ensureOn(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext.ensureTransformRoot(gameObject, transform);\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Render3DParams {\n visible?: boolean;\n opacity?: number;\n renderOrder?: number;\n sortableChildren?: boolean;\n}\n\nexport default class Render3D extends Component<Render3DParams> {\n static componentName: string = 'Render3D';\n\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'visible',\n description: 'Whether this object is drawn.',\n editor: 'toggle',\n })\n visible: boolean = true;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Render3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Render3D',\n label: 'renderOrder',\n description: 'Draw order; higher values render on top.',\n editor: 'number-stepper',\n })\n renderOrder: number = 0;\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'sortableChildren',\n description: 'When on, children are sorted by their render order before drawing.',\n editor: 'toggle',\n })\n sortableChildren: boolean = false;\n\n init(obj?: Render3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport type { Material, Mesh, Object3D } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Render3D from './Render3D';\n\n@decorators.componentObserver({\n Render3D: ['visible', 'opacity', 'renderOrder', 'sortableChildren'],\n})\nexport default class Render3DSystem extends Renderer3D {\n static systemName = 'Render3DSystem';\n name: string = 'Render3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Render3D') return;\n if (changed.type === OBSERVER_TYPE.REMOVE) {\n const root = this.threeContext.object3DFor(changed.gameObject.id);\n if (root) this.apply(root, { visible: true, opacity: 1, renderOrder: 0, sortableChildren: false } as Render3D);\n return;\n }\n this.applyTo(changed.gameObject, changed.component as Render3D);\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Render3D) as Render3D;\n if (!component) return;\n this.applyTo(gameObject, component);\n }\n\n private applyTo(gameObject: GameObject, component: Render3D) {\n const root = this.threeContext.object3DFor(gameObject.id);\n if (!root) return;\n this.apply(root, component);\n if (component.sortableChildren) {\n this.sortChildren(gameObject, root);\n }\n }\n\n private apply(root: Object3D, component: Render3D) {\n root.visible = component.visible;\n root.traverse((child) => {\n child.renderOrder = component.renderOrder;\n const mesh = child as Mesh;\n if (!mesh.isMesh || !mesh.material) return;\n const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];\n for (const material of materials as Material[]) {\n const mat = material as Material & { opacity?: number; transparent?: boolean };\n if (typeof mat.opacity === 'number') {\n mat.opacity = component.opacity;\n mat.transparent = component.opacity < 1;\n }\n }\n });\n }\n\n private sortChildren(gameObject: GameObject, root: Object3D) {\n const ranked = gameObject.children\n ?.map((childGo) => {\n if (!childGo) return null;\n const node = this.threeContext.object3DFor(childGo.id);\n if (!node || node.parent !== root) return null;\n const render = childGo.getComponent(Render3D) as Render3D | undefined;\n return { node, order: render?.renderOrder ?? 0 };\n })\n .filter((item): item is { node: Object3D; order: number } => !!item)\n .sort((a, b) => a.order - b.order);\n if (!ranked?.length) return;\n for (const item of ranked) {\n root.add(item.node);\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Camera3DParams {\n fov?: number;\n near?: number;\n far?: number;\n active?: boolean;\n lookAtX?: number;\n lookAtY?: number;\n lookAtZ?: number;\n lookAt?: boolean;\n}\n\nexport default class Camera3D extends Component<Camera3DParams> {\n static componentName: string = 'Camera3D';\n\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'fov',\n description: 'Vertical field of view in degrees.',\n editor: 'number-stepper',\n })\n fov: number = 75;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Camera3D',\n label: 'near',\n description: 'Near clipping plane.',\n editor: 'number-stepper',\n })\n near: number = 0.1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'far',\n description: 'Far clipping plane.',\n editor: 'number-stepper',\n })\n far: number = 1000;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'active',\n description: 'Use this camera for rendering.',\n editor: 'toggle',\n })\n active: boolean = true;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'lookAt',\n description: 'Point the camera at lookAtX/Y/Z each frame.',\n editor: 'toggle',\n })\n lookAt: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtX',\n description: 'World-space look-at target on X.',\n editor: 'number-stepper',\n })\n lookAtX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtY',\n description: 'World-space look-at target on Y.',\n editor: 'number-stepper',\n })\n lookAtY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtZ',\n description: 'World-space look-at target on Z.',\n editor: 'number-stepper',\n })\n lookAtZ: number = 0;\n\n init(obj?: Camera3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport { PerspectiveCamera } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Camera3D from './Camera3D';\nimport Transform3D from './Transform3D';\nimport { isIdentityPose } from './pose';\n\n@decorators.componentObserver({\n Camera3D: ['fov', 'near', 'far', 'active', 'lookAt', 'lookAtX', 'lookAtY', 'lookAtZ'],\n})\nexport default class Camera3DSystem extends Renderer3D {\n static systemName = 'Camera3DSystem';\n name: string = 'Camera3DSystem';\n\n private cameras = new Map<number, PerspectiveCamera>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Camera3D') return;\n const component = changed.component as Camera3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else {\n this.sync(changed.gameObject, component);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Camera3D) as Camera3D;\n const camera = this.cameras.get(gameObject.id);\n if (!component || !camera) return;\n if (component.lookAt) {\n camera.lookAt(component.lookAtX, component.lookAtY, component.lookAtZ);\n }\n }\n\n private mount(gameObject: GameObject, component: Camera3D) {\n this.ensureTransform(gameObject);\n const camera = new PerspectiveCamera(\n component.fov,\n this.threeContext.camera.aspect,\n component.near,\n component.far,\n );\n this.threeContext.attachVisual(gameObject.id, camera, gameObject);\n this.cameras.set(gameObject.id, camera);\n this.sync(gameObject, component);\n }\n\n private sync(gameObject: GameObject, component: Camera3D) {\n const camera = this.cameras.get(gameObject.id);\n if (!camera) return;\n camera.fov = component.fov;\n camera.near = component.near;\n camera.far = component.far;\n camera.updateProjectionMatrix();\n if (component.active) {\n this.threeContext.setActiveCamera(camera);\n } else if (this.threeContext.camera === camera) {\n this.activateAnother(gameObject.id);\n }\n }\n\n private unmount(id: number) {\n const camera = this.cameras.get(id);\n if (!camera) return;\n this.threeContext.detachVisual(id, camera);\n this.cameras.delete(id);\n if (this.threeContext.camera === camera) {\n this.activateAnother(id);\n }\n }\n\n private activateAnother(exceptId: number) {\n for (const [id, camera] of this.cameras) {\n if (id === exceptId) continue;\n const go = this.game.gameObjects.find((item) => item.id === id);\n const component = go?.getComponent(Camera3D) as Camera3D | undefined;\n if (component?.active) {\n this.threeContext.setActiveCamera(camera);\n return;\n }\n }\n this.threeContext.restoreFallbackCamera();\n }\n\n private ensureTransform(gameObject: GameObject) {\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n transform.positionZ = 5;\n gameObject.addComponent(transform);\n return;\n }\n if (isIdentityPose(transform)) {\n transform.positionZ = 5;\n }\n }\n\n onDestroy() {\n for (const [id] of this.cameras) {\n this.unmount(id);\n }\n this.cameras.clear();\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport type Light3DKind = 'ambient' | 'directional' | 'hemisphere' | 'point' | 'spot';\n\nexport interface Light3DParams {\n type?: Light3DKind | string;\n color?: number;\n intensity?: number;\n castShadow?: boolean;\n skyColor?: number;\n groundColor?: number;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n}\n\nexport default class Light3D extends Component<Light3DParams> {\n static componentName: string = 'Light3D';\n\n @Field({\n type: 'string',\n group: 'Light3D',\n label: 'type',\n description: 'Light kind.',\n editor: 'enum',\n enumOptions: ['ambient', 'directional', 'hemisphere', 'point', 'spot'],\n })\n type: string = 'directional';\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'color',\n description: 'Light color (hex).',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'number',\n step: 0.05,\n group: 'Light3D',\n label: 'intensity',\n description: 'Light intensity.',\n editor: 'number-stepper',\n })\n intensity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Light3D',\n label: 'castShadow',\n description: 'Whether this light casts shadows.',\n editor: 'toggle',\n })\n castShadow: boolean = false;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'skyColor',\n description: 'Hemisphere sky color (hex).',\n editor: 'number-stepper',\n })\n skyColor: number = 0xffffff;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'groundColor',\n description: 'Hemisphere ground color (hex).',\n editor: 'number-stepper',\n })\n groundColor: number = 0x444444;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'distance',\n description: 'Range for point and spot lights. 0 means no limit.',\n editor: 'number-stepper',\n })\n distance: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'decay',\n description: 'Intensity falloff for point and spot lights.',\n editor: 'number-stepper',\n })\n decay: number = 2;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Light3D',\n label: 'angle',\n description: 'Spot light cone angle in radians.',\n editor: 'number-stepper',\n })\n angle: number = Math.PI / 3;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Light3D',\n label: 'penumbra',\n description: 'Spot light soft edge (0–1).',\n editor: 'number-slider',\n })\n penumbra: number = 0;\n\n init(obj?: Light3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport {\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n PointLight,\n SpotLight,\n} from 'three';\nimport type { Light } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Light3D from './Light3D';\nimport Transform3D from './Transform3D';\n\n@decorators.componentObserver({\n Light3D: [\n 'type', 'color', 'intensity', 'castShadow',\n 'skyColor', 'groundColor', 'distance', 'decay', 'angle', 'penumbra',\n ],\n})\nexport default class Light3DSystem extends Renderer3D {\n static systemName = 'Light3DSystem';\n name: string = 'Light3DSystem';\n\n private lights = new Map<number, Light>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Light3D') return;\n const component = changed.component as Light3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else if (changed.prop?.prop?.[0] === 'type') {\n this.unmount(changed.gameObject.id);\n this.mount(changed.gameObject, component);\n } else {\n this.sync(changed.gameObject.id, component);\n }\n }\n\n rendererUpdate(_gameObject: GameObject) {}\n\n private mount(gameObject: GameObject, component: Light3D) {\n this.ensureTransform(gameObject);\n if (this.lights.size === 0) {\n this.threeContext.removeDefaultLights();\n }\n const light = this.createLight(component);\n this.threeContext.attachVisual(gameObject.id, light, gameObject);\n this.lights.set(gameObject.id, light);\n this.sync(gameObject.id, component);\n }\n\n private createLight(component: Light3D): Light {\n switch (component.type) {\n case 'ambient':\n return new AmbientLight(component.color, component.intensity);\n case 'hemisphere':\n return new HemisphereLight(component.skyColor, component.groundColor, component.intensity);\n case 'point':\n return new PointLight(component.color, component.intensity, component.distance, component.decay);\n case 'spot':\n return new SpotLight(\n component.color,\n component.intensity,\n component.distance,\n component.angle,\n component.penumbra,\n component.decay,\n );\n case 'directional':\n default:\n return new DirectionalLight(component.color, component.intensity);\n }\n }\n\n private sync(id: number, component: Light3D) {\n const light = this.lights.get(id);\n if (!light) return;\n if ('color' in light && (light as DirectionalLight).color) {\n (light as DirectionalLight).color.set(component.color);\n }\n light.intensity = component.intensity;\n if (light instanceof HemisphereLight) {\n light.color.set(component.skyColor);\n light.groundColor.set(component.groundColor);\n }\n if (light instanceof PointLight || light instanceof SpotLight) {\n light.distance = component.distance;\n light.decay = component.decay;\n }\n if (light instanceof SpotLight) {\n light.angle = component.angle;\n light.penumbra = component.penumbra;\n }\n if ('castShadow' in light) {\n (light as DirectionalLight).castShadow = !!(component.castShadow && this.threeContext.shadows);\n }\n }\n\n private unmount(id: number) {\n const light = this.lights.get(id);\n if (!light) return;\n this.threeContext.detachVisual(id, light);\n light.dispose?.();\n this.lights.delete(id);\n }\n\n private ensureTransform(gameObject: GameObject) {\n if (gameObject.getComponent(Transform3D)) return;\n gameObject.addComponent(new Transform3D());\n }\n\n onDestroy() {\n for (const [id] of this.lights) {\n this.unmount(id);\n }\n this.lights.clear();\n }\n}\n","import { resource } from '@combos-fun/engine';\nimport type { ResourceStruct } from '@combos-fun/engine';\nimport { SRGBColorSpace, Texture } from 'three';\n\nexport async function requireNamedResource(name: string): Promise<ResourceStruct> {\n const trimmed = String(name ?? '').trim();\n if (!trimmed) {\n throw new Error('resource name is required; register it with resource.addResource');\n }\n const res = await resource.getResource(trimmed);\n if (!res || !res.name) {\n throw new Error(\n `Unknown resource \"${trimmed}\"; register it with resource.addResource first`,\n );\n }\n return res;\n}\n\nexport function textureFromResourceImage(res: ResourceStruct): Texture {\n const image = res.data?.image as HTMLImageElement | undefined;\n if (!image) {\n throw new Error(\n `Resource \"${res.name}\" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`,\n );\n }\n const texture = new Texture(image);\n texture.colorSpace = SRGBColorSpace;\n texture.needsUpdate = true;\n return texture;\n}\n\nexport async function textureFromNamedImage(name: string): Promise<Texture> {\n // Always build a Three.Texture from data.image so 2D Pixi\n // registerInstance(IMAGE) is never overwritten or reused.\n return textureFromResourceImage(await requireNamedResource(name));\n}\n"],"names":["NoToneMapping","ACESFilmicToneMapping","LinearToneMapping","ReinhardToneMapping","CineonToneMapping","Vector3","Euler","Scene","PerspectiveCamera","WebGLRenderer","PCFSoftShadowMap","AmbientLight","DirectionalLight","HemisphereLight","Fog","Clock","AnimationMixer","Group","OBSERVER_TYPE","Component","__decorate","Field","Renderer3DSystem","System","decorators","PointLight","SpotLight","resource","Texture","SRGBColorSpace"],"mappings":";;;;;;;AAEO,MAAM,qBAAqB,GAAG;AAC9B,MAAM,kBAAkB,GAAG;AAE5B,SAAU,iBA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;;;;;;"}
@@ -1 +1 @@
1
- "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("three"),r=require("@combos-fun/inspector-decorator");const s="combosGameObjectId",n="combosTransform3D";function i(e){return!!e?.userData?.[n]}function a(e,t){e.traverse(e=>{e.userData[s]=t})}function c(e){let t=e;for(;t;){const e=t.userData?.[s];if("number"==typeof e)return e;t=t.parent}}function p(e){if(!e)return!0;const t=e.parent;return!t||t===e.scene}function d(e){return{positionX:e.positionX??0,positionY:e.positionY??0,positionZ:e.positionZ??0,rotationX:e.rotationX??0,rotationY:e.rotationY??0,rotationZ:e.rotationZ??0,scaleX:e.scaleX??1,scaleY:e.scaleY??1,scaleZ:e.scaleZ??1}}function h(e){const t=d(e);return[t.positionX,t.positionY,t.positionZ,t.rotationX,t.rotationY,t.rotationZ,t.scaleX,t.scaleY,t.scaleZ].join(",")}function l(e,t){const o=d(e);t.positionX=o.positionX,t.positionY=o.positionY,t.positionZ=o.positionZ,t.rotationX=o.rotationX,t.rotationY=o.rotationY,t.rotationZ=o.rotationZ,t.scaleX=o.scaleX,t.scaleY=o.scaleY,t.scaleZ=o.scaleZ}function m(e){const t=d(e);return 0===t.positionX&&0===t.positionY&&0===t.positionZ&&0===t.rotationX&&0===t.rotationY&&0===t.rotationZ&&1===t.scaleX&&1===t.scaleY&&1===t.scaleZ}function u(e,t){m(t)&&!m(e)&&l(e,t)}const g={none:o.NoToneMapping,aces:o.ACESFilmicToneMapping,linear:o.LinearToneMapping,reinhard:o.ReinhardToneMapping,cineon:o.CineonToneMapping},y=new o.Vector3,b=new o.Euler;class f{constructor(e){this.mixers=new Map,this.models=new Map,this.nodes=new Map,this.defaultLights=[];const{canvas:t,container:r,width:s,height:n,antialias:i=!0,backgroundColor:a=0,backgroundAlpha:c=1}=e;this.scene=new o.Scene,this.shadows=!!e.shadows,this.camera=new o.PerspectiveCamera(75,s/n,.1,1e3),this.camera.position.z=5,this.fallbackCamera=this.camera;const p={antialias:i};t&&(p.canvas=t),c<1&&(p.alpha=!0),this.renderer=new o.WebGLRenderer(p),this.renderer.setSize(s,n),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setClearColor(a,c),this.renderer.toneMapping=g[e.toneMapping??"aces"]??o.ACESFilmicToneMapping,this.renderer.toneMappingExposure=e.toneMappingExposure??1,this.shadows&&(this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=o.PCFSoftShadowMap),!t&&r&&r.appendChild(this.renderer.domElement);const d=new o.AmbientLight(16777215,e.ambientIntensity??.6);this.scene.add(d),this.defaultLights.push(d);const h=new o.DirectionalLight(16777215,e.directionalIntensity??.8);if(h.position.set(5,10,7.5),this.shadows&&(h.castShadow=!0,h.shadow.mapSize.set(1024,1024)),this.scene.add(h),this.defaultLights.push(h),!1!==e.hemisphereLight){const t="object"==typeof e.hemisphereLight?e.hemisphereLight:{},r=new o.HemisphereLight(t.skyColor??16777215,t.groundColor??4473924,t.intensity??.35);this.scene.add(r),this.defaultLights.push(r)}if(e.fog){const t="object"==typeof e.fog?e.fog:{};this.scene.fog=new o.Fog(t.color??a,t.near??8,t.far??40)}this.clock=new o.Clock}update(){const e=this.clock.getDelta();for(const t of this.mixers.values())t.update(e);this.renderer.render(this.scene,this.camera)}hasTransform3DRoot(e){return i(this.nodes.get(e))}applyModelShadows(e){this.shadows&&e.traverse(e=>{const t=e;t.isMesh&&(t.castShadow=!0,t.receiveShadow=!0)})}attachParsedModel(e,t,r,s){if(a(t,e),this.applyModelShadows(t),this.models.set(e,t),this.attachVisual(e,t,s),r&&r.length>0){const s=new o.AnimationMixer(t);this.mixers.set(e,s),t.userData.animations=r}return t}object3DFor(e){return this.nodes.get(e)}attachObject3D(e,t,o){const r=this.nodes.get(e);r&&r!==t&&(this.rehomeRegisteredChildren(r),r.parent?.remove(r)),this.nodes.set(e,t);const s=this.findParentNode(o);t.parent!==s&&s.add(t),o&&this.adoptChildGameObjects(o,t)}attachVisual(e,t,o){a(t,e);const r=this.nodes.get(e);i(r)&&r!==t?t.parent!==r&&r.add(t):this.attachObject3D(e,t,o)}detachVisual(e,t){const o=this.nodes.get(e);return i(o)&&o!==t?(t.parent?.remove(t),t):o===t?this.detachObject3D(e):(t.parent?.remove(t),t)}detachObject3D(e){const t=this.nodes.get(e);if(t)return this.rehomeRegisteredChildren(t),t.parent?.remove(t),this.nodes.delete(e),t}reparentGameObject(e){const t=this.nodes.get(e.id);if(!t)return;const o=this.findParentNode(e);t.parent!==o&&o.add(t)}findParentNode(e){if(!e||p(e))return this.scene;let t=e.parent;for(;t&&t!==e.scene;){const e=this.nodes.get(t.id);if(e)return e;t=t.parent}return this.scene}adoptChildGameObjects(e,t){const o=e.children;if(o)for(const e of o){if(!e)continue;const o=this.nodes.get(e.id);o&&o.parent!==t&&t.add(o)}}ensureTransformRoot(e,t){const r=this.nodes.get(e.id);if(i(r))return this.applyTransformPose(r,t),r;const s=new o.Group;if(s.name=e.name,s.userData[n]=!0,a(s,e.id),r&&r!==s){(function(e){const t=d(e);return 0===t.positionX&&0===t.positionY&&0===t.positionZ&&0===t.rotationX&&0===t.rotationY&&0===t.rotationZ&&1===t.scaleX&&1===t.scaleY&&1===t.scaleZ})(t)&&(t.positionX=r.position.x,t.positionY=r.position.y,t.positionZ=r.position.z,t.rotationX=r.rotation.x,t.rotationY=r.rotation.y,t.rotationZ=r.rotation.z,t.scaleX=r.scale.x,t.scaleY=r.scale.y,t.scaleZ=r.scale.z);(r.parent||this.scene).add(s),s.add(r),r.position.set(0,0,0),r.rotation.set(0,0,0),r.scale.set(1,1,1),this.nodes.set(e.id,s),this.adoptChildGameObjects(e,s)}else this.attachObject3D(e.id,s,e);return this.applyTransformPose(s,t),s}applyTransform3D(e,t){const o=this.ensureTransformRoot(e,t);return this.applyTransformPose(o,t),o.updateWorldMatrix(!0,!1),o.getWorldPosition(y),t.worldPositionX=y.x,t.worldPositionY=y.y,t.worldPositionZ=y.z,b.setFromRotationMatrix(o.matrixWorld),t.worldRotationX=b.x,t.worldRotationY=b.y,t.worldRotationZ=b.z,o}applyTransformPose(e,t){const o=d(t);e.position.set(o.positionX,o.positionY,o.positionZ),e.rotation.set(o.rotationX,o.rotationY,o.rotationZ),e.scale.set(o.scaleX,o.scaleY,o.scaleZ)}removeDefaultLights(){if(this.defaultLights.length){for(const e of this.defaultLights)e.parent?.remove(e),e.dispose?.();this.defaultLights=[]}}setActiveCamera(e){const t=this.camera;this.camera=e,t&&(e.aspect=t.aspect),e.updateProjectionMatrix()}restoreFallbackCamera(){this.camera!==this.fallbackCamera&&this.setActiveCamera(this.fallbackCamera)}rehomeRegisteredChildren(e){for(const t of[...e.children]){const e=t.userData?.[s];"number"==typeof e&&this.nodes.get(e)===t&&this.scene.add(t)}}playAnimation(e,t,o){const r=this.mixers.get(e),s=this.models.get(e);if(!r||!s)return;r.stopAllAction();const n=s.userData.animations;if(n&&n[t]){const e=r.clipAction(n[t]);e.timeScale=o,e.play()}}stopAnimation(e){const t=this.mixers.get(e);t&&t.stopAllAction()}removeModel(e){const t=this.models.get(e);t&&(this.detachVisual(e,t),t.traverse(e=>{const t=e;if(t.geometry&&t.geometry.dispose(),t.material){(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>e.dispose())}}),this.models.delete(e));const o=this.mixers.get(e);o&&(o.stopAllAction(),this.mixers.delete(e))}resize(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.fallbackCamera!==this.camera&&(this.fallbackCamera.aspect=e/t,this.fallbackCamera.updateProjectionMatrix()),this.renderer.setSize(e,t)}destroy(){for(const e of this.models.keys())this.removeModel(e);this.removeDefaultLights(),this.renderer.dispose(),this.renderer.domElement.remove(),this.nodes.clear(),this.scene=null,this.camera=null,this.fallbackCamera=null,this.renderer=null,this.clock=null}}class C{constructor({game:e,rendererSystem:t}){this.renderers=[],this.game=e,this.rendererSystem=t}register(...e){for(const t of e)t.game=this.game,t.rendererManager=this,t.threeContext=this.rendererSystem.threeContext,this.renderers.push(t)}componentChanged(e){for(const o of e)for(const e of this.renderers){const r=e.observerInfo[o.componentName];if(!r)continue;if(o.type===t.OBSERVER_TYPE.ADD||o.type===t.OBSERVER_TYPE.REMOVE){try{e.componentChanged(o)}catch(e){console.error(`gameObject: ${o.gameObject.name}, ${o.componentName} error.`,o,e)}continue}if(r.findIndex(e=>"string"==typeof e&&"string"==typeof o.prop?e===o.prop:JSON.stringify(e)===JSON.stringify(o.prop))>-1)try{e.componentChanged(o)}catch(e){console.error(`gameObject: ${o.gameObject?.name}, ${o.componentName} componentChanged error.`,o,e)}}}update(e){for(const t of e.components)for(const o of this.renderers){if(o.observerInfo[t.name])try{o.rendererUpdate(e)}catch(o){console.info(`gameObject: ${e.name}, ${t.name} update error`,o)}}}}class D extends t.Component{constructor(){super(...arguments),this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1,this.scaleZ=1,this.worldPositionX=0,this.worldPositionY=0,this.worldPositionZ=0,this.worldRotationX=0,this.worldRotationY=0,this.worldRotationZ=0}static{this.componentName="Transform3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],D.prototype,"positionX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],D.prototype,"positionY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],D.prototype,"positionZ",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],D.prototype,"rotationX",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],D.prototype,"rotationY",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],D.prototype,"rotationZ",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],D.prototype,"scaleX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],D.prototype,"scaleY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleZ",description:"Scale on Z.",editor:"number-stepper"})],D.prototype,"scaleZ",void 0);let v=class extends t.System{constructor(){super(...arguments),this.name="Renderer3DSystem"}static{this.systemName="Renderer3DSystem"}init(e){const t=e||{},o=t.width||750,r=t.height||1334;this.threeContext=new f({canvas:t.canvas,container:t.container,width:o,height:r,antialias:t.antialias,backgroundColor:t.backgroundColor,backgroundAlpha:t.backgroundAlpha,fog:t.fog,hemisphereLight:t.hemisphereLight,shadows:t.shadows,toneMapping:t.toneMapping,toneMappingExposure:t.toneMappingExposure,ambientIntensity:t.ambientIntensity,directionalIntensity:t.directionalIntensity}),this.game.canvas=this.threeContext.renderer.domElement,this.rendererManager=new C({game:this.game,rendererSystem:this})}update(e){const t=this.componentObserver.clear();for(const e of t)this.handleHierarchyChange(e);for(const e of this.game.gameObjects){const t=e.getComponent(D);t&&this.threeContext.applyTransform3D(e,t),this.rendererManager.update(e)}}handleHierarchyChange(e){"GameObject"===e.componentName&&(e.type!==t.OBSERVER_TYPE.CHANGE&&e.type!==t.OBSERVER_TYPE.ADD||(this.ensureTransform3D(e.gameObject),e.gameObject.parent&&this.ensureTransform3D(e.gameObject.parent),this.threeContext?.reparentGameObject(e.gameObject)))}ensureTransform3D(e){if(!e||e===e.scene)return;let t=e.getComponent(D);t||(t=new D,e.addComponent(t)),this.threeContext?.ensureTransformRoot(e,t)}lateUpdate(){this.threeContext?.update()}resize(e,t){this.threeContext?.resize(e,t)}onDestroy(){this.threeContext?.destroy(),this.threeContext=null}};v=e.__decorate([t.decorators.componentObserver({GameObject:["parent"]})],v);var x=v;Object.assign(x,{packageName:"@combos-fun/plugin-renderer-3d",packageVersion:"0.1.2"});class O extends t.System{constructor(e){super(e),this.asyncIdMap={};const t=this.constructor;this.observerInfo=t.observerInfo}componentChanged(e){}rendererUpdate(e){}update(e){const t=this.componentObserver.clear();for(const e of t)this.componentChanged(e)}increaseAsyncId(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]}validateAsyncId(e,t){return this.asyncIdMap[e]===t}}const w=new Set(["positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ"]);let R=class extends O{constructor(){super(...arguments),this.name="Transform3DSystem"}static{this.systemName="Transform3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("GameObject"===e.componentName)return this.ensureOn(e.gameObject),e.gameObject.parent&&this.ensureOn(e.gameObject.parent),void this.threeContext.reparentGameObject(e.gameObject);"Transform3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.threeContext.ensureTransformRoot(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.threeContext.detachObject3D(e.gameObject.id):w.has(e.prop?.prop?.[0])&&this.threeContext.applyTransform3D(e.gameObject,e.component))}rendererUpdate(e){const t=e.getComponent(D);t&&this.threeContext.applyTransform3D(e,t)}ensureOn(e){if(!e||e===e.scene)return;let t=e.getComponent(D);t||(t=new D,e.addComponent(t)),this.threeContext.ensureTransformRoot(e,t)}};R=e.__decorate([t.decorators.componentObserver({Transform3D:["positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ"],GameObject:["parent"]})],R);var _=R;class S extends t.Component{constructor(){super(...arguments),this.visible=!0,this.opacity=1,this.renderOrder=0,this.sortableChildren=!1}static{this.componentName="Render3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"boolean",group:"Render3D",label:"visible",description:"Whether this object is drawn.",editor:"toggle"})],S.prototype,"visible",void 0),e.__decorate([r.Field({type:"number",step:.01,min:0,max:1,group:"Render3D",label:"opacity",description:"Opacity from 0 to 1.",editor:"number-slider"})],S.prototype,"opacity",void 0),e.__decorate([r.Field({type:"number",step:1,group:"Render3D",label:"renderOrder",description:"Draw order; higher values render on top.",editor:"number-stepper"})],S.prototype,"renderOrder",void 0),e.__decorate([r.Field({type:"boolean",group:"Render3D",label:"sortableChildren",description:"When on, children are sorted by their render order before drawing.",editor:"toggle"})],S.prototype,"sortableChildren",void 0);let j=class extends O{constructor(){super(...arguments),this.name="Render3DSystem"}static{this.systemName="Render3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Render3D"===e.componentName){if(e.type===t.OBSERVER_TYPE.REMOVE){const t=this.threeContext.object3DFor(e.gameObject.id);return void(t&&this.apply(t,{visible:!0,opacity:1,renderOrder:0,sortableChildren:!1}))}this.applyTo(e.gameObject,e.component)}}rendererUpdate(e){const t=e.getComponent(S);t&&this.applyTo(e,t)}applyTo(e,t){const o=this.threeContext.object3DFor(e.id);o&&(this.apply(o,t),t.sortableChildren&&this.sortChildren(e,o))}apply(e,t){e.visible=t.visible,e.traverse(e=>{e.renderOrder=t.renderOrder;const o=e;if(!o.isMesh||!o.material)return;const r=Array.isArray(o.material)?o.material:[o.material];for(const e of r){const o=e;"number"==typeof o.opacity&&(o.opacity=t.opacity,o.transparent=t.opacity<1)}})}sortChildren(e,t){const o=e.children?.map(e=>{if(!e)return null;const o=this.threeContext.object3DFor(e.id);if(!o||o.parent!==t)return null;const r=e.getComponent(S);return{node:o,order:r?.renderOrder??0}}).filter(e=>!!e).sort((e,t)=>e.order-t.order);if(o?.length)for(const e of o)t.add(e.node)}};j=e.__decorate([t.decorators.componentObserver({Render3D:["visible","opacity","renderOrder","sortableChildren"]})],j);var Y=j;class T extends t.Component{constructor(){super(...arguments),this.fov=75,this.near=.1,this.far=1e3,this.active=!0,this.lookAt=!1,this.lookAtX=0,this.lookAtY=0,this.lookAtZ=0}static{this.componentName="Camera3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"number",step:1,group:"Camera3D",label:"fov",description:"Vertical field of view in degrees.",editor:"number-stepper"})],T.prototype,"fov",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Camera3D",label:"near",description:"Near clipping plane.",editor:"number-stepper"})],T.prototype,"near",void 0),e.__decorate([r.Field({type:"number",step:1,group:"Camera3D",label:"far",description:"Far clipping plane.",editor:"number-stepper"})],T.prototype,"far",void 0),e.__decorate([r.Field({type:"boolean",group:"Camera3D",label:"active",description:"Use this camera for rendering.",editor:"toggle"})],T.prototype,"active",void 0),e.__decorate([r.Field({type:"boolean",group:"Camera3D",label:"lookAt",description:"Point the camera at lookAtX/Y/Z each frame.",editor:"toggle"})],T.prototype,"lookAt",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtX",description:"World-space look-at target on X.",editor:"number-stepper"})],T.prototype,"lookAtX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtY",description:"World-space look-at target on Y.",editor:"number-stepper"})],T.prototype,"lookAtY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtZ",description:"World-space look-at target on Z.",editor:"number-stepper"})],T.prototype,"lookAtZ",void 0);let E=class extends O{constructor(){super(...arguments),this.name="Camera3DSystem",this.cameras=new Map}static{this.systemName="Camera3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Camera3D"!==e.componentName)return;const o=e.component;e.type===t.OBSERVER_TYPE.ADD?this.mount(e.gameObject,o):e.type===t.OBSERVER_TYPE.REMOVE?this.unmount(e.gameObject.id):this.sync(e.gameObject,o)}rendererUpdate(e){const t=e.getComponent(T),o=this.cameras.get(e.id);t&&o&&t.lookAt&&o.lookAt(t.lookAtX,t.lookAtY,t.lookAtZ)}mount(e,t){this.ensureTransform(e);const r=new o.PerspectiveCamera(t.fov,this.threeContext.camera.aspect,t.near,t.far);this.threeContext.attachVisual(e.id,r,e),this.cameras.set(e.id,r),this.sync(e,t)}sync(e,t){const o=this.cameras.get(e.id);o&&(o.fov=t.fov,o.near=t.near,o.far=t.far,o.updateProjectionMatrix(),t.active?this.threeContext.setActiveCamera(o):this.threeContext.camera===o&&this.activateAnother(e.id))}unmount(e){const t=this.cameras.get(e);t&&(this.threeContext.detachVisual(e,t),this.cameras.delete(e),this.threeContext.camera===t&&this.activateAnother(e))}activateAnother(e){for(const[t,o]of this.cameras){if(t===e)continue;const r=this.game.gameObjects.find(e=>e.id===t),s=r?.getComponent(T);if(s?.active)return void this.threeContext.setActiveCamera(o)}this.threeContext.restoreFallbackCamera()}ensureTransform(e){let t=e.getComponent(D);if(!t)return t=new D,t.positionZ=5,void e.addComponent(t);m(t)&&(t.positionZ=5)}onDestroy(){for(const[e]of this.cameras)this.unmount(e);this.cameras.clear()}};E=e.__decorate([t.decorators.componentObserver({Camera3D:["fov","near","far","active","lookAt","lookAtX","lookAtY","lookAtZ"]})],E);var A=E;class M extends t.Component{constructor(){super(...arguments),this.type="directional",this.color=16777215,this.intensity=1,this.castShadow=!1,this.skyColor=16777215,this.groundColor=4473924,this.distance=0,this.decay=2,this.angle=Math.PI/3,this.penumbra=0}static{this.componentName="Light3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"string",group:"Light3D",label:"type",description:"Light kind.",editor:"enum",enumOptions:["ambient","directional","hemisphere","point","spot"]})],M.prototype,"type",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"color",description:"Light color (hex).",editor:"number-stepper"})],M.prototype,"color",void 0),e.__decorate([r.Field({type:"number",step:.05,group:"Light3D",label:"intensity",description:"Light intensity.",editor:"number-stepper"})],M.prototype,"intensity",void 0),e.__decorate([r.Field({type:"boolean",group:"Light3D",label:"castShadow",description:"Whether this light casts shadows.",editor:"toggle"})],M.prototype,"castShadow",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"skyColor",description:"Hemisphere sky color (hex).",editor:"number-stepper"})],M.prototype,"skyColor",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"groundColor",description:"Hemisphere ground color (hex).",editor:"number-stepper"})],M.prototype,"groundColor",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Light3D",label:"distance",description:"Range for point and spot lights. 0 means no limit.",editor:"number-stepper"})],M.prototype,"distance",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Light3D",label:"decay",description:"Intensity falloff for point and spot lights.",editor:"number-stepper"})],M.prototype,"decay",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Light3D",label:"angle",description:"Spot light cone angle in radians.",editor:"number-stepper"})],M.prototype,"angle",void 0),e.__decorate([r.Field({type:"number",step:.01,min:0,max:1,group:"Light3D",label:"penumbra",description:"Spot light soft edge (0–1).",editor:"number-slider"})],M.prototype,"penumbra",void 0);let Z=class extends O{constructor(){super(...arguments),this.name="Light3DSystem",this.lights=new Map}static{this.systemName="Light3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Light3D"!==e.componentName)return;const o=e.component;e.type===t.OBSERVER_TYPE.ADD?this.mount(e.gameObject,o):e.type===t.OBSERVER_TYPE.REMOVE?this.unmount(e.gameObject.id):"type"===e.prop?.prop?.[0]?(this.unmount(e.gameObject.id),this.mount(e.gameObject,o)):this.sync(e.gameObject.id,o)}rendererUpdate(e){}mount(e,t){this.ensureTransform(e),0===this.lights.size&&this.threeContext.removeDefaultLights();const o=this.createLight(t);this.threeContext.attachVisual(e.id,o,e),this.lights.set(e.id,o),this.sync(e.id,t)}createLight(e){switch(e.type){case"ambient":return new o.AmbientLight(e.color,e.intensity);case"hemisphere":return new o.HemisphereLight(e.skyColor,e.groundColor,e.intensity);case"point":return new o.PointLight(e.color,e.intensity,e.distance,e.decay);case"spot":return new o.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);default:return new o.DirectionalLight(e.color,e.intensity)}}sync(e,t){const r=this.lights.get(e);r&&("color"in r&&r.color&&r.color.set(t.color),r.intensity=t.intensity,r instanceof o.HemisphereLight&&(r.color.set(t.skyColor),r.groundColor.set(t.groundColor)),(r instanceof o.PointLight||r instanceof o.SpotLight)&&(r.distance=t.distance,r.decay=t.decay),r instanceof o.SpotLight&&(r.angle=t.angle,r.penumbra=t.penumbra),"castShadow"in r&&(r.castShadow=!(!t.castShadow||!this.threeContext.shadows)))}unmount(e){const t=this.lights.get(e);t&&(this.threeContext.detachVisual(e,t),t.dispose?.(),this.lights.delete(e))}ensureTransform(e){e.getComponent(D)||e.addComponent(new D)}onDestroy(){for(const[e]of this.lights)this.unmount(e);this.lights.clear()}};Z=e.__decorate([t.decorators.componentObserver({Light3D:["type","color","intensity","castShadow","skyColor","groundColor","distance","decay","angle","penumbra"]})],Z);var k=Z;async function X(e){const o=String(e??"").trim();if(!o)throw new Error("resource name is required; register it with resource.addResource");const r=await t.resource.getResource(o);if(!r||!r.name)throw new Error(`Unknown resource "${o}"; register it with resource.addResource first`);return r}function L(e){const t=e.data?.image;if(!t)throw new Error(`Resource "${e.name}" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`);const r=new o.Texture(t);return r.colorSpace=o.SRGBColorSpace,r.needsUpdate=!0,r}exports.COMBOS_GAME_OBJECT_ID=s,exports.COMBOS_TRANSFORM3D=n,exports.Camera3D=T,exports.Camera3DSystem=A,exports.Light3D=M,exports.Light3DSystem=k,exports.Render3D=S,exports.Render3DSystem=Y,exports.Renderer3D=O,exports.Renderer3DManager=C,exports.Renderer3DSystem=x,exports.ThreeContext=f,exports.Transform3D=D,exports.Transform3DSystem=_,exports.VisualPoseBridge=class{constructor(){this.lastVisual="",this.lastRoot=""}sync(e,t){if(!t)return!0;if(""===this.lastVisual&&""===this.lastRoot)return u(e,t),this.lastVisual=h(e),this.lastRoot=h(t),!1;const o=h(e),r=h(t);return o!==this.lastVisual&&r===this.lastRoot&&l(e,t),this.lastVisual=h(e),this.lastRoot=h(t),!1}},exports.copyPose=l,exports.gameObjectIdFromIntersection=function(e){return c(e?.object)},exports.gameObjectIdFromObject3D=c,exports.has3DChildGameObjects=function(e){return(e?.children?.length??0)>0},exports.is3DSceneParent=p,exports.isIdentityPose=m,exports.isTransform3DRoot=i,exports.poseKeyOf=h,exports.readPose=d,exports.requireNamedResource=X,exports.seedTransform3D=u,exports.tagObject3D=a,exports.textureFromNamedImage=async function(e){return L(await X(e))},exports.textureFromResourceImage=L;
1
+ "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("three"),r=require("@combos-fun/inspector-decorator");const s="combosGameObjectId",n="combosTransform3D";function i(e){return!!e?.userData?.[n]}function a(e,t){e.traverse(e=>{e.userData[s]=t})}function c(e){let t=e;for(;t;){const e=t.userData?.[s];if("number"==typeof e)return e;t=t.parent}}function p(e){if(!e)return!0;const t=e.parent;return!t||t===e.scene}function d(e){return{positionX:e.positionX??0,positionY:e.positionY??0,positionZ:e.positionZ??0,rotationX:e.rotationX??0,rotationY:e.rotationY??0,rotationZ:e.rotationZ??0,scaleX:e.scaleX??1,scaleY:e.scaleY??1,scaleZ:e.scaleZ??1}}function h(e){const t=d(e);return[t.positionX,t.positionY,t.positionZ,t.rotationX,t.rotationY,t.rotationZ,t.scaleX,t.scaleY,t.scaleZ].join(",")}function l(e,t){const o=d(e);t.positionX=o.positionX,t.positionY=o.positionY,t.positionZ=o.positionZ,t.rotationX=o.rotationX,t.rotationY=o.rotationY,t.rotationZ=o.rotationZ,t.scaleX=o.scaleX,t.scaleY=o.scaleY,t.scaleZ=o.scaleZ}function m(e){const t=d(e);return 0===t.positionX&&0===t.positionY&&0===t.positionZ&&0===t.rotationX&&0===t.rotationY&&0===t.rotationZ&&1===t.scaleX&&1===t.scaleY&&1===t.scaleZ}function u(e,t){m(t)&&!m(e)&&l(e,t)}const g={none:o.NoToneMapping,aces:o.ACESFilmicToneMapping,linear:o.LinearToneMapping,reinhard:o.ReinhardToneMapping,cineon:o.CineonToneMapping},y=new o.Vector3,b=new o.Euler;class f{constructor(e){this.mixers=new Map,this.models=new Map,this.nodes=new Map,this.defaultLights=[];const{canvas:t,container:r,width:s,height:n,antialias:i=!0,backgroundColor:a=0,backgroundAlpha:c=1}=e;this.scene=new o.Scene,this.shadows=!!e.shadows,this.camera=new o.PerspectiveCamera(75,s/n,.1,1e3),this.camera.position.z=5,this.fallbackCamera=this.camera;const p={antialias:i};t&&(p.canvas=t),c<1&&(p.alpha=!0),this.renderer=new o.WebGLRenderer(p),this.renderer.setSize(s,n),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setClearColor(a,c),this.renderer.toneMapping=g[e.toneMapping??"aces"]??o.ACESFilmicToneMapping,this.renderer.toneMappingExposure=e.toneMappingExposure??1,this.shadows&&(this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=o.PCFSoftShadowMap),!t&&r&&r.appendChild(this.renderer.domElement);const d=new o.AmbientLight(16777215,e.ambientIntensity??.6);this.scene.add(d),this.defaultLights.push(d);const h=new o.DirectionalLight(16777215,e.directionalIntensity??.8);if(h.position.set(5,10,7.5),this.shadows&&(h.castShadow=!0,h.shadow.mapSize.set(1024,1024)),this.scene.add(h),this.defaultLights.push(h),!1!==e.hemisphereLight){const t="object"==typeof e.hemisphereLight?e.hemisphereLight:{},r=new o.HemisphereLight(t.skyColor??16777215,t.groundColor??4473924,t.intensity??.35);this.scene.add(r),this.defaultLights.push(r)}if(e.fog){const t="object"==typeof e.fog?e.fog:{};this.scene.fog=new o.Fog(t.color??a,t.near??8,t.far??40)}this.clock=new o.Clock}update(){const e=this.clock.getDelta();for(const t of this.mixers.values())t.update(e);this.renderer.render(this.scene,this.camera)}hasTransform3DRoot(e){return i(this.nodes.get(e))}applyModelShadows(e){this.shadows&&e.traverse(e=>{const t=e;t.isMesh&&(t.castShadow=!0,t.receiveShadow=!0)})}attachParsedModel(e,t,r,s){if(a(t,e),this.applyModelShadows(t),this.models.set(e,t),this.attachVisual(e,t,s),r&&r.length>0){const s=new o.AnimationMixer(t);this.mixers.set(e,s),t.userData.animations=r}return t}object3DFor(e){return this.nodes.get(e)}attachObject3D(e,t,o){const r=this.nodes.get(e);r&&r!==t&&(this.rehomeRegisteredChildren(r),r.parent?.remove(r)),this.nodes.set(e,t);const s=this.findParentNode(o);t.parent!==s&&s.add(t),o&&this.adoptChildGameObjects(o,t)}attachVisual(e,t,o){a(t,e);const r=this.nodes.get(e);i(r)&&r!==t?t.parent!==r&&r.add(t):this.attachObject3D(e,t,o)}detachVisual(e,t){const o=this.nodes.get(e);return i(o)&&o!==t?(t.parent?.remove(t),t):o===t?this.detachObject3D(e):(t.parent?.remove(t),t)}detachObject3D(e){const t=this.nodes.get(e);if(t)return this.rehomeRegisteredChildren(t),t.parent?.remove(t),this.nodes.delete(e),t}reparentGameObject(e){const t=this.nodes.get(e.id);if(!t)return;const o=this.findParentNode(e);t.parent!==o&&o.add(t)}findParentNode(e){if(!e||p(e))return this.scene;let t=e.parent;for(;t&&t!==e.scene;){const e=this.nodes.get(t.id);if(e)return e;t=t.parent}return this.scene}adoptChildGameObjects(e,t){const o=e.children;if(o)for(const e of o){if(!e)continue;const o=this.nodes.get(e.id);o&&o.parent!==t&&t.add(o)}}ensureTransformRoot(e,t){const r=this.nodes.get(e.id);if(i(r))return this.applyTransformPose(r,t),r;const s=new o.Group;if(s.name=e.name,s.userData[n]=!0,a(s,e.id),r&&r!==s){(function(e){const t=d(e);return 0===t.positionX&&0===t.positionY&&0===t.positionZ&&0===t.rotationX&&0===t.rotationY&&0===t.rotationZ&&1===t.scaleX&&1===t.scaleY&&1===t.scaleZ})(t)&&(t.positionX=r.position.x,t.positionY=r.position.y,t.positionZ=r.position.z,t.rotationX=r.rotation.x,t.rotationY=r.rotation.y,t.rotationZ=r.rotation.z,t.scaleX=r.scale.x,t.scaleY=r.scale.y,t.scaleZ=r.scale.z);(r.parent||this.scene).add(s),s.add(r),r.position.set(0,0,0),r.rotation.set(0,0,0),r.scale.set(1,1,1),this.nodes.set(e.id,s),this.adoptChildGameObjects(e,s)}else this.attachObject3D(e.id,s,e);return this.applyTransformPose(s,t),s}applyTransform3D(e,t){const o=this.ensureTransformRoot(e,t);return this.applyTransformPose(o,t),o.updateWorldMatrix(!0,!1),o.getWorldPosition(y),t.worldPositionX=y.x,t.worldPositionY=y.y,t.worldPositionZ=y.z,b.setFromRotationMatrix(o.matrixWorld),t.worldRotationX=b.x,t.worldRotationY=b.y,t.worldRotationZ=b.z,o}applyTransformPose(e,t){const o=d(t);e.position.set(o.positionX,o.positionY,o.positionZ),e.rotation.set(o.rotationX,o.rotationY,o.rotationZ),e.scale.set(o.scaleX,o.scaleY,o.scaleZ)}removeDefaultLights(){if(this.defaultLights.length){for(const e of this.defaultLights)e.parent?.remove(e),e.dispose?.();this.defaultLights=[]}}setActiveCamera(e){const t=this.camera;this.camera=e,t&&(e.aspect=t.aspect),e.updateProjectionMatrix()}restoreFallbackCamera(){this.camera!==this.fallbackCamera&&this.setActiveCamera(this.fallbackCamera)}rehomeRegisteredChildren(e){for(const t of[...e.children]){const e=t.userData?.[s];"number"==typeof e&&this.nodes.get(e)===t&&this.scene.add(t)}}playAnimation(e,t,o){const r=this.mixers.get(e),s=this.models.get(e);if(!r||!s)return;r.stopAllAction();const n=s.userData.animations;if(n&&n[t]){const e=r.clipAction(n[t]);e.timeScale=o,e.play()}}stopAnimation(e){const t=this.mixers.get(e);t&&t.stopAllAction()}removeModel(e){const t=this.models.get(e);t&&(this.detachVisual(e,t),t.traverse(e=>{const t=e;if(t.geometry&&t.geometry.dispose(),t.material){(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>e.dispose())}}),this.models.delete(e));const o=this.mixers.get(e);o&&(o.stopAllAction(),this.mixers.delete(e))}resize(e,t){this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.fallbackCamera!==this.camera&&(this.fallbackCamera.aspect=e/t,this.fallbackCamera.updateProjectionMatrix()),this.renderer.setSize(e,t)}destroy(){for(const e of this.models.keys())this.removeModel(e);this.removeDefaultLights(),this.renderer.dispose(),this.renderer.domElement.remove(),this.nodes.clear(),this.scene=null,this.camera=null,this.fallbackCamera=null,this.renderer=null,this.clock=null}}class C{constructor({game:e,rendererSystem:t}){this.renderers=[],this.game=e,this.rendererSystem=t}register(...e){for(const t of e)t.game=this.game,t.rendererManager=this,t.threeContext=this.rendererSystem.threeContext,this.renderers.push(t)}componentChanged(e){for(const o of e)for(const e of this.renderers){const r=e.observerInfo[o.componentName];if(!r)continue;if(o.type===t.OBSERVER_TYPE.ADD||o.type===t.OBSERVER_TYPE.REMOVE){try{e.componentChanged(o)}catch(e){console.error(`gameObject: ${o.gameObject.name}, ${o.componentName} error.`,o,e)}continue}if(r.findIndex(e=>"string"==typeof e&&"string"==typeof o.prop?e===o.prop:JSON.stringify(e)===JSON.stringify(o.prop))>-1)try{e.componentChanged(o)}catch(e){console.error(`gameObject: ${o.gameObject?.name}, ${o.componentName} componentChanged error.`,o,e)}}}update(e){for(const t of e.components)for(const o of this.renderers){if(o.observerInfo[t.name])try{o.rendererUpdate(e)}catch(o){console.info(`gameObject: ${e.name}, ${t.name} update error`,o)}}}}class D extends t.Component{constructor(){super(...arguments),this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1,this.scaleZ=1,this.worldPositionX=0,this.worldPositionY=0,this.worldPositionZ=0,this.worldRotationX=0,this.worldRotationY=0,this.worldRotationZ=0}static{this.componentName="Transform3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],D.prototype,"positionX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],D.prototype,"positionY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],D.prototype,"positionZ",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],D.prototype,"rotationX",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],D.prototype,"rotationY",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Transform3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],D.prototype,"rotationZ",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],D.prototype,"scaleX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],D.prototype,"scaleY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Transform3D",label:"scaleZ",description:"Scale on Z.",editor:"number-stepper"})],D.prototype,"scaleZ",void 0);let v=class extends t.System{constructor(){super(...arguments),this.name="Renderer3DSystem"}static{this.systemName="Renderer3DSystem"}init(e){const t=e||{},o=t.width||750,r=t.height||1334;this.threeContext=new f({canvas:t.canvas,container:t.container,width:o,height:r,antialias:t.antialias,backgroundColor:t.backgroundColor,backgroundAlpha:t.backgroundAlpha,fog:t.fog,hemisphereLight:t.hemisphereLight,shadows:t.shadows,toneMapping:t.toneMapping,toneMappingExposure:t.toneMappingExposure,ambientIntensity:t.ambientIntensity,directionalIntensity:t.directionalIntensity}),this.game.canvas=this.threeContext.renderer.domElement,this.rendererManager=new C({game:this.game,rendererSystem:this})}update(e){const t=this.componentObserver.clear();for(const e of t)this.handleHierarchyChange(e);for(const e of this.game.gameObjects){const t=e.getComponent(D);t&&this.threeContext.applyTransform3D(e,t),this.rendererManager.update(e)}}handleHierarchyChange(e){"GameObject"===e.componentName&&(e.type!==t.OBSERVER_TYPE.CHANGE&&e.type!==t.OBSERVER_TYPE.ADD||(this.ensureTransform3D(e.gameObject),e.gameObject.parent&&this.ensureTransform3D(e.gameObject.parent),this.threeContext?.reparentGameObject(e.gameObject)))}ensureTransform3D(e){if(!e||e===e.scene)return;let t=e.getComponent(D);t||(t=new D,e.addComponent(t)),this.threeContext?.ensureTransformRoot(e,t)}lateUpdate(){this.threeContext?.update()}resize(e,t){this.threeContext?.resize(e,t)}onDestroy(){this.threeContext?.destroy(),this.threeContext=null}};v=e.__decorate([t.decorators.componentObserver({GameObject:["parent"]})],v);var x=v;Object.assign(x,{packageName:"@combos-fun/plugin-renderer-3d",packageVersion:"0.1.4-beta.0"});class O extends t.System{constructor(e){super(e),this.asyncIdMap={};const t=this.constructor;this.observerInfo=t.observerInfo}componentChanged(e){}rendererUpdate(e){}update(e){const t=this.componentObserver.clear();for(const e of t)this.componentChanged(e)}increaseAsyncId(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]}validateAsyncId(e,t){return this.asyncIdMap[e]===t}}const w=new Set(["positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ"]);let R=class extends O{constructor(){super(...arguments),this.name="Transform3DSystem"}static{this.systemName="Transform3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("GameObject"===e.componentName)return this.ensureOn(e.gameObject),e.gameObject.parent&&this.ensureOn(e.gameObject.parent),void this.threeContext.reparentGameObject(e.gameObject);"Transform3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.threeContext.ensureTransformRoot(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.threeContext.detachObject3D(e.gameObject.id):w.has(e.prop?.prop?.[0])&&this.threeContext.applyTransform3D(e.gameObject,e.component))}rendererUpdate(e){const t=e.getComponent(D);t&&this.threeContext.applyTransform3D(e,t)}ensureOn(e){if(!e||e===e.scene)return;let t=e.getComponent(D);t||(t=new D,e.addComponent(t)),this.threeContext.ensureTransformRoot(e,t)}};R=e.__decorate([t.decorators.componentObserver({Transform3D:["positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ"],GameObject:["parent"]})],R);var _=R;class S extends t.Component{constructor(){super(...arguments),this.visible=!0,this.opacity=1,this.renderOrder=0,this.sortableChildren=!1}static{this.componentName="Render3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"boolean",group:"Render3D",label:"visible",description:"Whether this object is drawn.",editor:"toggle"})],S.prototype,"visible",void 0),e.__decorate([r.Field({type:"number",step:.01,min:0,max:1,group:"Render3D",label:"opacity",description:"Opacity from 0 to 1.",editor:"number-slider"})],S.prototype,"opacity",void 0),e.__decorate([r.Field({type:"number",step:1,group:"Render3D",label:"renderOrder",description:"Draw order; higher values render on top.",editor:"number-stepper"})],S.prototype,"renderOrder",void 0),e.__decorate([r.Field({type:"boolean",group:"Render3D",label:"sortableChildren",description:"When on, children are sorted by their render order before drawing.",editor:"toggle"})],S.prototype,"sortableChildren",void 0);let j=class extends O{constructor(){super(...arguments),this.name="Render3DSystem"}static{this.systemName="Render3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Render3D"===e.componentName){if(e.type===t.OBSERVER_TYPE.REMOVE){const t=this.threeContext.object3DFor(e.gameObject.id);return void(t&&this.apply(t,{visible:!0,opacity:1,renderOrder:0,sortableChildren:!1}))}this.applyTo(e.gameObject,e.component)}}rendererUpdate(e){const t=e.getComponent(S);t&&this.applyTo(e,t)}applyTo(e,t){const o=this.threeContext.object3DFor(e.id);o&&(this.apply(o,t),t.sortableChildren&&this.sortChildren(e,o))}apply(e,t){e.visible=t.visible,e.traverse(e=>{e.renderOrder=t.renderOrder;const o=e;if(!o.isMesh||!o.material)return;const r=Array.isArray(o.material)?o.material:[o.material];for(const e of r){const o=e;"number"==typeof o.opacity&&(o.opacity=t.opacity,o.transparent=t.opacity<1)}})}sortChildren(e,t){const o=e.children?.map(e=>{if(!e)return null;const o=this.threeContext.object3DFor(e.id);if(!o||o.parent!==t)return null;const r=e.getComponent(S);return{node:o,order:r?.renderOrder??0}}).filter(e=>!!e).sort((e,t)=>e.order-t.order);if(o?.length)for(const e of o)t.add(e.node)}};j=e.__decorate([t.decorators.componentObserver({Render3D:["visible","opacity","renderOrder","sortableChildren"]})],j);var Y=j;class T extends t.Component{constructor(){super(...arguments),this.fov=75,this.near=.1,this.far=1e3,this.active=!0,this.lookAt=!1,this.lookAtX=0,this.lookAtY=0,this.lookAtZ=0}static{this.componentName="Camera3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"number",step:1,group:"Camera3D",label:"fov",description:"Vertical field of view in degrees.",editor:"number-stepper"})],T.prototype,"fov",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Camera3D",label:"near",description:"Near clipping plane.",editor:"number-stepper"})],T.prototype,"near",void 0),e.__decorate([r.Field({type:"number",step:1,group:"Camera3D",label:"far",description:"Far clipping plane.",editor:"number-stepper"})],T.prototype,"far",void 0),e.__decorate([r.Field({type:"boolean",group:"Camera3D",label:"active",description:"Use this camera for rendering.",editor:"toggle"})],T.prototype,"active",void 0),e.__decorate([r.Field({type:"boolean",group:"Camera3D",label:"lookAt",description:"Point the camera at lookAtX/Y/Z each frame.",editor:"toggle"})],T.prototype,"lookAt",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtX",description:"World-space look-at target on X.",editor:"number-stepper"})],T.prototype,"lookAtX",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtY",description:"World-space look-at target on Y.",editor:"number-stepper"})],T.prototype,"lookAtY",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Camera3D",label:"lookAtZ",description:"World-space look-at target on Z.",editor:"number-stepper"})],T.prototype,"lookAtZ",void 0);let E=class extends O{constructor(){super(...arguments),this.name="Camera3DSystem",this.cameras=new Map}static{this.systemName="Camera3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Camera3D"!==e.componentName)return;const o=e.component;e.type===t.OBSERVER_TYPE.ADD?this.mount(e.gameObject,o):e.type===t.OBSERVER_TYPE.REMOVE?this.unmount(e.gameObject.id):this.sync(e.gameObject,o)}rendererUpdate(e){const t=e.getComponent(T),o=this.cameras.get(e.id);t&&o&&t.lookAt&&o.lookAt(t.lookAtX,t.lookAtY,t.lookAtZ)}mount(e,t){this.ensureTransform(e);const r=new o.PerspectiveCamera(t.fov,this.threeContext.camera.aspect,t.near,t.far);this.threeContext.attachVisual(e.id,r,e),this.cameras.set(e.id,r),this.sync(e,t)}sync(e,t){const o=this.cameras.get(e.id);o&&(o.fov=t.fov,o.near=t.near,o.far=t.far,o.updateProjectionMatrix(),t.active?this.threeContext.setActiveCamera(o):this.threeContext.camera===o&&this.activateAnother(e.id))}unmount(e){const t=this.cameras.get(e);t&&(this.threeContext.detachVisual(e,t),this.cameras.delete(e),this.threeContext.camera===t&&this.activateAnother(e))}activateAnother(e){for(const[t,o]of this.cameras){if(t===e)continue;const r=this.game.gameObjects.find(e=>e.id===t),s=r?.getComponent(T);if(s?.active)return void this.threeContext.setActiveCamera(o)}this.threeContext.restoreFallbackCamera()}ensureTransform(e){let t=e.getComponent(D);if(!t)return t=new D,t.positionZ=5,void e.addComponent(t);m(t)&&(t.positionZ=5)}onDestroy(){for(const[e]of this.cameras)this.unmount(e);this.cameras.clear()}};E=e.__decorate([t.decorators.componentObserver({Camera3D:["fov","near","far","active","lookAt","lookAtX","lookAtY","lookAtZ"]})],E);var A=E;class M extends t.Component{constructor(){super(...arguments),this.type="directional",this.color=16777215,this.intensity=1,this.castShadow=!1,this.skyColor=16777215,this.groundColor=4473924,this.distance=0,this.decay=2,this.angle=Math.PI/3,this.penumbra=0}static{this.componentName="Light3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([r.Field({type:"string",group:"Light3D",label:"type",description:"Light kind.",editor:"enum",enumOptions:["ambient","directional","hemisphere","point","spot"]})],M.prototype,"type",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"color",description:"Light color (hex).",editor:"number-stepper"})],M.prototype,"color",void 0),e.__decorate([r.Field({type:"number",step:.05,group:"Light3D",label:"intensity",description:"Light intensity.",editor:"number-stepper"})],M.prototype,"intensity",void 0),e.__decorate([r.Field({type:"boolean",group:"Light3D",label:"castShadow",description:"Whether this light casts shadows.",editor:"toggle"})],M.prototype,"castShadow",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"skyColor",description:"Hemisphere sky color (hex).",editor:"number-stepper"})],M.prototype,"skyColor",void 0),e.__decorate([r.Field({type:"number",group:"Light3D",label:"groundColor",description:"Hemisphere ground color (hex).",editor:"number-stepper"})],M.prototype,"groundColor",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Light3D",label:"distance",description:"Range for point and spot lights. 0 means no limit.",editor:"number-stepper"})],M.prototype,"distance",void 0),e.__decorate([r.Field({type:"number",step:.1,group:"Light3D",label:"decay",description:"Intensity falloff for point and spot lights.",editor:"number-stepper"})],M.prototype,"decay",void 0),e.__decorate([r.Field({type:"number",step:.01,group:"Light3D",label:"angle",description:"Spot light cone angle in radians.",editor:"number-stepper"})],M.prototype,"angle",void 0),e.__decorate([r.Field({type:"number",step:.01,min:0,max:1,group:"Light3D",label:"penumbra",description:"Spot light soft edge (0–1).",editor:"number-slider"})],M.prototype,"penumbra",void 0);let Z=class extends O{constructor(){super(...arguments),this.name="Light3DSystem",this.lights=new Map}static{this.systemName="Light3DSystem"}init(){this.game.getSystem("Renderer3DSystem").rendererManager.register(this)}componentChanged(e){if("Light3D"!==e.componentName)return;const o=e.component;e.type===t.OBSERVER_TYPE.ADD?this.mount(e.gameObject,o):e.type===t.OBSERVER_TYPE.REMOVE?this.unmount(e.gameObject.id):"type"===e.prop?.prop?.[0]?(this.unmount(e.gameObject.id),this.mount(e.gameObject,o)):this.sync(e.gameObject.id,o)}rendererUpdate(e){}mount(e,t){this.ensureTransform(e),0===this.lights.size&&this.threeContext.removeDefaultLights();const o=this.createLight(t);this.threeContext.attachVisual(e.id,o,e),this.lights.set(e.id,o),this.sync(e.id,t)}createLight(e){switch(e.type){case"ambient":return new o.AmbientLight(e.color,e.intensity);case"hemisphere":return new o.HemisphereLight(e.skyColor,e.groundColor,e.intensity);case"point":return new o.PointLight(e.color,e.intensity,e.distance,e.decay);case"spot":return new o.SpotLight(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);default:return new o.DirectionalLight(e.color,e.intensity)}}sync(e,t){const r=this.lights.get(e);r&&("color"in r&&r.color&&r.color.set(t.color),r.intensity=t.intensity,r instanceof o.HemisphereLight&&(r.color.set(t.skyColor),r.groundColor.set(t.groundColor)),(r instanceof o.PointLight||r instanceof o.SpotLight)&&(r.distance=t.distance,r.decay=t.decay),r instanceof o.SpotLight&&(r.angle=t.angle,r.penumbra=t.penumbra),"castShadow"in r&&(r.castShadow=!(!t.castShadow||!this.threeContext.shadows)))}unmount(e){const t=this.lights.get(e);t&&(this.threeContext.detachVisual(e,t),t.dispose?.(),this.lights.delete(e))}ensureTransform(e){e.getComponent(D)||e.addComponent(new D)}onDestroy(){for(const[e]of this.lights)this.unmount(e);this.lights.clear()}};Z=e.__decorate([t.decorators.componentObserver({Light3D:["type","color","intensity","castShadow","skyColor","groundColor","distance","decay","angle","penumbra"]})],Z);var k=Z;async function X(e){const o=String(e??"").trim();if(!o)throw new Error("resource name is required; register it with resource.addResource");const r=await t.resource.getResource(o);if(!r||!r.name)throw new Error(`Unknown resource "${o}"; register it with resource.addResource first`);return r}function L(e){const t=e.data?.image;if(!t)throw new Error(`Resource "${e.name}" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`);const r=new o.Texture(t);return r.colorSpace=o.SRGBColorSpace,r.needsUpdate=!0,r}exports.COMBOS_GAME_OBJECT_ID=s,exports.COMBOS_TRANSFORM3D=n,exports.Camera3D=T,exports.Camera3DSystem=A,exports.Light3D=M,exports.Light3DSystem=k,exports.Render3D=S,exports.Render3DSystem=Y,exports.Renderer3D=O,exports.Renderer3DManager=C,exports.Renderer3DSystem=x,exports.ThreeContext=f,exports.Transform3D=D,exports.Transform3DSystem=_,exports.VisualPoseBridge=class{constructor(){this.lastVisual="",this.lastRoot=""}sync(e,t){if(!t)return!0;if(""===this.lastVisual&&""===this.lastRoot)return u(e,t),this.lastVisual=h(e),this.lastRoot=h(t),!1;const o=h(e),r=h(t);return o!==this.lastVisual&&r===this.lastRoot&&l(e,t),this.lastVisual=h(e),this.lastRoot=h(t),!1}},exports.copyPose=l,exports.gameObjectIdFromIntersection=function(e){return c(e?.object)},exports.gameObjectIdFromObject3D=c,exports.has3DChildGameObjects=function(e){return(e?.children?.length??0)>0},exports.is3DSceneParent=p,exports.isIdentityPose=m,exports.isTransform3DRoot=i,exports.poseKeyOf=h,exports.readPose=d,exports.requireNamedResource=X,exports.seedTransform3D=u,exports.tagObject3D=a,exports.textureFromNamedImage=async function(e){return L(await X(e))},exports.textureFromResourceImage=L;
@@ -731,7 +731,7 @@ var Renderer3DSystem$1 = Renderer3DSystem;
731
731
  /** Auto-generated by scripts/build-package.mjs — do not edit. */
732
732
  Object.assign(Renderer3DSystem$1, {
733
733
  packageName: "@combos-fun/plugin-renderer-3d",
734
- packageVersion: "0.1.2",
734
+ packageVersion: "0.1.4-beta.0",
735
735
  });
736
736
 
737
737
  class Renderer3D extends System {
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d.esm.js","sources":["../lib/tagObject3D.ts","../lib/hierarchy.ts","../lib/pose.ts","../lib/ThreeContext.ts","../lib/Renderer3DManager.ts","../lib/Transform3D.ts","../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer3D.ts","../lib/Transform3DSystem.ts","../lib/Render3D.ts","../lib/Render3DSystem.ts","../lib/Camera3D.ts","../lib/Camera3DSystem.ts","../lib/Light3D.ts","../lib/Light3DSystem.ts","../lib/namedResource.ts"],"sourcesContent":["import type { Object3D } from 'three';\n\nexport const COMBOS_GAME_OBJECT_ID = 'combosGameObjectId';\nexport const COMBOS_TRANSFORM3D = 'combosTransform3D';\n\nexport function isTransform3DRoot(object: Object3D | null | undefined): boolean {\n return !!object?.userData?.[COMBOS_TRANSFORM3D];\n}\n\n/** Stamp a Three.js object (and its children) so Event3D raycasts can resolve the GameObject. */\nexport function tagObject3D(object: Object3D, gameObjectId: number): void {\n object.traverse((child) => {\n child.userData[COMBOS_GAME_OBJECT_ID] = gameObjectId;\n });\n}\n\nexport function gameObjectIdFromObject3D(object: Object3D | null | undefined): number | undefined {\n let current = object;\n while (current) {\n const id = current.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof id === 'number') {\n return id;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/** Resolve a raycast hit to a GameObject id. */\nexport function gameObjectIdFromIntersection(intersection: {\n object?: Object3D;\n} | null | undefined): number | undefined {\n return gameObjectIdFromObject3D(intersection?.object);\n}\n","import type { GameObject } from '@combos-fun/engine';\n\n/** True when this GameObject is a scene root (no 3D parent). */\nexport function is3DSceneParent(gameObject: GameObject | undefined | null): boolean {\n if (!gameObject) return true;\n const parent = gameObject.parent;\n return !parent || parent === gameObject.scene;\n}\n\nexport function has3DChildGameObjects(gameObject: GameObject | undefined | null): boolean {\n return (gameObject?.children?.length ?? 0) > 0;\n}\n","export interface PoseLike {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport function readPose(pose: PoseLike) {\n return {\n positionX: pose.positionX ?? 0,\n positionY: pose.positionY ?? 0,\n positionZ: pose.positionZ ?? 0,\n rotationX: pose.rotationX ?? 0,\n rotationY: pose.rotationY ?? 0,\n rotationZ: pose.rotationZ ?? 0,\n scaleX: pose.scaleX ?? 1,\n scaleY: pose.scaleY ?? 1,\n scaleZ: pose.scaleZ ?? 1,\n };\n}\n\nexport function poseKeyOf(pose: PoseLike): string {\n const r = readPose(pose);\n return [\n r.positionX, r.positionY, r.positionZ,\n r.rotationX, r.rotationY, r.rotationZ,\n r.scaleX, r.scaleY, r.scaleZ,\n ].join(',');\n}\n\nexport function copyPose(from: PoseLike, to: PoseLike) {\n const r = readPose(from);\n to.positionX = r.positionX;\n to.positionY = r.positionY;\n to.positionZ = r.positionZ;\n to.rotationX = r.rotationX;\n to.rotationY = r.rotationY;\n to.rotationZ = r.rotationZ;\n to.scaleX = r.scaleX;\n to.scaleY = r.scaleY;\n to.scaleZ = r.scaleZ;\n}\n\nexport function isIdentityPose(pose: PoseLike): boolean {\n const r = readPose(pose);\n return r.positionX === 0 && r.positionY === 0 && r.positionZ === 0\n && r.rotationX === 0 && r.rotationY === 0 && r.rotationZ === 0\n && r.scaleX === 1 && r.scaleY === 1 && r.scaleZ === 1;\n}\n\nexport function seedTransform3D(visual: PoseLike, transform: PoseLike) {\n if (isIdentityPose(transform) && !isIdentityPose(visual)) {\n copyPose(visual, transform);\n }\n}\n\n/**\n * Keep a visual component's pose fields and a sibling Transform3D in sync.\n * Returns true when the visual Object3D should still apply pose itself\n * (no Transform3D root yet).\n */\nexport class VisualPoseBridge {\n lastVisual = '';\n lastRoot = '';\n\n sync(visual: PoseLike, root?: PoseLike | null): boolean {\n if (!root) return true;\n if (this.lastVisual === '' && this.lastRoot === '') {\n seedTransform3D(visual, root);\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n const visualKey = poseKeyOf(visual);\n const rootKey = poseKeyOf(root);\n if (visualKey !== this.lastVisual && rootKey === this.lastRoot) {\n copyPose(visual, root);\n }\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n}\n","import {\n Scene,\n PerspectiveCamera,\n WebGLRenderer,\n Clock,\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n Fog,\n AnimationMixer,\n AnimationClip,\n Mesh,\n Material,\n Group,\n Euler,\n Vector3,\n ACESFilmicToneMapping,\n LinearToneMapping,\n ReinhardToneMapping,\n CineonToneMapping,\n NoToneMapping,\n PCFSoftShadowMap,\n} from 'three';\nimport type { Light, Object3D, ToneMapping } from 'three';\nimport type { GameObject } from '@combos-fun/engine';\nimport { tagObject3D, COMBOS_GAME_OBJECT_ID, COMBOS_TRANSFORM3D, isTransform3DRoot } from './tagObject3D';\nimport { is3DSceneParent } from './hierarchy';\nimport type { PoseLike } from './pose';\nimport { readPose } from './pose';\n\nexport type ToneMappingKind = 'none' | 'aces' | 'linear' | 'reinhard' | 'cineon';\n\nexport interface FogParams {\n color?: number;\n near?: number;\n far?: number;\n}\n\nexport interface HemisphereLightParams {\n skyColor?: number;\n groundColor?: number;\n intensity?: number;\n}\n\nexport interface ThreeContextParams {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width: number;\n height: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n fog?: boolean | FogParams;\n hemisphereLight?: boolean | HemisphereLightParams;\n shadows?: boolean;\n toneMapping?: ToneMappingKind;\n toneMappingExposure?: number;\n ambientIntensity?: number;\n directionalIntensity?: number;\n}\n\nexport interface Transform3DLike extends PoseLike {\n worldPositionX?: number;\n worldPositionY?: number;\n worldPositionZ?: number;\n worldRotationX?: number;\n worldRotationY?: number;\n worldRotationZ?: number;\n}\n\nconst TONE_MAPPING: Record<ToneMappingKind, ToneMapping> = {\n none: NoToneMapping,\n aces: ACESFilmicToneMapping,\n linear: LinearToneMapping,\n reinhard: ReinhardToneMapping,\n cineon: CineonToneMapping,\n};\n\nconst _world = new Vector3();\nconst _euler = new Euler();\n\nexport default class ThreeContext {\n scene: Scene;\n camera: PerspectiveCamera;\n fallbackCamera: PerspectiveCamera;\n renderer: WebGLRenderer;\n clock: Clock;\n mixers: Map<number, AnimationMixer> = new Map();\n models: Map<number, Group> = new Map();\n /** Root Object3D for each GameObject that has a 3D node. */\n nodes: Map<number, Object3D> = new Map();\n shadows: boolean;\n defaultLights: Object3D[] = [];\n\n constructor(params: ThreeContextParams) {\n const {\n canvas,\n container,\n width,\n height,\n antialias = true,\n backgroundColor = 0x000000,\n backgroundAlpha = 1,\n } = params;\n\n this.scene = new Scene();\n this.shadows = !!params.shadows;\n\n this.camera = new PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 5;\n this.fallbackCamera = this.camera;\n\n const rendererOpts: any = { antialias };\n if (canvas) {\n rendererOpts.canvas = canvas;\n }\n if (backgroundAlpha < 1) {\n rendererOpts.alpha = true;\n }\n\n this.renderer = new WebGLRenderer(rendererOpts);\n this.renderer.setSize(width, height);\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setClearColor(backgroundColor, backgroundAlpha);\n this.renderer.toneMapping = TONE_MAPPING[params.toneMapping ?? 'aces'] ?? ACESFilmicToneMapping;\n this.renderer.toneMappingExposure = params.toneMappingExposure ?? 1;\n if (this.shadows) {\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = PCFSoftShadowMap;\n }\n\n if (!canvas && container) {\n container.appendChild(this.renderer.domElement);\n }\n\n const ambientLight = new AmbientLight(0xffffff, params.ambientIntensity ?? 0.6);\n this.scene.add(ambientLight);\n this.defaultLights.push(ambientLight);\n\n const directionalLight = new DirectionalLight(0xffffff, params.directionalIntensity ?? 0.8);\n directionalLight.position.set(5, 10, 7.5);\n if (this.shadows) {\n directionalLight.castShadow = true;\n directionalLight.shadow.mapSize.set(1024, 1024);\n }\n this.scene.add(directionalLight);\n this.defaultLights.push(directionalLight);\n\n if (params.hemisphereLight !== false) {\n const hemi = typeof params.hemisphereLight === 'object' ? params.hemisphereLight : {};\n const hemisphereLight = new HemisphereLight(\n hemi.skyColor ?? 0xffffff,\n hemi.groundColor ?? 0x444444,\n hemi.intensity ?? 0.35,\n );\n this.scene.add(hemisphereLight);\n this.defaultLights.push(hemisphereLight);\n }\n\n if (params.fog) {\n const fog = typeof params.fog === 'object' ? params.fog : {};\n this.scene.fog = new Fog(fog.color ?? backgroundColor, fog.near ?? 8, fog.far ?? 40);\n }\n\n this.clock = new Clock();\n }\n\n update() {\n const delta = this.clock.getDelta();\n for (const mixer of this.mixers.values()) {\n mixer.update(delta);\n }\n this.renderer.render(this.scene, this.camera);\n }\n\n hasTransform3DRoot(id: number): boolean {\n return isTransform3DRoot(this.nodes.get(id));\n }\n\n applyModelShadows(object: Object3D) {\n if (!this.shadows) return;\n object.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.isMesh) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n });\n }\n\n attachParsedModel(\n id: number,\n model: Group,\n animations?: AnimationClip[],\n gameObject?: GameObject,\n ): Group {\n tagObject3D(model, id);\n this.applyModelShadows(model);\n this.models.set(id, model);\n this.attachVisual(id, model, gameObject);\n\n if (animations && animations.length > 0) {\n const mixer = new AnimationMixer(model);\n this.mixers.set(id, mixer);\n model.userData.animations = animations;\n }\n\n return model;\n }\n\n object3DFor(id: number): Object3D | undefined {\n return this.nodes.get(id);\n }\n\n /** Place a GameObject's root Object3D under the nearest ancestor visual (or the scene). */\n attachObject3D(id: number, object: Object3D, gameObject?: GameObject): void {\n const prev = this.nodes.get(id);\n if (prev && prev !== object) {\n this.rehomeRegisteredChildren(prev);\n prev.parent?.remove(prev);\n }\n this.nodes.set(id, object);\n const parentNode = this.findParentNode(gameObject);\n if (object.parent !== parentNode) {\n parentNode.add(object);\n }\n if (gameObject) {\n this.adoptChildGameObjects(gameObject, object);\n }\n }\n\n /**\n * Attach a visual / camera / light under the Transform3D root when one exists.\n * Otherwise the object itself becomes the GameObject root (legacy path).\n */\n attachVisual(id: number, object: Object3D, gameObject?: GameObject): void {\n tagObject3D(object, id);\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n if (object.parent !== root) {\n root.add(object);\n }\n return;\n }\n this.attachObject3D(id, object, gameObject);\n }\n\n detachVisual(id: number, object: Object3D): Object3D | undefined {\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n object.parent?.remove(object);\n return object;\n }\n if (root === object) {\n return this.detachObject3D(id);\n }\n object.parent?.remove(object);\n return object;\n }\n\n /** Remove a registered node without disposing it; child GameObject nodes stay in the scene. */\n detachObject3D(id: number): Object3D | undefined {\n const object = this.nodes.get(id);\n if (!object) return undefined;\n this.rehomeRegisteredChildren(object);\n object.parent?.remove(object);\n this.nodes.delete(id);\n return object;\n }\n\n reparentGameObject(gameObject: GameObject): void {\n const object = this.nodes.get(gameObject.id);\n if (!object) return;\n const parentNode = this.findParentNode(gameObject);\n if (object.parent === parentNode) return;\n parentNode.add(object);\n }\n\n findParentNode(gameObject?: GameObject): Object3D {\n if (!gameObject || is3DSceneParent(gameObject)) {\n return this.scene;\n }\n let current = gameObject.parent;\n while (current && current !== gameObject.scene) {\n const node = this.nodes.get(current.id);\n if (node) return node;\n current = current.parent;\n }\n return this.scene;\n }\n\n adoptChildGameObjects(gameObject: GameObject, object: Object3D): void {\n const children = gameObject.children;\n if (!children) return;\n for (const childGo of children) {\n if (!childGo) continue;\n const childNode = this.nodes.get(childGo.id);\n if (childNode && childNode.parent !== object) {\n object.add(childNode);\n }\n }\n }\n\n ensureTransformRoot(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const existing = this.nodes.get(gameObject.id);\n if (isTransform3DRoot(existing)) {\n this.applyTransformPose(existing, transform);\n return existing;\n }\n\n const group = new Group();\n group.name = gameObject.name;\n group.userData[COMBOS_TRANSFORM3D] = true;\n tagObject3D(group, gameObject.id);\n\n if (existing && existing !== group) {\n if (isIdentityPoseObject(transform)) {\n transform.positionX = existing.position.x;\n transform.positionY = existing.position.y;\n transform.positionZ = existing.position.z;\n transform.rotationX = existing.rotation.x;\n transform.rotationY = existing.rotation.y;\n transform.rotationZ = existing.rotation.z;\n transform.scaleX = existing.scale.x;\n transform.scaleY = existing.scale.y;\n transform.scaleZ = existing.scale.z;\n }\n const parent = existing.parent || this.scene;\n parent.add(group);\n group.add(existing);\n existing.position.set(0, 0, 0);\n existing.rotation.set(0, 0, 0);\n existing.scale.set(1, 1, 1);\n this.nodes.set(gameObject.id, group);\n this.adoptChildGameObjects(gameObject, group);\n } else {\n this.attachObject3D(gameObject.id, group, gameObject);\n }\n\n this.applyTransformPose(group, transform);\n return group;\n }\n\n applyTransform3D(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const root = this.ensureTransformRoot(gameObject, transform);\n this.applyTransformPose(root, transform);\n root.updateWorldMatrix(true, false);\n root.getWorldPosition(_world);\n transform.worldPositionX = _world.x;\n transform.worldPositionY = _world.y;\n transform.worldPositionZ = _world.z;\n _euler.setFromRotationMatrix(root.matrixWorld);\n transform.worldRotationX = _euler.x;\n transform.worldRotationY = _euler.y;\n transform.worldRotationZ = _euler.z;\n return root;\n }\n\n private applyTransformPose(root: Object3D, transform: Transform3DLike) {\n const pose = readPose(transform);\n root.position.set(pose.positionX, pose.positionY, pose.positionZ);\n root.rotation.set(pose.rotationX, pose.rotationY, pose.rotationZ);\n root.scale.set(pose.scaleX, pose.scaleY, pose.scaleZ);\n }\n\n removeDefaultLights() {\n if (!this.defaultLights.length) return;\n for (const light of this.defaultLights) {\n light.parent?.remove(light);\n (light as Light).dispose?.();\n }\n this.defaultLights = [];\n }\n\n setActiveCamera(camera: PerspectiveCamera) {\n const prev = this.camera;\n this.camera = camera;\n if (prev) {\n camera.aspect = prev.aspect;\n }\n camera.updateProjectionMatrix();\n }\n\n restoreFallbackCamera() {\n if (this.camera !== this.fallbackCamera) {\n this.setActiveCamera(this.fallbackCamera);\n }\n }\n\n private rehomeRegisteredChildren(object: Object3D): void {\n for (const child of [...object.children]) {\n const childId = child.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof childId === 'number' && this.nodes.get(childId) === child) {\n this.scene.add(child);\n }\n }\n }\n\n playAnimation(id: number, animationIndex: number, speed: number) {\n const mixer = this.mixers.get(id);\n const model = this.models.get(id);\n if (!mixer || !model) return;\n\n mixer.stopAllAction();\n const animations = model.userData.animations as AnimationClip[];\n if (animations && animations[animationIndex]) {\n const action = mixer.clipAction(animations[animationIndex]);\n action.timeScale = speed;\n action.play();\n }\n }\n\n stopAnimation(id: number) {\n const mixer = this.mixers.get(id);\n if (mixer) mixer.stopAllAction();\n }\n\n removeModel(id: number) {\n const model = this.models.get(id);\n if (model) {\n this.detachVisual(id, model);\n model.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.geometry) {\n mesh.geometry.dispose();\n }\n if (mesh.material) {\n const materials = Array.isArray(mesh.material)\n ? mesh.material as Material[]\n : [mesh.material as Material];\n materials.forEach(m => m.dispose());\n }\n });\n this.models.delete(id);\n }\n const mixer = this.mixers.get(id);\n if (mixer) {\n mixer.stopAllAction();\n this.mixers.delete(id);\n }\n }\n\n resize(width: number, height: number) {\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n if (this.fallbackCamera !== this.camera) {\n this.fallbackCamera.aspect = width / height;\n this.fallbackCamera.updateProjectionMatrix();\n }\n this.renderer.setSize(width, height);\n }\n\n destroy() {\n for (const id of this.models.keys()) {\n this.removeModel(id);\n }\n this.removeDefaultLights();\n this.renderer.dispose();\n this.renderer.domElement.remove();\n this.nodes.clear();\n this.scene = null;\n this.camera = null;\n this.fallbackCamera = null;\n this.renderer = null;\n this.clock = null;\n }\n}\n\nfunction isIdentityPoseObject(transform: Transform3DLike): boolean {\n const pose = readPose(transform);\n return pose.positionX === 0 && pose.positionY === 0 && pose.positionZ === 0\n && pose.rotationX === 0 && pose.rotationY === 0 && pose.rotationZ === 0\n && pose.scaleX === 1 && pose.scaleY === 1 && pose.scaleZ === 1;\n}\n","import { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\n\nexport default class Renderer3DManager {\n game: Game;\n rendererSystem: Renderer3DSystem;\n renderers: Renderer3D[] = [];\n\n constructor({ game, rendererSystem }: { game: Game; rendererSystem: Renderer3DSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n\n register(...renderers: Renderer3D[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this;\n renderer.threeContext = this.rendererSystem.threeContext;\n this.renderers.push(renderer);\n }\n }\n\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (!props) continue;\n\n if (changed.type === OBSERVER_TYPE.ADD || changed.type === OBSERVER_TYPE.REMOVE) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject.name}, ${changed.componentName} error.`,\n changed,\n e,\n );\n }\n continue;\n }\n\n // CHANGE type: check if the changed prop matches\n const index = props.findIndex((prop) => {\n if (typeof prop === 'string' && typeof changed.prop === 'string') {\n return prop === changed.prop;\n }\n // Deep comparison for object-style props\n return JSON.stringify(prop) === JSON.stringify(changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject?.name}, ${changed.componentName} componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[component.name];\n if (props) {\n try {\n renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(\n `gameObject: ${gameObject.name}, ${component.name} update error`,\n e,\n );\n }\n }\n }\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Transform3DParams {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport default class Transform3D extends Component<Transform3DParams> {\n static componentName: string = 'Transform3D';\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleX',\n description: 'Scale on X.',\n editor: 'number-stepper',\n })\n scaleX: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n\n worldPositionX: number = 0;\n worldPositionY: number = 0;\n worldPositionZ: number = 0;\n worldRotationX: number = 0;\n worldRotationY: number = 0;\n worldRotationZ: number = 0;\n\n init(obj?: Transform3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { System, decorators, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type { ComponentChanged, GameObject, UpdateParams } from '@combos-fun/engine';\nimport ThreeContext from './ThreeContext';\nimport type { ThreeContextParams } from './ThreeContext';\nimport Renderer3DManager from './Renderer3DManager';\nimport Transform3D from './Transform3D';\n\nexport interface Renderer3DSystemParams extends Partial<ThreeContextParams> {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width?: number;\n height?: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n})\nexport default class Renderer3DSystem extends System<Renderer3DSystemParams> {\n static systemName = 'Renderer3DSystem';\n name: string = 'Renderer3DSystem';\n threeContext: ThreeContext;\n rendererManager: Renderer3DManager;\n\n init(params?: Renderer3DSystemParams) {\n const opts = params || {};\n const width = opts.width || 750;\n const height = opts.height || 1334;\n\n this.threeContext = new ThreeContext({\n canvas: opts.canvas,\n container: opts.container,\n width,\n height,\n antialias: opts.antialias,\n backgroundColor: opts.backgroundColor,\n backgroundAlpha: opts.backgroundAlpha,\n fog: opts.fog,\n hemisphereLight: opts.hemisphereLight,\n shadows: opts.shadows,\n toneMapping: opts.toneMapping,\n toneMappingExposure: opts.toneMappingExposure,\n ambientIntensity: opts.ambientIntensity,\n directionalIntensity: opts.directionalIntensity,\n });\n\n this.game.canvas = this.threeContext.renderer.domElement;\n\n this.rendererManager = new Renderer3DManager({\n game: this.game,\n rendererSystem: this,\n });\n }\n\n update(e?: UpdateParams) {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.handleHierarchyChange(changed);\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (transform) {\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private handleHierarchyChange(changed: ComponentChanged) {\n if (changed.componentName !== 'GameObject') return;\n if (changed.type !== OBSERVER_TYPE.CHANGE && changed.type !== OBSERVER_TYPE.ADD) return;\n this.ensureTransform3D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform3D(changed.gameObject.parent);\n this.threeContext?.reparentGameObject(changed.gameObject);\n }\n\n private ensureTransform3D(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext?.ensureTransformRoot(gameObject, transform);\n }\n\n lateUpdate() {\n this.threeContext?.update();\n }\n\n resize(width: number, height: number) {\n this.threeContext?.resize(width, height);\n }\n\n onDestroy(): void {\n this.threeContext?.destroy();\n this.threeContext = null;\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer3DSystem from './system';\n\nObject.assign(Renderer3DSystem, {\n packageName: \"@combos-fun/plugin-renderer-3d\",\n packageVersion: \"0.1.2\",\n});\n","import { Game, PureObserverInfo, ComponentChanged, System, GameObject, UpdateParams } from '@combos-fun/engine';\nimport type Renderer3DManager from './Renderer3DManager';\nimport type ThreeContext from './ThreeContext';\n\nexport default class Renderer3D<T extends {} = {}> extends System<T> {\n name: string;\n game: Game;\n static observerInfo: PureObserverInfo;\n observerInfo: PureObserverInfo;\n rendererManager: Renderer3DManager;\n threeContext: ThreeContext;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer3D & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n componentChanged(_changed: ComponentChanged) {}\n rendererUpdate(_gameObject: GameObject) {}\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {};\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Transform3D from './Transform3D';\n\nconst POSE_PROPS = new Set([\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n]);\n\n@decorators.componentObserver({\n Transform3D: [\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n ],\n GameObject: ['parent'],\n})\nexport default class Transform3DSystem extends Renderer3D {\n static systemName = 'Transform3DSystem';\n name: string = 'Transform3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.ensureOn(changed.gameObject);\n if (changed.gameObject.parent) this.ensureOn(changed.gameObject.parent);\n this.threeContext.reparentGameObject(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.threeContext.ensureTransformRoot(changed.gameObject, changed.component as Transform3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.threeContext.detachObject3D(changed.gameObject.id);\n } else if (POSE_PROPS.has(changed.prop?.prop?.[0])) {\n this.threeContext.applyTransform3D(changed.gameObject, changed.component as Transform3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) return;\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n\n private ensureOn(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext.ensureTransformRoot(gameObject, transform);\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Render3DParams {\n visible?: boolean;\n opacity?: number;\n renderOrder?: number;\n sortableChildren?: boolean;\n}\n\nexport default class Render3D extends Component<Render3DParams> {\n static componentName: string = 'Render3D';\n\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'visible',\n description: 'Whether this object is drawn.',\n editor: 'toggle',\n })\n visible: boolean = true;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Render3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Render3D',\n label: 'renderOrder',\n description: 'Draw order; higher values render on top.',\n editor: 'number-stepper',\n })\n renderOrder: number = 0;\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'sortableChildren',\n description: 'When on, children are sorted by their render order before drawing.',\n editor: 'toggle',\n })\n sortableChildren: boolean = false;\n\n init(obj?: Render3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport type { Material, Mesh, Object3D } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Render3D from './Render3D';\n\n@decorators.componentObserver({\n Render3D: ['visible', 'opacity', 'renderOrder', 'sortableChildren'],\n})\nexport default class Render3DSystem extends Renderer3D {\n static systemName = 'Render3DSystem';\n name: string = 'Render3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Render3D') return;\n if (changed.type === OBSERVER_TYPE.REMOVE) {\n const root = this.threeContext.object3DFor(changed.gameObject.id);\n if (root) this.apply(root, { visible: true, opacity: 1, renderOrder: 0, sortableChildren: false } as Render3D);\n return;\n }\n this.applyTo(changed.gameObject, changed.component as Render3D);\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Render3D) as Render3D;\n if (!component) return;\n this.applyTo(gameObject, component);\n }\n\n private applyTo(gameObject: GameObject, component: Render3D) {\n const root = this.threeContext.object3DFor(gameObject.id);\n if (!root) return;\n this.apply(root, component);\n if (component.sortableChildren) {\n this.sortChildren(gameObject, root);\n }\n }\n\n private apply(root: Object3D, component: Render3D) {\n root.visible = component.visible;\n root.traverse((child) => {\n child.renderOrder = component.renderOrder;\n const mesh = child as Mesh;\n if (!mesh.isMesh || !mesh.material) return;\n const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];\n for (const material of materials as Material[]) {\n const mat = material as Material & { opacity?: number; transparent?: boolean };\n if (typeof mat.opacity === 'number') {\n mat.opacity = component.opacity;\n mat.transparent = component.opacity < 1;\n }\n }\n });\n }\n\n private sortChildren(gameObject: GameObject, root: Object3D) {\n const ranked = gameObject.children\n ?.map((childGo) => {\n if (!childGo) return null;\n const node = this.threeContext.object3DFor(childGo.id);\n if (!node || node.parent !== root) return null;\n const render = childGo.getComponent(Render3D) as Render3D | undefined;\n return { node, order: render?.renderOrder ?? 0 };\n })\n .filter((item): item is { node: Object3D; order: number } => !!item)\n .sort((a, b) => a.order - b.order);\n if (!ranked?.length) return;\n for (const item of ranked) {\n root.add(item.node);\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Camera3DParams {\n fov?: number;\n near?: number;\n far?: number;\n active?: boolean;\n lookAtX?: number;\n lookAtY?: number;\n lookAtZ?: number;\n lookAt?: boolean;\n}\n\nexport default class Camera3D extends Component<Camera3DParams> {\n static componentName: string = 'Camera3D';\n\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'fov',\n description: 'Vertical field of view in degrees.',\n editor: 'number-stepper',\n })\n fov: number = 75;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Camera3D',\n label: 'near',\n description: 'Near clipping plane.',\n editor: 'number-stepper',\n })\n near: number = 0.1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'far',\n description: 'Far clipping plane.',\n editor: 'number-stepper',\n })\n far: number = 1000;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'active',\n description: 'Use this camera for rendering.',\n editor: 'toggle',\n })\n active: boolean = true;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'lookAt',\n description: 'Point the camera at lookAtX/Y/Z each frame.',\n editor: 'toggle',\n })\n lookAt: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtX',\n description: 'World-space look-at target on X.',\n editor: 'number-stepper',\n })\n lookAtX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtY',\n description: 'World-space look-at target on Y.',\n editor: 'number-stepper',\n })\n lookAtY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtZ',\n description: 'World-space look-at target on Z.',\n editor: 'number-stepper',\n })\n lookAtZ: number = 0;\n\n init(obj?: Camera3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport { PerspectiveCamera } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Camera3D from './Camera3D';\nimport Transform3D from './Transform3D';\nimport { isIdentityPose } from './pose';\n\n@decorators.componentObserver({\n Camera3D: ['fov', 'near', 'far', 'active', 'lookAt', 'lookAtX', 'lookAtY', 'lookAtZ'],\n})\nexport default class Camera3DSystem extends Renderer3D {\n static systemName = 'Camera3DSystem';\n name: string = 'Camera3DSystem';\n\n private cameras = new Map<number, PerspectiveCamera>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Camera3D') return;\n const component = changed.component as Camera3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else {\n this.sync(changed.gameObject, component);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Camera3D) as Camera3D;\n const camera = this.cameras.get(gameObject.id);\n if (!component || !camera) return;\n if (component.lookAt) {\n camera.lookAt(component.lookAtX, component.lookAtY, component.lookAtZ);\n }\n }\n\n private mount(gameObject: GameObject, component: Camera3D) {\n this.ensureTransform(gameObject);\n const camera = new PerspectiveCamera(\n component.fov,\n this.threeContext.camera.aspect,\n component.near,\n component.far,\n );\n this.threeContext.attachVisual(gameObject.id, camera, gameObject);\n this.cameras.set(gameObject.id, camera);\n this.sync(gameObject, component);\n }\n\n private sync(gameObject: GameObject, component: Camera3D) {\n const camera = this.cameras.get(gameObject.id);\n if (!camera) return;\n camera.fov = component.fov;\n camera.near = component.near;\n camera.far = component.far;\n camera.updateProjectionMatrix();\n if (component.active) {\n this.threeContext.setActiveCamera(camera);\n } else if (this.threeContext.camera === camera) {\n this.activateAnother(gameObject.id);\n }\n }\n\n private unmount(id: number) {\n const camera = this.cameras.get(id);\n if (!camera) return;\n this.threeContext.detachVisual(id, camera);\n this.cameras.delete(id);\n if (this.threeContext.camera === camera) {\n this.activateAnother(id);\n }\n }\n\n private activateAnother(exceptId: number) {\n for (const [id, camera] of this.cameras) {\n if (id === exceptId) continue;\n const go = this.game.gameObjects.find((item) => item.id === id);\n const component = go?.getComponent(Camera3D) as Camera3D | undefined;\n if (component?.active) {\n this.threeContext.setActiveCamera(camera);\n return;\n }\n }\n this.threeContext.restoreFallbackCamera();\n }\n\n private ensureTransform(gameObject: GameObject) {\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n transform.positionZ = 5;\n gameObject.addComponent(transform);\n return;\n }\n if (isIdentityPose(transform)) {\n transform.positionZ = 5;\n }\n }\n\n onDestroy() {\n for (const [id] of this.cameras) {\n this.unmount(id);\n }\n this.cameras.clear();\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport type Light3DKind = 'ambient' | 'directional' | 'hemisphere' | 'point' | 'spot';\n\nexport interface Light3DParams {\n type?: Light3DKind | string;\n color?: number;\n intensity?: number;\n castShadow?: boolean;\n skyColor?: number;\n groundColor?: number;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n}\n\nexport default class Light3D extends Component<Light3DParams> {\n static componentName: string = 'Light3D';\n\n @Field({\n type: 'string',\n group: 'Light3D',\n label: 'type',\n description: 'Light kind.',\n editor: 'enum',\n enumOptions: ['ambient', 'directional', 'hemisphere', 'point', 'spot'],\n })\n type: string = 'directional';\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'color',\n description: 'Light color (hex).',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'number',\n step: 0.05,\n group: 'Light3D',\n label: 'intensity',\n description: 'Light intensity.',\n editor: 'number-stepper',\n })\n intensity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Light3D',\n label: 'castShadow',\n description: 'Whether this light casts shadows.',\n editor: 'toggle',\n })\n castShadow: boolean = false;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'skyColor',\n description: 'Hemisphere sky color (hex).',\n editor: 'number-stepper',\n })\n skyColor: number = 0xffffff;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'groundColor',\n description: 'Hemisphere ground color (hex).',\n editor: 'number-stepper',\n })\n groundColor: number = 0x444444;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'distance',\n description: 'Range for point and spot lights. 0 means no limit.',\n editor: 'number-stepper',\n })\n distance: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'decay',\n description: 'Intensity falloff for point and spot lights.',\n editor: 'number-stepper',\n })\n decay: number = 2;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Light3D',\n label: 'angle',\n description: 'Spot light cone angle in radians.',\n editor: 'number-stepper',\n })\n angle: number = Math.PI / 3;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Light3D',\n label: 'penumbra',\n description: 'Spot light soft edge (0–1).',\n editor: 'number-slider',\n })\n penumbra: number = 0;\n\n init(obj?: Light3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport {\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n PointLight,\n SpotLight,\n} from 'three';\nimport type { Light } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Light3D from './Light3D';\nimport Transform3D from './Transform3D';\n\n@decorators.componentObserver({\n Light3D: [\n 'type', 'color', 'intensity', 'castShadow',\n 'skyColor', 'groundColor', 'distance', 'decay', 'angle', 'penumbra',\n ],\n})\nexport default class Light3DSystem extends Renderer3D {\n static systemName = 'Light3DSystem';\n name: string = 'Light3DSystem';\n\n private lights = new Map<number, Light>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Light3D') return;\n const component = changed.component as Light3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else if (changed.prop?.prop?.[0] === 'type') {\n this.unmount(changed.gameObject.id);\n this.mount(changed.gameObject, component);\n } else {\n this.sync(changed.gameObject.id, component);\n }\n }\n\n rendererUpdate(_gameObject: GameObject) {}\n\n private mount(gameObject: GameObject, component: Light3D) {\n this.ensureTransform(gameObject);\n if (this.lights.size === 0) {\n this.threeContext.removeDefaultLights();\n }\n const light = this.createLight(component);\n this.threeContext.attachVisual(gameObject.id, light, gameObject);\n this.lights.set(gameObject.id, light);\n this.sync(gameObject.id, component);\n }\n\n private createLight(component: Light3D): Light {\n switch (component.type) {\n case 'ambient':\n return new AmbientLight(component.color, component.intensity);\n case 'hemisphere':\n return new HemisphereLight(component.skyColor, component.groundColor, component.intensity);\n case 'point':\n return new PointLight(component.color, component.intensity, component.distance, component.decay);\n case 'spot':\n return new SpotLight(\n component.color,\n component.intensity,\n component.distance,\n component.angle,\n component.penumbra,\n component.decay,\n );\n case 'directional':\n default:\n return new DirectionalLight(component.color, component.intensity);\n }\n }\n\n private sync(id: number, component: Light3D) {\n const light = this.lights.get(id);\n if (!light) return;\n if ('color' in light && (light as DirectionalLight).color) {\n (light as DirectionalLight).color.set(component.color);\n }\n light.intensity = component.intensity;\n if (light instanceof HemisphereLight) {\n light.color.set(component.skyColor);\n light.groundColor.set(component.groundColor);\n }\n if (light instanceof PointLight || light instanceof SpotLight) {\n light.distance = component.distance;\n light.decay = component.decay;\n }\n if (light instanceof SpotLight) {\n light.angle = component.angle;\n light.penumbra = component.penumbra;\n }\n if ('castShadow' in light) {\n (light as DirectionalLight).castShadow = !!(component.castShadow && this.threeContext.shadows);\n }\n }\n\n private unmount(id: number) {\n const light = this.lights.get(id);\n if (!light) return;\n this.threeContext.detachVisual(id, light);\n light.dispose?.();\n this.lights.delete(id);\n }\n\n private ensureTransform(gameObject: GameObject) {\n if (gameObject.getComponent(Transform3D)) return;\n gameObject.addComponent(new Transform3D());\n }\n\n onDestroy() {\n for (const [id] of this.lights) {\n this.unmount(id);\n }\n this.lights.clear();\n }\n}\n","import { resource } from '@combos-fun/engine';\nimport type { ResourceStruct } from '@combos-fun/engine';\nimport { SRGBColorSpace, Texture } from 'three';\n\nexport async function requireNamedResource(name: string): Promise<ResourceStruct> {\n const trimmed = String(name ?? '').trim();\n if (!trimmed) {\n throw new Error('resource name is required; register it with resource.addResource');\n }\n const res = await resource.getResource(trimmed);\n if (!res || !res.name) {\n throw new Error(\n `Unknown resource \"${trimmed}\"; register it with resource.addResource first`,\n );\n }\n return res;\n}\n\nexport function textureFromResourceImage(res: ResourceStruct): Texture {\n const image = res.data?.image as HTMLImageElement | undefined;\n if (!image) {\n throw new Error(\n `Resource \"${res.name}\" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`,\n );\n }\n const texture = new Texture(image);\n texture.colorSpace = SRGBColorSpace;\n texture.needsUpdate = true;\n return texture;\n}\n\nexport async function textureFromNamedImage(name: string): Promise<Texture> {\n // Always build a Three.Texture from data.image so 2D Pixi\n // registerInstance(IMAGE) is never overwritten or reused.\n return textureFromResourceImage(await requireNamedResource(name));\n}\n"],"names":["Renderer3DSystem"],"mappings":";;;;;AAEO,MAAM,qBAAqB,GAAG;AAC9B,MAAM,kBAAkB,GAAG;AAE5B,SAAU,iBAAiB,CAAC,MAAmC,EAAA;IACnE,OAAO,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAC;AACjD;AAEA;AACM,SAAU,WAAW,CAAC,MAAgB,EAAE,YAAoB,EAAA;AAChE,IAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAI;AACxB,QAAA,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,YAAY;AACtD,IAAA,CAAC,CAAC;AACJ;AAEM,SAAU,wBAAwB,CAAC,MAAmC,EAAA;IAC1E,IAAI,OAAO,GAAG,MAAM;IACpB,OAAO,OAAO,EAAE;QACd,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,GAAG,qBAAqB,CAAC;AACpD,QAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;AAC1B,YAAA,OAAO,EAAE;QACX;AACA,QAAA,OAAO,GAAG,OAAO,CAAC,MAAM;IAC1B;AACA,IAAA,OAAO,SAAS;AAClB;AAEA;AACM,SAAU,4BAA4B,CAAC,YAEzB,EAAA;AAClB,IAAA,OAAO,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC;AACvD;;AC/BA;AACM,SAAU,eAAe,CAAC,UAAyC,EAAA;AACvE,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,IAAI;AAC5B,IAAA,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM;IAChC,OAAO,CAAC,MAAM,IAAI,MAAM,KAAK,UAAU,CAAC,KAAK;AAC/C;AAEM,SAAU,qBAAqB,CAAC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"file":"plugin-renderer-3d.esm.js","sources":["../lib/tagObject3D.ts","../lib/hierarchy.ts","../lib/pose.ts","../lib/ThreeContext.ts","../lib/Renderer3DManager.ts","../lib/Transform3D.ts","../lib/system.ts","../lib/__combosPackageMeta.gen.ts","../lib/Renderer3D.ts","../lib/Transform3DSystem.ts","../lib/Render3D.ts","../lib/Render3DSystem.ts","../lib/Camera3D.ts","../lib/Camera3DSystem.ts","../lib/Light3D.ts","../lib/Light3DSystem.ts","../lib/namedResource.ts"],"sourcesContent":["import type { Object3D } from 'three';\n\nexport const COMBOS_GAME_OBJECT_ID = 'combosGameObjectId';\nexport const COMBOS_TRANSFORM3D = 'combosTransform3D';\n\nexport function isTransform3DRoot(object: Object3D | null | undefined): boolean {\n return !!object?.userData?.[COMBOS_TRANSFORM3D];\n}\n\n/** Stamp a Three.js object (and its children) so Event3D raycasts can resolve the GameObject. */\nexport function tagObject3D(object: Object3D, gameObjectId: number): void {\n object.traverse((child) => {\n child.userData[COMBOS_GAME_OBJECT_ID] = gameObjectId;\n });\n}\n\nexport function gameObjectIdFromObject3D(object: Object3D | null | undefined): number | undefined {\n let current = object;\n while (current) {\n const id = current.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof id === 'number') {\n return id;\n }\n current = current.parent;\n }\n return undefined;\n}\n\n/** Resolve a raycast hit to a GameObject id. */\nexport function gameObjectIdFromIntersection(intersection: {\n object?: Object3D;\n} | null | undefined): number | undefined {\n return gameObjectIdFromObject3D(intersection?.object);\n}\n","import type { GameObject } from '@combos-fun/engine';\n\n/** True when this GameObject is a scene root (no 3D parent). */\nexport function is3DSceneParent(gameObject: GameObject | undefined | null): boolean {\n if (!gameObject) return true;\n const parent = gameObject.parent;\n return !parent || parent === gameObject.scene;\n}\n\nexport function has3DChildGameObjects(gameObject: GameObject | undefined | null): boolean {\n return (gameObject?.children?.length ?? 0) > 0;\n}\n","export interface PoseLike {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport function readPose(pose: PoseLike) {\n return {\n positionX: pose.positionX ?? 0,\n positionY: pose.positionY ?? 0,\n positionZ: pose.positionZ ?? 0,\n rotationX: pose.rotationX ?? 0,\n rotationY: pose.rotationY ?? 0,\n rotationZ: pose.rotationZ ?? 0,\n scaleX: pose.scaleX ?? 1,\n scaleY: pose.scaleY ?? 1,\n scaleZ: pose.scaleZ ?? 1,\n };\n}\n\nexport function poseKeyOf(pose: PoseLike): string {\n const r = readPose(pose);\n return [\n r.positionX, r.positionY, r.positionZ,\n r.rotationX, r.rotationY, r.rotationZ,\n r.scaleX, r.scaleY, r.scaleZ,\n ].join(',');\n}\n\nexport function copyPose(from: PoseLike, to: PoseLike) {\n const r = readPose(from);\n to.positionX = r.positionX;\n to.positionY = r.positionY;\n to.positionZ = r.positionZ;\n to.rotationX = r.rotationX;\n to.rotationY = r.rotationY;\n to.rotationZ = r.rotationZ;\n to.scaleX = r.scaleX;\n to.scaleY = r.scaleY;\n to.scaleZ = r.scaleZ;\n}\n\nexport function isIdentityPose(pose: PoseLike): boolean {\n const r = readPose(pose);\n return r.positionX === 0 && r.positionY === 0 && r.positionZ === 0\n && r.rotationX === 0 && r.rotationY === 0 && r.rotationZ === 0\n && r.scaleX === 1 && r.scaleY === 1 && r.scaleZ === 1;\n}\n\nexport function seedTransform3D(visual: PoseLike, transform: PoseLike) {\n if (isIdentityPose(transform) && !isIdentityPose(visual)) {\n copyPose(visual, transform);\n }\n}\n\n/**\n * Keep a visual component's pose fields and a sibling Transform3D in sync.\n * Returns true when the visual Object3D should still apply pose itself\n * (no Transform3D root yet).\n */\nexport class VisualPoseBridge {\n lastVisual = '';\n lastRoot = '';\n\n sync(visual: PoseLike, root?: PoseLike | null): boolean {\n if (!root) return true;\n if (this.lastVisual === '' && this.lastRoot === '') {\n seedTransform3D(visual, root);\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n const visualKey = poseKeyOf(visual);\n const rootKey = poseKeyOf(root);\n if (visualKey !== this.lastVisual && rootKey === this.lastRoot) {\n copyPose(visual, root);\n }\n this.lastVisual = poseKeyOf(visual);\n this.lastRoot = poseKeyOf(root);\n return false;\n }\n}\n","import {\n Scene,\n PerspectiveCamera,\n WebGLRenderer,\n Clock,\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n Fog,\n AnimationMixer,\n AnimationClip,\n Mesh,\n Material,\n Group,\n Euler,\n Vector3,\n ACESFilmicToneMapping,\n LinearToneMapping,\n ReinhardToneMapping,\n CineonToneMapping,\n NoToneMapping,\n PCFSoftShadowMap,\n} from 'three';\nimport type { Light, Object3D, ToneMapping } from 'three';\nimport type { GameObject } from '@combos-fun/engine';\nimport { tagObject3D, COMBOS_GAME_OBJECT_ID, COMBOS_TRANSFORM3D, isTransform3DRoot } from './tagObject3D';\nimport { is3DSceneParent } from './hierarchy';\nimport type { PoseLike } from './pose';\nimport { readPose } from './pose';\n\nexport type ToneMappingKind = 'none' | 'aces' | 'linear' | 'reinhard' | 'cineon';\n\nexport interface FogParams {\n color?: number;\n near?: number;\n far?: number;\n}\n\nexport interface HemisphereLightParams {\n skyColor?: number;\n groundColor?: number;\n intensity?: number;\n}\n\nexport interface ThreeContextParams {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width: number;\n height: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n fog?: boolean | FogParams;\n hemisphereLight?: boolean | HemisphereLightParams;\n shadows?: boolean;\n toneMapping?: ToneMappingKind;\n toneMappingExposure?: number;\n ambientIntensity?: number;\n directionalIntensity?: number;\n}\n\nexport interface Transform3DLike extends PoseLike {\n worldPositionX?: number;\n worldPositionY?: number;\n worldPositionZ?: number;\n worldRotationX?: number;\n worldRotationY?: number;\n worldRotationZ?: number;\n}\n\nconst TONE_MAPPING: Record<ToneMappingKind, ToneMapping> = {\n none: NoToneMapping,\n aces: ACESFilmicToneMapping,\n linear: LinearToneMapping,\n reinhard: ReinhardToneMapping,\n cineon: CineonToneMapping,\n};\n\nconst _world = new Vector3();\nconst _euler = new Euler();\n\nexport default class ThreeContext {\n scene: Scene;\n camera: PerspectiveCamera;\n fallbackCamera: PerspectiveCamera;\n renderer: WebGLRenderer;\n clock: Clock;\n mixers: Map<number, AnimationMixer> = new Map();\n models: Map<number, Group> = new Map();\n /** Root Object3D for each GameObject that has a 3D node. */\n nodes: Map<number, Object3D> = new Map();\n shadows: boolean;\n defaultLights: Object3D[] = [];\n\n constructor(params: ThreeContextParams) {\n const {\n canvas,\n container,\n width,\n height,\n antialias = true,\n backgroundColor = 0x000000,\n backgroundAlpha = 1,\n } = params;\n\n this.scene = new Scene();\n this.shadows = !!params.shadows;\n\n this.camera = new PerspectiveCamera(75, width / height, 0.1, 1000);\n this.camera.position.z = 5;\n this.fallbackCamera = this.camera;\n\n const rendererOpts: any = { antialias };\n if (canvas) {\n rendererOpts.canvas = canvas;\n }\n if (backgroundAlpha < 1) {\n rendererOpts.alpha = true;\n }\n\n this.renderer = new WebGLRenderer(rendererOpts);\n this.renderer.setSize(width, height);\n this.renderer.setPixelRatio(window.devicePixelRatio);\n this.renderer.setClearColor(backgroundColor, backgroundAlpha);\n this.renderer.toneMapping = TONE_MAPPING[params.toneMapping ?? 'aces'] ?? ACESFilmicToneMapping;\n this.renderer.toneMappingExposure = params.toneMappingExposure ?? 1;\n if (this.shadows) {\n this.renderer.shadowMap.enabled = true;\n this.renderer.shadowMap.type = PCFSoftShadowMap;\n }\n\n if (!canvas && container) {\n container.appendChild(this.renderer.domElement);\n }\n\n const ambientLight = new AmbientLight(0xffffff, params.ambientIntensity ?? 0.6);\n this.scene.add(ambientLight);\n this.defaultLights.push(ambientLight);\n\n const directionalLight = new DirectionalLight(0xffffff, params.directionalIntensity ?? 0.8);\n directionalLight.position.set(5, 10, 7.5);\n if (this.shadows) {\n directionalLight.castShadow = true;\n directionalLight.shadow.mapSize.set(1024, 1024);\n }\n this.scene.add(directionalLight);\n this.defaultLights.push(directionalLight);\n\n if (params.hemisphereLight !== false) {\n const hemi = typeof params.hemisphereLight === 'object' ? params.hemisphereLight : {};\n const hemisphereLight = new HemisphereLight(\n hemi.skyColor ?? 0xffffff,\n hemi.groundColor ?? 0x444444,\n hemi.intensity ?? 0.35,\n );\n this.scene.add(hemisphereLight);\n this.defaultLights.push(hemisphereLight);\n }\n\n if (params.fog) {\n const fog = typeof params.fog === 'object' ? params.fog : {};\n this.scene.fog = new Fog(fog.color ?? backgroundColor, fog.near ?? 8, fog.far ?? 40);\n }\n\n this.clock = new Clock();\n }\n\n update() {\n const delta = this.clock.getDelta();\n for (const mixer of this.mixers.values()) {\n mixer.update(delta);\n }\n this.renderer.render(this.scene, this.camera);\n }\n\n hasTransform3DRoot(id: number): boolean {\n return isTransform3DRoot(this.nodes.get(id));\n }\n\n applyModelShadows(object: Object3D) {\n if (!this.shadows) return;\n object.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.isMesh) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n });\n }\n\n attachParsedModel(\n id: number,\n model: Group,\n animations?: AnimationClip[],\n gameObject?: GameObject,\n ): Group {\n tagObject3D(model, id);\n this.applyModelShadows(model);\n this.models.set(id, model);\n this.attachVisual(id, model, gameObject);\n\n if (animations && animations.length > 0) {\n const mixer = new AnimationMixer(model);\n this.mixers.set(id, mixer);\n model.userData.animations = animations;\n }\n\n return model;\n }\n\n object3DFor(id: number): Object3D | undefined {\n return this.nodes.get(id);\n }\n\n /** Place a GameObject's root Object3D under the nearest ancestor visual (or the scene). */\n attachObject3D(id: number, object: Object3D, gameObject?: GameObject): void {\n const prev = this.nodes.get(id);\n if (prev && prev !== object) {\n this.rehomeRegisteredChildren(prev);\n prev.parent?.remove(prev);\n }\n this.nodes.set(id, object);\n const parentNode = this.findParentNode(gameObject);\n if (object.parent !== parentNode) {\n parentNode.add(object);\n }\n if (gameObject) {\n this.adoptChildGameObjects(gameObject, object);\n }\n }\n\n /**\n * Attach a visual / camera / light under the Transform3D root when one exists.\n * Otherwise the object itself becomes the GameObject root (legacy path).\n */\n attachVisual(id: number, object: Object3D, gameObject?: GameObject): void {\n tagObject3D(object, id);\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n if (object.parent !== root) {\n root.add(object);\n }\n return;\n }\n this.attachObject3D(id, object, gameObject);\n }\n\n detachVisual(id: number, object: Object3D): Object3D | undefined {\n const root = this.nodes.get(id);\n if (isTransform3DRoot(root) && root !== object) {\n object.parent?.remove(object);\n return object;\n }\n if (root === object) {\n return this.detachObject3D(id);\n }\n object.parent?.remove(object);\n return object;\n }\n\n /** Remove a registered node without disposing it; child GameObject nodes stay in the scene. */\n detachObject3D(id: number): Object3D | undefined {\n const object = this.nodes.get(id);\n if (!object) return undefined;\n this.rehomeRegisteredChildren(object);\n object.parent?.remove(object);\n this.nodes.delete(id);\n return object;\n }\n\n reparentGameObject(gameObject: GameObject): void {\n const object = this.nodes.get(gameObject.id);\n if (!object) return;\n const parentNode = this.findParentNode(gameObject);\n if (object.parent === parentNode) return;\n parentNode.add(object);\n }\n\n findParentNode(gameObject?: GameObject): Object3D {\n if (!gameObject || is3DSceneParent(gameObject)) {\n return this.scene;\n }\n let current = gameObject.parent;\n while (current && current !== gameObject.scene) {\n const node = this.nodes.get(current.id);\n if (node) return node;\n current = current.parent;\n }\n return this.scene;\n }\n\n adoptChildGameObjects(gameObject: GameObject, object: Object3D): void {\n const children = gameObject.children;\n if (!children) return;\n for (const childGo of children) {\n if (!childGo) continue;\n const childNode = this.nodes.get(childGo.id);\n if (childNode && childNode.parent !== object) {\n object.add(childNode);\n }\n }\n }\n\n ensureTransformRoot(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const existing = this.nodes.get(gameObject.id);\n if (isTransform3DRoot(existing)) {\n this.applyTransformPose(existing, transform);\n return existing;\n }\n\n const group = new Group();\n group.name = gameObject.name;\n group.userData[COMBOS_TRANSFORM3D] = true;\n tagObject3D(group, gameObject.id);\n\n if (existing && existing !== group) {\n if (isIdentityPoseObject(transform)) {\n transform.positionX = existing.position.x;\n transform.positionY = existing.position.y;\n transform.positionZ = existing.position.z;\n transform.rotationX = existing.rotation.x;\n transform.rotationY = existing.rotation.y;\n transform.rotationZ = existing.rotation.z;\n transform.scaleX = existing.scale.x;\n transform.scaleY = existing.scale.y;\n transform.scaleZ = existing.scale.z;\n }\n const parent = existing.parent || this.scene;\n parent.add(group);\n group.add(existing);\n existing.position.set(0, 0, 0);\n existing.rotation.set(0, 0, 0);\n existing.scale.set(1, 1, 1);\n this.nodes.set(gameObject.id, group);\n this.adoptChildGameObjects(gameObject, group);\n } else {\n this.attachObject3D(gameObject.id, group, gameObject);\n }\n\n this.applyTransformPose(group, transform);\n return group;\n }\n\n applyTransform3D(gameObject: GameObject, transform: Transform3DLike): Object3D {\n const root = this.ensureTransformRoot(gameObject, transform);\n this.applyTransformPose(root, transform);\n root.updateWorldMatrix(true, false);\n root.getWorldPosition(_world);\n transform.worldPositionX = _world.x;\n transform.worldPositionY = _world.y;\n transform.worldPositionZ = _world.z;\n _euler.setFromRotationMatrix(root.matrixWorld);\n transform.worldRotationX = _euler.x;\n transform.worldRotationY = _euler.y;\n transform.worldRotationZ = _euler.z;\n return root;\n }\n\n private applyTransformPose(root: Object3D, transform: Transform3DLike) {\n const pose = readPose(transform);\n root.position.set(pose.positionX, pose.positionY, pose.positionZ);\n root.rotation.set(pose.rotationX, pose.rotationY, pose.rotationZ);\n root.scale.set(pose.scaleX, pose.scaleY, pose.scaleZ);\n }\n\n removeDefaultLights() {\n if (!this.defaultLights.length) return;\n for (const light of this.defaultLights) {\n light.parent?.remove(light);\n (light as Light).dispose?.();\n }\n this.defaultLights = [];\n }\n\n setActiveCamera(camera: PerspectiveCamera) {\n const prev = this.camera;\n this.camera = camera;\n if (prev) {\n camera.aspect = prev.aspect;\n }\n camera.updateProjectionMatrix();\n }\n\n restoreFallbackCamera() {\n if (this.camera !== this.fallbackCamera) {\n this.setActiveCamera(this.fallbackCamera);\n }\n }\n\n private rehomeRegisteredChildren(object: Object3D): void {\n for (const child of [...object.children]) {\n const childId = child.userData?.[COMBOS_GAME_OBJECT_ID];\n if (typeof childId === 'number' && this.nodes.get(childId) === child) {\n this.scene.add(child);\n }\n }\n }\n\n playAnimation(id: number, animationIndex: number, speed: number) {\n const mixer = this.mixers.get(id);\n const model = this.models.get(id);\n if (!mixer || !model) return;\n\n mixer.stopAllAction();\n const animations = model.userData.animations as AnimationClip[];\n if (animations && animations[animationIndex]) {\n const action = mixer.clipAction(animations[animationIndex]);\n action.timeScale = speed;\n action.play();\n }\n }\n\n stopAnimation(id: number) {\n const mixer = this.mixers.get(id);\n if (mixer) mixer.stopAllAction();\n }\n\n removeModel(id: number) {\n const model = this.models.get(id);\n if (model) {\n this.detachVisual(id, model);\n model.traverse((child) => {\n const mesh = child as Mesh;\n if (mesh.geometry) {\n mesh.geometry.dispose();\n }\n if (mesh.material) {\n const materials = Array.isArray(mesh.material)\n ? mesh.material as Material[]\n : [mesh.material as Material];\n materials.forEach(m => m.dispose());\n }\n });\n this.models.delete(id);\n }\n const mixer = this.mixers.get(id);\n if (mixer) {\n mixer.stopAllAction();\n this.mixers.delete(id);\n }\n }\n\n resize(width: number, height: number) {\n this.camera.aspect = width / height;\n this.camera.updateProjectionMatrix();\n if (this.fallbackCamera !== this.camera) {\n this.fallbackCamera.aspect = width / height;\n this.fallbackCamera.updateProjectionMatrix();\n }\n this.renderer.setSize(width, height);\n }\n\n destroy() {\n for (const id of this.models.keys()) {\n this.removeModel(id);\n }\n this.removeDefaultLights();\n this.renderer.dispose();\n this.renderer.domElement.remove();\n this.nodes.clear();\n this.scene = null;\n this.camera = null;\n this.fallbackCamera = null;\n this.renderer = null;\n this.clock = null;\n }\n}\n\nfunction isIdentityPoseObject(transform: Transform3DLike): boolean {\n const pose = readPose(transform);\n return pose.positionX === 0 && pose.positionY === 0 && pose.positionZ === 0\n && pose.rotationX === 0 && pose.rotationY === 0 && pose.rotationZ === 0\n && pose.scaleX === 1 && pose.scaleY === 1 && pose.scaleZ === 1;\n}\n","import { GameObject, Game, ComponentChanged, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\n\nexport default class Renderer3DManager {\n game: Game;\n rendererSystem: Renderer3DSystem;\n renderers: Renderer3D[] = [];\n\n constructor({ game, rendererSystem }: { game: Game; rendererSystem: Renderer3DSystem }) {\n this.game = game;\n this.rendererSystem = rendererSystem;\n }\n\n register(...renderers: Renderer3D[]) {\n for (const renderer of renderers) {\n renderer.game = this.game;\n renderer.rendererManager = this;\n renderer.threeContext = this.rendererSystem.threeContext;\n this.renderers.push(renderer);\n }\n }\n\n componentChanged(changes: ComponentChanged[]) {\n for (const changed of changes) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[changed.componentName];\n if (!props) continue;\n\n if (changed.type === OBSERVER_TYPE.ADD || changed.type === OBSERVER_TYPE.REMOVE) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject.name}, ${changed.componentName} error.`,\n changed,\n e,\n );\n }\n continue;\n }\n\n // CHANGE type: check if the changed prop matches\n const index = props.findIndex((prop) => {\n if (typeof prop === 'string' && typeof changed.prop === 'string') {\n return prop === changed.prop;\n }\n // Deep comparison for object-style props\n return JSON.stringify(prop) === JSON.stringify(changed.prop);\n });\n\n if (index > -1) {\n try {\n renderer.componentChanged(changed);\n } catch (e) {\n console.error(\n `gameObject: ${changed.gameObject?.name}, ${changed.componentName} componentChanged error.`,\n changed,\n e,\n );\n }\n }\n }\n }\n }\n\n update(gameObject: GameObject) {\n for (const component of gameObject.components) {\n for (const renderer of this.renderers) {\n const props = renderer.observerInfo[component.name];\n if (props) {\n try {\n renderer.rendererUpdate(gameObject);\n } catch (e) {\n console.info(\n `gameObject: ${gameObject.name}, ${component.name} update error`,\n e,\n );\n }\n }\n }\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Transform3DParams {\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n}\n\nexport default class Transform3D extends Component<Transform3DParams> {\n static componentName: string = 'Transform3D';\n\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionX',\n description: 'Local X position.',\n editor: 'number-stepper',\n })\n positionX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionY',\n description: 'Local Y position.',\n editor: 'number-stepper',\n })\n positionY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'positionZ',\n description: 'Local Z position.',\n editor: 'number-stepper',\n })\n positionZ: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationX',\n description: 'Rotation around X in radians.',\n editor: 'number-stepper',\n })\n rotationX: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationY',\n description: 'Rotation around Y in radians.',\n editor: 'number-stepper',\n })\n rotationY: number = 0;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Transform3D',\n label: 'rotationZ',\n description: 'Rotation around Z in radians.',\n editor: 'number-stepper',\n })\n rotationZ: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleX',\n description: 'Scale on X.',\n editor: 'number-stepper',\n })\n scaleX: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Transform3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n\n worldPositionX: number = 0;\n worldPositionY: number = 0;\n worldPositionZ: number = 0;\n worldRotationX: number = 0;\n worldRotationY: number = 0;\n worldRotationZ: number = 0;\n\n init(obj?: Transform3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { System, decorators, OBSERVER_TYPE } from '@combos-fun/engine';\nimport type { ComponentChanged, GameObject, UpdateParams } from '@combos-fun/engine';\nimport ThreeContext from './ThreeContext';\nimport type { ThreeContextParams } from './ThreeContext';\nimport Renderer3DManager from './Renderer3DManager';\nimport Transform3D from './Transform3D';\n\nexport interface Renderer3DSystemParams extends Partial<ThreeContextParams> {\n canvas?: HTMLCanvasElement;\n container?: HTMLElement;\n width?: number;\n height?: number;\n antialias?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n}\n\n@decorators.componentObserver({\n GameObject: ['parent'],\n})\nexport default class Renderer3DSystem extends System<Renderer3DSystemParams> {\n static systemName = 'Renderer3DSystem';\n name: string = 'Renderer3DSystem';\n threeContext: ThreeContext;\n rendererManager: Renderer3DManager;\n\n init(params?: Renderer3DSystemParams) {\n const opts = params || {};\n const width = opts.width || 750;\n const height = opts.height || 1334;\n\n this.threeContext = new ThreeContext({\n canvas: opts.canvas,\n container: opts.container,\n width,\n height,\n antialias: opts.antialias,\n backgroundColor: opts.backgroundColor,\n backgroundAlpha: opts.backgroundAlpha,\n fog: opts.fog,\n hemisphereLight: opts.hemisphereLight,\n shadows: opts.shadows,\n toneMapping: opts.toneMapping,\n toneMappingExposure: opts.toneMappingExposure,\n ambientIntensity: opts.ambientIntensity,\n directionalIntensity: opts.directionalIntensity,\n });\n\n this.game.canvas = this.threeContext.renderer.domElement;\n\n this.rendererManager = new Renderer3DManager({\n game: this.game,\n rendererSystem: this,\n });\n }\n\n update(e?: UpdateParams) {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.handleHierarchyChange(changed);\n }\n for (const gameObject of this.game.gameObjects) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (transform) {\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n this.rendererManager.update(gameObject);\n }\n }\n\n private handleHierarchyChange(changed: ComponentChanged) {\n if (changed.componentName !== 'GameObject') return;\n if (changed.type !== OBSERVER_TYPE.CHANGE && changed.type !== OBSERVER_TYPE.ADD) return;\n this.ensureTransform3D(changed.gameObject);\n if (changed.gameObject.parent) this.ensureTransform3D(changed.gameObject.parent);\n this.threeContext?.reparentGameObject(changed.gameObject);\n }\n\n private ensureTransform3D(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext?.ensureTransformRoot(gameObject, transform);\n }\n\n lateUpdate() {\n this.threeContext?.update();\n }\n\n resize(width: number, height: number) {\n this.threeContext?.resize(width, height);\n }\n\n onDestroy(): void {\n this.threeContext?.destroy();\n this.threeContext = null;\n }\n}\n","/** Auto-generated by scripts/build-package.mjs — do not edit. */\n\nimport Renderer3DSystem from './system';\n\nObject.assign(Renderer3DSystem, {\n packageName: \"@combos-fun/plugin-renderer-3d\",\n packageVersion: \"0.1.4-beta.0\",\n});\n","import { Game, PureObserverInfo, ComponentChanged, System, GameObject, UpdateParams } from '@combos-fun/engine';\nimport type Renderer3DManager from './Renderer3DManager';\nimport type ThreeContext from './ThreeContext';\n\nexport default class Renderer3D<T extends {} = {}> extends System<T> {\n name: string;\n game: Game;\n static observerInfo: PureObserverInfo;\n observerInfo: PureObserverInfo;\n rendererManager: Renderer3DManager;\n threeContext: ThreeContext;\n\n constructor(params?: T) {\n super(params);\n const Ctor = this.constructor as typeof Renderer3D & { observerInfo: PureObserverInfo };\n this.observerInfo = Ctor.observerInfo;\n }\n\n componentChanged(_changed: ComponentChanged) {}\n rendererUpdate(_gameObject: GameObject) {}\n\n override update(e?: UpdateParams): void {\n const changes = this.componentObserver.clear();\n for (const changed of changes) {\n this.componentChanged(changed);\n }\n }\n\n protected asyncIdMap: Record<number, number> = {};\n\n protected increaseAsyncId(id: number) {\n this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1;\n return this.asyncIdMap[id];\n }\n\n protected validateAsyncId(id: number, asyncId: number) {\n return this.asyncIdMap[id] === asyncId;\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Transform3D from './Transform3D';\n\nconst POSE_PROPS = new Set([\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n]);\n\n@decorators.componentObserver({\n Transform3D: [\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n ],\n GameObject: ['parent'],\n})\nexport default class Transform3DSystem extends Renderer3D {\n static systemName = 'Transform3DSystem';\n name: string = 'Transform3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName === 'GameObject') {\n this.ensureOn(changed.gameObject);\n if (changed.gameObject.parent) this.ensureOn(changed.gameObject.parent);\n this.threeContext.reparentGameObject(changed.gameObject);\n return;\n }\n if (changed.componentName !== 'Transform3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.threeContext.ensureTransformRoot(changed.gameObject, changed.component as Transform3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.threeContext.detachObject3D(changed.gameObject.id);\n } else if (POSE_PROPS.has(changed.prop?.prop?.[0])) {\n this.threeContext.applyTransform3D(changed.gameObject, changed.component as Transform3D);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) return;\n this.threeContext.applyTransform3D(gameObject, transform);\n }\n\n private ensureOn(gameObject: GameObject) {\n if (!gameObject || gameObject === gameObject.scene) return;\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n gameObject.addComponent(transform);\n }\n this.threeContext.ensureTransformRoot(gameObject, transform);\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Render3DParams {\n visible?: boolean;\n opacity?: number;\n renderOrder?: number;\n sortableChildren?: boolean;\n}\n\nexport default class Render3D extends Component<Render3DParams> {\n static componentName: string = 'Render3D';\n\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'visible',\n description: 'Whether this object is drawn.',\n editor: 'toggle',\n })\n visible: boolean = true;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Render3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Render3D',\n label: 'renderOrder',\n description: 'Draw order; higher values render on top.',\n editor: 'number-stepper',\n })\n renderOrder: number = 0;\n @Field({\n type: 'boolean',\n group: 'Render3D',\n label: 'sortableChildren',\n description: 'When on, children are sorted by their render order before drawing.',\n editor: 'toggle',\n })\n sortableChildren: boolean = false;\n\n init(obj?: Render3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport type { Material, Mesh, Object3D } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Render3D from './Render3D';\n\n@decorators.componentObserver({\n Render3D: ['visible', 'opacity', 'renderOrder', 'sortableChildren'],\n})\nexport default class Render3DSystem extends Renderer3D {\n static systemName = 'Render3DSystem';\n name: string = 'Render3DSystem';\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Render3D') return;\n if (changed.type === OBSERVER_TYPE.REMOVE) {\n const root = this.threeContext.object3DFor(changed.gameObject.id);\n if (root) this.apply(root, { visible: true, opacity: 1, renderOrder: 0, sortableChildren: false } as Render3D);\n return;\n }\n this.applyTo(changed.gameObject, changed.component as Render3D);\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Render3D) as Render3D;\n if (!component) return;\n this.applyTo(gameObject, component);\n }\n\n private applyTo(gameObject: GameObject, component: Render3D) {\n const root = this.threeContext.object3DFor(gameObject.id);\n if (!root) return;\n this.apply(root, component);\n if (component.sortableChildren) {\n this.sortChildren(gameObject, root);\n }\n }\n\n private apply(root: Object3D, component: Render3D) {\n root.visible = component.visible;\n root.traverse((child) => {\n child.renderOrder = component.renderOrder;\n const mesh = child as Mesh;\n if (!mesh.isMesh || !mesh.material) return;\n const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];\n for (const material of materials as Material[]) {\n const mat = material as Material & { opacity?: number; transparent?: boolean };\n if (typeof mat.opacity === 'number') {\n mat.opacity = component.opacity;\n mat.transparent = component.opacity < 1;\n }\n }\n });\n }\n\n private sortChildren(gameObject: GameObject, root: Object3D) {\n const ranked = gameObject.children\n ?.map((childGo) => {\n if (!childGo) return null;\n const node = this.threeContext.object3DFor(childGo.id);\n if (!node || node.parent !== root) return null;\n const render = childGo.getComponent(Render3D) as Render3D | undefined;\n return { node, order: render?.renderOrder ?? 0 };\n })\n .filter((item): item is { node: Object3D; order: number } => !!item)\n .sort((a, b) => a.order - b.order);\n if (!ranked?.length) return;\n for (const item of ranked) {\n root.add(item.node);\n }\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface Camera3DParams {\n fov?: number;\n near?: number;\n far?: number;\n active?: boolean;\n lookAtX?: number;\n lookAtY?: number;\n lookAtZ?: number;\n lookAt?: boolean;\n}\n\nexport default class Camera3D extends Component<Camera3DParams> {\n static componentName: string = 'Camera3D';\n\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'fov',\n description: 'Vertical field of view in degrees.',\n editor: 'number-stepper',\n })\n fov: number = 75;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Camera3D',\n label: 'near',\n description: 'Near clipping plane.',\n editor: 'number-stepper',\n })\n near: number = 0.1;\n @Field({\n type: 'number',\n step: 1,\n group: 'Camera3D',\n label: 'far',\n description: 'Far clipping plane.',\n editor: 'number-stepper',\n })\n far: number = 1000;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'active',\n description: 'Use this camera for rendering.',\n editor: 'toggle',\n })\n active: boolean = true;\n @Field({\n type: 'boolean',\n group: 'Camera3D',\n label: 'lookAt',\n description: 'Point the camera at lookAtX/Y/Z each frame.',\n editor: 'toggle',\n })\n lookAt: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtX',\n description: 'World-space look-at target on X.',\n editor: 'number-stepper',\n })\n lookAtX: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtY',\n description: 'World-space look-at target on Y.',\n editor: 'number-stepper',\n })\n lookAtY: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Camera3D',\n label: 'lookAtZ',\n description: 'World-space look-at target on Z.',\n editor: 'number-stepper',\n })\n lookAtZ: number = 0;\n\n init(obj?: Camera3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport { PerspectiveCamera } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Camera3D from './Camera3D';\nimport Transform3D from './Transform3D';\nimport { isIdentityPose } from './pose';\n\n@decorators.componentObserver({\n Camera3D: ['fov', 'near', 'far', 'active', 'lookAt', 'lookAtX', 'lookAtY', 'lookAtZ'],\n})\nexport default class Camera3DSystem extends Renderer3D {\n static systemName = 'Camera3DSystem';\n name: string = 'Camera3DSystem';\n\n private cameras = new Map<number, PerspectiveCamera>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Camera3D') return;\n const component = changed.component as Camera3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else {\n this.sync(changed.gameObject, component);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Camera3D) as Camera3D;\n const camera = this.cameras.get(gameObject.id);\n if (!component || !camera) return;\n if (component.lookAt) {\n camera.lookAt(component.lookAtX, component.lookAtY, component.lookAtZ);\n }\n }\n\n private mount(gameObject: GameObject, component: Camera3D) {\n this.ensureTransform(gameObject);\n const camera = new PerspectiveCamera(\n component.fov,\n this.threeContext.camera.aspect,\n component.near,\n component.far,\n );\n this.threeContext.attachVisual(gameObject.id, camera, gameObject);\n this.cameras.set(gameObject.id, camera);\n this.sync(gameObject, component);\n }\n\n private sync(gameObject: GameObject, component: Camera3D) {\n const camera = this.cameras.get(gameObject.id);\n if (!camera) return;\n camera.fov = component.fov;\n camera.near = component.near;\n camera.far = component.far;\n camera.updateProjectionMatrix();\n if (component.active) {\n this.threeContext.setActiveCamera(camera);\n } else if (this.threeContext.camera === camera) {\n this.activateAnother(gameObject.id);\n }\n }\n\n private unmount(id: number) {\n const camera = this.cameras.get(id);\n if (!camera) return;\n this.threeContext.detachVisual(id, camera);\n this.cameras.delete(id);\n if (this.threeContext.camera === camera) {\n this.activateAnother(id);\n }\n }\n\n private activateAnother(exceptId: number) {\n for (const [id, camera] of this.cameras) {\n if (id === exceptId) continue;\n const go = this.game.gameObjects.find((item) => item.id === id);\n const component = go?.getComponent(Camera3D) as Camera3D | undefined;\n if (component?.active) {\n this.threeContext.setActiveCamera(camera);\n return;\n }\n }\n this.threeContext.restoreFallbackCamera();\n }\n\n private ensureTransform(gameObject: GameObject) {\n let transform = gameObject.getComponent(Transform3D) as Transform3D;\n if (!transform) {\n transform = new Transform3D();\n transform.positionZ = 5;\n gameObject.addComponent(transform);\n return;\n }\n if (isIdentityPose(transform)) {\n transform.positionZ = 5;\n }\n }\n\n onDestroy() {\n for (const [id] of this.cameras) {\n this.unmount(id);\n }\n this.cameras.clear();\n }\n}\n","import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport type Light3DKind = 'ambient' | 'directional' | 'hemisphere' | 'point' | 'spot';\n\nexport interface Light3DParams {\n type?: Light3DKind | string;\n color?: number;\n intensity?: number;\n castShadow?: boolean;\n skyColor?: number;\n groundColor?: number;\n distance?: number;\n decay?: number;\n angle?: number;\n penumbra?: number;\n}\n\nexport default class Light3D extends Component<Light3DParams> {\n static componentName: string = 'Light3D';\n\n @Field({\n type: 'string',\n group: 'Light3D',\n label: 'type',\n description: 'Light kind.',\n editor: 'enum',\n enumOptions: ['ambient', 'directional', 'hemisphere', 'point', 'spot'],\n })\n type: string = 'directional';\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'color',\n description: 'Light color (hex).',\n editor: 'number-stepper',\n })\n color: number = 0xffffff;\n @Field({\n type: 'number',\n step: 0.05,\n group: 'Light3D',\n label: 'intensity',\n description: 'Light intensity.',\n editor: 'number-stepper',\n })\n intensity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Light3D',\n label: 'castShadow',\n description: 'Whether this light casts shadows.',\n editor: 'toggle',\n })\n castShadow: boolean = false;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'skyColor',\n description: 'Hemisphere sky color (hex).',\n editor: 'number-stepper',\n })\n skyColor: number = 0xffffff;\n @Field({\n type: 'number',\n group: 'Light3D',\n label: 'groundColor',\n description: 'Hemisphere ground color (hex).',\n editor: 'number-stepper',\n })\n groundColor: number = 0x444444;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'distance',\n description: 'Range for point and spot lights. 0 means no limit.',\n editor: 'number-stepper',\n })\n distance: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Light3D',\n label: 'decay',\n description: 'Intensity falloff for point and spot lights.',\n editor: 'number-stepper',\n })\n decay: number = 2;\n @Field({\n type: 'number',\n step: 0.01,\n group: 'Light3D',\n label: 'angle',\n description: 'Spot light cone angle in radians.',\n editor: 'number-stepper',\n })\n angle: number = Math.PI / 3;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Light3D',\n label: 'penumbra',\n description: 'Spot light soft edge (0–1).',\n editor: 'number-slider',\n })\n penumbra: number = 0;\n\n init(obj?: Light3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport type { ComponentChanged } from '@combos-fun/engine';\nimport {\n AmbientLight,\n DirectionalLight,\n HemisphereLight,\n PointLight,\n SpotLight,\n} from 'three';\nimport type { Light } from 'three';\nimport Renderer3D from './Renderer3D';\nimport type Renderer3DSystem from './system';\nimport Light3D from './Light3D';\nimport Transform3D from './Transform3D';\n\n@decorators.componentObserver({\n Light3D: [\n 'type', 'color', 'intensity', 'castShadow',\n 'skyColor', 'groundColor', 'distance', 'decay', 'angle', 'penumbra',\n ],\n})\nexport default class Light3DSystem extends Renderer3D {\n static systemName = 'Light3DSystem';\n name: string = 'Light3DSystem';\n\n private lights = new Map<number, Light>();\n\n init() {\n const renderer3DSystem = this.game.getSystem('Renderer3DSystem') as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'Light3D') return;\n const component = changed.component as Light3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.mount(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.unmount(changed.gameObject.id);\n } else if (changed.prop?.prop?.[0] === 'type') {\n this.unmount(changed.gameObject.id);\n this.mount(changed.gameObject, component);\n } else {\n this.sync(changed.gameObject.id, component);\n }\n }\n\n rendererUpdate(_gameObject: GameObject) {}\n\n private mount(gameObject: GameObject, component: Light3D) {\n this.ensureTransform(gameObject);\n if (this.lights.size === 0) {\n this.threeContext.removeDefaultLights();\n }\n const light = this.createLight(component);\n this.threeContext.attachVisual(gameObject.id, light, gameObject);\n this.lights.set(gameObject.id, light);\n this.sync(gameObject.id, component);\n }\n\n private createLight(component: Light3D): Light {\n switch (component.type) {\n case 'ambient':\n return new AmbientLight(component.color, component.intensity);\n case 'hemisphere':\n return new HemisphereLight(component.skyColor, component.groundColor, component.intensity);\n case 'point':\n return new PointLight(component.color, component.intensity, component.distance, component.decay);\n case 'spot':\n return new SpotLight(\n component.color,\n component.intensity,\n component.distance,\n component.angle,\n component.penumbra,\n component.decay,\n );\n case 'directional':\n default:\n return new DirectionalLight(component.color, component.intensity);\n }\n }\n\n private sync(id: number, component: Light3D) {\n const light = this.lights.get(id);\n if (!light) return;\n if ('color' in light && (light as DirectionalLight).color) {\n (light as DirectionalLight).color.set(component.color);\n }\n light.intensity = component.intensity;\n if (light instanceof HemisphereLight) {\n light.color.set(component.skyColor);\n light.groundColor.set(component.groundColor);\n }\n if (light instanceof PointLight || light instanceof SpotLight) {\n light.distance = component.distance;\n light.decay = component.decay;\n }\n if (light instanceof SpotLight) {\n light.angle = component.angle;\n light.penumbra = component.penumbra;\n }\n if ('castShadow' in light) {\n (light as DirectionalLight).castShadow = !!(component.castShadow && this.threeContext.shadows);\n }\n }\n\n private unmount(id: number) {\n const light = this.lights.get(id);\n if (!light) return;\n this.threeContext.detachVisual(id, light);\n light.dispose?.();\n this.lights.delete(id);\n }\n\n private ensureTransform(gameObject: GameObject) {\n if (gameObject.getComponent(Transform3D)) return;\n gameObject.addComponent(new Transform3D());\n }\n\n onDestroy() {\n for (const [id] of this.lights) {\n this.unmount(id);\n }\n this.lights.clear();\n }\n}\n","import { resource } from '@combos-fun/engine';\nimport type { ResourceStruct } from '@combos-fun/engine';\nimport { SRGBColorSpace, Texture } from 'three';\n\nexport async function requireNamedResource(name: string): Promise<ResourceStruct> {\n const trimmed = String(name ?? '').trim();\n if (!trimmed) {\n throw new Error('resource name is required; register it with resource.addResource');\n }\n const res = await resource.getResource(trimmed);\n if (!res || !res.name) {\n throw new Error(\n `Unknown resource \"${trimmed}\"; register it with resource.addResource first`,\n );\n }\n return res;\n}\n\nexport function textureFromResourceImage(res: ResourceStruct): Texture {\n const image = res.data?.image as HTMLImageElement | undefined;\n if (!image) {\n throw new Error(\n `Resource \"${res.name}\" has no image data; use RESOURCE_TYPE.IMAGE with src.image.url`,\n );\n }\n const texture = new Texture(image);\n texture.colorSpace = SRGBColorSpace;\n texture.needsUpdate = true;\n return texture;\n}\n\nexport async function textureFromNamedImage(name: string): Promise<Texture> {\n // Always build a Three.Texture from data.image so 2D Pixi\n // registerInstance(IMAGE) is never overwritten or reused.\n return textureFromResourceImage(await requireNamedResource(name));\n}\n"],"names":["Renderer3DSystem"],"mappings":";;;;;AAEO,MAAM,qBAAqB,GAAG;AAC9B,MAAM,kBAAkB,GAAG;AAE5B,SAAU,iBAAiB,CAAC,MAAmC,EAAA;IACnE,OAAO,CAAC,CAAC,MAAM,EAAE,QAAQ,GAAG,kBAAkB,CAAC;AACjD;AAEA;AACM,SAAU,WAAW,CAAC,MAAgB,EAAE,YAAoB,EAAA;AAChE,IAAA,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAI;AACxB,QAAA,KAAK,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,YAAY;AACtD,IAAA,CAAC,CAAC;AACJ;AAEM,SAAU,wBAAwB,CAAC,MAAmC,EAAA;IAC1E,IAAI,OAAO,GAAG,MAAM;IACpB,OAAO,OAAO,EAAE;QACd,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,GAA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BAAwB,CAAC,GAAmB,EAAA;AAC1D,IAAA,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,KAAqC;IAC7D,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CACb,CAAA,UAAA,EAAa,GAAG,CAAC,IAAI,CAAA,+DAAA,CAAiE,CACvF;IACH;AACA,IAAA,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;AAClC,IAAA,OAAO,CAAC,UAAU,GAAG,cAAc;AACnC,IAAA,OAAO,CAAC,WAAW,GAAG,IAAI;AAC1B,IAAA,OAAO,OAAO;AAChB;AAEO,eAAe,qBAAqB,CAAC,IAAY,EAAA;;;IAGtD,OAAO,wBAAwB,CAAC,MAAM,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACnE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d",
3
- "version": "0.1.2",
3
+ "version": "0.1.4-beta.0",
4
4
  "main": "index.js",
5
5
  "module": "dist/plugin-renderer-3d.esm.js",
6
6
  "bundle": "CombosFun.plugin.renderer.3d",
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "three": "^0.172.0",
29
- "@combos-fun/engine": "0.1.2",
30
- "@combos-fun/inspector-decorator": "0.1.2"
29
+ "@combos-fun/engine": "0.1.4-beta.0",
30
+ "@combos-fun/inspector-decorator": "0.1.4-beta.0"
31
31
  },
32
32
  "description": "3D rendering foundation",
33
33
  "keywords": [