@woosh/meep-engine 3.4.0 → 3.5.0
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/package.json +1 -1
- package/src/engine/Engine.js +2 -2
- package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +1 -1
- package/src/engine/graphics3/GraphicsEngine3.d.ts +7 -0
- package/src/engine/graphics3/GraphicsEngine3.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine3.js +9 -0
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/shade/playground/skinned_blas_refit/README.md +56 -33
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts +2 -1
- package/src/shade/playground/skinned_blas_refit/place_character.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/place_character.js +2 -1
- package/src/view/graphics/{WebGLContextFailureView.d.ts → GraphicsContextFailureView.d.ts} +2 -2
- package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -0
- package/src/view/graphics/{WebGLContextFailureView.js → GraphicsContextFailureView.js} +1 -1
- package/src/core/geom/3d/aabb/aabb3_from_three_geometry.d.ts +0 -7
- package/src/core/geom/3d/aabb/aabb3_from_three_geometry.d.ts.map +0 -1
- package/src/core/geom/3d/aabb/aabb3_from_three_geometry.js +0 -18
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.d.ts +0 -7
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.d.ts.map +0 -1
- package/src/core/geom/3d/aabb/aabb3_from_threejs_geometry.js +0 -7
- package/src/engine/ecs/transform/copy_three_transform.d.ts +0 -7
- package/src/engine/ecs/transform/copy_three_transform.d.ts.map +0 -1
- package/src/engine/ecs/transform/copy_three_transform.js +0 -15
- package/src/engine/graphics/ecs/mesh-v2/DeferredBoundsQueue.d.ts +0 -48
- package/src/engine/graphics/ecs/mesh-v2/DeferredBoundsQueue.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/DeferredBoundsQueue.js +0 -88
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.d.ts +0 -63
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +0 -314
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.d.ts +0 -67
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js +0 -130
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.d.ts +0 -42
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.js +0 -71
- package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.d.ts +0 -20
- package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.js +0 -123
- package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.d.ts +0 -8
- package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.d.ts.map +0 -1
- package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +0 -55
- package/src/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.d.ts +0 -12
- package/src/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.d.ts.map +0 -1
- package/src/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.js +0 -31
- package/src/view/graphics/WebGLContextFailureView.d.ts.map +0 -1
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { min2 } from "../../../../../core/math/min2.js";
|
|
2
|
-
import { ResourceAccessKind } from "../../../../../core/model/ResourceAccessKind.js";
|
|
3
|
-
import { ResourceAccessSpecification } from "../../../../../core/model/ResourceAccessSpecification.js";
|
|
4
|
-
import { STATIC_ASSET_CACHE } from "../../../../asset/STATIC_ASSET_CACHE.js";
|
|
5
|
-
import { EntityNode } from "../../../../ecs/parent/EntityNode.js";
|
|
6
|
-
import { ParentEntity } from "../../../../ecs/parent/ParentEntity.js";
|
|
7
|
-
import { System } from "../../../../ecs/System.js";
|
|
8
|
-
import { TransformAttachment } from "../../../../ecs/transform-attachment/TransformAttachment.js";
|
|
9
|
-
import { TransformAttachmentSystem } from "../../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
10
|
-
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
11
|
-
import { assetTypeByPath } from "../../mesh/assetTypeByPath.js";
|
|
12
|
-
import { ShadedGeometry } from "../ShadedGeometry.js";
|
|
13
|
-
import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
|
|
14
|
-
import { three_object_to_entity_composition } from "../three_object_to_entity_composition.js";
|
|
15
|
-
import { SGMesh } from "./SGMesh.js";
|
|
16
|
-
import { SGMeshEvents } from "./SGMeshEvents.js";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @readonly
|
|
21
|
-
* @type {number}
|
|
22
|
-
*/
|
|
23
|
-
const MAX_CYCLE_COUNT = 128;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* In milliseconds
|
|
27
|
-
* @readonly
|
|
28
|
-
* @type {number}
|
|
29
|
-
*/
|
|
30
|
-
const MAX_CYCLE_TIME = 40;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
*
|
|
35
|
-
* @param {string} url
|
|
36
|
-
* @param {AssetManager} assetManager
|
|
37
|
-
* @returns {Promise<THREE.Object3D>}
|
|
38
|
-
*/
|
|
39
|
-
async function getAsset(url, assetManager) {
|
|
40
|
-
|
|
41
|
-
const assetType = assetTypeByPath(url);
|
|
42
|
-
|
|
43
|
-
const asset = await assetManager.promise(url, assetType);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export class SGMeshSystem extends System {
|
|
48
|
-
dependencies = [SGMesh, Transform];
|
|
49
|
-
components_used = [
|
|
50
|
-
ResourceAccessSpecification.from(SGMesh, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
51
|
-
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read),
|
|
52
|
-
ResourceAccessSpecification.from(ShadedGeometry, ResourceAccessKind.Create),
|
|
53
|
-
ResourceAccessSpecification.from(TransformAttachment, ResourceAccessKind.Create),
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
*
|
|
58
|
-
* @type {number[]}
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
__wait_queue = [];
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @type {number}
|
|
66
|
-
* @private
|
|
67
|
-
*/
|
|
68
|
-
__wait_queue_process_index = 0;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {Engine} engine
|
|
73
|
-
*/
|
|
74
|
-
constructor(engine) {
|
|
75
|
-
super();
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @type {Engine}
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
this.__engine = engine;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
*
|
|
86
|
-
* @type {AssetManager}
|
|
87
|
-
* @private
|
|
88
|
-
*/
|
|
89
|
-
this.__assetManager = engine.assetManager;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async startup(em) {
|
|
93
|
-
|
|
94
|
-
if (!em.hasSystem(TransformAttachmentSystem)) {
|
|
95
|
-
await em.addSystem(new TransformAttachmentSystem());
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
*
|
|
102
|
-
* @param {number} entity
|
|
103
|
-
* @param {SGMesh} mesh
|
|
104
|
-
* @param {Transform} transform
|
|
105
|
-
*/
|
|
106
|
-
async process(entity, mesh, transform) {
|
|
107
|
-
const am = this.__assetManager;
|
|
108
|
-
const ecd = this.entityManager.dataset;
|
|
109
|
-
|
|
110
|
-
const assetType = assetTypeByPath(mesh.url);
|
|
111
|
-
|
|
112
|
-
let asset;
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
asset = await am.promise(mesh.url, assetType);
|
|
116
|
-
} catch (e) {
|
|
117
|
-
ecd.sendEvent(entity, SGMeshEvents.AssetLoadFailed);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (!ecd.entityExists(entity)) {
|
|
122
|
-
// entity no longer exists
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (ecd.getComponent(entity, SGMesh) !== mesh) {
|
|
127
|
-
// mesh has changed
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (asset.boundingBox !== undefined) {
|
|
132
|
-
mesh.__initial_bounds.copy(asset.boundingBox);
|
|
133
|
-
|
|
134
|
-
if (asset.has_root_transform) {
|
|
135
|
-
// TODO potentially move this to the GLTF Asset Loader to skip matrix operations here
|
|
136
|
-
mesh.__initial_bounds.applyMatrix4(asset.root_transform.matrix);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
} else {
|
|
140
|
-
console.error(`No bounds for asset: ${asset.description}`);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
let object;
|
|
144
|
-
const cached_object = STATIC_ASSET_CACHE.get(asset);
|
|
145
|
-
|
|
146
|
-
if (cached_object !== null) {
|
|
147
|
-
object = cached_object;
|
|
148
|
-
} else {
|
|
149
|
-
object = asset.create();
|
|
150
|
-
|
|
151
|
-
STATIC_ASSET_CACHE.set(asset, object);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
let entity_node = three_object_to_entity_composition(object);
|
|
155
|
-
|
|
156
|
-
if (asset.has_root_transform) {
|
|
157
|
-
// apply root transform
|
|
158
|
-
|
|
159
|
-
const new_root = new EntityNode();
|
|
160
|
-
|
|
161
|
-
new_root.entity.add(new Transform());
|
|
162
|
-
|
|
163
|
-
entity_node.transform.copy(asset.root_transform);
|
|
164
|
-
|
|
165
|
-
new_root.addChild(entity_node);
|
|
166
|
-
|
|
167
|
-
entity_node = new_root;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// attach parent entity to link hierarchy to this entity
|
|
171
|
-
entity_node.entity.add(ParentEntity.from(entity));
|
|
172
|
-
|
|
173
|
-
mesh.__node = entity_node;
|
|
174
|
-
|
|
175
|
-
function copy_transform() {
|
|
176
|
-
entity_node.transform.copy(transform);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
copy_transform();
|
|
180
|
-
|
|
181
|
-
entity_node.build(ecd);
|
|
182
|
-
|
|
183
|
-
transform.subscribe(copy_transform);
|
|
184
|
-
|
|
185
|
-
entity_node.on.destroyed.addOne(() => {
|
|
186
|
-
|
|
187
|
-
transform.unsubscribe(copy_transform);
|
|
188
|
-
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
const material_override = mesh.materialOverride;
|
|
192
|
-
|
|
193
|
-
// apply flags to the hierarchy
|
|
194
|
-
entity_node.traverse(node => {
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
* @type {ShadedGeometry|null}
|
|
198
|
-
*/
|
|
199
|
-
const sg = node.entity.getComponent(ShadedGeometry);
|
|
200
|
-
if (sg === null) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
sg.writeFlag(ShadedGeometryFlags.CastShadow, mesh.castShadow);
|
|
205
|
-
sg.writeFlag(ShadedGeometryFlags.ReceiveShadow, mesh.receiveShadow);
|
|
206
|
-
|
|
207
|
-
if (material_override !== null) {
|
|
208
|
-
sg.material = material_override;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
ecd.sendEvent(entity, SGMeshEvents.AssetLoaded);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
*
|
|
218
|
-
* @param {SGMesh} mesh
|
|
219
|
-
* @param {Transform} transform
|
|
220
|
-
* @param {number} entity
|
|
221
|
-
*/
|
|
222
|
-
link(mesh, transform, entity) {
|
|
223
|
-
const p = transform.position;
|
|
224
|
-
|
|
225
|
-
// set initial bounds to single point
|
|
226
|
-
mesh.__initial_bounds.setBounds(
|
|
227
|
-
p.x, p.y, p.z,
|
|
228
|
-
p.x, p.y, p.z,
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
if (mesh.url === null) {
|
|
232
|
-
this.__wait_queue.push(entity);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
this.process(entity, mesh, transform);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
*
|
|
241
|
-
* @param {SGMesh} mesh
|
|
242
|
-
* @param {Transform} transform
|
|
243
|
-
* @param {number} entity
|
|
244
|
-
*/
|
|
245
|
-
unlink(mesh, transform, entity) {
|
|
246
|
-
if (mesh.__node !== null) {
|
|
247
|
-
mesh.__node.destroy();
|
|
248
|
-
|
|
249
|
-
mesh.__node = null;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// check the queue
|
|
253
|
-
const i = this.__wait_queue.indexOf(entity);
|
|
254
|
-
|
|
255
|
-
if (i !== -1) {
|
|
256
|
-
this.__wait_queue.splice(i, 1);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
update(time_delta) {
|
|
261
|
-
|
|
262
|
-
const entityManager = this.entityManager;
|
|
263
|
-
const dataset = entityManager.dataset;
|
|
264
|
-
|
|
265
|
-
if (dataset === null) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const waiting = this.__wait_queue;
|
|
270
|
-
|
|
271
|
-
let l = waiting.length;
|
|
272
|
-
|
|
273
|
-
if (l > 0) {
|
|
274
|
-
|
|
275
|
-
const time_0 = performance.now();
|
|
276
|
-
|
|
277
|
-
let pointer = this.__wait_queue_process_index;
|
|
278
|
-
|
|
279
|
-
const pointer_limit = pointer + min2(l, MAX_CYCLE_COUNT);
|
|
280
|
-
|
|
281
|
-
while (pointer < pointer_limit) {
|
|
282
|
-
|
|
283
|
-
const index = pointer % l;
|
|
284
|
-
pointer++;
|
|
285
|
-
|
|
286
|
-
const entity = waiting[index];
|
|
287
|
-
|
|
288
|
-
const mesh = dataset.getComponent(entity, SGMesh);
|
|
289
|
-
|
|
290
|
-
if (mesh.url === null) {
|
|
291
|
-
// no URL yet
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
waiting.splice(index, 1);
|
|
296
|
-
|
|
297
|
-
const transform = dataset.getComponent(entity, Transform);
|
|
298
|
-
|
|
299
|
-
this.process(entity, mesh, transform);
|
|
300
|
-
|
|
301
|
-
const time_1 = performance.now();
|
|
302
|
-
|
|
303
|
-
if ((time_1 - time_0) > MAX_CYCLE_TIME) {
|
|
304
|
-
// too much time has passed
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
this.__wait_queue_process_index = pointer;
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export class AbstractRenderAdapter {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @type {number}
|
|
5
|
-
* @protected
|
|
6
|
-
*/
|
|
7
|
-
protected __object_count: number;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @type {THREE.Object3D[]}
|
|
11
|
-
* @protected
|
|
12
|
-
*/
|
|
13
|
-
protected __objects: THREE.Object3D[];
|
|
14
|
-
/**
|
|
15
|
-
* Sorting objects by material will help reduce context switching and number of graphics API calls
|
|
16
|
-
*/
|
|
17
|
-
sort_by_material(): void;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {THREE.BufferGeometry} geometry
|
|
21
|
-
* @param {THREE.Material} material
|
|
22
|
-
* @param {number} instance_count
|
|
23
|
-
* @returns {number}
|
|
24
|
-
*/
|
|
25
|
-
score(geometry: THREE.BufferGeometry, material: THREE.Material, instance_count: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Express intent to draw
|
|
28
|
-
* @param {ShadedGeometry} sg
|
|
29
|
-
* @returns {boolean} true if able to draw immediately, false otherwise
|
|
30
|
-
*/
|
|
31
|
-
intend_draw(sg: ShadedGeometry): boolean;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param {ShadedGeometry} sg
|
|
35
|
-
* @returns {void}
|
|
36
|
-
*/
|
|
37
|
-
add(sg: ShadedGeometry): void;
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
41
|
-
* @param {CameraView} view
|
|
42
|
-
*/
|
|
43
|
-
build_start(renderer: THREE.WebGLRenderer, view: CameraView): void;
|
|
44
|
-
build_end(): void;
|
|
45
|
-
clear(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Used to perform infrequent housekeeping on the adapter's internal data structures
|
|
48
|
-
* Returns a maintenance sequence
|
|
49
|
-
* @return {Generator}
|
|
50
|
-
*/
|
|
51
|
-
maintain(): Generator;
|
|
52
|
-
/**
|
|
53
|
-
* @returns {THREE.Object3D[]}
|
|
54
|
-
*/
|
|
55
|
-
get objects(): THREE.Object3D[];
|
|
56
|
-
/**
|
|
57
|
-
* @returns {number}
|
|
58
|
-
*/
|
|
59
|
-
get object_count(): number;
|
|
60
|
-
dispose(): void;
|
|
61
|
-
/**
|
|
62
|
-
* @readonly
|
|
63
|
-
* @type {boolean}
|
|
64
|
-
*/
|
|
65
|
-
readonly isShadedGeometryRenderAdapter: boolean;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=AbstractRenderAdapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractRenderAdapter.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/render/adapters/AbstractRenderAdapter.js"],"names":[],"mappings":"AA4BA;IACI;;;;OAIG;IACH,0BAHU,MAAM,CAGG;IAEnB;;;;OAIG;IACH,qBAHU,gBAAgB,CAGX;IAEf;;OAEG;IACH,yBAEC;IAED;;;;;;OAMG;IACH,gFAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;OAIG;IACH,iCAFa,OAAO,CAInB;IAED;;;;OAIG;IACH,yBAFa,IAAI,CAIhB;IAGD;;;;OAIG;IACH,mEAEC;IAED,kBAEC;IAED,cAEC;IAED;;;;OAIG;IACH,YAFY,SAAS,CAIpB;IAED;;OAEG;IACH,gCAEC;IAED;;OAEG;IACH,2BAEC;IAED,gBAEC;IAGL;;;OAGG;IACH,wCAFU,OAAO,CAE4C;CAN5D"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
array_quick_sort_by_comparator
|
|
3
|
-
} from "../../../../../../core/collection/array/array_quick_sort_by_comparator.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {THREE.Object3D|{material?:Material}} a
|
|
8
|
-
* @param {THREE.Object3D|{material?:Material}} b
|
|
9
|
-
* @returns {number}
|
|
10
|
-
*/
|
|
11
|
-
function compare_by_material(a, b) {
|
|
12
|
-
|
|
13
|
-
const a_mat = a.material;
|
|
14
|
-
const b_mat = b.material;
|
|
15
|
-
|
|
16
|
-
if (a_mat === b_mat) {
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (a_mat === undefined) {
|
|
21
|
-
return 1;
|
|
22
|
-
} else if (b_mat === undefined) {
|
|
23
|
-
return -1;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return a_mat.id - b_mat.id;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class AbstractRenderAdapter {
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @type {number}
|
|
33
|
-
* @protected
|
|
34
|
-
*/
|
|
35
|
-
__object_count = 0;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
* @type {THREE.Object3D[]}
|
|
40
|
-
* @protected
|
|
41
|
-
*/
|
|
42
|
-
__objects = [];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Sorting objects by material will help reduce context switching and number of graphics API calls
|
|
46
|
-
*/
|
|
47
|
-
sort_by_material() {
|
|
48
|
-
array_quick_sort_by_comparator(this.__objects, compare_by_material, null, 0, this.__object_count - 1);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
* @param {THREE.BufferGeometry} geometry
|
|
54
|
-
* @param {THREE.Material} material
|
|
55
|
-
* @param {number} instance_count
|
|
56
|
-
* @returns {number}
|
|
57
|
-
*/
|
|
58
|
-
score(geometry, material, instance_count) {
|
|
59
|
-
return 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Express intent to draw
|
|
64
|
-
* @param {ShadedGeometry} sg
|
|
65
|
-
* @returns {boolean} true if able to draw immediately, false otherwise
|
|
66
|
-
*/
|
|
67
|
-
intend_draw(sg) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
* @param {ShadedGeometry} sg
|
|
74
|
-
* @returns {void}
|
|
75
|
-
*/
|
|
76
|
-
add(sg) {
|
|
77
|
-
throw new Error('Not Implemented');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
* @param {THREE.WebGLRenderer} renderer
|
|
84
|
-
* @param {CameraView} view
|
|
85
|
-
*/
|
|
86
|
-
build_start(renderer, view) {
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
build_end() {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
clear() {
|
|
95
|
-
this.__object_count = 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Used to perform infrequent housekeeping on the adapter's internal data structures
|
|
100
|
-
* Returns a maintenance sequence
|
|
101
|
-
* @return {Generator}
|
|
102
|
-
*/
|
|
103
|
-
* maintain() {
|
|
104
|
-
// override as necessary
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @returns {THREE.Object3D[]}
|
|
109
|
-
*/
|
|
110
|
-
get objects() {
|
|
111
|
-
return this.__objects;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @returns {number}
|
|
116
|
-
*/
|
|
117
|
-
get object_count() {
|
|
118
|
-
return this.__object_count;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
dispose() {
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @readonly
|
|
128
|
-
* @type {boolean}
|
|
129
|
-
*/
|
|
130
|
-
AbstractRenderAdapter.prototype.isShadedGeometryRenderAdapter = true;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export class SGCacheKey {
|
|
2
|
-
/**
|
|
3
|
-
* ID of geometry
|
|
4
|
-
* @type {number}
|
|
5
|
-
*/
|
|
6
|
-
geometry: number;
|
|
7
|
-
/**
|
|
8
|
-
* ID of material
|
|
9
|
-
* @type {number}
|
|
10
|
-
*/
|
|
11
|
-
material: number;
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @type {DrawMode}
|
|
15
|
-
*/
|
|
16
|
-
mode: DrawMode;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @type {number}
|
|
20
|
-
*/
|
|
21
|
-
flags: number;
|
|
22
|
-
hash(): number;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param {SGCacheKey} other
|
|
26
|
-
* @returns {boolean}
|
|
27
|
-
*/
|
|
28
|
-
equals(other: SGCacheKey): boolean;
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @param {SGCacheKey} other
|
|
32
|
-
*/
|
|
33
|
-
copy(other: SGCacheKey): void;
|
|
34
|
-
clone(): SGCacheKey;
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {ShadedGeometry} sg
|
|
38
|
-
*/
|
|
39
|
-
fromSG(sg: ShadedGeometry): void;
|
|
40
|
-
}
|
|
41
|
-
import { DrawMode } from "../../DrawMode.js";
|
|
42
|
-
//# sourceMappingURL=SGCacheKey.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SGCacheKey.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/render/adapters/SGCacheKey.js"],"names":[],"mappings":"AAEA;IACI;;;OAGG;IACH,UAFU,MAAM,CAEF;IACd;;;OAGG;IACH,UAFU,MAAM,CAEF;IACd;;;OAGG;IACH,MAFU,QAAQ,CAEQ;IAE1B;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV,eAEC;IAED;;;;OAIG;IACH,cAHW,UAAU,GACR,OAAO,CAOnB;IAED;;;OAGG;IACH,YAFW,UAAU,QAOpB;IAED,oBAMC;IAED;;;OAGG;IACH,iCAKC;CACJ;yBAtEwB,mBAAmB"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { DrawMode } from "../../DrawMode.js";
|
|
2
|
-
|
|
3
|
-
export class SGCacheKey {
|
|
4
|
-
/**
|
|
5
|
-
* ID of geometry
|
|
6
|
-
* @type {number}
|
|
7
|
-
*/
|
|
8
|
-
geometry = -1;
|
|
9
|
-
/**
|
|
10
|
-
* ID of material
|
|
11
|
-
* @type {number}
|
|
12
|
-
*/
|
|
13
|
-
material = -1;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @type {DrawMode}
|
|
17
|
-
*/
|
|
18
|
-
mode = DrawMode.Triangles;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @type {number}
|
|
23
|
-
*/
|
|
24
|
-
flags = 0;
|
|
25
|
-
|
|
26
|
-
hash() {
|
|
27
|
-
return this.geometry ^ this.material;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @param {SGCacheKey} other
|
|
33
|
-
* @returns {boolean}
|
|
34
|
-
*/
|
|
35
|
-
equals(other) {
|
|
36
|
-
return this.geometry === other.geometry
|
|
37
|
-
&& this.material === other.material
|
|
38
|
-
&& this.mode === other.mode
|
|
39
|
-
&& this.flags === other.flags;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @param {SGCacheKey} other
|
|
45
|
-
*/
|
|
46
|
-
copy(other) {
|
|
47
|
-
this.geometry = other.geometry;
|
|
48
|
-
this.material = other.material;
|
|
49
|
-
this.mode = other.mode;
|
|
50
|
-
this.flags = other.flags;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
clone() {
|
|
54
|
-
const r = new SGCacheKey();
|
|
55
|
-
|
|
56
|
-
r.copy(this);
|
|
57
|
-
|
|
58
|
-
return r;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @param {ShadedGeometry} sg
|
|
64
|
-
*/
|
|
65
|
-
fromSG(sg) {
|
|
66
|
-
this.geometry = sg.geometry.id;
|
|
67
|
-
this.material = sg.material.id;
|
|
68
|
-
this.mode = sg.mode;
|
|
69
|
-
this.flags = sg.flags;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export class RuntimeDrawMethodOptimizer {
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @type {ShadedGeometrySystem|null}
|
|
5
|
-
* @private
|
|
6
|
-
*/
|
|
7
|
-
private __system;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @type {Generator<number>}
|
|
11
|
-
* @private
|
|
12
|
-
*/
|
|
13
|
-
private __entity_iterator;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @returns {boolean} true if a change was made, false otherwise
|
|
17
|
-
*/
|
|
18
|
-
step(): boolean;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=RuntimeDrawMethodOptimizer.d.ts.map
|
package/src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeDrawMethodOptimizer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/engine/graphics/ecs/mesh-v2/render/optimization/RuntimeDrawMethodOptimizer.js"],"names":[],"mappings":"AAGA;IACI;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,0BAAyB;IAEzB;;;OAGG;IACH,QAFa,OAAO,CAqGnB;CACJ"}
|