@woosh/meep-engine 2.43.1 → 2.43.4
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 +13 -1
- package/core/binary/BitSet.js +2 -2
- package/core/bvh2/aabb3/aabb3_array_combine.js +2 -2
- package/core/collection/RingBuffer.js +4 -2
- package/core/collection/RingBuffer.spec.js +59 -0
- package/core/collection/array/ArrayIteratorRandom.js +1 -1
- package/core/collection/{ArrayUtils.spec.js → array/arrayPickBestElement.spec.js} +1 -1
- package/core/collection/array/arrayPickBestElements.js +51 -0
- package/core/collection/array/arrayPickMinElement.js +43 -0
- package/core/collection/array/arrayQuickSort.js +1 -1
- package/core/collection/array/arraySetSortingDiff.js +1 -1
- package/core/collection/array/arraySwapElements.js +12 -0
- package/core/collection/array/array_range_equal_strict.js +22 -0
- package/core/collection/array/groupArrayBy.js +42 -0
- package/core/collection/array/isArrayEqual.js +50 -0
- package/core/collection/array/randomMultipleFromArray.js +34 -0
- package/core/collection/array/randomizeArrayElementOrder.js +23 -0
- package/core/color/sRGB_to_linear.js +9 -4
- package/core/geom/2d/convex-hull/convex_hull_monotone_2d.js +1 -1
- package/core/geom/3d/aabb/aabb3_build_frustum.js +1 -1
- package/core/geom/3d/aabb/compute_aabb_from_points.js +1 -1
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +3 -1
- package/core/geom/3d/morton/v3_morton_encode_transformed.spec.js +20 -0
- package/core/geom/3d/plane/orient3d_fast.js +11 -10
- package/core/geom/3d/plane/orient3d_robust.js +41 -0
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +0 -23
- package/core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js +24 -0
- package/core/geom/3d/shape/UnionShape3D.js +1 -1
- package/core/geom/3d/sphere/harmonics/README.md +15 -0
- package/core/geom/3d/sphere/harmonics/sh3_add.js +21 -0
- package/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +618 -0
- package/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +49 -0
- package/core/geom/3d/sphere/harmonics/sh3_sample_irradiance_by_direction.js +53 -0
- package/core/geom/3d/tetrahedra/README.md +10 -1
- package/core/geom/3d/tetrahedra/TetrahedralMesh.js +650 -0
- package/core/geom/3d/tetrahedra/TetrahedralMesh.spec.js +233 -0
- package/core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js +75 -0
- package/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +2 -2
- package/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.spec.js +4 -4
- package/core/geom/3d/tetrahedra/delaunay/Cavity.js +49 -7
- package/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +51 -17
- package/core/geom/3d/tetrahedra/delaunay/debug_validate_mesh.js +19 -0
- package/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +191 -0
- package/core/geom/3d/tetrahedra/delaunay/push_boundary_with_validation.js +27 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_cavity.js +59 -43
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.js +77 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_compute_sub_determinant.spec.js +30 -0
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_towards_containing_tetrahedron.js +58 -0
- package/core/geom/3d/tetrahedra/delaunay/validate_cavity_boundary.js +60 -0
- package/core/geom/3d/tetrahedra/{point_in_tetrahedron_circumsphere.js → in_sphere_fast.js} +11 -13
- package/core/geom/3d/tetrahedra/in_sphere_robust.js +53 -0
- package/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +44 -35
- package/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.js +83 -0
- package/core/geom/3d/tetrahedra/tetrahedron_compute_signed_volume.spec.js +24 -0
- package/core/geom/3d/tetrahedra/tetrahedron_contains_point.spec.js +66 -0
- package/core/geom/3d/tetrahedra/validate_tetrahedral_mesh.js +166 -0
- package/core/geom/3d/util/make_justified_point_grid.js +31 -0
- package/core/geom/Bezier.js +0 -27
- package/core/geom/Plane.js +0 -4
- package/core/geom/packing/miniball/Subspan.js +2 -2
- package/core/geom/v3_lerp.js +6 -1
- package/core/math/isqrt.js +28 -0
- package/core/math/isqrt.spec.js +9 -0
- package/core/math/max.spec.js +25 -0
- package/core/math/min2.spec.js +25 -0
- package/core/model/node-graph/node/NodeInstance.js +3 -3
- package/core/primitives/strings/prefixTree/PrefixTreeLeaf.js +1 -1
- package/core/process/delay.js +5 -0
- package/core/process/task/util/randomCountTask.js +1 -1
- package/editor/Editor.js +3 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +195 -11
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +4 -0
- package/editor/ecs/component/editors/primitive/ArrayEditor.js +1 -1
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +6 -0
- package/editor/view/ecs/components/common/AutoCanvasView.js +13 -25
- package/engine/EngineHarness.js +11 -5
- package/engine/asset/AssetManager.d.ts +5 -1
- package/engine/asset/AssetManager.js +50 -15
- package/engine/asset/AssetManager.spec.js +17 -11
- package/engine/asset/AssetRequest.js +57 -0
- package/engine/asset/loaders/ArrayBufferLoader.js +22 -0
- package/engine/asset/loaders/AssetLoader.js +1 -1
- package/engine/ecs/System.js +1 -1
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +1 -1
- package/engine/ecs/terrain/ecs/TerrainSystem.js +7 -1
- package/engine/ecs/transform/copy_three_transform.js +15 -0
- package/engine/graphics/FrameRunner.js +5 -9
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +1 -1
- package/engine/graphics/ecs/camera/Camera.js +1 -10
- package/engine/graphics/ecs/camera/CameraSystem.js +8 -8
- package/engine/graphics/ecs/camera/ProjectionType.js +9 -0
- package/engine/graphics/ecs/camera/build_three_camera_object.js +3 -3
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +59 -4
- package/engine/graphics/ecs/light/Light.js +6 -1
- package/engine/graphics/ecs/light/LightSystem.d.ts +1 -1
- package/engine/graphics/ecs/mesh-v2/three_object_to_entity_composition.js +2 -17
- package/engine/graphics/geometry/VertexDataSpec.js +1 -1
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +2 -2
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +3 -3
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +1 -1
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +3 -1
- package/engine/graphics/particles/node-based/codegen/modules/FunctionSignature.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.spec.js +4 -0
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +4 -2
- package/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +2 -2
- package/engine/graphics/render/layers/RenderLayerUtils.js +2 -2
- package/engine/graphics/sh3/LightProbeVolume.js +595 -0
- package/engine/graphics/sh3/SH3VisualisationMaterial.js +79 -0
- package/engine/graphics/sh3/prototypeSH3Probe.js +427 -0
- package/engine/graphics/sh3/visualise_probe.js +40 -0
- package/engine/graphics/shaders/DenoiseShader.js +1 -1
- package/engine/graphics/texture/atlas/AtlasPatch.js +11 -3
- package/engine/graphics/texture/atlas/CachingTextureAtlas.js +2 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +22 -4
- package/engine/graphics/texture/atlas/TextureAtlas.spec.js +22 -0
- package/engine/graphics/texture/sampler/Sampler2D.js +0 -64
- package/engine/graphics/texture/sampler/Sampler2D.spec.js +2 -1
- package/engine/graphics/texture/sampler/sampler2d_combine.js +67 -0
- package/engine/intelligence/behavior/ecs/BehaviorSystem.spec.js +0 -3
- package/engine/intelligence/blackboard/AbstractBlackboard.d.ts +1 -1
- package/engine/network/PriorityFetch.js +192 -0
- package/engine/simulation/DormandPrince.js +1 -1
- package/engine/ui/DraggableAspect.js +0 -1
- package/generation/grid/generation/road/GridTaskGenerateRoads.js +1 -1
- package/package.json +2 -1
- package/samples/terrain/from_image_2.js +127 -82
- package/view/elements/CanvasView.js +7 -1
- package/view/elements/image/HTMLElementCacheKey.js +1 -1
- package/view/util/DomSizeObserver.js +3 -5
- package/core/collection/ArrayUtils.js +0 -263
- package/core/geom/3d/tetrahedra/delaunay/tetrahedral_mesh_walk_toward_cavity.js +0 -48
- package/core/geom/3d/tetrahedra/hxt/a.js +0 -524
- package/core/geom/3d/tetrahedra/hxt/hxt.js +0 -140
- package/core/geom/3d/tetrahedra/hxt/hxt.wasm +0 -0
- package/core/geom/3d/tetrahedra/tetrahedra_collection.js +0 -383
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @enum {number}
|
|
4
|
+
*/
|
|
5
|
+
export const AssetRequestFlags = {
|
|
6
|
+
/**
|
|
7
|
+
* Will always skip the wait queue
|
|
8
|
+
*/
|
|
9
|
+
SkipQueue: 1
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
export class AssetRequest {
|
|
2
13
|
/**
|
|
3
14
|
*
|
|
@@ -28,5 +39,51 @@ export class AssetRequest {
|
|
|
28
39
|
* @type {number}
|
|
29
40
|
*/
|
|
30
41
|
this.priority = 0;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
this.flags = 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
* @param {number|AssetRequestFlags} flag
|
|
53
|
+
* @returns {void}
|
|
54
|
+
*/
|
|
55
|
+
setFlag(flag) {
|
|
56
|
+
this.flags |= flag;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param {number|AssetRequestFlags} flag
|
|
62
|
+
* @returns {void}
|
|
63
|
+
*/
|
|
64
|
+
clearFlag(flag) {
|
|
65
|
+
this.flags &= ~flag;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param {number|AssetRequestFlags} flag
|
|
71
|
+
* @param {boolean} value
|
|
72
|
+
*/
|
|
73
|
+
writeFlag(flag, value) {
|
|
74
|
+
if (value) {
|
|
75
|
+
this.setFlag(flag);
|
|
76
|
+
} else {
|
|
77
|
+
this.clearFlag(flag);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param {number|AssetRequestFlags} flag
|
|
84
|
+
* @returns {boolean}
|
|
85
|
+
*/
|
|
86
|
+
getFlag(flag) {
|
|
87
|
+
return (this.flags & flag) === flag;
|
|
31
88
|
}
|
|
32
89
|
}
|
|
@@ -3,6 +3,23 @@ import { AssetLoader } from "./AssetLoader.js";
|
|
|
3
3
|
import { CrossOriginKind } from "../CORS/CrossOriginKind.js";
|
|
4
4
|
|
|
5
5
|
export class ArrayBufferLoader extends AssetLoader {
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {"auto"|"low"|"high"} fetch_priority
|
|
9
|
+
*/
|
|
10
|
+
constructor({
|
|
11
|
+
fetch_priority = "auto"
|
|
12
|
+
} = {}) {
|
|
13
|
+
super();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @type {"auto"|"low"|"high"}
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
this.__fetch_priority = fetch_priority;
|
|
21
|
+
}
|
|
22
|
+
|
|
6
23
|
load(path, success, failure, progress) {
|
|
7
24
|
const coc = this.assetManager.crossOriginConfig;
|
|
8
25
|
|
|
@@ -13,6 +30,11 @@ export class ArrayBufferLoader extends AssetLoader {
|
|
|
13
30
|
headers: headers
|
|
14
31
|
});
|
|
15
32
|
|
|
33
|
+
if (typeof request.priority !== "undefined") {
|
|
34
|
+
// priority API is present
|
|
35
|
+
request.priority = this.__fetch_priority;
|
|
36
|
+
}
|
|
37
|
+
|
|
16
38
|
fetch(request)
|
|
17
39
|
.then(handle_response)
|
|
18
40
|
.then(response_to_asset)
|
package/engine/ecs/System.js
CHANGED
|
@@ -34,7 +34,7 @@ class System {
|
|
|
34
34
|
/**
|
|
35
35
|
* Component types that are used internally by the system
|
|
36
36
|
* Declaring this helps EntityManager to ensure that all relevant component types are properly registered for the system
|
|
37
|
-
* @type {
|
|
37
|
+
* @type {Array}
|
|
38
38
|
*/
|
|
39
39
|
this.components_used = [];
|
|
40
40
|
}
|
|
@@ -4,7 +4,6 @@ import { SystemEntityContext } from "../system/SystemEntityContext.js";
|
|
|
4
4
|
import { DataScope } from "../../../../model/game/unit/actions/data/DataScope.js";
|
|
5
5
|
import { Blackboard } from "../../intelligence/blackboard/Blackboard.js";
|
|
6
6
|
import { compareNumbersDescending, returnTrue } from "../../../core/function/Functions.js";
|
|
7
|
-
import { randomMultipleFromArray } from "../../../core/collection/ArrayUtils.js";
|
|
8
7
|
import { EntityProxyScope } from "../binding/EntityProxyScope.js";
|
|
9
8
|
import EntityBuilder, { EntityBuilderFlags } from "../EntityBuilder.js";
|
|
10
9
|
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
@@ -20,6 +19,7 @@ import { computeContextualDynamicRuleDebugString } from "./rules/computeContextu
|
|
|
20
19
|
import { computeStringHash } from "../../../core/primitives/strings/computeStringHash.js";
|
|
21
20
|
import { randomFromArray } from "../../../core/math/random/randomFromArray.js";
|
|
22
21
|
import { randomFloatBetween } from "../../../core/math/random/randomFloatBetween.js";
|
|
22
|
+
import { randomMultipleFromArray } from "../../../core/collection/array/randomMultipleFromArray.js";
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* In seconds
|
|
@@ -7,6 +7,7 @@ import { TerrainFlags } from "./TerrainFlags.js";
|
|
|
7
7
|
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
8
8
|
import { Transform } from "../../transform/Transform.js";
|
|
9
9
|
import { MATRIX_4_IDENTITY } from "../../../../core/geom/3d/matrix/MATRIX_4_IDENTITY.js";
|
|
10
|
+
import { BinaryNode } from "../../../../core/bvh2/BinaryNode.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
*
|
|
@@ -149,6 +150,11 @@ class TerrainSystem extends System {
|
|
|
149
150
|
*/
|
|
150
151
|
unlink(component, entity) {
|
|
151
152
|
|
|
153
|
+
if (this.renderLayer.bvh === component.__tiles.bvh) {
|
|
154
|
+
// remove from render index
|
|
155
|
+
this.renderLayer.bvh = new BinaryNode();
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
component.unlink();
|
|
153
159
|
}
|
|
154
160
|
|
|
@@ -187,7 +193,7 @@ class TerrainSystem extends System {
|
|
|
187
193
|
if (transform !== undefined) {
|
|
188
194
|
// terrain has a transform
|
|
189
195
|
terrain.transform = transform.matrix;
|
|
190
|
-
}else{
|
|
196
|
+
} else {
|
|
191
197
|
terrain.transform = MATRIX_4_IDENTITY;
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {Transform} transform
|
|
4
|
+
* @param {THREE.Object3D} three_object
|
|
5
|
+
*/
|
|
6
|
+
export function copy_three_transform(transform, three_object) {
|
|
7
|
+
|
|
8
|
+
// copy object transform
|
|
9
|
+
transform.position.copy(three_object.position);
|
|
10
|
+
transform.scale.copy(three_object.scale);
|
|
11
|
+
transform.rotation.copy(three_object.quaternion);
|
|
12
|
+
|
|
13
|
+
//
|
|
14
|
+
transform.matrix.set(three_object.matrix.elements);
|
|
15
|
+
}
|
|
@@ -41,22 +41,18 @@ export class FrameRunner {
|
|
|
41
41
|
|
|
42
42
|
this.running = true;
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const action = this.action;
|
|
47
|
-
|
|
48
|
-
function cycle() {
|
|
49
|
-
if (!self.running) {
|
|
44
|
+
const cycle = () => {
|
|
45
|
+
if (!this.running) {
|
|
50
46
|
//not supposed to be running, bail
|
|
51
47
|
return;
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
action();
|
|
50
|
+
this.action();
|
|
55
51
|
|
|
56
|
-
|
|
52
|
+
this.animationFrameId = requestAnimationFrame(cycle);
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
|
|
55
|
+
this.animationFrameId = requestAnimationFrame(cycle);
|
|
60
56
|
|
|
61
57
|
return true;
|
|
62
58
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isArrayEqual } from "../../../../../core/collection/ArrayUtils.js";
|
|
2
1
|
import { computeStringHash } from "../../../../../core/primitives/strings/computeStringHash.js";
|
|
3
2
|
import { invokeObjectHash } from "../../../../../core/model/object/invokeObjectHash.js";
|
|
4
3
|
import { computeHashArray } from "../../../../../core/collection/array/computeHashArray.js";
|
|
5
4
|
import { computeHashIntegerArray } from "../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
5
|
+
import { isArrayEqual } from "../../../../../core/collection/array/isArrayEqual.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -3,10 +3,10 @@ import { BlendStateMatrix } from "../../blending/BlendStateMatrix.js";
|
|
|
3
3
|
import { AnimationStateDefinition } from "./AnimationStateDefinition.js";
|
|
4
4
|
import { AnimationClipDefinition } from "../../AnimationClipDefinition.js";
|
|
5
5
|
import { AnimationClip } from "../../AnimationClip.js";
|
|
6
|
-
import { isArrayEqual } from "../../../../../../../core/collection/ArrayUtils.js";
|
|
7
6
|
import { invokeObjectHash } from "../../../../../../../core/model/object/invokeObjectHash.js";
|
|
8
7
|
import { computeHashArray } from "../../../../../../../core/collection/array/computeHashArray.js";
|
|
9
8
|
import { computeHashIntegerArray } from "../../../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
9
|
+
import { isArrayEqual } from "../../../../../../../core/collection/array/isArrayEqual.js";
|
|
10
10
|
|
|
11
11
|
export class AnimationGraphDefinition {
|
|
12
12
|
constructor() {
|
|
@@ -13,16 +13,7 @@ import Vector3 from "../../../../core/geom/Vector3.js";
|
|
|
13
13
|
import { frustum_from_camera } from "./frustum_from_camera.js";
|
|
14
14
|
import { invertQuaternionOrientation } from "./InvertQuaternionOrientation.js";
|
|
15
15
|
import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @enum {String}
|
|
20
|
-
* @readonly
|
|
21
|
-
*/
|
|
22
|
-
export const ProjectionType = {
|
|
23
|
-
Perspective: "perspective",
|
|
24
|
-
Orthographic: "orthographic"
|
|
25
|
-
};
|
|
16
|
+
import { ProjectionType } from "./ProjectionType.js";
|
|
26
17
|
|
|
27
18
|
/**
|
|
28
19
|
* @class
|
|
@@ -142,12 +142,13 @@ export class CameraSystem extends System {
|
|
|
142
142
|
const position = transform.position;
|
|
143
143
|
const rotation = transform.rotation;
|
|
144
144
|
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
const signalBindings = [
|
|
146
|
+
new SignalBinding(position.onChanged, synchronizePosition),
|
|
147
|
+
new SignalBinding(rotation.onChanged, synchronizeRotation),
|
|
148
|
+
new SignalBinding(camera.projectionType.onChanged, rebuild),
|
|
149
|
+
new SignalBinding(camera.active.onChanged, synchronizeActiveState),
|
|
150
|
+
new SignalBinding(camera.fov.onChanged, rebuild)
|
|
151
|
+
];
|
|
151
152
|
|
|
152
153
|
signalBindings.forEach(b => b.link());
|
|
153
154
|
|
|
@@ -158,7 +159,6 @@ export class CameraSystem extends System {
|
|
|
158
159
|
synchronizeRotation(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
159
160
|
synchronizeActiveState(camera.active.getValue());
|
|
160
161
|
|
|
161
|
-
|
|
162
162
|
assert.notEqual(camera.object, null, 'Camera object must not be null (invariant)');
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -212,7 +212,7 @@ export class CameraSystem extends System {
|
|
|
212
212
|
return;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
if(c.object.updateProjectionMatrix !== undefined) {
|
|
215
|
+
if (c.object.updateProjectionMatrix !== undefined) {
|
|
216
216
|
c.object.updateProjectionMatrix();
|
|
217
217
|
c.object.updateMatrix();
|
|
218
218
|
c.object.updateMatrixWorld(true);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Camera } from "./Camera.js";
|
|
2
1
|
import { OrthographicCamera as ThreeOrthographicCamera, PerspectiveCamera as ThreePerspectiveCamera } from "three";
|
|
2
|
+
import { ProjectionType } from "./ProjectionType.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
@@ -13,10 +13,10 @@ export function build_three_camera_object(component) {
|
|
|
13
13
|
default:
|
|
14
14
|
console.error(`Unsupported camera projection type "${component.projectionType.getValue()}", defaulting to perspective projection`);
|
|
15
15
|
//fallthrough
|
|
16
|
-
case
|
|
16
|
+
case ProjectionType.Perspective:
|
|
17
17
|
result = new ThreePerspectiveCamera(component.fov.getValue(), 1, 1, 50);
|
|
18
18
|
break;
|
|
19
|
-
case
|
|
19
|
+
case ProjectionType.Orthographic:
|
|
20
20
|
result = new ThreeOrthographicCamera(-10, 10, 20, -20, 1, 1);
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
@@ -13,9 +13,9 @@ import { TransformAttachmentSystem } from "../../../../ecs/transform-attachment/
|
|
|
13
13
|
import { SGMesh } from "../../mesh-v2/aggregate/SGMesh.js";
|
|
14
14
|
import { GameAssetType } from "../../../../asset/GameAssetType.js";
|
|
15
15
|
import { GLTFAssetLoader } from "../../../../asset/loaders/GLTFAssetLoader.js";
|
|
16
|
-
import { TaskLoadingScreen } from "../../../../../view/task/TaskLoadingScreen.js";
|
|
17
16
|
import '../../../../../../../../css/game.scss';
|
|
18
17
|
import { countTask } from "../../../../../core/process/task/util/countTask.js";
|
|
18
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
19
19
|
|
|
20
20
|
const decal_urls = `data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/staff_13_t.png
|
|
21
21
|
data/textures/icons/FantasyIconsMegaPack/MagicItems/MagicItems_png/transparent/x64/artifact_01_t.png
|
|
@@ -207,6 +207,55 @@ function promise_time_out(t) {
|
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
/**
|
|
211
|
+
*
|
|
212
|
+
* @param ecd
|
|
213
|
+
* @param {number} x
|
|
214
|
+
* @param {number} y
|
|
215
|
+
* @param {number} size_x
|
|
216
|
+
* @param {number} size_y
|
|
217
|
+
* @param {number} spacing
|
|
218
|
+
* @param {string[]} textures
|
|
219
|
+
*/
|
|
220
|
+
function grid(ecd, offset_x, offset_y,x, y, size_x, size_y, spacing, textures) {
|
|
221
|
+
|
|
222
|
+
const random = seededRandom();
|
|
223
|
+
|
|
224
|
+
for (let i = 0; i < x; i++) {
|
|
225
|
+
for (let j = 0; j < y; j++) {
|
|
226
|
+
|
|
227
|
+
const decal = new Decal();
|
|
228
|
+
|
|
229
|
+
decal.uri = randomFromArray(random, textures);
|
|
230
|
+
|
|
231
|
+
const entity = new EntityBuilder();
|
|
232
|
+
|
|
233
|
+
entity.clearFlag(EntityBuilderFlags.WatchDestruction);
|
|
234
|
+
|
|
235
|
+
const transform = new Transform();
|
|
236
|
+
transform.position.set(
|
|
237
|
+
i * (size_x + spacing) + offset_x,
|
|
238
|
+
0,
|
|
239
|
+
j * (size_y + spacing) + offset_y,
|
|
240
|
+
);
|
|
241
|
+
// transform.rotation.alignToDirection(Vector3.down);
|
|
242
|
+
// transform.rotation.set(0,0,-0.7,0.7);
|
|
243
|
+
// transform.rotation.set(0,0.7,0,0.7);
|
|
244
|
+
transform.rotation.set(-0.7, 0, 0, 0.7);
|
|
245
|
+
// transform.rotation.random(random);
|
|
246
|
+
transform.scale.set(size_x, size_y,1 );
|
|
247
|
+
// transform.scale.setScalar(1);
|
|
248
|
+
|
|
249
|
+
entity
|
|
250
|
+
.add(transform)
|
|
251
|
+
.add(decal)
|
|
252
|
+
.build(ecd);
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
|
|
210
259
|
/**
|
|
211
260
|
*
|
|
212
261
|
* @param {Engine} engine
|
|
@@ -216,7 +265,9 @@ async function main(engine) {
|
|
|
216
265
|
await EngineHarness.buildBasics({
|
|
217
266
|
engine,
|
|
218
267
|
enableWater: false,
|
|
219
|
-
cameraFarDistance: 300
|
|
268
|
+
cameraFarDistance: 300,
|
|
269
|
+
terrainResolution: 1,
|
|
270
|
+
terrainSize: new Vector2(1000, 1000)
|
|
220
271
|
});
|
|
221
272
|
|
|
222
273
|
new EntityBuilder()
|
|
@@ -265,7 +316,7 @@ async function main(engine) {
|
|
|
265
316
|
|
|
266
317
|
const task = countTask(0, ENTITY_COUNT, makeOne);
|
|
267
318
|
|
|
268
|
-
TaskLoadingScreen.instance.load(engine, task);
|
|
319
|
+
// TaskLoadingScreen.instance.load(engine, task);
|
|
269
320
|
|
|
270
321
|
// console.profile('spawn');
|
|
271
322
|
|
|
@@ -273,8 +324,12 @@ async function main(engine) {
|
|
|
273
324
|
// console.profileEnd('spawn');
|
|
274
325
|
});
|
|
275
326
|
|
|
276
|
-
engine.executor.run(task);
|
|
327
|
+
// engine.executor.run(task);
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
grid(engine.entityManager.dataset, 20,10,80, 25, .4, .6, .1, decal_urls.slice(105, 105+3));
|
|
277
331
|
|
|
332
|
+
grid(engine.entityManager.dataset, 20,30,80, 25, .4, .6, .1, decal_urls.slice(105, 105+3));
|
|
278
333
|
// await promise_time_out(10);
|
|
279
334
|
|
|
280
335
|
|
|
@@ -8,6 +8,9 @@ import { Color } from "../../../../core/color/Color.js";
|
|
|
8
8
|
import ObservedBoolean from "../../../../core/model/ObservedBoolean.js";
|
|
9
9
|
import { LightType } from "./LightType.js";
|
|
10
10
|
|
|
11
|
+
|
|
12
|
+
const DEFAULT_DISTANCE = 1;
|
|
13
|
+
|
|
11
14
|
export class Light {
|
|
12
15
|
/**
|
|
13
16
|
*
|
|
@@ -48,7 +51,7 @@ export class Light {
|
|
|
48
51
|
* Applicable for SPOT and POINT lights, controls maximum extents of influence of the light
|
|
49
52
|
* @type {Vector1}
|
|
50
53
|
*/
|
|
51
|
-
this.distance = new Vector1(
|
|
54
|
+
this.distance = new Vector1(DEFAULT_DISTANCE);
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
57
|
*
|
|
@@ -127,6 +130,8 @@ export class Light {
|
|
|
127
130
|
|
|
128
131
|
if (json.distance !== undefined) {
|
|
129
132
|
this.distance.fromJSON(json.distance);
|
|
133
|
+
} else {
|
|
134
|
+
this.distance.set(DEFAULT_DISTANCE);
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
137
|
this.__threeObject = null;
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { EntityNode } from "../../../ecs/parent/EntityNode.js";
|
|
2
2
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
3
3
|
import { ShadedGeometry } from "./ShadedGeometry.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {Transform} transform
|
|
8
|
-
* @param {THREE.Object3D} three_object
|
|
9
|
-
*/
|
|
10
|
-
function copy_three_transform(transform, three_object) {
|
|
11
|
-
|
|
12
|
-
// copy object transform
|
|
13
|
-
transform.position.copy(three_object.position);
|
|
14
|
-
transform.scale.copy(three_object.scale);
|
|
15
|
-
transform.rotation.copy(three_object.quaternion);
|
|
16
|
-
|
|
17
|
-
//
|
|
18
|
-
transform.matrix.set(three_object.matrix.elements);
|
|
19
|
-
}
|
|
4
|
+
import { copy_three_transform } from "../../../ecs/transform/copy_three_transform.js";
|
|
20
5
|
|
|
21
6
|
/**
|
|
22
7
|
*
|
|
@@ -41,7 +26,7 @@ export function three_object_to_entity_composition(root) {
|
|
|
41
26
|
|
|
42
27
|
if (root.isMesh) {
|
|
43
28
|
if (root.isSkinnedMesh) {
|
|
44
|
-
|
|
29
|
+
console.error(`Skinned meshes are not supported`);
|
|
45
30
|
}
|
|
46
31
|
|
|
47
32
|
const sg = ShadedGeometry.from(root.geometry, root.material);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isArrayEqual } from "../../../core/collection/ArrayUtils.js";
|
|
2
1
|
import { invokeObjectHash } from "../../../core/model/object/invokeObjectHash.js";
|
|
3
2
|
import { computeHashArray } from "../../../core/collection/array/computeHashArray.js";
|
|
3
|
+
import { isArrayEqual } from "../../../core/collection/array/isArrayEqual.js";
|
|
4
4
|
|
|
5
5
|
const DEFAULT_HASH = 123456;
|
|
6
6
|
|
|
@@ -54,12 +54,12 @@ export class InstancedMeshGroup {
|
|
|
54
54
|
*
|
|
55
55
|
* @type {number}
|
|
56
56
|
*/
|
|
57
|
-
this.growFactor = 1.
|
|
57
|
+
this.growFactor = 1.2;
|
|
58
58
|
/**
|
|
59
59
|
* Minimum spare capacity increase during growing
|
|
60
60
|
* @type {number}
|
|
61
61
|
*/
|
|
62
|
-
this.growConstant =
|
|
62
|
+
this.growConstant = 16;
|
|
63
63
|
|
|
64
64
|
this.shrinkFactor = 0.5;
|
|
65
65
|
/**
|
|
@@ -51,10 +51,10 @@ async function main(engine) {
|
|
|
51
51
|
// const path = 'data/models/road_bike/road_bike.gltf'; //large CAD-type model
|
|
52
52
|
// const path = 'data/models/LowPolyTownshipSet/Barrel/model.gltf';
|
|
53
53
|
// const path = 'data/models/LowPolyTownshipSet/Town_Hall/model.gltf';
|
|
54
|
-
const path = 'data/models/RTS_Buildings_Humans/18/Building_R_18_out/Building_R_18.gltf';
|
|
54
|
+
// const path = 'data/models/RTS_Buildings_Humans/18/Building_R_18_out/Building_R_18.gltf';
|
|
55
55
|
// const path = 'data/models/MOBA and Tower Defense/Tree_01.gltf';
|
|
56
56
|
// const path = 'data/models/samples/transform-hierarchy.glb';
|
|
57
|
-
|
|
57
|
+
const path = 'data/models/sponza-pbr/gltf/sponza.glb';
|
|
58
58
|
// const path = 'moicon/gnutti_not_optimized/model.gltf';
|
|
59
59
|
// const path = 'moicon/isiflow_Oct_15_21/1/model.gltf';
|
|
60
60
|
// const path = 'moicon/Kople/EVCharger1.gltf';
|
|
@@ -64,7 +64,7 @@ async function main(engine) {
|
|
|
64
64
|
// console.profile('bake');
|
|
65
65
|
const id = baker.bake({
|
|
66
66
|
objects,
|
|
67
|
-
frames:
|
|
67
|
+
frames: 24,
|
|
68
68
|
resolution: 1024,
|
|
69
69
|
type: ImpostorCaptureType.Hemisphere
|
|
70
70
|
});
|
|
@@ -174,7 +174,7 @@ export class GLTFAssetTransformer extends AssetTransformer {
|
|
|
174
174
|
const micron_path = `${base}/${uri}`;
|
|
175
175
|
|
|
176
176
|
try {
|
|
177
|
-
micron_data = await this.__am.promise(micron_path, ASSET_TYPE_ARRAY_BUFFER);
|
|
177
|
+
micron_data = await this.__am.promise(micron_path, ASSET_TYPE_ARRAY_BUFFER, { skip_queue: true });
|
|
178
178
|
} catch (e) {
|
|
179
179
|
console.error(`Failed to load micron geometry '${micron_path}' referenced in GLTF (will skip): ${e}`);
|
|
180
180
|
return;
|
|
@@ -149,7 +149,9 @@ export class MicronRenderPlugin extends EnginePlugin {
|
|
|
149
149
|
|
|
150
150
|
// ensure that "arraybuffer" asset loader is present
|
|
151
151
|
if (am.getLoaderByType(ASSET_TYPE_ARRAY_BUFFER) === undefined) {
|
|
152
|
-
am.registerLoader(ASSET_TYPE_ARRAY_BUFFER, new ArrayBufferLoader(
|
|
152
|
+
am.registerLoader(ASSET_TYPE_ARRAY_BUFFER, new ArrayBufferLoader({
|
|
153
|
+
fetch_priority: "low" // hint to fetch data in background
|
|
154
|
+
}));
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
this.__asset_transformer.assetManager = am;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isArrayEqual } from "../../../../../../core/collection/ArrayUtils.js";
|
|
2
1
|
import { assert } from "../../../../../../core/assert.js";
|
|
2
|
+
import { isArrayEqual } from "../../../../../../core/collection/array/isArrayEqual.js";
|
|
3
3
|
|
|
4
4
|
export class FunctionSignature {
|
|
5
5
|
constructor() {
|
|
@@ -17,7 +17,6 @@ import Vector3 from "../../../../core/geom/Vector3.js";
|
|
|
17
17
|
import { query_bvh_frustum_from_objects } from "./query/query_bvh_frustum_from_objects.js";
|
|
18
18
|
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
19
19
|
import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
20
|
-
import { arraySwapElements } from "../../../../core/collection/ArrayUtils.js";
|
|
21
20
|
import { compute_light_data_hash_0 } from "./cluster/compute_light_data_hash_0.js";
|
|
22
21
|
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
23
22
|
import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/read_frustum_planes_to_array.js";
|
|
@@ -47,6 +46,7 @@ import { array_copy } from "../../../../core/collection/array/copyArray.js";
|
|
|
47
46
|
import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
48
47
|
import { invokeObjectCompare } from "../../../../core/model/object/invokeObjectCompare.js";
|
|
49
48
|
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
49
|
+
import { arraySwapElements } from "../../../../core/collection/array/arraySwapElements.js";
|
|
50
50
|
|
|
51
51
|
const LOOKUP_CACHE_SIZE = 1024; // must be power of two
|
|
52
52
|
|
|
@@ -35,6 +35,10 @@ test('correct cluster content (single small light)', () => {
|
|
|
35
35
|
|
|
36
36
|
const camera = new PerspectiveCamera(45, 1, 1, 10);
|
|
37
37
|
camera.lookAt(0, 0, 5);
|
|
38
|
+
|
|
39
|
+
camera.updateProjectionMatrix();
|
|
40
|
+
camera.updateMatrix();
|
|
41
|
+
camera.updateMatrixWorld(true);
|
|
38
42
|
|
|
39
43
|
lm.setTileMapResolution(1, 1, 1);
|
|
40
44
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
plane_three_computeConvex3PlaneIntersection
|
|
3
|
+
} from "../../../../core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js";
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Get frustum corners from a set of planes
|
|
5
7
|
* @param {Float32Array|number[]} result
|
|
6
8
|
* @param {Plane[]} planes
|
|
7
9
|
*/
|
|
@@ -1561,10 +1561,10 @@ function draw_camera_view_planes() {
|
|
|
1561
1561
|
// prepare_scene_2();
|
|
1562
1562
|
// prepare_scene_decal_0();
|
|
1563
1563
|
// prepare_scene_decal_1();
|
|
1564
|
-
|
|
1564
|
+
prepare_scene_decal_2();
|
|
1565
1565
|
// prepare_scene_9();
|
|
1566
1566
|
// prepare_scene_2();
|
|
1567
|
-
prepare_scene_0();
|
|
1567
|
+
// prepare_scene_0();
|
|
1568
1568
|
animate();
|
|
1569
1569
|
|
|
1570
1570
|
// draw_camera_view_planes();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
|
|
1
2
|
import {
|
|
2
3
|
plane_three_computeConvex3PlaneIntersection
|
|
3
|
-
} from "../../../../core/geom/3d/plane/
|
|
4
|
-
import { v3_distance_above_plane } from "../../../../core/geom/v3_distance_above_plane.js";
|
|
4
|
+
} from "../../../../core/geom/3d/plane/plane_three_compute_convex3_plane_intersection.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|