@combos-fun/plugin-renderer-3d-graphics 0.0.34 → 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.
@@ -35,73 +35,183 @@ class Graphics3D extends engine.Component {
35
35
  }
36
36
  }
37
37
  tslib.__decorate([
38
- inspectorDecorator.type('string')
38
+ inspectorDecorator.Field({
39
+ type: 'string',
40
+ group: 'Graphics3D',
41
+ label: 'shape',
42
+ description: 'Primitive shape kind.',
43
+ editor: 'text',
44
+ })
39
45
  ], Graphics3D.prototype, "shape", void 0);
40
46
  tslib.__decorate([
41
- inspectorDecorator.type('number')
47
+ inspectorDecorator.Field({
48
+ type: 'number',
49
+ group: 'Graphics3D',
50
+ label: 'color',
51
+ description: 'Color value.',
52
+ editor: 'number-stepper',
53
+ })
42
54
  ], Graphics3D.prototype, "color", void 0);
43
55
  tslib.__decorate([
44
- inspectorDecorator.type('boolean')
56
+ inspectorDecorator.Field({
57
+ type: 'boolean',
58
+ group: 'Graphics3D',
59
+ label: 'wireframe',
60
+ description: 'Draw as wireframe.',
61
+ editor: 'toggle',
62
+ })
45
63
  ], Graphics3D.prototype, "wireframe", void 0);
46
64
  tslib.__decorate([
47
- inspectorDecorator.type('number'),
48
- inspectorDecorator.step(0.1)
65
+ inspectorDecorator.Field({
66
+ type: 'number',
67
+ step: 0.1,
68
+ group: 'Graphics3D',
69
+ label: 'width',
70
+ description: 'Width.',
71
+ editor: 'number-stepper',
72
+ })
49
73
  ], Graphics3D.prototype, "width", void 0);
50
74
  tslib.__decorate([
51
- inspectorDecorator.type('number'),
52
- inspectorDecorator.step(0.1)
75
+ inspectorDecorator.Field({
76
+ type: 'number',
77
+ step: 0.1,
78
+ group: 'Graphics3D',
79
+ label: 'height',
80
+ description: 'Height.',
81
+ editor: 'number-stepper',
82
+ })
53
83
  ], Graphics3D.prototype, "height", void 0);
54
84
  tslib.__decorate([
55
- inspectorDecorator.type('number'),
56
- inspectorDecorator.step(0.1)
85
+ inspectorDecorator.Field({
86
+ type: 'number',
87
+ step: 0.1,
88
+ group: 'Graphics3D',
89
+ label: 'depth',
90
+ description: 'Depth.',
91
+ editor: 'number-stepper',
92
+ })
57
93
  ], Graphics3D.prototype, "depth", void 0);
58
94
  tslib.__decorate([
59
- inspectorDecorator.type('number'),
60
- inspectorDecorator.step(0.1)
95
+ inspectorDecorator.Field({
96
+ type: 'number',
97
+ step: 0.1,
98
+ group: 'Graphics3D',
99
+ label: 'radius',
100
+ description: 'Radius.',
101
+ editor: 'number-stepper',
102
+ })
61
103
  ], Graphics3D.prototype, "radius", void 0);
62
104
  tslib.__decorate([
63
- inspectorDecorator.type('number'),
64
- inspectorDecorator.step(1)
105
+ inspectorDecorator.Field({
106
+ type: 'number',
107
+ step: 1,
108
+ group: 'Graphics3D',
109
+ label: 'segments',
110
+ description: 'Mesh segment count.',
111
+ editor: 'number-stepper',
112
+ })
65
113
  ], Graphics3D.prototype, "segments", void 0);
66
114
  tslib.__decorate([
67
- inspectorDecorator.type('number'),
68
- inspectorDecorator.step(0.1)
115
+ inspectorDecorator.Field({
116
+ type: 'number',
117
+ step: 0.1,
118
+ group: 'Graphics3D',
119
+ label: 'positionX',
120
+ description: 'Local X position.',
121
+ editor: 'number-stepper',
122
+ })
69
123
  ], Graphics3D.prototype, "positionX", void 0);
70
124
  tslib.__decorate([
71
- inspectorDecorator.type('number'),
72
- inspectorDecorator.step(0.1)
125
+ inspectorDecorator.Field({
126
+ type: 'number',
127
+ step: 0.1,
128
+ group: 'Graphics3D',
129
+ label: 'positionY',
130
+ description: 'Local Y position.',
131
+ editor: 'number-stepper',
132
+ })
73
133
  ], Graphics3D.prototype, "positionY", void 0);
74
134
  tslib.__decorate([
75
- inspectorDecorator.type('number'),
76
- inspectorDecorator.step(0.1)
135
+ inspectorDecorator.Field({
136
+ type: 'number',
137
+ step: 0.1,
138
+ group: 'Graphics3D',
139
+ label: 'positionZ',
140
+ description: 'Local Z position.',
141
+ editor: 'number-stepper',
142
+ })
77
143
  ], Graphics3D.prototype, "positionZ", void 0);
78
144
  tslib.__decorate([
79
- inspectorDecorator.type('number'),
80
- inspectorDecorator.step(0.01)
145
+ inspectorDecorator.Field({
146
+ type: 'number',
147
+ step: 0.01,
148
+ group: 'Graphics3D',
149
+ label: 'rotationX',
150
+ description: 'Rotation around X in radians.',
151
+ editor: 'number-stepper',
152
+ })
81
153
  ], Graphics3D.prototype, "rotationX", void 0);
82
154
  tslib.__decorate([
83
- inspectorDecorator.type('number'),
84
- inspectorDecorator.step(0.01)
155
+ inspectorDecorator.Field({
156
+ type: 'number',
157
+ step: 0.01,
158
+ group: 'Graphics3D',
159
+ label: 'rotationY',
160
+ description: 'Rotation around Y in radians.',
161
+ editor: 'number-stepper',
162
+ })
85
163
  ], Graphics3D.prototype, "rotationY", void 0);
86
164
  tslib.__decorate([
87
- inspectorDecorator.type('number'),
88
- inspectorDecorator.step(0.01)
165
+ inspectorDecorator.Field({
166
+ type: 'number',
167
+ step: 0.01,
168
+ group: 'Graphics3D',
169
+ label: 'rotationZ',
170
+ description: 'Rotation around Z in radians.',
171
+ editor: 'number-stepper',
172
+ })
89
173
  ], Graphics3D.prototype, "rotationZ", void 0);
90
174
  tslib.__decorate([
91
- inspectorDecorator.type('number'),
92
- inspectorDecorator.step(0.1)
175
+ inspectorDecorator.Field({
176
+ type: 'number',
177
+ step: 0.1,
178
+ group: 'Graphics3D',
179
+ label: 'scaleX',
180
+ description: 'Scale on X.',
181
+ editor: 'number-stepper',
182
+ })
93
183
  ], Graphics3D.prototype, "scaleX", void 0);
94
184
  tslib.__decorate([
95
- inspectorDecorator.type('number'),
96
- inspectorDecorator.step(0.1)
185
+ inspectorDecorator.Field({
186
+ type: 'number',
187
+ step: 0.1,
188
+ group: 'Graphics3D',
189
+ label: 'scaleY',
190
+ description: 'Scale on Y.',
191
+ editor: 'number-stepper',
192
+ })
97
193
  ], Graphics3D.prototype, "scaleY", void 0);
98
194
  tslib.__decorate([
99
- inspectorDecorator.type('number'),
100
- inspectorDecorator.step(0.1)
195
+ inspectorDecorator.Field({
196
+ type: 'number',
197
+ step: 0.1,
198
+ group: 'Graphics3D',
199
+ label: 'scaleZ',
200
+ description: 'Scale on Z.',
201
+ editor: 'number-stepper',
202
+ })
101
203
  ], Graphics3D.prototype, "scaleZ", void 0);
102
204
  tslib.__decorate([
103
- inspectorDecorator.type('number'),
104
- inspectorDecorator.step(0.01)
205
+ inspectorDecorator.Field({
206
+ type: 'number',
207
+ step: 0.01,
208
+ min: 0,
209
+ max: 1,
210
+ group: 'Graphics3D',
211
+ label: 'opacity',
212
+ description: 'Opacity from 0 to 1.',
213
+ editor: 'number-slider',
214
+ })
105
215
  ], Graphics3D.prototype, "opacity", void 0);
106
216
 
107
217
  const GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-graphics.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 Graphics3DParams {\n shape?: string;\n color?: number;\n wireframe?: boolean;\n width?: number;\n height?: number;\n depth?: number;\n radius?: number;\n segments?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n opacity?: number;\n}\n\nexport default class Graphics3D extends Component<Graphics3DParams> {\n static componentName: string = 'Graphics3D';\n\n @type('string') shape: string = 'box';\n @type('number') color: number = 0x00ff00;\n @type('boolean') wireframe: boolean = false;\n @type('number') @step(0.1) width: number = 1;\n @type('number') @step(0.1) height: number = 1;\n @type('number') @step(0.1) depth: number = 1;\n @type('number') @step(0.1) radius: number = 0.5;\n @type('number') @step(1) segments: number = 32;\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.1) scaleZ: number = 1;\n @type('number') @step(0.01) opacity: number = 1;\n\n init(obj?: Graphics3DParams) {\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 BoxGeometry,\n SphereGeometry,\n CylinderGeometry,\n PlaneGeometry,\n ConeGeometry,\n TorusGeometry,\n MeshStandardMaterial,\n Mesh,\n} from 'three';\nimport type { BufferGeometry } from 'three';\nimport Graphics3D from './component';\n\ninterface Graphics3DEntry {\n mesh: Mesh;\n}\n\nconst GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];\nconst MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];\n\n@decorators.componentObserver({\n Graphics3D: [\n 'shape', 'color', 'wireframe',\n 'width', 'height', 'depth', 'radius', 'segments',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'opacity',\n ],\n})\nexport default class Graphics3DSystem extends Renderer3D {\n static systemName = 'Graphics3DSystem';\n name: string = 'Graphics3DSystem';\n\n private entries: Map<number, Graphics3DEntry> = 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 !== 'Graphics3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Graphics3D);\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(Graphics3D) as Graphics3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private handleAdd(gameObject: GameObject, component: Graphics3D) {\n const geometry = this.createGeometry(component);\n const material = new MeshStandardMaterial({\n color: component.color,\n wireframe: component.wireframe,\n transparent: component.opacity < 1,\n opacity: component.opacity,\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, component.scaleZ);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as Graphics3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n if (!entry) return;\n\n if (GEOMETRY_PROPS.includes(changedProp)) {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = this.createGeometry(component);\n }\n\n if (MATERIAL_PROPS.includes(changedProp)) {\n const material = entry.mesh.material as MeshStandardMaterial;\n material.color.setHex(component.color);\n material.wireframe = component.wireframe;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshStandardMaterial).dispose();\n this.entries.delete(id);\n }\n\n private createGeometry(component: Graphics3D): BufferGeometry {\n switch (component.shape) {\n case 'sphere':\n return new SphereGeometry(component.radius, component.segments, component.segments);\n case 'cylinder':\n return new CylinderGeometry(\n component.radius, component.radius, component.height, component.segments,\n );\n case 'plane':\n return new PlaneGeometry(component.width, component.height);\n case 'cone':\n return new ConeGeometry(component.radius, component.height, component.segments);\n case 'torus':\n return new TorusGeometry(\n component.radius, component.radius * 0.4, 16, component.segments,\n );\n case 'box':\n default:\n return new BoxGeometry(component.width, component.height, component.depth);\n }\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":["Component","__decorate","type","step","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","MeshStandardMaterial","Mesh","SphereGeometry","CylinderGeometry","PlaneGeometry","ConeGeometry","TorusGeometry","BoxGeometry","decorators"],"mappings":";;;;;;;;AAwBc,MAAO,UAAW,SAAQA,gBAA2B,CAAA;AAAnE,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,KAAK,GAAW,KAAK;QACrB,IAAA,CAAA,KAAK,GAAW,QAAQ;QACvB,IAAA,CAAA,SAAS,GAAY,KAAK;QAChB,IAAA,CAAA,KAAK,GAAW,CAAC;QACjB,IAAA,CAAA,MAAM,GAAW,CAAC;QAClB,IAAA,CAAA,KAAK,GAAW,CAAC;QACjB,IAAA,CAAA,MAAM,GAAW,GAAG;QACtB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACnB,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;QAClB,IAAA,CAAA,MAAM,GAAW,CAAC;QACjB,IAAA,CAAA,OAAO,GAAW,CAAC;IAKjD;aAxBS,IAAA,CAAA,aAAa,GAAW,YAAX,CAAwB;AAqB5C,IAAA,IAAI,CAAC,GAAsB,EAAA;AACzB,QAAA,IAA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AAA,KAAK,KAAK;AACV,YAAA;AACE,gBAAA,OAAO,IAAIC,iBAAW,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;;IAEhF;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AA7GmB,gBAAgB,GAAAb,gBAAA,CAAA;IAVpCc,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,UAAU,EAAE;YACV,OAAO,EAAE,OAAO,EAAE,WAAW;AAC7B,YAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU;YAChD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;YAC5B,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,gBAAgB,CA8GpC;+BA9GoB,gBAAgB;;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-graphics.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 Graphics3DParams {\n shape?: string;\n color?: number;\n wireframe?: boolean;\n width?: number;\n height?: number;\n depth?: number;\n radius?: number;\n segments?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n opacity?: number;\n}\n\nexport default class Graphics3D extends Component<Graphics3DParams> {\n static componentName: string = 'Graphics3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Graphics3D',\n\n label: 'shape',\n\n description: 'Primitive shape kind.',\n\n editor: 'text',\n\n })\n\n shape: string = 'box';\n @Field({\n type: 'number',\n group: 'Graphics3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0x00ff00;\n @Field({\n type: 'boolean',\n group: 'Graphics3D',\n label: 'wireframe',\n description: 'Draw as wireframe.',\n editor: 'toggle',\n })\n wireframe: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'width',\n description: 'Width.',\n editor: 'number-stepper',\n })\n width: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'height',\n description: 'Height.',\n editor: 'number-stepper',\n })\n height: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'depth',\n description: 'Depth.',\n editor: 'number-stepper',\n })\n depth: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'radius',\n description: 'Radius.',\n editor: 'number-stepper',\n })\n radius: number = 0.5;\n @Field({\n type: 'number',\n step: 1,\n group: 'Graphics3D',\n label: 'segments',\n description: 'Mesh segment count.',\n editor: 'number-stepper',\n })\n segments: number = 32;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Graphics3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n\n init(obj?: Graphics3DParams) {\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 BoxGeometry,\n SphereGeometry,\n CylinderGeometry,\n PlaneGeometry,\n ConeGeometry,\n TorusGeometry,\n MeshStandardMaterial,\n Mesh,\n} from 'three';\nimport type { BufferGeometry } from 'three';\nimport Graphics3D from './component';\n\ninterface Graphics3DEntry {\n mesh: Mesh;\n}\n\nconst GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];\nconst MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];\n\n@decorators.componentObserver({\n Graphics3D: [\n 'shape', 'color', 'wireframe',\n 'width', 'height', 'depth', 'radius', 'segments',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'opacity',\n ],\n})\nexport default class Graphics3DSystem extends Renderer3D {\n static systemName = 'Graphics3DSystem';\n name: string = 'Graphics3DSystem';\n\n private entries: Map<number, Graphics3DEntry> = 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 !== 'Graphics3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Graphics3D);\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(Graphics3D) as Graphics3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private handleAdd(gameObject: GameObject, component: Graphics3D) {\n const geometry = this.createGeometry(component);\n const material = new MeshStandardMaterial({\n color: component.color,\n wireframe: component.wireframe,\n transparent: component.opacity < 1,\n opacity: component.opacity,\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, component.scaleZ);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as Graphics3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n if (!entry) return;\n\n if (GEOMETRY_PROPS.includes(changedProp)) {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = this.createGeometry(component);\n }\n\n if (MATERIAL_PROPS.includes(changedProp)) {\n const material = entry.mesh.material as MeshStandardMaterial;\n material.color.setHex(component.color);\n material.wireframe = component.wireframe;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshStandardMaterial).dispose();\n this.entries.delete(id);\n }\n\n private createGeometry(component: Graphics3D): BufferGeometry {\n switch (component.shape) {\n case 'sphere':\n return new SphereGeometry(component.radius, component.segments, component.segments);\n case 'cylinder':\n return new CylinderGeometry(\n component.radius, component.radius, component.height, component.segments,\n );\n case 'plane':\n return new PlaneGeometry(component.width, component.height);\n case 'cone':\n return new ConeGeometry(component.radius, component.height, component.segments);\n case 'torus':\n return new TorusGeometry(\n component.radius, component.radius * 0.4, 16, component.segments,\n );\n case 'box':\n default:\n return new BoxGeometry(component.width, component.height, component.depth);\n }\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":["Component","__decorate","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","MeshStandardMaterial","Mesh","SphereGeometry","CylinderGeometry","PlaneGeometry","ConeGeometry","TorusGeometry","BoxGeometry","decorators"],"mappings":";;;;;;;;AAwBc,MAAO,UAAW,SAAQA,gBAA2B,CAAA;AAAnE,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,KAAK,GAAW,KAAK;QAQrB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,SAAS,GAAY,KAAK;QAS1B,IAAA,CAAA,KAAK,GAAW,CAAC;QASjB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,KAAK,GAAW,CAAC;QASjB,IAAA,CAAA,MAAM,GAAW,GAAG;QASpB,IAAA,CAAA,QAAQ,GAAW,EAAE;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CAAA,SAAS,GAAW,CAAC;QASrB,IAAA,CA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AO,EAAE,QAAQ,EAAE,UAAU;YAChD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;YAC5B,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,gBAAgB,CA8GpC;+BA9GoB,gBAAgB;;;;;"}
@@ -1 +1 @@
1
- "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),s=require("@combos-fun/plugin-renderer-3d"),r=require("three");class i extends t.Component{constructor(){super(...arguments),this.shape="box",this.color=65280,this.wireframe=!1,this.width=1,this.height=1,this.depth=1,this.radius=.5,this.segments=32,this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1,this.scaleZ=1,this.opacity=1}static{this.componentName="Graphics3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.type("string")],i.prototype,"shape",void 0),e.__decorate([o.type("number")],i.prototype,"color",void 0),e.__decorate([o.type("boolean")],i.prototype,"wireframe",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"width",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"height",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"depth",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"radius",void 0),e.__decorate([o.type("number"),o.step(1)],i.prototype,"segments",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"positionX",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"positionY",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"positionZ",void 0),e.__decorate([o.type("number"),o.step(.01)],i.prototype,"rotationX",void 0),e.__decorate([o.type("number"),o.step(.01)],i.prototype,"rotationY",void 0),e.__decorate([o.type("number"),o.step(.01)],i.prototype,"rotationZ",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"scaleX",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"scaleY",void 0),e.__decorate([o.type("number"),o.step(.1)],i.prototype,"scaleZ",void 0),e.__decorate([o.type("number"),o.step(.01)],i.prototype,"opacity",void 0);const n=["shape","width","height","depth","radius","segments"],a=["color","wireframe","opacity"];let p=class extends s.Renderer3D{constructor(){super(...arguments),this.name="Graphics3DSystem",this.entries=new Map}static{this.systemName="Graphics3DSystem"}init(){this.game.getSystem(s.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"Graphics3D"===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(i);if(!t)return;const o=this.entries.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,t.scaleZ))}handleAdd(e,t){const o=this.createGeometry(t),s=new r.MeshStandardMaterial({color:t.color,wireframe:t.wireframe,transparent:t.opacity<1,opacity:t.opacity}),i=new r.Mesh(o,s);i.position.set(t.positionX,t.positionY,t.positionZ),i.rotation.set(t.rotationX,t.rotationY,t.rotationZ),i.scale.set(t.scaleX,t.scaleY,t.scaleZ),this.threeContext.scene.add(i),this.entries.set(e.id,{mesh:i})}handleChange(e){const t=e.component,o=e.prop?.prop?.[0],s=this.entries.get(e.gameObject.id);if(s&&(n.includes(o)&&(s.mesh.geometry.dispose(),s.mesh.geometry=this.createGeometry(t)),a.includes(o))){const e=s.mesh.material;e.color.setHex(t.color),e.wireframe=t.wireframe,e.opacity=t.opacity,e.transparent=t.opacity<1}}handleRemove(e){const t=this.entries.get(e);t&&(this.threeContext.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),this.entries.delete(e))}createGeometry(e){switch(e.shape){case"sphere":return new r.SphereGeometry(e.radius,e.segments,e.segments);case"cylinder":return new r.CylinderGeometry(e.radius,e.radius,e.height,e.segments);case"plane":return new r.PlaneGeometry(e.width,e.height);case"cone":return new r.ConeGeometry(e.radius,e.height,e.segments);case"torus":return new r.TorusGeometry(e.radius,.4*e.radius,16,e.segments);default:return new r.BoxGeometry(e.width,e.height,e.depth)}}onDestroy(){for(const[e]of this.entries)this.handleRemove(e);this.entries.clear()}};p=e.__decorate([t.decorators.componentObserver({Graphics3D:["shape","color","wireframe","width","height","depth","radius","segments","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ","opacity"]})],p);var c=p;exports.Graphics3D=i,exports.Graphics3DSystem=c;
1
+ "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),r=require("@combos-fun/plugin-renderer-3d"),i=require("three");class s extends t.Component{constructor(){super(...arguments),this.shape="box",this.color=65280,this.wireframe=!1,this.width=1,this.height=1,this.depth=1,this.radius=.5,this.segments=32,this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.scaleX=1,this.scaleY=1,this.scaleZ=1,this.opacity=1}static{this.componentName="Graphics3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.Field({type:"string",group:"Graphics3D",label:"shape",description:"Primitive shape kind.",editor:"text"})],s.prototype,"shape",void 0),e.__decorate([o.Field({type:"number",group:"Graphics3D",label:"color",description:"Color value.",editor:"number-stepper"})],s.prototype,"color",void 0),e.__decorate([o.Field({type:"boolean",group:"Graphics3D",label:"wireframe",description:"Draw as wireframe.",editor:"toggle"})],s.prototype,"wireframe",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"width",description:"Width.",editor:"number-stepper"})],s.prototype,"width",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"height",description:"Height.",editor:"number-stepper"})],s.prototype,"height",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"depth",description:"Depth.",editor:"number-stepper"})],s.prototype,"depth",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"radius",description:"Radius.",editor:"number-stepper"})],s.prototype,"radius",void 0),e.__decorate([o.Field({type:"number",step:1,group:"Graphics3D",label:"segments",description:"Mesh segment count.",editor:"number-stepper"})],s.prototype,"segments",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],s.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],s.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],s.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Graphics3D",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:"Graphics3D",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:"Graphics3D",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:"Graphics3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],s.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],s.prototype,"scaleY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Graphics3D",label:"scaleZ",description:"Scale on Z.",editor:"number-stepper"})],s.prototype,"scaleZ",void 0),e.__decorate([o.Field({type:"number",step:.01,min:0,max:1,group:"Graphics3D",label:"opacity",description:"Opacity from 0 to 1.",editor:"number-slider"})],s.prototype,"opacity",void 0);const p=["shape","width","height","depth","radius","segments"],a=["color","wireframe","opacity"];let n=class extends r.Renderer3D{constructor(){super(...arguments),this.name="Graphics3DSystem",this.entries=new Map}static{this.systemName="Graphics3DSystem"}init(){this.game.getSystem(r.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"Graphics3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(s);if(!t)return;const o=this.entries.get(e.id);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,t.scaleZ))}handleAdd(e,t){const o=this.createGeometry(t),r=new i.MeshStandardMaterial({color:t.color,wireframe:t.wireframe,transparent:t.opacity<1,opacity:t.opacity}),s=new i.Mesh(o,r);s.position.set(t.positionX,t.positionY,t.positionZ),s.rotation.set(t.rotationX,t.rotationY,t.rotationZ),s.scale.set(t.scaleX,t.scaleY,t.scaleZ),this.threeContext.scene.add(s),this.entries.set(e.id,{mesh:s})}handleChange(e){const t=e.component,o=e.prop?.prop?.[0],r=this.entries.get(e.gameObject.id);if(r&&(p.includes(o)&&(r.mesh.geometry.dispose(),r.mesh.geometry=this.createGeometry(t)),a.includes(o))){const e=r.mesh.material;e.color.setHex(t.color),e.wireframe=t.wireframe,e.opacity=t.opacity,e.transparent=t.opacity<1}}handleRemove(e){const t=this.entries.get(e);t&&(this.threeContext.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),this.entries.delete(e))}createGeometry(e){switch(e.shape){case"sphere":return new i.SphereGeometry(e.radius,e.segments,e.segments);case"cylinder":return new i.CylinderGeometry(e.radius,e.radius,e.height,e.segments);case"plane":return new i.PlaneGeometry(e.width,e.height);case"cone":return new i.ConeGeometry(e.radius,e.height,e.segments);case"torus":return new i.TorusGeometry(e.radius,.4*e.radius,16,e.segments);default:return new i.BoxGeometry(e.width,e.height,e.depth)}}onDestroy(){for(const[e]of this.entries)this.handleRemove(e);this.entries.clear()}};n=e.__decorate([t.decorators.componentObserver({Graphics3D:["shape","color","wireframe","width","height","depth","radius","segments","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ","opacity"]})],n);var d=n;exports.Graphics3D=s,exports.Graphics3DSystem=d;
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import { Component, OBSERVER_TYPE, decorators } from '@combos-fun/engine';
3
- import { type, step } from '@combos-fun/inspector-decorator';
3
+ import { Field } from '@combos-fun/inspector-decorator';
4
4
  import { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';
5
5
  import { MeshStandardMaterial, Mesh, BoxGeometry, TorusGeometry, ConeGeometry, PlaneGeometry, CylinderGeometry, SphereGeometry } from 'three';
6
6
 
@@ -33,73 +33,183 @@ class Graphics3D extends Component {
33
33
  }
34
34
  }
35
35
  __decorate([
36
- type('string')
36
+ Field({
37
+ type: 'string',
38
+ group: 'Graphics3D',
39
+ label: 'shape',
40
+ description: 'Primitive shape kind.',
41
+ editor: 'text',
42
+ })
37
43
  ], Graphics3D.prototype, "shape", void 0);
38
44
  __decorate([
39
- type('number')
45
+ Field({
46
+ type: 'number',
47
+ group: 'Graphics3D',
48
+ label: 'color',
49
+ description: 'Color value.',
50
+ editor: 'number-stepper',
51
+ })
40
52
  ], Graphics3D.prototype, "color", void 0);
41
53
  __decorate([
42
- type('boolean')
54
+ Field({
55
+ type: 'boolean',
56
+ group: 'Graphics3D',
57
+ label: 'wireframe',
58
+ description: 'Draw as wireframe.',
59
+ editor: 'toggle',
60
+ })
43
61
  ], Graphics3D.prototype, "wireframe", void 0);
44
62
  __decorate([
45
- type('number'),
46
- step(0.1)
63
+ Field({
64
+ type: 'number',
65
+ step: 0.1,
66
+ group: 'Graphics3D',
67
+ label: 'width',
68
+ description: 'Width.',
69
+ editor: 'number-stepper',
70
+ })
47
71
  ], Graphics3D.prototype, "width", void 0);
48
72
  __decorate([
49
- type('number'),
50
- step(0.1)
73
+ Field({
74
+ type: 'number',
75
+ step: 0.1,
76
+ group: 'Graphics3D',
77
+ label: 'height',
78
+ description: 'Height.',
79
+ editor: 'number-stepper',
80
+ })
51
81
  ], Graphics3D.prototype, "height", void 0);
52
82
  __decorate([
53
- type('number'),
54
- step(0.1)
83
+ Field({
84
+ type: 'number',
85
+ step: 0.1,
86
+ group: 'Graphics3D',
87
+ label: 'depth',
88
+ description: 'Depth.',
89
+ editor: 'number-stepper',
90
+ })
55
91
  ], Graphics3D.prototype, "depth", void 0);
56
92
  __decorate([
57
- type('number'),
58
- step(0.1)
93
+ Field({
94
+ type: 'number',
95
+ step: 0.1,
96
+ group: 'Graphics3D',
97
+ label: 'radius',
98
+ description: 'Radius.',
99
+ editor: 'number-stepper',
100
+ })
59
101
  ], Graphics3D.prototype, "radius", void 0);
60
102
  __decorate([
61
- type('number'),
62
- step(1)
103
+ Field({
104
+ type: 'number',
105
+ step: 1,
106
+ group: 'Graphics3D',
107
+ label: 'segments',
108
+ description: 'Mesh segment count.',
109
+ editor: 'number-stepper',
110
+ })
63
111
  ], Graphics3D.prototype, "segments", void 0);
64
112
  __decorate([
65
- type('number'),
66
- step(0.1)
113
+ Field({
114
+ type: 'number',
115
+ step: 0.1,
116
+ group: 'Graphics3D',
117
+ label: 'positionX',
118
+ description: 'Local X position.',
119
+ editor: 'number-stepper',
120
+ })
67
121
  ], Graphics3D.prototype, "positionX", void 0);
68
122
  __decorate([
69
- type('number'),
70
- step(0.1)
123
+ Field({
124
+ type: 'number',
125
+ step: 0.1,
126
+ group: 'Graphics3D',
127
+ label: 'positionY',
128
+ description: 'Local Y position.',
129
+ editor: 'number-stepper',
130
+ })
71
131
  ], Graphics3D.prototype, "positionY", void 0);
72
132
  __decorate([
73
- type('number'),
74
- step(0.1)
133
+ Field({
134
+ type: 'number',
135
+ step: 0.1,
136
+ group: 'Graphics3D',
137
+ label: 'positionZ',
138
+ description: 'Local Z position.',
139
+ editor: 'number-stepper',
140
+ })
75
141
  ], Graphics3D.prototype, "positionZ", void 0);
76
142
  __decorate([
77
- type('number'),
78
- step(0.01)
143
+ Field({
144
+ type: 'number',
145
+ step: 0.01,
146
+ group: 'Graphics3D',
147
+ label: 'rotationX',
148
+ description: 'Rotation around X in radians.',
149
+ editor: 'number-stepper',
150
+ })
79
151
  ], Graphics3D.prototype, "rotationX", void 0);
80
152
  __decorate([
81
- type('number'),
82
- step(0.01)
153
+ Field({
154
+ type: 'number',
155
+ step: 0.01,
156
+ group: 'Graphics3D',
157
+ label: 'rotationY',
158
+ description: 'Rotation around Y in radians.',
159
+ editor: 'number-stepper',
160
+ })
83
161
  ], Graphics3D.prototype, "rotationY", void 0);
84
162
  __decorate([
85
- type('number'),
86
- step(0.01)
163
+ Field({
164
+ type: 'number',
165
+ step: 0.01,
166
+ group: 'Graphics3D',
167
+ label: 'rotationZ',
168
+ description: 'Rotation around Z in radians.',
169
+ editor: 'number-stepper',
170
+ })
87
171
  ], Graphics3D.prototype, "rotationZ", void 0);
88
172
  __decorate([
89
- type('number'),
90
- step(0.1)
173
+ Field({
174
+ type: 'number',
175
+ step: 0.1,
176
+ group: 'Graphics3D',
177
+ label: 'scaleX',
178
+ description: 'Scale on X.',
179
+ editor: 'number-stepper',
180
+ })
91
181
  ], Graphics3D.prototype, "scaleX", void 0);
92
182
  __decorate([
93
- type('number'),
94
- step(0.1)
183
+ Field({
184
+ type: 'number',
185
+ step: 0.1,
186
+ group: 'Graphics3D',
187
+ label: 'scaleY',
188
+ description: 'Scale on Y.',
189
+ editor: 'number-stepper',
190
+ })
95
191
  ], Graphics3D.prototype, "scaleY", void 0);
96
192
  __decorate([
97
- type('number'),
98
- step(0.1)
193
+ Field({
194
+ type: 'number',
195
+ step: 0.1,
196
+ group: 'Graphics3D',
197
+ label: 'scaleZ',
198
+ description: 'Scale on Z.',
199
+ editor: 'number-stepper',
200
+ })
99
201
  ], Graphics3D.prototype, "scaleZ", void 0);
100
202
  __decorate([
101
- type('number'),
102
- step(0.01)
203
+ Field({
204
+ type: 'number',
205
+ step: 0.01,
206
+ min: 0,
207
+ max: 1,
208
+ group: 'Graphics3D',
209
+ label: 'opacity',
210
+ description: 'Opacity from 0 to 1.',
211
+ editor: 'number-slider',
212
+ })
103
213
  ], Graphics3D.prototype, "opacity", void 0);
104
214
 
105
215
  const GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-renderer-3d-graphics.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 Graphics3DParams {\n shape?: string;\n color?: number;\n wireframe?: boolean;\n width?: number;\n height?: number;\n depth?: number;\n radius?: number;\n segments?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n opacity?: number;\n}\n\nexport default class Graphics3D extends Component<Graphics3DParams> {\n static componentName: string = 'Graphics3D';\n\n @type('string') shape: string = 'box';\n @type('number') color: number = 0x00ff00;\n @type('boolean') wireframe: boolean = false;\n @type('number') @step(0.1) width: number = 1;\n @type('number') @step(0.1) height: number = 1;\n @type('number') @step(0.1) depth: number = 1;\n @type('number') @step(0.1) radius: number = 0.5;\n @type('number') @step(1) segments: number = 32;\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.1) scaleZ: number = 1;\n @type('number') @step(0.01) opacity: number = 1;\n\n init(obj?: Graphics3DParams) {\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 BoxGeometry,\n SphereGeometry,\n CylinderGeometry,\n PlaneGeometry,\n ConeGeometry,\n TorusGeometry,\n MeshStandardMaterial,\n Mesh,\n} from 'three';\nimport type { BufferGeometry } from 'three';\nimport Graphics3D from './component';\n\ninterface Graphics3DEntry {\n mesh: Mesh;\n}\n\nconst GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];\nconst MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];\n\n@decorators.componentObserver({\n Graphics3D: [\n 'shape', 'color', 'wireframe',\n 'width', 'height', 'depth', 'radius', 'segments',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'opacity',\n ],\n})\nexport default class Graphics3DSystem extends Renderer3D {\n static systemName = 'Graphics3DSystem';\n name: string = 'Graphics3DSystem';\n\n private entries: Map<number, Graphics3DEntry> = 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 !== 'Graphics3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Graphics3D);\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(Graphics3D) as Graphics3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private handleAdd(gameObject: GameObject, component: Graphics3D) {\n const geometry = this.createGeometry(component);\n const material = new MeshStandardMaterial({\n color: component.color,\n wireframe: component.wireframe,\n transparent: component.opacity < 1,\n opacity: component.opacity,\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, component.scaleZ);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as Graphics3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n if (!entry) return;\n\n if (GEOMETRY_PROPS.includes(changedProp)) {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = this.createGeometry(component);\n }\n\n if (MATERIAL_PROPS.includes(changedProp)) {\n const material = entry.mesh.material as MeshStandardMaterial;\n material.color.setHex(component.color);\n material.wireframe = component.wireframe;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshStandardMaterial).dispose();\n this.entries.delete(id);\n }\n\n private createGeometry(component: Graphics3D): BufferGeometry {\n switch (component.shape) {\n case 'sphere':\n return new SphereGeometry(component.radius, component.segments, component.segments);\n case 'cylinder':\n return new CylinderGeometry(\n component.radius, component.radius, component.height, component.segments,\n );\n case 'plane':\n return new PlaneGeometry(component.width, component.height);\n case 'cone':\n return new ConeGeometry(component.radius, component.height, component.segments);\n case 'torus':\n return new TorusGeometry(\n component.radius, component.radius * 0.4, 16, component.segments,\n );\n case 'box':\n default:\n return new BoxGeometry(component.width, component.height, component.depth);\n }\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}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EAAE,UAAU;YAChD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;YAC5B,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,gBAAgB,CA8GpC;+BA9GoB,gBAAgB;;;;"}
1
+ {"version":3,"file":"plugin-renderer-3d-graphics.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 Graphics3DParams {\n shape?: string;\n color?: number;\n wireframe?: boolean;\n width?: number;\n height?: number;\n depth?: number;\n radius?: number;\n segments?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n scaleX?: number;\n scaleY?: number;\n scaleZ?: number;\n opacity?: number;\n}\n\nexport default class Graphics3D extends Component<Graphics3DParams> {\n static componentName: string = 'Graphics3D';\n\n @Field({\n\n type: 'string',\n\n group: 'Graphics3D',\n\n label: 'shape',\n\n description: 'Primitive shape kind.',\n\n editor: 'text',\n\n })\n\n shape: string = 'box';\n @Field({\n type: 'number',\n group: 'Graphics3D',\n label: 'color',\n description: 'Color value.',\n editor: 'number-stepper',\n })\n color: number = 0x00ff00;\n @Field({\n type: 'boolean',\n group: 'Graphics3D',\n label: 'wireframe',\n description: 'Draw as wireframe.',\n editor: 'toggle',\n })\n wireframe: boolean = false;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'width',\n description: 'Width.',\n editor: 'number-stepper',\n })\n width: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'height',\n description: 'Height.',\n editor: 'number-stepper',\n })\n height: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'depth',\n description: 'Depth.',\n editor: 'number-stepper',\n })\n depth: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'radius',\n description: 'Radius.',\n editor: 'number-stepper',\n })\n radius: number = 0.5;\n @Field({\n type: 'number',\n step: 1,\n group: 'Graphics3D',\n label: 'segments',\n description: 'Mesh segment count.',\n editor: 'number-stepper',\n })\n segments: number = 32;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\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: 'Graphics3D',\n label: 'scaleY',\n description: 'Scale on Y.',\n editor: 'number-stepper',\n })\n scaleY: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Graphics3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n scaleZ: number = 1;\n @Field({\n type: 'number',\n step: 0.01,\n min: 0,\n max: 1,\n group: 'Graphics3D',\n label: 'opacity',\n description: 'Opacity from 0 to 1.',\n editor: 'number-slider',\n })\n opacity: number = 1;\n\n init(obj?: Graphics3DParams) {\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 BoxGeometry,\n SphereGeometry,\n CylinderGeometry,\n PlaneGeometry,\n ConeGeometry,\n TorusGeometry,\n MeshStandardMaterial,\n Mesh,\n} from 'three';\nimport type { BufferGeometry } from 'three';\nimport Graphics3D from './component';\n\ninterface Graphics3DEntry {\n mesh: Mesh;\n}\n\nconst GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];\nconst MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];\n\n@decorators.componentObserver({\n Graphics3D: [\n 'shape', 'color', 'wireframe',\n 'width', 'height', 'depth', 'radius', 'segments',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'opacity',\n ],\n})\nexport default class Graphics3DSystem extends Renderer3D {\n static systemName = 'Graphics3DSystem';\n name: string = 'Graphics3DSystem';\n\n private entries: Map<number, Graphics3DEntry> = 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 !== 'Graphics3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as Graphics3D);\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(Graphics3D) as Graphics3D;\n if (!component) return;\n\n const entry = this.entries.get(gameObject.id);\n if (!entry) return;\n\n entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);\n entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private handleAdd(gameObject: GameObject, component: Graphics3D) {\n const geometry = this.createGeometry(component);\n const material = new MeshStandardMaterial({\n color: component.color,\n wireframe: component.wireframe,\n transparent: component.opacity < 1,\n opacity: component.opacity,\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, component.scaleZ);\n\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as Graphics3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n if (!entry) return;\n\n if (GEOMETRY_PROPS.includes(changedProp)) {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = this.createGeometry(component);\n }\n\n if (MATERIAL_PROPS.includes(changedProp)) {\n const material = entry.mesh.material as MeshStandardMaterial;\n material.color.setHex(component.color);\n material.wireframe = component.wireframe;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n const entry = this.entries.get(id);\n if (!entry) return;\n\n this.threeContext.scene.remove(entry.mesh);\n entry.mesh.geometry.dispose();\n (entry.mesh.material as MeshStandardMaterial).dispose();\n this.entries.delete(id);\n }\n\n private createGeometry(component: Graphics3D): BufferGeometry {\n switch (component.shape) {\n case 'sphere':\n return new SphereGeometry(component.radius, component.segments, component.segments);\n case 'cylinder':\n return new CylinderGeometry(\n component.radius, component.radius, component.height, component.segments,\n );\n case 'plane':\n return new PlaneGeometry(component.width, component.height);\n case 'cone':\n return new ConeGeometry(component.radius, component.height, component.segments);\n case 'torus':\n return new TorusGeometry(\n component.radius, component.radius * 0.4, 16, component.segments,\n );\n case 'box':\n default:\n return new BoxGeometry(component.width, component.height, component.depth);\n }\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAwBc,MAAO,UAAW,SAAQ,SAA2B,CAAA;AAAnE,IAAA,WAAA,GAAA;;QAiBE,IAAA,CAAA,KAAK,GAAW,KAAK;QAQrB,IAAA,CAAA,KAAK,GAAW,QAAQ;QAQxB,IAAA,CAAA,SAAS,GAAY,KAAK;QAS1B,IAAA,CAAA,KAAK,GAAW,CAAC;QASjB,IAAA,CAAA,MAAM,GAAW,CAAC;QASlB,IAAA,CAAA,KAAK,GAAW,CAAC;QASjB,IAAA,CAAA,MAAM,GAAW,GAAG;QASpB,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;QASlB,IAAA,CAAA,MAAM,GAAW,CAAC;QAWlB,IAAA,CAAA,OAAO,GAAW,CAAC;IAKrB;aA9KS,IAAA,CAAA,aAAa,GAAW,YAAX,CAAwB;AA2K5C,IAAA,IAAI,CAAC,GAAsB,EAAA;AACzB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AA7JA,UAAA,CAAA;AAdC,IAAA,KAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EAAE,YAAY;AAEnB,QAAA,KAAK,EAAE,OAAO;AAEd,QAAA,WAAW,EAAE,uBAAuB;AAEpC,QAAA,MAAM,EAAE,MAAM;KAEf;AAEq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CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC;;IAEhF;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AA7GmB,gBAAgB,GAAA,UAAA,CAAA;IAVpC,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,UAAU,EAAE;YACV,OAAO,EAAE,OAAO,EAAE,WAAW;AAC7B,YAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU;YAChD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;YAC5B,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,gBAAgB,CA8GpC;+BA9GoB,gBAAgB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combos-fun/plugin-renderer-3d-graphics",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "Procedural 3D primitive shapes",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-3d-graphics.esm.js",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "three": "^0.172.0",
30
- "@combos-fun/plugin-renderer-3d": "0.0.34",
31
- "@combos-fun/inspector-decorator": "0.0.34",
32
- "@combos-fun/engine": "0.0.34"
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",