@combos-fun/plugin-renderer-3d-model 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin-renderer-3d-model.cjs.js +101 -23
- package/dist/plugin-renderer-3d-model.cjs.js.map +1 -1
- package/dist/plugin-renderer-3d-model.cjs.prod.js +1 -1
- package/dist/plugin-renderer-3d-model.esm.js +102 -24
- package/dist/plugin-renderer-3d-model.esm.js.map +1 -1
- package/package.json +4 -4
|
@@ -29,53 +29,131 @@ class Model3D extends engine.Component {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
tslib.__decorate([
|
|
32
|
-
inspectorDecorator.
|
|
32
|
+
inspectorDecorator.Field({
|
|
33
|
+
type: 'string',
|
|
34
|
+
group: 'Model3D',
|
|
35
|
+
label: 'resource',
|
|
36
|
+
description: 'Resource id from the asset registry.',
|
|
37
|
+
editor: 'text',
|
|
38
|
+
})
|
|
33
39
|
], Model3D.prototype, "resource", void 0);
|
|
34
40
|
tslib.__decorate([
|
|
35
|
-
inspectorDecorator.
|
|
41
|
+
inspectorDecorator.Field({
|
|
42
|
+
type: 'boolean',
|
|
43
|
+
group: 'Model3D',
|
|
44
|
+
label: 'autoPlay',
|
|
45
|
+
description: 'Start playing automatically when loaded.',
|
|
46
|
+
editor: 'toggle',
|
|
47
|
+
})
|
|
36
48
|
], Model3D.prototype, "autoPlay", void 0);
|
|
37
49
|
tslib.__decorate([
|
|
38
|
-
inspectorDecorator.
|
|
50
|
+
inspectorDecorator.Field({
|
|
51
|
+
type: 'number',
|
|
52
|
+
group: 'Model3D',
|
|
53
|
+
label: 'animationIndex',
|
|
54
|
+
description: 'Animation clip index.',
|
|
55
|
+
editor: 'number-stepper',
|
|
56
|
+
})
|
|
39
57
|
], Model3D.prototype, "animationIndex", void 0);
|
|
40
58
|
tslib.__decorate([
|
|
41
|
-
inspectorDecorator.
|
|
42
|
-
|
|
59
|
+
inspectorDecorator.Field({
|
|
60
|
+
type: 'number',
|
|
61
|
+
step: 0.1,
|
|
62
|
+
group: 'Model3D',
|
|
63
|
+
label: 'speed',
|
|
64
|
+
description: 'Playback speed.',
|
|
65
|
+
editor: 'number-stepper',
|
|
66
|
+
})
|
|
43
67
|
], Model3D.prototype, "speed", void 0);
|
|
44
68
|
tslib.__decorate([
|
|
45
|
-
inspectorDecorator.
|
|
46
|
-
|
|
69
|
+
inspectorDecorator.Field({
|
|
70
|
+
type: 'number',
|
|
71
|
+
step: 0.1,
|
|
72
|
+
group: 'Model3D',
|
|
73
|
+
label: 'positionX',
|
|
74
|
+
description: 'Local X position.',
|
|
75
|
+
editor: 'number-stepper',
|
|
76
|
+
})
|
|
47
77
|
], Model3D.prototype, "positionX", void 0);
|
|
48
78
|
tslib.__decorate([
|
|
49
|
-
inspectorDecorator.
|
|
50
|
-
|
|
79
|
+
inspectorDecorator.Field({
|
|
80
|
+
type: 'number',
|
|
81
|
+
step: 0.1,
|
|
82
|
+
group: 'Model3D',
|
|
83
|
+
label: 'positionY',
|
|
84
|
+
description: 'Local Y position.',
|
|
85
|
+
editor: 'number-stepper',
|
|
86
|
+
})
|
|
51
87
|
], Model3D.prototype, "positionY", void 0);
|
|
52
88
|
tslib.__decorate([
|
|
53
|
-
inspectorDecorator.
|
|
54
|
-
|
|
89
|
+
inspectorDecorator.Field({
|
|
90
|
+
type: 'number',
|
|
91
|
+
step: 0.1,
|
|
92
|
+
group: 'Model3D',
|
|
93
|
+
label: 'positionZ',
|
|
94
|
+
description: 'Local Z position.',
|
|
95
|
+
editor: 'number-stepper',
|
|
96
|
+
})
|
|
55
97
|
], Model3D.prototype, "positionZ", void 0);
|
|
56
98
|
tslib.__decorate([
|
|
57
|
-
inspectorDecorator.
|
|
58
|
-
|
|
99
|
+
inspectorDecorator.Field({
|
|
100
|
+
type: 'number',
|
|
101
|
+
step: 0.01,
|
|
102
|
+
group: 'Model3D',
|
|
103
|
+
label: 'rotationX',
|
|
104
|
+
description: 'Rotation around X in radians.',
|
|
105
|
+
editor: 'number-stepper',
|
|
106
|
+
})
|
|
59
107
|
], Model3D.prototype, "rotationX", void 0);
|
|
60
108
|
tslib.__decorate([
|
|
61
|
-
inspectorDecorator.
|
|
62
|
-
|
|
109
|
+
inspectorDecorator.Field({
|
|
110
|
+
type: 'number',
|
|
111
|
+
step: 0.01,
|
|
112
|
+
group: 'Model3D',
|
|
113
|
+
label: 'rotationY',
|
|
114
|
+
description: 'Rotation around Y in radians.',
|
|
115
|
+
editor: 'number-stepper',
|
|
116
|
+
})
|
|
63
117
|
], Model3D.prototype, "rotationY", void 0);
|
|
64
118
|
tslib.__decorate([
|
|
65
|
-
inspectorDecorator.
|
|
66
|
-
|
|
119
|
+
inspectorDecorator.Field({
|
|
120
|
+
type: 'number',
|
|
121
|
+
step: 0.01,
|
|
122
|
+
group: 'Model3D',
|
|
123
|
+
label: 'rotationZ',
|
|
124
|
+
description: 'Rotation around Z in radians.',
|
|
125
|
+
editor: 'number-stepper',
|
|
126
|
+
})
|
|
67
127
|
], Model3D.prototype, "rotationZ", void 0);
|
|
68
128
|
tslib.__decorate([
|
|
69
|
-
inspectorDecorator.
|
|
70
|
-
|
|
129
|
+
inspectorDecorator.Field({
|
|
130
|
+
type: 'number',
|
|
131
|
+
step: 0.1,
|
|
132
|
+
group: 'Model3D',
|
|
133
|
+
label: 'scaleX',
|
|
134
|
+
description: 'Scale on X.',
|
|
135
|
+
editor: 'number-stepper',
|
|
136
|
+
})
|
|
71
137
|
], Model3D.prototype, "scaleX", void 0);
|
|
72
138
|
tslib.__decorate([
|
|
73
|
-
inspectorDecorator.
|
|
74
|
-
|
|
139
|
+
inspectorDecorator.Field({
|
|
140
|
+
type: 'number',
|
|
141
|
+
step: 0.1,
|
|
142
|
+
group: 'Model3D',
|
|
143
|
+
label: 'scaleY',
|
|
144
|
+
description: 'Scale on Y.',
|
|
145
|
+
editor: 'number-stepper',
|
|
146
|
+
})
|
|
75
147
|
], Model3D.prototype, "scaleY", void 0);
|
|
76
148
|
tslib.__decorate([
|
|
77
|
-
inspectorDecorator.
|
|
78
|
-
|
|
149
|
+
inspectorDecorator.Field({
|
|
150
|
+
type: 'number',
|
|
151
|
+
step: 0.1,
|
|
152
|
+
group: 'Model3D',
|
|
153
|
+
label: 'scaleZ',
|
|
154
|
+
description: 'Scale on Z.',
|
|
155
|
+
editor: 'number-stepper',
|
|
156
|
+
})
|
|
79
157
|
], Model3D.prototype, "scaleZ", void 0);
|
|
80
158
|
|
|
81
159
|
let Model3DSystem = class Model3DSystem extends pluginRenderer3d.Renderer3D {
|
|
@@ -1 +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 Model3DSystem extends Renderer3D {\n static systemName = 'Model3DSystem';\n name: string = 'Model3DSystem';\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,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,SAAS,GAAW,CAAC;QACtB,IAAA,CAAA,MAAM,GAAW,CAAC;QAClB,IAAA,CAAA,MAAM,GAAW,CAAC;QAClB,IAAA,CAAA,MAAM,GAAW,CAAC;IAK/C;aAnBS,IAAA,CAAA,aAAa,GAAW,SAAX,CAAqB;AAgBzC,IAAA,IAAI,CAAC,GAAmB,EAAA;AACtB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AAhBgBC,gBAAA,CAAA;IAAfC,uBAAI,CAAC,QAAQ;AAAwB,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AACrBD,gBAAA,CAAA;IAAhBC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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,aAAa,CAiFjC;4BAjFoB,aAAa;;;;;"}
|
|
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 { Field } 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 @Field({\n\n type: 'string',\n\n group: 'Model3D',\n\n label: 'resource',\n\n description: 'Resource id from the asset registry.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'Model3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n group: 'Model3D',\n label: 'animationIndex',\n description: 'Animation clip index.',\n editor: 'number-stepper',\n })\n animationIndex: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Model3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n 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 Model3DSystem extends Renderer3D {\n static systemName = 'Model3DSystem';\n name: string = 'Model3DSystem';\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","Field","Renderer3D","Renderer3DSystem","OBSERVER_TYPE","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AS,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,aAAa,GAAAJ,gBAAA,CAAA;IATjCK,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,aAAa,CAiFjC;4BAjFoB,aAAa;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),t=require("@combos-fun/engine"),o=require("@combos-fun/inspector-decorator"),i=require("@combos-fun/plugin-renderer-3d");class
|
|
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 r 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.Field({type:"string",group:"Model3D",label:"resource",description:"Resource id from the asset registry.",editor:"text"})],r.prototype,"resource",void 0),e.__decorate([o.Field({type:"boolean",group:"Model3D",label:"autoPlay",description:"Start playing automatically when loaded.",editor:"toggle"})],r.prototype,"autoPlay",void 0),e.__decorate([o.Field({type:"number",group:"Model3D",label:"animationIndex",description:"Animation clip index.",editor:"number-stepper"})],r.prototype,"animationIndex",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"speed",description:"Playback speed.",editor:"number-stepper"})],r.prototype,"speed",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"positionX",description:"Local X position.",editor:"number-stepper"})],r.prototype,"positionX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"positionY",description:"Local Y position.",editor:"number-stepper"})],r.prototype,"positionY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"positionZ",description:"Local Z position.",editor:"number-stepper"})],r.prototype,"positionZ",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Model3D",label:"rotationX",description:"Rotation around X in radians.",editor:"number-stepper"})],r.prototype,"rotationX",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Model3D",label:"rotationY",description:"Rotation around Y in radians.",editor:"number-stepper"})],r.prototype,"rotationY",void 0),e.__decorate([o.Field({type:"number",step:.01,group:"Model3D",label:"rotationZ",description:"Rotation around Z in radians.",editor:"number-stepper"})],r.prototype,"rotationZ",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"scaleX",description:"Scale on X.",editor:"number-stepper"})],r.prototype,"scaleX",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"scaleY",description:"Scale on Y.",editor:"number-stepper"})],r.prototype,"scaleY",void 0),e.__decorate([o.Field({type:"number",step:.1,group:"Model3D",label:"scaleZ",description:"Scale on Z.",editor:"number-stepper"})],r.prototype,"scaleZ",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="Model3DSystem"}static{this.systemName="Model3DSystem"}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(r);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)}};n=e.__decorate([t.decorators.componentObserver({Model3D:["resource","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","scaleX","scaleY","scaleZ","speed","animationIndex"]})],n);var s=n;exports.Model3D=r,exports.Model3DSystem=s;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { Component, OBSERVER_TYPE, decorators } from '@combos-fun/engine';
|
|
3
|
-
import {
|
|
3
|
+
import { Field } from '@combos-fun/inspector-decorator';
|
|
4
4
|
import { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';
|
|
5
5
|
|
|
6
6
|
class Model3D extends Component {
|
|
@@ -27,53 +27,131 @@ class Model3D extends Component {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
__decorate([
|
|
30
|
-
|
|
30
|
+
Field({
|
|
31
|
+
type: 'string',
|
|
32
|
+
group: 'Model3D',
|
|
33
|
+
label: 'resource',
|
|
34
|
+
description: 'Resource id from the asset registry.',
|
|
35
|
+
editor: 'text',
|
|
36
|
+
})
|
|
31
37
|
], Model3D.prototype, "resource", void 0);
|
|
32
38
|
__decorate([
|
|
33
|
-
|
|
39
|
+
Field({
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
group: 'Model3D',
|
|
42
|
+
label: 'autoPlay',
|
|
43
|
+
description: 'Start playing automatically when loaded.',
|
|
44
|
+
editor: 'toggle',
|
|
45
|
+
})
|
|
34
46
|
], Model3D.prototype, "autoPlay", void 0);
|
|
35
47
|
__decorate([
|
|
36
|
-
|
|
48
|
+
Field({
|
|
49
|
+
type: 'number',
|
|
50
|
+
group: 'Model3D',
|
|
51
|
+
label: 'animationIndex',
|
|
52
|
+
description: 'Animation clip index.',
|
|
53
|
+
editor: 'number-stepper',
|
|
54
|
+
})
|
|
37
55
|
], Model3D.prototype, "animationIndex", void 0);
|
|
38
56
|
__decorate([
|
|
39
|
-
|
|
40
|
-
|
|
57
|
+
Field({
|
|
58
|
+
type: 'number',
|
|
59
|
+
step: 0.1,
|
|
60
|
+
group: 'Model3D',
|
|
61
|
+
label: 'speed',
|
|
62
|
+
description: 'Playback speed.',
|
|
63
|
+
editor: 'number-stepper',
|
|
64
|
+
})
|
|
41
65
|
], Model3D.prototype, "speed", void 0);
|
|
42
66
|
__decorate([
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
Field({
|
|
68
|
+
type: 'number',
|
|
69
|
+
step: 0.1,
|
|
70
|
+
group: 'Model3D',
|
|
71
|
+
label: 'positionX',
|
|
72
|
+
description: 'Local X position.',
|
|
73
|
+
editor: 'number-stepper',
|
|
74
|
+
})
|
|
45
75
|
], Model3D.prototype, "positionX", void 0);
|
|
46
76
|
__decorate([
|
|
47
|
-
|
|
48
|
-
|
|
77
|
+
Field({
|
|
78
|
+
type: 'number',
|
|
79
|
+
step: 0.1,
|
|
80
|
+
group: 'Model3D',
|
|
81
|
+
label: 'positionY',
|
|
82
|
+
description: 'Local Y position.',
|
|
83
|
+
editor: 'number-stepper',
|
|
84
|
+
})
|
|
49
85
|
], Model3D.prototype, "positionY", void 0);
|
|
50
86
|
__decorate([
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
Field({
|
|
88
|
+
type: 'number',
|
|
89
|
+
step: 0.1,
|
|
90
|
+
group: 'Model3D',
|
|
91
|
+
label: 'positionZ',
|
|
92
|
+
description: 'Local Z position.',
|
|
93
|
+
editor: 'number-stepper',
|
|
94
|
+
})
|
|
53
95
|
], Model3D.prototype, "positionZ", void 0);
|
|
54
96
|
__decorate([
|
|
55
|
-
|
|
56
|
-
|
|
97
|
+
Field({
|
|
98
|
+
type: 'number',
|
|
99
|
+
step: 0.01,
|
|
100
|
+
group: 'Model3D',
|
|
101
|
+
label: 'rotationX',
|
|
102
|
+
description: 'Rotation around X in radians.',
|
|
103
|
+
editor: 'number-stepper',
|
|
104
|
+
})
|
|
57
105
|
], Model3D.prototype, "rotationX", void 0);
|
|
58
106
|
__decorate([
|
|
59
|
-
|
|
60
|
-
|
|
107
|
+
Field({
|
|
108
|
+
type: 'number',
|
|
109
|
+
step: 0.01,
|
|
110
|
+
group: 'Model3D',
|
|
111
|
+
label: 'rotationY',
|
|
112
|
+
description: 'Rotation around Y in radians.',
|
|
113
|
+
editor: 'number-stepper',
|
|
114
|
+
})
|
|
61
115
|
], Model3D.prototype, "rotationY", void 0);
|
|
62
116
|
__decorate([
|
|
63
|
-
|
|
64
|
-
|
|
117
|
+
Field({
|
|
118
|
+
type: 'number',
|
|
119
|
+
step: 0.01,
|
|
120
|
+
group: 'Model3D',
|
|
121
|
+
label: 'rotationZ',
|
|
122
|
+
description: 'Rotation around Z in radians.',
|
|
123
|
+
editor: 'number-stepper',
|
|
124
|
+
})
|
|
65
125
|
], Model3D.prototype, "rotationZ", void 0);
|
|
66
126
|
__decorate([
|
|
67
|
-
|
|
68
|
-
|
|
127
|
+
Field({
|
|
128
|
+
type: 'number',
|
|
129
|
+
step: 0.1,
|
|
130
|
+
group: 'Model3D',
|
|
131
|
+
label: 'scaleX',
|
|
132
|
+
description: 'Scale on X.',
|
|
133
|
+
editor: 'number-stepper',
|
|
134
|
+
})
|
|
69
135
|
], Model3D.prototype, "scaleX", void 0);
|
|
70
136
|
__decorate([
|
|
71
|
-
|
|
72
|
-
|
|
137
|
+
Field({
|
|
138
|
+
type: 'number',
|
|
139
|
+
step: 0.1,
|
|
140
|
+
group: 'Model3D',
|
|
141
|
+
label: 'scaleY',
|
|
142
|
+
description: 'Scale on Y.',
|
|
143
|
+
editor: 'number-stepper',
|
|
144
|
+
})
|
|
73
145
|
], Model3D.prototype, "scaleY", void 0);
|
|
74
146
|
__decorate([
|
|
75
|
-
|
|
76
|
-
|
|
147
|
+
Field({
|
|
148
|
+
type: 'number',
|
|
149
|
+
step: 0.1,
|
|
150
|
+
group: 'Model3D',
|
|
151
|
+
label: 'scaleZ',
|
|
152
|
+
description: 'Scale on Z.',
|
|
153
|
+
editor: 'number-stepper',
|
|
154
|
+
})
|
|
77
155
|
], Model3D.prototype, "scaleZ", void 0);
|
|
78
156
|
|
|
79
157
|
let Model3DSystem = class Model3DSystem extends Renderer3D {
|
|
@@ -1 +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 Model3DSystem extends Renderer3D {\n static systemName = 'Model3DSystem';\n name: string = 'Model3DSystem';\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,SAAS,GAAW,CAAC;QACtB,IAA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AAC,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,aAAa,GAAA,UAAA,CAAA;IATjC,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,aAAa,CAiFjC;4BAjFoB,aAAa;;;;"}
|
|
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 { Field } 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 @Field({\n\n type: 'string',\n\n group: 'Model3D',\n\n label: 'resource',\n\n description: 'Resource id from the asset registry.',\n\n editor: 'text',\n\n })\n\n resource: string = '';\n @Field({\n type: 'boolean',\n group: 'Model3D',\n label: 'autoPlay',\n description: 'Start playing automatically when loaded.',\n editor: 'toggle',\n })\n autoPlay: boolean = true;\n @Field({\n type: 'number',\n group: 'Model3D',\n label: 'animationIndex',\n description: 'Animation clip index.',\n editor: 'number-stepper',\n })\n animationIndex: number = 0;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Model3D',\n label: 'speed',\n description: 'Playback speed.',\n editor: 'number-stepper',\n })\n speed: number = 1;\n @Field({\n type: 'number',\n step: 0.1,\n group: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\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: 'Model3D',\n label: 'scaleZ',\n description: 'Scale on Z.',\n editor: 'number-stepper',\n })\n 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 Model3DSystem extends Renderer3D {\n static systemName = 'Model3DSystem';\n name: string = 'Model3DSystem';\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;;QAiBE,IAAA,CAAA,QAAQ,GAAW,EAAE;QAQrB,IAAA,CAAA,QAAQ,GAAY,IAAI;QAQxB,IAAA,CAAA,cAAc,GAAW,CAAC;QAS1B,IAAA,CAAA,KAAK,GAAW,CAAC;QASjB,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;IAKpB;aA/HS,IAAA,CAAA,aAAa,GAAW,SAAX,CAAqB;AA4HzC,IAAA,IAAI,CAAC,GAAmB,EAAA;AACtB,QAAA,IAAI,GAAG;AAAE,YAAA,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC;IACnC;;AA9GA,UAAA,CAAA;AAdC,IAAA,KAAK,CAAC;AAEL,QAAA,IAAI,EAAE,QAAQ;AAEd,QAAA,KAAK,EAAE,SAAS;AAEhB,QAAA,KAAK,EAAE,UAAU;AAEjB,QAAA,WAAW,EAAE,sCAAsC;AAEnD,QAAA,MAAM,EAAE,MAAM;KAEf;AAEqB,C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AO,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,aAAa,GAAA,UAAA,CAAA;IATjC,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,aAAa,CAiFjC;4BAjFoB,aAAa;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-3d-model",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "GLB / GLTF 3D model loader and animator",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-3d-model.esm.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"three": "^0.172.0",
|
|
30
|
-
"@combos-fun/engine": "0.0.
|
|
31
|
-
"@combos-fun/
|
|
32
|
-
"@combos-fun/
|
|
30
|
+
"@combos-fun/engine": "0.0.35",
|
|
31
|
+
"@combos-fun/plugin-renderer-3d": "0.0.35",
|
|
32
|
+
"@combos-fun/inspector-decorator": "0.0.35"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"combos-fun",
|