@woosh/meep-engine 3.4.0 → 3.6.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/core/geom/3d/gjk/gjk_epa_penetration.d.ts +30 -3
- package/src/core/geom/3d/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/gjk_epa_penetration.js +83 -10
- package/src/core/geom/3d/gjk/mpr.d.ts +7 -1
- package/src/core/geom/3d/gjk/mpr.d.ts.map +1 -1
- package/src/core/geom/3d/gjk/mpr.js +76 -13
- 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/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +20 -2
- 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/shade/renderer/scene/bvh/StaticSceneBVH.js +4 -4
- 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/engine/graphics/sh3/build_injected_shader.d.ts +0 -51
- package/src/engine/graphics/sh3/build_injected_shader.d.ts.map +0 -1
- package/src/engine/graphics/sh3/build_injected_shader.js +0 -56
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts +0 -9
- package/src/engine/graphics/sh3/fromCubeRenderTarget.d.ts.map +0 -1
- package/src/engine/graphics/sh3/fromCubeRenderTarget.js +0 -142
- package/src/engine/graphics/sh3/shader/visualize.frag.d.ts +0 -3
- package/src/engine/graphics/sh3/shader/visualize.frag.d.ts.map +0 -1
- package/src/engine/graphics/sh3/shader/visualize.frag.js +0 -51
- package/src/engine/graphics/sh3/shader/visualize.vert.d.ts +0 -3
- package/src/engine/graphics/sh3/shader/visualize.vert.d.ts.map +0 -1
- package/src/engine/graphics/sh3/shader/visualize.vert.js +0 -12
- package/src/view/graphics/WebGLContextFailureView.d.ts.map +0 -1
|
@@ -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"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { ShadedGeometry } from "../../ShadedGeometry.js";
|
|
2
|
-
import { ShadedGeometryFlags } from "../../ShadedGeometryFlags.js";
|
|
3
|
-
|
|
4
|
-
export class RuntimeDrawMethodOptimizer {
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @type {ShadedGeometrySystem|null}
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
__system = null;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @type {Generator<number>}
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
__entity_iterator = null;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @returns {boolean} true if a change was made, false otherwise
|
|
22
|
-
*/
|
|
23
|
-
step() {
|
|
24
|
-
const system = this.__system;
|
|
25
|
-
|
|
26
|
-
if (system === null) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const ecd = system.entityManager.dataset;
|
|
31
|
-
|
|
32
|
-
if (ecd === null) {
|
|
33
|
-
// no dataset attached
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!ecd.isComponentTypeRegistered(ShadedGeometry)) {
|
|
38
|
-
// component not registered
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (this.__entity_iterator === null) {
|
|
43
|
-
this.__entity_iterator = ecd[Symbol.iterator]();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const next = this.__entity_iterator.next();
|
|
47
|
-
|
|
48
|
-
if (next.done) {
|
|
49
|
-
this.__entity_iterator = ecd[Symbol.iterator]();
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const entity = next.value;
|
|
54
|
-
|
|
55
|
-
if (!ecd.entityExists(entity)) {
|
|
56
|
-
// seems that iterator is stale, reset iterator
|
|
57
|
-
this.__entity_iterator = null;
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @type {ShadedGeometry}
|
|
64
|
-
*/
|
|
65
|
-
const sg = ecd.getComponent(entity, ShadedGeometry);
|
|
66
|
-
|
|
67
|
-
if (sg === undefined) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (sg.getFlag(ShadedGeometryFlags.DrawMethodLocked)) {
|
|
72
|
-
// draw mode is locked, can't change
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const use_count = system.getGeometryUsageCounters().get(sg.geometry.id);
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @type {ShadedGeometryRendererContext|undefined}
|
|
81
|
-
*/
|
|
82
|
-
const first_context = system.__view_contexts.values().next().value;
|
|
83
|
-
|
|
84
|
-
if (first_context === undefined) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const adapters = first_context.adapters;
|
|
89
|
-
const adapter_count = adapters.length;
|
|
90
|
-
|
|
91
|
-
let best_score = Number.NEGATIVE_INFINITY;
|
|
92
|
-
let best_adapter = -1;
|
|
93
|
-
|
|
94
|
-
for (let i = 0; i < adapter_count; i++) {
|
|
95
|
-
const adapter = adapters[i];
|
|
96
|
-
|
|
97
|
-
const score = adapter.score(sg.geometry, sg.material, use_count);
|
|
98
|
-
|
|
99
|
-
if (score > best_score) {
|
|
100
|
-
best_score = score;
|
|
101
|
-
best_adapter = i;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (best_adapter === -1) {
|
|
106
|
-
// not found
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (sg.draw_method === best_adapter) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (!adapters[best_adapter].intend_draw(sg)) {
|
|
115
|
-
// unable to draw, don't do anything
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
sg.draw_method = best_adapter;
|
|
120
|
-
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {THREE.Object3D} root
|
|
4
|
-
* @returns {EntityNode}
|
|
5
|
-
*/
|
|
6
|
-
export function three_object_to_entity_composition(root: THREE.Object3D): EntityNode;
|
|
7
|
-
import { EntityNode } from "../../../ecs/parent/EntityNode.js";
|
|
8
|
-
//# sourceMappingURL=three_object_to_entity_composition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"three_object_to_entity_composition.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0EAFa,UAAU,CA6CtB;2BArD0B,mCAAmC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import Name from "../../../ecs/name/Name.js";
|
|
2
|
-
import { EntityNode } from "../../../ecs/parent/EntityNode.js";
|
|
3
|
-
import { copy_three_transform } from "../../../ecs/transform/copy_three_transform.js";
|
|
4
|
-
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
5
|
-
import { ShadedGeometry } from "./ShadedGeometry.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {THREE.Object3D} root
|
|
10
|
-
* @returns {EntityNode}
|
|
11
|
-
*/
|
|
12
|
-
export function three_object_to_entity_composition(root) {
|
|
13
|
-
const node = new EntityNode();
|
|
14
|
-
|
|
15
|
-
const node_transform = node.transform;
|
|
16
|
-
|
|
17
|
-
// copy object transform
|
|
18
|
-
copy_three_transform(node_transform, root);
|
|
19
|
-
|
|
20
|
-
const entity = node.entity;
|
|
21
|
-
|
|
22
|
-
const transform = new Transform();
|
|
23
|
-
// initialize world transform
|
|
24
|
-
transform.fromMatrix(root.matrixWorld.elements);
|
|
25
|
-
|
|
26
|
-
entity.add(transform);
|
|
27
|
-
entity.add(new Name(root.name));
|
|
28
|
-
|
|
29
|
-
if (root.isMesh) {
|
|
30
|
-
if (root.isSkinnedMesh) {
|
|
31
|
-
console.error(`Skinned meshes are not supported`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const sg = ShadedGeometry.from(root.geometry, root.material);
|
|
35
|
-
|
|
36
|
-
if(root.customDepthMaterial !== undefined && root.customDepthMaterial !== null) {
|
|
37
|
-
sg.depth_material = root.customDepthMaterial;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
entity.add(sg);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const children = root.children;
|
|
44
|
-
const child_count = children.length;
|
|
45
|
-
|
|
46
|
-
for (let i = 0; i < child_count; i++) {
|
|
47
|
-
const child = children[i];
|
|
48
|
-
|
|
49
|
-
const child_node = three_object_to_entity_composition(child);
|
|
50
|
-
|
|
51
|
-
node.addChild(child_node);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return node;
|
|
55
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {Engine} engine
|
|
4
|
-
* @param {string} url
|
|
5
|
-
* @return {Promise<{mesh:ShadedGeometry,transform:mat4}[]>}
|
|
6
|
-
*/
|
|
7
|
-
export function load_mesh_for_bake(engine: Engine, url: string): Promise<{
|
|
8
|
-
mesh: ShadedGeometry;
|
|
9
|
-
transform: mat4;
|
|
10
|
-
}[]>;
|
|
11
|
-
import { ShadedGeometry } from "../../../ecs/mesh-v2/ShadedGeometry.js";
|
|
12
|
-
//# sourceMappingURL=load_mesh_for_bake.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load_mesh_for_bake.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/util/load_mesh_for_bake.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wDAHW,MAAM,GACL,QAAQ;IAAC,IAAI,EAAC,cAAc,CAAC;IAAA,SAAS,OAAK;CAAC,EAAE,CAAC,CAqB1D;+BA5B8B,wCAAwC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
2
|
-
import { three_object_to_entity_composition } from "../../../ecs/mesh-v2/three_object_to_entity_composition.js";
|
|
3
|
-
import { ShadedGeometry } from "../../../ecs/mesh-v2/ShadedGeometry.js";
|
|
4
|
-
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {Engine} engine
|
|
9
|
-
* @param {string} url
|
|
10
|
-
* @return {Promise<{mesh:ShadedGeometry,transform:mat4}[]>}
|
|
11
|
-
*/
|
|
12
|
-
export async function load_mesh_for_bake(engine, url) {
|
|
13
|
-
|
|
14
|
-
const gltf_asset = await engine.assetManager.promise(url, GameAssetType.ModelGLTF_JSON);
|
|
15
|
-
|
|
16
|
-
const node_hierarchy = three_object_to_entity_composition(gltf_asset.create());
|
|
17
|
-
|
|
18
|
-
const objects = [];
|
|
19
|
-
|
|
20
|
-
node_hierarchy.traverse(n => {
|
|
21
|
-
const sg = n.entity.getComponent(ShadedGeometry);
|
|
22
|
-
if (sg !== null) {
|
|
23
|
-
objects.push({
|
|
24
|
-
mesh: sg,
|
|
25
|
-
transform: n.entity.getComponent(Transform).matrix
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return objects;
|
|
31
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prepend a preamble to a three.js-generated shader and splice a chunk in after
|
|
3
|
-
* a named anchor.
|
|
4
|
-
*
|
|
5
|
-
* WHY THIS EXISTS
|
|
6
|
-
*
|
|
7
|
-
* The LPV/GI and LPG material paths have eight shader builders between them
|
|
8
|
-
* (`space_fragment` and `space_vertex`, vertex and fragment, times two
|
|
9
|
-
* subsystems) and every one of them was the same three statements: concatenate
|
|
10
|
-
* the preambles ahead of the source, `insert_after` an anchor, return. What
|
|
11
|
-
* actually differs is data — which preamble, which anchor, which chunk.
|
|
12
|
-
*
|
|
13
|
-
* More importantly the two anchors were spelled out in eight separate string
|
|
14
|
-
* literals. They are three.js's own chunk include lines, and a mismatch fails
|
|
15
|
-
* *quietly* (a console warning and an unmodified shader), so having one
|
|
16
|
-
* definition each is worth more than the lines it saves.
|
|
17
|
-
*
|
|
18
|
-
* Shader assembly happens once per material compile, not per frame.
|
|
19
|
-
*
|
|
20
|
-
* @param {string} source shader source three.js handed to `onBeforeCompile`
|
|
21
|
-
* @param {string} preamble prepended verbatim, ahead of the source
|
|
22
|
-
* @param {string} anchor see {@link GLSL_ANCHOR_LIGHTS_FRAGMENT_BEGIN} / {@link GLSL_ANCHOR_FOG_VERTEX}
|
|
23
|
-
* @param {string} chunk GLSL spliced in directly after `anchor`
|
|
24
|
-
* @returns {string}
|
|
25
|
-
*/
|
|
26
|
-
export function build_injected_shader(source: string, preamble: string, anchor: string, chunk: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* three.js chunk marker after which a probe-field contribution is added to
|
|
29
|
-
* `irradiance` in the fragment stage.
|
|
30
|
-
*
|
|
31
|
-
* `<lights_fragment_begin>` is where three declares `irradiance` and has not yet
|
|
32
|
-
* consumed it, so anything added immediately after it participates in the
|
|
33
|
-
* lighting equations normally. The literal must match three's include line
|
|
34
|
-
* exactly — `insert_after` warns and silently returns the source unchanged when
|
|
35
|
-
* it does not find the term, which shows up as GI simply not appearing.
|
|
36
|
-
*
|
|
37
|
-
* @type {string}
|
|
38
|
-
*/
|
|
39
|
-
export const GLSL_ANCHOR_LIGHTS_FRAGMENT_BEGIN: string;
|
|
40
|
-
/**
|
|
41
|
-
* three.js chunk marker after which per-vertex probe work is injected.
|
|
42
|
-
*
|
|
43
|
-
* `<fog_vertex>` is the last chunk in the standard vertex `main()`, so by that
|
|
44
|
-
* point `worldPosition` (when declared), `position` and `normal` are all
|
|
45
|
-
* available. Same exact-match requirement as
|
|
46
|
-
* {@link GLSL_ANCHOR_LIGHTS_FRAGMENT_BEGIN}.
|
|
47
|
-
*
|
|
48
|
-
* @type {string}
|
|
49
|
-
*/
|
|
50
|
-
export const GLSL_ANCHOR_FOG_VERTEX: string;
|
|
51
|
-
//# sourceMappingURL=build_injected_shader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_injected_shader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/sh3/build_injected_shader.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8CANW,MAAM,YACN,MAAM,UACN,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB;AArDD;;;;;;;;;;;GAWG;AACH,gDAFU,MAAM,CAEoE;AAEpF;;;;;;;;;GASG;AACH,qCAFU,MAAM,CAE8C"}
|