@woosh/meep-engine 2.118.9 → 2.118.12
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/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +209 -266
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +209 -266
- package/editor/ecs/component/editors/Sampler2DEditor.js +2 -4
- package/package.json +1 -1
- package/samples/terrain/editor.js +3 -3
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts +1 -19
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +10 -78
- package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +13 -11
- package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
- package/src/core/collection/array/isArrayEqualStrict.js +2 -2
- package/src/core/collection/array/iterator/ArrayIteratorSequential.d.ts.map +1 -1
- package/src/core/collection/array/iterator/ArrayIteratorSequential.js +3 -4
- package/src/core/collection/array/typed/array_buffer_copy.js +2 -2
- package/src/core/collection/array/typed/typed_array_copy.d.ts.map +1 -1
- package/src/core/collection/array/typed/typed_array_copy.js +16 -0
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +1 -1
- package/src/core/geom/3d/aabb/AABB3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/AABB3.js +0 -8
- package/src/core/geom/3d/aabb/aabb3_compute_surface_area.js +1 -3
- package/src/core/geom/3d/morton/{Morton.d.ts → v3_morton_encode.d.ts} +1 -1
- package/src/core/geom/3d/morton/v3_morton_encode.d.ts.map +1 -0
- package/src/core/geom/3d/morton/v3_morton_encode_bounded.js +2 -2
- package/src/core/geom/3d/morton/v3_morton_encode_transformed.js +2 -2
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +7 -10
- package/src/core/geom/Vector3.d.ts.map +1 -1
- package/src/core/geom/Vector3.js +4 -49
- package/src/core/math/sinc.d.ts +8 -0
- package/src/core/math/sinc.d.ts.map +1 -0
- package/src/core/math/sinc.js +13 -0
- package/src/core/process/worker/WorkerProxy.d.ts +12 -3
- package/src/core/process/worker/WorkerProxy.d.ts.map +1 -1
- package/src/core/process/worker/WorkerProxy.js +10 -1
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts +2 -17
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.d.ts.map +1 -1
- package/src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js +2 -118
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts +0 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js +1 -6
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts +5 -5
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js +20 -28
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/layers/TerrainLayer.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTile.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +3 -1
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.d.ts +1 -1
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +12 -12
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +14 -16
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts +17 -0
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/buffered/build_height_field_geometry.js +118 -0
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts +2 -2
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.d.ts.map +1 -1
- package/src/engine/graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js +1 -1
- package/src/engine/graphics/geometry/optimization/VertexCacheOptimizer.d.ts.map +1 -1
- package/src/engine/graphics/geometry/optimization/VertexCacheOptimizer.js +36 -22
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.d.ts.map +1 -1
- package/src/engine/graphics/material/optimization/MaterialOptimizationContext.js +2 -2
- package/src/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
- package/src/engine/graphics/texture/sampler/Sampler2D.d.ts.map +1 -1
- package/src/engine/graphics/texture/sampler/Sampler2D.js +31 -52
- package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts +10 -0
- package/src/engine/graphics/texture/sampler/sampler2d_to_texture.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{Sampler2D2Texture.js → sampler2d_to_texture.js} +5 -5
- package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.d.ts → sampler2d_transfer_data.d.ts} +2 -2
- package/src/engine/graphics/texture/sampler/sampler2d_transfer_data.d.ts.map +1 -0
- package/src/engine/graphics/texture/sampler/{copy_Sampler2D_channel_data.js → sampler2d_transfer_data.js} +1 -1
- package/src/engine/graphics/texture/sampler/writeSampler2DDataToDataTexture.js +2 -2
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.d.ts.map +1 -1
- package/src/engine/graphics/trail/x/simulator/RibbonXFixedPhysicsSimulator.js +0 -3
- package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts +6 -3
- package/src/engine/intelligence/behavior/selector/WeightedElement.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +9 -12
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.d.ts.map +1 -1
- package/src/engine/intelligence/behavior/selector/WeightedRandomBehavior.js +20 -23
- package/src/engine/intelligence/mcts/StateNode.d.ts.map +1 -1
- package/src/engine/intelligence/mcts/StateNode.js +76 -102
- package/src/engine/logging/Logger.d.ts.map +1 -1
- package/src/engine/logging/Logger.js +7 -9
- package/src/engine/logging/LoggerBackend.d.ts.map +1 -1
- package/src/engine/logging/LoggerBackend.js +7 -7
- package/src/core/geom/3d/morton/Morton.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts +0 -9
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +0 -11
- package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts +0 -14
- package/src/engine/graphics/geometry/MikkT/m_getPosition.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_getPosition.js +0 -20
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts +0 -21
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.d.ts.map +0 -1
- package/src/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +0 -22
- package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts +0 -10
- package/src/engine/graphics/texture/sampler/Sampler2D2Texture.d.ts.map +0 -1
- package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.d.ts.map +0 -1
- /package/src/core/geom/3d/morton/{Morton.js → v3_morton_encode.js} +0 -0
package/src/core/geom/Vector3.js
CHANGED
|
@@ -426,10 +426,10 @@ class Vector3 {
|
|
|
426
426
|
* @param {number} [squaredError]
|
|
427
427
|
* @return {boolean}
|
|
428
428
|
*/
|
|
429
|
-
isNormalized(squaredError =
|
|
429
|
+
isNormalized(squaredError = 1e-5) {
|
|
430
430
|
const lengthSq = this.lengthSqr();
|
|
431
431
|
|
|
432
|
-
return (lengthSq
|
|
432
|
+
return epsilonEquals(lengthSq, 1, squaredError);
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
/**
|
|
@@ -479,10 +479,6 @@ class Vector3 {
|
|
|
479
479
|
return v3_length_sqr(this.x - x, this.y - y, this.z - z);
|
|
480
480
|
}
|
|
481
481
|
|
|
482
|
-
distanceToSquared(other) {
|
|
483
|
-
return v3_length_sqr(this.x - other.x, this.y - other.y, this.z - other.z);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
482
|
/**
|
|
487
483
|
* Angle between two vectors (co-planar) in radians
|
|
488
484
|
* @param {Vector3} other
|
|
@@ -742,31 +738,6 @@ class Vector3 {
|
|
|
742
738
|
this._projectVectors(x0, y0, z0, x1, y1, z1);
|
|
743
739
|
}
|
|
744
740
|
|
|
745
|
-
/**
|
|
746
|
-
* Compute orthogonal vectors given a normal
|
|
747
|
-
* Orthogonal vectors are normalized vectors pointing at right angles away from the input normal and to one another
|
|
748
|
-
* @see https://stackoverflow.com/questions/3684269/component-of-a-quaternion-rotation-around-an-axis
|
|
749
|
-
* @param normal
|
|
750
|
-
* @param orthonormal1
|
|
751
|
-
* @param orthonormal2
|
|
752
|
-
*/
|
|
753
|
-
static findOrthonormals(normal, orthonormal1, orthonormal2) {
|
|
754
|
-
throw new Error('Not Implemented');
|
|
755
|
-
|
|
756
|
-
// Vector3 w = Vector3.Transform(normal, OrthoX);
|
|
757
|
-
// float dot = Vector3.Dot(normal, w);
|
|
758
|
-
// if (Math.Abs(dot) > 0.6)
|
|
759
|
-
// {
|
|
760
|
-
// w = Vector3.Transform(normal, OrthoY);
|
|
761
|
-
// }
|
|
762
|
-
// w.Normalize();
|
|
763
|
-
//
|
|
764
|
-
// orthonormal1 = Vector3.Cross(normal, w);
|
|
765
|
-
// orthonormal1.Normalize();
|
|
766
|
-
// orthonormal2 = Vector3.Cross(normal, orthonormal1);
|
|
767
|
-
// orthonormal2.Normalize();
|
|
768
|
-
}
|
|
769
|
-
|
|
770
741
|
/**
|
|
771
742
|
* Project first vector onto second one
|
|
772
743
|
* @param {number} x0
|
|
@@ -907,24 +878,6 @@ class Vector3 {
|
|
|
907
878
|
this.set(x, y, z);
|
|
908
879
|
}
|
|
909
880
|
|
|
910
|
-
/**
|
|
911
|
-
*
|
|
912
|
-
* @param {BinaryBuffer} buffer
|
|
913
|
-
* @deprecated use dedicated method directly instead
|
|
914
|
-
*/
|
|
915
|
-
toBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
916
|
-
throw new Error('deprecated, use v3_binary_equality_encode')
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Uses an extra byte for a header. Only writes unique components. Useful for things like scale where all components usually have the same value
|
|
921
|
-
* @param {BinaryBuffer} buffer
|
|
922
|
-
* @deprecated use dedicated method directly instead
|
|
923
|
-
*/
|
|
924
|
-
fromBinaryBufferFloat32_EqualityEncoded(buffer) {
|
|
925
|
-
throw new Error('deprecated, use v3_binary_equality_decode')
|
|
926
|
-
}
|
|
927
|
-
|
|
928
881
|
hash() {
|
|
929
882
|
const x = computeHashFloat(this.x);
|
|
930
883
|
const y = computeHashFloat(this.y);
|
|
@@ -1012,6 +965,8 @@ class Vector3 {
|
|
|
1012
965
|
|
|
1013
966
|
// Aliases
|
|
1014
967
|
|
|
968
|
+
Vector3.prototype.distanceToSquared = Vector3.prototype.distanceSqrTo;
|
|
969
|
+
|
|
1015
970
|
Vector3.prototype.lengthSq = Vector3.prototype.lengthSqr;
|
|
1016
971
|
Vector3.prototype.fromArray = Vector3.prototype.readFromArray;
|
|
1017
972
|
Vector3.prototype.toArray = Vector3.prototype.writeToArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sinc.d.ts","sourceRoot":"","sources":["../../../../src/core/math/sinc.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAHW,MAAM,GACL,MAAM,CAQjB"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export default WorkerProxy;
|
|
2
2
|
declare class WorkerProxy {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {string} url
|
|
6
|
+
* @param {Object} methods
|
|
7
|
+
*/
|
|
8
|
+
constructor(url: string, methods: any);
|
|
4
9
|
/**
|
|
5
10
|
*
|
|
6
11
|
* @type {{}}
|
|
@@ -20,7 +25,7 @@ declare class WorkerProxy {
|
|
|
20
25
|
* @private
|
|
21
26
|
*/
|
|
22
27
|
private __id_counter;
|
|
23
|
-
url:
|
|
28
|
+
url: string;
|
|
24
29
|
methods: any;
|
|
25
30
|
/**
|
|
26
31
|
* Invoke a given method on the worker, as defined by the `WorkerBuilder`
|
|
@@ -36,7 +41,11 @@ declare class WorkerProxy {
|
|
|
36
41
|
* @private
|
|
37
42
|
*/
|
|
38
43
|
private __makeMethod;
|
|
39
|
-
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private __generateAPI;
|
|
40
49
|
/**
|
|
41
50
|
*
|
|
42
51
|
* @param {Event} event
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";AAqCA;IA0BI,
|
|
1
|
+
{"version":3,"file":"WorkerProxy.d.ts","sourceRoot":"","sources":["../../../../../src/core/process/worker/WorkerProxy.js"],"names":[],"mappings":";AAqCA;IA0BI;;;;OAIG;IACH,iBAHW,MAAM,gBAQhB;IAlCD;;;;OAIG;IACH,kBAAe;IAEf,qBAAoB;IAEpB;;;;OAIG;IACH,iBAAgB;IAEhB;;;;OAIG;IACH,qBAAiB;IASb,YAAc;IACd,aAAsB;IAK1B;;;;;;OAMG;IACH,wBAJW,MAAM,2BAmDhB;IAED;;;;OAIG;IACH,qBAeC;IAED;;;OAGG;IACH,sBAQC;IAED;;;;OAIG;IACH,wBAqCC;IAED,qBAEC;IAED,aAOC;IAED;;;;;OAKG;IACH,kBAJW,MAAM,eACN,MAAM,GACJ,OAAO,CAkCnB;IAED,4BAmBC;IAED,cAiBC;CACJ"}
|
|
@@ -61,11 +61,16 @@ class WorkerProxy {
|
|
|
61
61
|
__id_counter = 0;
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {string} url
|
|
67
|
+
* @param {Object} methods
|
|
68
|
+
*/
|
|
64
69
|
constructor(url, methods) {
|
|
65
70
|
this.url = url;
|
|
66
71
|
this.methods = methods;
|
|
67
72
|
|
|
68
|
-
this.__generateAPI(
|
|
73
|
+
this.__generateAPI();
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
/**
|
|
@@ -146,6 +151,10 @@ class WorkerProxy {
|
|
|
146
151
|
|
|
147
152
|
}
|
|
148
153
|
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
149
158
|
__generateAPI() {
|
|
150
159
|
|
|
151
160
|
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
export default Builder;
|
|
2
2
|
declare namespace Builder {
|
|
3
|
-
export {
|
|
3
|
+
export { build_height_field_geometry as build };
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* @param {Sampler2D} samplerHeight
|
|
8
|
-
* @param {Vector2} position
|
|
9
|
-
* @param {Vector2} size
|
|
10
|
-
* @param {Vector2} scale
|
|
11
|
-
* @param {Vector2} totalSize
|
|
12
|
-
* @param {number} resolution
|
|
13
|
-
* @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
|
|
14
|
-
*/
|
|
15
|
-
declare function buildBufferGeometry(samplerHeight: Sampler2D, position: Vector2, size: Vector2, scale: Vector2, totalSize: Vector2, resolution: number): {
|
|
16
|
-
indices: any;
|
|
17
|
-
vertices: Float32Array;
|
|
18
|
-
normals: Float32Array;
|
|
19
|
-
uvs: Float32Array;
|
|
20
|
-
};
|
|
5
|
+
import { build_height_field_geometry } from "../../graphics/geometry/buffered/build_height_field_geometry.js";
|
|
21
6
|
//# sourceMappingURL=BufferedGeometryArraysBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BufferedGeometryArraysBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"BufferedGeometryArraysBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/terrain/BufferedGeometryArraysBuilder.js"],"names":[],"mappings":";;;;4CAA4C,iEAAiE"}
|
|
@@ -1,123 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
geometry_compute_vertex_normals_indexed
|
|
3
|
-
} from '../../graphics/geometry/buffered/geometry_compute_vertex_normals_indexed.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {Sampler2D} samplerHeight
|
|
8
|
-
* @param {Vector2} position
|
|
9
|
-
* @param {Vector2} size
|
|
10
|
-
* @param {Vector2} scale
|
|
11
|
-
* @param {Vector2} totalSize
|
|
12
|
-
* @param {number} resolution
|
|
13
|
-
* @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
|
|
14
|
-
*/
|
|
15
|
-
function buildBufferGeometry(samplerHeight, position, size, scale, totalSize, resolution) {
|
|
16
|
-
|
|
17
|
-
const width = size.x;
|
|
18
|
-
const height = size.y;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const gridX1 = width * resolution;
|
|
22
|
-
const gridY1 = height * resolution;
|
|
23
|
-
|
|
24
|
-
const gridX2 = gridX1 - 1;
|
|
25
|
-
const gridY2 = gridY1 - 1;
|
|
26
|
-
|
|
27
|
-
let offset = 0, offset2 = 0;
|
|
28
|
-
|
|
29
|
-
const vertexCount = gridX1 * gridY1;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const vertices = new Float32Array(vertexCount * 3);
|
|
33
|
-
|
|
34
|
-
const normals = new Float32Array(vertexCount * 3);
|
|
35
|
-
|
|
36
|
-
const uvs = new Float32Array(vertexCount * 2);
|
|
37
|
-
|
|
38
|
-
let y, x;
|
|
39
|
-
|
|
40
|
-
const vMultiplier = (size.y / totalSize.y) / gridY2;
|
|
41
|
-
const uMultiplier = (size.x / totalSize.x) / gridX2;
|
|
42
|
-
|
|
43
|
-
const vConst = position.y / totalSize.y;
|
|
44
|
-
const uConst = position.x / totalSize.x;
|
|
45
|
-
|
|
46
|
-
const totalScaledSizeX = totalSize.x * scale.x;
|
|
47
|
-
const totalScaledSizeY = totalSize.y * scale.y;
|
|
48
|
-
|
|
49
|
-
//fill vertices
|
|
50
|
-
let px, py, pz;
|
|
51
|
-
for (y = 0; y < gridY1; y++) {
|
|
52
|
-
|
|
53
|
-
const v = y * vMultiplier + vConst;
|
|
54
|
-
|
|
55
|
-
pz = v * totalScaledSizeY;
|
|
56
|
-
|
|
57
|
-
for (x = 0; x < gridX1; x++) {
|
|
58
|
-
|
|
59
|
-
const u = x * uMultiplier + uConst;
|
|
60
|
-
|
|
61
|
-
//get height sample
|
|
62
|
-
const val = samplerHeight.sampleChannelBicubicUV(u, v, 0);
|
|
63
|
-
|
|
64
|
-
px = u * totalScaledSizeX;
|
|
65
|
-
py = val;
|
|
66
|
-
|
|
67
|
-
vertices[offset] = px;
|
|
68
|
-
vertices[offset + 1] = py;
|
|
69
|
-
vertices[offset + 2] = pz;
|
|
70
|
-
|
|
71
|
-
uvs[offset2] = u;
|
|
72
|
-
uvs[offset2 + 1] = v;
|
|
73
|
-
|
|
74
|
-
offset += 3;
|
|
75
|
-
offset2 += 2;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
offset = 0;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @type {Uint16Array|Uint32Array}
|
|
83
|
-
*/
|
|
84
|
-
const indices = new ((vertices.length / 3) > 65535 ? Uint32Array : Uint16Array)(gridX2 * gridY2 * 6);
|
|
85
|
-
|
|
86
|
-
//add faces
|
|
87
|
-
//TODO TraingleStip mode is more efficient in terms of memory usage and probably GPU-time
|
|
88
|
-
for (y = 0; y < gridY2; y++) {
|
|
89
|
-
|
|
90
|
-
for (x = 0; x < gridX2; x++) {
|
|
91
|
-
const a = x + gridX1 * y;
|
|
92
|
-
const b = x + gridX1 * (y + 1);
|
|
93
|
-
const c = (x + 1) + gridX1 * (y + 1);
|
|
94
|
-
const d = (x + 1) + gridX1 * y;
|
|
95
|
-
|
|
96
|
-
indices[offset] = a;
|
|
97
|
-
indices[offset + 1] = b;
|
|
98
|
-
indices[offset + 2] = d;
|
|
99
|
-
|
|
100
|
-
indices[offset + 3] = b;
|
|
101
|
-
indices[offset + 4] = c;
|
|
102
|
-
indices[offset + 5] = d;
|
|
103
|
-
|
|
104
|
-
offset += 6;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
geometry_compute_vertex_normals_indexed(vertices, normals, indices);
|
|
109
|
-
|
|
110
|
-
//CleanupGeometry(geometry);
|
|
111
|
-
return {
|
|
112
|
-
indices: indices,
|
|
113
|
-
vertices: vertices,
|
|
114
|
-
normals: normals,
|
|
115
|
-
uvs: uvs
|
|
116
|
-
};
|
|
117
|
-
}
|
|
1
|
+
import { build_height_field_geometry } from "../../graphics/geometry/buffered/build_height_field_geometry.js";
|
|
118
2
|
|
|
119
3
|
const Builder = {
|
|
120
|
-
build:
|
|
4
|
+
build: build_height_field_geometry
|
|
121
5
|
};
|
|
122
6
|
|
|
123
7
|
export default Builder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClingToTerrain.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js"],"names":[],"mappings":";AAGA;
|
|
1
|
+
{"version":3,"file":"ClingToTerrain.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrain.js"],"names":[],"mappings":";AAGA;IAyDI;;;;OAIG;IACH,4BAFa,cAAc,CAQ1B;IAnED;;OAEG;IACH,aAFU,OAAO,CAEG;IACpB;;;OAGG;IACH,gBAFU,OAAO,CAEqB;IACtC;;;OAGG;IACH,gBAFU,UAAU,CAEwB;IAE5C;;;OAGG;IACH,eAFU,MAAM,CAEE;IAElB;;;;OAIG;IACH,cAHW,cAAc,GACZ,OAAO,CAKnB;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;MAKC;IAED;;;aAQC;CAcJ;;;;oBAvEmB,qCAAqC;uBADlC,wCAAwC"}
|
|
@@ -16,18 +16,13 @@ class ClingToTerrain {
|
|
|
16
16
|
* @type {Quaternion}
|
|
17
17
|
*/
|
|
18
18
|
__lastRotation = new Quaternion(0, 0, 0, 1);
|
|
19
|
+
|
|
19
20
|
/**
|
|
20
21
|
* Speed in Rad/s (Radians/second) by which rotation can change
|
|
21
22
|
* @type {number}
|
|
22
23
|
*/
|
|
23
24
|
rotationSpeed = 3;
|
|
24
25
|
|
|
25
|
-
constructor(opt) {
|
|
26
|
-
if (opt !== undefined) {
|
|
27
|
-
throw new Error("constructor options deprecated");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
/**
|
|
32
27
|
*
|
|
33
28
|
* @param {ClingToTerrain} other
|
|
@@ -11,10 +11,6 @@ export default ClingToTerrainSystem;
|
|
|
11
11
|
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
12
12
|
import Vector3 from '../../../../../core/geom/Vector3.js';
|
|
13
13
|
declare class ClingToTerrainSystem extends System<any, any, any, any, any> {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
14
|
constructor();
|
|
19
15
|
dependencies: (typeof Transform | typeof ClingToTerrain)[];
|
|
20
16
|
components_used: (ResourceAccessSpecification<typeof Transform> | ResourceAccessSpecification<typeof Terrain>)[];
|
|
@@ -29,7 +25,11 @@ declare class ClingToTerrainSystem extends System<any, any, any, any, any> {
|
|
|
29
25
|
* @type {number}
|
|
30
26
|
*/
|
|
31
27
|
updateBatchLimit: number;
|
|
32
|
-
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {number} entity
|
|
31
|
+
*/
|
|
32
|
+
requestUpdate(entity: number): void;
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
35
|
* @param {Transform} transform
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClingToTerrainSystem.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/cling/ClingToTerrainSystem.js"],"names":[],"mappings":"AA2LA;;;;;;;GAOG;AACH,wCANW,UAAU,aACV,OAAO,gBACP,MAAM,yCAgDhB;;uBA3OsB,wCAAwC;oBAE3C,qCAAqC;AAyCzD;IA5CmB,cAAmB;IA+ClC,2DAA2C;IAG3C,iHAGE;IAEF;;;OAGG;IACH,aAFU,MAAM,MAAM,CAAC,CAEG;IAE1B,YAAU;IAEV;;;OAGG;IACH,kBAFU,MAAM,CAEwB;IAExC;;;OAGG;IACH,sBAFW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,YAHW,cAAc,aADd,SAAS,uBAkBnB;IAED;;;;;OAKG;IACH,cAHW,cAAc,aADd,SAAS,uBAkBnB;IAED,6BAiDC;CACJ;uBArKsB,oBAAoB;0BACjB,iCAAiC;2BAIhC,qBAAqB;4CANJ,0DAA0D;oBAIlF,eAAe;sBAbb,+CAA+C"}
|
|
@@ -46,42 +46,34 @@ function deregister(datum) {
|
|
|
46
46
|
const DEFAULT_UPDATE_LIMIT = 1024;
|
|
47
47
|
|
|
48
48
|
class ClingToTerrainSystem extends System {
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @constructor
|
|
52
|
-
*/
|
|
53
|
-
constructor() {
|
|
54
|
-
super();
|
|
55
49
|
|
|
56
|
-
this.dependencies = [ClingToTerrain, Transform];
|
|
57
50
|
|
|
51
|
+
dependencies = [ClingToTerrain, Transform];
|
|
58
52
|
|
|
59
|
-
this.components_used = [
|
|
60
|
-
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
61
|
-
ResourceAccessSpecification.from(Terrain, ResourceAccessKind.Read)
|
|
62
|
-
];
|
|
63
53
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.entityManager = null;
|
|
54
|
+
components_used = [
|
|
55
|
+
ResourceAccessSpecification.from(Transform, ResourceAccessKind.Read | ResourceAccessKind.Write),
|
|
56
|
+
ResourceAccessSpecification.from(Terrain, ResourceAccessKind.Read)
|
|
57
|
+
];
|
|
69
58
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @type {Deque<number>}
|
|
62
|
+
*/
|
|
63
|
+
updateQueue = new Deque();
|
|
75
64
|
|
|
76
|
-
|
|
65
|
+
data = [];
|
|
77
66
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
67
|
+
/**
|
|
68
|
+
* How many entities can be updated in a single tick, this is useful for performance optimization, if you have a large number of entities that need to be updated, updates can be executed over several ticks
|
|
69
|
+
* @type {number}
|
|
70
|
+
*/
|
|
71
|
+
updateBatchLimit = DEFAULT_UPDATE_LIMIT;
|
|
84
72
|
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param {number} entity
|
|
76
|
+
*/
|
|
85
77
|
requestUpdate(entity) {
|
|
86
78
|
if (!this.updateQueue.has(entity)) {
|
|
87
79
|
//queue up update
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainLayer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayer.js"],"names":[],"mappings":"AA2BA;IA+CI;;;;;OAKG;IACH,iBAJW,MAAM,SACN,MAAM,UACN,MAAM,gBAShB;IAED;;;;OAIG;IACH,oDAFa,YAAY,CAQxB;IAvED;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,WAAW;IAEX;;;OAGG;IACH,WAFU,MAAM,CAES;IAGzB;;;;MAMC;IAED;;;;aAIC;IA8BD;;;;OAIG;IACH,0DAwDC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;
|
|
1
|
+
{"version":3,"file":"TerrainLayer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayer.js"],"names":[],"mappings":"AA2BA;IA+CI;;;;;OAKG;IACH,iBAJW,MAAM,SACN,MAAM,UACN,MAAM,gBAShB;IAED;;;;OAIG;IACH,oDAFa,YAAY,CAQxB;IAvED;;;OAGG;IACH,0BAAuB;IAEvB;;;OAGG;IACH,SAFU,SAAS,CAEgB;IAEnC;;;OAGG;IACH,MAFU,OAAO,CAEQ;IAEzB;;;OAGG;IACH,WAAW;IAEX;;;OAGG;IACH,WAFU,MAAM,CAES;IAGzB;;;;MAMC;IAED;;;;aAIC;IA8BD;;;;OAIG;IACH,0DAwDC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;0BA9JyB,mDAAmD;oBAJzD,qCAAqC;mBADtC,6CAA6C"}
|
|
@@ -4,8 +4,8 @@ import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
|
4
4
|
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
|
|
5
5
|
import { string_compute_byte_size } from "../../../../../core/primitives/strings/string_compute_byte_size.js";
|
|
6
6
|
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
7
|
-
import { copy_Sampler2D_channel_data } from "../../../../graphics/texture/sampler/copy_Sampler2D_channel_data.js";
|
|
8
7
|
import { Sampler2D } from "../../../../graphics/texture/sampler/Sampler2D.js";
|
|
8
|
+
import { sampler2d_transfer_data } from "../../../../graphics/texture/sampler/sampler2d_transfer_data.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
@@ -149,7 +149,7 @@ export class TerrainLayer {
|
|
|
149
149
|
|
|
150
150
|
const source = new Sampler2D(source_data, source_item_size, image.width, image.height);
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
sampler2d_transfer_data(source, this.diffuse);
|
|
153
153
|
|
|
154
154
|
this.onChanged.send0();
|
|
155
155
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainTile.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTile.js"],"names":[],"mappings":";AAgCA;;GAEG;AACH;IACI,sBAA6B;IAC7B,eAA0B;IAC1B,
|
|
1
|
+
{"version":3,"file":"TerrainTile.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/ecs/terrain/tiles/TerrainTile.js"],"names":[],"mappings":";AAgCA;;GAEG;AACH;IACI,sBAA6B;IAC7B,eAA0B;IAC1B,cAAyB;IACzB,kBAAyB;IACzB,4BAAoC;IAEpC;;;OAGG;IACH,mBAAgB;IAChB,uGAAiE;IAGjE;;;OAGG;IACH,UAFU,MAAM,cAAc,CAEd;IAEhB;;;OAGG;IACH,WAFU,OAAO,CAEA;IAEjB;;;OAGG;IACH,cAFU,SAAS,CAEY;IAE/B;;;OAGG;IACH,KAFU,eAAe,CAEd;IAEX;;;OAGG;IACH,SAFU,OAAO,CAED;IAChB;;;OAGG;IACH,mBAFU,OAAO,CAES;IAC1B,uBAAmB;IAEnB;;;OAGG;IACH,SAFU,OAAO,WAAW,CAAC,CAEN;IACvB,4DAA2B;IAE3B;;;;OAIG;IACH,kBAWE;IAEF;;;;;OAKG;IACH,+BAAiG;IAEjG;;;OAGG;IACH,SAFU,MAAM,CAEJ;IAqBZ;;;OAGG;IACH,6BAGC;IAfD;;;OAGG;IACH,0BAEC;IAWD;;;;;;;;;;OAUG;IACH,yBATW,aAAa,WACb,MAAM,WACN,MAAM,WACN,MAAM,cACN,MAAM,cACN,MAAM,cACN,MAAM,GACL,OAAO,CAkDlB;IAED,+CAKC;IAED,8CAOC;IAED;;;;;;;;;;OAUG;IACH,mBATW,WAAW,GAAC,SAAS,UACrB,WAAW,GAAC,SAAS,QACrB,WAAW,GAAC,SAAS,SACrB,WAAW,GAAC,SAAS,WACrB,WAAW,GAAC,SAAS,YACrB,WAAW,GAAC,SAAS,cACrB,WAAW,GAAC,SAAS,eACrB,WAAW,GAAC,SAAS,QAsN/B;IAED,2BAmFC;IAED;;;;OAIG;IACH,mCAHW,MAAM,cACN,MAAM,QAIhB;IAED,gBAYC;IAED;;;;OAIG;IACH,gBAHW;QAAC,QAAQ,CAAC;QAAC,GAAG,CAAC,EAAC;YAAC,UAAU,EAAC,MAAM,CAAC;YAAC,IAAI,EAAC,WAAW,CAAA;SAAC,CAAA;KAAC,QAoDhE;CACJ;oBAzlBmB,kCAAkC;4BAG1B,2CAA2C;sDAZhE,OAAO;0BAEY,yCAAyC;gCADnC,mDAAmD;mBAGhE,0CAA0C;8BAI/B,2CAA2C"}
|
|
@@ -36,7 +36,7 @@ const m4_tmp = [];
|
|
|
36
36
|
class TerrainTile {
|
|
37
37
|
gridPosition = new Vector2();
|
|
38
38
|
scale = new Vector2(1, 1);
|
|
39
|
-
size = new Vector2();
|
|
39
|
+
size = new Vector2(1, 1);
|
|
40
40
|
position = new Vector2();
|
|
41
41
|
resolution = new ObservedInteger(1);
|
|
42
42
|
|
|
@@ -506,6 +506,7 @@ class TerrainTile {
|
|
|
506
506
|
|
|
507
507
|
geometry.boundingSphere = new ThreeSphere(center, radius);
|
|
508
508
|
}
|
|
509
|
+
|
|
509
510
|
//pull bounding box from geometry
|
|
510
511
|
|
|
511
512
|
bb = geometry.boundingBox;
|
|
@@ -513,6 +514,7 @@ class TerrainTile {
|
|
|
513
514
|
geometry.computeBoundingBox();
|
|
514
515
|
bb = geometry.boundingBox;
|
|
515
516
|
}
|
|
517
|
+
|
|
516
518
|
}
|
|
517
519
|
|
|
518
520
|
const x0 = bb.min.x;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { vec3 } from "gl-matrix";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { STSpace } from "./STSpace.js";
|
|
2
|
+
import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
|
|
3
|
+
import { DEG_TO_RAD } from "../../../../core/math/DEG_TO_RAD.js";
|
|
4
|
+
import { Build4RuleGroups } from "./Build4RuleGroups.js";
|
|
6
5
|
import { MARK_DEGENERATE } from "./constants/MARK_DEGENERATE.js";
|
|
7
|
-
import { InitTriInfo } from "./InitTriInfo.js";
|
|
8
|
-
import { GenerateTSpaces } from "./GenerateTSpaces.js";
|
|
9
6
|
import { DegenEpilogue } from "./DegenEpilogue.js";
|
|
10
|
-
import { Build4RuleGroups } from "./Build4RuleGroups.js";
|
|
11
|
-
import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
|
|
12
|
-
import { m_getNumFaces } from "./m_getNumFaces.js";
|
|
13
|
-
import { GenerateInitialVerticesIndexList } from "./GenerateInitialVerticesIndexList.js";
|
|
14
7
|
import { DegenPrologue } from "./DegenPrologue.js";
|
|
8
|
+
import { GenerateInitialVerticesIndexList } from "./GenerateInitialVerticesIndexList.js";
|
|
15
9
|
import { GenerateSharedVerticesIndexList } from "./GenerateSharedVerticesIndexList.js";
|
|
16
|
-
import {
|
|
10
|
+
import { GenerateTSpaces } from "./GenerateTSpaces.js";
|
|
11
|
+
import { GetPosition } from "./GetPosition.js";
|
|
12
|
+
import { InitTriInfo } from "./InitTriInfo.js";
|
|
13
|
+
import { m_getNumFaces } from "./m_getNumFaces.js";
|
|
14
|
+
import { m_setTSpace } from "./m_setTSpace.js";
|
|
15
|
+
import { malloc } from "./malloc.js";
|
|
16
|
+
import { STSpace } from "./STSpace.js";
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
/*
|
|
@@ -158,7 +158,7 @@ export class SMikkTSpaceContext {
|
|
|
158
158
|
/**
|
|
159
159
|
*
|
|
160
160
|
* @param {SMikkTSpaceContext} pContext
|
|
161
|
-
* @param {number} fAngularThreshold
|
|
161
|
+
* @param {number} [fAngularThreshold]
|
|
162
162
|
* @return {boolean}
|
|
163
163
|
*/
|
|
164
164
|
export function genTangSpace(pContext, fAngularThreshold = 180) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"STSpace.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/MikkT/STSpace.js"],"names":[],"mappings":";AAGA;
|
|
1
|
+
{"version":3,"file":"STSpace.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/MikkT/STSpace.js"],"names":[],"mappings":";AAGA;IACI;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEP;IACpB;;;OAGG;IACH,KAFU,IAAI,GAAC,YAAY,CAEP;IAEpB,cAAU;IACV,cAAU;IAEV,iBAAa;IACb,iBAAgB;IAEhB;;;OAGG;IACH,YAFW,OAAO,QASjB;CACJ;qBAjCoB,WAAW"}
|
|
@@ -2,24 +2,22 @@ import { vec3 } from "gl-matrix";
|
|
|
2
2
|
import { v3_allocate } from "../../../../core/geom/vec3/v3_allocate.js";
|
|
3
3
|
|
|
4
4
|
export class STSpace {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.vOt = v3_allocate();
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @type {vec3|Float32Array}
|
|
8
|
+
*/
|
|
9
|
+
vOs = v3_allocate();
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @type {vec3|Float32Array}
|
|
13
|
+
*/
|
|
14
|
+
vOt = v3_allocate();
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
fMagS = 0;
|
|
17
|
+
fMagT = 0;
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
iCounter = 0; // this is to average back into quads.
|
|
20
|
+
bOrient = false;
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
*
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Sampler2D} samplerHeight
|
|
4
|
+
* @param {Vector2} position
|
|
5
|
+
* @param {Vector2} size
|
|
6
|
+
* @param {Vector2} scale
|
|
7
|
+
* @param {Vector2} totalSize
|
|
8
|
+
* @param {number} resolution
|
|
9
|
+
* @returns {{indices, vertices: Float32Array, normals: Float32Array, uvs: Float32Array}}
|
|
10
|
+
*/
|
|
11
|
+
export function build_height_field_geometry(samplerHeight: Sampler2D, position: Vector2, size: Vector2, scale: Vector2, totalSize: Vector2, resolution: number): {
|
|
12
|
+
indices: any;
|
|
13
|
+
vertices: Float32Array;
|
|
14
|
+
normals: Float32Array;
|
|
15
|
+
uvs: Float32Array;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=build_height_field_geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_height_field_geometry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/build_height_field_geometry.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wJAHW,MAAM;;cACgB,YAAY;aAAW,YAAY;SAAO,YAAY;EA0GtF"}
|