@woosh/meep-engine 2.43.6 → 2.43.8
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/geom/3d/SurfacePoint3.js +8 -0
- package/core/geom/3d/aabb/compute_aabb_from_points.js +1 -1
- package/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +10 -4
- package/core/geom/3d/topology/samples/sampleFloodFill.js +275 -0
- package/core/geom/3d/topology/simplify/prototypeMeshSimplification.js +5 -6
- package/core/geom/3d/topology/struct/TopoMesh.js +17 -0
- package/core/geom/3d/topology/three_buffer_geometry_to_topo_mesh.js +30 -0
- package/core/geom/3d/topology/{topoMeshToBufferGeometry.js → topo_mesh_to_three_buffer_geometry.js} +1 -1
- package/core/geom/3d/topology/util/mesh_flood_fill.js +61 -0
- package/engine/Engine.js +1 -1
- package/engine/EngineHarness.js +5 -5
- package/engine/ecs/parent/EntityNode.js +1 -2
- package/engine/graphics/GraphicsEngine.js +5 -2
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +1 -1
- package/engine/graphics/ecs/mesh-v2/aggregate/SGMeshSystem.js +10 -0
- package/engine/graphics/geometry/buffered/makeGeometryIndexed.js +5 -4
- package/engine/graphics/geometry/buffered/query/RaycastNearestHitComputingVisitor.js +6 -5
- package/engine/graphics/impostors/octahedral/README.md +4 -0
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +6 -5
- package/engine/graphics/impostors/octahedral/shader/ImpostorShaderV0.js +194 -20
- package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +2 -2
- package/engine/graphics/micron/plugin/MicronRenderPlugin.js +1 -31
- package/engine/graphics/micron/plugin/shaded_geometry/MicronShadedGeometryRenderAdapter.js +23 -5
- package/engine/graphics/micron/simplifyGeometry.js +4 -2
- package/engine/graphics/sh3/LightProbeVolume.js +28 -5
- package/engine/graphics/sh3/README.md +3 -0
- package/engine/graphics/sh3/SH3VisualisationMaterial.js +1 -0
- package/engine/graphics/sh3/prototypeSH3Probe.js +26 -21
- package/engine/graphics/shadows/README.md +6 -0
- package/engine/input/devices/PointerDevice.js +28 -0
- package/package.json +1 -1
- package/samples/terrain/from_image_2.js +1 -45
- package/view/elements/navigation/ViewStack.js +4 -2
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
DataTexture,
|
|
11
11
|
LinearFilter,
|
|
12
12
|
MeshBasicMaterial,
|
|
13
|
-
MeshStandardMaterial,
|
|
14
13
|
NearestFilter,
|
|
15
14
|
PlaneBufferGeometry,
|
|
16
15
|
RGBAFormat,
|
|
@@ -32,6 +31,7 @@ import { make_justified_point_grid } from "../../../core/geom/3d/util/make_justi
|
|
|
32
31
|
import LightSystem from "../ecs/light/LightSystem.js";
|
|
33
32
|
import { Light } from "../ecs/light/Light.js";
|
|
34
33
|
import { LightType } from "../ecs/light/LightType.js";
|
|
34
|
+
import { buildCubeURLs } from "../texture/cubemap/buildCubeURLs.js";
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
*
|
|
@@ -185,13 +185,15 @@ async function main(engine) {
|
|
|
185
185
|
enableWater: false,
|
|
186
186
|
enableTerrain: false,
|
|
187
187
|
enableLights: false,
|
|
188
|
+
// enableLights: true,
|
|
188
189
|
cameraFarDistance: 200,
|
|
189
190
|
focus: { x: 0, y: 0, z: 0 },
|
|
190
|
-
pitch:
|
|
191
|
-
yaw: -
|
|
192
|
-
distance:
|
|
191
|
+
pitch: 1,
|
|
192
|
+
yaw: -1.54,
|
|
193
|
+
distance: 54,
|
|
193
194
|
shadowmapResolution: 4096
|
|
194
195
|
});
|
|
196
|
+
engine.graphics.loadEnvironmentMap(buildCubeURLs('data/textures/cubemaps/hip_miramar/32/', '.png'));
|
|
195
197
|
|
|
196
198
|
const ecd = engine.entityManager.dataset;
|
|
197
199
|
|
|
@@ -216,8 +218,8 @@ async function main(engine) {
|
|
|
216
218
|
const sg = n.entity.getComponent(ShadedGeometry);
|
|
217
219
|
|
|
218
220
|
if (sg !== null) {
|
|
219
|
-
sg.
|
|
220
|
-
sg.
|
|
221
|
+
sg.writeFlag(ShadedGeometryFlags.CastShadow, false);
|
|
222
|
+
sg.writeFlag(ShadedGeometryFlags.ReceiveShadow, false);
|
|
221
223
|
}
|
|
222
224
|
});
|
|
223
225
|
|
|
@@ -246,17 +248,18 @@ async function main(engine) {
|
|
|
246
248
|
const model_footprint = Math.hypot(mesh_asset.boundingBox.getExtentsX(), mesh_asset.boundingBox.getExtentsY(), mesh_asset.boundingBox.getExtentsZ());
|
|
247
249
|
|
|
248
250
|
|
|
249
|
-
make_plane({
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
251
|
+
// make_plane({
|
|
252
|
+
// engine,
|
|
253
|
+
// scale: 2 * model_footprint,
|
|
254
|
+
// offset: new Vector3(0, 0, 0),
|
|
255
|
+
// direction: Vector3.up,
|
|
256
|
+
// up: Vector3.forward,
|
|
257
|
+
// material: new MeshStandardMaterial({
|
|
258
|
+
// color: 0x111111,
|
|
259
|
+
// map: make_test_texture(),
|
|
260
|
+
// }),
|
|
261
|
+
// shadow: true,
|
|
262
|
+
// }).build(ecd);
|
|
260
263
|
|
|
261
264
|
//
|
|
262
265
|
// make_plane({
|
|
@@ -326,9 +329,9 @@ async function main(engine) {
|
|
|
326
329
|
}
|
|
327
330
|
}))
|
|
328
331
|
.add(Light.fromJSON({
|
|
329
|
-
distance: model_footprint *0.
|
|
332
|
+
distance: model_footprint * 0.1,
|
|
330
333
|
type: LightType.POINT,
|
|
331
|
-
intensity:
|
|
334
|
+
intensity: 0.5,
|
|
332
335
|
color: `hsv(${random()},${1},1)`
|
|
333
336
|
}))
|
|
334
337
|
.build(ecd);
|
|
@@ -339,7 +342,7 @@ async function main(engine) {
|
|
|
339
342
|
|
|
340
343
|
// lpv.add_point(10, 5, 10);
|
|
341
344
|
|
|
342
|
-
const desired_density =
|
|
345
|
+
const desired_density = 10;
|
|
343
346
|
|
|
344
347
|
|
|
345
348
|
// const light_volume_bounds = new AABB3(-10, 0.5, -10, 10, 11, 10);
|
|
@@ -418,7 +421,9 @@ new EngineHarness().initialize({
|
|
|
418
421
|
configuration(config, engine) {
|
|
419
422
|
config.addSystem(new ShadedGeometrySystem(engine));
|
|
420
423
|
config.addSystem(new TransformAttachmentSystem());
|
|
421
|
-
config.addSystem(new LightSystem(engine
|
|
424
|
+
config.addSystem(new LightSystem(engine,{
|
|
425
|
+
shadowResolution: 2048
|
|
426
|
+
}));
|
|
422
427
|
|
|
423
428
|
config.addLoader('gltf', new GLTFAssetLoader());
|
|
424
429
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
## Techniques for shadow maps
|
|
2
|
+
|
|
3
|
+
### Light-Space Perspective Shadow Map (LiSPSM)
|
|
4
|
+
* 20004 - "Light Space Perspective Shadow Maps" by Michael Wimmer, Daniel Scherzer and Werner Purgathofer ([pdf](https://www.cg.tuwien.ac.at/research/vr/lispsm/shadows_egsr2004_revised.pdf))
|
|
5
|
+
* [implementation](https://github.com/nkrisztian89/interstellar-armada/commit/53f4284b38a83aae87e2a40e98f5c4461cead1e9) in "Interstellar Armada"
|
|
6
|
+
* [implementation](https://github.com/openscenegraph/OpenSceneGraph/blob/34a1d8bc9bba5c415c4ff590b3ea5229fa876ba8/include/osgShadow/LightSpacePerspectiveShadowMap) in OpenSceneGraph
|
|
@@ -483,6 +483,34 @@ PointerDevice.prototype.getTargetElement = function () {
|
|
|
483
483
|
return this.__target;
|
|
484
484
|
};
|
|
485
485
|
|
|
486
|
+
/**
|
|
487
|
+
*
|
|
488
|
+
* @param {Element} el
|
|
489
|
+
*/
|
|
490
|
+
PointerDevice.prototype.setTargetElement = function (el) {
|
|
491
|
+
assert.defined(el, 'el');
|
|
492
|
+
assert.notNull(el, 'el');
|
|
493
|
+
|
|
494
|
+
if (this.__target === el) {
|
|
495
|
+
// no change
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
let was_running = this.isRunning;
|
|
500
|
+
|
|
501
|
+
if (was_running) {
|
|
502
|
+
// disconnect from previous target
|
|
503
|
+
this.stop();
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
this.__target = el;
|
|
507
|
+
|
|
508
|
+
if (was_running) {
|
|
509
|
+
// restart to maintain original state
|
|
510
|
+
this.start();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
486
514
|
/**
|
|
487
515
|
*
|
|
488
516
|
* @param {Vector2} result
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"productName": "Meep",
|
|
6
6
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.43.
|
|
8
|
+
"version": "2.43.8",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|
|
@@ -15,8 +15,6 @@ import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.j
|
|
|
15
15
|
import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
|
|
16
16
|
import { Transform } from "../../engine/ecs/transform/Transform.js";
|
|
17
17
|
import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
|
|
18
|
-
import ButtonView from "../../view/elements/button/ButtonView.js";
|
|
19
|
-
import { downloadAsFile } from "../../core/binary/ByteArrayTools.js";
|
|
20
18
|
|
|
21
19
|
const HEIGHT_RANGE = 64;
|
|
22
20
|
|
|
@@ -135,8 +133,7 @@ async function main(engine) {
|
|
|
135
133
|
water.shoreDepthTransition.set(0.1, 0.3);
|
|
136
134
|
water.scattering.set(3);
|
|
137
135
|
|
|
138
|
-
|
|
139
|
-
terrain_builder
|
|
136
|
+
new EntityBuilder()
|
|
140
137
|
.add(terrain)
|
|
141
138
|
// .add(water)
|
|
142
139
|
.build(ecd);
|
|
@@ -152,47 +149,6 @@ async function main(engine) {
|
|
|
152
149
|
load_gltf("moicon/23_Nov_21_Skogplanter/02/model.gltf", engine, transform);
|
|
153
150
|
// load_gltf("moicon/23_Nov_21_Skogplanter/03/model.gltf", engine, transform);
|
|
154
151
|
// load_gltf("moicon/23_Nov_21_Skogplanter/04/model.gltf", engine, transform);
|
|
155
|
-
|
|
156
|
-
engine.gui.view.addChild(new ButtonView({
|
|
157
|
-
name: 'Download',
|
|
158
|
-
action() {
|
|
159
|
-
// we wrap the terrain data into "component json" format that meep editor recognizes to make this compatible with the standalone terrain editor
|
|
160
|
-
const json_payload = {
|
|
161
|
-
type: "Terrain",
|
|
162
|
-
data: terrain.toJSON()
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
downloadAsFile(
|
|
166
|
-
JSON.stringify(json_payload),
|
|
167
|
-
'terrain.json'
|
|
168
|
-
);
|
|
169
|
-
},
|
|
170
|
-
css: {
|
|
171
|
-
bottom: '4px',
|
|
172
|
-
left: '4px',
|
|
173
|
-
position: 'absolute',
|
|
174
|
-
background: 'white',
|
|
175
|
-
border: '1px solid black',
|
|
176
|
-
padding: '2px',
|
|
177
|
-
pointerEvents: 'auto'
|
|
178
|
-
}
|
|
179
|
-
}));
|
|
180
|
-
|
|
181
|
-
engine.gui.view.addChild(new ButtonView({
|
|
182
|
-
name: 'Remove',
|
|
183
|
-
action() {
|
|
184
|
-
engine.entityManager.dataset.removeEntity(terrain_builder.entity);
|
|
185
|
-
},
|
|
186
|
-
css: {
|
|
187
|
-
bottom: '4px',
|
|
188
|
-
left: '104px',
|
|
189
|
-
position: 'absolute',
|
|
190
|
-
background: 'white',
|
|
191
|
-
border: '1px solid black',
|
|
192
|
-
padding: '2px',
|
|
193
|
-
pointerEvents: 'auto'
|
|
194
|
-
}
|
|
195
|
-
}));
|
|
196
152
|
}
|
|
197
153
|
|
|
198
154
|
/**
|
|
@@ -49,6 +49,8 @@ export class ViewStack extends View {
|
|
|
49
49
|
|
|
50
50
|
this.el = element;
|
|
51
51
|
|
|
52
|
+
this.addClass('view-stack');
|
|
53
|
+
|
|
52
54
|
this.__stack = [];
|
|
53
55
|
/**
|
|
54
56
|
*
|
|
@@ -108,9 +110,9 @@ export class ViewStack extends View {
|
|
|
108
110
|
/**
|
|
109
111
|
*
|
|
110
112
|
* @param {View} view
|
|
111
|
-
* @param {string} name
|
|
113
|
+
* @param {string} [name]
|
|
112
114
|
*/
|
|
113
|
-
push(view, name) {
|
|
115
|
+
push(view, name = '') {
|
|
114
116
|
const stack = this.__stack;
|
|
115
117
|
const stackFrame = new StackFrame(view, name);
|
|
116
118
|
stack.push(stackFrame);
|