@woosh/meep-engine 2.138.16 → 2.138.17
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/editor/Editor.d.ts.map +1 -1
- package/editor/SelectionVisualizer.d.ts.map +1 -1
- package/editor/actions/concrete/ComponentAddAction.d.ts.map +1 -1
- package/editor/actions/concrete/EntityCreateAction.d.ts.map +1 -1
- package/editor/actions/concrete/SelectionAddAction.d.ts.map +1 -1
- package/editor/enableEditor.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/ecs/grid/HeightMap2AOMap.d.ts +25 -0
- package/src/engine/ecs/grid/HeightMap2AOMap.d.ts.map +1 -0
- package/src/engine/ecs/grid/HeightMap2AOMap.js +95 -0
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts +15 -7
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/BuildLightTexture.js +44 -99
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +36 -0
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.d.ts +1 -1
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +3 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts +12 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +21 -0
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderDepthV0.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderDepthV0.js +2 -14
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderLitV0.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderLitV0.js +1 -7
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderNormalsV0.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderNormalsV0.js +1 -6
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderViewportDepthV0.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/shader/ImpostorShaderViewportDepthV0.js +1 -6
- package/src/engine/graphics/material/TerrainDepthMaterial.d.ts +36 -0
- package/src/engine/graphics/material/TerrainDepthMaterial.d.ts.map +1 -0
- package/src/engine/graphics/material/TerrainDepthMaterial.js +65 -0
- package/src/engine/graphics/shaders/AmbientOcclusionShader.d.ts +69 -12
- package/src/engine/graphics/shaders/AmbientOcclusionShader.d.ts.map +1 -1
- package/src/engine/graphics/shaders/AmbientOcclusionShader.js +371 -128
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts +25 -0
- package/src/engine/graphics/util/build_max_height_pyramid.d.ts.map +1 -0
- package/src/engine/graphics/util/build_max_height_pyramid.js +100 -0
- package/editor/ecs/component/FieldDescriptor.d.ts +0 -27
- package/editor/ecs/component/FieldDescriptor.d.ts.map +0 -1
- package/editor/ecs/component/FieldValueAdapter.d.ts +0 -7
- package/editor/ecs/component/FieldValueAdapter.d.ts.map +0 -1
- package/editor/ecs/component/createFieldEditor.d.ts +0 -9
- package/editor/ecs/component/createFieldEditor.d.ts.map +0 -1
- package/editor/ecs/component/createObjectEditor.d.ts +0 -14
- package/editor/ecs/component/createObjectEditor.d.ts.map +0 -1
- package/editor/ecs/component/findNearestRegisteredType.d.ts +0 -8
- package/editor/ecs/component/findNearestRegisteredType.d.ts.map +0 -1
- package/src/engine/ecs/grid/HeightMap2NormalMap.d.ts +0 -10
- package/src/engine/ecs/grid/HeightMap2NormalMap.d.ts.map +0 -1
- package/src/engine/ecs/grid/HeightMap2NormalMap.js +0 -72
- package/src/engine/ecs/grid/NormalMap2AOMap.d.ts +0 -15
- package/src/engine/ecs/grid/NormalMap2AOMap.d.ts.map +0 -1
- package/src/engine/ecs/grid/NormalMap2AOMap.js +0 -82
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FieldValueAdapter.d.ts","sourceRoot":"","sources":["FieldValueAdapter.js"],"names":[],"mappings":"AAEA;IAEQ,kBAAoB;IACpB,kBAAoB;IAIxB,wCAKC;IAED,sDAEC;CACJ"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @template CTX
|
|
3
|
-
* @param {Object} object
|
|
4
|
-
* @param {FieldDescriptor} field
|
|
5
|
-
* @param {Map<*, TypeEditor>} registry
|
|
6
|
-
*/
|
|
7
|
-
export function createFieldEditor<CTX>(object: any, field: FieldDescriptor, registry: Map<any, TypeEditor>): EmptyView;
|
|
8
|
-
import EmptyView from "../../../src/view/elements/EmptyView.js";
|
|
9
|
-
//# sourceMappingURL=createFieldEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFieldEditor.d.ts","sourceRoot":"","sources":["createFieldEditor.js"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,sFAFW,oBAAkB,aA6E5B;sBA3FqB,yCAAyC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {Object} object
|
|
3
|
-
* @param {Map<*, TypeEditor>} registry
|
|
4
|
-
* @param {FieldDescriptor} [field_descriptor]
|
|
5
|
-
*/
|
|
6
|
-
export function buildObjectEditorFromRegistry(object: any, registry: Map<any, TypeEditor>, field_descriptor?: FieldDescriptor<any>): any;
|
|
7
|
-
/**
|
|
8
|
-
* @param {Object} object
|
|
9
|
-
* @param {Map<*, TypeEditor>} registry
|
|
10
|
-
*/
|
|
11
|
-
export function createObjectEditor(object: any, registry: Map<any, TypeEditor>): EmptyView;
|
|
12
|
-
import { FieldDescriptor } from "./FieldDescriptor.js";
|
|
13
|
-
import EmptyView from "../../../src/view/elements/EmptyView.js";
|
|
14
|
-
//# sourceMappingURL=createObjectEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createObjectEditor.d.ts","sourceRoot":"","sources":["createObjectEditor.js"],"names":[],"mappings":"AA8QA;;;;GAIG;AACH,qEAHW,oBAAkB,gDA0B5B;AAID;;;GAGG;AACH,0DAFW,oBAAkB,aA0D5B;gCAvW+B,sBAAsB;sBAFhC,yCAAyC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {Map<*, TypeEditor>} registry
|
|
4
|
-
* @param {*} value
|
|
5
|
-
* @returns {TypeEditor|void}
|
|
6
|
-
*/
|
|
7
|
-
export function findNearestRegisteredType(registry: Map<any, TypeEditor>, value: any): TypeEditor | void;
|
|
8
|
-
//# sourceMappingURL=findNearestRegisteredType.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findNearestRegisteredType.d.ts","sourceRoot":"","sources":["findNearestRegisteredType.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,oDAJW,oBAAkB,eAEhB,aAAW,IAAI,CAsD3B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export default heightMap2NormalMap;
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {WebGLRenderer} renderer
|
|
5
|
-
* @param {Sampler2D} sampler
|
|
6
|
-
* @returns {Sampler2D}
|
|
7
|
-
*/
|
|
8
|
-
declare function heightMap2NormalMap(renderer: WebGLRenderer, sampler: Sampler2D): Sampler2D;
|
|
9
|
-
import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
|
|
10
|
-
//# sourceMappingURL=HeightMap2NormalMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HeightMap2NormalMap.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/grid/HeightMap2NormalMap.js"],"names":[],"mappings":";AA0CA;;;;;GAKG;AACH,uEAHW,SAAS,GACP,SAAS,CAuBrB;0BAnEyB,6CAA6C"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import ImageFilter from '../../graphics/filter/ImageFilter.js';
|
|
2
|
-
import NormalMapShader from '../../graphics/shaders/NormalMapShader2.js';
|
|
3
|
-
import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
|
|
4
|
-
import { sampler2d_to_float32_texture } from "../../graphics/texture/sampler/sampler2d_to_float32_texture.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function convertChannel(v) {
|
|
8
|
-
return (v) / 255 - 0.5;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {number[]|Uint8Array} source
|
|
14
|
-
* @returns {Float32Array}
|
|
15
|
-
*/
|
|
16
|
-
function rgbaArray2RGB(source) {
|
|
17
|
-
const length = source.length;
|
|
18
|
-
const numPixels = Math.floor(length / 4);
|
|
19
|
-
const target = new Float32Array(numPixels * 3);
|
|
20
|
-
//
|
|
21
|
-
let h;
|
|
22
|
-
for (let i = 0; i < numPixels; i++) {
|
|
23
|
-
const j = i * 4;
|
|
24
|
-
const k = i * 3;
|
|
25
|
-
//normalize source to normal vectors
|
|
26
|
-
let x = convertChannel(source[j]);
|
|
27
|
-
let y = convertChannel(source[j + 1]);
|
|
28
|
-
let z = convertChannel(source[j + 2]);
|
|
29
|
-
//
|
|
30
|
-
h = Math.sqrt(x * x + y * y + z * z);
|
|
31
|
-
|
|
32
|
-
x /= h;
|
|
33
|
-
y /= h;
|
|
34
|
-
z /= h;
|
|
35
|
-
//
|
|
36
|
-
target[k] = x;
|
|
37
|
-
target[k + 1] = y;
|
|
38
|
-
target[k + 2] = z;
|
|
39
|
-
}
|
|
40
|
-
return target;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param {WebGLRenderer} renderer
|
|
46
|
-
* @param {Sampler2D} sampler
|
|
47
|
-
* @returns {Sampler2D}
|
|
48
|
-
*/
|
|
49
|
-
function heightMap2NormalMap(renderer, sampler) {
|
|
50
|
-
|
|
51
|
-
const width = sampler.width;
|
|
52
|
-
const height = sampler.height;
|
|
53
|
-
|
|
54
|
-
const texture = sampler2d_to_float32_texture(sampler);
|
|
55
|
-
|
|
56
|
-
//construct shader
|
|
57
|
-
const shader = new NormalMapShader();
|
|
58
|
-
shader.uniforms.heightMap.value = texture;
|
|
59
|
-
shader.uniforms.resolution.value.set(width, height);
|
|
60
|
-
|
|
61
|
-
//perform filtering
|
|
62
|
-
const result = ImageFilter(renderer, width, height, shader);
|
|
63
|
-
|
|
64
|
-
//create the sampler
|
|
65
|
-
const array = result.array;
|
|
66
|
-
const rgb = rgbaArray2RGB(array);
|
|
67
|
-
|
|
68
|
-
//reduce array's alpha component
|
|
69
|
-
return new Sampler2D(rgb, 3, width, height);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default heightMap2NormalMap;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default normalMap2OcclusionMap;
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* @param {WebGLRenderer} renderer
|
|
5
|
-
* @param {Sampler2D} heightMap
|
|
6
|
-
* @param {Sampler2D} normalMap
|
|
7
|
-
* @param {Vector2} resultSize
|
|
8
|
-
* @param worldSize
|
|
9
|
-
* @param {number} [rayLength]
|
|
10
|
-
* @returns {Sampler2D}
|
|
11
|
-
*/
|
|
12
|
-
declare function normalMap2OcclusionMap(renderer: WebGLRenderer, heightMap: Sampler2D, normalMap: Sampler2D, resultSize: Vector2, worldSize?: Vector2, rayLength?: number): Sampler2D;
|
|
13
|
-
import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
|
|
14
|
-
import { Vector2 } from 'three';
|
|
15
|
-
//# sourceMappingURL=NormalMap2AOMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NormalMap2AOMap.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/grid/NormalMap2AOMap.js"],"names":[],"mappings":";AA2BA;;;;;;;;;GASG;AACH,4EAPW,SAAS,aACT,SAAS,cACT,OAAO,mCAEP,MAAM,GACJ,SAAS,CA4CrB;0BA3EyB,6CAA6C;wBAJiB,OAAO"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { ClampToEdgeWrapping, DataTexture, RGBAFormat, UnsignedByteType, Vector2 } from 'three';
|
|
2
|
-
import ImageFilter from '../../graphics/filter/ImageFilter.js';
|
|
3
|
-
import AmbientOcclusionShader from '../../graphics/shaders/AmbientOcclusionShader.js';
|
|
4
|
-
import { DenoiseShader } from "../../graphics/shaders/DenoiseShader.js";
|
|
5
|
-
import { Sampler2D } from '../../graphics/texture/sampler/Sampler2D.js';
|
|
6
|
-
import { sampler2d_to_float32_texture } from "../../graphics/texture/sampler/sampler2d_to_float32_texture.js";
|
|
7
|
-
|
|
8
|
-
function filterResult2Texture(data, width, height) {
|
|
9
|
-
const result = new DataTexture();
|
|
10
|
-
result.format = RGBAFormat;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
result.type = UnsignedByteType;
|
|
14
|
-
result.flipY = false;
|
|
15
|
-
result.image = { data: data, width: width, height: height };
|
|
16
|
-
|
|
17
|
-
result.wrapS = ClampToEdgeWrapping;
|
|
18
|
-
result.wrapT = ClampToEdgeWrapping;
|
|
19
|
-
|
|
20
|
-
result.repeat.set(1, 1);
|
|
21
|
-
result.needsUpdate = true;
|
|
22
|
-
|
|
23
|
-
result.anisotropy = 4;
|
|
24
|
-
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param {WebGLRenderer} renderer
|
|
31
|
-
* @param {Sampler2D} heightMap
|
|
32
|
-
* @param {Sampler2D} normalMap
|
|
33
|
-
* @param {Vector2} resultSize
|
|
34
|
-
* @param worldSize
|
|
35
|
-
* @param {number} [rayLength]
|
|
36
|
-
* @returns {Sampler2D}
|
|
37
|
-
*/
|
|
38
|
-
function normalMap2OcclusionMap(
|
|
39
|
-
renderer,
|
|
40
|
-
heightMap,
|
|
41
|
-
normalMap,
|
|
42
|
-
resultSize,
|
|
43
|
-
worldSize = new Vector2(heightMap.width, heightMap.width),
|
|
44
|
-
rayLength = 17
|
|
45
|
-
) {
|
|
46
|
-
const width = resultSize.x;
|
|
47
|
-
const height = resultSize.y;
|
|
48
|
-
//
|
|
49
|
-
const normalTexture = sampler2d_to_float32_texture(normalMap);
|
|
50
|
-
|
|
51
|
-
const heightTexture = sampler2d_to_float32_texture(heightMap);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//construct shader
|
|
55
|
-
const shaderAO = new AmbientOcclusionShader();
|
|
56
|
-
shaderAO.uniforms.heightMap.value = heightTexture;
|
|
57
|
-
shaderAO.uniforms.normalMap.value = normalTexture;
|
|
58
|
-
shaderAO.uniforms.world_size.value.set(worldSize.x, worldSize.y);
|
|
59
|
-
shaderAO.uniforms.rayLength.value = rayLength;
|
|
60
|
-
//perform filtering
|
|
61
|
-
const rawAO = ImageFilter(renderer, width, height, shaderAO);
|
|
62
|
-
|
|
63
|
-
const shaderDenoise = new DenoiseShader(2);
|
|
64
|
-
shaderDenoise.uniforms.source.value = filterResult2Texture(rawAO.array, width, height);
|
|
65
|
-
shaderDenoise.uniforms.pixelOffset.value.set(1 / width, 1 / height);
|
|
66
|
-
|
|
67
|
-
const smoothAO = ImageFilter(renderer, width, height, shaderDenoise);
|
|
68
|
-
|
|
69
|
-
//create the sampler
|
|
70
|
-
const result = new Sampler2D(new Uint8ClampedArray(width * height), 1, width, height);
|
|
71
|
-
|
|
72
|
-
//populate samples
|
|
73
|
-
const size = width * height;
|
|
74
|
-
|
|
75
|
-
for (let i = 0; i < size; i++) {
|
|
76
|
-
result.data[i] = smoothAO.array[i * 4];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default normalMap2OcclusionMap;
|