@woosh/meep-engine 2.65.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/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +51290 -54244
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +51290 -54244
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.js +4 -10
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +7 -7
- package/editor/tools/SelectionTool.js +6 -95
- package/package.json +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +118 -113
- package/src/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/src/core/bvh2/binary/2/bvh32_query_user_data_ray.js +98 -0
- package/src/core/bvh2/bvh3/BVH.d.ts +1 -1
- package/src/core/bvh2/bvh3/BvhClient.d.ts +11 -0
- package/src/core/bvh2/bvh3/BvhClient.js +19 -0
- package/src/core/collection/array/array_copy.js +6 -0
- package/src/core/geom/3d/aabb/aabb3_array_combine.js +17 -8
- package/src/core/geom/3d/aabb/aabb3_array_intersects_ray.js +5 -2
- package/src/core/geom/3d/aabb/aabb3_array_set.js +25 -0
- package/src/core/geom/3d/aabb/aabb3_compute_half_surface_area.js +3 -0
- package/src/core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js +8 -1
- package/src/engine/EngineHarness.js +23 -25
- package/src/engine/ecs/renderable/RenderSystem.js +44 -32
- package/src/engine/ecs/renderable/Renderable.d.ts +2 -2
- package/src/engine/ecs/renderable/Renderable.js +12 -11
- package/src/engine/ecs/terrain/ecs/Terrain.js +83 -87
- package/src/engine/ecs/terrain/ecs/TerrainSystem.js +106 -57
- package/src/engine/ecs/terrain/ecs/makeTerrainWorkerProxy.js +5 -2
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +122 -67
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +162 -146
- package/src/engine/ecs/terrain/tiles/TileBuildWorker.js +16 -5
- package/src/engine/graphics/GraphicsEngine.js +16 -25
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +8 -11
- package/src/engine/graphics/debug/VisualSymbolLine.js +1 -0
- package/src/engine/graphics/ecs/camera/CameraSystem.js +9 -9
- package/src/engine/graphics/ecs/camera/auto_set_camera_clipping_planes.js +3 -23
- package/src/engine/graphics/ecs/compileAllMaterials.js +5 -12
- package/src/engine/graphics/ecs/light/LightSystem.js +12 -48
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +9 -31
- package/src/engine/graphics/ecs/mesh/updateNodeByTransformAndBBB.js +3 -43
- 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/ecs/trail2d/Trail2D.js +105 -106
- package/src/engine/graphics/ecs/trail2d/Trail2DSystem.js +60 -61
- package/src/engine/graphics/ecs/trail2d/makeGradientTrail.js +3 -3
- package/src/engine/graphics/ecs/water/WATER_SIZE.js +1 -0
- package/src/engine/graphics/ecs/water/Water.js +84 -42
- package/src/engine/graphics/ecs/water/WaterSystem.js +53 -105
- package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +13 -7
- package/src/engine/graphics/geometry/bvh/buffered/bvh32_from_indexed_geometry.js +58 -0
- package/src/engine/graphics/particles/ecs/ParticleEmitterSystem.js +32 -62
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1 -1
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +8 -11
- package/src/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +21 -19
- package/src/engine/graphics/render/layers/RenderLayer.d.ts +4 -3
- package/src/engine/graphics/render/layers/RenderLayer.js +34 -108
- package/src/engine/graphics/render/make_bvh_visibility_builder.js +64 -0
- package/src/engine/graphics/three/expand_aabb_by_transformed_three_object.js +4 -4
- package/src/engine/graphics/trail/x/RibbonX.js +26 -5
- package/src/core/bvh2/binary/tiny/TinyBVH.js +0 -221
- package/src/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +0 -138
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { System } from '../../../ecs/System.js';
|
|
7
|
-
import { Camera } from './Camera.js';
|
|
8
|
-
import { Transform } from '../../../ecs/transform/Transform.js';
|
|
9
6
|
import { Frustum as ThreeFrustum, } from 'three';
|
|
10
7
|
import { assert } from "../../../../core/assert.js";
|
|
11
8
|
import { SignalBinding } from "../../../../core/events/signal/SignalBinding.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
9
|
+
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
10
|
+
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
11
|
+
import { System } from '../../../ecs/System.js';
|
|
12
|
+
import { Transform } from '../../../ecs/transform/Transform.js';
|
|
15
13
|
import { auto_set_camera_clipping_planes } from "./auto_set_camera_clipping_planes.js";
|
|
14
|
+
import { build_three_camera_object } from "./build_three_camera_object.js";
|
|
15
|
+
import { Camera } from './Camera.js';
|
|
16
16
|
import { frustum_from_camera } from "./frustum_from_camera.js";
|
|
17
17
|
import { invertQuaternionOrientation } from "./InvertQuaternionOrientation.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
18
|
+
import { set_camera_aspect_ratio } from "./set_camera_aspect_ratio.js";
|
|
19
|
+
import { update_camera_transform } from "./update_camera_transform.js";
|
|
20
20
|
|
|
21
21
|
export class CameraSystem extends System {
|
|
22
22
|
/**
|
|
@@ -32,7 +32,7 @@ export class CameraSystem extends System {
|
|
|
32
32
|
this.dependencies = [Camera, Transform];
|
|
33
33
|
|
|
34
34
|
this.components_used = [
|
|
35
|
-
ResourceAccessSpecification.from(Camera,ResourceAccessKind.Write)
|
|
35
|
+
ResourceAccessSpecification.from(Camera, ResourceAccessKind.Write)
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -1,32 +1,12 @@
|
|
|
1
|
-
import { CameraClippingPlaneComputer } from "./CameraClippingPlaneComputer.js";
|
|
2
|
-
|
|
3
|
-
const cameraClippingPlaneComputer = new CameraClippingPlaneComputer();
|
|
4
|
-
|
|
5
1
|
/**
|
|
6
2
|
*
|
|
7
3
|
* @param {Camera} c
|
|
8
4
|
* @param {RenderLayerManager} layers
|
|
9
5
|
*/
|
|
10
6
|
export function auto_set_camera_clipping_planes(c, layers) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* @type {number}
|
|
16
|
-
*/
|
|
17
|
-
const hysteresis = c.autoClipHysteresis;
|
|
18
|
-
|
|
19
|
-
cameraClippingPlaneComputer.hysteresis = hysteresis;
|
|
20
|
-
cameraClippingPlaneComputer.camera = camera;
|
|
21
|
-
cameraClippingPlaneComputer.layers = layers;
|
|
22
|
-
|
|
23
|
-
cameraClippingPlaneComputer.compute();
|
|
24
|
-
|
|
25
|
-
if (camera.near !== cameraClippingPlaneComputer.near || camera.far !== cameraClippingPlaneComputer.far) {
|
|
26
|
-
camera.near = cameraClippingPlaneComputer.near;
|
|
27
|
-
camera.far = cameraClippingPlaneComputer.far;
|
|
7
|
+
// TODO implement
|
|
28
8
|
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
c.object.far = c.clip_far;
|
|
10
|
+
c.object.near = c.clip_near;
|
|
31
11
|
|
|
32
12
|
}
|
|
@@ -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
|
|
|
@@ -3,23 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
import { assert } from "../../../../core/assert.js";
|
|
7
|
+
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
8
|
+
import { ResourceAccessKind } from "../../../../core/model/ResourceAccessKind.js";
|
|
9
|
+
import { ResourceAccessSpecification } from "../../../../core/model/ResourceAccessSpecification.js";
|
|
10
|
+
import { AbstractContextSystem } from "../../../ecs/system/AbstractContextSystem.js";
|
|
6
11
|
import { Transform } from '../../../ecs/transform/Transform.js';
|
|
7
|
-
import {
|
|
12
|
+
import { ForwardPlusRenderingPlugin } from "../../render/forward_plus/plugin/ForwardPlusRenderingPlugin.js";
|
|
8
13
|
import { Camera } from '../camera/Camera.js';
|
|
9
14
|
|
|
10
15
|
import FrustumProjector from '../camera/FrustumProjector.js';
|
|
11
|
-
import {
|
|
12
|
-
import { CameraClippingPlaneComputer } from "../camera/CameraClippingPlaneComputer.js";
|
|
13
|
-
import { assert } from "../../../../core/assert.js";
|
|
14
|
-
import { ForwardPlusRenderingPlugin } from "../../render/forward_plus/plugin/ForwardPlusRenderingPlugin.js";
|
|
15
|
-
import { ThreeLightCache } from "./three/ThreeLightCache.js";
|
|
16
|
-
import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
|
|
17
|
-
import { ShadowManager } from "./shadow/ShadowManager.js";
|
|
18
|
-
import { AbstractContextSystem } from "../../../ecs/system/AbstractContextSystem.js";
|
|
16
|
+
import { Light } from './Light.js';
|
|
19
17
|
import { LightContext } from "./LightContext.js";
|
|
18
|
+
import { LightType } from "./LightType.js";
|
|
20
19
|
import { setShadowCameraDimensionsDiscrete } from "./shadow/setShadowCameraDimensionsDiscrete.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
20
|
+
import { ShadowManager } from "./shadow/ShadowManager.js";
|
|
21
|
+
import { ThreeLightCache } from "./three/ThreeLightCache.js";
|
|
23
22
|
|
|
24
23
|
class LightSystem extends AbstractContextSystem {
|
|
25
24
|
/**
|
|
@@ -265,8 +264,6 @@ class LightSystem extends AbstractContextSystem {
|
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
266
|
|
|
268
|
-
const cameraClippingPlaneComputer = new CameraClippingPlaneComputer();
|
|
269
|
-
|
|
270
267
|
const scratch_aabb3 = new AABB3();
|
|
271
268
|
|
|
272
269
|
/**
|
|
@@ -278,10 +275,6 @@ const scratch_aabb3 = new AABB3();
|
|
|
278
275
|
*/
|
|
279
276
|
function updateShadowMap(camera, light, graphics) {
|
|
280
277
|
|
|
281
|
-
/**
|
|
282
|
-
* @type {RenderLayerManager}
|
|
283
|
-
*/
|
|
284
|
-
const layers = graphics.layers;
|
|
285
278
|
|
|
286
279
|
// Fit shadow camera's ortho frustum to camera frustum
|
|
287
280
|
const shadow = light.shadow;
|
|
@@ -310,43 +303,14 @@ function updateShadowMap(camera, light, graphics) {
|
|
|
310
303
|
|
|
311
304
|
// collect all visible objects
|
|
312
305
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
cameraClippingPlaneComputer.camera = shadowCamera;
|
|
316
|
-
cameraClippingPlaneComputer.layers = layers;
|
|
317
|
-
|
|
318
|
-
cameraClippingPlaneComputer.compute();
|
|
319
|
-
|
|
320
|
-
shadowCamera.near = cameraClippingPlaneComputer.near;
|
|
321
|
-
shadowCamera.far = cameraClippingPlaneComputer.far;
|
|
306
|
+
shadowCamera.near = 0.1;
|
|
307
|
+
shadowCamera.far = 100;
|
|
322
308
|
|
|
323
309
|
shadowCamera.updateProjectionMatrix();
|
|
324
310
|
|
|
325
311
|
// small bias to prevent shadow acne
|
|
326
312
|
shadow.bias = -0.0001;
|
|
327
313
|
|
|
328
|
-
//
|
|
329
|
-
// const frustum = new Frustum();
|
|
330
|
-
// frustumFromCamera(shadowCamera, frustum);
|
|
331
|
-
// visitor.setFrustums([frustum]);
|
|
332
|
-
// visitor.collector = collector;
|
|
333
|
-
//
|
|
334
|
-
// shadow_scene.children = [];
|
|
335
|
-
//
|
|
336
|
-
// const layers_list = layers.layers;
|
|
337
|
-
// const layer_count = layers_list.length;
|
|
338
|
-
//
|
|
339
|
-
// for (let i = 0; i < layer_count; i++) {
|
|
340
|
-
// const renderLayer = layers_list.get(i);
|
|
341
|
-
//
|
|
342
|
-
// collector.callbackContext = shadow_scene.children;
|
|
343
|
-
// collector.callback = Array.prototype.push;
|
|
344
|
-
// collector.reader = renderLayer.extractRenderable;
|
|
345
|
-
//
|
|
346
|
-
// traverseBinaryNodeUsingVisitor(renderLayer.bvh, visitor);
|
|
347
|
-
// }
|
|
348
|
-
//
|
|
349
|
-
// graphics.shadowmap_renderer.update(graphics.renderer, light.shadow, shadow_scene, camera, light);
|
|
350
314
|
}
|
|
351
315
|
|
|
352
316
|
export default LightSystem;
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
import { BoxBufferGeometry, MeshLambertMaterial } from "three";
|
|
7
7
|
import { assert } from "../../../../core/assert.js";
|
|
8
8
|
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
9
|
-
import {
|
|
10
|
-
bvh_query_user_data_overlaps_frustum
|
|
11
|
-
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
12
9
|
import { SignalBinding } from "../../../../core/events/signal/SignalBinding.js";
|
|
13
10
|
|
|
14
11
|
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
@@ -17,6 +14,7 @@ import { ResourceAccessSpecification } from "../../../../core/model/ResourceAcce
|
|
|
17
14
|
import { GLTFAssetLoader } from "../../../asset/loaders/GLTFAssetLoader.js";
|
|
18
15
|
import { System } from "../../../ecs/System.js";
|
|
19
16
|
import { Transform } from "../../../ecs/transform/Transform.js";
|
|
17
|
+
import { make_bvh_visibility_builder } from "../../render/make_bvh_visibility_builder.js";
|
|
20
18
|
|
|
21
19
|
import checkerTexture from "../../texture/CheckersTexture.js";
|
|
22
20
|
|
|
@@ -34,8 +32,6 @@ const PLACEHOLDER_TEXTURE = checkerTexture.create();
|
|
|
34
32
|
|
|
35
33
|
const PLACEHOLDER_MATERIAL = new MeshLambertMaterial({ map: PLACEHOLDER_TEXTURE });
|
|
36
34
|
|
|
37
|
-
const scratch_array = [];
|
|
38
|
-
|
|
39
35
|
export class MeshSystem extends System {
|
|
40
36
|
/**
|
|
41
37
|
*
|
|
@@ -152,37 +148,19 @@ export class MeshSystem extends System {
|
|
|
152
148
|
const graphics = this.graphics;
|
|
153
149
|
this.renderLayer = graphics.layers.create("mesh-system");
|
|
154
150
|
|
|
155
|
-
this.renderLayer.buildVisibleSet = (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (ecd === null) {
|
|
160
|
-
return 0;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const view_frustum = view.frustum;
|
|
164
|
-
|
|
165
|
-
const hit_count = bvh_query_user_data_overlaps_frustum(scratch_array, 0, this.__bvh_binary, view_frustum);
|
|
166
|
-
|
|
167
|
-
let added = 0;
|
|
168
|
-
|
|
169
|
-
for (let i = 0; i < hit_count; i++) {
|
|
170
|
-
const entity = scratch_array[i];
|
|
171
|
-
|
|
151
|
+
this.renderLayer.buildVisibleSet = make_bvh_visibility_builder(
|
|
152
|
+
this.entityManager, this.__bvh_binary,
|
|
153
|
+
(destination, offset, entity, ecd) => {
|
|
172
154
|
const component = ecd.getComponent(entity, Mesh);
|
|
173
155
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (object3D === null) {
|
|
177
|
-
continue;
|
|
156
|
+
if (component.mesh === null) {
|
|
157
|
+
return 0;
|
|
178
158
|
}
|
|
179
159
|
|
|
180
|
-
destination[
|
|
181
|
-
|
|
160
|
+
destination[offset] = component.mesh;
|
|
161
|
+
return 1;
|
|
182
162
|
}
|
|
183
|
-
|
|
184
|
-
return added;
|
|
185
|
-
};
|
|
163
|
+
)
|
|
186
164
|
|
|
187
165
|
const visibleSet = this.renderLayer.visibleSet;
|
|
188
166
|
|
|
@@ -1,54 +1,14 @@
|
|
|
1
1
|
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Common buffer for scratch objects for better cache locality
|
|
5
|
-
* @type {ArrayBuffer}
|
|
6
|
-
*/
|
|
7
|
-
const scratch_buffer = new ArrayBuffer(28 * 4);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @type {Float32Array}
|
|
12
|
-
*/
|
|
13
|
-
const scratch_matrix4 = new Float32Array(scratch_buffer, 0, 16);
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {Float32Array}
|
|
18
|
-
*/
|
|
19
|
-
const scratch_aabb_0 = new Float32Array(scratch_buffer, 64, 6);
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @type {Float32Array}
|
|
24
|
-
*/
|
|
25
|
-
const scratch_aabb_1 = new Float32Array(scratch_buffer, 88, 6);
|
|
26
|
-
|
|
27
3
|
/**
|
|
28
4
|
*
|
|
29
|
-
* @param {
|
|
5
|
+
* @param {BvhClient} bvh
|
|
30
6
|
* @param {AABB3} boundingBox
|
|
31
7
|
* @param {Transform} transform
|
|
32
8
|
*/
|
|
33
9
|
export function updateNodeByTransformAndBBB(bvh, boundingBox, transform) {
|
|
34
|
-
transform.
|
|
35
|
-
|
|
36
|
-
updateNodeByMatrix4AndBBB(bvh, boundingBox, scratch_matrix4);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param {LeafNode} bvh
|
|
42
|
-
* @param {AABB3} boundingBox
|
|
43
|
-
* @param {ArrayLike<number>|number[]|Float32Array} matrix4
|
|
44
|
-
*/
|
|
45
|
-
export function updateNodeByMatrix4AndBBB(bvh, boundingBox, matrix4) {
|
|
46
|
-
boundingBox.writeToArray(scratch_aabb_1, 0);
|
|
47
|
-
|
|
48
|
-
aabb3_matrix4_project(scratch_aabb_0, scratch_aabb_1, matrix4);
|
|
49
|
-
|
|
50
|
-
bvh.readFromArray(scratch_aabb_0, 0);
|
|
10
|
+
aabb3_matrix4_project(bvh.bounds, boundingBox, transform.matrix);
|
|
51
11
|
|
|
52
|
-
bvh.
|
|
12
|
+
bvh.write_bounds();
|
|
53
13
|
}
|
|
54
14
|
|
|
@@ -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({
|