@woosh/meep-engine 2.119.72 → 2.119.74
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/package.json
CHANGED
|
@@ -50,6 +50,7 @@ export class EngineHarness {
|
|
|
50
50
|
* @param {boolean} [params.enableWater]
|
|
51
51
|
* @param {boolean} [params.enableTerrain]
|
|
52
52
|
* @param {boolean} [params.enableLights=true]
|
|
53
|
+
* @param {boolean} [params.enableShadows=true] if lights are enabled, enable shadows for sun
|
|
53
54
|
* @param {number} [params.cameraFieldOfView]
|
|
54
55
|
* @param {number} [params.cameraFarDistance]
|
|
55
56
|
* @param {boolean} [params.cameraController=true]
|
|
@@ -57,7 +58,7 @@ export class EngineHarness {
|
|
|
57
58
|
* @param {number} [params.shadowmapResolution]
|
|
58
59
|
* @param {boolean} [params.showFps]
|
|
59
60
|
*/
|
|
60
|
-
static buildBasics({ engine, focus, heightMap, heightRange, pitch, yaw, distance, terrainSize, terrainResolution, enableWater, enableTerrain, enableLights, cameraFieldOfView, cameraFarDistance, cameraController, cameraAutoClip, shadowmapResolution, showFps }: {
|
|
61
|
+
static buildBasics({ engine, focus, heightMap, heightRange, pitch, yaw, distance, terrainSize, terrainResolution, enableWater, enableTerrain, enableLights, enableShadows, cameraFieldOfView, cameraFarDistance, cameraController, cameraAutoClip, shadowmapResolution, showFps }: {
|
|
61
62
|
engine: Engine;
|
|
62
63
|
focus?: {
|
|
63
64
|
x: number;
|
|
@@ -77,6 +78,7 @@ export class EngineHarness {
|
|
|
77
78
|
enableWater?: boolean;
|
|
78
79
|
enableTerrain?: boolean;
|
|
79
80
|
enableLights?: boolean;
|
|
81
|
+
enableShadows?: boolean;
|
|
80
82
|
cameraFieldOfView?: number;
|
|
81
83
|
cameraFarDistance?: number;
|
|
82
84
|
cameraController?: boolean;
|
|
@@ -127,13 +129,12 @@ export class EngineHarness {
|
|
|
127
129
|
* @param {Vector2} [size]
|
|
128
130
|
* @param {String} [diffuse0]
|
|
129
131
|
* @param heightMap
|
|
130
|
-
* @param
|
|
131
|
-
* @param
|
|
132
|
-
* @param
|
|
133
|
-
* @param enableWater
|
|
132
|
+
* @param {number} [resolution]
|
|
133
|
+
* @param {number} [waterLevel]
|
|
134
|
+
* @param {boolean} [enableWater]
|
|
134
135
|
* @returns {Terrain}
|
|
135
136
|
*/
|
|
136
|
-
static buildTerrain({ engine, size, diffuse0,
|
|
137
|
+
static buildTerrain({ engine, size, diffuse0, resolution, waterLevel, enableWater, }: Engine): Terrain;
|
|
137
138
|
/**
|
|
138
139
|
*
|
|
139
140
|
* @type {Engine}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EngineHarness.d.ts","sourceRoot":"","sources":["../../../src/engine/EngineHarness.js"],"names":[],"mappings":"AA8DA;IAmBI;;;;OAIG;IACH,8CAHmB,mBAAmB,UAAQ,MAAM,WACxC,QAAQ,MAAM,CAAC,CAM1B;IAED;;;OAGG;IACH,6BAFW,MAAM,QAYhB;IAmED;;;;;;;;;;;;;OAaG;IACH;QAZyB,MAAM,EAApB,MAAM;QACyB,GAAG;QAClB,MAAM,GAAtB,OAAO;QACQ,QAAQ,GAAvB,MAAM;QACS,KAAK,GAApB,MAAM;QACS,GAAG,GAAlB,MAAM;QACU,QAAQ,GAAxB,OAAO;QACQ,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACS,WAAW,GAA1B,MAAM;QACJ,MAAM,CA+DlB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;QApB0B,MAAM,EAArB,MAAM;QACgC,KAAK,GAA3C;YAAC,CAAC,EAAC,MAAM,CAAC;YAAA,CAAC,EAAC,MAAM,CAAC;YAAA,CAAC,EAAC,MAAM,CAAA;SAAC;QACrB,SAAS;QACT,WAAW;QACF,KAAK,GAArB,MAAM;QACU,GAA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Light.js";
|
|
|
24
24
|
import LightSystem from "./graphics/ecs/light/LightSystem.js";
|
|
25
25
|
import Water from "./graphics/ecs/water/Water.js";
|
|
26
26
|
import WaterSystem from "./graphics/ecs/water/WaterSystem.js";
|
|
27
|
+
import checkersTextureURI from "./graphics/texture/CheckersTextureURI.js";
|
|
27
28
|
import { MouseEvents } from "./input/devices/events/MouseEvents.js";
|
|
28
29
|
import KeyboardCameraController from "./input/ecs/controllers/KeyboardCameraController.js";
|
|
29
30
|
import InputControllerSystem from "./input/ecs/systems/InputControllerSystem.js";
|
|
@@ -261,6 +262,7 @@ export class EngineHarness {
|
|
|
261
262
|
* @param {boolean} [params.enableWater]
|
|
262
263
|
* @param {boolean} [params.enableTerrain]
|
|
263
264
|
* @param {boolean} [params.enableLights=true]
|
|
265
|
+
* @param {boolean} [params.enableShadows=true] if lights are enabled, enable shadows for sun
|
|
264
266
|
* @param {number} [params.cameraFieldOfView]
|
|
265
267
|
* @param {number} [params.cameraFarDistance]
|
|
266
268
|
* @param {boolean} [params.cameraController=true]
|
|
@@ -281,6 +283,7 @@ export class EngineHarness {
|
|
|
281
283
|
enableWater = true,
|
|
282
284
|
enableTerrain = true,
|
|
283
285
|
enableLights = true,
|
|
286
|
+
enableShadows = true,
|
|
284
287
|
cameraFieldOfView,
|
|
285
288
|
cameraFarDistance,
|
|
286
289
|
cameraController = true,
|
|
@@ -294,7 +297,11 @@ export class EngineHarness {
|
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
if (enableLights) {
|
|
297
|
-
await EngineHarness.buildLights({
|
|
300
|
+
await EngineHarness.buildLights({
|
|
301
|
+
engine: engine,
|
|
302
|
+
shadowmapResolution,
|
|
303
|
+
castShadow: enableShadows,
|
|
304
|
+
});
|
|
298
305
|
}
|
|
299
306
|
|
|
300
307
|
const camera = EngineHarness.buildCamera({
|
|
@@ -461,18 +468,16 @@ export class EngineHarness {
|
|
|
461
468
|
* @param {Vector2} [size]
|
|
462
469
|
* @param {String} [diffuse0]
|
|
463
470
|
* @param heightMap
|
|
464
|
-
* @param
|
|
465
|
-
* @param
|
|
466
|
-
* @param
|
|
467
|
-
* @param enableWater
|
|
471
|
+
* @param {number} [resolution]
|
|
472
|
+
* @param {number} [waterLevel]
|
|
473
|
+
* @param {boolean} [enableWater]
|
|
468
474
|
* @returns {Terrain}
|
|
469
475
|
*/
|
|
470
476
|
static async buildTerrain(
|
|
471
477
|
{
|
|
472
478
|
engine,
|
|
473
479
|
size = new Vector2(10, 10),
|
|
474
|
-
diffuse0 = "data/
|
|
475
|
-
heightRange = 0,
|
|
480
|
+
diffuse0 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII=",
|
|
476
481
|
resolution = 10,
|
|
477
482
|
waterLevel = 0,
|
|
478
483
|
enableWater = true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerrainLayers.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayers.js"],"names":[],"mappings":"AA6EA;IAGQ;;;OAGG;IACH,QAFU,KAAK,YAAY,CAAC,CAEJ;IAExB;;;OAGG;IACH,YAFU,OAAO,CAEoD;
|
|
1
|
+
{"version":3,"file":"TerrainLayers.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/terrain/ecs/layers/TerrainLayers.js"],"names":[],"mappings":"AA6EA;IAGQ;;;OAGG;IACH,QAFU,KAAK,YAAY,CAAC,CAEJ;IAExB;;;OAGG;IACH,YAFU,OAAO,CAEoD;IAMrE;;;OAGG;IACH,SAFU,kBAAkB,CAE8B;IAiB1D,2BAAsF;IAc1F;;;MAKC;IAED;;;aAGC;IAED;;;;OAIG;IACH,gCAHW,MAAM,iBACN,MAAM,QAuChB;IAED;;;;OAIG;IACH,0DAyBC;IAED,sCAIC;IAED;;;;OAIG;IACH,WAHW,MAAM,GACL,YAAY,CAIvB;IAED;;;;OAIG;IACH,8DAFa,MAAM,CAqBlB;IAED;;;;OAIG;IACH,kCAHW,MAAM,GACJ,MAAM,CAMlB;IAED;;;OAGG;IACH,SAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,gBAHW,YAAY,GACV,MAAM,CAWlB;IAED;;;;OAIG;IACH,mBAHW,YAAY,GACX,OAAO,CAIlB;IAED;;;;;;OAMG;IACH,0CA8BC;IAED;;;OAGG;IACH,iCAFW,MAAM,QAgChB;IAED,gBAGC;IAED,cAEC;IAGD,qBAsCC;CACJ;iBA5ZgB,6CAA6C;6BAQjC,mBAAmB;oBAP5B,qCAAqC;mCALlD,OAAO;4BAAP,OAAO"}
|
|
@@ -36,7 +36,7 @@ class ScaledTextureKey {
|
|
|
36
36
|
* @returns {ScaledTextureKey}
|
|
37
37
|
*/
|
|
38
38
|
static from(uri, size) {
|
|
39
|
-
assert.isString(uri,
|
|
39
|
+
assert.isString(uri, 'uri');
|
|
40
40
|
|
|
41
41
|
const r = new ScaledTextureKey();
|
|
42
42
|
|
|
@@ -90,11 +90,15 @@ export class TerrainLayers {
|
|
|
90
90
|
*/
|
|
91
91
|
this.resolution = new Vector2(DEFAULT_RESOLUTION, DEFAULT_RESOLUTION);
|
|
92
92
|
|
|
93
|
+
|
|
94
|
+
const layer_data = new Uint8Array(3);
|
|
95
|
+
layer_data.fill(255); //pre-fill with white
|
|
96
|
+
|
|
93
97
|
/**
|
|
94
98
|
*
|
|
95
99
|
* @type {DataTexture2DArray}
|
|
96
100
|
*/
|
|
97
|
-
this.texture = new DataTexture2DArray(
|
|
101
|
+
this.texture = new DataTexture2DArray(layer_data, 1, 1, 1);
|
|
98
102
|
this.texture.format = GL_RGBFormat;
|
|
99
103
|
this.texture.type = UnsignedByteType;
|
|
100
104
|
|
|
@@ -109,6 +113,7 @@ export class TerrainLayers {
|
|
|
109
113
|
this.texture.generateMipmaps = true;
|
|
110
114
|
this.texture.encoding = LinearEncoding;
|
|
111
115
|
this.texture.internalFormat = 'RGB8';
|
|
116
|
+
this.texture.needsUpdate = true;
|
|
112
117
|
|
|
113
118
|
this.scalesTexture = new DataTexture(new Float32Array(64), 32, 1, RGFormat, FloatType);
|
|
114
119
|
|
|
@@ -121,6 +126,7 @@ export class TerrainLayers {
|
|
|
121
126
|
this.scalesTexture.internalFormat = 'RG32F';
|
|
122
127
|
|
|
123
128
|
this.scalesTexture.generateMipmaps = false;
|
|
129
|
+
this.scalesTexture.needsUpdate = true;
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
toJSON() {
|
|
@@ -406,6 +412,7 @@ export class TerrainLayers {
|
|
|
406
412
|
|
|
407
413
|
//build an array to hold texture array
|
|
408
414
|
const arrayData = new Uint8Array(size_x * size_y * 3 * layerCount);
|
|
415
|
+
arrayData.fill(255); // fill with white
|
|
409
416
|
|
|
410
417
|
if (image.width === size_x && image.height === size_y) {
|
|
411
418
|
// dimensions preserved, copy old data
|