@combos-fun/plugin-renderer-3d-graphics 0.0.6

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.
@@ -0,0 +1,226 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var engine = require('@combos-fun/engine');
5
+ var inspectorDecorator = require('@combos-fun/inspector-decorator');
6
+ var pluginRenderer3d = require('@combos-fun/plugin-renderer-3d');
7
+ var three = require('three');
8
+
9
+ class Graphics3D extends engine.Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.shape = 'box';
13
+ this.color = 0x00ff00;
14
+ this.wireframe = false;
15
+ this.width = 1;
16
+ this.height = 1;
17
+ this.depth = 1;
18
+ this.radius = 0.5;
19
+ this.segments = 32;
20
+ this.positionX = 0;
21
+ this.positionY = 0;
22
+ this.positionZ = 0;
23
+ this.rotationX = 0;
24
+ this.rotationY = 0;
25
+ this.rotationZ = 0;
26
+ this.scaleX = 1;
27
+ this.scaleY = 1;
28
+ this.scaleZ = 1;
29
+ this.opacity = 1;
30
+ }
31
+ static { this.componentName = 'Graphics3D'; }
32
+ init(obj) {
33
+ if (obj)
34
+ Object.assign(this, obj);
35
+ }
36
+ }
37
+ tslib.__decorate([
38
+ inspectorDecorator.type('string')
39
+ ], Graphics3D.prototype, "shape", void 0);
40
+ tslib.__decorate([
41
+ inspectorDecorator.type('number')
42
+ ], Graphics3D.prototype, "color", void 0);
43
+ tslib.__decorate([
44
+ inspectorDecorator.type('boolean')
45
+ ], Graphics3D.prototype, "wireframe", void 0);
46
+ tslib.__decorate([
47
+ inspectorDecorator.type('number'),
48
+ inspectorDecorator.step(0.1)
49
+ ], Graphics3D.prototype, "width", void 0);
50
+ tslib.__decorate([
51
+ inspectorDecorator.type('number'),
52
+ inspectorDecorator.step(0.1)
53
+ ], Graphics3D.prototype, "height", void 0);
54
+ tslib.__decorate([
55
+ inspectorDecorator.type('number'),
56
+ inspectorDecorator.step(0.1)
57
+ ], Graphics3D.prototype, "depth", void 0);
58
+ tslib.__decorate([
59
+ inspectorDecorator.type('number'),
60
+ inspectorDecorator.step(0.1)
61
+ ], Graphics3D.prototype, "radius", void 0);
62
+ tslib.__decorate([
63
+ inspectorDecorator.type('number'),
64
+ inspectorDecorator.step(1)
65
+ ], Graphics3D.prototype, "segments", void 0);
66
+ tslib.__decorate([
67
+ inspectorDecorator.type('number'),
68
+ inspectorDecorator.step(0.1)
69
+ ], Graphics3D.prototype, "positionX", void 0);
70
+ tslib.__decorate([
71
+ inspectorDecorator.type('number'),
72
+ inspectorDecorator.step(0.1)
73
+ ], Graphics3D.prototype, "positionY", void 0);
74
+ tslib.__decorate([
75
+ inspectorDecorator.type('number'),
76
+ inspectorDecorator.step(0.1)
77
+ ], Graphics3D.prototype, "positionZ", void 0);
78
+ tslib.__decorate([
79
+ inspectorDecorator.type('number'),
80
+ inspectorDecorator.step(0.01)
81
+ ], Graphics3D.prototype, "rotationX", void 0);
82
+ tslib.__decorate([
83
+ inspectorDecorator.type('number'),
84
+ inspectorDecorator.step(0.01)
85
+ ], Graphics3D.prototype, "rotationY", void 0);
86
+ tslib.__decorate([
87
+ inspectorDecorator.type('number'),
88
+ inspectorDecorator.step(0.01)
89
+ ], Graphics3D.prototype, "rotationZ", void 0);
90
+ tslib.__decorate([
91
+ inspectorDecorator.type('number'),
92
+ inspectorDecorator.step(0.1)
93
+ ], Graphics3D.prototype, "scaleX", void 0);
94
+ tslib.__decorate([
95
+ inspectorDecorator.type('number'),
96
+ inspectorDecorator.step(0.1)
97
+ ], Graphics3D.prototype, "scaleY", void 0);
98
+ tslib.__decorate([
99
+ inspectorDecorator.type('number'),
100
+ inspectorDecorator.step(0.1)
101
+ ], Graphics3D.prototype, "scaleZ", void 0);
102
+ tslib.__decorate([
103
+ inspectorDecorator.type('number'),
104
+ inspectorDecorator.step(0.01)
105
+ ], Graphics3D.prototype, "opacity", void 0);
106
+
107
+ const GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];
108
+ const MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];
109
+ let Graphics3DSystem = class Graphics3DSystem extends pluginRenderer3d.Renderer3D {
110
+ constructor() {
111
+ super(...arguments);
112
+ this.name = 'Graphics3DSystem';
113
+ this.entries = new Map();
114
+ }
115
+ static { this.systemName = 'Graphics3DSystem'; }
116
+ init() {
117
+ const renderer3DSystem = this.game.getSystem(pluginRenderer3d.Renderer3DSystem);
118
+ renderer3DSystem.rendererManager.register(this);
119
+ }
120
+ componentChanged(changed) {
121
+ if (changed.componentName !== 'Graphics3D')
122
+ return;
123
+ if (changed.type === engine.OBSERVER_TYPE.ADD) {
124
+ this.handleAdd(changed.gameObject, changed.component);
125
+ }
126
+ else if (changed.type === engine.OBSERVER_TYPE.REMOVE) {
127
+ this.handleRemove(changed.gameObject.id);
128
+ }
129
+ else {
130
+ this.handleChange(changed);
131
+ }
132
+ }
133
+ rendererUpdate(gameObject) {
134
+ const component = gameObject.getComponent(Graphics3D);
135
+ if (!component)
136
+ return;
137
+ const entry = this.entries.get(gameObject.id);
138
+ if (!entry)
139
+ return;
140
+ entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
141
+ entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
142
+ entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);
143
+ }
144
+ handleAdd(gameObject, component) {
145
+ const geometry = this.createGeometry(component);
146
+ const material = new three.MeshStandardMaterial({
147
+ color: component.color,
148
+ wireframe: component.wireframe,
149
+ transparent: component.opacity < 1,
150
+ opacity: component.opacity,
151
+ });
152
+ const mesh = new three.Mesh(geometry, material);
153
+ mesh.position.set(component.positionX, component.positionY, component.positionZ);
154
+ mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
155
+ mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);
156
+ this.threeContext.scene.add(mesh);
157
+ this.entries.set(gameObject.id, { mesh });
158
+ }
159
+ handleChange(changed) {
160
+ const component = changed.component;
161
+ const changedProp = changed.prop?.prop?.[0];
162
+ const entry = this.entries.get(changed.gameObject.id);
163
+ if (!entry)
164
+ return;
165
+ if (GEOMETRY_PROPS.includes(changedProp)) {
166
+ entry.mesh.geometry.dispose();
167
+ entry.mesh.geometry = this.createGeometry(component);
168
+ }
169
+ if (MATERIAL_PROPS.includes(changedProp)) {
170
+ const material = entry.mesh.material;
171
+ material.color.setHex(component.color);
172
+ material.wireframe = component.wireframe;
173
+ material.opacity = component.opacity;
174
+ material.transparent = component.opacity < 1;
175
+ }
176
+ }
177
+ handleRemove(id) {
178
+ const entry = this.entries.get(id);
179
+ if (!entry)
180
+ return;
181
+ this.threeContext.scene.remove(entry.mesh);
182
+ entry.mesh.geometry.dispose();
183
+ entry.mesh.material.dispose();
184
+ this.entries.delete(id);
185
+ }
186
+ createGeometry(component) {
187
+ switch (component.shape) {
188
+ case 'sphere':
189
+ return new three.SphereGeometry(component.radius, component.segments, component.segments);
190
+ case 'cylinder':
191
+ return new three.CylinderGeometry(component.radius, component.radius, component.height, component.segments);
192
+ case 'plane':
193
+ return new three.PlaneGeometry(component.width, component.height);
194
+ case 'cone':
195
+ return new three.ConeGeometry(component.radius, component.height, component.segments);
196
+ case 'torus':
197
+ return new three.TorusGeometry(component.radius, component.radius * 0.4, 16, component.segments);
198
+ case 'box':
199
+ default:
200
+ return new three.BoxGeometry(component.width, component.height, component.depth);
201
+ }
202
+ }
203
+ onDestroy() {
204
+ for (const [id] of this.entries) {
205
+ this.handleRemove(id);
206
+ }
207
+ this.entries.clear();
208
+ }
209
+ };
210
+ Graphics3DSystem = tslib.__decorate([
211
+ engine.decorators.componentObserver({
212
+ Graphics3D: [
213
+ 'shape', 'color', 'wireframe',
214
+ 'width', 'height', 'depth', 'radius', 'segments',
215
+ 'positionX', 'positionY', 'positionZ',
216
+ 'rotationX', 'rotationY', 'rotationZ',
217
+ 'scaleX', 'scaleY', 'scaleZ',
218
+ 'opacity',
219
+ ],
220
+ })
221
+ ], Graphics3DSystem);
222
+ var Graphics3DSystem_default = Graphics3DSystem;
223
+
224
+ exports.Graphics3D = Graphics3D;
225
+ exports.Graphics3DSystem = Graphics3DSystem_default;
226
+ //# sourceMappingURL=plugin-renderer-3d-graphics.cjs.js.map
@@ -0,0 +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","T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BAAA,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;;;;;"}
@@ -0,0 +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;
@@ -0,0 +1,62 @@
1
+ import { Component, ComponentChanged, GameObject } from '@combos-fun/engine';
2
+ import { Renderer3D } from '@combos-fun/plugin-renderer-3d';
3
+
4
+ interface Graphics3DParams {
5
+ shape?: string;
6
+ color?: number;
7
+ wireframe?: boolean;
8
+ width?: number;
9
+ height?: number;
10
+ depth?: number;
11
+ radius?: number;
12
+ segments?: number;
13
+ positionX?: number;
14
+ positionY?: number;
15
+ positionZ?: number;
16
+ rotationX?: number;
17
+ rotationY?: number;
18
+ rotationZ?: number;
19
+ scaleX?: number;
20
+ scaleY?: number;
21
+ scaleZ?: number;
22
+ opacity?: number;
23
+ }
24
+ declare class Graphics3D extends Component<Graphics3DParams> {
25
+ static componentName: string;
26
+ shape: string;
27
+ color: number;
28
+ wireframe: boolean;
29
+ width: number;
30
+ height: number;
31
+ depth: number;
32
+ radius: number;
33
+ segments: number;
34
+ positionX: number;
35
+ positionY: number;
36
+ positionZ: number;
37
+ rotationX: number;
38
+ rotationY: number;
39
+ rotationZ: number;
40
+ scaleX: number;
41
+ scaleY: number;
42
+ scaleZ: number;
43
+ opacity: number;
44
+ init(obj?: Graphics3DParams): void;
45
+ }
46
+
47
+ declare class Graphics3DSystem extends Renderer3D {
48
+ static systemName: string;
49
+ name: string;
50
+ private entries;
51
+ init(): void;
52
+ componentChanged(changed: ComponentChanged): void;
53
+ rendererUpdate(gameObject: GameObject): void;
54
+ private handleAdd;
55
+ private handleChange;
56
+ private handleRemove;
57
+ private createGeometry;
58
+ onDestroy(): void;
59
+ }
60
+
61
+ export { Graphics3D, Graphics3DSystem };
62
+ export type { Graphics3DParams };
@@ -0,0 +1,223 @@
1
+ import { __decorate } from 'tslib';
2
+ import { Component, OBSERVER_TYPE, decorators } from '@combos-fun/engine';
3
+ import { type, step } from '@combos-fun/inspector-decorator';
4
+ import { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';
5
+ import { MeshStandardMaterial, Mesh, BoxGeometry, TorusGeometry, ConeGeometry, PlaneGeometry, CylinderGeometry, SphereGeometry } from 'three';
6
+
7
+ class Graphics3D extends Component {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.shape = 'box';
11
+ this.color = 0x00ff00;
12
+ this.wireframe = false;
13
+ this.width = 1;
14
+ this.height = 1;
15
+ this.depth = 1;
16
+ this.radius = 0.5;
17
+ this.segments = 32;
18
+ this.positionX = 0;
19
+ this.positionY = 0;
20
+ this.positionZ = 0;
21
+ this.rotationX = 0;
22
+ this.rotationY = 0;
23
+ this.rotationZ = 0;
24
+ this.scaleX = 1;
25
+ this.scaleY = 1;
26
+ this.scaleZ = 1;
27
+ this.opacity = 1;
28
+ }
29
+ static { this.componentName = 'Graphics3D'; }
30
+ init(obj) {
31
+ if (obj)
32
+ Object.assign(this, obj);
33
+ }
34
+ }
35
+ __decorate([
36
+ type('string')
37
+ ], Graphics3D.prototype, "shape", void 0);
38
+ __decorate([
39
+ type('number')
40
+ ], Graphics3D.prototype, "color", void 0);
41
+ __decorate([
42
+ type('boolean')
43
+ ], Graphics3D.prototype, "wireframe", void 0);
44
+ __decorate([
45
+ type('number'),
46
+ step(0.1)
47
+ ], Graphics3D.prototype, "width", void 0);
48
+ __decorate([
49
+ type('number'),
50
+ step(0.1)
51
+ ], Graphics3D.prototype, "height", void 0);
52
+ __decorate([
53
+ type('number'),
54
+ step(0.1)
55
+ ], Graphics3D.prototype, "depth", void 0);
56
+ __decorate([
57
+ type('number'),
58
+ step(0.1)
59
+ ], Graphics3D.prototype, "radius", void 0);
60
+ __decorate([
61
+ type('number'),
62
+ step(1)
63
+ ], Graphics3D.prototype, "segments", void 0);
64
+ __decorate([
65
+ type('number'),
66
+ step(0.1)
67
+ ], Graphics3D.prototype, "positionX", void 0);
68
+ __decorate([
69
+ type('number'),
70
+ step(0.1)
71
+ ], Graphics3D.prototype, "positionY", void 0);
72
+ __decorate([
73
+ type('number'),
74
+ step(0.1)
75
+ ], Graphics3D.prototype, "positionZ", void 0);
76
+ __decorate([
77
+ type('number'),
78
+ step(0.01)
79
+ ], Graphics3D.prototype, "rotationX", void 0);
80
+ __decorate([
81
+ type('number'),
82
+ step(0.01)
83
+ ], Graphics3D.prototype, "rotationY", void 0);
84
+ __decorate([
85
+ type('number'),
86
+ step(0.01)
87
+ ], Graphics3D.prototype, "rotationZ", void 0);
88
+ __decorate([
89
+ type('number'),
90
+ step(0.1)
91
+ ], Graphics3D.prototype, "scaleX", void 0);
92
+ __decorate([
93
+ type('number'),
94
+ step(0.1)
95
+ ], Graphics3D.prototype, "scaleY", void 0);
96
+ __decorate([
97
+ type('number'),
98
+ step(0.1)
99
+ ], Graphics3D.prototype, "scaleZ", void 0);
100
+ __decorate([
101
+ type('number'),
102
+ step(0.01)
103
+ ], Graphics3D.prototype, "opacity", void 0);
104
+
105
+ const GEOMETRY_PROPS = ['shape', 'width', 'height', 'depth', 'radius', 'segments'];
106
+ const MATERIAL_PROPS = ['color', 'wireframe', 'opacity'];
107
+ let Graphics3DSystem = class Graphics3DSystem extends Renderer3D {
108
+ constructor() {
109
+ super(...arguments);
110
+ this.name = 'Graphics3DSystem';
111
+ this.entries = new Map();
112
+ }
113
+ static { this.systemName = 'Graphics3DSystem'; }
114
+ init() {
115
+ const renderer3DSystem = this.game.getSystem(Renderer3DSystem);
116
+ renderer3DSystem.rendererManager.register(this);
117
+ }
118
+ componentChanged(changed) {
119
+ if (changed.componentName !== 'Graphics3D')
120
+ return;
121
+ if (changed.type === OBSERVER_TYPE.ADD) {
122
+ this.handleAdd(changed.gameObject, changed.component);
123
+ }
124
+ else if (changed.type === OBSERVER_TYPE.REMOVE) {
125
+ this.handleRemove(changed.gameObject.id);
126
+ }
127
+ else {
128
+ this.handleChange(changed);
129
+ }
130
+ }
131
+ rendererUpdate(gameObject) {
132
+ const component = gameObject.getComponent(Graphics3D);
133
+ if (!component)
134
+ return;
135
+ const entry = this.entries.get(gameObject.id);
136
+ if (!entry)
137
+ return;
138
+ entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
139
+ entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
140
+ entry.mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);
141
+ }
142
+ handleAdd(gameObject, component) {
143
+ const geometry = this.createGeometry(component);
144
+ const material = new MeshStandardMaterial({
145
+ color: component.color,
146
+ wireframe: component.wireframe,
147
+ transparent: component.opacity < 1,
148
+ opacity: component.opacity,
149
+ });
150
+ const mesh = new Mesh(geometry, material);
151
+ mesh.position.set(component.positionX, component.positionY, component.positionZ);
152
+ mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
153
+ mesh.scale.set(component.scaleX, component.scaleY, component.scaleZ);
154
+ this.threeContext.scene.add(mesh);
155
+ this.entries.set(gameObject.id, { mesh });
156
+ }
157
+ handleChange(changed) {
158
+ const component = changed.component;
159
+ const changedProp = changed.prop?.prop?.[0];
160
+ const entry = this.entries.get(changed.gameObject.id);
161
+ if (!entry)
162
+ return;
163
+ if (GEOMETRY_PROPS.includes(changedProp)) {
164
+ entry.mesh.geometry.dispose();
165
+ entry.mesh.geometry = this.createGeometry(component);
166
+ }
167
+ if (MATERIAL_PROPS.includes(changedProp)) {
168
+ const material = entry.mesh.material;
169
+ material.color.setHex(component.color);
170
+ material.wireframe = component.wireframe;
171
+ material.opacity = component.opacity;
172
+ material.transparent = component.opacity < 1;
173
+ }
174
+ }
175
+ handleRemove(id) {
176
+ const entry = this.entries.get(id);
177
+ if (!entry)
178
+ return;
179
+ this.threeContext.scene.remove(entry.mesh);
180
+ entry.mesh.geometry.dispose();
181
+ entry.mesh.material.dispose();
182
+ this.entries.delete(id);
183
+ }
184
+ createGeometry(component) {
185
+ switch (component.shape) {
186
+ case 'sphere':
187
+ return new SphereGeometry(component.radius, component.segments, component.segments);
188
+ case 'cylinder':
189
+ return new CylinderGeometry(component.radius, component.radius, component.height, component.segments);
190
+ case 'plane':
191
+ return new PlaneGeometry(component.width, component.height);
192
+ case 'cone':
193
+ return new ConeGeometry(component.radius, component.height, component.segments);
194
+ case 'torus':
195
+ return new TorusGeometry(component.radius, component.radius * 0.4, 16, component.segments);
196
+ case 'box':
197
+ default:
198
+ return new BoxGeometry(component.width, component.height, component.depth);
199
+ }
200
+ }
201
+ onDestroy() {
202
+ for (const [id] of this.entries) {
203
+ this.handleRemove(id);
204
+ }
205
+ this.entries.clear();
206
+ }
207
+ };
208
+ Graphics3DSystem = __decorate([
209
+ decorators.componentObserver({
210
+ Graphics3D: [
211
+ 'shape', 'color', 'wireframe',
212
+ 'width', 'height', 'depth', 'radius', 'segments',
213
+ 'positionX', 'positionY', 'positionZ',
214
+ 'rotationX', 'rotationY', 'rotationZ',
215
+ 'scaleX', 'scaleY', 'scaleZ',
216
+ 'opacity',
217
+ ],
218
+ })
219
+ ], Graphics3DSystem);
220
+ var Graphics3DSystem_default = Graphics3DSystem;
221
+
222
+ export { Graphics3D, Graphics3DSystem_default as Graphics3DSystem };
223
+ //# sourceMappingURL=plugin-renderer-3d-graphics.esm.js.map
@@ -0,0 +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}\n"],"names":[],"mappings":";;;;;;AAwBc,MAAO,UAAW,SAAQ,SAA2B,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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
+ module.exports = require('./dist/plugin-renderer-3d-graphics.cjs.js');
7
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@combos-fun/plugin-renderer-3d-graphics",
3
+ "version": "0.0.6",
4
+ "description": "@combos-fun/plugin-renderer-3d-graphics",
5
+ "main": "index.js",
6
+ "module": "dist/plugin-renderer-3d-graphics.esm.js",
7
+ "bundle": "CombosFun.plugin.renderer.3d.graphics",
8
+ "unpkg": "dist/CombosFun.plugin.renderer.3d.graphics.min.js",
9
+ "types": "dist/plugin-renderer-3d-graphics.d.ts",
10
+ "files": [
11
+ "index.js",
12
+ "dist"
13
+ ],
14
+ "dependencies": {
15
+ "three": "^0.172.0",
16
+ "@combos-fun/engine": "0.0.6",
17
+ "@combos-fun/inspector-decorator": "0.0.6",
18
+ "@combos-fun/plugin-renderer-3d": "0.0.6"
19
+ },
20
+ "scripts": {
21
+ "build": "node ../../scripts/build-package.mjs"
22
+ }
23
+ }