@woosh/meep-engine 2.126.36 → 2.126.38
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/mat4/m4_orthographic_off_center_z0.d.ts +13 -0
- package/src/core/geom/3d/mat4/m4_orthographic_off_center_z0.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_orthographic_off_center_z0.js +39 -0
- package/src/core/geom/3d/shape/util/shape_to_visual_entity.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +12 -12
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +2 -1
- package/src/core/geom/Quaternion.d.ts +2 -1
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +6 -2
- package/src/engine/asset/loaders/GLTFAssetLoader.d.ts.map +1 -1
- package/src/engine/asset/loaders/GLTFAssetLoader.js +19 -19
- package/src/engine/ecs/Entity.d.ts.map +1 -1
- package/src/engine/ecs/Entity.js +3 -1
- package/src/engine/ecs/attachment/TransformAttachmentBinding.d.ts.map +1 -1
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +5 -5
- package/src/engine/ecs/transform/Transform.d.ts +19 -5
- package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform.js +30 -9
- package/src/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +4 -2
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Pure JavaScript game engine. Fully featured and production ready.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.126.
|
|
8
|
+
"version": "2.126.38",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new projection matrix for customized orthographic view
|
|
3
|
+
* Adapted for WebGPU.
|
|
4
|
+
* @param {number[]|Float32Array[]} output 4x4 matrix will be written here
|
|
5
|
+
* @param {number} left Lower x-value at the near plane (x0)
|
|
6
|
+
* @param {number} right Upper x-value at the near plane (x1)
|
|
7
|
+
* @param {number} bottom Lower y-coordinate at the near plane (y0)
|
|
8
|
+
* @param {number} top Upper y-value at the near plane (y1)
|
|
9
|
+
* @param {number} z_near Depth of the near plane (z0)
|
|
10
|
+
* @param {number} z_far Depth of the far plane (z1)
|
|
11
|
+
*/
|
|
12
|
+
export function m4_orthographic_off_center_z0(output: number[] | Float32Array[], left: number, right: number, bottom: number, top: number, z_near: number, z_far: number): void;
|
|
13
|
+
//# sourceMappingURL=m4_orthographic_off_center_z0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m4_orthographic_off_center_z0.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/m4_orthographic_off_center_z0.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,sDARW,MAAM,EAAE,GAAC,YAAY,EAAE,QACvB,MAAM,SACN,MAAM,UACN,MAAM,OACN,MAAM,UACN,MAAM,SACN,MAAM,QA6BhB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new projection matrix for customized orthographic view
|
|
3
|
+
* Adapted for WebGPU.
|
|
4
|
+
* @param {number[]|Float32Array[]} output 4x4 matrix will be written here
|
|
5
|
+
* @param {number} left Lower x-value at the near plane (x0)
|
|
6
|
+
* @param {number} right Upper x-value at the near plane (x1)
|
|
7
|
+
* @param {number} bottom Lower y-coordinate at the near plane (y0)
|
|
8
|
+
* @param {number} top Upper y-value at the near plane (y1)
|
|
9
|
+
* @param {number} z_near Depth of the near plane (z0)
|
|
10
|
+
* @param {number} z_far Depth of the far plane (z1)
|
|
11
|
+
*/
|
|
12
|
+
export function m4_orthographic_off_center_z0(
|
|
13
|
+
output,
|
|
14
|
+
left, right,
|
|
15
|
+
bottom, top,
|
|
16
|
+
z_near, z_far
|
|
17
|
+
) {
|
|
18
|
+
// actual implementation is different from DirectX, based on Orilusion code: https://github.com/Orillusion/orillusion/blob/8887427f0a2e426a1cc75ef022c8649bcdd785b0/src/math/Matrix4.ts#L676
|
|
19
|
+
|
|
20
|
+
output[0] = 2 / (right - left);
|
|
21
|
+
output[1] = 0;
|
|
22
|
+
output[2] = 0;
|
|
23
|
+
output[3] = 0;
|
|
24
|
+
|
|
25
|
+
output[4] = 0;
|
|
26
|
+
output[5] = 2 / (top - bottom);
|
|
27
|
+
output[6] = 0;
|
|
28
|
+
output[7] = 0;
|
|
29
|
+
|
|
30
|
+
output[8] = 0;
|
|
31
|
+
output[9] = 0;
|
|
32
|
+
output[10] = 1.0 / (z_far - z_near); // Different from direct X
|
|
33
|
+
output[11] = 0;
|
|
34
|
+
|
|
35
|
+
output[12] = (left + right) / (left - right);
|
|
36
|
+
output[13] = (top + bottom) / (bottom - top);
|
|
37
|
+
output[14] = z_near / (z_near - z_far);
|
|
38
|
+
output[15] = 1;
|
|
39
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape_to_visual_entity.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/util/shape_to_visual_entity.js"],"names":[],"mappings":"AA4IA;;;;;GAKG;AACH,8CAJW,eAAe,OACf,sBAAsB,GACpB,MAAM,CAclB;AAlID,sCAAuC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"shape_to_visual_entity.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/shape/util/shape_to_visual_entity.js"],"names":[],"mappings":"AA4IA;;;;;GAKG;AACH,8CAJW,eAAe,OACf,sBAAsB,GACpB,MAAM,CAclB;AAlID,sCAAuC,kBAAkB,CAAC;mBAvBvC,qCAAqC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { UnionShape3D } from "../UnionShape3D.js";
|
|
2
|
-
import { UnitCubeShape3D } from "../UnitCubeShape3D.js";
|
|
3
|
-
import { UnitSphereShape3D } from "../UnitSphereShape3D.js";
|
|
4
|
-
import { TransformedShape3D } from "../TransformedShape3D.js";
|
|
5
|
-
import Entity from "../../../../../engine/ecs/Entity.js";
|
|
6
|
-
import { Transform } from "../../../../../engine/ecs/transform/Transform.js";
|
|
7
|
-
import { AttachmentSockets } from "../../../../../engine/ecs/sockets/AttachmentSockets.js";
|
|
8
|
-
import { Attachment } from "../../../../../engine/ecs/attachment/Attachment.js";
|
|
9
|
-
import { ShadedGeometry } from "../../../../../engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
10
1
|
import { LineBasicMaterial } from "three";
|
|
11
|
-
import { makeHelperSphereGeometry } from "../../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
12
|
-
import { DrawMode } from "../../../../../engine/graphics/ecs/mesh-v2/DrawMode.js";
|
|
13
2
|
import { makeHelperBoxGeometry } from "../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
|
|
3
|
+
import { makeHelperSphereGeometry } from "../../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
4
|
+
import { Attachment } from "../../../../../engine/ecs/attachment/Attachment.js";
|
|
14
5
|
import Tag from "../../../../../engine/ecs/components/Tag.js";
|
|
6
|
+
import Entity from "../../../../../engine/ecs/Entity.js";
|
|
7
|
+
import { AttachmentSockets } from "../../../../../engine/ecs/sockets/AttachmentSockets.js";
|
|
8
|
+
import { Transform } from "../../../../../engine/ecs/transform/Transform.js";
|
|
9
|
+
import { DrawMode } from "../../../../../engine/graphics/ecs/mesh-v2/DrawMode.js";
|
|
10
|
+
import { ShadedGeometry } from "../../../../../engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
11
|
+
import { TransformedShape3D } from "../TransformedShape3D.js";
|
|
12
|
+
import { UnionShape3D } from "../UnionShape3D.js";
|
|
13
|
+
import { UnitCubeShape3D } from "../UnitCubeShape3D.js";
|
|
14
|
+
import { UnitSphereShape3D } from "../UnitSphereShape3D.js";
|
|
15
15
|
|
|
16
16
|
const g_unit_sphere = makeHelperSphereGeometry(0.5, 32);
|
|
17
17
|
const g_unit_cube = makeHelperBoxGeometry(1, 1, 1);
|
|
@@ -131,7 +131,7 @@ function transformed_shape_to_entity(shape, ecd) {
|
|
|
131
131
|
immediate: true
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
attachment.transform.
|
|
134
|
+
attachment.transform.fromMatrix(shape.transform);
|
|
135
135
|
|
|
136
136
|
subject.add(attachment);
|
|
137
137
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConicRay.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/ConicRay.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH;IAkLI;;;;;;;OAOG;IACH,sBANW,MAAM,KACN,MAAM,KACN,MAAM,cACN,MAAM,GACJ,QAAQ,CAkBpB;IAxMD;;;;OAIG;IACH,oBAFU,OAAO,CAEgB;IAEjC;;;;OAIG;IACH,OAFU,MAAM,CAEN;IAEV;;;;;;;MAKC;IAED,0BAGC;IAED;;;OAGG;IACH,uBAFW,YAAY,QAKtB;IAED;;;OAGG;IACH,yBAFW,YAAY,QAQtB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAMnB;IAED;;;;;OAKG;IACH,qBAJW,QAAQ,cACR,MAAM,GACJ,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFY,MAAM,CAOjB;IAED;;;OAGG;IACH,YAFW,QAAQ,QAKlB;IAED;;;;OAIG;IACH,4BAHW,OAAO,GACL,OAAO,CAMnB;IAED;;;;;OAKG;IACH,gDAFW,OAAO,QAsEjB;IA6BL;;;OAGG;IACH,qBAFU,OAAO,CAEY;CAN5B;;kBAUS,MAAM;;oBA/NI,cAAc"}
|
|
@@ -2,6 +2,7 @@ import { assert } from "../assert.js";
|
|
|
2
2
|
import { combine_hash } from "../collection/array/combine_hash.js";
|
|
3
3
|
import { EPSILON } from "../math/EPSILON.js";
|
|
4
4
|
import { epsilonEquals } from "../math/epsilonEquals.js";
|
|
5
|
+
import { PI2 } from "../math/PI2.js";
|
|
5
6
|
import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
|
|
6
7
|
import Vector3 from "./Vector3.js";
|
|
7
8
|
|
|
@@ -136,7 +137,7 @@ export class ConicRay {
|
|
|
136
137
|
|
|
137
138
|
const z = random() * (1 - angleCosine) + angleCosine;
|
|
138
139
|
|
|
139
|
-
const phi = random() *
|
|
140
|
+
const phi = random() * PI2;
|
|
140
141
|
|
|
141
142
|
const zSqr = z * z;
|
|
142
143
|
|
|
@@ -131,7 +131,7 @@ export class Quaternion implements Iterable<number> {
|
|
|
131
131
|
*/
|
|
132
132
|
_lookRotation(fx: number, fy: number, fz: number, ux: number, uy: number, uz: number): this;
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* Orient quaternion to align with the `forward` drection.
|
|
135
135
|
* @param {Vector3} forward
|
|
136
136
|
* @param {Vector3} [up=Vector3.up]
|
|
137
137
|
*/
|
|
@@ -247,6 +247,7 @@ export class Quaternion implements Iterable<number> {
|
|
|
247
247
|
* @param {Vector3} source
|
|
248
248
|
* @param {Vector3} target
|
|
249
249
|
* @param {Vector3} [up]
|
|
250
|
+
* @see lookRotation
|
|
250
251
|
*/
|
|
251
252
|
lookAt(source: Vector3, target: Vector3, up?: Vector3): void;
|
|
252
253
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,mCALe,QAAQ,CAAC,MAAM;IA4R1B;;;;;OAKG;IACH,2BAJW,OAAO,SACP,MAAM,GACJ,UAAU,CAQtB;
|
|
1
|
+
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/Quaternion.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,mCALe,QAAQ,CAAC,MAAM;IA4R1B;;;;;OAKG;IACH,2BAJW,OAAO,SACP,MAAM,GACJ,UAAU,CAQtB;IAspCD;;;;OAIG;IACH,kCAFa,UAAU,CAQtB;IAED;;;;;;;OAOG;IACH,0BALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,UAAU,CAQtB;IAED;;;;;;OAMG;IACH,6BALW,UAAU,QACV,UAAU,MACV,UAAU,aACV,MAAM,QA0BhB;IAp/CD;;;;;;;OAOG;IACH,gBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,EAsChB;IA7BG;;;OAGG;IACH,GAFU,MAAM,CAEN;IACV;;;OAGG;IACH,GAFU,MAAM,CAEN;IACV;;;OAGG;IACH,GAFU,MAAM,CAEN;IACV;;;OAGG;IACH,GAFU,MAAM,CAEN;IAEV;;;;;;OAMG;IACH,oBAFU,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEnD;IAqCjC;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAtCD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAkCD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAtCD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAkCD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAtCD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAkCD;;;OAGG;IACH,SAFW,MAAM,EAIhB;IAtCD;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAgDD;;;;;;;;;;OAUG;IACH,kBAR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AAc"}
|
|
@@ -221,7 +221,7 @@ export class Quaternion {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
*
|
|
224
|
+
* Orient quaternion to align with the `forward` drection.
|
|
225
225
|
* @param {Vector3} forward
|
|
226
226
|
* @param {Vector3} [up=Vector3.up]
|
|
227
227
|
*/
|
|
@@ -582,6 +582,7 @@ export class Quaternion {
|
|
|
582
582
|
* @param {Vector3} source
|
|
583
583
|
* @param {Vector3} target
|
|
584
584
|
* @param {Vector3} [up]
|
|
585
|
+
* @see lookRotation
|
|
585
586
|
*/
|
|
586
587
|
lookAt(source, target, up = Vector3.up) {
|
|
587
588
|
const forward = scratch_v3_a;
|
|
@@ -1541,9 +1542,12 @@ export class Quaternion {
|
|
|
1541
1542
|
|
|
1542
1543
|
const angle = from.angleTo(to);
|
|
1543
1544
|
|
|
1545
|
+
|
|
1544
1546
|
if (angle === 0) {
|
|
1545
|
-
//
|
|
1547
|
+
// We're already where we need to be.
|
|
1548
|
+
// Also - avoid division by 0.
|
|
1546
1549
|
result.copy(to);
|
|
1550
|
+
|
|
1547
1551
|
} else {
|
|
1548
1552
|
// clamp to 1, to make sure we don't overshoot
|
|
1549
1553
|
const t = clamp01(max_delta / angle);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GLTFAssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/GLTFAssetLoader.js"],"names":[],"mappings":"AAuIA;IAEI,cAyDC;IArDG,2BAAsC;IAatC,mBAAoB;IAEpB;;;;;OAKG;IACH,gCAAoC;IAEpC;;;;;OAKG;IACH,+BAAmC;IAEnC;;;;OAIG;IACH,yBAIE;IAGF;;;;OAIG;IACH,wBAIE;IAGN;;;OAGG;IACH,uBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,yBAFW,OAAO,EAIjB;IAED;;;OAGG;IACH,yBAFa,OAAO,CAInB;IAED,oDAOC;IAED;;;;OAIG;IACH,gCAsCC;IAGD,6EAkKC;CACJ;
|
|
1
|
+
{"version":3,"file":"GLTFAssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/GLTFAssetLoader.js"],"names":[],"mappings":"AAuIA;IAEI,cAyDC;IArDG,2BAAsC;IAatC,mBAAoB;IAEpB;;;;;OAKG;IACH,gCAAoC;IAEpC;;;;;OAKG;IACH,+BAAmC;IAEnC;;;;OAIG;IACH,yBAIE;IAGF;;;;OAIG;IACH,wBAIE;IAGN;;;OAGG;IACH,uBAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,yBAFW,OAAO,EAIjB;IAED;;;OAGG;IACH,yBAFa,OAAO,CAInB;IAED,oDAOC;IAED;;;;OAIG;IACH,gCAsCC;IAGD,6EAkKC;CACJ;4BAja2B,kBAAkB;4BAnBlB,2CAA2C;2BAC5C,0CAA0C"}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { MeshDepthMaterial, RGBADepthPacking } from "three";
|
|
2
|
+
import { DDSLoader } from "three/examples/jsm/loaders/DDSLoader.js";
|
|
3
|
+
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
|
|
4
4
|
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
5
|
+
import { HashSet } from "../../../core/collection/set/HashSet.js";
|
|
5
6
|
import { AABB3 } from "../../../core/geom/3d/aabb/AABB3.js";
|
|
6
|
-
import { StaticMaterialCache } from "./material/StaticMaterialCache.js";
|
|
7
|
-
import { DDSLoader } from "three/examples/jsm/loaders/DDSLoader.js";
|
|
8
7
|
import { AnimationOptimizer } from "../../ecs/animation/AnimationOptimizer.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { Transform } from "../../ecs/transform/Transform.js";
|
|
9
|
+
import { traverseThreeObject } from "../../graphics/ecs/highlight/renderer/traverseThreeObject.js";
|
|
10
|
+
import { computeGeometryEquality } from "../../graphics/geometry/buffered/computeGeometryEquality.js";
|
|
11
|
+
import { computeGeometryHash } from "../../graphics/geometry/buffered/computeGeometryHash.js";
|
|
12
12
|
import { ensureGeometryBoundingSphere } from "../../graphics/geometry/buffered/ensureGeometryBoundingSphere.js";
|
|
13
13
|
import {
|
|
14
14
|
computeSkinnedMeshBoundingVolumes
|
|
15
15
|
} from "../../graphics/geometry/skining/computeSkinnedMeshBoundingVolumes.js";
|
|
16
|
-
import { ensureGeometryBoundingBox } from "../../graphics/util/ensureGeometryBoundingBox.js";
|
|
17
16
|
import { cloneObject3D } from "../../graphics/three/cloneObject3D.js";
|
|
18
|
-
import
|
|
17
|
+
import { three_computeObjectBoundingBox } from "../../graphics/three/three_computeObjectBoundingBox.js";
|
|
18
|
+
import { prepareMaterial, prepareObject } from "../../graphics/three/ThreeFactory.js";
|
|
19
|
+
import { ensureGeometryBoundingBox } from "../../graphics/util/ensureGeometryBoundingBox.js";
|
|
20
|
+
import { Asset } from "../Asset.js";
|
|
19
21
|
import { CrossOriginKind } from "../CORS/CrossOriginKind.js";
|
|
22
|
+
import { AssetLoader } from "./AssetLoader.js";
|
|
23
|
+
import { async_traverse_three_object } from "./async_traverse_three_object.js";
|
|
20
24
|
import { computeObjectBoundingSphere } from "./gltf/computeObjectBoundingSphere.js";
|
|
25
|
+
import GLTFTextureDDSExtension from "./gltf/extensions/MSFT_texture_dds.js";
|
|
21
26
|
import { isMesh } from "./gltf/isMesh.js";
|
|
22
|
-
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
|
|
23
|
-
import { HashSet } from "../../../core/collection/set/HashSet.js";
|
|
24
|
-
import { computeGeometryHash } from "../../graphics/geometry/buffered/computeGeometryHash.js";
|
|
25
|
-
import { computeGeometryEquality } from "../../graphics/geometry/buffered/computeGeometryEquality.js";
|
|
26
|
-
import { traverseThreeObject } from "../../graphics/ecs/highlight/renderer/traverseThreeObject.js";
|
|
27
|
-
import { computeTextureHash } from "./material/computeTextureHash.js";
|
|
28
27
|
import { computeTextureEquality } from "./material/computeTextureEquality.js";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
28
|
+
import { computeTextureHash } from "./material/computeTextureHash.js";
|
|
29
|
+
import { StaticMaterialCache } from "./material/StaticMaterialCache.js";
|
|
30
|
+
import { TextureAttachmentsByMaterialType } from "./material/TextureAttachmensByMaterialType.js";
|
|
31
31
|
|
|
32
32
|
const animationOptimizer = new AnimationOptimizer();
|
|
33
33
|
const materialCache = StaticMaterialCache.Global;
|
|
@@ -80,7 +80,7 @@ function transferRootTransform(root, result) {
|
|
|
80
80
|
|
|
81
81
|
// record transformation matrix on the root
|
|
82
82
|
root.updateMatrix();
|
|
83
|
-
result.
|
|
83
|
+
result.fromMatrix(root.matrix.elements);
|
|
84
84
|
|
|
85
85
|
return true;
|
|
86
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;
|
|
1
|
+
{"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../../../../src/engine/ecs/Entity.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAsaI;;;;;;;;;;;OAWG;IACH,+BAJW,MAAM,WACN,sBAAsB,GACpB,MAAM,CAqBlB;IAncD;;;;;OAKG;IACH,oBAFU,eAAe,CAES;IAGlC;;;OAGG;IACH,UAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,2BAAgB;IAQhB;;;;OAIG;IACH,SAFU,sBAAsB,CAEjB;IAEf;;;OAGG;IACH,OAFU,WAAW,GAAC,MAAM,CAEN;IAEtB;;;;OAIG;IACH,yBAAgB;IAEhB;;OAEG;IACH;QACI;;WAEG;;MAEL;IAUF;;;OAGG;IACH,eAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,WAAW,GAChB,OAAO,CAMnB;IAED;;;OAGG;IACH,gBAFW,MAAM,GAAC,WAAW,QAI5B;IAED;;;OAGG;IACH,wBAFa,OAAO,CAInB;IAED;;OAEG;IACH,4BAQC;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,IAJa,CAAC,qBACH,CAAC,GACC,MAAM,CAsBlB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,CAAC,GACC,OAAO,CAInB;IAED;;;;OAIG;IACH,aAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,GAAC,IAAI,CAclB;IAED;;;;;OAKG;IACH,iBAJa,CAAC,SACH,KAAK,CAAC,CAAC,CAAC,GACN,CAAC,CAUb;IAED;;;;OAIG;IACH,kCAFa,GAAC,GAAC,IAAI,CA0BlB;IAED;;;;OAIG;IACH,qBAHW,MAAM,UACN,GAAC,QAQX;IAED;;;OAGG;IACH,wBAFW,MAAM,gBAiBhB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAalB;IAED;;;;;;OAMG;IACH,+BALW,MAAM,gCAEN,GAAC,GACC,MAAM,CAyBlB;IAED;;;OAGG;IACH,WAFa,OAAO,CAwBnB;IAED;;;;;;;;;;;;OAYG;IACH,eAFW,sBAAsB,GADpB,MAAM,CA4DlB;IAoCL;;;;OAIG;IACH,mBAFU,OAAO,CAEQ;;CAPxB;;gCA9e+B,sBAAsB;4BAD1B,kBAAkB;mBAF3B,oCAAoC"}
|
package/src/engine/ecs/Entity.js
CHANGED
|
@@ -408,6 +408,8 @@ export class Entity {
|
|
|
408
408
|
build(dataset) {
|
|
409
409
|
assert.defined(dataset, "dataset");
|
|
410
410
|
assert.notNull(dataset, "dataset");
|
|
411
|
+
assert.isObject(dataset, 'dataset');
|
|
412
|
+
assert.equal(dataset.isEntityComponentDataset, true, 'dataset.isEntityComponentDataset !== true');
|
|
411
413
|
|
|
412
414
|
if (
|
|
413
415
|
this.getFlag(EntityFlags.Built)
|
|
@@ -497,7 +499,7 @@ export class Entity {
|
|
|
497
499
|
}
|
|
498
500
|
|
|
499
501
|
/**
|
|
500
|
-
* Useful for faster alternative to `instanceof` checks
|
|
502
|
+
* Useful for a faster alternative to `instanceof` checks
|
|
501
503
|
* @readonly
|
|
502
504
|
* @type {boolean}
|
|
503
505
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformAttachmentBinding.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/attachment/TransformAttachmentBinding.js"],"names":[],"mappings":"AAOA;CAgCC;
|
|
1
|
+
{"version":3,"file":"TransformAttachmentBinding.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/attachment/TransformAttachmentBinding.js"],"names":[],"mappings":"AAOA;CAgCC;kCAtCiC,wBAAwB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AttachmentBinding } from "./AttachmentBinding.js";
|
|
2
1
|
import { mat4 } from "gl-matrix";
|
|
2
|
+
import { AttachmentBinding } from "./AttachmentBinding.js";
|
|
3
3
|
|
|
4
4
|
const scratch_m4_0 = new Float32Array(16);
|
|
5
5
|
const scratch_m4_1 = new Float32Array(16);
|
|
@@ -12,9 +12,9 @@ export class TransformAttachmentBinding extends AttachmentBinding {
|
|
|
12
12
|
*/
|
|
13
13
|
update() {
|
|
14
14
|
|
|
15
|
-
this.socket.transform.
|
|
16
|
-
this.parentTransform.
|
|
17
|
-
this.attachment.transform.
|
|
15
|
+
this.socket.transform.toMatrix(scratch_m4_0);
|
|
16
|
+
this.parentTransform.toMatrix(scratch_m4_1);
|
|
17
|
+
this.attachment.transform.toMatrix(scratch_m4_2);
|
|
18
18
|
|
|
19
19
|
mat4.multiply(
|
|
20
20
|
scratch_m4_0, scratch_m4_1, scratch_m4_0
|
|
@@ -23,7 +23,7 @@ export class TransformAttachmentBinding extends AttachmentBinding {
|
|
|
23
23
|
scratch_m4_0, scratch_m4_0, scratch_m4_2
|
|
24
24
|
);
|
|
25
25
|
|
|
26
|
-
this.attachedTransform.
|
|
26
|
+
this.attachedTransform.fromMatrix(scratch_m4_0);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
link() {
|
|
@@ -51,6 +51,7 @@ export class Transform {
|
|
|
51
51
|
readonly scale: Vector3;
|
|
52
52
|
/**
|
|
53
53
|
* transform matrix, position, rotation, and scale must match, but shear can be different
|
|
54
|
+
* Note: this is managed by the Transform itself, do not modify the matrix directly. If you want to set it - use {@link fromMatrix} method instead
|
|
54
55
|
* @readonly
|
|
55
56
|
* @type {Float32Array}
|
|
56
57
|
*/
|
|
@@ -143,7 +144,9 @@ export class Transform {
|
|
|
143
144
|
};
|
|
144
145
|
};
|
|
145
146
|
/**
|
|
146
|
-
*
|
|
147
|
+
* Set this transform to match `other`.
|
|
148
|
+
* Afterward `this.equals(other) === true`.
|
|
149
|
+
* The `other` is unchanged in the process.
|
|
147
150
|
* @param {Transform} other
|
|
148
151
|
*/
|
|
149
152
|
copy(other: Transform): void;
|
|
@@ -153,7 +156,7 @@ export class Transform {
|
|
|
153
156
|
*/
|
|
154
157
|
clone(): Transform;
|
|
155
158
|
/**
|
|
156
|
-
*
|
|
159
|
+
* Strict equality check
|
|
157
160
|
* @param {Transform} other
|
|
158
161
|
* @returns {boolean}
|
|
159
162
|
*/
|
|
@@ -183,12 +186,13 @@ export class Transform {
|
|
|
183
186
|
* @param {mat4|number[]|Float32Array} matrix 4x4 affine matrix
|
|
184
187
|
* @returns {this}
|
|
185
188
|
*/
|
|
186
|
-
|
|
189
|
+
fromMatrix(matrix: mat4 | number[] | Float32Array): this;
|
|
187
190
|
/**
|
|
188
191
|
* Write out the current transform to a supplied container
|
|
189
|
-
* @param {number[]|Float32Array} result
|
|
192
|
+
* @param {number[]|Float32Array} [result] if not provided, `Float32Array` of size 16 will be created
|
|
193
|
+
* @returns {number[]} same as the input
|
|
190
194
|
*/
|
|
191
|
-
|
|
195
|
+
toMatrix(result?: number[] | Float32Array): number[];
|
|
192
196
|
/**
|
|
193
197
|
* reset transform, resulting transform is an identity matrix
|
|
194
198
|
* - position: [0,0,0]
|
|
@@ -212,6 +216,16 @@ export class Transform {
|
|
|
212
216
|
* }
|
|
213
217
|
*/
|
|
214
218
|
readonly isTransform: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* @readonly
|
|
221
|
+
* @deprecated use {@link Transform.prototype.toMatrix} instead
|
|
222
|
+
*/
|
|
223
|
+
readonly toMatrix4: (result?: number[] | Float32Array) => number[];
|
|
224
|
+
/**
|
|
225
|
+
* @readonly
|
|
226
|
+
* @deprecated use {@link Transform.prototype.fromMatrix} instead
|
|
227
|
+
*/
|
|
228
|
+
readonly fromMatrix4: (matrix: mat4 | number[] | Float32Array) => Transform;
|
|
215
229
|
#private;
|
|
216
230
|
}
|
|
217
231
|
export namespace Transform {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;GAaG;AACH;
|
|
1
|
+
{"version":3,"file":"Transform.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/transform/Transform.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;GAaG;AACH;IA6QI;;;;OAIG;IACH,4BAFa,SAAS,CAQrB;IAED;;;;OAIG;IACH,uBAHW,MAAM,EAAE,GAAC,YAAY,GACnB,SAAS,CAQrB;IA0FD;;;;;OAKG;IACH,wCAJW,UAAU,gBACV,OAAO,wBAejB;IA/YD;;;OAGG;IACH,mBAHU,OAAO,CAGe;IAEhC;;;;;OAKG;IACH,mBAHU,UAAU,CAGkB;IAEtC;;;OAGG;IACH,gBAHU,OAAO,CAGY;IAE7B;;;;;OAKG;IACH,iBAFU,YAAY,CAEC;IAEvB;;;;OAIG;IACH,OAFU,MAA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+BA1Ge,IAAI,GAAC,MAAM,EAAE,GAAC,YAAY,eA0GV;;CA7B9B;;kBAIS,MAAM;;oBAnbI,+BAA+B;uBAD5B,kCAAkC;+BAE1B,qBAAqB"}
|
|
@@ -58,6 +58,7 @@ export class Transform {
|
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* transform matrix, position, rotation, and scale must match, but shear can be different
|
|
61
|
+
* Note: this is managed by the Transform itself, do not modify the matrix directly. If you want to set it - use {@link fromMatrix} method instead
|
|
61
62
|
* @readonly
|
|
62
63
|
* @type {Float32Array}
|
|
63
64
|
*/
|
|
@@ -250,11 +251,13 @@ export class Transform {
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
/**
|
|
253
|
-
*
|
|
254
|
+
* Set this transform to match `other`.
|
|
255
|
+
* Afterward `this.equals(other) === true`.
|
|
256
|
+
* The `other` is unchanged in the process.
|
|
254
257
|
* @param {Transform} other
|
|
255
258
|
*/
|
|
256
259
|
copy(other) {
|
|
257
|
-
// prevent matrix from being
|
|
260
|
+
// prevent the matrix from being overridden
|
|
258
261
|
this.clearFlag(TransformFlags.AutomaticChangeDetection);
|
|
259
262
|
|
|
260
263
|
this.matrix.set(other.matrix);
|
|
@@ -281,7 +284,7 @@ export class Transform {
|
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
/**
|
|
284
|
-
*
|
|
287
|
+
* Strict equality check
|
|
285
288
|
* @param {Transform} other
|
|
286
289
|
* @returns {boolean}
|
|
287
290
|
*/
|
|
@@ -321,7 +324,7 @@ export class Transform {
|
|
|
321
324
|
static fromMatrix(mat) {
|
|
322
325
|
const result = new Transform();
|
|
323
326
|
|
|
324
|
-
result.
|
|
327
|
+
result.fromMatrix(mat);
|
|
325
328
|
|
|
326
329
|
return result;
|
|
327
330
|
}
|
|
@@ -351,7 +354,7 @@ export class Transform {
|
|
|
351
354
|
|
|
352
355
|
m4_multiply(scratch_matrix, a.matrix, b.matrix);
|
|
353
356
|
|
|
354
|
-
return this.
|
|
357
|
+
return this.fromMatrix(scratch_matrix);
|
|
355
358
|
}
|
|
356
359
|
|
|
357
360
|
/**
|
|
@@ -359,7 +362,7 @@ export class Transform {
|
|
|
359
362
|
* @param {mat4|number[]|Float32Array} matrix 4x4 affine matrix
|
|
360
363
|
* @returns {this}
|
|
361
364
|
*/
|
|
362
|
-
|
|
365
|
+
fromMatrix(matrix) {
|
|
363
366
|
assert.isArrayLike(matrix, 'matrix');
|
|
364
367
|
assert.greaterThanOrEqual(matrix.length, 16, 'matrix.length must be >= 16');
|
|
365
368
|
|
|
@@ -380,10 +383,14 @@ export class Transform {
|
|
|
380
383
|
|
|
381
384
|
/**
|
|
382
385
|
* Write out the current transform to a supplied container
|
|
383
|
-
* @param {number[]|Float32Array} result
|
|
386
|
+
* @param {number[]|Float32Array} [result] if not provided, `Float32Array` of size 16 will be created
|
|
387
|
+
* @returns {number[]} same as the input
|
|
384
388
|
*/
|
|
385
|
-
|
|
389
|
+
toMatrix(result = new Float32Array(16)) {
|
|
390
|
+
|
|
386
391
|
compose_matrix4_array(result, this.position, this.rotation, this.scale);
|
|
392
|
+
|
|
393
|
+
return result;
|
|
387
394
|
}
|
|
388
395
|
|
|
389
396
|
/**
|
|
@@ -393,7 +400,7 @@ export class Transform {
|
|
|
393
400
|
* - scale: [1,1,1]
|
|
394
401
|
*/
|
|
395
402
|
makeIdentity() {
|
|
396
|
-
this.
|
|
403
|
+
this.fromMatrix(MATRIX_4_IDENTITY);
|
|
397
404
|
}
|
|
398
405
|
|
|
399
406
|
/**
|
|
@@ -421,6 +428,8 @@ export class Transform {
|
|
|
421
428
|
targetVector,
|
|
422
429
|
limit = Infinity
|
|
423
430
|
) {
|
|
431
|
+
console.warn('deprecated, use Transform.rotation.rotateTowards instead');
|
|
432
|
+
|
|
424
433
|
const q = new Quaternion();
|
|
425
434
|
|
|
426
435
|
q.lookRotation(targetVector);
|
|
@@ -446,5 +455,17 @@ Transform.typeName = "Transform";
|
|
|
446
455
|
*/
|
|
447
456
|
Transform.prototype.isTransform = true;
|
|
448
457
|
|
|
458
|
+
/**
|
|
459
|
+
* @readonly
|
|
460
|
+
* @deprecated use {@link Transform.prototype.toMatrix} instead
|
|
461
|
+
*/
|
|
462
|
+
Transform.prototype.toMatrix4 = Transform.prototype.toMatrix
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* @readonly
|
|
466
|
+
* @deprecated use {@link Transform.prototype.fromMatrix} instead
|
|
467
|
+
*/
|
|
468
|
+
Transform.prototype.fromMatrix4 = Transform.prototype.fromMatrix
|
|
469
|
+
|
|
449
470
|
|
|
450
471
|
|
|
@@ -21,7 +21,7 @@ export function three_object_to_entity_composition(root) {
|
|
|
21
21
|
|
|
22
22
|
const transform = new Transform();
|
|
23
23
|
// initialize world transform
|
|
24
|
-
transform.
|
|
24
|
+
transform.fromMatrix(root.matrixWorld.elements);
|
|
25
25
|
|
|
26
26
|
entity.add(transform);
|
|
27
27
|
entity.add(new Name(root.name));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathFollowingSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/navigation/ecs/path_following/PathFollowingSystem.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"PathFollowingSystem.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/navigation/ecs/path_following/PathFollowingSystem.js"],"names":[],"mappings":";AAwHA;IACI,cAiBC;IAdG,sCAAkC;IAElC,iKAIC;IAED;;;;OAIG;IACH,qBAAqB;IAGzB;;;;;;OAMG;IACH,6BALW,YAAY,aACZ,SAAS,QACT,IAAI,UACJ,MAAM,QAuBhB;CAgBJ;uBAnLsB,wBAAwB;yBAGtB,mBAAmB;0BAFlB,qCAAqC;4CAFnB,uDAAuD;iBAGlF,uBAAuB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Quaternion from "../../../../core/geom/Quaternion.js";
|
|
1
2
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
2
3
|
import { min2 } from "../../../../core/math/min2.js";
|
|
3
4
|
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
@@ -12,7 +13,7 @@ import { PathFollowerFlags } from "./PathFollowerFlags.js";
|
|
|
12
13
|
const v3_forward = new Vector3();
|
|
13
14
|
const v3_temp1 = new Vector3();
|
|
14
15
|
const v3_temp2 = new Vector3();
|
|
15
|
-
|
|
16
|
+
const scratch_quaternion = new Quaternion();
|
|
16
17
|
/**
|
|
17
18
|
*
|
|
18
19
|
* @param {PathFollower} pathFollower
|
|
@@ -107,7 +108,8 @@ function performStep(pathFollower, path, transform, timeDelta) {
|
|
|
107
108
|
|
|
108
109
|
// console.log("Angular limit:", angularLimit, positionDelta.toJSON());
|
|
109
110
|
|
|
110
|
-
|
|
111
|
+
scratch_quaternion.lookRotation(positionDelta);
|
|
112
|
+
transform.rotation.rotateTowards(scratch_quaternion,angularLimit);
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
position.copy(nextPosition);
|