@combos-fun/plugin-renderer-3d-img 0.1.13 → 0.1.14-beta.1

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.
@@ -184,7 +184,7 @@ let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
184
184
  if (!component.resource)
185
185
  return;
186
186
  const asyncId = this.increaseAsyncId(gameObject.id);
187
- const texture = await pluginRenderer3d.textureFromNamedImage(component.resource);
187
+ const texture = await pluginRenderer3d.textureFromNamedImage(component.resource, this.threeContext.renderer);
188
188
  if (!this.validateAsyncId(gameObject.id, asyncId)) {
189
189
  texture.dispose();
190
190
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-img.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 Img3DParams {\n resource?: string;\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 opacity?: number;\n doubleSide?: boolean;\n}\n\nexport default class Img3D extends Component<Img3DParams> {\n static componentName: string = 'Img3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Img3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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.01,\n min: 0,\n max: 1,\n group: 'Img3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Img3D',\n label: 'doubleSide',\n description: 'Render both sides of the mesh.',\n editor: 'toggle',\n })\n doubleSide: boolean = false;\n\n init(obj?: Img3DParams) {\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 tagObject3D,\n textureFromNamedImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n FrontSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport Img3D from './component';\n\ninterface Img3DEntry {\n mesh: Mesh;\n texture: Texture;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n Img3D: [\n 'resource', 'opacity', 'doubleSide',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class Img3DSystem extends Renderer3D {\n static systemName = 'Img3DSystem';\n name: string = 'Img3DSystem';\n\n private imgs: Map<number, Img3DEntry> = 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 !== 'Img3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Img3D);\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(Img3D) as Img3D;\n if (!component) return;\n\n const entry = this.imgs.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 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\n private async handleAdd(gameObject: GameObject, component: Img3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await textureFromNamedImage(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const image = texture.image as { width?: number; height?: number };\n const aspectRatio = (image?.width || 1) / (image?.height || 1);\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n opacity: component.opacity,\n side: component.doubleSide ? DoubleSide : FrontSide,\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 const poseBridge = new VisualPoseBridge();\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.imgs.set(gameObject.id, { mesh, texture, poseBridge });\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Img3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.imgs.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n const material = entry.mesh.material as MeshBasicMaterial;\n\n if (changedProp === 'opacity') {\n material.opacity = component.opacity;\n }\n if (changedProp === 'doubleSide') {\n material.side = component.doubleSide ? DoubleSide : FrontSide;\n material.needsUpdate = true;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.imgs.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.imgs.delete(id);\n }\n\n onDestroy() {\n for (const [id] of this.imgs) {\n this.handleRemove(id);\n }\n this.imgs.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","Transform3D","textureFromNamedImage","PlaneGeometry","MeshBasicMaterial","DoubleSide","FrontSide","Mesh","tagObject3D","VisualPoseBridge","decorators"],"mappings":";;;;;;;;AAiBc,MAAO,KAAM,SAAQA,gBAAsB,CAAA;AAAzD,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,S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AAC;AAC/B,QAAA,IAAI,CAAC,KAAK;YAAE;QAEZ,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC;AAC9C,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAA,KAAK,CAAC,IAAI,CAAC,QAA8B,CAAC,OAAO,EAAE;AACpD,QAAA,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACtB;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;AAC5B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;IACnB;;AAzHmB,WAAW,GAAAV,gBAAA,CAAA;IAR/Bc,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,KAAK,EAAE;YACL,UAAU,EAAE,SAAS,EAAE,YAAY;YACnC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CA0H/B;0BA1HoB,WAAW;;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-img.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 Img3DParams {\n resource?: string;\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 opacity?: number;\n doubleSide?: boolean;\n}\n\nexport default class Img3D extends Component<Img3DParams> {\n static componentName: string = 'Img3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Img3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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.01,\n min: 0,\n max: 1,\n group: 'Img3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Img3D',\n label: 'doubleSide',\n description: 'Render both sides of the mesh.',\n editor: 'toggle',\n })\n doubleSide: boolean = false;\n\n init(obj?: Img3DParams) {\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 tagObject3D,\n textureFromNamedImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n FrontSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport Img3D from './component';\n\ninterface Img3DEntry {\n mesh: Mesh;\n texture: Texture;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n Img3D: [\n 'resource', 'opacity', 'doubleSide',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class Img3DSystem extends Renderer3D {\n static systemName = 'Img3DSystem';\n name: string = 'Img3DSystem';\n\n private imgs: Map<number, Img3DEntry> = 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 !== 'Img3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Img3D);\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(Img3D) as Img3D;\n if (!component) return;\n\n const entry = this.imgs.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 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\n private async handleAdd(gameObject: GameObject, component: Img3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await textureFromNamedImage(component.resource, this.threeContext.renderer);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const image = texture.image as { width?: number; height?: number };\n const aspectRatio = (image?.width || 1) / (image?.height || 1);\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n opacity: component.opacity,\n side: component.doubleSide ? DoubleSide : FrontSide,\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 const poseBridge = new VisualPoseBridge();\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.imgs.set(gameObject.id, { mesh, texture, poseBridge });\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Img3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.imgs.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n const material = entry.mesh.material as MeshBasicMaterial;\n\n if (changedProp === 'opacity') {\n material.opacity = component.opacity;\n }\n if (changedProp === 'doubleSide') {\n material.side = component.doubleSide ? DoubleSide : FrontSide;\n material.needsUpdate = true;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.imgs.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.imgs.delete(id);\n }\n\n onDestroy() {\n for (const [id] of this.imgs) {\n this.handleRemove(id);\n }\n this.imgs.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","Transform3D","textureFromNamedImage","PlaneGeometry","MeshBasicMaterial","DoubleSide","FrontSide","Mesh","tagObject3D","VisualPoseBridge","decorators"],"mappings":";;;;;;;;AAiBc,MAAO,KAAM,SAAQA,gBAAsB,CAAA;AAAzD,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;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,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;QAWlB,IAAA,CAAA,OAAO,GAAW,CAAC;QAQnB,IAAA,CAAA,UAAU,GAAY,KAAK;IAK7B;aAhHS,IAAA,CAAA,aAAa,GAAW,OAAX,CAAmB;AA6GvC,IAAA,IAAI,CAAC,GAAiB,EAAA;AACpB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AA/FAC,gBAAA,CAAA;AAdC,IAAAC,wBAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EAAE,OAAO;AAEd,QAAA,KAAK,EAAE,UAAU;AAEjB,QAAA,WAAW,EAAE,2DAA2D;AAExE,QAAA,MAAM,EAAE,MAAM;KAEf;AAEqB,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAStBD,gBAAA,CAA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AW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CA0H/B;0BA1HoB,WAAW;;;;;"}
@@ -1 +1 @@
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"),s=require("three");class r extends t.Component{constructor(){super(...arguments),this.resource="",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.opacity=1,this.doubleSide=!1}static{this.componentName="Img3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.Field({type:"string",group:"Img3D",label:"resource",description:"Engine resource name registered with RESOURCE_TYPE.IMAGE.",editor:"text"})],r.prototype,"resource",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],r.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],r.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],r.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],r.prototype,"rotationX",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],r.prototype,"rotationY",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],r.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],r.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],r.prototype,"scaleY",void 0),e.__decorate([o.Field({type:"number",step:.01,min:0,max:1,group:"Img3D",label:"opacity",description:"Opacity from 0 to 1.",editor:"number-slider"})],r.prototype,"opacity",void 0),e.__decorate([o.Field({type:"boolean",group:"Img3D",label:"doubleSide",description:"Render both sides of the mesh.",editor:"toggle"})],r.prototype,"doubleSide",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="Img3DSystem",this.imgs=new Map}static{this.systemName="Img3DSystem"}init(){this.game.getSystem(i.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"Img3D"===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(r);if(!t)return;const o=this.imgs.get(e.id);if(!o)return;const s=e.getComponent(i.Transform3D);if(!o.poseBridge.sync(t,s))return o.mesh.position.set(0,0,0),o.mesh.rotation.set(0,0,0),void o.mesh.scale.set(1,1,1);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)}async handleAdd(e,t){if(!t.resource)return;const o=this.increaseAsyncId(e.id),r=await i.textureFromNamedImage(t.resource);if(!this.validateAsyncId(e.id,o))return void r.dispose();const n=r.image,a=(n?.width||1)/(n?.height||1),p=new s.PlaneGeometry(a,1),d=new s.MeshBasicMaterial({map:r,transparent:!0,opacity:t.opacity,side:t.doubleSide?s.DoubleSide:s.FrontSide}),c=new s.Mesh(p,d);i.tagObject3D(c,e.id),this.threeContext.shadows&&(c.castShadow=!0,c.receiveShadow=!0);const m=new i.VisualPoseBridge,l=e.getComponent(i.Transform3D);m.sync(t,l)&&(c.position.set(t.positionX,t.positionY,t.positionZ),c.rotation.set(t.rotationX,t.rotationY,t.rotationZ),c.scale.set(t.scaleX,t.scaleY,1)),this.threeContext.attachVisual(e.id,c,e),this.imgs.set(e.id,{mesh:c,texture:r,poseBridge:m})}async handleChange(e){const t=e.component,o=e.prop?.prop?.[0],i=this.imgs.get(e.gameObject.id);if("resource"===o)return this.handleRemove(e.gameObject.id),void this.handleAdd(e.gameObject,t);if(!i)return;const r=i.mesh.material;"opacity"===o&&(r.opacity=t.opacity),"doubleSide"===o&&(r.side=t.doubleSide?s.DoubleSide:s.FrontSide,r.needsUpdate=!0)}handleRemove(e){this.increaseAsyncId(e);const t=this.imgs.get(e);t&&(this.threeContext.detachVisual(e,t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.imgs.delete(e))}onDestroy(){for(const[e]of this.imgs)this.handleRemove(e);this.imgs.clear()}};n=e.__decorate([t.decorators.componentObserver({Img3D:["resource","opacity","doubleSide","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY"]})],n);var a=n;exports.Img3D=r,exports.Img3DSystem=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"),s=require("three");class r extends t.Component{constructor(){super(...arguments),this.resource="",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.opacity=1,this.doubleSide=!1}static{this.componentName="Img3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.Field({type:"string",group:"Img3D",label:"resource",description:"Engine resource name registered with RESOURCE_TYPE.IMAGE.",editor:"text"})],r.prototype,"resource",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],r.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],r.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],r.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],r.prototype,"rotationX",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],r.prototype,"rotationY",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Img3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],r.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],r.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],r.prototype,"scaleY",void 0),e.__decorate([o.Field({type:"number",step:.01,min:0,max:1,group:"Img3D",label:"opacity",description:"Opacity from 0 to 1.",editor:"number-slider"})],r.prototype,"opacity",void 0),e.__decorate([o.Field({type:"boolean",group:"Img3D",label:"doubleSide",description:"Render both sides of the mesh.",editor:"toggle"})],r.prototype,"doubleSide",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="Img3DSystem",this.imgs=new Map}static{this.systemName="Img3DSystem"}init(){this.game.getSystem(i.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"Img3D"===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(r);if(!t)return;const o=this.imgs.get(e.id);if(!o)return;const s=e.getComponent(i.Transform3D);if(!o.poseBridge.sync(t,s))return o.mesh.position.set(0,0,0),o.mesh.rotation.set(0,0,0),void o.mesh.scale.set(1,1,1);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)}async handleAdd(e,t){if(!t.resource)return;const o=this.increaseAsyncId(e.id),r=await i.textureFromNamedImage(t.resource,this.threeContext.renderer);if(!this.validateAsyncId(e.id,o))return void r.dispose();const n=r.image,a=(n?.width||1)/(n?.height||1),p=new s.PlaneGeometry(a,1),d=new s.MeshBasicMaterial({map:r,transparent:!0,opacity:t.opacity,side:t.doubleSide?s.DoubleSide:s.FrontSide}),c=new s.Mesh(p,d);i.tagObject3D(c,e.id),this.threeContext.shadows&&(c.castShadow=!0,c.receiveShadow=!0);const m=new i.VisualPoseBridge,l=e.getComponent(i.Transform3D);m.sync(t,l)&&(c.position.set(t.positionX,t.positionY,t.positionZ),c.rotation.set(t.rotationX,t.rotationY,t.rotationZ),c.scale.set(t.scaleX,t.scaleY,1)),this.threeContext.attachVisual(e.id,c,e),this.imgs.set(e.id,{mesh:c,texture:r,poseBridge:m})}async handleChange(e){const t=e.component,o=e.prop?.prop?.[0],i=this.imgs.get(e.gameObject.id);if("resource"===o)return this.handleRemove(e.gameObject.id),void this.handleAdd(e.gameObject,t);if(!i)return;const r=i.mesh.material;"opacity"===o&&(r.opacity=t.opacity),"doubleSide"===o&&(r.side=t.doubleSide?s.DoubleSide:s.FrontSide,r.needsUpdate=!0)}handleRemove(e){this.increaseAsyncId(e);const t=this.imgs.get(e);t&&(this.threeContext.detachVisual(e,t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.imgs.delete(e))}onDestroy(){for(const[e]of this.imgs)this.handleRemove(e);this.imgs.clear()}};n=e.__decorate([t.decorators.componentObserver({Img3D:["resource","opacity","doubleSide","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY"]})],n);var a=n;exports.Img3D=r,exports.Img3DSystem=a;
@@ -182,7 +182,7 @@ let Img3DSystem = class Img3DSystem extends Renderer3D {
182
182
  if (!component.resource)
183
183
  return;
184
184
  const asyncId = this.increaseAsyncId(gameObject.id);
185
- const texture = await textureFromNamedImage(component.resource);
185
+ const texture = await textureFromNamedImage(component.resource, this.threeContext.renderer);
186
186
  if (!this.validateAsyncId(gameObject.id, asyncId)) {
187
187
  texture.dispose();
188
188
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-img.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 Img3DParams {\n resource?: string;\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 opacity?: number;\n doubleSide?: boolean;\n}\n\nexport default class Img3D extends Component<Img3DParams> {\n static componentName: string = 'Img3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Img3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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.01,\n min: 0,\n max: 1,\n group: 'Img3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Img3D',\n label: 'doubleSide',\n description: 'Render both sides of the mesh.',\n editor: 'toggle',\n })\n doubleSide: boolean = false;\n\n init(obj?: Img3DParams) {\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 tagObject3D,\n textureFromNamedImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n FrontSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport Img3D from './component';\n\ninterface Img3DEntry {\n mesh: Mesh;\n texture: Texture;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n Img3D: [\n 'resource', 'opacity', 'doubleSide',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class Img3DSystem extends Renderer3D {\n static systemName = 'Img3DSystem';\n name: string = 'Img3DSystem';\n\n private imgs: Map<number, Img3DEntry> = 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 !== 'Img3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Img3D);\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(Img3D) as Img3D;\n if (!component) return;\n\n const entry = this.imgs.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 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\n private async handleAdd(gameObject: GameObject, component: Img3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await textureFromNamedImage(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const image = texture.image as { width?: number; height?: number };\n const aspectRatio = (image?.width || 1) / (image?.height || 1);\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n opacity: component.opacity,\n side: component.doubleSide ? DoubleSide : FrontSide,\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 const poseBridge = new VisualPoseBridge();\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.imgs.set(gameObject.id, { mesh, texture, poseBridge });\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Img3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.imgs.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n const material = entry.mesh.material as MeshBasicMaterial;\n\n if (changedProp === 'opacity') {\n material.opacity = component.opacity;\n }\n if (changedProp === 'doubleSide') {\n material.side = component.doubleSide ? DoubleSide : FrontSide;\n material.needsUpdate = true;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.imgs.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.imgs.delete(id);\n }\n\n onDestroy() {\n for (const [id] of this.imgs) {\n this.handleRemove(id);\n }\n this.imgs.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBc,MAAO,KAAM,SAAQ,SAAsB,CAAA;AAAzD,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;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,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;QAWlB,IAAA,CAAA,OAAO,GAAW,CAAC;QAQnB,IAAA,CAAA,UAAU,GAAY,KAAK;IAK7B;aAhHS,IAAA,CAAA,aAAa,GAAW,OAAX,CAAmB;AA6GvC,IAAA,IAAI,CAAC,GAAiB,EAAA;AACpB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,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K,EAAE;IACnB;;AAzHmB,WAAW,GAAA,UAAA,CAAA;IAR/B,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,KAAK,EAAE;YACL,UAAU,EAAE,SAAS,EAAE,YAAY;YACnC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CA0H/B;0BA1HoB,WAAW;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-img.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 Img3DParams {\n resource?: string;\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 opacity?: number;\n doubleSide?: boolean;\n}\n\nexport default class Img3D extends Component<Img3DParams> {\n static componentName: string = 'Img3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Img3D',\n\n label: 'resource',\n\n description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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: 'Img3D',\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.01,\n min: 0,\n max: 1,\n group: 'Img3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n @Field({\n type: 'boolean',\n group: 'Img3D',\n label: 'doubleSide',\n description: 'Render both sides of the mesh.',\n editor: 'toggle',\n })\n doubleSide: boolean = false;\n\n init(obj?: Img3DParams) {\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 tagObject3D,\n textureFromNamedImage,\n Transform3D,\n VisualPoseBridge,\n} from '@combos-fun/plugin-renderer-3d';\nimport {\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n DoubleSide,\n FrontSide,\n} from 'three';\nimport type { Texture } from 'three';\nimport Img3D from './component';\n\ninterface Img3DEntry {\n mesh: Mesh;\n texture: Texture;\n poseBridge: VisualPoseBridge;\n}\n\n@decorators.componentObserver({\n Img3D: [\n 'resource', 'opacity', 'doubleSide',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY',\n ],\n})\nexport default class Img3DSystem extends Renderer3D {\n static systemName = 'Img3DSystem';\n name: string = 'Img3DSystem';\n\n private imgs: Map<number, Img3DEntry> = 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 !== 'Img3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Img3D);\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(Img3D) as Img3D;\n if (!component) return;\n\n const entry = this.imgs.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 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\n private async handleAdd(gameObject: GameObject, component: Img3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await textureFromNamedImage(component.resource, this.threeContext.renderer);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const image = texture.image as { width?: number; height?: number };\n const aspectRatio = (image?.width || 1) / (image?.height || 1);\n const geometry = new PlaneGeometry(aspectRatio, 1);\n const material = new MeshBasicMaterial({\n map: texture,\n transparent: true,\n opacity: component.opacity,\n side: component.doubleSide ? DoubleSide : FrontSide,\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 const poseBridge = new VisualPoseBridge();\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.imgs.set(gameObject.id, { mesh, texture, poseBridge });\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Img3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.imgs.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n const material = entry.mesh.material as MeshBasicMaterial;\n\n if (changedProp === 'opacity') {\n material.opacity = component.opacity;\n }\n if (changedProp === 'doubleSide') {\n material.side = component.doubleSide ? DoubleSide : FrontSide;\n material.needsUpdate = true;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\n const entry = this.imgs.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.imgs.delete(id);\n }\n\n onDestroy() {\n for (const [id] of this.imgs) {\n this.handleRemove(id);\n }\n this.imgs.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAiBc,MAAO,KAAM,SAAQ,SAAsB,CAAA;AAAzD,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;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,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;QAWlB,I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CAAC,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACtB;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;AAC5B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;IACnB;;AAzHmB,WAAW,GAAA,UAAA,CAAA;IAR/B,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,KAAK,EAAE;YACL,UAAU,EAAE,SAAS,EAAE,YAAY;YACnC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CA0H/B;0BA1HoB,WAAW;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-img",
3
- "version": "0.1.13",
3
+ "version": "0.1.14-beta.1",
4
4
  "description": "3D textured plane",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-img.esm.js",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "three": "^0.172.0",
30
- "@combos-fun/engine": "0.1.13",
31
- "@combos-fun/inspector-decorator": "0.1.13",
32
- "@combos-fun/plugin-renderer-3d": "0.1.13"
30
+ "@combos-fun/engine": "0.1.14-beta.1",
31
+ "@combos-fun/inspector-decorator": "0.1.14-beta.1",
32
+ "@combos-fun/plugin-renderer-3d": "0.1.14-beta.1"
33
33
  },
34
34
  "keywords": [
35
35
  "combos-fun",