@ludicon/spark.js 0.0.12 → 0.0.13
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/dist/spark.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const z = /* @__PURE__ */ Object.assign({ "./spark_astc_rgb.wgsl": () => import("./spark_astc_rgb-DaSIMKXW.js"), "./spark_astc_rgba.wgsl": () => import("./spark_astc_rgba-BToA2Rcq.js"), "./spark_bc1_rgb.wgsl": () => import("./spark_bc1_rgb-DZwuM1tO.js"), "./spark_bc4_r.wgsl": () => import("./spark_bc4_r-DjThizCH.js"), "./spark_bc5_rg.wgsl": () => import("./spark_bc5_rg-6bO0Gvo9.js"), "./spark_bc7_rgb.wgsl": () => import("./spark_bc7_rgb-FXpBw9fE.js"), "./spark_bc7_rgba.wgsl": () => import("./spark_bc7_rgba-C8Hi2pUY.js"), "./spark_eac_r.wgsl": () => import("./spark_eac_r-D8HGiglc.js"), "./spark_eac_rg.wgsl": () => import("./spark_eac_rg-DvsrLP9h.js"), "./spark_etc2_rgb.wgsl": () => import("./spark_etc2_rgb-C-j5FZpn.js"), "./utils.wgsl": () => import("./utils-
|
|
1
|
+
const z = /* @__PURE__ */ Object.assign({ "./spark_astc_rgb.wgsl": () => import("./spark_astc_rgb-DaSIMKXW.js"), "./spark_astc_rgba.wgsl": () => import("./spark_astc_rgba-BToA2Rcq.js"), "./spark_bc1_rgb.wgsl": () => import("./spark_bc1_rgb-DZwuM1tO.js"), "./spark_bc4_r.wgsl": () => import("./spark_bc4_r-DjThizCH.js"), "./spark_bc5_rg.wgsl": () => import("./spark_bc5_rg-6bO0Gvo9.js"), "./spark_bc7_rgb.wgsl": () => import("./spark_bc7_rgb-FXpBw9fE.js"), "./spark_bc7_rgba.wgsl": () => import("./spark_bc7_rgba-C8Hi2pUY.js"), "./spark_eac_r.wgsl": () => import("./spark_eac_r-D8HGiglc.js"), "./spark_eac_rg.wgsl": () => import("./spark_eac_rg-DvsrLP9h.js"), "./spark_etc2_rgb.wgsl": () => import("./spark_etc2_rgb-C-j5FZpn.js"), "./utils.wgsl": () => import("./utils-Dw9jXlhw.js") }), k = Object.fromEntries(
|
|
2
2
|
Object.entries(z).map(([n, e]) => [n.replace("./", ""), async () => (await e()).default])
|
|
3
3
|
), s = {
|
|
4
4
|
ASTC_4x4_RGB: 0,
|
|
@@ -20,7 +20,13 @@ fn linear_to_srgb_vec4(c: vec4<f32>) -> vec4<f32> {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
fn normalize_vec4(c: vec4<f32>) -> vec4<f32> {
|
|
23
|
-
|
|
23
|
+
if (c.z == 0.0) {
|
|
24
|
+
// If the normal is stored with only the XY components, there's no need to normalize.
|
|
25
|
+
return c;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return vec4<f32>(saturate(0.5 * normalize(2 * c.xyz - 1) + 0.5), c.w);
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
@compute @workgroup_size(8, 8)
|
|
@@ -42,7 +48,7 @@ fn mipmap(@builtin(global_invocation_id) id : vec3<u32>) {
|
|
|
42
48
|
color += textureSampleLevel(src, smp, vec2f(uv1.x, uv0.y), 0);
|
|
43
49
|
color += textureSampleLevel(src, smp, vec2f(uv0.x, uv1.y), 0);
|
|
44
50
|
color += textureSampleLevel(src, smp, vec2f(uv1.x, uv1.y), 0);
|
|
45
|
-
color *= 0.25;
|
|
51
|
+
color *= 0.25;
|
|
46
52
|
|
|
47
53
|
// This would be the single sample implementation:
|
|
48
54
|
// let uv = (vec2f(id.xy) + vec2f(0.5)) * size_rcp;
|
|
@@ -105,7 +111,7 @@ var<workgroup> local_invalid_normals: atomic<u32>;
|
|
|
105
111
|
@compute @workgroup_size(8, 8)
|
|
106
112
|
fn detect_channel_count(@builtin(global_invocation_id) global_id: vec3<u32>,
|
|
107
113
|
@builtin(local_invocation_index) local_id: u32) {
|
|
108
|
-
|
|
114
|
+
|
|
109
115
|
if (local_id == 0u) {
|
|
110
116
|
atomicStore(&local_opaque, 1u);
|
|
111
117
|
atomicStore(&local_grayscale, 1u);
|
|
@@ -157,8 +163,6 @@ fn detect_channel_count(@builtin(global_invocation_id) global_id: vec3<u32>,
|
|
|
157
163
|
|
|
158
164
|
|
|
159
165
|
// @@ Compute RMSE?
|
|
160
|
-
|
|
161
|
-
|
|
162
166
|
`;
|
|
163
167
|
export {
|
|
164
168
|
n as default
|