@woosh/meep-engine 2.66.0 → 2.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/meep.cjs +127 -1756
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +127 -1756
- package/package.json +1 -1
- package/src/engine/graphics/GraphicsEngine.js +16 -25
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +5 -5
- package/src/engine/graphics/ecs/compileAllMaterials.js +5 -12
- package/src/engine/graphics/ecs/mesh/Mesh.d.ts +0 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +0 -5
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +0 -1
- package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +22 -24
- package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +21 -23
- package/src/engine/graphics/material/optimization/prototypeMaterialOptimizer.js +16 -19
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +46 -47
- package/src/engine/graphics/render/layers/RenderLayer.d.ts +0 -5
- package/src/engine/graphics/render/layers/RenderLayer.js +29 -45
- package/src/core/bvh2/BVHTasks.js +0 -65
- package/src/core/bvh2/BinaryNode.d.ts +0 -13
- package/src/core/bvh2/BinaryNode.js +0 -1188
- package/src/core/bvh2/BinaryNode.spec.js +0 -309
- package/src/core/bvh2/LeafNode.d.ts +0 -7
- package/src/core/bvh2/LeafNode.js +0 -147
- package/src/core/bvh2/Node.d.ts +0 -9
- package/src/core/bvh2/Node.js +0 -196
- package/src/core/bvh2/NodeValidator.js +0 -197
- package/src/core/bvh2/StacklessTraverser.js +0 -154
- package/src/core/bvh2/StacklessTraverser.spec.js +0 -109
- package/src/core/bvh2/serialization/deserializeBinaryNode.js +0 -40
- package/src/core/bvh2/serialization/deserializeBinaryNodeFromBinaryBuffer.js +0 -90
- package/src/core/bvh2/serialization/serializeBinaryNode.js +0 -31
- package/src/core/bvh2/serialization/serializeBinaryNodeToBinaryBuffer.js +0 -86
- package/src/core/bvh2/transform/BottomUpOptimizingRebuilder.js +0 -144
- package/src/core/bvh2/transform/RotationOptimizer.js +0 -123
- package/src/core/bvh2/transform/RotationOptimizer.spec.js +0 -303
- package/src/core/bvh2/transform/tryRotateSingleNode.js +0 -260
- package/src/core/bvh2/traversal/BVHVisitor.js +0 -30
- package/src/core/bvh2/traversal/RaycastBVHVisitor.js +0 -66
- package/src/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +0 -384
- package/src/core/bvh2/traversal/ThreeFrustumsIntersectionBVHVisitor.js +0 -52
- package/src/core/bvh2/traversal/bvh_traverse_pre_order_using_stack.js +0 -43
- package/src/core/bvh2/traversal/queryBinaryNode_ClippingPlanes.d.ts +0 -5
- package/src/core/bvh2/traversal/queryBinaryNode_ClippingPlanes.js +0 -66
- package/src/core/bvh2/traversal/queryBinaryNode_CollectData.js +0 -49
- package/src/core/bvh2/traversal/queryBinaryNode_CollectLeaves.js +0 -51
- package/src/core/bvh2/traversal/queryBinaryNode_FrustumIntersections.js +0 -77
- package/src/core/bvh2/traversal/queryBinaryNode_SphereIntersections.js +0 -63
- package/src/core/bvh2/traversal/traverseBinaryNodeUsingVisitor.js +0 -50
- package/src/core/bvh2/traversal/traverseBinaryNodeUsingVisitor_DepthFirst_PreOrder.js +0 -34
- package/src/core/bvh2/util/find_least_common_ancestor.js +0 -34
- package/src/core/bvh2/visual/convert_bvh_to_dot_format_string.js +0 -50
- package/src/core/geom/2d/bvh/BinaryNode2.js +0 -152
- package/src/core/geom/2d/bvh/LeafNode2.js +0 -11
- package/src/core/geom/2d/bvh/Node2.js +0 -51
- package/src/engine/ecs/terrain/tiles/FirstRayIntersectionTerrainBVHVisitor.js +0 -74
- package/src/engine/graphics/geometry/bvh/BVHFromGeometry.js +0 -72
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +0 -240
- package/src/engine/graphics/geometry/bvh/buffered/IndexedTraingleBoundsComputer.js +0 -43
- package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +0 -133
package/package.json
CHANGED
|
@@ -13,30 +13,28 @@ import {
|
|
|
13
13
|
VSMShadowMap,
|
|
14
14
|
WebGLRenderer
|
|
15
15
|
} from "three";
|
|
16
|
-
import {assert} from "../../core/assert.js";
|
|
17
|
-
|
|
18
|
-
import {BinaryNode} from "../../core/bvh2/BinaryNode.js";
|
|
16
|
+
import { assert } from "../../core/assert.js";
|
|
19
17
|
|
|
20
18
|
import Signal from "../../core/events/signal/Signal.js";
|
|
21
19
|
import Vector1 from "../../core/geom/Vector1.js";
|
|
22
|
-
import {max2} from "../../core/math/max2.js";
|
|
20
|
+
import { max2 } from "../../core/math/max2.js";
|
|
23
21
|
import EmptyView from "../../view/elements/EmptyView.js";
|
|
24
|
-
import {globalMetrics} from "../metrics/GlobalMetrics.js";
|
|
25
|
-
import {MetricsCategory} from "../metrics/MetricsCategory.js";
|
|
26
|
-
import {CompositingStages} from "./composit/CompositingStages.js";
|
|
22
|
+
import { globalMetrics } from "../metrics/GlobalMetrics.js";
|
|
23
|
+
import { MetricsCategory } from "../metrics/MetricsCategory.js";
|
|
24
|
+
import { CompositingStages } from "./composit/CompositingStages.js";
|
|
27
25
|
|
|
28
26
|
import LayerCompositer from "./composit/LayerCompositer.js";
|
|
29
|
-
import {Camera} from "./ecs/camera/Camera.js";
|
|
30
|
-
import {MaterialManager} from "./material/manager/MaterialManager.js";
|
|
31
|
-
import {ColorAndDepthFrameBuffer} from "./render/buffer/buffers/ColorAndDepthFrameBuffer.js";
|
|
32
|
-
import {NormalFrameBuffer} from "./render/buffer/buffers/NormalFrameBuffer.js";
|
|
33
|
-
import {FrameBufferManager} from "./render/buffer/FrameBufferManager.js";
|
|
34
|
-
import {RenderLayerManager} from "./render/layers/RenderLayerManager.js";
|
|
35
|
-
import {RenderPassType} from "./render/RenderPassType.js";
|
|
36
|
-
import {renderTextureToScreenQuad} from "./render/utils/renderTextureToScreenQuad.js";
|
|
37
|
-
import {CameraViewManager} from "./render/view/CameraViewManager.js";
|
|
38
|
-
import {ShadowMapRenderer} from "./shadows/ShadowMapRenderer.js";
|
|
39
|
-
import {StandardFrameBuffers} from "./StandardFrameBuffers.js";
|
|
27
|
+
import { Camera } from "./ecs/camera/Camera.js";
|
|
28
|
+
import { MaterialManager } from "./material/manager/MaterialManager.js";
|
|
29
|
+
import { ColorAndDepthFrameBuffer } from "./render/buffer/buffers/ColorAndDepthFrameBuffer.js";
|
|
30
|
+
import { NormalFrameBuffer } from "./render/buffer/buffers/NormalFrameBuffer.js";
|
|
31
|
+
import { FrameBufferManager } from "./render/buffer/FrameBufferManager.js";
|
|
32
|
+
import { RenderLayerManager } from "./render/layers/RenderLayerManager.js";
|
|
33
|
+
import { RenderPassType } from "./render/RenderPassType.js";
|
|
34
|
+
import { renderTextureToScreenQuad } from "./render/utils/renderTextureToScreenQuad.js";
|
|
35
|
+
import { CameraViewManager } from "./render/view/CameraViewManager.js";
|
|
36
|
+
import { ShadowMapRenderer } from "./shadows/ShadowMapRenderer.js";
|
|
37
|
+
import { StandardFrameBuffers } from "./StandardFrameBuffers.js";
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
*
|
|
@@ -120,13 +118,6 @@ export class GraphicsEngine {
|
|
|
120
118
|
*/
|
|
121
119
|
this.layers = new RenderLayerManager();
|
|
122
120
|
|
|
123
|
-
/**
|
|
124
|
-
*
|
|
125
|
-
* @type {BinaryNode}
|
|
126
|
-
*/
|
|
127
|
-
this.bvh = new BinaryNode();
|
|
128
|
-
this.bvh.setNegativelyInfiniteBounds();
|
|
129
|
-
|
|
130
121
|
//renderer setup
|
|
131
122
|
const scene = new ThreeScene();
|
|
132
123
|
//prevent automatic updates to all descendants of the scene, such updates are very wasteful
|
|
@@ -265,11 +265,11 @@ function makeCameraClippingDebug(engine) {
|
|
|
265
265
|
drawConvexHull(vertices_up, 'rgb(255,111,0,0.1)', 'rgb(255,111,0,0.8)');
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
function drawBVH() {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
268
|
+
// function drawBVH() {
|
|
269
|
+
// engine.graphics.layers.traverse(layer => {
|
|
270
|
+
// layer.bvh.traverseLeavesPreOrderUsingStack(drawAABB);
|
|
271
|
+
// });
|
|
272
|
+
// }
|
|
273
273
|
|
|
274
274
|
const special_hits_0 = [];
|
|
275
275
|
const special_hits_1 = [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Mesh, PlaneBufferGeometry } from "three";
|
|
2
|
-
import Task from "../../../core/process/task/Task.js";
|
|
3
|
-
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
4
2
|
import { collectIteratorValueToArray } from "../../../core/collection/collectIteratorValueToArray.js";
|
|
5
3
|
import { clamp01 } from "../../../core/math/clamp01.js";
|
|
4
|
+
import Task from "../../../core/process/task/Task.js";
|
|
5
|
+
import { TaskSignal } from "../../../core/process/task/TaskSignal.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Compile all materials found in the dataset
|
|
@@ -61,19 +61,12 @@ export function compileAllMaterials({ graphics, timeout = 0, includeHiddenLayers
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @param {LeafNode} node
|
|
67
|
-
*/
|
|
68
|
-
function visitLeaf(node) {
|
|
69
|
-
const object3D = renderLayer.extractRenderable(node.object);
|
|
70
|
-
|
|
71
|
-
extractMaterialFromObject(object3D);
|
|
72
|
-
}
|
|
73
64
|
|
|
74
65
|
const n0 = materials.size;
|
|
75
66
|
|
|
76
|
-
|
|
67
|
+
// TODO extract materials
|
|
68
|
+
|
|
69
|
+
console.warn('No-op');
|
|
77
70
|
|
|
78
71
|
const n1 = materials.size;
|
|
79
72
|
|
|
@@ -7,11 +7,6 @@ export class ShadedGeometry {
|
|
|
7
7
|
material: Material
|
|
8
8
|
readonly mode: DrawMode
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
readonly bvh: Readonly<AABB3>
|
|
14
|
-
|
|
15
10
|
getBoundingBox(destination: AABB3): void
|
|
16
11
|
|
|
17
12
|
from(geometry: BufferGeometry, material: Material, draw_mode?: DrawMode): void
|
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
import {BoxBufferGeometry, MeshStandardMaterial, OctahedronGeometry} from "three";
|
|
2
|
-
import {OrbitingBehavior} from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
|
|
3
|
-
import {
|
|
4
|
-
import {convert_bvh_to_dot_format_string} from "../../../../../core/bvh2/visual/convert_bvh_to_dot_format_string.js";
|
|
5
|
-
import {Color} from "../../../../../core/color/Color.js";
|
|
1
|
+
import { BoxBufferGeometry, MeshStandardMaterial, OctahedronGeometry } from "three";
|
|
2
|
+
import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
|
|
3
|
+
import { Color } from "../../../../../core/color/Color.js";
|
|
6
4
|
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
7
5
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
8
6
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
9
|
-
import {randomFloatBetween} from "../../../../../core/math/random/randomFloatBetween.js";
|
|
10
|
-
import {randomFromArray} from "../../../../../core/math/random/randomFromArray.js";
|
|
11
|
-
import {seededRandom} from "../../../../../core/math/random/seededRandom.js";
|
|
7
|
+
import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
|
|
8
|
+
import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
|
|
9
|
+
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
12
10
|
import ButtonView from "../../../../../view/elements/button/ButtonView.js";
|
|
13
11
|
import Entity from "../../../../ecs/Entity.js";
|
|
14
12
|
import GUIElement from "../../../../ecs/gui/GUIElement.js";
|
|
15
13
|
import GUIElementSystem from "../../../../ecs/gui/GUIElementSystem.js";
|
|
16
14
|
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
17
15
|
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
18
|
-
import {Transform} from "../../../../ecs/transform/Transform.js";
|
|
19
|
-
import {EngineHarness} from "../../../../EngineHarness.js";
|
|
20
|
-
import {SequenceBehavior} from "../../../../intelligence/behavior/composite/SequenceBehavior.js";
|
|
21
|
-
import {RepeatBehavior} from "../../../../intelligence/behavior/decorator/RepeatBehavior.js";
|
|
22
|
-
import {BehaviorComponent} from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
23
|
-
import {BehaviorSystem} from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
24
|
-
import {ActionBehavior} from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
|
|
25
|
-
import {DelayBehavior} from "../../../../intelligence/behavior/util/DelayBehavior.js";
|
|
26
|
-
import {ShadedGeometry} from "../ShadedGeometry.js";
|
|
27
|
-
import {ShadedGeometryFlags} from "../ShadedGeometryFlags.js";
|
|
28
|
-
import {ShadedGeometrySystem} from "../ShadedGeometrySystem.js";
|
|
16
|
+
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
17
|
+
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
18
|
+
import { SequenceBehavior } from "../../../../intelligence/behavior/composite/SequenceBehavior.js";
|
|
19
|
+
import { RepeatBehavior } from "../../../../intelligence/behavior/decorator/RepeatBehavior.js";
|
|
20
|
+
import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
21
|
+
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
22
|
+
import { ActionBehavior } from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
|
|
23
|
+
import { DelayBehavior } from "../../../../intelligence/behavior/util/DelayBehavior.js";
|
|
24
|
+
import { ShadedGeometry } from "../ShadedGeometry.js";
|
|
25
|
+
import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
|
|
26
|
+
import { ShadedGeometrySystem } from "../ShadedGeometrySystem.js";
|
|
29
27
|
|
|
30
28
|
const eh = new EngineHarness();
|
|
31
29
|
|
|
@@ -150,11 +148,11 @@ async function main(engine) {
|
|
|
150
148
|
|
|
151
149
|
// makeMovingShadedGeometry().build(ecd);
|
|
152
150
|
|
|
153
|
-
debug_button(engine, () => {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}, 'save dot file');
|
|
151
|
+
// debug_button(engine, () => {
|
|
152
|
+
// const dot = convert_bvh_to_dot_format_string(engine.graphics.layers.getLayerByName('shaded-geometry').bvh);
|
|
153
|
+
// downloadAsFile(dot, 'bvh.dot', 'text');
|
|
154
|
+
//
|
|
155
|
+
// }, 'save dot file');
|
|
158
156
|
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
2
|
-
import { ShadedGeometrySystem } from "../ShadedGeometrySystem.js";
|
|
3
|
-
import Entity from "../../../../ecs/Entity.js";
|
|
4
|
-
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
5
|
-
import { ShadedGeometry } from "../ShadedGeometry.js";
|
|
6
1
|
import {
|
|
7
2
|
BoxBufferGeometry,
|
|
8
3
|
MeshBasicMaterial,
|
|
@@ -10,29 +5,32 @@ import {
|
|
|
10
5
|
OctahedronGeometry,
|
|
11
6
|
SphereBufferGeometry
|
|
12
7
|
} from "three";
|
|
8
|
+
import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
|
|
9
|
+
import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
|
|
10
|
+
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
11
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
12
|
+
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
13
13
|
import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
|
|
14
|
+
import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
|
|
15
|
+
import { randomIntegerBetween } from "../../../../../core/math/random/randomIntegerBetween.js";
|
|
14
16
|
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
15
|
-
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
16
|
-
import GUIElement from "../../../../ecs/gui/GUIElement.js";
|
|
17
17
|
import ButtonView from "../../../../../view/elements/button/ButtonView.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import Entity from "../../../../ecs/Entity.js";
|
|
19
|
+
import GUIElement from "../../../../ecs/gui/GUIElement.js";
|
|
20
20
|
import GUIElementSystem from "../../../../ecs/gui/GUIElementSystem.js";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
21
|
+
import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
|
|
22
|
+
import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
23
|
+
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
24
|
+
import { EngineHarness } from "../../../../EngineHarness.js";
|
|
25
25
|
import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
26
|
-
import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
|
|
27
26
|
import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
28
27
|
import {
|
|
29
28
|
MicronShadedGeometryRenderAdapter
|
|
30
29
|
} from "../../../micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js";
|
|
31
30
|
import { MicronRenderContext } from "../../../micron/render/v1/MicronRenderContext.js";
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
34
|
-
import {
|
|
35
|
-
import {downloadAsFile} from "../../../../../core/binary/downloadAsFile.js";
|
|
31
|
+
import { ShadedGeometry } from "../ShadedGeometry.js";
|
|
32
|
+
import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
|
|
33
|
+
import { ShadedGeometrySystem } from "../ShadedGeometrySystem.js";
|
|
36
34
|
|
|
37
35
|
const eh = new EngineHarness();
|
|
38
36
|
|
|
@@ -134,11 +132,11 @@ async function main(engine) {
|
|
|
134
132
|
|
|
135
133
|
// makeMovingShadedGeometry().build(ecd);
|
|
136
134
|
|
|
137
|
-
debug_button(engine, () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}, 'save dot file');
|
|
135
|
+
// debug_button(engine, () => {
|
|
136
|
+
// const dot = convert_bvh_to_dot_format_string(engine.graphics.layers.getLayerByName('shaded-geometry').bvh);
|
|
137
|
+
// downloadAsFile(dot, 'bvh.dot', 'text');
|
|
138
|
+
//
|
|
139
|
+
// }, 'save dot file');
|
|
142
140
|
|
|
143
141
|
const raycast_marker = new Entity()
|
|
144
142
|
.add(ShadedGeometry.from(new SphereBufferGeometry(1), new MeshBasicMaterial({
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { EngineHarness } from "../../../EngineHarness.js";
|
|
2
|
-
import { EngineConfiguration } from "../../../EngineConfiguration.js";
|
|
3
|
-
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
4
|
-
import { AttachmentSystem } from "../../../ecs/attachment/AttachmentSystem.js";
|
|
5
|
-
import { TransformAttachmentSystem } from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
6
1
|
import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
7
2
|
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
3
|
+
import { AttachmentSystem } from "../../../ecs/attachment/AttachmentSystem.js";
|
|
4
|
+
import { TransformAttachmentSystem } from "../../../ecs/transform-attachment/TransformAttachmentSystem.js";
|
|
5
|
+
import { EngineConfiguration } from "../../../EngineConfiguration.js";
|
|
6
|
+
import { EngineHarness } from "../../../EngineHarness.js";
|
|
7
|
+
import { ShadedGeometrySystem } from "../../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
8
8
|
import { three_object_to_entity_composition } from "../../ecs/mesh-v2/three_object_to_entity_composition.js";
|
|
9
9
|
import { MaterialOptimizationContext } from "./MaterialOptimizationContext.js";
|
|
10
|
-
import {
|
|
11
|
-
bvh_traverse_pre_order_using_stack
|
|
12
|
-
} from "../../../../core/bvh2/traversal/bvh_traverse_pre_order_using_stack.js";
|
|
13
10
|
|
|
14
11
|
const eh = new EngineHarness();
|
|
15
12
|
|
|
@@ -23,17 +20,17 @@ function optimize(engine) {
|
|
|
23
20
|
|
|
24
21
|
const optimizer = new MaterialOptimizationContext();
|
|
25
22
|
|
|
26
|
-
engine.graphics.layers.layers.forEach(l => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
});
|
|
23
|
+
// engine.graphics.layers.layers.forEach(l => {
|
|
24
|
+
// bvh_traverse_pre_order_using_stack(l.bvh, node => {
|
|
25
|
+
// if (node.isLeafNode) {
|
|
26
|
+
// const object = l.extractRenderable(node.object);
|
|
27
|
+
//
|
|
28
|
+
// if (object) {
|
|
29
|
+
// optimizer.addObject(object);
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
// });
|
|
33
|
+
// });
|
|
37
34
|
|
|
38
35
|
optimizer.update();
|
|
39
36
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { mat4 } from "gl-matrix";
|
|
2
|
+
import SimplexNoise from "simplex-noise";
|
|
1
3
|
import {
|
|
2
4
|
AmbientLight,
|
|
3
5
|
BoxBufferGeometry,
|
|
@@ -16,56 +18,53 @@ import {
|
|
|
16
18
|
Vector2,
|
|
17
19
|
WebGLRenderer,
|
|
18
20
|
} from "three";
|
|
19
|
-
import { min2 } from "../../../../../core/math/min2.js";
|
|
20
|
-
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
21
|
-
import { PointLight } from "../model/PointLight.js";
|
|
22
|
-
import { makeHelperSphereGeometry } from "../../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
23
21
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
24
|
-
import { MouseEvents } from "../../../../input/devices/events/MouseEvents.js";
|
|
25
|
-
import { RingBuffer } from "../../../../../core/collection/RingBuffer.js";
|
|
26
|
-
import { query_bvh_frustum_from_objects } from "../query/query_bvh_frustum_from_objects.js";
|
|
27
|
-
import { FPlusDebugMaterial } from "../materials/FPlusDebugMaterial.js";
|
|
28
|
-
import { parse_color } from "../../../../../core/color/parse_color.js";
|
|
29
|
-
import { buildLightClusterWidget } from "../debug/buildLightClusterWidget.js";
|
|
30
|
-
import domify from "../../../../../view/DOM.js";
|
|
31
|
-
import { createScreenGrid } from "../debug/createScreenGrid.js";
|
|
32
|
-
import { createLayerSwitcher } from "../debug/createLayerSwitcher.js";
|
|
33
|
-
import { FPlusStandardMaterial } from "../materials/FPlusStandardMaterial.js";
|
|
34
|
-
import { LightManager } from "../LightManager.js";
|
|
35
|
-
import ButtonView from "../../../../../view/elements/button/ButtonView.js";
|
|
36
|
-
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
37
|
-
import { traverseMaterialTextures } from "../../../../asset/loaders/material/traverseMaterialTextures.js";
|
|
38
|
-
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
39
|
-
import { MetricCollection } from "../../../../development/performance/MetricCollection.js";
|
|
40
|
-
import { MetricStatistics } from "../../../../development/performance/MetricStatistics.js";
|
|
41
|
-
import { SpotLight } from "../model/SpotLight.js";
|
|
42
|
-
import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
|
|
43
|
-
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
44
|
-
import SimplexNoise from "simplex-noise";
|
|
45
22
|
import Stats from "three/examples/jsm/libs/stats.module.js";
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
23
|
+
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
24
|
+
import { Float32BufferAttribute } from "three/src/core/BufferAttribute.js";
|
|
25
|
+
import { BufferGeometry } from "three/src/core/BufferGeometry.js";
|
|
26
|
+
import { DEG2RAD, smoothstep } from "three/src/math/MathUtils.js";
|
|
27
|
+
import '../../../../../../../../../css/game.scss'
|
|
50
28
|
import { makeHelperBoxGeometry } from "../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
|
|
29
|
+
import { makeHelperSphereGeometry } from "../../../../../../editor/process/symbolic/makeHelperSphereGeometry.js";
|
|
51
30
|
import { array_copy } from "../../../../../core/collection/array/array_copy.js";
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
31
|
+
import { RingBuffer } from "../../../../../core/collection/RingBuffer.js";
|
|
32
|
+
import { Color } from "../../../../../core/color/Color.js";
|
|
33
|
+
import { parse_color } from "../../../../../core/color/parse_color.js";
|
|
34
|
+
import Signal from "../../../../../core/events/signal/Signal.js";
|
|
54
35
|
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
55
36
|
import { v2_distance } from "../../../../../core/geom/Vector2.js";
|
|
56
|
-
import
|
|
37
|
+
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
38
|
+
import { Localization } from "../../../../../core/localization/Localization.js";
|
|
39
|
+
import { min2 } from "../../../../../core/math/min2.js";
|
|
40
|
+
import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
|
|
41
|
+
import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
|
|
42
|
+
import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
|
|
43
|
+
import { number_pretty_print } from "../../../../../core/primitives/numbers/number_pretty_print.js";
|
|
44
|
+
import domify from "../../../../../view/DOM.js";
|
|
45
|
+
import ButtonView from "../../../../../view/elements/button/ButtonView.js";
|
|
46
|
+
import { GMLEngine } from "../../../../../view/tooltip/gml/GMLEngine.js";
|
|
47
|
+
import { TooltipManager } from "../../../../../view/tooltip/TooltipManager.js";
|
|
57
48
|
import { AssetManager } from "../../../../asset/AssetManager.js";
|
|
58
49
|
import { ImageRGBADataLoader } from "../../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
50
|
+
import { traverseMaterialTextures } from "../../../../asset/loaders/material/traverseMaterialTextures.js";
|
|
51
|
+
import { MetricCollection } from "../../../../development/performance/MetricCollection.js";
|
|
52
|
+
import { MetricStatistics } from "../../../../development/performance/MetricStatistics.js";
|
|
53
|
+
import { MouseEvents } from "../../../../input/devices/events/MouseEvents.js";
|
|
62
54
|
import { PointerDevice } from "../../../../input/devices/PointerDevice.js";
|
|
63
55
|
import { StaticKnowledgeDatabase } from "../../../../knowledge/database/StaticKnowledgeDatabase.js";
|
|
64
|
-
import { Localization } from "../../../../../core/localization/Localization.js";
|
|
65
|
-
import '../../../../../../../../../css/game.scss'
|
|
66
|
-
import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
|
|
67
56
|
import { debugAtlas } from "../../../particles/particular/engine/shader/debugAtlas.js";
|
|
68
|
-
import {
|
|
57
|
+
import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
|
|
58
|
+
import { threeUpdateTransform } from "../../../util/threeUpdateTransform.js";
|
|
59
|
+
import { buildLightClusterWidget } from "../debug/buildLightClusterWidget.js";
|
|
60
|
+
import { createLayerSwitcher } from "../debug/createLayerSwitcher.js";
|
|
61
|
+
import { createScreenGrid } from "../debug/createScreenGrid.js";
|
|
62
|
+
import { LightManager } from "../LightManager.js";
|
|
63
|
+
import { FPlusDebugMaterial } from "../materials/FPlusDebugMaterial.js";
|
|
64
|
+
import { FPlusStandardMaterial } from "../materials/FPlusStandardMaterial.js";
|
|
65
|
+
import { Decal } from "../model/Decal.js";
|
|
66
|
+
import { PointLight } from "../model/PointLight.js";
|
|
67
|
+
import { SpotLight } from "../model/SpotLight.js";
|
|
69
68
|
|
|
70
69
|
document.body.style.margin = 0;
|
|
71
70
|
|
|
@@ -1532,20 +1531,20 @@ function print_perf_stats() {
|
|
|
1532
1531
|
setInterval(print_perf_stats, 2000);
|
|
1533
1532
|
|
|
1534
1533
|
function do_sample() {
|
|
1535
|
-
query_bvh_frustum_from_objects.iteration_count = 0;
|
|
1536
|
-
query_bvh_frustum_from_objects.rejection_count = 0;
|
|
1537
|
-
query_bvh_frustum_from_objects.rejection_sphere_count = 0;
|
|
1538
|
-
query_bvh_frustum_from_objects.plane_tests = 0;
|
|
1539
|
-
query_bvh_frustum_from_objects.plane_tests_early_exits = 0;
|
|
1534
|
+
// query_bvh_frustum_from_objects.iteration_count = 0;
|
|
1535
|
+
// query_bvh_frustum_from_objects.rejection_count = 0;
|
|
1536
|
+
// query_bvh_frustum_from_objects.rejection_sphere_count = 0;
|
|
1537
|
+
// query_bvh_frustum_from_objects.plane_tests = 0;
|
|
1538
|
+
// query_bvh_frustum_from_objects.plane_tests_early_exits = 0;
|
|
1540
1539
|
|
|
1541
1540
|
const t0 = performance.now();
|
|
1542
1541
|
lm.buildTiles(camera);
|
|
1543
1542
|
const t1 = performance.now();
|
|
1544
1543
|
|
|
1545
1544
|
metrics.get("time").record(t1 - t0);
|
|
1546
|
-
metrics.get("iterations").record(query_bvh_frustum_from_objects.iteration_count);
|
|
1547
|
-
metrics.get("rejections").record(query_bvh_frustum_from_objects.rejection_count);
|
|
1548
|
-
metrics.get("sphere_rejections").record(query_bvh_frustum_from_objects.rejection_sphere_count);
|
|
1545
|
+
// metrics.get("iterations").record(query_bvh_frustum_from_objects.iteration_count);
|
|
1546
|
+
// metrics.get("rejections").record(query_bvh_frustum_from_objects.rejection_count);
|
|
1547
|
+
// metrics.get("sphere_rejections").record(query_bvh_frustum_from_objects.rejection_sphere_count);
|
|
1549
1548
|
}
|
|
1550
1549
|
|
|
1551
1550
|
function draw_camera_view_planes() {
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import {Object3D} from "three";
|
|
2
|
-
import {BinaryNode} from "../../../../core/bvh2/BinaryNode";
|
|
3
2
|
import {IncrementalDeltaSet} from "../visibility/IncrementalDeltaSet";
|
|
4
3
|
import {RenderLayerState} from "./RenderLayerState";
|
|
5
4
|
|
|
6
5
|
export class RenderLayer {
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
bvh: BinaryNode
|
|
11
6
|
name: string
|
|
12
7
|
state: RenderLayerState
|
|
13
8
|
|
|
@@ -3,61 +3,45 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { BinaryNode } from '../../../../core/bvh2/BinaryNode.js';
|
|
7
6
|
import { passThrough } from "../../../../core/function/Functions.js";
|
|
8
7
|
import { compare_three_objects } from "../../three/compare_three_objects.js";
|
|
9
8
|
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
10
9
|
import { RenderLayerState } from "./RenderLayerState.js";
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @type {*[]}
|
|
16
|
-
*/
|
|
17
|
-
const scratch_array = [];
|
|
18
|
-
|
|
19
11
|
export class RenderLayer {
|
|
20
|
-
constructor() {
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated
|
|
23
|
-
* @type {BinaryNode}
|
|
24
|
-
*/
|
|
25
|
-
this.bvh = new BinaryNode();
|
|
26
|
-
this.bvh.setNegativelyInfiniteBounds();
|
|
27
12
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @type {RenderLayerState}
|
|
16
|
+
*/
|
|
17
|
+
state = new RenderLayerState();
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {String|null}
|
|
22
|
+
*/
|
|
23
|
+
name = null;
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Layer is managed externally, visibility will not be updated in the rendering engine
|
|
27
|
+
* @deprecated
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
managed = false;
|
|
46
31
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @type {function(*): Object3D}
|
|
35
|
+
*/
|
|
36
|
+
extractRenderable = passThrough;
|
|
52
37
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated use CameraView's visible set instead
|
|
40
|
+
* Contains visible elements across all views, if element is in at least one view - it will be here
|
|
41
|
+
* @deprecated
|
|
42
|
+
* @type {IncrementalDeltaSet<THREE.Object3D>}
|
|
43
|
+
*/
|
|
44
|
+
visibleSet = new IncrementalDeltaSet(compare_three_objects);
|
|
61
45
|
|
|
62
46
|
/**
|
|
63
47
|
* @deprecated
|
|
@@ -90,7 +74,7 @@ export class RenderLayer {
|
|
|
90
74
|
}
|
|
91
75
|
|
|
92
76
|
/**
|
|
93
|
-
@deprecated
|
|
77
|
+
* @deprecated
|
|
94
78
|
* @param {THREE.Object3D[]} destination
|
|
95
79
|
* @param {number} destination_offset
|
|
96
80
|
* @param {CameraView} view
|