@combos-fun/plugin-renderer-3d-img 0.0.39 → 0.0.41

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.
package/agent-skill.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@combos-fun/plugin-renderer-3d-img` — Agent notes
2
2
 
3
- 3D textured plane. Renders an image as a `THREE.Mesh` with a `PlaneGeometry` sized by the image's aspect ratio.
3
+ 3D textured plane. Renders a named `RESOURCE_TYPE.IMAGE` as a `THREE.Mesh` with a `PlaneGeometry` sized by the image's aspect ratio. `resource` is an engine **name**, never a URL.
4
4
 
5
5
  ## When to read
6
6
 
@@ -10,6 +10,7 @@ Read when you need to put a 2D image into a 3D scene: billboards, flat backdrops
10
10
 
11
11
  ```ts
12
12
  import { Img3D, Img3DSystem, type Img3DParams } from '@combos-fun/plugin-renderer-3d-img';
13
+ import { resource, RESOURCE_TYPE } from '@combos-fun/engine';
13
14
  ```
14
15
 
15
16
  `componentName = 'Img3D'`, `systemName = 'Img3DSystem'`.
@@ -18,7 +19,7 @@ import { Img3D, Img3DSystem, type Img3DParams } from '@combos-fun/plugin-rendere
18
19
 
19
20
  | Field | Type | Default |
20
21
  |-------|------|---------|
21
- | `resource` | `string` | `''` (image URL — direct, not engine resource name) |
22
+ | `resource` | `string` | `''` (engine resource name, `RESOURCE_TYPE.IMAGE`) |
22
23
  | `positionX` / `Y` / `Z` | `number` | `0` |
23
24
  | `rotationX` / `Y` / `Z` | `number` | `0` |
24
25
  | `scaleX` / `Y` | `number` | `1` (no `scaleZ` — plane is 2D) |
@@ -29,23 +30,30 @@ The plane geometry size matches the image's natural pixel aspect ratio in world
29
30
 
30
31
  ## Required setup
31
32
 
32
- `Renderer3DSystem` then `Img3DSystem`. URL must be CORS-accessible.
33
+ `Renderer3DSystem` then `Img3DSystem`. Register the image with `resource.addResource`; CDN URLs go in `src.image.url`. The 3D system builds a Three `Texture` from `data.image` and does **not** overwrite the 2D Pixi `IMAGE` instance.
33
34
 
34
35
  ## Common pitfalls
35
36
 
36
37
  | Symptom | Fix |
37
38
  |---------|-----|
39
+ | `Unknown resource` throw | Use the engine name, not a URL |
38
40
  | Image only visible from front | Set `doubleSide: true` |
39
41
  | Image too large in world | Scale via `scaleX` / `scaleY`, not `width`/`height` (no such fields here) |
40
- | 404 / CORS | Direct URL, must be CORS-enabled |
41
- | Stale image after fast remove | The system uses `increaseAsyncId` / `validateAsyncId` to drop stale work — no action needed unless extending |
42
+ | Stale image after fast remove | The system uses `increaseAsyncId` / `validateAsyncId` to drop stale work |
42
43
 
43
44
  ## Minimal example
44
45
 
45
46
  ```ts
47
+ resource.addResource([{
48
+ name: 'poster',
49
+ type: RESOURCE_TYPE.IMAGE,
50
+ src: { image: { type: 'png', url: 'https://cdn.example/poster.png' } },
51
+ preload: true,
52
+ }]);
53
+
46
54
  const billboard = new GameObject('billboard');
47
55
  billboard.addComponent(new Img3D({
48
- resource: '/assets/poster.png',
56
+ resource: 'poster',
49
57
  positionZ: -3,
50
58
  doubleSide: true,
51
59
  }));
@@ -32,7 +32,7 @@ tslib.__decorate([
32
32
  type: 'string',
33
33
  group: 'Img3D',
34
34
  label: 'resource',
35
- description: 'Resource id from the asset registry.',
35
+ description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',
36
36
  editor: 'text',
37
37
  })
38
38
  ], Img3D.prototype, "resource", void 0);
@@ -143,7 +143,6 @@ let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
143
143
  super(...arguments);
144
144
  this.name = 'Img3DSystem';
145
145
  this.imgs = new Map();
146
- this.textureLoader = new three.TextureLoader();
147
146
  }
148
147
  static { this.systemName = 'Img3DSystem'; }
149
148
  init() {
@@ -178,12 +177,13 @@ let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
178
177
  if (!component.resource)
179
178
  return;
180
179
  const asyncId = this.increaseAsyncId(gameObject.id);
181
- const texture = await this.loadTexture(component.resource);
180
+ const texture = await pluginRenderer3d.textureFromNamedImage(component.resource);
182
181
  if (!this.validateAsyncId(gameObject.id, asyncId)) {
183
182
  texture.dispose();
184
183
  return;
185
184
  }
186
- const aspectRatio = texture.image.width / texture.image.height;
185
+ const image = texture.image;
186
+ const aspectRatio = (image?.width || 1) / (image?.height || 1);
187
187
  const geometry = new three.PlaneGeometry(aspectRatio, 1);
188
188
  const material = new three.MeshBasicMaterial({
189
189
  map: texture,
@@ -192,6 +192,7 @@ let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
192
192
  side: component.doubleSide ? three.DoubleSide : three.FrontSide,
193
193
  });
194
194
  const mesh = new three.Mesh(geometry, material);
195
+ pluginRenderer3d.tagObject3D(mesh, gameObject.id);
195
196
  mesh.position.set(component.positionX, component.positionY, component.positionZ);
196
197
  mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
197
198
  mesh.scale.set(component.scaleX, component.scaleY, 1);
@@ -229,11 +230,6 @@ let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
229
230
  entry.texture.dispose();
230
231
  this.imgs.delete(id);
231
232
  }
232
- loadTexture(url) {
233
- return new Promise((resolve, reject) => {
234
- this.textureLoader.load(url, resolve, undefined, reject);
235
- });
236
- }
237
233
  onDestroy() {
238
234
  for (const [id] of this.imgs) {
239
235
  this.handleRemove(id);
@@ -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: 'Resource id from the asset registry.',\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 { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';\nimport {\n TextureLoader,\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}\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 private textureLoader = new TextureLoader();\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 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 this.loadTexture(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const aspectRatio = texture.image.width / texture.image.height;\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 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.imgs.set(gameObject.id, { mesh, texture });\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.scene.remove(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 private loadTexture(url: string): Promise<Texture> {\n return new Promise((resolve, reject) => {\n this.textureLoader.load(url, resolve, undefined, reject);\n });\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","TextureLoader","Renderer3DSystem","OBSERVER_TYPE","PlaneGeometry","MeshBasicMaterial","DoubleSide","FrontSide","Mesh","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,C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U,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,CAgH/B;0BAhHoB,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} 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}\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 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 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.imgs.set(gameObject.id, { mesh, texture });\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.scene.remove(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","textureFromNamedImage","PlaneGeometry","MeshBasicMaterial","DoubleSide","FrontSide","Mesh","tagObject3D","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,EA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,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;;AA1GmB,WAAW,GAAAT,gBAAA,CAAA;IAR/BY,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,CA2G/B;0BA3GoB,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"),r=require("three");class s 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:"Resource id from the asset registry.",editor:"text"})],s.prototype,"resource",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],s.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],s.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],s.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"})],s.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"})],s.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"})],s.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],s.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],s.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"})],s.prototype,"opacity",void 0),e.__decorate([o.Field({type:"boolean",group:"Img3D",label:"doubleSide",description:"Render both sides of the mesh.",editor:"toggle"})],s.prototype,"doubleSide",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="Img3DSystem",this.imgs=new Map,this.textureLoader=new r.TextureLoader}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(s);if(!t)return;const o=this.imgs.get(e.id);o&&(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),i=await this.loadTexture(t.resource);if(!this.validateAsyncId(e.id,o))return void i.dispose();const s=i.image.width/i.image.height,n=new r.PlaneGeometry(s,1),a=new r.MeshBasicMaterial({map:i,transparent:!0,opacity:t.opacity,side:t.doubleSide?r.DoubleSide:r.FrontSide}),d=new r.Mesh(n,a);d.position.set(t.positionX,t.positionY,t.positionZ),d.rotation.set(t.rotationX,t.rotationY,t.rotationZ),d.scale.set(t.scaleX,t.scaleY,1),this.threeContext.scene.add(d),this.imgs.set(e.id,{mesh:d,texture:i})}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 s=i.mesh.material;"opacity"===o&&(s.opacity=t.opacity),"doubleSide"===o&&(s.side=t.doubleSide?r.DoubleSide:r.FrontSide,s.needsUpdate=!0)}handleRemove(e){this.increaseAsyncId(e);const t=this.imgs.get(e);t&&(this.threeContext.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.imgs.delete(e))}loadTexture(e){return new Promise((t,o)=>{this.textureLoader.load(e,t,void 0,o)})}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=s,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"),r=require("three");class s 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"})],s.prototype,"resource",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],s.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],s.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],s.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"})],s.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"})],s.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"})],s.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],s.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Img3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],s.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"})],s.prototype,"opacity",void 0),e.__decorate([o.Field({type:"boolean",group:"Img3D",label:"doubleSide",description:"Render both sides of the mesh.",editor:"toggle"})],s.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(s);if(!t)return;const o=this.imgs.get(e.id);o&&(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),s=await i.textureFromNamedImage(t.resource);if(!this.validateAsyncId(e.id,o))return void s.dispose();const n=s.image,a=(n?.width||1)/(n?.height||1),p=new r.PlaneGeometry(a,1),d=new r.MeshBasicMaterial({map:s,transparent:!0,opacity:t.opacity,side:t.doubleSide?r.DoubleSide:r.FrontSide}),c=new r.Mesh(p,d);i.tagObject3D(c,e.id),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.scene.add(c),this.imgs.set(e.id,{mesh:c,texture:s})}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 s=i.mesh.material;"opacity"===o&&(s.opacity=t.opacity),"doubleSide"===o&&(s.side=t.doubleSide?r.DoubleSide:r.FrontSide,s.needsUpdate=!0)}handleRemove(e){this.increaseAsyncId(e);const t=this.imgs.get(e);t&&(this.threeContext.scene.remove(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=s,exports.Img3DSystem=a;
@@ -34,14 +34,12 @@ declare class Img3DSystem extends Renderer3D {
34
34
  static systemName: string;
35
35
  name: string;
36
36
  private imgs;
37
- private textureLoader;
38
37
  init(): void;
39
38
  componentChanged(changed: ComponentChanged): void;
40
39
  rendererUpdate(gameObject: GameObject): void;
41
40
  private handleAdd;
42
41
  private handleChange;
43
42
  private handleRemove;
44
- private loadTexture;
45
43
  onDestroy(): void;
46
44
  }
47
45
 
@@ -1,8 +1,8 @@
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 } from '@combos-fun/plugin-renderer-3d';
5
- import { TextureLoader, PlaneGeometry, MeshBasicMaterial, DoubleSide, FrontSide, Mesh } from 'three';
4
+ import { Renderer3D, Renderer3DSystem, textureFromNamedImage, tagObject3D } from '@combos-fun/plugin-renderer-3d';
5
+ import { PlaneGeometry, MeshBasicMaterial, DoubleSide, FrontSide, Mesh } from 'three';
6
6
 
7
7
  class Img3D extends Component {
8
8
  constructor() {
@@ -30,7 +30,7 @@ __decorate([
30
30
  type: 'string',
31
31
  group: 'Img3D',
32
32
  label: 'resource',
33
- description: 'Resource id from the asset registry.',
33
+ description: 'Engine resource name registered with RESOURCE_TYPE.IMAGE.',
34
34
  editor: 'text',
35
35
  })
36
36
  ], Img3D.prototype, "resource", void 0);
@@ -141,7 +141,6 @@ let Img3DSystem = class Img3DSystem extends Renderer3D {
141
141
  super(...arguments);
142
142
  this.name = 'Img3DSystem';
143
143
  this.imgs = new Map();
144
- this.textureLoader = new TextureLoader();
145
144
  }
146
145
  static { this.systemName = 'Img3DSystem'; }
147
146
  init() {
@@ -176,12 +175,13 @@ let Img3DSystem = class Img3DSystem extends Renderer3D {
176
175
  if (!component.resource)
177
176
  return;
178
177
  const asyncId = this.increaseAsyncId(gameObject.id);
179
- const texture = await this.loadTexture(component.resource);
178
+ const texture = await textureFromNamedImage(component.resource);
180
179
  if (!this.validateAsyncId(gameObject.id, asyncId)) {
181
180
  texture.dispose();
182
181
  return;
183
182
  }
184
- const aspectRatio = texture.image.width / texture.image.height;
183
+ const image = texture.image;
184
+ const aspectRatio = (image?.width || 1) / (image?.height || 1);
185
185
  const geometry = new PlaneGeometry(aspectRatio, 1);
186
186
  const material = new MeshBasicMaterial({
187
187
  map: texture,
@@ -190,6 +190,7 @@ let Img3DSystem = class Img3DSystem extends Renderer3D {
190
190
  side: component.doubleSide ? DoubleSide : FrontSide,
191
191
  });
192
192
  const mesh = new Mesh(geometry, material);
193
+ tagObject3D(mesh, gameObject.id);
193
194
  mesh.position.set(component.positionX, component.positionY, component.positionZ);
194
195
  mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
195
196
  mesh.scale.set(component.scaleX, component.scaleY, 1);
@@ -227,11 +228,6 @@ let Img3DSystem = class Img3DSystem extends Renderer3D {
227
228
  entry.texture.dispose();
228
229
  this.imgs.delete(id);
229
230
  }
230
- loadTexture(url) {
231
- return new Promise((resolve, reject) => {
232
- this.textureLoader.load(url, resolve, undefined, reject);
233
- });
234
- }
235
231
  onDestroy() {
236
232
  for (const [id] of this.imgs) {
237
233
  this.handleRemove(id);
@@ -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: 'Resource id from the asset registry.',\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 { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';\nimport {\n TextureLoader,\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}\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 private textureLoader = new TextureLoader();\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 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 this.loadTexture(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n const aspectRatio = texture.image.width / texture.image.height;\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 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.imgs.set(gameObject.id, { mesh, texture });\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.scene.remove(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 private loadTexture(url: string): Promise<Texture> {\n return new Promise((resolve, reject) => {\n this.textureLoader.load(url, resolve, undefined, reject);\n });\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,OAA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AAC,EAAE,CAAC;AAC/B,QAAA,IAAI,CAAC,KAAK;YAAE;QAEZ,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AAC1C,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;AAEQ,IAAA,WAAW,CAAC,GAAW,EAAA;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;AAC1D,QAAA,CAAC,CAAC;IACJ;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;;AA/GmB,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,CAgH/B;0BAhHoB,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} 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}\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 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 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.imgs.set(gameObject.id, { mesh, texture });\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.scene.remove(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,K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AA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CA2G/B;0BA3GoB,WAAW;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-img",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "3D textured plane",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-img.esm.js",
@@ -26,10 +26,10 @@
26
26
  "pluginManifest": "./combos-plugin.json"
27
27
  },
28
28
  "dependencies": {
29
- "@combos-fun/engine": "0.0.39",
30
- "@combos-fun/inspector-decorator": "0.0.39",
31
- "@combos-fun/plugin-renderer-3d": "0.0.39",
32
- "three": "^0.172.0"
29
+ "three": "^0.172.0",
30
+ "@combos-fun/inspector-decorator": "0.0.41",
31
+ "@combos-fun/plugin-renderer-3d": "0.0.41",
32
+ "@combos-fun/engine": "0.0.41"
33
33
  },
34
34
  "keywords": [
35
35
  "combos-fun",