@combos-fun/plugin-renderer-3d-sprite-animation 0.0.42 → 0.0.44

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.
@@ -167,9 +167,17 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends pluginRender
167
167
  const entry = this.entries.get(gameObject.id);
168
168
  if (!entry)
169
169
  return;
170
- entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
171
- entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
172
- entry.mesh.scale.set(component.scaleX, component.scaleY, 1);
170
+ const transform = gameObject.getComponent(pluginRenderer3d.Transform3D);
171
+ if (!entry.poseBridge.sync(component, transform)) {
172
+ entry.mesh.position.set(0, 0, 0);
173
+ entry.mesh.rotation.set(0, 0, 0);
174
+ entry.mesh.scale.set(1, 1, 1);
175
+ }
176
+ else {
177
+ entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
178
+ entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
179
+ entry.mesh.scale.set(component.scaleX, component.scaleY, 1);
180
+ }
173
181
  if (!entry.playing || entry.frames.length === 0)
174
182
  return;
175
183
  const delta = this.threeContext.clock.getDelta() * 1000;
@@ -213,6 +221,11 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends pluginRender
213
221
  });
214
222
  const mesh = new three.Mesh(geometry, material);
215
223
  pluginRenderer3d.tagObject3D(mesh, gameObject.id);
224
+ if (this.threeContext.shadows) {
225
+ mesh.castShadow = true;
226
+ mesh.receiveShadow = true;
227
+ }
228
+ const poseBridge = new pluginRenderer3d.VisualPoseBridge();
216
229
  const entry = {
217
230
  mesh,
218
231
  texture,
@@ -222,12 +235,16 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends pluginRender
222
235
  currentFrame: 0,
223
236
  elapsed: 0,
224
237
  playing: component.autoPlay,
238
+ poseBridge,
225
239
  };
226
240
  this.applyFrame(entry);
227
- mesh.position.set(component.positionX, component.positionY, component.positionZ);
228
- mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
229
- mesh.scale.set(component.scaleX, component.scaleY, 1);
230
- this.threeContext.scene.add(mesh);
241
+ const transform = gameObject.getComponent(pluginRenderer3d.Transform3D);
242
+ if (poseBridge.sync(component, transform)) {
243
+ mesh.position.set(component.positionX, component.positionY, component.positionZ);
244
+ mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
245
+ mesh.scale.set(component.scaleX, component.scaleY, 1);
246
+ }
247
+ this.threeContext.attachVisual(gameObject.id, mesh, gameObject);
231
248
  this.entries.set(gameObject.id, entry);
232
249
  }
233
250
  catch (e) {
@@ -248,7 +265,7 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends pluginRender
248
265
  const entry = this.entries.get(id);
249
266
  if (!entry)
250
267
  return;
251
- this.threeContext.scene.remove(entry.mesh);
268
+ this.threeContext.detachVisual(id, entry.mesh);
252
269
  entry.mesh.geometry.dispose();
253
270
  entry.mesh.material.dispose();
254
271
  entry.texture.dispose();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-sprite-animation.cjs.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface SpriteAnimation3DParams {\n resource?: string;\n autoPlay?: boolean;\n speed?: number;\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}\n\nexport default class SpriteAnimation3D extends Component<SpriteAnimation3DParams> {\n static componentName: string = 'SpriteAnimation3D';\n\n @Field({\n\n type: 'string',\n\n group: 'SpriteAnimation3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'SpriteAnimation3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n step: 10,\n group: 'SpriteAnimation3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 100;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n\n init(obj?: SpriteAnimation3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport {\n Renderer3D,\n Renderer3DSystem,\n requireNamedResource,\n tagObject3D,\n textureFromResourceImage,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport SpriteAnimation3D from './component';\n\ninterface FrameData {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SpriteAnimation3DEntry {\n mesh: Mesh;\n texture: Texture;\n frames: FrameData[];\n sheetWidth: number;\n sheetHeight: number;\n currentFrame: number;\n elapsed: number;\n playing: boolean;\n}\n\n@decorators.componentObserver({\n SpriteAnimation3D: [\n 'resource', 'speed',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class SpriteAnimation3DSystem extends Renderer3D {\n static systemName = 'SpriteAnimation3DSystem';\n name: string = 'SpriteAnimation3DSystem';\n\n private entries: Map<number, SpriteAnimation3DEntry> = new Map();\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 !== 'SpriteAnimation3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as SpriteAnimation3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(SpriteAnimation3D) as SpriteAnimation3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, 1);\n\n if (!entry.playing || entry.frames.length === 0) return;\n\n const delta = this.threeContext.clock.getDelta() * 1000;\n entry.elapsed += delta;\n\n if (entry.elapsed >= component.speed) {\n entry.elapsed -= component.speed;\n entry.currentFrame = (entry.currentFrame + 1) % entry.frames.length;\n this.applyFrame(entry);\n }\n }\n\n private async handleAdd(gameObject: GameObject, component: SpriteAnimation3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n try {\n const res = await requireNamedResource(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n const json = res.data?.json;\n if (!json) {\n throw new Error(\n `Resource \"${res.name}\" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`,\n );\n }\n\n const texture = textureFromResourceImage(res);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const frames = this.parseFrames(json.frames);\n const sheetWidth = json.meta?.size?.w || texture.image?.width || 1;\n const sheetHeight = json.meta?.size?.h || texture.image?.height || 1;\n\n const firstFrame = frames[0];\n if (!firstFrame) {\n throw new Error(`Resource \"${res.name}\" spritesheet has no frames`);\n }\n const aspectRatio = firstFrame.w / firstFrame.h;\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n side: DoubleSide,\n });\n const mesh = new Mesh(geometry, material);\n tagObject3D(mesh, gameObject.id);\n\n const entry: SpriteAnimation3DEntry = {\n mesh,\n texture,\n frames,\n sheetWidth,\n sheetHeight,\n currentFrame: 0,\n elapsed: 0,\n playing: component.autoPlay,\n };\n\n this.applyFrame(entry);\n\n mesh.position.set(component.positionX, component.positionY, component.positionZ);\n mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n mesh.scale.set(component.scaleX, component.scaleY, 1);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, entry);\n } catch (e) {\n console.error('SpriteAnimation3DSystem: failed to load spritesheet', e);\n throw e;\n }\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as SpriteAnimation3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private applyFrame(entry: SpriteAnimation3DEntry) {\n const frame = entry.frames[entry.currentFrame];\n const tex = entry.texture;\n\n tex.offset.set(frame.x / entry.sheetWidth, 1 - (frame.y + frame.h) / entry.sheetHeight);\n tex.repeat.set(frame.w / entry.sheetWidth, frame.h / entry.sheetHeight);\n }\n\n private parseFrames(framesData: any): FrameData[] {\n if (Array.isArray(framesData)) {\n return framesData.map((f: any) => ({\n x: f.frame.x,\n y: f.frame.y,\n w: f.frame.w,\n h: f.frame.h,\n }));\n }\n return Object.keys(framesData)\n .sort()\n .map((key) => ({\n x: framesData[key].frame.x,\n y: framesData[key].frame.y,\n w: framesData[key].frame.w,\n h: framesData[key].frame.h,\n }));\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","requireNamedResource","textureFromResourceImage","PlaneGeometry","MeshBasicMaterial","DoubleSide","Mesh","tagObject3D","decorators"],"mappings":";;;;;;;;AAiBc,MAAO,iBAAkB,SAAQA,gBAAkC,CAAA;AAAjF,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;QAQrB,IAAA,CAAA,QAAQ,GAAY,IAAI;QASxB,IAAA,CAAA,KAAK,GAAW,GAAG;QASnB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS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,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;AACb,aAAA,CAAC,CAAC;QACL;AACA,QAAA,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU;AAC1B,aAAA,IAAI;AACJ,aAAA,GAAG,CAAC,CAAC,GAAG,MAAM;YACb,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3B,SAAA,CAAC,CAAC;IACP;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AArKmB,uBAAuB,GAAAX,gBAAA,CAAA;IAR3CY,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,iBAAiB,EAAE;AACjB,YAAA,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,uBAAuB,CAsK3C;sCAtKoB,uBAAuB;;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-sprite-animation.cjs.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface SpriteAnimation3DParams {\n resource?: string;\n autoPlay?: boolean;\n speed?: number;\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}\n\nexport default class SpriteAnimation3D extends Component<SpriteAnimation3DParams> {\n static componentName: string = 'SpriteAnimation3D';\n\n @Field({\n\n type: 'string',\n\n group: 'SpriteAnimation3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'SpriteAnimation3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n step: 10,\n group: 'SpriteAnimation3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 100;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n\n init(obj?: SpriteAnimation3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport {\n Renderer3D,\n Renderer3DSystem,\n requireNamedResource,\n tagObject3D,\n textureFromResourceImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport SpriteAnimation3D from './component';\n\ninterface FrameData {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SpriteAnimation3DEntry {\n mesh: Mesh;\n texture: Texture;\n frames: FrameData[];\n sheetWidth: number;\n sheetHeight: number;\n currentFrame: number;\n elapsed: number;\n playing: boolean;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n SpriteAnimation3D: [\n 'resource', 'speed',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class SpriteAnimation3DSystem extends Renderer3D {\n static systemName = 'SpriteAnimation3DSystem';\n name: string = 'SpriteAnimation3DSystem';\n\n private entries: Map<number, SpriteAnimation3DEntry> = new Map();\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 !== 'SpriteAnimation3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as SpriteAnimation3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(SpriteAnimation3D) as SpriteAnimation3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!entry.poseBridge.sync(component, transform)) {\n entry.mesh.position.set(0, 0, 0);\n entry.mesh.rotation.set(0, 0, 0);\n entry.mesh.scale.set(1, 1, 1);\n } else {\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, 1);\n }\n\n if (!entry.playing || entry.frames.length === 0) return;\n\n const delta = this.threeContext.clock.getDelta() * 1000;\n entry.elapsed += delta;\n\n if (entry.elapsed >= component.speed) {\n entry.elapsed -= component.speed;\n entry.currentFrame = (entry.currentFrame + 1) % entry.frames.length;\n this.applyFrame(entry);\n }\n }\n\n private async handleAdd(gameObject: GameObject, component: SpriteAnimation3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n try {\n const res = await requireNamedResource(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n const json = res.data?.json;\n if (!json) {\n throw new Error(\n `Resource \"${res.name}\" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`,\n );\n }\n\n const texture = textureFromResourceImage(res);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const frames = this.parseFrames(json.frames);\n const sheetWidth = json.meta?.size?.w || texture.image?.width || 1;\n const sheetHeight = json.meta?.size?.h || texture.image?.height || 1;\n\n const firstFrame = frames[0];\n if (!firstFrame) {\n throw new Error(`Resource \"${res.name}\" spritesheet has no frames`);\n }\n const aspectRatio = firstFrame.w / firstFrame.h;\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n side: DoubleSide,\n });\n const mesh = new Mesh(geometry, material);\n tagObject3D(mesh, gameObject.id);\n if (this.threeContext.shadows) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n const poseBridge = new VisualPoseBridge();\n const entry: SpriteAnimation3DEntry = {\n mesh,\n texture,\n frames,\n sheetWidth,\n sheetHeight,\n currentFrame: 0,\n elapsed: 0,\n playing: component.autoPlay,\n poseBridge,\n };\n\n this.applyFrame(entry);\n\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (poseBridge.sync(component, transform)) {\n mesh.position.set(component.positionX, component.positionY, component.positionZ);\n mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n mesh.scale.set(component.scaleX, component.scaleY, 1);\n }\n\n this.threeContext.attachVisual(gameObject.id, mesh, gameObject);\n this.entries.set(gameObject.id, entry);\n } catch (e) {\n console.error('SpriteAnimation3DSystem: failed to load spritesheet', e);\n throw e;\n }\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as SpriteAnimation3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private applyFrame(entry: SpriteAnimation3DEntry) {\n const frame = entry.frames[entry.currentFrame];\n const tex = entry.texture;\n\n tex.offset.set(frame.x / entry.sheetWidth, 1 - (frame.y + frame.h) / entry.sheetHeight);\n tex.repeat.set(frame.w / entry.sheetWidth, frame.h / entry.sheetHeight);\n }\n\n private parseFrames(framesData: any): FrameData[] {\n if (Array.isArray(framesData)) {\n return framesData.map((f: any) => ({\n x: f.frame.x,\n y: f.frame.y,\n w: f.frame.w,\n h: f.frame.h,\n }));\n }\n return Object.keys(framesData)\n .sort()\n .map((key) => ({\n x: framesData[key].frame.x,\n y: framesData[key].frame.y,\n w: framesData[key].frame.w,\n h: framesData[key].frame.h,\n }));\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","Transform3D","requireNamedResource","textureFromResourceImage","PlaneGeometry","MeshBasicMaterial","DoubleSide","Mesh","tagObject3D","VisualPoseBridge","decorators"],"mappings":";;;;;;;;AAiBc,MAAO,iBAAkB,SAAQA,gBAAkC,CAAA;AAAjF,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;QAQrB,IAAA,CAAA,QAAQ,GAAY,IAAI;QASxB,IAAA,CAAA,KAAK,GAAW,GAAG;QASnB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;IAKpB;aA9GS,IAAA,CAAA,aAAa,GAAW,mBAAX,CAA+B;AA2GnD,IAAA,IAAI,CAAC,GAA6B,EAAA;AAChC,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AA7FAC,gBAAA,CAAA;AAdC,IAAAC,wBAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EAAE,mBAAmB;AAE1B,QAAA,KAAK,EAAE,UAAU;AAEjB,QAAA,WAAW,EAAE,sEAAsE;AAEnF,QAAA,MAAM,EAAE,MAAM;KAEf;AAE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SAAA;KACF;AACoB,CAAA,EAAA,uBAAuB,CAsL3C;sCAtLoB,uBAAuB;;;;;"}
@@ -1 +1 @@
1
- "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),i=require("@combos-fun/inspector-decorator"),o=require("@combos-fun/plugin-renderer-3d"),r=require("three");class s extends t.Component{constructor(){super(...arguments),this.resource="",this.autoPlay=!0,this.speed=100,this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1}static{this.componentName="SpriteAnimation3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([i.Field({type:"string",group:"SpriteAnimation3D",label:"resource",description:"Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.",editor:"text"})],s.prototype,"resource",void 0),e.__decorate([i.Field({type:"boolean",group:"SpriteAnimation3D",label:"autoPlay",description:"Start playing automatically when loaded.",editor:"toggle"})],s.prototype,"autoPlay",void 0),e.__decorate([i.Field({type:"number",step:10,group:"SpriteAnimation3D",label:"speed",description:"Playback speed.",editor:"number-stepper"})],s.prototype,"speed",void 0),e.__decorate([i.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],s.prototype,"positionX",void 0),e.__decorate([i.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],s.prototype,"positionY",void 0),e.__decorate([i.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],s.prototype,"positionZ",void 0),e.__decorate([i.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],s.prototype,"rotationX",void 0),e.__decorate([i.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],s.prototype,"rotationY",void 0),e.__decorate([i.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],s.prototype,"rotationZ",void 0),e.__decorate([i.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],s.prototype,"scaleX",void 0),e.__decorate([i.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],s.prototype,"scaleY",void 0);let n=class extends o.Renderer3D{constructor(){super(...arguments),this.name="SpriteAnimation3DSystem",this.entries=new Map}static{this.systemName="SpriteAnimation3DSystem"}init(){this.game.getSystem(o.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"SpriteAnimation3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(s);if(!t)return;const i=this.entries.get(e.id);if(!i)return;if(i.mesh.position.set(t.positionX,t.positionY,t.positionZ),i.mesh.rotation.set(t.rotationX,t.rotationY,t.rotationZ),i.mesh.scale.set(t.scaleX,t.scaleY,1),!i.playing||0===i.frames.length)return;const o=1e3*this.threeContext.clock.getDelta();i.elapsed+=o,i.elapsed>=t.speed&&(i.elapsed-=t.speed,i.currentFrame=(i.currentFrame+1)%i.frames.length,this.applyFrame(i))}async handleAdd(e,t){if(!t.resource)return;const i=this.increaseAsyncId(e.id);try{const s=await o.requireNamedResource(t.resource);if(!this.validateAsyncId(e.id,i))return;const n=s.data?.json;if(!n)throw new Error(`Resource "${s.name}" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`);const a=o.textureFromResourceImage(s);if(!this.validateAsyncId(e.id,i))return void a.dispose();const p=this.parseFrames(n.frames),d=n.meta?.size?.w||a.image?.width||1,c=n.meta?.size?.h||a.image?.height||1,m=p[0];if(!m)throw new Error(`Resource "${s.name}" spritesheet has no frames`);const h=m.w/m.h,l=new r.PlaneGeometry(h,1),u=new r.MeshBasicMaterial({map:a,transparent:!0,side:r.DoubleSide}),y=new r.Mesh(l,u);o.tagObject3D(y,e.id);const g={mesh:y,texture:a,frames:p,sheetWidth:d,sheetHeight:c,currentFrame:0,elapsed:0,playing:t.autoPlay};this.applyFrame(g),y.position.set(t.positionX,t.positionY,t.positionZ),y.rotation.set(t.rotationX,t.rotationY,t.rotationZ),y.scale.set(t.scaleX,t.scaleY,1),this.threeContext.scene.add(y),this.entries.set(e.id,g)}catch(e){throw console.error("SpriteAnimation3DSystem: failed to load spritesheet",e),e}}handleChange(e){const t=e.component,i=e.prop?.prop?.[0];"resource"===i&&(this.handleRemove(e.gameObject.id),this.handleAdd(e.gameObject,t))}handleRemove(e){this.increaseAsyncId(e);const t=this.entries.get(e);t&&(this.threeContext.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.entries.delete(e))}applyFrame(e){const t=e.frames[e.currentFrame],i=e.texture;i.offset.set(t.x/e.sheetWidth,1-(t.y+t.h)/e.sheetHeight),i.repeat.set(t.w/e.sheetWidth,t.h/e.sheetHeight)}parseFrames(e){return Array.isArray(e)?e.map(e=>({x:e.frame.x,y:e.frame.y,w:e.frame.w,h:e.frame.h})):Object.keys(e).sort().map(t=>({x:e[t].frame.x,y:e[t].frame.y,w:e[t].frame.w,h:e[t].frame.h}))}onDestroy(){for(const[e]of this.entries)this.handleRemove(e);this.entries.clear()}};n=e.__decorate([t.decorators.componentObserver({SpriteAnimation3D:["resource","speed","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY"]})],n);var a=n;exports.SpriteAnimation3D=s,exports.SpriteAnimation3DSystem=a;
1
+ "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),i=require("@combos-fun/plugin-renderer-3d"),r=require("three");class s extends t.Component{constructor(){super(...arguments),this.resource="",this.autoPlay=!0,this.speed=100,this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1}static{this.componentName="SpriteAnimation3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.Field({type:"string",group:"SpriteAnimation3D",label:"resource",description:"Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.",editor:"text"})],s.prototype,"resource",void 0),e.__decorate([o.Field({type:"boolean",group:"SpriteAnimation3D",label:"autoPlay",description:"Start playing automatically when loaded.",editor:"toggle"})],s.prototype,"autoPlay",void 0),e.__decorate([o.Field({type:"number",step:10,group:"SpriteAnimation3D",label:"speed",description:"Playback speed.",editor:"number-stepper"})],s.prototype,"speed",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],s.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],s.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],s.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],s.prototype,"rotationX",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],s.prototype,"rotationY",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"SpriteAnimation3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],s.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],s.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"SpriteAnimation3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],s.prototype,"scaleY",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="SpriteAnimation3DSystem",this.entries=new Map}static{this.systemName="SpriteAnimation3DSystem"}init(){this.game.getSystem(i.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"SpriteAnimation3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(s);if(!t)return;const o=this.entries.get(e.id);if(!o)return;const r=e.getComponent(i.Transform3D);if(o.poseBridge.sync(t,r)?(o.mesh.position.set(t.positionX,t.positionY,t.positionZ),o.mesh.rotation.set(t.rotationX,t.rotationY,t.rotationZ),o.mesh.scale.set(t.scaleX,t.scaleY,1)):(o.mesh.position.set(0,0,0),o.mesh.rotation.set(0,0,0),o.mesh.scale.set(1,1,1)),!o.playing||0===o.frames.length)return;const n=1e3*this.threeContext.clock.getDelta();o.elapsed+=n,o.elapsed>=t.speed&&(o.elapsed-=t.speed,o.currentFrame=(o.currentFrame+1)%o.frames.length,this.applyFrame(o))}async handleAdd(e,t){if(!t.resource)return;const o=this.increaseAsyncId(e.id);try{const s=await i.requireNamedResource(t.resource);if(!this.validateAsyncId(e.id,o))return;const n=s.data?.json;if(!n)throw new Error(`Resource "${s.name}" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`);const a=i.textureFromResourceImage(s);if(!this.validateAsyncId(e.id,o))return void a.dispose();const p=this.parseFrames(n.frames),d=n.meta?.size?.w||a.image?.width||1,c=n.meta?.size?.h||a.image?.height||1,m=p[0];if(!m)throw new Error(`Resource "${s.name}" spritesheet has no frames`);const h=m.w/m.h,l=new r.PlaneGeometry(h,1),u=new r.MeshBasicMaterial({map:a,transparent:!0,side:r.DoubleSide}),y=new r.Mesh(l,u);i.tagObject3D(y,e.id),this.threeContext.shadows&&(y.castShadow=!0,y.receiveShadow=!0);const g=new i.VisualPoseBridge,b={mesh:y,texture:a,frames:p,sheetWidth:d,sheetHeight:c,currentFrame:0,elapsed:0,playing:t.autoPlay,poseBridge:g};this.applyFrame(b);const S=e.getComponent(i.Transform3D);g.sync(t,S)&&(y.position.set(t.positionX,t.positionY,t.positionZ),y.rotation.set(t.rotationX,t.rotationY,t.rotationZ),y.scale.set(t.scaleX,t.scaleY,1)),this.threeContext.attachVisual(e.id,y,e),this.entries.set(e.id,b)}catch(e){throw console.error("SpriteAnimation3DSystem: failed to load spritesheet",e),e}}handleChange(e){const t=e.component,o=e.prop?.prop?.[0];"resource"===o&&(this.handleRemove(e.gameObject.id),this.handleAdd(e.gameObject,t))}handleRemove(e){this.increaseAsyncId(e);const t=this.entries.get(e);t&&(this.threeContext.detachVisual(e,t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.entries.delete(e))}applyFrame(e){const t=e.frames[e.currentFrame],o=e.texture;o.offset.set(t.x/e.sheetWidth,1-(t.y+t.h)/e.sheetHeight),o.repeat.set(t.w/e.sheetWidth,t.h/e.sheetHeight)}parseFrames(e){return Array.isArray(e)?e.map(e=>({x:e.frame.x,y:e.frame.y,w:e.frame.w,h:e.frame.h})):Object.keys(e).sort().map(t=>({x:e[t].frame.x,y:e[t].frame.y,w:e[t].frame.w,h:e[t].frame.h}))}onDestroy(){for(const[e]of this.entries)this.handleRemove(e);this.entries.clear()}};n=e.__decorate([t.decorators.componentObserver({SpriteAnimation3D:["resource","speed","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY"]})],n);var a=n;exports.SpriteAnimation3D=s,exports.SpriteAnimation3DSystem=a;
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import { Component, OBSERVER_TYPE, decorators } from '@combos-fun/engine';
3
3
  import { Field } from '@combos-fun/inspector-decorator';
4
- import { Renderer3D, Renderer3DSystem, requireNamedResource, textureFromResourceImage, tagObject3D } from '@combos-fun/plugin-renderer-3d';
4
+ import { Renderer3D, Renderer3DSystem, Transform3D, requireNamedResource, textureFromResourceImage, tagObject3D, VisualPoseBridge } from '@combos-fun/plugin-renderer-3d';
5
5
  import { PlaneGeometry, MeshBasicMaterial, DoubleSide, Mesh } from 'three';
6
6
 
7
7
  class SpriteAnimation3D extends Component {
@@ -165,9 +165,17 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends Renderer3D {
165
165
  const entry = this.entries.get(gameObject.id);
166
166
  if (!entry)
167
167
  return;
168
- entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
169
- entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
170
- entry.mesh.scale.set(component.scaleX, component.scaleY, 1);
168
+ const transform = gameObject.getComponent(Transform3D);
169
+ if (!entry.poseBridge.sync(component, transform)) {
170
+ entry.mesh.position.set(0, 0, 0);
171
+ entry.mesh.rotation.set(0, 0, 0);
172
+ entry.mesh.scale.set(1, 1, 1);
173
+ }
174
+ else {
175
+ entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
176
+ entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
177
+ entry.mesh.scale.set(component.scaleX, component.scaleY, 1);
178
+ }
171
179
  if (!entry.playing || entry.frames.length === 0)
172
180
  return;
173
181
  const delta = this.threeContext.clock.getDelta() * 1000;
@@ -211,6 +219,11 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends Renderer3D {
211
219
  });
212
220
  const mesh = new Mesh(geometry, material);
213
221
  tagObject3D(mesh, gameObject.id);
222
+ if (this.threeContext.shadows) {
223
+ mesh.castShadow = true;
224
+ mesh.receiveShadow = true;
225
+ }
226
+ const poseBridge = new VisualPoseBridge();
214
227
  const entry = {
215
228
  mesh,
216
229
  texture,
@@ -220,12 +233,16 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends Renderer3D {
220
233
  currentFrame: 0,
221
234
  elapsed: 0,
222
235
  playing: component.autoPlay,
236
+ poseBridge,
223
237
  };
224
238
  this.applyFrame(entry);
225
- mesh.position.set(component.positionX, component.positionY, component.positionZ);
226
- mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
227
- mesh.scale.set(component.scaleX, component.scaleY, 1);
228
- this.threeContext.scene.add(mesh);
239
+ const transform = gameObject.getComponent(Transform3D);
240
+ if (poseBridge.sync(component, transform)) {
241
+ mesh.position.set(component.positionX, component.positionY, component.positionZ);
242
+ mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
243
+ mesh.scale.set(component.scaleX, component.scaleY, 1);
244
+ }
245
+ this.threeContext.attachVisual(gameObject.id, mesh, gameObject);
229
246
  this.entries.set(gameObject.id, entry);
230
247
  }
231
248
  catch (e) {
@@ -246,7 +263,7 @@ let SpriteAnimation3DSystem = class SpriteAnimation3DSystem extends Renderer3D {
246
263
  const entry = this.entries.get(id);
247
264
  if (!entry)
248
265
  return;
249
- this.threeContext.scene.remove(entry.mesh);
266
+ this.threeContext.detachVisual(id, entry.mesh);
250
267
  entry.mesh.geometry.dispose();
251
268
  entry.mesh.material.dispose();
252
269
  entry.texture.dispose();
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-sprite-animation.esm.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface SpriteAnimation3DParams {\n resource?: string;\n autoPlay?: boolean;\n speed?: number;\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}\n\nexport default class SpriteAnimation3D extends Component<SpriteAnimation3DParams> {\n static componentName: string = 'SpriteAnimation3D';\n\n @Field({\n\n type: 'string',\n\n group: 'SpriteAnimation3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'SpriteAnimation3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n step: 10,\n group: 'SpriteAnimation3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 100;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n\n init(obj?: SpriteAnimation3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport {\n Renderer3D,\n Renderer3DSystem,\n requireNamedResource,\n tagObject3D,\n textureFromResourceImage,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport SpriteAnimation3D from './component';\n\ninterface FrameData {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SpriteAnimation3DEntry {\n mesh: Mesh;\n texture: Texture;\n frames: FrameData[];\n sheetWidth: number;\n sheetHeight: number;\n currentFrame: number;\n elapsed: number;\n playing: boolean;\n}\n\n@decorators.componentObserver({\n SpriteAnimation3D: [\n 'resource', 'speed',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class SpriteAnimation3DSystem extends Renderer3D {\n static systemName = 'SpriteAnimation3DSystem';\n name: string = 'SpriteAnimation3DSystem';\n\n private entries: Map<number, SpriteAnimation3DEntry> = new Map();\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 !== 'SpriteAnimation3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as SpriteAnimation3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(SpriteAnimation3D) as SpriteAnimation3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, 1);\n\n if (!entry.playing || entry.frames.length === 0) return;\n\n const delta = this.threeContext.clock.getDelta() * 1000;\n entry.elapsed += delta;\n\n if (entry.elapsed >= component.speed) {\n entry.elapsed -= component.speed;\n entry.currentFrame = (entry.currentFrame + 1) % entry.frames.length;\n this.applyFrame(entry);\n }\n }\n\n private async handleAdd(gameObject: GameObject, component: SpriteAnimation3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n try {\n const res = await requireNamedResource(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n const json = res.data?.json;\n if (!json) {\n throw new Error(\n `Resource \"${res.name}\" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`,\n );\n }\n\n const texture = textureFromResourceImage(res);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const frames = this.parseFrames(json.frames);\n const sheetWidth = json.meta?.size?.w || texture.image?.width || 1;\n const sheetHeight = json.meta?.size?.h || texture.image?.height || 1;\n\n const firstFrame = frames[0];\n if (!firstFrame) {\n throw new Error(`Resource \"${res.name}\" spritesheet has no frames`);\n }\n const aspectRatio = firstFrame.w / firstFrame.h;\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n side: DoubleSide,\n });\n const mesh = new Mesh(geometry, material);\n tagObject3D(mesh, gameObject.id);\n\n const entry: SpriteAnimation3DEntry = {\n mesh,\n texture,\n frames,\n sheetWidth,\n sheetHeight,\n currentFrame: 0,\n elapsed: 0,\n playing: component.autoPlay,\n };\n\n this.applyFrame(entry);\n\n mesh.position.set(component.positionX, component.positionY, component.positionZ);\n mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n mesh.scale.set(component.scaleX, component.scaleY, 1);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, entry);\n } catch (e) {\n console.error('SpriteAnimation3DSystem: failed to load spritesheet', e);\n throw e;\n }\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as SpriteAnimation3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private applyFrame(entry: SpriteAnimation3DEntry) {\n const frame = entry.frames[entry.currentFrame];\n const tex = entry.texture;\n\n tex.offset.set(frame.x / entry.sheetWidth, 1 - (frame.y + frame.h) / entry.sheetHeight);\n tex.repeat.set(frame.w / entry.sheetWidth, frame.h / entry.sheetHeight);\n }\n\n private parseFrames(framesData: any): FrameData[] {\n if (Array.isArray(framesData)) {\n return framesData.map((f: any) => ({\n x: f.frame.x,\n y: f.frame.y,\n w: f.frame.w,\n h: f.frame.h,\n }));\n }\n return Object.keys(framesData)\n .sort()\n .map((key) => ({\n x: framesData[key].frame.x,\n y: framesData[key].frame.y,\n w: framesData[key].frame.w,\n h: framesData[key].frame.h,\n }));\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBc,MAAO,iBAAkB,SAAQ,SAAkC,CAAA;AAAjF,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;QAQrB,IAAA,CAAA,QAAQ,GAAY,IAAI;QASxB,IAAA,CAAA,KAAK,GAAW,GAAG;QASnB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;IAKpB;aA9GS,IAAA,CA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AAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3B,SAAA,CAAC,CAAC;IACP;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AArKmB,uBAAuB,GAAA,UAAA,CAAA;IAR3C,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,iBAAiB,EAAE;AACjB,YAAA,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,uBAAuB,CAsK3C;sCAtKoB,uBAAuB;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-sprite-animation.esm.js","sources":["../lib/component.ts","../lib/system.ts"],"sourcesContent":["import { Component } from '@combos-fun/engine';\nimport { Field } from '@combos-fun/inspector-decorator';\n\nexport interface SpriteAnimation3DParams {\n resource?: string;\n autoPlay?: boolean;\n speed?: number;\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}\n\nexport default class SpriteAnimation3D extends Component<SpriteAnimation3DParams> {\n static componentName: string = 'SpriteAnimation3D';\n\n @Field({\n\n type: 'string',\n\n group: 'SpriteAnimation3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.SPRITE_ANIMATION.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'SpriteAnimation3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n step: 10,\n group: 'SpriteAnimation3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 100;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\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: 'SpriteAnimation3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n\n init(obj?: SpriteAnimation3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport {\n Renderer3D,\n Renderer3DSystem,\n requireNamedResource,\n tagObject3D,\n textureFromResourceImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport SpriteAnimation3D from './component';\n\ninterface FrameData {\n x: number;\n y: number;\n w: number;\n h: number;\n}\n\ninterface SpriteAnimation3DEntry {\n mesh: Mesh;\n texture: Texture;\n frames: FrameData[];\n sheetWidth: number;\n sheetHeight: number;\n currentFrame: number;\n elapsed: number;\n playing: boolean;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n SpriteAnimation3D: [\n 'resource', 'speed',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class SpriteAnimation3DSystem extends Renderer3D {\n static systemName = 'SpriteAnimation3DSystem';\n name: string = 'SpriteAnimation3DSystem';\n\n private entries: Map<number, SpriteAnimation3DEntry> = new Map();\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 !== 'SpriteAnimation3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as SpriteAnimation3D);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.handleRemove(changed.gameObject.id);\n } else {\n this.handleChange(changed);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(SpriteAnimation3D) as SpriteAnimation3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (!entry.poseBridge.sync(component, transform)) {\n entry.mesh.position.set(0, 0, 0);\n entry.mesh.rotation.set(0, 0, 0);\n entry.mesh.scale.set(1, 1, 1);\n } else {\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, 1);\n }\n\n if (!entry.playing || entry.frames.length === 0) return;\n\n const delta = this.threeContext.clock.getDelta() * 1000;\n entry.elapsed += delta;\n\n if (entry.elapsed >= component.speed) {\n entry.elapsed -= component.speed;\n entry.currentFrame = (entry.currentFrame + 1) % entry.frames.length;\n this.applyFrame(entry);\n }\n }\n\n private async handleAdd(gameObject: GameObject, component: SpriteAnimation3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n try {\n const res = await requireNamedResource(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n const json = res.data?.json;\n if (!json) {\n throw new Error(\n `Resource \"${res.name}\" has no json data; use RESOURCE_TYPE.SPRITE_ANIMATION with src.image and src.json`,\n );\n }\n\n const texture = textureFromResourceImage(res);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const frames = this.parseFrames(json.frames);\n const sheetWidth = json.meta?.size?.w || texture.image?.width || 1;\n const sheetHeight = json.meta?.size?.h || texture.image?.height || 1;\n\n const firstFrame = frames[0];\n if (!firstFrame) {\n throw new Error(`Resource \"${res.name}\" spritesheet has no frames`);\n }\n const aspectRatio = firstFrame.w / firstFrame.h;\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n side: DoubleSide,\n });\n const mesh = new Mesh(geometry, material);\n tagObject3D(mesh, gameObject.id);\n if (this.threeContext.shadows) {\n mesh.castShadow = true;\n mesh.receiveShadow = true;\n }\n\n const poseBridge = new VisualPoseBridge();\n const entry: SpriteAnimation3DEntry = {\n mesh,\n texture,\n frames,\n sheetWidth,\n sheetHeight,\n currentFrame: 0,\n elapsed: 0,\n playing: component.autoPlay,\n poseBridge,\n };\n\n this.applyFrame(entry);\n\n const transform = gameObject.getComponent(Transform3D) as Transform3D | undefined;\n if (poseBridge.sync(component, transform)) {\n mesh.position.set(component.positionX, component.positionY, component.positionZ);\n mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n mesh.scale.set(component.scaleX, component.scaleY, 1);\n }\n\n this.threeContext.attachVisual(gameObject.id, mesh, gameObject);\n this.entries.set(gameObject.id, entry);\n } catch (e) {\n console.error('SpriteAnimation3DSystem: failed to load spritesheet', e);\n throw e;\n }\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as SpriteAnimation3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.detachVisual(id, entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private applyFrame(entry: SpriteAnimation3DEntry) {\n const frame = entry.frames[entry.currentFrame];\n const tex = entry.texture;\n\n tex.offset.set(frame.x / entry.sheetWidth, 1 - (frame.y + frame.h) / entry.sheetHeight);\n tex.repeat.set(frame.w / entry.sheetWidth, frame.h / entry.sheetHeight);\n }\n\n private parseFrames(framesData: any): FrameData[] {\n if (Array.isArray(framesData)) {\n return framesData.map((f: any) => ({\n x: f.frame.x,\n y: f.frame.y,\n w: f.frame.w,\n h: f.frame.h,\n }));\n }\n return Object.keys(framesData)\n .sort()\n .map((key) => ({\n x: framesData[key].frame.x,\n y: framesData[key].frame.y,\n w: framesData[key].frame.w,\n h: framesData[key].frame.h,\n }));\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBc,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C1B,aAAA,IAAI;AACJ,aAAA,GAAG,CAAC,CAAC,GAAG,MAAM;YACb,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3B,SAAA,CAAC,CAAC;IACP;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AArLmB,uBAAuB,GAAA,UAAA,CAAA;IAR3C,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,iBAAiB,EAAE;AACjB,YAAA,UAAU,EAAE,OAAO;YACnB,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,uBAAuB,CAsL3C;sCAtLoB,uBAAuB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-sprite-animation",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "Spritesheet animation projected onto a PlaneGeometry in 3D space",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-sprite-animation.esm.js",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "three": "^0.172.0",
30
- "@combos-fun/engine": "0.0.42",
31
- "@combos-fun/plugin-renderer-3d": "0.0.42",
32
- "@combos-fun/inspector-decorator": "0.0.42"
30
+ "@combos-fun/engine": "0.0.44",
31
+ "@combos-fun/inspector-decorator": "0.0.44",
32
+ "@combos-fun/plugin-renderer-3d": "0.0.44"
33
33
  },
34
34
  "keywords": [
35
35
  "combos-fun",