@woosh/meep-engine 2.41.0 → 2.42.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/core/geom/3d/apply_mat4_transform_to_v3_array.js +2 -4
- package/core/geom/3d/sphere/sphere_radius_sqr_from_v3_array_transformed.js +28 -0
- package/core/geom/Quaternion.js +14 -0
- package/engine/EngineHarness.js +9 -3
- package/engine/ecs/transform/Transform.js +23 -3
- package/engine/graphics/ecs/decal/v2/Decal.d.ts +11 -0
- package/engine/graphics/ecs/decal/v2/Decal.js +50 -0
- package/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +8 -0
- package/engine/graphics/ecs/decal/v2/FPDecalSystem.js +213 -0
- package/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +237 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +8 -1
- package/engine/graphics/ecs/mesh-v2/build_three_object.js +4 -0
- package/engine/graphics/geometry/MikkT/MikkTSpace.js +466 -305
- package/engine/graphics/geometry/buffered/computeGeometryEquality.js +1 -1
- package/engine/graphics/geometry/buffered/computeGeometryHash.js +1 -1
- package/engine/graphics/impostors/octahedral/ImpostorBaker.js +27 -14
- package/engine/graphics/impostors/octahedral/ImpostorDescription.js +6 -0
- package/engine/graphics/impostors/octahedral/README.md +1 -0
- package/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere.js +25 -22
- package/engine/graphics/impostors/octahedral/bake/compute_bounding_sphere_radius_only.js +37 -0
- package/engine/graphics/impostors/octahedral/bake/prepare_bake_material.js +30 -1
- package/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +1 -1
- package/engine/graphics/impostors/octahedral/prototypeBaker.js +121 -22
- package/engine/graphics/impostors/octahedral/shader/BakeShaderStandard.js +46 -7
- package/engine/graphics/impostors/octahedral/shader/ImpostorShaderV0.js +349 -0
- package/engine/graphics/impostors/octahedral/shader/ImpostorShaderV1.js +74 -0
- package/engine/graphics/impostors/octahedral/shader/glsl/v1/common.glsl +209 -0
- package/engine/graphics/impostors/octahedral/shader/glsl/v1/flagment.glsl +80 -0
- package/engine/graphics/impostors/octahedral/shader/glsl/v1/vertex.glsl +350 -0
- package/engine/graphics/micron/render/v1/getTransformedPositionsCached.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +1 -1
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +1 -3
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +2 -1
- package/engine/graphics/render/forward_plus/model/Decal.js +19 -2
- package/engine/graphics/texture/sampler/Sampler2D.js +10 -10
- package/engine/graphics/texture/sampler/prototypeSamplerFiltering.js +117 -11
- package/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +66 -0
- package/engine/graphics/texture/sampler/sampler2_d_scale_down_lanczos.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Sampler2D } from "../Sampler2D.js";
|
|
2
|
+
import { sampler2D_scale_down_linear } from "../sampler2D_scale_down_linear.js";
|
|
3
|
+
import { inverseLerp } from "../../../../../core/math/inverseLerp.js";
|
|
4
|
+
import { lerp } from "../../../../../core/math/lerp.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Emulated how downsampling is done in OpenGL using autogenerated mipmaps with LINEAR_MIPMAP_LINEAR parameters
|
|
8
|
+
* @param {Sampler2D} source
|
|
9
|
+
* @param {Sampler2D} destination
|
|
10
|
+
*/
|
|
11
|
+
export function sampler2d_downsample_mipmap(source, destination) {
|
|
12
|
+
let current_mip = source;
|
|
13
|
+
let previous_mip = source;
|
|
14
|
+
|
|
15
|
+
const itemSize = current_mip.itemSize;
|
|
16
|
+
|
|
17
|
+
const dest_width = destination.width;
|
|
18
|
+
const dest_height = destination.height;
|
|
19
|
+
|
|
20
|
+
while (current_mip.width > dest_width && current_mip.width > 1) {
|
|
21
|
+
const new_w = Math.floor(current_mip.width * 0.5);
|
|
22
|
+
const new_h = Math.floor(current_mip.height * 0.5);
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const out = new Sampler2D(new current_mip.data.constructor(new_w * new_h * itemSize), itemSize, new_w, new_h);
|
|
26
|
+
|
|
27
|
+
sampler2D_scale_down_linear(current_mip, out);
|
|
28
|
+
|
|
29
|
+
previous_mip = current_mip;
|
|
30
|
+
current_mip = out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const mip_mix = inverseLerp(previous_mip.width, current_mip.width, dest_width);
|
|
34
|
+
|
|
35
|
+
const m1_hp_x = 0.5 / previous_mip.width;
|
|
36
|
+
const m1_hp_y = 0.5 / previous_mip.height;
|
|
37
|
+
|
|
38
|
+
const m0_hp_x = 0.5 / current_mip.width;
|
|
39
|
+
const m0_hp_y = 0.5 / current_mip.height;
|
|
40
|
+
|
|
41
|
+
const m1_sx = (previous_mip.width + 1) / (previous_mip.width);
|
|
42
|
+
const m1_sy = (previous_mip.height + 1) / (previous_mip.height);
|
|
43
|
+
|
|
44
|
+
const m0_sx = (current_mip.width + 1) / (current_mip.width);
|
|
45
|
+
const m0_sy = (current_mip.height + 1) / (current_mip.height);
|
|
46
|
+
|
|
47
|
+
for (let y = 0; y < dest_height; y++) {
|
|
48
|
+
const v = y / (dest_height - 1);
|
|
49
|
+
|
|
50
|
+
for (let x = 0; x < dest_width; x++) {
|
|
51
|
+
|
|
52
|
+
const u = x / (dest_width - 1);
|
|
53
|
+
|
|
54
|
+
for (let i = 0; i < itemSize; i++) {
|
|
55
|
+
|
|
56
|
+
const c0 = previous_mip.sampleChannelBilinearUV(u * m1_sx - m1_hp_x, v * m1_sy - m1_hp_y, i);
|
|
57
|
+
const c1 = current_mip.sampleChannelBilinearUV(u * m0_sx - m0_hp_x, v * m0_sy - m0_hp_y, i);
|
|
58
|
+
|
|
59
|
+
const c_out = lerp(c0, c1, mip_mix);
|
|
60
|
+
|
|
61
|
+
destination.data[(y * dest_width + x) * itemSize + i] = c_out;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
@@ -77,12 +77,12 @@ export function sampler2D_scale_down_lanczos(source, destination, lobes = 3) {
|
|
|
77
77
|
|
|
78
78
|
for (v = 0; v < d_h; v++) {
|
|
79
79
|
|
|
80
|
-
const center_y = (v) * ratio_y;
|
|
80
|
+
const center_y = (v) * ratio_y - 0.5;
|
|
81
81
|
const source_y0 = max2(Math.ceil(center_y - range2_y), 0);
|
|
82
82
|
const source_y1 = min2(Math.floor(center_y + range2_y), source_height - 1);
|
|
83
83
|
|
|
84
84
|
for (u = 0; u < d_w; u++) {
|
|
85
|
-
const center_x = (u) * ratio_x;
|
|
85
|
+
const center_x = (u) * ratio_x - 0.5;
|
|
86
86
|
|
|
87
87
|
const source_x0 = max2(Math.ceil(center_x - range2_x), 0);
|
|
88
88
|
const source_x1 = min2(Math.floor(center_x + range2_x), source_width - 1);
|
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.
|
|
8
|
+
"version": "2.42.0",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"gl-matrix": "3.4.3",
|
|
11
11
|
"fast-levenshtein": "2.0.6",
|