@combos-fun/plugin-renderer-3d-img 0.0.33 → 0.0.35
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.
|
@@ -28,46 +28,114 @@ class Img3D extends engine.Component {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
tslib.__decorate([
|
|
31
|
-
inspectorDecorator.
|
|
31
|
+
inspectorDecorator.Field({
|
|
32
|
+
type: 'string',
|
|
33
|
+
group: 'Img3D',
|
|
34
|
+
label: 'resource',
|
|
35
|
+
description: 'Resource id from the asset registry.',
|
|
36
|
+
editor: 'text',
|
|
37
|
+
})
|
|
32
38
|
], Img3D.prototype, "resource", void 0);
|
|
33
39
|
tslib.__decorate([
|
|
34
|
-
inspectorDecorator.
|
|
35
|
-
|
|
40
|
+
inspectorDecorator.Field({
|
|
41
|
+
type: 'number',
|
|
42
|
+
step: 0.1,
|
|
43
|
+
group: 'Img3D',
|
|
44
|
+
label: 'positionX',
|
|
45
|
+
description: 'Local X position.',
|
|
46
|
+
editor: 'number-stepper',
|
|
47
|
+
})
|
|
36
48
|
], Img3D.prototype, "positionX", void 0);
|
|
37
49
|
tslib.__decorate([
|
|
38
|
-
inspectorDecorator.
|
|
39
|
-
|
|
50
|
+
inspectorDecorator.Field({
|
|
51
|
+
type: 'number',
|
|
52
|
+
step: 0.1,
|
|
53
|
+
group: 'Img3D',
|
|
54
|
+
label: 'positionY',
|
|
55
|
+
description: 'Local Y position.',
|
|
56
|
+
editor: 'number-stepper',
|
|
57
|
+
})
|
|
40
58
|
], Img3D.prototype, "positionY", void 0);
|
|
41
59
|
tslib.__decorate([
|
|
42
|
-
inspectorDecorator.
|
|
43
|
-
|
|
60
|
+
inspectorDecorator.Field({
|
|
61
|
+
type: 'number',
|
|
62
|
+
step: 0.1,
|
|
63
|
+
group: 'Img3D',
|
|
64
|
+
label: 'positionZ',
|
|
65
|
+
description: 'Local Z position.',
|
|
66
|
+
editor: 'number-stepper',
|
|
67
|
+
})
|
|
44
68
|
], Img3D.prototype, "positionZ", void 0);
|
|
45
69
|
tslib.__decorate([
|
|
46
|
-
inspectorDecorator.
|
|
47
|
-
|
|
70
|
+
inspectorDecorator.Field({
|
|
71
|
+
type: 'number',
|
|
72
|
+
step: 0.01,
|
|
73
|
+
group: 'Img3D',
|
|
74
|
+
label: 'rotationX',
|
|
75
|
+
description: 'Rotation around X in radians.',
|
|
76
|
+
editor: 'number-stepper',
|
|
77
|
+
})
|
|
48
78
|
], Img3D.prototype, "rotationX", void 0);
|
|
49
79
|
tslib.__decorate([
|
|
50
|
-
inspectorDecorator.
|
|
51
|
-
|
|
80
|
+
inspectorDecorator.Field({
|
|
81
|
+
type: 'number',
|
|
82
|
+
step: 0.01,
|
|
83
|
+
group: 'Img3D',
|
|
84
|
+
label: 'rotationY',
|
|
85
|
+
description: 'Rotation around Y in radians.',
|
|
86
|
+
editor: 'number-stepper',
|
|
87
|
+
})
|
|
52
88
|
], Img3D.prototype, "rotationY", void 0);
|
|
53
89
|
tslib.__decorate([
|
|
54
|
-
inspectorDecorator.
|
|
55
|
-
|
|
90
|
+
inspectorDecorator.Field({
|
|
91
|
+
type: 'number',
|
|
92
|
+
step: 0.01,
|
|
93
|
+
group: 'Img3D',
|
|
94
|
+
label: 'rotationZ',
|
|
95
|
+
description: 'Rotation around Z in radians.',
|
|
96
|
+
editor: 'number-stepper',
|
|
97
|
+
})
|
|
56
98
|
], Img3D.prototype, "rotationZ", void 0);
|
|
57
99
|
tslib.__decorate([
|
|
58
|
-
inspectorDecorator.
|
|
59
|
-
|
|
100
|
+
inspectorDecorator.Field({
|
|
101
|
+
type: 'number',
|
|
102
|
+
step: 0.1,
|
|
103
|
+
group: 'Img3D',
|
|
104
|
+
label: 'scaleX',
|
|
105
|
+
description: 'Scale on X.',
|
|
106
|
+
editor: 'number-stepper',
|
|
107
|
+
})
|
|
60
108
|
], Img3D.prototype, "scaleX", void 0);
|
|
61
109
|
tslib.__decorate([
|
|
62
|
-
inspectorDecorator.
|
|
63
|
-
|
|
110
|
+
inspectorDecorator.Field({
|
|
111
|
+
type: 'number',
|
|
112
|
+
step: 0.1,
|
|
113
|
+
group: 'Img3D',
|
|
114
|
+
label: 'scaleY',
|
|
115
|
+
description: 'Scale on Y.',
|
|
116
|
+
editor: 'number-stepper',
|
|
117
|
+
})
|
|
64
118
|
], Img3D.prototype, "scaleY", void 0);
|
|
65
119
|
tslib.__decorate([
|
|
66
|
-
inspectorDecorator.
|
|
67
|
-
|
|
120
|
+
inspectorDecorator.Field({
|
|
121
|
+
type: 'number',
|
|
122
|
+
step: 0.01,
|
|
123
|
+
min: 0,
|
|
124
|
+
max: 1,
|
|
125
|
+
group: 'Img3D',
|
|
126
|
+
label: 'opacity',
|
|
127
|
+
description: 'Opacity from 0 to 1.',
|
|
128
|
+
editor: 'number-slider',
|
|
129
|
+
})
|
|
68
130
|
], Img3D.prototype, "opacity", void 0);
|
|
69
131
|
tslib.__decorate([
|
|
70
|
-
inspectorDecorator.
|
|
132
|
+
inspectorDecorator.Field({
|
|
133
|
+
type: 'boolean',
|
|
134
|
+
group: 'Img3D',
|
|
135
|
+
label: 'doubleSide',
|
|
136
|
+
description: 'Render both sides of the mesh.',
|
|
137
|
+
editor: 'toggle',
|
|
138
|
+
})
|
|
71
139
|
], Img3D.prototype, "doubleSide", void 0);
|
|
72
140
|
|
|
73
141
|
let Img3DSystem = class Img3DSystem extends pluginRenderer3d.Renderer3D {
|
|
@@ -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 { type, step } 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 @type('string') resource: string = '';\n @type('number') @step(0.1) positionX: number = 0;\n @type('number') @step(0.1) positionY: number = 0;\n @type('number') @step(0.1) positionZ: number = 0;\n @type('number') @step(0.01) rotationX: number = 0;\n @type('number') @step(0.01) rotationY: number = 0;\n @type('number') @step(0.01) rotationZ: number = 0;\n @type('number') @step(0.1) scaleX: number = 1;\n @type('number') @step(0.1) scaleY: number = 1;\n @type('number') @step(0.01) opacity: number = 1;\n @type('boolean') 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","type","step","Renderer3D","TextureLoader","Renderer3DSystem","OBSERVER_TYPE","PlaneGeometry","MeshBasicMaterial","DoubleSide","FrontSide","Mesh","decorators"],"mappings":";;;;;;;;AAiBc,MAAO,KAAM,SAAQA,gBAAsB,CAAA;AAAzD,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACV,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACpB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACtB,IAAA,CAAA,MAAM,GAAW,CAAC;QAClB,IAAA,CAAA,MAAM,GAAW,CAAC;QACjB,IAAA,CAAA,OAAO,GAAW,CAAC;QAC9B,IAAA,CAAA,UAAU,GAAY,KAAK;IAK9C;aAjBS,IAAA,CAAA,aAAa,GAAW,OAAX,CAAmB;AAcvC,IAAA,IAAI,CAAC,GAAiB,EAAA;AACpB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AAdgBC,gBAAA,CAAA;IAAfC,uBAAI,CAAC,QAAQ;AAAwB,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AACXD,gBAAA,CAAA;IAA1BC,uBAAI,CAAC,QAAQ,CAAC;IAAEC,uBAAI,CAAC,GAAG;AAAwB,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AACtBF,gBAAA,CAA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AW,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: '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,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,sCAAsC;A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,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,GAAAT,gBAAA,CAAA;IAR/BW,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,CAgH/B;0BAhHoB,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"),
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { Component, OBSERVER_TYPE, decorators } from '@combos-fun/engine';
|
|
3
|
-
import {
|
|
3
|
+
import { Field } from '@combos-fun/inspector-decorator';
|
|
4
4
|
import { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';
|
|
5
5
|
import { TextureLoader, PlaneGeometry, MeshBasicMaterial, DoubleSide, FrontSide, Mesh } from 'three';
|
|
6
6
|
|
|
@@ -26,46 +26,114 @@ class Img3D extends Component {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
__decorate([
|
|
29
|
-
|
|
29
|
+
Field({
|
|
30
|
+
type: 'string',
|
|
31
|
+
group: 'Img3D',
|
|
32
|
+
label: 'resource',
|
|
33
|
+
description: 'Resource id from the asset registry.',
|
|
34
|
+
editor: 'text',
|
|
35
|
+
})
|
|
30
36
|
], Img3D.prototype, "resource", void 0);
|
|
31
37
|
__decorate([
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
Field({
|
|
39
|
+
type: 'number',
|
|
40
|
+
step: 0.1,
|
|
41
|
+
group: 'Img3D',
|
|
42
|
+
label: 'positionX',
|
|
43
|
+
description: 'Local X position.',
|
|
44
|
+
editor: 'number-stepper',
|
|
45
|
+
})
|
|
34
46
|
], Img3D.prototype, "positionX", void 0);
|
|
35
47
|
__decorate([
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
Field({
|
|
49
|
+
type: 'number',
|
|
50
|
+
step: 0.1,
|
|
51
|
+
group: 'Img3D',
|
|
52
|
+
label: 'positionY',
|
|
53
|
+
description: 'Local Y position.',
|
|
54
|
+
editor: 'number-stepper',
|
|
55
|
+
})
|
|
38
56
|
], Img3D.prototype, "positionY", void 0);
|
|
39
57
|
__decorate([
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
Field({
|
|
59
|
+
type: 'number',
|
|
60
|
+
step: 0.1,
|
|
61
|
+
group: 'Img3D',
|
|
62
|
+
label: 'positionZ',
|
|
63
|
+
description: 'Local Z position.',
|
|
64
|
+
editor: 'number-stepper',
|
|
65
|
+
})
|
|
42
66
|
], Img3D.prototype, "positionZ", void 0);
|
|
43
67
|
__decorate([
|
|
44
|
-
|
|
45
|
-
|
|
68
|
+
Field({
|
|
69
|
+
type: 'number',
|
|
70
|
+
step: 0.01,
|
|
71
|
+
group: 'Img3D',
|
|
72
|
+
label: 'rotationX',
|
|
73
|
+
description: 'Rotation around X in radians.',
|
|
74
|
+
editor: 'number-stepper',
|
|
75
|
+
})
|
|
46
76
|
], Img3D.prototype, "rotationX", void 0);
|
|
47
77
|
__decorate([
|
|
48
|
-
|
|
49
|
-
|
|
78
|
+
Field({
|
|
79
|
+
type: 'number',
|
|
80
|
+
step: 0.01,
|
|
81
|
+
group: 'Img3D',
|
|
82
|
+
label: 'rotationY',
|
|
83
|
+
description: 'Rotation around Y in radians.',
|
|
84
|
+
editor: 'number-stepper',
|
|
85
|
+
})
|
|
50
86
|
], Img3D.prototype, "rotationY", void 0);
|
|
51
87
|
__decorate([
|
|
52
|
-
|
|
53
|
-
|
|
88
|
+
Field({
|
|
89
|
+
type: 'number',
|
|
90
|
+
step: 0.01,
|
|
91
|
+
group: 'Img3D',
|
|
92
|
+
label: 'rotationZ',
|
|
93
|
+
description: 'Rotation around Z in radians.',
|
|
94
|
+
editor: 'number-stepper',
|
|
95
|
+
})
|
|
54
96
|
], Img3D.prototype, "rotationZ", void 0);
|
|
55
97
|
__decorate([
|
|
56
|
-
|
|
57
|
-
|
|
98
|
+
Field({
|
|
99
|
+
type: 'number',
|
|
100
|
+
step: 0.1,
|
|
101
|
+
group: 'Img3D',
|
|
102
|
+
label: 'scaleX',
|
|
103
|
+
description: 'Scale on X.',
|
|
104
|
+
editor: 'number-stepper',
|
|
105
|
+
})
|
|
58
106
|
], Img3D.prototype, "scaleX", void 0);
|
|
59
107
|
__decorate([
|
|
60
|
-
|
|
61
|
-
|
|
108
|
+
Field({
|
|
109
|
+
type: 'number',
|
|
110
|
+
step: 0.1,
|
|
111
|
+
group: 'Img3D',
|
|
112
|
+
label: 'scaleY',
|
|
113
|
+
description: 'Scale on Y.',
|
|
114
|
+
editor: 'number-stepper',
|
|
115
|
+
})
|
|
62
116
|
], Img3D.prototype, "scaleY", void 0);
|
|
63
117
|
__decorate([
|
|
64
|
-
|
|
65
|
-
|
|
118
|
+
Field({
|
|
119
|
+
type: 'number',
|
|
120
|
+
step: 0.01,
|
|
121
|
+
min: 0,
|
|
122
|
+
max: 1,
|
|
123
|
+
group: 'Img3D',
|
|
124
|
+
label: 'opacity',
|
|
125
|
+
description: 'Opacity from 0 to 1.',
|
|
126
|
+
editor: 'number-slider',
|
|
127
|
+
})
|
|
66
128
|
], Img3D.prototype, "opacity", void 0);
|
|
67
129
|
__decorate([
|
|
68
|
-
|
|
130
|
+
Field({
|
|
131
|
+
type: 'boolean',
|
|
132
|
+
group: 'Img3D',
|
|
133
|
+
label: 'doubleSide',
|
|
134
|
+
description: 'Render both sides of the mesh.',
|
|
135
|
+
editor: 'toggle',
|
|
136
|
+
})
|
|
69
137
|
], Img3D.prototype, "doubleSide", void 0);
|
|
70
138
|
|
|
71
139
|
let Img3DSystem = class Img3DSystem extends Renderer3D {
|
|
@@ -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 { type, step } 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 @type('string') resource: string = '';\n @type('number') @step(0.1) positionX: number = 0;\n @type('number') @step(0.1) positionY: number = 0;\n @type('number') @step(0.1) positionZ: number = 0;\n @type('number') @step(0.01) rotationX: number = 0;\n @type('number') @step(0.01) rotationY: number = 0;\n @type('number') @step(0.01) rotationZ: number = 0;\n @type('number') @step(0.1) scaleX: number = 1;\n @type('number') @step(0.1) scaleY: number = 1;\n @type('number') @step(0.01) opacity: number = 1;\n @type('boolean') 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,S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AAC;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: '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,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AE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;AACrC,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;KACF;AACoB,CAAA,EAAA,WAAW,CAgH/B;0BAhHoB,WAAW;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-3d-img",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
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.0.
|
|
31
|
-
"@combos-fun/
|
|
32
|
-
"@combos-fun/
|
|
30
|
+
"@combos-fun/engine": "0.0.35",
|
|
31
|
+
"@combos-fun/plugin-renderer-3d": "0.0.35",
|
|
32
|
+
"@combos-fun/inspector-decorator": "0.0.35"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"combos-fun",
|