@combos-fun/plugin-renderer-3d-model 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,163 @@
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
+
8
+ class Model3D extends engine.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.resource = '';
12
+ this.autoPlay = true;
13
+ this.animationIndex = 0;
14
+ this.speed = 1;
15
+ this.positionX = 0;
16
+ this.positionY = 0;
17
+ this.positionZ = 0;
18
+ this.rotationX = 0;
19
+ this.rotationY = 0;
20
+ this.rotationZ = 0;
21
+ this.scaleX = 1;
22
+ this.scaleY = 1;
23
+ this.scaleZ = 1;
24
+ }
25
+ static { this.componentName = 'Model3D'; }
26
+ init(obj) {
27
+ if (obj)
28
+ Object.assign(this, obj);
29
+ }
30
+ }
31
+ tslib.__decorate([
32
+ inspectorDecorator.type('string')
33
+ ], Model3D.prototype, "resource", void 0);
34
+ tslib.__decorate([
35
+ inspectorDecorator.type('boolean')
36
+ ], Model3D.prototype, "autoPlay", void 0);
37
+ tslib.__decorate([
38
+ inspectorDecorator.type('number')
39
+ ], Model3D.prototype, "animationIndex", void 0);
40
+ tslib.__decorate([
41
+ inspectorDecorator.type('number'),
42
+ inspectorDecorator.step(0.1)
43
+ ], Model3D.prototype, "speed", void 0);
44
+ tslib.__decorate([
45
+ inspectorDecorator.type('number'),
46
+ inspectorDecorator.step(0.1)
47
+ ], Model3D.prototype, "positionX", void 0);
48
+ tslib.__decorate([
49
+ inspectorDecorator.type('number'),
50
+ inspectorDecorator.step(0.1)
51
+ ], Model3D.prototype, "positionY", void 0);
52
+ tslib.__decorate([
53
+ inspectorDecorator.type('number'),
54
+ inspectorDecorator.step(0.1)
55
+ ], Model3D.prototype, "positionZ", void 0);
56
+ tslib.__decorate([
57
+ inspectorDecorator.type('number'),
58
+ inspectorDecorator.step(0.01)
59
+ ], Model3D.prototype, "rotationX", void 0);
60
+ tslib.__decorate([
61
+ inspectorDecorator.type('number'),
62
+ inspectorDecorator.step(0.01)
63
+ ], Model3D.prototype, "rotationY", void 0);
64
+ tslib.__decorate([
65
+ inspectorDecorator.type('number'),
66
+ inspectorDecorator.step(0.01)
67
+ ], Model3D.prototype, "rotationZ", void 0);
68
+ tslib.__decorate([
69
+ inspectorDecorator.type('number'),
70
+ inspectorDecorator.step(0.1)
71
+ ], Model3D.prototype, "scaleX", void 0);
72
+ tslib.__decorate([
73
+ inspectorDecorator.type('number'),
74
+ inspectorDecorator.step(0.1)
75
+ ], Model3D.prototype, "scaleY", void 0);
76
+ tslib.__decorate([
77
+ inspectorDecorator.type('number'),
78
+ inspectorDecorator.step(0.1)
79
+ ], Model3D.prototype, "scaleZ", void 0);
80
+
81
+ let GLBSystem = class GLBSystem extends pluginRenderer3d.Renderer3D {
82
+ constructor() {
83
+ super(...arguments);
84
+ this.name = 'GLBSystem';
85
+ }
86
+ static { this.systemName = 'GLBSystem'; }
87
+ init() {
88
+ const renderer3DSystem = this.game.getSystem(pluginRenderer3d.Renderer3DSystem);
89
+ renderer3DSystem.rendererManager.register(this);
90
+ }
91
+ componentChanged(changed) {
92
+ if (changed.componentName !== 'Model3D')
93
+ return;
94
+ const component = changed.component;
95
+ if (changed.type === engine.OBSERVER_TYPE.ADD) {
96
+ this.handleAdd(changed.gameObject, component);
97
+ }
98
+ else if (changed.type === engine.OBSERVER_TYPE.CHANGE) {
99
+ this.handleChange(changed);
100
+ }
101
+ else if (changed.type === engine.OBSERVER_TYPE.REMOVE) {
102
+ this.increaseAsyncId(changed.gameObject.id);
103
+ this.threeContext.removeModel(changed.gameObject.id);
104
+ }
105
+ }
106
+ rendererUpdate(gameObject) {
107
+ const component = gameObject.getComponent(Model3D);
108
+ if (!component)
109
+ return;
110
+ const model = this.threeContext.models.get(gameObject.id);
111
+ if (!model)
112
+ return;
113
+ model.position.set(component.positionX, component.positionY, component.positionZ);
114
+ model.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
115
+ model.scale.set(component.scaleX, component.scaleY, component.scaleZ);
116
+ }
117
+ async handleAdd(gameObject, component) {
118
+ if (!component.resource)
119
+ return;
120
+ const asyncId = this.increaseAsyncId(gameObject.id);
121
+ await this.threeContext.loadGLB(gameObject.id, component.resource);
122
+ if (!this.validateAsyncId(gameObject.id, asyncId))
123
+ return;
124
+ if (component.autoPlay) {
125
+ this.threeContext.playAnimation(gameObject.id, component.animationIndex, component.speed);
126
+ }
127
+ }
128
+ async handleChange(changed) {
129
+ const component = changed.component;
130
+ const changedProp = changed.prop?.prop?.[0];
131
+ if (changedProp === 'resource') {
132
+ this.threeContext.removeModel(changed.gameObject.id);
133
+ if (!component.resource)
134
+ return;
135
+ const asyncId = this.increaseAsyncId(changed.gameObject.id);
136
+ await this.threeContext.loadGLB(changed.gameObject.id, component.resource);
137
+ if (!this.validateAsyncId(changed.gameObject.id, asyncId))
138
+ return;
139
+ if (component.autoPlay) {
140
+ this.threeContext.playAnimation(changed.gameObject.id, component.animationIndex, component.speed);
141
+ }
142
+ }
143
+ if (changedProp === 'speed' || changedProp === 'animationIndex') {
144
+ this.threeContext.playAnimation(changed.gameObject.id, component.animationIndex, component.speed);
145
+ }
146
+ }
147
+ };
148
+ GLBSystem = tslib.__decorate([
149
+ engine.decorators.componentObserver({
150
+ Model3D: [
151
+ 'resource',
152
+ 'positionX', 'positionY', 'positionZ',
153
+ 'rotationX', 'rotationY', 'rotationZ',
154
+ 'scaleX', 'scaleY', 'scaleZ',
155
+ 'speed', 'animationIndex',
156
+ ],
157
+ })
158
+ ], GLBSystem);
159
+ var GLBSystem_default = GLBSystem;
160
+
161
+ exports.GLBSystem = GLBSystem_default;
162
+ exports.Model3D = Model3D;
163
+ //# sourceMappingURL=plugin-renderer-3d-model.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-renderer-3d-model.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 Model3DParams {\n resource?: string;\n autoPlay?: boolean;\n animationIndex?: number;\n speed?: 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}\n\nexport default class Model3D extends Component<Model3DParams> {\n static componentName: string = 'Model3D';\n\n @type('string') resource: string = '';\n @type('boolean') autoPlay: boolean = true;\n @type('number') animationIndex: number = 0;\n @type('number') @step(0.1) speed: number = 1;\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\n init(obj?: Model3DParams) {\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 Model3D from './component';\n\n@decorators.componentObserver({\n Model3D: [\n 'resource',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'speed', 'animationIndex',\n ],\n})\nexport default class GLBSystem extends Renderer3D {\n static systemName = 'GLBSystem';\n name: string = 'GLBSystem';\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 !== 'Model3D') return;\n\n const component = changed.component as Model3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.CHANGE) {\n this.handleChange(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.increaseAsyncId(changed.gameObject.id);\n this.threeContext.removeModel(changed.gameObject.id);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Model3D) as Model3D;\n if (!component) return;\n\n const model = this.threeContext.models.get(gameObject.id);\n if (!model) return;\n\n model.position.set(component.positionX, component.positionY, component.positionZ);\n model.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n model.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private async handleAdd(gameObject: GameObject, component: Model3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n await this.threeContext.loadGLB(gameObject.id, component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n if (component.autoPlay) {\n this.threeContext.playAnimation(\n gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Model3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.threeContext.removeModel(changed.gameObject.id);\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(changed.gameObject.id);\n await this.threeContext.loadGLB(changed.gameObject.id, component.resource);\n if (!this.validateAsyncId(changed.gameObject.id, asyncId)) return;\n\n if (component.autoPlay) {\n this.threeContext.playAnimation(\n changed.gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n\n if (changedProp === 'speed' || changedProp === 'animationIndex') {\n this.threeContext.playAnimation(\n changed.gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n}\n"],"names":["Component","__decorate","type","step","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","decorators"],"mappings":";;;;;;;AAmBc,MAAO,OAAQ,SAAQA,gBAAwB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AC,UAAU,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,SAAS,CAAC,QAAQ;gBAAE;AAEzB,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;AAC3D,YAAA,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,CAAC,QAAQ,CAAC;AAC1E,YAAA,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC;gBAAE;AAE3D,YAAA,IAAI,SAAS,CAAC,QAAQ,EAAE;AACtB,gBAAA,IAAI,CAAC,YAAY,CAAC,aAAa,CAC7B,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,KAAK,CAChB;YACH;QACF;QAEA,IAAI,WAAW,KAAK,OAAO,IAAI,WAAW,KAAK,gBAAgB,EAAE;AAC/D,YAAA,IAAI,CAAC,YAAY,CAAC,aAAa,CAC7B,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,KAAK,CAChB;QACH;IACF;;AAhFmB,SAAS,GAAAL,gBAAA,CAAA;IAT7BM,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,OAAO,EAAE;YACP,UAAU;YACV,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;AAC5B,YAAA,OAAO,EAAE,gBAAgB;AAC1B,SAAA;KACF;AACoB,CAAA,EAAA,SAAS,CAiF7B;wBAjFoB,SAAS;;;;;"}
@@ -0,0 +1 @@
1
+ "use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),i=require("@combos-fun/plugin-renderer-3d");class n extends t.Component{constructor(){super(...arguments),this.resource="",this.autoPlay=!0,this.animationIndex=0,this.speed=1,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}static{this.componentName="Model3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.type("string")],n.prototype,"resource",void 0),e.__decorate([o.type("boolean")],n.prototype,"autoPlay",void 0),e.__decorate([o.type("number")],n.prototype,"animationIndex",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"speed",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"positionX",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"positionY",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"positionZ",void 0),e.__decorate([o.type("number"),o.step(.01)],n.prototype,"rotationX",void 0),e.__decorate([o.type("number"),o.step(.01)],n.prototype,"rotationY",void 0),e.__decorate([o.type("number"),o.step(.01)],n.prototype,"rotationZ",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"scaleX",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"scaleY",void 0),e.__decorate([o.type("number"),o.step(.1)],n.prototype,"scaleZ",void 0);let s=class extends i.Renderer3D{constructor(){super(...arguments),this.name="GLBSystem"}static{this.systemName="GLBSystem"}init(){this.game.getSystem(i.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){if("Model3D"!==e.componentName)return;const o=e.component;e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,o):e.type===t.OBSERVER_TYPE.CHANGE?this.handleChange(e):e.type===t.OBSERVER_TYPE.REMOVE&&(this.increaseAsyncId(e.gameObject.id),this.threeContext.removeModel(e.gameObject.id))}rendererUpdate(e){const t=e.getComponent(n);if(!t)return;const o=this.threeContext.models.get(e.id);o&&(o.position.set(t.positionX,t.positionY,t.positionZ),o.rotation.set(t.rotationX,t.rotationY,t.rotationZ),o.scale.set(t.scaleX,t.scaleY,t.scaleZ))}async handleAdd(e,t){if(!t.resource)return;const o=this.increaseAsyncId(e.id);await this.threeContext.loadGLB(e.id,t.resource),this.validateAsyncId(e.id,o)&&t.autoPlay&&this.threeContext.playAnimation(e.id,t.animationIndex,t.speed)}async handleChange(e){const t=e.component,o=e.prop?.prop?.[0];if("resource"===o){if(this.threeContext.removeModel(e.gameObject.id),!t.resource)return;const o=this.increaseAsyncId(e.gameObject.id);if(await this.threeContext.loadGLB(e.gameObject.id,t.resource),!this.validateAsyncId(e.gameObject.id,o))return;t.autoPlay&&this.threeContext.playAnimation(e.gameObject.id,t.animationIndex,t.speed)}"speed"!==o&&"animationIndex"!==o||this.threeContext.playAnimation(e.gameObject.id,t.animationIndex,t.speed)}};s=e.__decorate([t.decorators.componentObserver({Model3D:["resource","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ","speed","animationIndex"]})],s);var r=s;exports.GLBSystem=r,exports.Model3D=n;
@@ -0,0 +1,48 @@
1
+ import { Component, ComponentChanged, GameObject } from '@combos-fun/engine';
2
+ import { Renderer3D } from '@combos-fun/plugin-renderer-3d';
3
+
4
+ interface Model3DParams {
5
+ resource?: string;
6
+ autoPlay?: boolean;
7
+ animationIndex?: number;
8
+ speed?: number;
9
+ positionX?: number;
10
+ positionY?: number;
11
+ positionZ?: number;
12
+ rotationX?: number;
13
+ rotationY?: number;
14
+ rotationZ?: number;
15
+ scaleX?: number;
16
+ scaleY?: number;
17
+ scaleZ?: number;
18
+ }
19
+ declare class Model3D extends Component<Model3DParams> {
20
+ static componentName: string;
21
+ resource: string;
22
+ autoPlay: boolean;
23
+ animationIndex: number;
24
+ speed: number;
25
+ positionX: number;
26
+ positionY: number;
27
+ positionZ: number;
28
+ rotationX: number;
29
+ rotationY: number;
30
+ rotationZ: number;
31
+ scaleX: number;
32
+ scaleY: number;
33
+ scaleZ: number;
34
+ init(obj?: Model3DParams): void;
35
+ }
36
+
37
+ declare class GLBSystem extends Renderer3D {
38
+ static systemName: string;
39
+ name: string;
40
+ init(): void;
41
+ componentChanged(changed: ComponentChanged): void;
42
+ rendererUpdate(gameObject: GameObject): void;
43
+ private handleAdd;
44
+ private handleChange;
45
+ }
46
+
47
+ export { GLBSystem, Model3D };
48
+ export type { Model3DParams };
@@ -0,0 +1,160 @@
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
+
6
+ class Model3D extends Component {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.resource = '';
10
+ this.autoPlay = true;
11
+ this.animationIndex = 0;
12
+ this.speed = 1;
13
+ this.positionX = 0;
14
+ this.positionY = 0;
15
+ this.positionZ = 0;
16
+ this.rotationX = 0;
17
+ this.rotationY = 0;
18
+ this.rotationZ = 0;
19
+ this.scaleX = 1;
20
+ this.scaleY = 1;
21
+ this.scaleZ = 1;
22
+ }
23
+ static { this.componentName = 'Model3D'; }
24
+ init(obj) {
25
+ if (obj)
26
+ Object.assign(this, obj);
27
+ }
28
+ }
29
+ __decorate([
30
+ type('string')
31
+ ], Model3D.prototype, "resource", void 0);
32
+ __decorate([
33
+ type('boolean')
34
+ ], Model3D.prototype, "autoPlay", void 0);
35
+ __decorate([
36
+ type('number')
37
+ ], Model3D.prototype, "animationIndex", void 0);
38
+ __decorate([
39
+ type('number'),
40
+ step(0.1)
41
+ ], Model3D.prototype, "speed", void 0);
42
+ __decorate([
43
+ type('number'),
44
+ step(0.1)
45
+ ], Model3D.prototype, "positionX", void 0);
46
+ __decorate([
47
+ type('number'),
48
+ step(0.1)
49
+ ], Model3D.prototype, "positionY", void 0);
50
+ __decorate([
51
+ type('number'),
52
+ step(0.1)
53
+ ], Model3D.prototype, "positionZ", void 0);
54
+ __decorate([
55
+ type('number'),
56
+ step(0.01)
57
+ ], Model3D.prototype, "rotationX", void 0);
58
+ __decorate([
59
+ type('number'),
60
+ step(0.01)
61
+ ], Model3D.prototype, "rotationY", void 0);
62
+ __decorate([
63
+ type('number'),
64
+ step(0.01)
65
+ ], Model3D.prototype, "rotationZ", void 0);
66
+ __decorate([
67
+ type('number'),
68
+ step(0.1)
69
+ ], Model3D.prototype, "scaleX", void 0);
70
+ __decorate([
71
+ type('number'),
72
+ step(0.1)
73
+ ], Model3D.prototype, "scaleY", void 0);
74
+ __decorate([
75
+ type('number'),
76
+ step(0.1)
77
+ ], Model3D.prototype, "scaleZ", void 0);
78
+
79
+ let GLBSystem = class GLBSystem extends Renderer3D {
80
+ constructor() {
81
+ super(...arguments);
82
+ this.name = 'GLBSystem';
83
+ }
84
+ static { this.systemName = 'GLBSystem'; }
85
+ init() {
86
+ const renderer3DSystem = this.game.getSystem(Renderer3DSystem);
87
+ renderer3DSystem.rendererManager.register(this);
88
+ }
89
+ componentChanged(changed) {
90
+ if (changed.componentName !== 'Model3D')
91
+ return;
92
+ const component = changed.component;
93
+ if (changed.type === OBSERVER_TYPE.ADD) {
94
+ this.handleAdd(changed.gameObject, component);
95
+ }
96
+ else if (changed.type === OBSERVER_TYPE.CHANGE) {
97
+ this.handleChange(changed);
98
+ }
99
+ else if (changed.type === OBSERVER_TYPE.REMOVE) {
100
+ this.increaseAsyncId(changed.gameObject.id);
101
+ this.threeContext.removeModel(changed.gameObject.id);
102
+ }
103
+ }
104
+ rendererUpdate(gameObject) {
105
+ const component = gameObject.getComponent(Model3D);
106
+ if (!component)
107
+ return;
108
+ const model = this.threeContext.models.get(gameObject.id);
109
+ if (!model)
110
+ return;
111
+ model.position.set(component.positionX, component.positionY, component.positionZ);
112
+ model.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
113
+ model.scale.set(component.scaleX, component.scaleY, component.scaleZ);
114
+ }
115
+ async handleAdd(gameObject, component) {
116
+ if (!component.resource)
117
+ return;
118
+ const asyncId = this.increaseAsyncId(gameObject.id);
119
+ await this.threeContext.loadGLB(gameObject.id, component.resource);
120
+ if (!this.validateAsyncId(gameObject.id, asyncId))
121
+ return;
122
+ if (component.autoPlay) {
123
+ this.threeContext.playAnimation(gameObject.id, component.animationIndex, component.speed);
124
+ }
125
+ }
126
+ async handleChange(changed) {
127
+ const component = changed.component;
128
+ const changedProp = changed.prop?.prop?.[0];
129
+ if (changedProp === 'resource') {
130
+ this.threeContext.removeModel(changed.gameObject.id);
131
+ if (!component.resource)
132
+ return;
133
+ const asyncId = this.increaseAsyncId(changed.gameObject.id);
134
+ await this.threeContext.loadGLB(changed.gameObject.id, component.resource);
135
+ if (!this.validateAsyncId(changed.gameObject.id, asyncId))
136
+ return;
137
+ if (component.autoPlay) {
138
+ this.threeContext.playAnimation(changed.gameObject.id, component.animationIndex, component.speed);
139
+ }
140
+ }
141
+ if (changedProp === 'speed' || changedProp === 'animationIndex') {
142
+ this.threeContext.playAnimation(changed.gameObject.id, component.animationIndex, component.speed);
143
+ }
144
+ }
145
+ };
146
+ GLBSystem = __decorate([
147
+ decorators.componentObserver({
148
+ Model3D: [
149
+ 'resource',
150
+ 'positionX', 'positionY', 'positionZ',
151
+ 'rotationX', 'rotationY', 'rotationZ',
152
+ 'scaleX', 'scaleY', 'scaleZ',
153
+ 'speed', 'animationIndex',
154
+ ],
155
+ })
156
+ ], GLBSystem);
157
+ var GLBSystem_default = GLBSystem;
158
+
159
+ export { GLBSystem_default as GLBSystem, Model3D };
160
+ //# sourceMappingURL=plugin-renderer-3d-model.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-renderer-3d-model.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 Model3DParams {\n resource?: string;\n autoPlay?: boolean;\n animationIndex?: number;\n speed?: 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}\n\nexport default class Model3D extends Component<Model3DParams> {\n static componentName: string = 'Model3D';\n\n @type('string') resource: string = '';\n @type('boolean') autoPlay: boolean = true;\n @type('number') animationIndex: number = 0;\n @type('number') @step(0.1) speed: number = 1;\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\n init(obj?: Model3DParams) {\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 Model3D from './component';\n\n@decorators.componentObserver({\n Model3D: [\n 'resource',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'scaleX', 'scaleY', 'scaleZ',\n 'speed', 'animationIndex',\n ],\n})\nexport default class GLBSystem extends Renderer3D {\n static systemName = 'GLBSystem';\n name: string = 'GLBSystem';\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 !== 'Model3D') return;\n\n const component = changed.component as Model3D;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, component);\n } else if (changed.type === OBSERVER_TYPE.CHANGE) {\n this.handleChange(changed);\n } else if (changed.type === OBSERVER_TYPE.REMOVE) {\n this.increaseAsyncId(changed.gameObject.id);\n this.threeContext.removeModel(changed.gameObject.id);\n }\n }\n\n rendererUpdate(gameObject: GameObject) {\n const component = gameObject.getComponent(Model3D) as Model3D;\n if (!component) return;\n\n const model = this.threeContext.models.get(gameObject.id);\n if (!model) return;\n\n model.position.set(component.positionX, component.positionY, component.positionZ);\n model.rotation.set(component.rotationX, component.rotationY, component.rotationZ);\n model.scale.set(component.scaleX, component.scaleY, component.scaleZ);\n }\n\n private async handleAdd(gameObject: GameObject, component: Model3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n await this.threeContext.loadGLB(gameObject.id, component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) return;\n\n if (component.autoPlay) {\n this.threeContext.playAnimation(\n gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n\n private async handleChange(changed: ComponentChanged) {\n const component = changed.component as Model3D;\n const changedProp = changed.prop?.prop?.[0];\n\n if (changedProp === 'resource') {\n this.threeContext.removeModel(changed.gameObject.id);\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(changed.gameObject.id);\n await this.threeContext.loadGLB(changed.gameObject.id, component.resource);\n if (!this.validateAsyncId(changed.gameObject.id, asyncId)) return;\n\n if (component.autoPlay) {\n this.threeContext.playAnimation(\n changed.gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n\n if (changedProp === 'speed' || changedProp === 'animationIndex') {\n this.threeContext.playAnimation(\n changed.gameObject.id,\n component.animationIndex,\n component.speed,\n );\n }\n }\n}\n"],"names":[],"mappings":";;;;;AAmBc,MAAO,OAAQ,SAAQ,SAAwB,CAAA;AAA7D,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACpB,IAAA,CAAA,QAAQ,GAAY,IAAI;QACzB,IAAA,CAAA,cAAc,GAAW,CAAC;QACf,IAAA,CAAA,KAAK,GAAW,CAAC;QACjB,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,S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C7B,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,KAAK,CAChB;YACH;QACF;QAEA,IAAI,WAAW,KAAK,OAAO,IAAI,WAAW,KAAK,gBAAgB,EAAE;AAC/D,YAAA,IAAI,CAAC,YAAY,CAAC,aAAa,CAC7B,OAAO,CAAC,UAAU,CAAC,EAAE,EACrB,SAAS,CAAC,cAAc,EACxB,SAAS,CAAC,KAAK,CAChB;QACH;IACF;;AAhFmB,SAAS,GAAA,UAAA,CAAA;IAT7B,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,OAAO,EAAE;YACP,UAAU;YACV,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,QAAQ,EAAE,QAAQ,EAAE,QAAQ;AAC5B,YAAA,OAAO,EAAE,gBAAgB;AAC1B,SAAA;KACF;AACoB,CAAA,EAAA,SAAS,CAiF7B;wBAjFoB,SAAS;;;;"}
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./dist/plugin-renderer-3d-model.cjs.prod.js');
5
+ } else {
6
+ module.exports = require('./dist/plugin-renderer-3d-model.cjs.js');
7
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@combos-fun/plugin-renderer-3d-model",
3
+ "version": "0.0.6",
4
+ "description": "@combos-fun/plugin-renderer-3d-model",
5
+ "main": "index.js",
6
+ "module": "dist/plugin-renderer-3d-model.esm.js",
7
+ "bundle": "CombosFun.plugin.renderer.3d.model",
8
+ "unpkg": "dist/CombosFun.plugin.renderer.3d.model.min.js",
9
+ "types": "dist/plugin-renderer-3d-model.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
+ }