@woosh/meep-engine 2.42.0 → 2.42.2
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/assert.js +2 -2
- package/core/collection/RingBuffer.js +15 -0
- package/core/collection/array/array_swap.js +3 -3
- package/core/collection/map/AsyncLoadingCache.js +47 -0
- package/core/geom/3d/aabb/aabb3_compute_distance_above_plane_max.js +1 -1
- package/core/math/statistics/computeSampleSize_Cochran.js +3 -3
- package/editor/ecs/component/editors/geom/QuaternionEditor.js +12 -5
- package/engine/Engine.js +6 -1
- package/engine/EngineBootstrapper.js +2 -1
- package/engine/EngineHarness.js +5 -1
- package/engine/asset/AssetManager.js +97 -7
- package/engine/development/performance/AbstractMetric.js +3 -1
- package/engine/development/performance/RingBufferMetric.js +39 -4
- package/engine/ecs/EntityBuilder.js +29 -4
- package/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +17 -1
- package/engine/graphics/ecs/decal/v2/FPDecalSystem.js +18 -30
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +57 -16
- package/engine/graphics/ecs/mesh-v2/allocate_v3.js +37 -0
- package/engine/graphics/geometry/MikkT/AddTriToGroup.js +10 -0
- package/engine/graphics/geometry/MikkT/AssignRecur.js +84 -0
- package/engine/graphics/geometry/MikkT/AvgTSpace.js +38 -0
- package/engine/graphics/geometry/MikkT/Build4RuleGroups.js +96 -0
- package/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +137 -0
- package/engine/graphics/geometry/MikkT/CalcTexArea.js +31 -0
- package/engine/graphics/geometry/MikkT/CompareSubGroups.js +26 -0
- package/engine/graphics/geometry/MikkT/DegenEpilogue.js +220 -0
- package/engine/graphics/geometry/MikkT/DegenPrologue.js +115 -0
- package/engine/graphics/geometry/MikkT/EvalTspace.js +128 -0
- package/engine/graphics/geometry/MikkT/GenerateInitialVerticesIndexList.js +48 -0
- package/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +184 -0
- package/engine/graphics/geometry/MikkT/GenerateTSpaces.js +226 -0
- package/engine/graphics/geometry/MikkT/GetEdge.js +45 -0
- package/engine/graphics/geometry/MikkT/GetNormal.js +16 -0
- package/engine/graphics/geometry/MikkT/GetPosition.js +25 -0
- package/engine/graphics/geometry/MikkT/GetTexCoord.js +18 -0
- package/engine/graphics/geometry/MikkT/InitTriInfo.js +180 -0
- package/engine/graphics/geometry/MikkT/Length.js +10 -0
- package/engine/graphics/geometry/MikkT/MakeIndex.js +18 -0
- package/engine/graphics/geometry/MikkT/MikkTSpace.js +165 -2197
- package/engine/graphics/geometry/MikkT/NormalizeSafe.js +21 -0
- package/engine/graphics/geometry/MikkT/NotZero.js +10 -0
- package/engine/graphics/geometry/MikkT/QuickSort.js +54 -0
- package/engine/graphics/geometry/MikkT/QuickSortEdges.js +71 -0
- package/engine/graphics/geometry/MikkT/SSubGroup.js +15 -0
- package/engine/graphics/geometry/MikkT/STSpace.js +36 -0
- package/engine/graphics/geometry/MikkT/constants/GROUP_WITH_ANY.js +1 -0
- package/engine/graphics/geometry/MikkT/constants/INTERNAL_RND_SORT_SEED.js +1 -0
- package/engine/graphics/geometry/MikkT/constants/MARK_DEGENERATE.js +1 -0
- package/engine/graphics/geometry/MikkT/constants/ORIENT_PRESERVING.js +1 -0
- package/engine/graphics/geometry/MikkT/constants/QUAD_ONE_DEGEN_TRI.js +1 -0
- package/engine/graphics/geometry/MikkT/m_getNormal.js +16 -0
- package/engine/graphics/geometry/MikkT/m_getNumFaces.js +8 -0
- package/engine/graphics/geometry/MikkT/m_getNumVerticesOfFace.js +11 -0
- package/engine/graphics/geometry/MikkT/m_getPosition.js +20 -0
- package/engine/graphics/geometry/MikkT/m_getTexCoord.js +16 -0
- package/engine/graphics/geometry/MikkT/m_setTSpace.js +35 -0
- package/engine/graphics/geometry/MikkT/m_setTSpaceBasic.js +22 -0
- package/engine/graphics/geometry/MikkT/malloc.js +16 -0
- package/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +52 -0
- package/engine/graphics/impostors/octahedral/ImpostorBaker.js +3 -2
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +5 -5
- package/engine/graphics/render/forward_plus/LightManager.js +16 -6
- package/engine/graphics/render/forward_plus/data/TextureBackedMemoryRegion.js +7 -1
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +13 -3
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +2 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +14 -2
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +2 -2
- package/engine/intelligence/behavior/util/RotationBehavior.js +69 -0
- package/generation/example/filters/SampleGroundMoistureFilter.js +5 -5
- package/package.json +1 -1
|
@@ -36,6 +36,10 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
36
36
|
type: 't',
|
|
37
37
|
value: light_manager.getTextureDecalAtlas()
|
|
38
38
|
},
|
|
39
|
+
fp_t_decal_atlas_resolution: {
|
|
40
|
+
type: 't',
|
|
41
|
+
value: new Vector2(1, 1)
|
|
42
|
+
},
|
|
39
43
|
fp_f_camera_near: {
|
|
40
44
|
type: 'f',
|
|
41
45
|
value: 0
|
|
@@ -71,8 +75,16 @@ export class MaterialTransformer extends AbstractMaterialTransformer {
|
|
|
71
75
|
* @param {CameraView} c
|
|
72
76
|
*/
|
|
73
77
|
updateCamera(c) {
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
const us = this.__common_uniforms;
|
|
79
|
+
|
|
80
|
+
us.fp_f_camera_far.value = c.camera.far;
|
|
81
|
+
us.fp_f_camera_near.value = c.camera.near;
|
|
82
|
+
|
|
83
|
+
// TODO move to "onbefore render"
|
|
84
|
+
us.fp_t_decal_atlas_resolution.value.set(
|
|
85
|
+
us.fp_t_decal_atlas.value.image.width,
|
|
86
|
+
us.fp_t_decal_atlas.value.image.height,
|
|
87
|
+
);
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
transform(source) {
|
|
@@ -21,6 +21,7 @@ function frustum_check(data_view, address, planes) {
|
|
|
21
21
|
const n_x0 = data_view.getFloat32(address);
|
|
22
22
|
const n_y0 = data_view.getFloat32(address + 4);
|
|
23
23
|
const n_z0 = data_view.getFloat32(address + 8);
|
|
24
|
+
|
|
24
25
|
const n_x1 = data_view.getFloat32(address + 12);
|
|
25
26
|
const n_y1 = data_view.getFloat32(address + 16);
|
|
26
27
|
const n_z1 = data_view.getFloat32(address + 20);
|
|
@@ -72,7 +73,6 @@ export function query_bvh_frustum_from_texture(
|
|
|
72
73
|
|
|
73
74
|
let stackPointer = 1;
|
|
74
75
|
let result = 0;
|
|
75
|
-
let plane_address;
|
|
76
76
|
|
|
77
77
|
const binary_node_count = root.getBinaryNodeCount();
|
|
78
78
|
|
|
@@ -90,7 +90,7 @@ export function query_bvh_frustum_from_texture(
|
|
|
90
90
|
const last_valid_index = binary_node_count + root.getLeafNodeCount();
|
|
91
91
|
const data_view = root.getDataView();
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
while (stackPointer-- > 0) {
|
|
94
94
|
|
|
95
95
|
// query_bvh_frustum_from_objects.iteration_count++;
|
|
96
96
|
const node_index = stack[stackPointer];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EntityBehavior } from "../ecs/EntityBehavior.js";
|
|
2
|
+
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
3
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
4
|
+
import Quaternion from "../../../../core/geom/Quaternion.js";
|
|
5
|
+
import { BehaviorStatus } from "../BehaviorStatus.js";
|
|
6
|
+
|
|
7
|
+
export class RotationBehavior extends EntityBehavior {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Rotation per second
|
|
13
|
+
* @type {Vector3}
|
|
14
|
+
*/
|
|
15
|
+
this.axis = new Vector3();
|
|
16
|
+
this.speed = 1;
|
|
17
|
+
|
|
18
|
+
this.angle = 0;
|
|
19
|
+
|
|
20
|
+
this.__offset = new Quaternion();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static fromJSON(j) {
|
|
24
|
+
const r = new RotationBehavior();
|
|
25
|
+
|
|
26
|
+
r.fromJSON(j);
|
|
27
|
+
|
|
28
|
+
return r;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param axis
|
|
34
|
+
* @param speed
|
|
35
|
+
* @param angle
|
|
36
|
+
*/
|
|
37
|
+
fromJSON({ axis = Vector3.up, speed = 1, angle = 0 }) {
|
|
38
|
+
this.axis.fromJSON(axis);
|
|
39
|
+
this.speed = speed;
|
|
40
|
+
this.angle = angle;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
initialize(context) {
|
|
44
|
+
super.initialize(context);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const transform = this.ecd.getComponent(this.entity, Transform);
|
|
48
|
+
this.__offset.copy(transform.rotation);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tick(timeDelta) {
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @type {Transform}
|
|
55
|
+
*/
|
|
56
|
+
const transform = this.ecd.getComponent(this.entity, Transform);
|
|
57
|
+
|
|
58
|
+
const angleDelta = this.speed * timeDelta;
|
|
59
|
+
|
|
60
|
+
this.angle += angleDelta;
|
|
61
|
+
|
|
62
|
+
const r = transform.rotation;
|
|
63
|
+
|
|
64
|
+
r.fromAxisAngle(this.axis, this.angle);
|
|
65
|
+
r.multiplyQuaternions(r, this.__offset);
|
|
66
|
+
|
|
67
|
+
return BehaviorStatus.Running;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -9,8 +9,8 @@ import { CellFilterMax2 } from "../../filtering/numeric/math/CellFilterMax2.js";
|
|
|
9
9
|
import { CellFilterSmoothStep } from "../../filtering/numeric/math/CellFilterSmoothStep.js";
|
|
10
10
|
import { MohGridLayers } from "../../../../../generator/MohGridLayers.js";
|
|
11
11
|
import { CellFilterDilate } from "../../filtering/numeric/complex/CellFilterDilate.js";
|
|
12
|
-
import { DEG2RAD } from "three/src/math/MathUtils.js";
|
|
13
12
|
import { CellFilterCache } from "../../filtering/numeric/CellFilterCache.js";
|
|
13
|
+
import { DEG_TO_RAD } from "../../../core/math/DEG_TO_RAD.js";
|
|
14
14
|
|
|
15
15
|
const fReadHeight = CellFilterSampleLayerLinear.from(MirGridLayers.Heights);
|
|
16
16
|
|
|
@@ -27,8 +27,8 @@ export const SampleGroundMoistureFilter = CellFilterMax2.from(
|
|
|
27
27
|
CellFilterMax2.from(
|
|
28
28
|
// flat areas are more likely to be keep moisture
|
|
29
29
|
CellFilterSmoothStep.from(
|
|
30
|
-
CellFilterLiteralFloat.from(40 *
|
|
31
|
-
CellFilterLiteralFloat.from(10 *
|
|
30
|
+
CellFilterLiteralFloat.from(40 * DEG_TO_RAD),
|
|
31
|
+
CellFilterLiteralFloat.from(10 * DEG_TO_RAD),
|
|
32
32
|
SLOPE
|
|
33
33
|
),
|
|
34
34
|
// water accumulates in crevices
|
|
@@ -60,8 +60,8 @@ export const SampleGroundMoistureFilter = CellFilterMax2.from(
|
|
|
60
60
|
NOTE: we don't have to worry about directly of the slope, as water always starts at 0, so any slope will be positive in effect
|
|
61
61
|
*/
|
|
62
62
|
CellFilterSmoothStep.from(
|
|
63
|
-
CellFilterLiteralFloat.from(35 *
|
|
64
|
-
CellFilterLiteralFloat.from(10 *
|
|
63
|
+
CellFilterLiteralFloat.from(35 * DEG_TO_RAD),
|
|
64
|
+
CellFilterLiteralFloat.from(10 * DEG_TO_RAD),
|
|
65
65
|
SLOPE
|
|
66
66
|
),
|
|
67
67
|
)
|
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.42.
|
|
8
|
+
"version": "2.42.2",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|