@woosh/meep-engine 2.35.17 → 2.36.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/core/binary/BinaryBuffer.js +42 -17
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +2 -2
- package/core/bvh2/aabb3/aabb3_array_combine.js +20 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_frustum_array.js +20 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_ray.js +1 -0
- package/core/bvh2/aabb3/aabb3_array_intersects_ray_array.js +14 -0
- package/core/bvh2/{aabb3_combined_surface_area.js → aabb3/aabb3_combined_surface_area.js} +3 -3
- package/core/bvh2/aabb3/aabb3_intersects_frustum_array.js +1 -19
- package/core/bvh2/bvh3/BVHNodeProxy.js +53 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +848 -0
- package/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.spec.js +142 -0
- package/core/bvh2/bvh3/bvh_query_leaves_generic.js +79 -0
- package/core/bvh2/bvh3/bvh_query_leaves_ray.js +95 -0
- package/core/bvh2/bvh3/query/BVHQuery.js +11 -0
- package/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +36 -0
- package/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +36 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/table/RowFirstTable.js +25 -7
- package/core/collection/table/RowFirstTableSpec.js +4 -4
- package/core/geom/3d/aabb/aabb3_matrix4_project.spec.js +1 -1
- package/{engine/graphics/util → core/geom/3d/aabb}/computeBoundingBoxFromVertexData.js +1 -1
- package/core/geom/3d/compose_matrix4_array.js +53 -0
- package/{engine/graphics/util → core/geom/3d}/decompose_matrix_4_array.js +0 -0
- package/core/geom/Vector1.js +2 -3
- package/engine/asset/loaders/GLTFAssetLoader.js +3 -0
- package/engine/asset/loaders/gltf/GLTFAssetTransformMikkTSpaceTangents.js +27 -0
- package/engine/ecs/EntityComponentDataset.js +7 -4
- package/engine/ecs/foliage/InstancedFoliage.js +1 -1
- package/engine/ecs/foliage/ViewState.js +1 -1
- package/engine/ecs/transform/Transform.js +2 -2
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +46 -12
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +81 -95
- package/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +16 -5
- package/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -0
- package/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +1 -1
- package/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -2
- package/engine/graphics/geometry/MikkT/MikkTSpace.js +2210 -0
- package/engine/graphics/geometry/MikkT/MikkTSpace.spec.js +22 -0
- package/engine/graphics/geometry/MikkT/buffer_geometry_ensure_tangents.js +34 -0
- package/engine/graphics/geometry/MikkT/buffer_geometry_generate_tangents.js +28 -0
- package/engine/graphics/{compute_geometry_polycount.js → geometry/compute_geometry_polycount.js} +0 -0
- package/engine/graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js +1 -1
- package/engine/graphics/micron/format/serialization/collection/geometry_collection_serialization.js +83 -0
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +42 -19
- package/engine/graphics/micron/plugin/GLTF_MICRON_ID_FIELD.js +5 -0
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +0 -4
- package/engine/graphics/micron/render/refinement/ActivePatchList.js +2 -2
- package/engine/graphics/micron/render/refinement/get_geometry_patch_cut.js +2 -2
- package/engine/graphics/render/forward_plus/LightManager.js +5 -5
- package/engine/graphics/render/forward_plus/data/channelCountToThreIntegerTextureType.js +3 -3
- package/engine/graphics/texture/channelCountToThreeTextureFormat.js +2 -2
- package/engine/graphics/util/composeMatrix4.js +1 -53
- package/engine/graphics/util/composeMatrix4RotationScale.js +1 -1
- package/engine/intelligence/blackboard/AbstractBlackboard.js +9 -0
- package/engine/notify/Notification.js +1 -1
- package/engine/ui/notification/ViewEmitter.js +7 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/engine/ui/scene/SceneGUIContext.js +11 -130
- package/engine/ui/scene/initializeNotifications.js +141 -0
- package/package.json +1 -1
- package/view/elements/notify/NotificationView.js +1 -2
|
@@ -864,23 +864,6 @@ BinaryBuffer.prototype.writeUTF8String = function (string) {
|
|
|
864
864
|
this.position = at;
|
|
865
865
|
};
|
|
866
866
|
|
|
867
|
-
/**
|
|
868
|
-
*
|
|
869
|
-
* @param {number} length
|
|
870
|
-
* @returns {string}
|
|
871
|
-
*/
|
|
872
|
-
BinaryBuffer.prototype.readASCIICharacters = function (length) {
|
|
873
|
-
let result = "";
|
|
874
|
-
|
|
875
|
-
for (let i = 0; i < length; i++) {
|
|
876
|
-
const code = this.readUint8();
|
|
877
|
-
|
|
878
|
-
result += String.fromCharCode(code);
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
return result;
|
|
882
|
-
};
|
|
883
|
-
|
|
884
867
|
/**
|
|
885
868
|
* Adapted from https://github.com/samthor/fast-text-encoding/blob/master/text.js
|
|
886
869
|
* @licence Original license is Apache 2.0
|
|
@@ -954,6 +937,48 @@ BinaryBuffer.prototype.readUTF8String = function () {
|
|
|
954
937
|
return result;
|
|
955
938
|
};
|
|
956
939
|
|
|
940
|
+
/**
|
|
941
|
+
*
|
|
942
|
+
* @param {string} string
|
|
943
|
+
*/
|
|
944
|
+
BinaryBuffer.prototype.writeASCIIString = function (string) {
|
|
945
|
+
const char_count = string.length;
|
|
946
|
+
|
|
947
|
+
const start = this.position;
|
|
948
|
+
const end = start + char_count;
|
|
949
|
+
|
|
950
|
+
this.ensureCapacity(end);
|
|
951
|
+
|
|
952
|
+
for (let i = 0; i < char_count; i++) {
|
|
953
|
+
const char_code = string.charCodeAt(i);
|
|
954
|
+
|
|
955
|
+
if (char_code > 0xFF) {
|
|
956
|
+
throw new Error(`Character ${String.fromCharCode(char_code)} can\'t be represented by a US-ASCII byte.`);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
this.__data_uint8[start + i] = char_code;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
this.position = end;
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
*
|
|
967
|
+
* @param {number} length
|
|
968
|
+
* @returns {string}
|
|
969
|
+
*/
|
|
970
|
+
BinaryBuffer.prototype.readASCIICharacters = function (length) {
|
|
971
|
+
let result = "";
|
|
972
|
+
|
|
973
|
+
for (let i = 0; i < length; i++) {
|
|
974
|
+
const code = this.readUint8();
|
|
975
|
+
|
|
976
|
+
result += String.fromCharCode(code);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
return result;
|
|
980
|
+
};
|
|
981
|
+
|
|
957
982
|
/**
|
|
958
983
|
*
|
|
959
984
|
* @param {BinaryBuffer} source
|
package/core/bvh2/BinaryNode.js
CHANGED
|
@@ -15,7 +15,7 @@ import { BVHVisitor } from "./traversal/BVHVisitor.js";
|
|
|
15
15
|
import { traverseBinaryNodeUsingVisitor } from "./traversal/traverseBinaryNodeUsingVisitor.js";
|
|
16
16
|
import { aabb3_intersect_aabb3 } from "./aabb3/aabb3_intersect_aabb3.js";
|
|
17
17
|
import { aabb3_box_surface_area_2 } from "./aabb3/aabb3_box_surface_area_2.js";
|
|
18
|
-
import { aabb3_combined_surface_area } from "./aabb3_combined_surface_area.js";
|
|
18
|
+
import { aabb3_combined_surface_area } from "./aabb3/aabb3_combined_surface_area.js";
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
/**
|
package/core/bvh2/aabb3/AABB3.js
CHANGED
|
@@ -9,10 +9,10 @@ import computeMortonCode from "../../geom/3d/morton/Morton.js";
|
|
|
9
9
|
import { aabb3_build_corners } from "../../geom/3d/aabb/aabb3_build_corners.js";
|
|
10
10
|
import { assert } from "../../assert.js";
|
|
11
11
|
import { aabb3_intersects_frustum_degree } from "./aabb3_intersects_frustum_degree.js";
|
|
12
|
-
import { aabb3_intersects_frustum } from "./aabb3_intersects_frustum_array.js";
|
|
13
12
|
import { aabb3_intersects_line_segment } from "./aabb3_intersects_line_segment.js";
|
|
14
13
|
import { aabb3_intersects_ray } from "./aabb3_intersects_ray.js";
|
|
15
14
|
import { aabb3_compute_surface_area } from "./aabb3_compute_surface_area.js";
|
|
15
|
+
import { aabb3_intersects_frustum_array } from "./aabb3_intersects_frustum_array.js";
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
export class AABB3 {
|
|
@@ -903,7 +903,7 @@ export class AABB3 {
|
|
|
903
903
|
const y1 = this.y1;
|
|
904
904
|
const z1 = this.z1;
|
|
905
905
|
|
|
906
|
-
return
|
|
906
|
+
return aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum);
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
/**
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
|
|
3
|
+
import { min2 } from "../../math/min2.js";
|
|
4
|
+
import { max2 } from "../../math/max2.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {ArrayLike<number>|number[]} result
|
|
9
|
+
* @param {ArrayLike<number>|number[]} a
|
|
10
|
+
* @param {ArrayLike<number>|number[]} b
|
|
11
|
+
*/
|
|
12
|
+
export function aabb3_array_combine(result, a, b) {
|
|
13
|
+
result[0] = min2(a[0], b[0]);
|
|
14
|
+
result[1] = min2(a[1], b[1]);
|
|
15
|
+
result[2] = min2(a[2], b[2]);
|
|
16
|
+
|
|
17
|
+
result[3] = max2(a[3], b[3]);
|
|
18
|
+
result[4] = max2(a[4], b[4]);
|
|
19
|
+
result[5] = max2(a[5], b[5]);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { aabb3_intersects_frustum_array } from "./aabb3_intersects_frustum_array.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Float32Array|number[]} aabb
|
|
6
|
+
* @param {Float32Array|number[]} frustum
|
|
7
|
+
* @return {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function aabb3_array_intersects_frustum_array(aabb, frustum) {
|
|
10
|
+
|
|
11
|
+
const x0 = aabb[0];
|
|
12
|
+
const y0 = aabb[1];
|
|
13
|
+
const z0 = aabb[2];
|
|
14
|
+
const x1 = aabb[3];
|
|
15
|
+
const y1 = aabb[4];
|
|
16
|
+
const z1 = aabb[5];
|
|
17
|
+
|
|
18
|
+
return aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum);
|
|
19
|
+
}
|
|
20
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { aabb3_intersects_ray } from "./aabb3_intersects_ray.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {ArrayLike<number>|number[]|Float32Array} aabb bounding box, order: x0,y0,z0,x1,y1,z1
|
|
6
|
+
* @param {ArrayLike<number>|number[]|Float32Array} ray ray data, order: origin_x, origin_y, origin_z, direction_x, direction_y, direction_z
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export function aabb3_array_intersects_ray_array(aabb, ray) {
|
|
10
|
+
return aabb3_intersects_ray(aabb[0], aabb[1], aabb[2], aabb[3], aabb[4], aabb[5],
|
|
11
|
+
ray[0], ray[1], ray[2],
|
|
12
|
+
ray[3], ray[4], ray[5]
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { min2 } from "
|
|
2
|
-
import { max2 } from "
|
|
3
|
-
import { aabb3_compute_half_surface_area } from "./
|
|
1
|
+
import { min2 } from "../../math/min2.js";
|
|
2
|
+
import { max2 } from "../../math/max2.js";
|
|
3
|
+
import { aabb3_compute_half_surface_area } from "./aabb3_compute_half_surface_area.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
*
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
import { aabb3_computeDistanceAbovePlane } from "../../geom/3d/aabb/aabb3_computeDistanceAbovePlane.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {Float32Array|number[]} aabb
|
|
6
|
-
* @param {Float32Array|number[]} frustum
|
|
7
|
-
* @return {boolean}
|
|
8
|
-
*/
|
|
9
|
-
export function aabb3_intersects_frustum_array(aabb, frustum) {
|
|
10
|
-
|
|
11
|
-
const x0 = aabb[0];
|
|
12
|
-
const y0 = aabb[1];
|
|
13
|
-
const z0 = aabb[2];
|
|
14
|
-
const x1 = aabb[3];
|
|
15
|
-
const y1 = aabb[4];
|
|
16
|
-
const z1 = aabb[5];
|
|
17
|
-
|
|
18
|
-
return aabb3_intersects_frustum(x0, y0, z0, x1, y1, z1, frustum);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
3
|
/**
|
|
22
4
|
*
|
|
23
5
|
* @param {number} x0
|
|
@@ -29,7 +11,7 @@ export function aabb3_intersects_frustum_array(aabb, frustum) {
|
|
|
29
11
|
* @param {ArrayLike<number>|number[]|Float32Array|Float64Array} frustum
|
|
30
12
|
* @return {boolean}
|
|
31
13
|
*/
|
|
32
|
-
export function
|
|
14
|
+
export function aabb3_intersects_frustum_array(x0, y0, z0, x1, y1, z1, frustum) {
|
|
33
15
|
for (let i = 0; i < 24; i += 4) {
|
|
34
16
|
|
|
35
17
|
const plane_x = frustum[i];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export class BVHNodeProxy {
|
|
2
|
+
constructor() {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @type {number}
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
this.__node = -1;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {ExplicitBinaryBoundingVolumeHierarchy|null}
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
this.__tree = null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {number} node
|
|
21
|
+
* @param {ExplicitBinaryBoundingVolumeHierarchy} tree
|
|
22
|
+
*/
|
|
23
|
+
bind(node, tree) {
|
|
24
|
+
this.__node = node;
|
|
25
|
+
this.__tree = tree;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {number} x0
|
|
31
|
+
* @param {number} y0
|
|
32
|
+
* @param {number} z0
|
|
33
|
+
* @param {number} x1
|
|
34
|
+
* @param {number} y1
|
|
35
|
+
* @param {number} z1
|
|
36
|
+
*/
|
|
37
|
+
set_bounds(x0, y0, z0, x1, y1, z1) {
|
|
38
|
+
this.__tree.node_set_aabb_primitive(this.__node,
|
|
39
|
+
x0, y0, z0, x1, y1, z1
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
disconnect() {
|
|
44
|
+
this.__tree.remove_leaf(this.__node);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
destroy() {
|
|
48
|
+
this.__tree.release_node(this.__node);
|
|
49
|
+
|
|
50
|
+
this.__tree = null;
|
|
51
|
+
this.__node = -1;
|
|
52
|
+
}
|
|
53
|
+
}
|