@woosh/meep-engine 2.66.0 → 2.67.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 -1755
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +127 -1755
- 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-v2/sample/prototypeShadedGeometry.js +22 -24
- package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +21 -23
- package/src/engine/graphics/render/layers/RenderLayer.d.ts +0 -5
- package/src/engine/graphics/render/layers/RenderLayer.js +29 -45
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
|
|
|
@@ -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,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
|