@combos-fun/plugin-renderer-3d-tiling-sprite 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.
- package/dist/plugin-renderer-3d-tiling-sprite.cjs.js +199 -0
- package/dist/plugin-renderer-3d-tiling-sprite.cjs.js.map +1 -0
- package/dist/plugin-renderer-3d-tiling-sprite.cjs.prod.js +1 -0
- package/dist/plugin-renderer-3d-tiling-sprite.d.ts +51 -0
- package/dist/plugin-renderer-3d-tiling-sprite.esm.js +196 -0
- package/dist/plugin-renderer-3d-tiling-sprite.esm.js.map +1 -0
- package/index.js +7 -0
- package/package.json +23 -0
|
@@ -0,0 +1,199 @@
|
|
|
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 TilingSprite3D extends engine.Component {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.resource = '';
|
|
13
|
+
this.repeatX = 1;
|
|
14
|
+
this.repeatY = 1;
|
|
15
|
+
this.width = 10;
|
|
16
|
+
this.height = 10;
|
|
17
|
+
this.positionX = 0;
|
|
18
|
+
this.positionY = 0;
|
|
19
|
+
this.positionZ = 0;
|
|
20
|
+
this.rotationX = 0;
|
|
21
|
+
this.rotationY = 0;
|
|
22
|
+
this.rotationZ = 0;
|
|
23
|
+
this.opacity = 1;
|
|
24
|
+
}
|
|
25
|
+
static { this.componentName = 'TilingSprite3D'; }
|
|
26
|
+
init(obj) {
|
|
27
|
+
if (obj)
|
|
28
|
+
Object.assign(this, obj);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
tslib.__decorate([
|
|
32
|
+
inspectorDecorator.type('string')
|
|
33
|
+
], TilingSprite3D.prototype, "resource", void 0);
|
|
34
|
+
tslib.__decorate([
|
|
35
|
+
inspectorDecorator.type('number'),
|
|
36
|
+
inspectorDecorator.step(0.1)
|
|
37
|
+
], TilingSprite3D.prototype, "repeatX", void 0);
|
|
38
|
+
tslib.__decorate([
|
|
39
|
+
inspectorDecorator.type('number'),
|
|
40
|
+
inspectorDecorator.step(0.1)
|
|
41
|
+
], TilingSprite3D.prototype, "repeatY", void 0);
|
|
42
|
+
tslib.__decorate([
|
|
43
|
+
inspectorDecorator.type('number'),
|
|
44
|
+
inspectorDecorator.step(0.1)
|
|
45
|
+
], TilingSprite3D.prototype, "width", void 0);
|
|
46
|
+
tslib.__decorate([
|
|
47
|
+
inspectorDecorator.type('number'),
|
|
48
|
+
inspectorDecorator.step(0.1)
|
|
49
|
+
], TilingSprite3D.prototype, "height", void 0);
|
|
50
|
+
tslib.__decorate([
|
|
51
|
+
inspectorDecorator.type('number'),
|
|
52
|
+
inspectorDecorator.step(0.1)
|
|
53
|
+
], TilingSprite3D.prototype, "positionX", void 0);
|
|
54
|
+
tslib.__decorate([
|
|
55
|
+
inspectorDecorator.type('number'),
|
|
56
|
+
inspectorDecorator.step(0.1)
|
|
57
|
+
], TilingSprite3D.prototype, "positionY", void 0);
|
|
58
|
+
tslib.__decorate([
|
|
59
|
+
inspectorDecorator.type('number'),
|
|
60
|
+
inspectorDecorator.step(0.1)
|
|
61
|
+
], TilingSprite3D.prototype, "positionZ", void 0);
|
|
62
|
+
tslib.__decorate([
|
|
63
|
+
inspectorDecorator.type('number'),
|
|
64
|
+
inspectorDecorator.step(0.01)
|
|
65
|
+
], TilingSprite3D.prototype, "rotationX", void 0);
|
|
66
|
+
tslib.__decorate([
|
|
67
|
+
inspectorDecorator.type('number'),
|
|
68
|
+
inspectorDecorator.step(0.01)
|
|
69
|
+
], TilingSprite3D.prototype, "rotationY", void 0);
|
|
70
|
+
tslib.__decorate([
|
|
71
|
+
inspectorDecorator.type('number'),
|
|
72
|
+
inspectorDecorator.step(0.01)
|
|
73
|
+
], TilingSprite3D.prototype, "rotationZ", void 0);
|
|
74
|
+
tslib.__decorate([
|
|
75
|
+
inspectorDecorator.type('number'),
|
|
76
|
+
inspectorDecorator.step(0.01)
|
|
77
|
+
], TilingSprite3D.prototype, "opacity", void 0);
|
|
78
|
+
|
|
79
|
+
let TilingSprite3DSystem = class TilingSprite3DSystem extends pluginRenderer3d.Renderer3D {
|
|
80
|
+
constructor() {
|
|
81
|
+
super(...arguments);
|
|
82
|
+
this.name = 'TilingSprite3DSystem';
|
|
83
|
+
this.entries = new Map();
|
|
84
|
+
this.textureLoader = new three.TextureLoader();
|
|
85
|
+
}
|
|
86
|
+
static { this.systemName = 'TilingSprite3DSystem'; }
|
|
87
|
+
init() {
|
|
88
|
+
const renderer3DSystem = this.game.getSystem(pluginRenderer3d.Renderer3DSystem);
|
|
89
|
+
renderer3DSystem.rendererManager.register(this);
|
|
90
|
+
}
|
|
91
|
+
componentChanged(changed) {
|
|
92
|
+
if (changed.componentName !== 'TilingSprite3D')
|
|
93
|
+
return;
|
|
94
|
+
if (changed.type === engine.OBSERVER_TYPE.ADD) {
|
|
95
|
+
this.handleAdd(changed.gameObject, changed.component);
|
|
96
|
+
}
|
|
97
|
+
else if (changed.type === engine.OBSERVER_TYPE.REMOVE) {
|
|
98
|
+
this.handleRemove(changed.gameObject.id);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.handleChange(changed);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
rendererUpdate(gameObject) {
|
|
105
|
+
const component = gameObject.getComponent(TilingSprite3D);
|
|
106
|
+
if (!component)
|
|
107
|
+
return;
|
|
108
|
+
const entry = this.entries.get(gameObject.id);
|
|
109
|
+
if (!entry)
|
|
110
|
+
return;
|
|
111
|
+
entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
|
|
112
|
+
entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
113
|
+
}
|
|
114
|
+
async handleAdd(gameObject, component) {
|
|
115
|
+
if (!component.resource)
|
|
116
|
+
return;
|
|
117
|
+
const asyncId = this.increaseAsyncId(gameObject.id);
|
|
118
|
+
const texture = await this.loadTexture(component.resource);
|
|
119
|
+
if (!this.validateAsyncId(gameObject.id, asyncId)) {
|
|
120
|
+
texture.dispose();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
texture.wrapS = three.RepeatWrapping;
|
|
124
|
+
texture.wrapT = three.RepeatWrapping;
|
|
125
|
+
texture.repeat.set(component.repeatX, component.repeatY);
|
|
126
|
+
const geometry = new three.PlaneGeometry(component.width, component.height);
|
|
127
|
+
const material = new three.MeshBasicMaterial({
|
|
128
|
+
map: texture,
|
|
129
|
+
transparent: component.opacity < 1,
|
|
130
|
+
opacity: component.opacity,
|
|
131
|
+
});
|
|
132
|
+
const mesh = new three.Mesh(geometry, material);
|
|
133
|
+
mesh.position.set(component.positionX, component.positionY, component.positionZ);
|
|
134
|
+
mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
135
|
+
this.threeContext.scene.add(mesh);
|
|
136
|
+
this.entries.set(gameObject.id, { mesh, texture });
|
|
137
|
+
}
|
|
138
|
+
handleChange(changed) {
|
|
139
|
+
const component = changed.component;
|
|
140
|
+
const changedProp = changed.prop?.prop?.[0];
|
|
141
|
+
const entry = this.entries.get(changed.gameObject.id);
|
|
142
|
+
if (changedProp === 'resource') {
|
|
143
|
+
this.handleRemove(changed.gameObject.id);
|
|
144
|
+
this.handleAdd(changed.gameObject, component);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (!entry)
|
|
148
|
+
return;
|
|
149
|
+
if (changedProp === 'repeatX' || changedProp === 'repeatY') {
|
|
150
|
+
entry.texture.repeat.set(component.repeatX, component.repeatY);
|
|
151
|
+
}
|
|
152
|
+
if (changedProp === 'width' || changedProp === 'height') {
|
|
153
|
+
entry.mesh.geometry.dispose();
|
|
154
|
+
entry.mesh.geometry = new three.PlaneGeometry(component.width, component.height);
|
|
155
|
+
}
|
|
156
|
+
if (changedProp === 'opacity') {
|
|
157
|
+
const material = entry.mesh.material;
|
|
158
|
+
material.opacity = component.opacity;
|
|
159
|
+
material.transparent = component.opacity < 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
handleRemove(id) {
|
|
163
|
+
this.increaseAsyncId(id);
|
|
164
|
+
const entry = this.entries.get(id);
|
|
165
|
+
if (!entry)
|
|
166
|
+
return;
|
|
167
|
+
this.threeContext.scene.remove(entry.mesh);
|
|
168
|
+
entry.mesh.geometry.dispose();
|
|
169
|
+
entry.mesh.material.dispose();
|
|
170
|
+
entry.texture.dispose();
|
|
171
|
+
this.entries.delete(id);
|
|
172
|
+
}
|
|
173
|
+
loadTexture(url) {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
this.textureLoader.load(url, resolve, undefined, reject);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
onDestroy() {
|
|
179
|
+
for (const [id] of this.entries) {
|
|
180
|
+
this.handleRemove(id);
|
|
181
|
+
}
|
|
182
|
+
this.entries.clear();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
TilingSprite3DSystem = tslib.__decorate([
|
|
186
|
+
engine.decorators.componentObserver({
|
|
187
|
+
TilingSprite3D: [
|
|
188
|
+
'resource', 'repeatX', 'repeatY', 'width', 'height',
|
|
189
|
+
'positionX', 'positionY', 'positionZ',
|
|
190
|
+
'rotationX', 'rotationY', 'rotationZ',
|
|
191
|
+
'opacity',
|
|
192
|
+
],
|
|
193
|
+
})
|
|
194
|
+
], TilingSprite3DSystem);
|
|
195
|
+
var TilingSprite3DSystem_default = TilingSprite3DSystem;
|
|
196
|
+
|
|
197
|
+
exports.TilingSprite3D = TilingSprite3D;
|
|
198
|
+
exports.TilingSprite3DSystem = TilingSprite3DSystem_default;
|
|
199
|
+
//# sourceMappingURL=plugin-renderer-3d-tiling-sprite.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-renderer-3d-tiling-sprite.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 TilingSprite3DParams {\n resource?: string;\n repeatX?: number;\n repeatY?: number;\n width?: number;\n height?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n opacity?: number;\n}\n\nexport default class TilingSprite3D extends Component<TilingSprite3DParams> {\n static componentName: string = 'TilingSprite3D';\n\n @type('string') resource: string = '';\n @type('number') @step(0.1) repeatX: number = 1;\n @type('number') @step(0.1) repeatY: number = 1;\n @type('number') @step(0.1) width: number = 10;\n @type('number') @step(0.1) height: number = 10;\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.01) opacity: number = 1;\n\n init(obj?: TilingSprite3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';\nimport {\n TextureLoader,\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n RepeatWrapping,\n} from 'three';\nimport type { Texture } from 'three';\nimport TilingSprite3D from './component';\n\ninterface TilingSprite3DEntry {\n mesh: Mesh;\n texture: Texture;\n}\n\n@decorators.componentObserver({\n TilingSprite3D: [\n 'resource', 'repeatX', 'repeatY', 'width', 'height',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'opacity',\n ],\n})\nexport default class TilingSprite3DSystem extends Renderer3D {\n static systemName = 'TilingSprite3DSystem';\n name: string = 'TilingSprite3DSystem';\n\n private entries: Map<number, TilingSprite3DEntry> = new Map();\n private textureLoader = new TextureLoader();\n\n init() {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'TilingSprite3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as TilingSprite3D);\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(TilingSprite3D) as TilingSprite3D;\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 }\n\n private async handleAdd(gameObject: GameObject, component: TilingSprite3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await this.loadTexture(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n texture.wrapS = RepeatWrapping;\n texture.wrapT = RepeatWrapping;\n texture.repeat.set(component.repeatX, component.repeatY);\n\n const geometry = new PlaneGeometry(component.width, component.height);\n const material = new MeshBasicMaterial({\n map: texture,\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\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh, texture });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as TilingSprite3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n if (changedProp === 'repeatX' || changedProp === 'repeatY') {\n entry.texture.repeat.set(component.repeatX, component.repeatY);\n }\n\n if (changedProp === 'width' || changedProp === 'height') {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = new PlaneGeometry(component.width, component.height);\n }\n\n if (changedProp === 'opacity') {\n const material = entry.mesh.material as MeshBasicMaterial;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\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 MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private loadTexture(url: string): Promise<Texture> {\n return new Promise((resolve, reject) => {\n this.textureLoader.load(url, resolve, undefined, reject);\n });\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":["Component","__decorate","type","step","Renderer3D","TextureLoader","Renderer3DSystem","OBSERVER_TYPE","RepeatWrapping","PlaneGeometry","MeshBasicMaterial","Mesh","decorators"],"mappings":";;;;;;;;AAkBc,MAAO,cAAe,SAAQA,gBAA+B,CAAA;AAA3E,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACV,IAAA,CAAA,OAAO,GAAW,CAAC;QACnB,IAAA,CAAA,OAAO,GAAW,CAAC;QACnB,IAAA,CAAA,KAAK,GAAW,EAAE;QAClB,IAAA,CAAA,MAAM,GAAW,EAAE;QACnB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACpB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA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CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;AAC1C,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAA,KAAK,CAAC,IAAI,CAAC,QAA8B,CAAC,OAAO,EAAE;AACpD,QAAA,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB;AAEQ,IAAA,WAAW,CAAC,GAAW,EAAA;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;AAC1D,QAAA,CAAC,CAAC;IACJ;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AApHmB,oBAAoB,GAAAR,gBAAA,CAAA;IARxCW,iBAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,cAAc,EAAE;AACd,YAAA,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ;YACnD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,oBAAoB,CAqHxC;mCArHoB,oBAAoB;;;;;"}
|
|
@@ -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"),r=require("three");class s extends t.Component{constructor(){super(...arguments),this.resource="",this.repeatX=1,this.repeatY=1,this.width=10,this.height=10,this.positionX=0,this.positionY=0,this.positionZ=0,this.rotationX=0,this.rotationY=0,this.rotationZ=0,this.opacity=1}static{this.componentName="TilingSprite3D"}init(e){e&&Object.assign(this,e)}}e.__decorate([o.type("string")],s.prototype,"resource",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"repeatX",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"repeatY",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"width",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"height",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"positionX",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"positionY",void 0),e.__decorate([o.type("number"),o.step(.1)],s.prototype,"positionZ",void 0),e.__decorate([o.type("number"),o.step(.01)],s.prototype,"rotationX",void 0),e.__decorate([o.type("number"),o.step(.01)],s.prototype,"rotationY",void 0),e.__decorate([o.type("number"),o.step(.01)],s.prototype,"rotationZ",void 0),e.__decorate([o.type("number"),o.step(.01)],s.prototype,"opacity",void 0);let n=class extends i.Renderer3D{constructor(){super(...arguments),this.name="TilingSprite3DSystem",this.entries=new Map,this.textureLoader=new r.TextureLoader}static{this.systemName="TilingSprite3DSystem"}init(){this.game.getSystem(i.Renderer3DSystem).rendererManager.register(this)}componentChanged(e){"TilingSprite3D"===e.componentName&&(e.type===t.OBSERVER_TYPE.ADD?this.handleAdd(e.gameObject,e.component):e.type===t.OBSERVER_TYPE.REMOVE?this.handleRemove(e.gameObject.id):this.handleChange(e))}rendererUpdate(e){const t=e.getComponent(s);if(!t)return;const o=this.entries.get(e.id);o&&(o.mesh.position.set(t.positionX,t.positionY,t.positionZ),o.mesh.rotation.set(t.rotationX,t.rotationY,t.rotationZ))}async handleAdd(e,t){if(!t.resource)return;const o=this.increaseAsyncId(e.id),i=await this.loadTexture(t.resource);if(!this.validateAsyncId(e.id,o))return void i.dispose();i.wrapS=r.RepeatWrapping,i.wrapT=r.RepeatWrapping,i.repeat.set(t.repeatX,t.repeatY);const s=new r.PlaneGeometry(t.width,t.height),n=new r.MeshBasicMaterial({map:i,transparent:t.opacity<1,opacity:t.opacity}),p=new r.Mesh(s,n);p.position.set(t.positionX,t.positionY,t.positionZ),p.rotation.set(t.rotationX,t.rotationY,t.rotationZ),this.threeContext.scene.add(p),this.entries.set(e.id,{mesh:p,texture:i})}handleChange(e){const t=e.component,o=e.prop?.prop?.[0],i=this.entries.get(e.gameObject.id);if("resource"===o)return this.handleRemove(e.gameObject.id),void this.handleAdd(e.gameObject,t);if(i&&("repeatX"!==o&&"repeatY"!==o||i.texture.repeat.set(t.repeatX,t.repeatY),"width"!==o&&"height"!==o||(i.mesh.geometry.dispose(),i.mesh.geometry=new r.PlaneGeometry(t.width,t.height)),"opacity"===o)){const e=i.mesh.material;e.opacity=t.opacity,e.transparent=t.opacity<1}}handleRemove(e){this.increaseAsyncId(e);const t=this.entries.get(e);t&&(this.threeContext.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose(),t.texture.dispose(),this.entries.delete(e))}loadTexture(e){return new Promise((t,o)=>{this.textureLoader.load(e,t,void 0,o)})}onDestroy(){for(const[e]of this.entries)this.handleRemove(e);this.entries.clear()}};n=e.__decorate([t.decorators.componentObserver({TilingSprite3D:["resource","repeatX","repeatY","width","height","positionX","positionY","positionZ","rotationX","rotationY","rotationZ","opacity"]})],n);var p=n;exports.TilingSprite3D=s,exports.TilingSprite3DSystem=p;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Component, ComponentChanged, GameObject } from '@combos-fun/engine';
|
|
2
|
+
import { Renderer3D } from '@combos-fun/plugin-renderer-3d';
|
|
3
|
+
|
|
4
|
+
interface TilingSprite3DParams {
|
|
5
|
+
resource?: string;
|
|
6
|
+
repeatX?: number;
|
|
7
|
+
repeatY?: number;
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
positionX?: number;
|
|
11
|
+
positionY?: number;
|
|
12
|
+
positionZ?: number;
|
|
13
|
+
rotationX?: number;
|
|
14
|
+
rotationY?: number;
|
|
15
|
+
rotationZ?: number;
|
|
16
|
+
opacity?: number;
|
|
17
|
+
}
|
|
18
|
+
declare class TilingSprite3D extends Component<TilingSprite3DParams> {
|
|
19
|
+
static componentName: string;
|
|
20
|
+
resource: string;
|
|
21
|
+
repeatX: number;
|
|
22
|
+
repeatY: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
positionX: number;
|
|
26
|
+
positionY: number;
|
|
27
|
+
positionZ: number;
|
|
28
|
+
rotationX: number;
|
|
29
|
+
rotationY: number;
|
|
30
|
+
rotationZ: number;
|
|
31
|
+
opacity: number;
|
|
32
|
+
init(obj?: TilingSprite3DParams): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class TilingSprite3DSystem extends Renderer3D {
|
|
36
|
+
static systemName: string;
|
|
37
|
+
name: string;
|
|
38
|
+
private entries;
|
|
39
|
+
private textureLoader;
|
|
40
|
+
init(): void;
|
|
41
|
+
componentChanged(changed: ComponentChanged): void;
|
|
42
|
+
rendererUpdate(gameObject: GameObject): void;
|
|
43
|
+
private handleAdd;
|
|
44
|
+
private handleChange;
|
|
45
|
+
private handleRemove;
|
|
46
|
+
private loadTexture;
|
|
47
|
+
onDestroy(): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { TilingSprite3D, TilingSprite3DSystem };
|
|
51
|
+
export type { TilingSprite3DParams };
|
|
@@ -0,0 +1,196 @@
|
|
|
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 { TextureLoader, RepeatWrapping, PlaneGeometry, MeshBasicMaterial, Mesh } from 'three';
|
|
6
|
+
|
|
7
|
+
class TilingSprite3D extends Component {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.resource = '';
|
|
11
|
+
this.repeatX = 1;
|
|
12
|
+
this.repeatY = 1;
|
|
13
|
+
this.width = 10;
|
|
14
|
+
this.height = 10;
|
|
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.opacity = 1;
|
|
22
|
+
}
|
|
23
|
+
static { this.componentName = 'TilingSprite3D'; }
|
|
24
|
+
init(obj) {
|
|
25
|
+
if (obj)
|
|
26
|
+
Object.assign(this, obj);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
__decorate([
|
|
30
|
+
type('string')
|
|
31
|
+
], TilingSprite3D.prototype, "resource", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
type('number'),
|
|
34
|
+
step(0.1)
|
|
35
|
+
], TilingSprite3D.prototype, "repeatX", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
type('number'),
|
|
38
|
+
step(0.1)
|
|
39
|
+
], TilingSprite3D.prototype, "repeatY", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
type('number'),
|
|
42
|
+
step(0.1)
|
|
43
|
+
], TilingSprite3D.prototype, "width", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
type('number'),
|
|
46
|
+
step(0.1)
|
|
47
|
+
], TilingSprite3D.prototype, "height", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
type('number'),
|
|
50
|
+
step(0.1)
|
|
51
|
+
], TilingSprite3D.prototype, "positionX", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
type('number'),
|
|
54
|
+
step(0.1)
|
|
55
|
+
], TilingSprite3D.prototype, "positionY", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
type('number'),
|
|
58
|
+
step(0.1)
|
|
59
|
+
], TilingSprite3D.prototype, "positionZ", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
type('number'),
|
|
62
|
+
step(0.01)
|
|
63
|
+
], TilingSprite3D.prototype, "rotationX", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
type('number'),
|
|
66
|
+
step(0.01)
|
|
67
|
+
], TilingSprite3D.prototype, "rotationY", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
type('number'),
|
|
70
|
+
step(0.01)
|
|
71
|
+
], TilingSprite3D.prototype, "rotationZ", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
type('number'),
|
|
74
|
+
step(0.01)
|
|
75
|
+
], TilingSprite3D.prototype, "opacity", void 0);
|
|
76
|
+
|
|
77
|
+
let TilingSprite3DSystem = class TilingSprite3DSystem extends Renderer3D {
|
|
78
|
+
constructor() {
|
|
79
|
+
super(...arguments);
|
|
80
|
+
this.name = 'TilingSprite3DSystem';
|
|
81
|
+
this.entries = new Map();
|
|
82
|
+
this.textureLoader = new TextureLoader();
|
|
83
|
+
}
|
|
84
|
+
static { this.systemName = 'TilingSprite3DSystem'; }
|
|
85
|
+
init() {
|
|
86
|
+
const renderer3DSystem = this.game.getSystem(Renderer3DSystem);
|
|
87
|
+
renderer3DSystem.rendererManager.register(this);
|
|
88
|
+
}
|
|
89
|
+
componentChanged(changed) {
|
|
90
|
+
if (changed.componentName !== 'TilingSprite3D')
|
|
91
|
+
return;
|
|
92
|
+
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
93
|
+
this.handleAdd(changed.gameObject, changed.component);
|
|
94
|
+
}
|
|
95
|
+
else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
96
|
+
this.handleRemove(changed.gameObject.id);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
this.handleChange(changed);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
rendererUpdate(gameObject) {
|
|
103
|
+
const component = gameObject.getComponent(TilingSprite3D);
|
|
104
|
+
if (!component)
|
|
105
|
+
return;
|
|
106
|
+
const entry = this.entries.get(gameObject.id);
|
|
107
|
+
if (!entry)
|
|
108
|
+
return;
|
|
109
|
+
entry.mesh.position.set(component.positionX, component.positionY, component.positionZ);
|
|
110
|
+
entry.mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
111
|
+
}
|
|
112
|
+
async handleAdd(gameObject, component) {
|
|
113
|
+
if (!component.resource)
|
|
114
|
+
return;
|
|
115
|
+
const asyncId = this.increaseAsyncId(gameObject.id);
|
|
116
|
+
const texture = await this.loadTexture(component.resource);
|
|
117
|
+
if (!this.validateAsyncId(gameObject.id, asyncId)) {
|
|
118
|
+
texture.dispose();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
texture.wrapS = RepeatWrapping;
|
|
122
|
+
texture.wrapT = RepeatWrapping;
|
|
123
|
+
texture.repeat.set(component.repeatX, component.repeatY);
|
|
124
|
+
const geometry = new PlaneGeometry(component.width, component.height);
|
|
125
|
+
const material = new MeshBasicMaterial({
|
|
126
|
+
map: texture,
|
|
127
|
+
transparent: component.opacity < 1,
|
|
128
|
+
opacity: component.opacity,
|
|
129
|
+
});
|
|
130
|
+
const mesh = new Mesh(geometry, material);
|
|
131
|
+
mesh.position.set(component.positionX, component.positionY, component.positionZ);
|
|
132
|
+
mesh.rotation.set(component.rotationX, component.rotationY, component.rotationZ);
|
|
133
|
+
this.threeContext.scene.add(mesh);
|
|
134
|
+
this.entries.set(gameObject.id, { mesh, texture });
|
|
135
|
+
}
|
|
136
|
+
handleChange(changed) {
|
|
137
|
+
const component = changed.component;
|
|
138
|
+
const changedProp = changed.prop?.prop?.[0];
|
|
139
|
+
const entry = this.entries.get(changed.gameObject.id);
|
|
140
|
+
if (changedProp === 'resource') {
|
|
141
|
+
this.handleRemove(changed.gameObject.id);
|
|
142
|
+
this.handleAdd(changed.gameObject, component);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (!entry)
|
|
146
|
+
return;
|
|
147
|
+
if (changedProp === 'repeatX' || changedProp === 'repeatY') {
|
|
148
|
+
entry.texture.repeat.set(component.repeatX, component.repeatY);
|
|
149
|
+
}
|
|
150
|
+
if (changedProp === 'width' || changedProp === 'height') {
|
|
151
|
+
entry.mesh.geometry.dispose();
|
|
152
|
+
entry.mesh.geometry = new PlaneGeometry(component.width, component.height);
|
|
153
|
+
}
|
|
154
|
+
if (changedProp === 'opacity') {
|
|
155
|
+
const material = entry.mesh.material;
|
|
156
|
+
material.opacity = component.opacity;
|
|
157
|
+
material.transparent = component.opacity < 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
handleRemove(id) {
|
|
161
|
+
this.increaseAsyncId(id);
|
|
162
|
+
const entry = this.entries.get(id);
|
|
163
|
+
if (!entry)
|
|
164
|
+
return;
|
|
165
|
+
this.threeContext.scene.remove(entry.mesh);
|
|
166
|
+
entry.mesh.geometry.dispose();
|
|
167
|
+
entry.mesh.material.dispose();
|
|
168
|
+
entry.texture.dispose();
|
|
169
|
+
this.entries.delete(id);
|
|
170
|
+
}
|
|
171
|
+
loadTexture(url) {
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
this.textureLoader.load(url, resolve, undefined, reject);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
onDestroy() {
|
|
177
|
+
for (const [id] of this.entries) {
|
|
178
|
+
this.handleRemove(id);
|
|
179
|
+
}
|
|
180
|
+
this.entries.clear();
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
TilingSprite3DSystem = __decorate([
|
|
184
|
+
decorators.componentObserver({
|
|
185
|
+
TilingSprite3D: [
|
|
186
|
+
'resource', 'repeatX', 'repeatY', 'width', 'height',
|
|
187
|
+
'positionX', 'positionY', 'positionZ',
|
|
188
|
+
'rotationX', 'rotationY', 'rotationZ',
|
|
189
|
+
'opacity',
|
|
190
|
+
],
|
|
191
|
+
})
|
|
192
|
+
], TilingSprite3DSystem);
|
|
193
|
+
var TilingSprite3DSystem_default = TilingSprite3DSystem;
|
|
194
|
+
|
|
195
|
+
export { TilingSprite3D, TilingSprite3DSystem_default as TilingSprite3DSystem };
|
|
196
|
+
//# sourceMappingURL=plugin-renderer-3d-tiling-sprite.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-renderer-3d-tiling-sprite.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 TilingSprite3DParams {\n resource?: string;\n repeatX?: number;\n repeatY?: number;\n width?: number;\n height?: number;\n positionX?: number;\n positionY?: number;\n positionZ?: number;\n rotationX?: number;\n rotationY?: number;\n rotationZ?: number;\n opacity?: number;\n}\n\nexport default class TilingSprite3D extends Component<TilingSprite3DParams> {\n static componentName: string = 'TilingSprite3D';\n\n @type('string') resource: string = '';\n @type('number') @step(0.1) repeatX: number = 1;\n @type('number') @step(0.1) repeatY: number = 1;\n @type('number') @step(0.1) width: number = 10;\n @type('number') @step(0.1) height: number = 10;\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.01) opacity: number = 1;\n\n init(obj?: TilingSprite3DParams) {\n if (obj) Object.assign(this, obj);\n }\n}\n","import { decorators, ComponentChanged, OBSERVER_TYPE, GameObject } from '@combos-fun/engine';\nimport { Renderer3D, Renderer3DSystem } from '@combos-fun/plugin-renderer-3d';\nimport {\n TextureLoader,\n PlaneGeometry,\n MeshBasicMaterial,\n Mesh,\n RepeatWrapping,\n} from 'three';\nimport type { Texture } from 'three';\nimport TilingSprite3D from './component';\n\ninterface TilingSprite3DEntry {\n mesh: Mesh;\n texture: Texture;\n}\n\n@decorators.componentObserver({\n TilingSprite3D: [\n 'resource', 'repeatX', 'repeatY', 'width', 'height',\n 'positionX', 'positionY', 'positionZ',\n 'rotationX', 'rotationY', 'rotationZ',\n 'opacity',\n ],\n})\nexport default class TilingSprite3DSystem extends Renderer3D {\n static systemName = 'TilingSprite3DSystem';\n name: string = 'TilingSprite3DSystem';\n\n private entries: Map<number, TilingSprite3DEntry> = new Map();\n private textureLoader = new TextureLoader();\n\n init() {\n const renderer3DSystem = this.game.getSystem(Renderer3DSystem) as Renderer3DSystem;\n renderer3DSystem.rendererManager.register(this);\n }\n\n componentChanged(changed: ComponentChanged) {\n if (changed.componentName !== 'TilingSprite3D') return;\n\n if (changed.type === OBSERVER_TYPE.ADD) {\n this.handleAdd(changed.gameObject, changed.component as TilingSprite3D);\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(TilingSprite3D) as TilingSprite3D;\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 }\n\n private async handleAdd(gameObject: GameObject, component: TilingSprite3D) {\n if (!component.resource) return;\n\n const asyncId = this.increaseAsyncId(gameObject.id);\n\n const texture = await this.loadTexture(component.resource);\n if (!this.validateAsyncId(gameObject.id, asyncId)) {\n texture.dispose();\n return;\n }\n\n texture.wrapS = RepeatWrapping;\n texture.wrapT = RepeatWrapping;\n texture.repeat.set(component.repeatX, component.repeatY);\n\n const geometry = new PlaneGeometry(component.width, component.height);\n const material = new MeshBasicMaterial({\n map: texture,\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\n this.threeContext.scene.add(mesh);\n this.entries.set(gameObject.id, { mesh, texture });\n }\n\n private handleChange(changed: ComponentChanged) {\n const component = changed.component as TilingSprite3D;\n const changedProp = changed.prop?.prop?.[0];\n const entry = this.entries.get(changed.gameObject.id);\n\n if (changedProp === 'resource') {\n this.handleRemove(changed.gameObject.id);\n this.handleAdd(changed.gameObject, component);\n return;\n }\n\n if (!entry) return;\n\n if (changedProp === 'repeatX' || changedProp === 'repeatY') {\n entry.texture.repeat.set(component.repeatX, component.repeatY);\n }\n\n if (changedProp === 'width' || changedProp === 'height') {\n entry.mesh.geometry.dispose();\n entry.mesh.geometry = new PlaneGeometry(component.width, component.height);\n }\n\n if (changedProp === 'opacity') {\n const material = entry.mesh.material as MeshBasicMaterial;\n material.opacity = component.opacity;\n material.transparent = component.opacity < 1;\n }\n }\n\n private handleRemove(id: number) {\n this.increaseAsyncId(id);\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 MeshBasicMaterial).dispose();\n entry.texture.dispose();\n this.entries.delete(id);\n }\n\n private loadTexture(url: string): Promise<Texture> {\n return new Promise((resolve, reject) => {\n this.textureLoader.load(url, resolve, undefined, reject);\n });\n }\n\n onDestroy() {\n for (const [id] of this.entries) {\n this.handleRemove(id);\n }\n this.entries.clear();\n }\n}\n"],"names":[],"mappings":";;;;;;AAkBc,MAAO,cAAe,SAAQ,SAA+B,CAAA;AAA3E,IAAA,WAAA,GAAA;;QAGkB,IAAA,CAAA,QAAQ,GAAW,EAAE;QACV,IAAA,CAAA,OAAO,GAAW,CAAC;QACnB,IAAA,CAAA,OAAO,GAAW,CAAC;QACnB,IAAA,CAAA,KAAK,GAAW,EAAE;QAClB,IAAA,CAAA,MAAM,GAAW,EAAE;QACnB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IAAA,CAAA,SAAS,GAAW,CAAC;QACpB,IAAA,CAAA,SAAS,GAAW,CAAC;QACrB,IA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CAAC;AAC1C,QAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAA,KAAK,CAAC,IAAI,CAAC,QAA8B,CAAC,OAAO,EAAE;AACpD,QAAA,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;AACvB,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB;AAEQ,IAAA,WAAW,CAAC,GAAW,EAAA;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC;AAC1D,QAAA,CAAC,CAAC;IACJ;IAEA,SAAS,GAAA;QACP,KAAK,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;AAC/B,YAAA,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACvB;AACA,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;IACtB;;AApHmB,oBAAoB,GAAA,UAAA,CAAA;IARxC,UAAU,CAAC,iBAAiB,CAAC;AAC5B,QAAA,cAAc,EAAE;AACd,YAAA,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ;YACnD,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,WAAW,EAAE,WAAW,EAAE,WAAW;YACrC,SAAS;AACV,SAAA;KACF;AACoB,CAAA,EAAA,oBAAoB,CAqHxC;mCArHoB,oBAAoB;;;;"}
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@combos-fun/plugin-renderer-3d-tiling-sprite",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "@combos-fun/plugin-renderer-3d-tiling-sprite",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"module": "dist/plugin-renderer-3d-tiling-sprite.esm.js",
|
|
7
|
+
"bundle": "CombosFun.plugin.renderer.3d.tiling.sprite",
|
|
8
|
+
"unpkg": "dist/CombosFun.plugin.renderer.3d.tiling.sprite.min.js",
|
|
9
|
+
"types": "dist/plugin-renderer-3d-tiling-sprite.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"three": "^0.172.0",
|
|
16
|
+
"@combos-fun/plugin-renderer-3d": "0.0.6",
|
|
17
|
+
"@combos-fun/inspector-decorator": "0.0.6",
|
|
18
|
+
"@combos-fun/engine": "0.0.6"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "node ../../scripts/build-package.mjs"
|
|
22
|
+
}
|
|
23
|
+
}
|