@woosh/meep-engine 2.37.12 → 2.37.13
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/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +0 -2
- package/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.d.ts +2 -0
- package/engine/graphics/ecs/mesh-v2/aggregate/SGMesh.js +16 -0
- package/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +14 -0
- package/engine/graphics/ecs/mesh-v2/render/adapters/GenericRendererAdapter.js +7 -2
- package/package.json +1 -1
|
@@ -3,8 +3,6 @@ import { AABB3 } from "../../../../core/bvh2/aabb3/AABB3.js";
|
|
|
3
3
|
import { DrawMode } from "./DrawMode.js";
|
|
4
4
|
import { ShadedGeometryFlags } from "./ShadedGeometryFlags.js";
|
|
5
5
|
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
6
|
-
import { allocate_transform_m4 } from "./allocate_transform_m4.js";
|
|
7
|
-
import { TransformFlags } from "../../../ecs/transform/TransformFlags.js";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @readonly
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { entity_node_compute_bounding_box } from "../../../../ecs/parent/entity_node_compute_bounding_box.js";
|
|
2
|
+
import { AABB3 } from "../../../../../core/bvh2/aabb3/AABB3.js";
|
|
2
3
|
|
|
3
4
|
export const SGMeshFlags = {
|
|
4
5
|
CastShadow: 1,
|
|
@@ -20,6 +21,13 @@ export class SGMesh {
|
|
|
20
21
|
*/
|
|
21
22
|
this.__node = null;
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {AABB3}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
this.__initial_bounds = new AABB3();
|
|
30
|
+
|
|
23
31
|
/**
|
|
24
32
|
*
|
|
25
33
|
* @type {number}
|
|
@@ -63,6 +71,14 @@ export class SGMesh {
|
|
|
63
71
|
return true;
|
|
64
72
|
}
|
|
65
73
|
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @param {AABB3} destination
|
|
77
|
+
*/
|
|
78
|
+
getUntransformedBoundingBox(destination) {
|
|
79
|
+
destination.copy(this.__initial_bounds);
|
|
80
|
+
}
|
|
81
|
+
|
|
66
82
|
/**
|
|
67
83
|
*
|
|
68
84
|
* @param {number|SGMeshFlags} flag
|
|
@@ -86,6 +86,12 @@ export class SGMeshSystem extends System {
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
if (asset.boundingBox !== undefined) {
|
|
90
|
+
mesh.__initial_bounds.copy(asset.boundingBox);
|
|
91
|
+
} else {
|
|
92
|
+
console.error(`No bounds for asset: ${asset.description}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
let entity_node = three_object_to_entity_composition(asset.create());
|
|
90
96
|
|
|
91
97
|
if (asset.has_root_transform) {
|
|
@@ -153,6 +159,14 @@ export class SGMeshSystem extends System {
|
|
|
153
159
|
* @param {number} entity
|
|
154
160
|
*/
|
|
155
161
|
link(mesh, transform, entity) {
|
|
162
|
+
const p = transform.position;
|
|
163
|
+
|
|
164
|
+
// set initial bounds to single point
|
|
165
|
+
mesh.__initial_bounds.setBounds(
|
|
166
|
+
p.x, p.y, p.z,
|
|
167
|
+
p.x, p.y, p.z,
|
|
168
|
+
);
|
|
169
|
+
|
|
156
170
|
if (mesh.url === null) {
|
|
157
171
|
this.__wait_queue.push(entity);
|
|
158
172
|
return;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AbstractRenderAdapter } from "./AbstractRenderAdapter.js";
|
|
2
|
-
import { array_copy } from "../../../../../../core/collection/array/copyArray.js";
|
|
3
2
|
import { SGThreeObjectCache } from "../SGThreeObjectCache.js";
|
|
4
3
|
|
|
5
4
|
export class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
@@ -30,7 +29,13 @@ export class GenericRendererAdapter extends AbstractRenderAdapter {
|
|
|
30
29
|
*/
|
|
31
30
|
const object = this.__cache.get(sg);
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
const source = sg.transform;
|
|
33
|
+
const destination = object.matrixWorld.elements;
|
|
34
|
+
|
|
35
|
+
// copy transform matrix
|
|
36
|
+
for (let i = 0; i < 16; i++) {
|
|
37
|
+
destination[i] = source[i];
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
this.__objects[this.__object_count++] = object;
|
|
36
41
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.37.
|
|
8
|
+
"version": "2.37.13",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|