@ifc-lite/renderer 4.2.0 → 5.0.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/dist/edge-params.d.ts +43 -0
- package/dist/edge-params.d.ts.map +1 -0
- package/dist/edge-params.js +63 -0
- package/dist/edge-params.js.map +1 -0
- package/dist/edge-pass.d.ts +38 -0
- package/dist/edge-pass.d.ts.map +1 -0
- package/dist/edge-pass.js +111 -0
- package/dist/edge-pass.js.map +1 -0
- package/dist/index.d.ts +29 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -34
- package/dist/index.js.map +1 -1
- package/dist/instanced-render.d.ts +3 -3
- package/dist/instanced-render.js +3 -3
- package/dist/mesh-material.d.ts +26 -0
- package/dist/mesh-material.d.ts.map +1 -0
- package/dist/mesh-material.js +52 -0
- package/dist/mesh-material.js.map +1 -0
- package/dist/mesh-rte-uniforms.d.ts +1 -0
- package/dist/mesh-rte-uniforms.d.ts.map +1 -1
- package/dist/mesh-rte-uniforms.js +1 -0
- package/dist/mesh-rte-uniforms.js.map +1 -1
- package/dist/overlay-theme-uniforms.d.ts +54 -0
- package/dist/overlay-theme-uniforms.d.ts.map +1 -0
- package/dist/overlay-theme-uniforms.js +89 -0
- package/dist/overlay-theme-uniforms.js.map +1 -0
- package/dist/overlay-theme.d.ts +73 -0
- package/dist/overlay-theme.d.ts.map +1 -0
- package/dist/overlay-theme.js +24 -0
- package/dist/overlay-theme.js.map +1 -0
- package/dist/pipeline.d.ts +2 -0
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +10 -11
- package/dist/pipeline.js.map +1 -1
- package/dist/post-pass-chain.d.ts +1 -1
- package/dist/post-pass-chain.d.ts.map +1 -1
- package/dist/post-pass-chain.js +19 -13
- package/dist/post-pass-chain.js.map +1 -1
- package/dist/renderer-overlays.d.ts +8 -7
- package/dist/renderer-overlays.d.ts.map +1 -1
- package/dist/renderer-overlays.js +11 -14
- package/dist/renderer-overlays.js.map +1 -1
- package/dist/scene.d.ts +10 -1
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/section-plane.d.ts +3 -0
- package/dist/section-plane.d.ts.map +1 -1
- package/dist/section-plane.js +15 -24
- package/dist/section-plane.js.map +1 -1
- package/dist/shaders/color-transfer.wgsl.d.ts +5 -3
- package/dist/shaders/color-transfer.wgsl.d.ts.map +1 -1
- package/dist/shaders/color-transfer.wgsl.js +5 -3
- package/dist/shaders/color-transfer.wgsl.js.map +1 -1
- package/dist/shaders/edges.wgsl.d.ts +2 -0
- package/dist/shaders/edges.wgsl.d.ts.map +1 -0
- package/dist/shaders/edges.wgsl.js +158 -0
- package/dist/shaders/edges.wgsl.js.map +1 -0
- package/dist/shaders/main.wgsl.d.ts +1 -1
- package/dist/shaders/main.wgsl.d.ts.map +1 -1
- package/dist/shaders/main.wgsl.js +81 -77
- package/dist/shaders/main.wgsl.js.map +1 -1
- package/dist/shaders/specular.wgsl.d.ts +34 -0
- package/dist/shaders/specular.wgsl.d.ts.map +1 -0
- package/dist/shaders/specular.wgsl.js +134 -0
- package/dist/shaders/specular.wgsl.js.map +1 -0
- package/dist/visual-enhancement.d.ts +10 -3
- package/dist/visual-enhancement.d.ts.map +1 -1
- package/dist/visual-enhancement.js +9 -3
- package/dist/visual-enhancement.js.map +1 -1
- package/package.json +2 -2
- package/dist/post-processor.d.ts +0 -46
- package/dist/post-processor.d.ts.map +0 -1
- package/dist/post-processor.js +0 -295
- package/dist/post-processor.js.map +0 -1
|
@@ -3,14 +3,22 @@
|
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
/**
|
|
5
5
|
* Main rendering shader for IFC geometry.
|
|
6
|
-
* Features: linear-space
|
|
7
|
-
*
|
|
8
|
-
* roll-off, screen-space edge
|
|
6
|
+
* Features: linear-space lighting of sRGB-authored colours with a GGX
|
|
7
|
+
* specular term (specular.wgsl.ts), section plane clipping, selection
|
|
8
|
+
* highlight, glass, hue-preserving highlight roll-off, screen-space edge
|
|
9
|
+
* enhancement.
|
|
9
10
|
*/
|
|
10
11
|
import { MESH_FLAG_RTE_DRAWABLE } from '../mesh-rte-uniforms.js';
|
|
11
12
|
import { colorTransferWgsl } from './color-transfer.wgsl.js';
|
|
12
13
|
import { mainRteWgsl, mainShadowWgsl } from './main-rte-shadow.wgsl.js';
|
|
13
14
|
import { relativeToEyeWgsl } from './relative-to-eye.wgsl.js';
|
|
15
|
+
import { specularWgsl } from './specular.wgsl.js';
|
|
16
|
+
/**
|
|
17
|
+
* Translucent surfaces draw at this fraction of their alpha, so interiors
|
|
18
|
+
* read through windows and X-Ray ghosts stay faint. A viewer choice that
|
|
19
|
+
* predates #5386, not optics.
|
|
20
|
+
*/
|
|
21
|
+
const TRANSLUCENT_OPACITY_SCALE = 0.7;
|
|
14
22
|
/**
|
|
15
23
|
* Converts the environment's light intensities to linear irradiance.
|
|
16
24
|
*
|
|
@@ -33,8 +41,8 @@ export const mainShaderSource = `
|
|
|
33
41
|
viewProj: mat4x4<f32>,
|
|
34
42
|
model: mat4x4<f32>,
|
|
35
43
|
baseColor: vec4<f32>,
|
|
36
|
-
metallicRoughness: vec2<f32>, // x = metallic, y = roughness
|
|
37
|
-
|
|
44
|
+
metallicRoughness: vec2<f32>, // x = metallic, y = roughness (mesh-material.ts)
|
|
45
|
+
transmission: vec2<f32>, // x = 1: authored translucent, drawn as glass; y = pad
|
|
38
46
|
sectionPlane: vec4<f32>, // xyz = plane normal, w = plane distance
|
|
39
47
|
flags: vec4<u32>, // x = isSelected, y = section/clip bits, z = edgeEnabled, w = edgeIntensityMilli
|
|
40
48
|
clipBoxMin: vec4<f32>, // xyz = clip-box min corner (world), w = pad
|
|
@@ -66,8 +74,15 @@ export const mainShaderSource = `
|
|
|
66
74
|
_pad2: f32,
|
|
67
75
|
}
|
|
68
76
|
@binding(0) @group(1) var<uniform> env: Environment;
|
|
77
|
+
// Selection highlight tint (#5484), set by Renderer.setOverlayTheme via
|
|
78
|
+
// updateSelectionColor — written only on theme change, never per frame.
|
|
79
|
+
// TRUE LINEAR-LIGHT RGB: re-lit by lightTerm below exactly like the WGSL
|
|
80
|
+
// constant it replaces, then ACES-tonemapped + gamma-encoded on output.
|
|
81
|
+
@binding(4) @group(1) var<uniform> selectionColor: vec4<f32>;
|
|
69
82
|
const IRRADIANCE_CALIBRATION: f32 = ${IRRADIANCE_CALIBRATION};
|
|
83
|
+
const TRANSLUCENT_OPACITY_SCALE: f32 = ${TRANSLUCENT_OPACITY_SCALE};
|
|
70
84
|
${colorTransferWgsl}
|
|
85
|
+
${specularWgsl}
|
|
71
86
|
|
|
72
87
|
${mainShadowWgsl}
|
|
73
88
|
|
|
@@ -244,35 +259,6 @@ export const mainShaderSource = `
|
|
|
244
259
|
return output;
|
|
245
260
|
}
|
|
246
261
|
|
|
247
|
-
// PBR helper functions
|
|
248
|
-
fn fresnelSchlick(cosTheta: f32, F0: vec3<f32>) -> vec3<f32> {
|
|
249
|
-
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
fn distributionGGX(NdotH: f32, roughness: f32) -> f32 {
|
|
253
|
-
let a = roughness * roughness;
|
|
254
|
-
let a2 = a * a;
|
|
255
|
-
let NdotH2 = NdotH * NdotH;
|
|
256
|
-
let num = a2;
|
|
257
|
-
let denomBase = (NdotH2 * (a2 - 1.0) + 1.0);
|
|
258
|
-
let denom = 3.14159265 * denomBase * denomBase;
|
|
259
|
-
return num / max(denom, 0.0000001);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
fn geometrySchlickGGX(NdotV: f32, roughness: f32) -> f32 {
|
|
263
|
-
let r = (roughness + 1.0);
|
|
264
|
-
let k = (r * r) / 8.0;
|
|
265
|
-
let num = NdotV;
|
|
266
|
-
let denom = NdotV * (1.0 - k) + k;
|
|
267
|
-
return num / max(denom, 0.0000001);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
fn geometrySmith(NdotV: f32, NdotL: f32, roughness: f32) -> f32 {
|
|
271
|
-
let ggx2 = geometrySchlickGGX(NdotV, roughness);
|
|
272
|
-
let ggx1 = geometrySchlickGGX(NdotL, roughness);
|
|
273
|
-
return ggx1 * ggx2;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
262
|
fn encodeId24(id: u32) -> vec4<f32> {
|
|
277
263
|
let r = f32((id >> 16u) & 255u) / 255.0;
|
|
278
264
|
let g = f32((id >> 8u) & 255u) / 255.0;
|
|
@@ -451,10 +437,10 @@ export const mainShaderSource = `
|
|
|
451
437
|
// bit 1 (value 2) = isOverlay → color-override pass; preserve
|
|
452
438
|
// baseColor.a (overlay pipeline has
|
|
453
439
|
// src-alpha blending) AND skip the
|
|
454
|
-
//
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
//
|
|
440
|
+
// specular term, so an override
|
|
441
|
+
// paints its colour, lit, and a
|
|
442
|
+
// low-alpha ghost tint does not
|
|
443
|
+
// pick up glass reflections.
|
|
458
444
|
// Selected via the per-draw flag (flat path) OR the per-occurrence flag
|
|
459
445
|
// (instanced path — vs_instanced reads it from the instance buffer).
|
|
460
446
|
let isSelected = ((uniforms.flags.x & 1u) == 1u) || ((input.instSelected & 1u) == 1u);
|
|
@@ -464,7 +450,7 @@ export const mainShaderSource = `
|
|
|
464
450
|
//
|
|
465
451
|
// We override the material albedo with selection-blue and re-light
|
|
466
452
|
// it with the SAME lightTerm used for unselected surfaces, then
|
|
467
|
-
//
|
|
453
|
+
// skip the view-dependent (specular) term below. Two requirements
|
|
468
454
|
// are in tension and this satisfies both:
|
|
469
455
|
//
|
|
470
456
|
// * No base-material bleed-through. The old fresnel-glow mix left
|
|
@@ -488,7 +474,10 @@ export const mainShaderSource = `
|
|
|
488
474
|
if (isSelected) {
|
|
489
475
|
let shadeLum = dot(irradiance, vec3<f32>(0.299, 0.587, 0.114));
|
|
490
476
|
let shade = clamp(shadeLum, 0.45, 1.2);
|
|
491
|
-
|
|
477
|
+
// selectionColor is already linear-light (set by Renderer.setOverlayTheme
|
|
478
|
+
// from the app theme, #5484) — no srgbToLinear here, unlike the constant
|
|
479
|
+
// it replaces.
|
|
480
|
+
color = selectionColor.rgb * shade;
|
|
492
481
|
}
|
|
493
482
|
|
|
494
483
|
// flags.x bit 5 (value 32) = EMPHASIZE overlay: render the colour
|
|
@@ -502,44 +491,59 @@ export const mainShaderSource = `
|
|
|
502
491
|
color = baseColor * facet;
|
|
503
492
|
}
|
|
504
493
|
|
|
505
|
-
//
|
|
506
|
-
//
|
|
507
|
-
//
|
|
508
|
-
//
|
|
509
|
-
// fully opaque (the selection pipeline has no alpha blending).
|
|
510
|
-
// Emphasized clash overlay paints a SOLID vivid fill (force opaque) so
|
|
511
|
-
// it isn't blended down to a pale tint against the geometry beneath.
|
|
494
|
+
// Force alpha to 1.0 for selected objects so the highlight is fully
|
|
495
|
+
// opaque (the selection pipeline has no alpha blending). Emphasized
|
|
496
|
+
// clash overlay paints a SOLID vivid fill (force opaque) so it isn't
|
|
497
|
+
// blended down to a pale tint against the geometry beneath.
|
|
512
498
|
var finalAlpha = select(input.color.a, 1.0, isSelected || emphasizedOverlay);
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
//
|
|
524
|
-
|
|
525
|
-
let
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
499
|
+
|
|
500
|
+
// Specular (#5386; specular.wgsl.ts), after the diffuse above. Not
|
|
501
|
+
// on the selection highlight (it would wash the blue out) nor on a
|
|
502
|
+
// colour-override overlay. The sun lobe is scaled exactly like the
|
|
503
|
+
// diffuse sun term, and both terms like irradiance, so a preset's
|
|
504
|
+
// highlights and its diffuse light move together.
|
|
505
|
+
if (!isSelected && !isOverlay) {
|
|
506
|
+
// Glass is an authored translucent material (mesh-material.ts
|
|
507
|
+
// also gives it its smooth roughness). An X-Ray or compare fade
|
|
508
|
+
// only lowers the alpha and stays a fade. Instanced occurrences
|
|
509
|
+
// are never authored translucent: prepareInstancedRender routes
|
|
510
|
+
// those to the flat path, so the per-pass lane is ignored there.
|
|
511
|
+
let instancedPass = (uniforms.flags.x & 4u) != 0u;
|
|
512
|
+
let translucent = finalAlpha < 0.99;
|
|
513
|
+
let glass = translucent && uniforms.transmission.x > 0.5 && !instancedPass;
|
|
514
|
+
let metallic = clamp(uniforms.metallicRoughness.x, 0.0, 1.0);
|
|
515
|
+
let spec = surfaceSpecular(
|
|
516
|
+
N,
|
|
517
|
+
normalize(-input.eyePos),
|
|
518
|
+
baseColor,
|
|
519
|
+
metallic,
|
|
520
|
+
uniforms.metallicRoughness.y,
|
|
521
|
+
env.sunColor * (env.sunIntensity * sunShadow),
|
|
522
|
+
);
|
|
523
|
+
// What the lobe reflects is not there to diffuse; a metal has no
|
|
524
|
+
// diffuse at all.
|
|
525
|
+
let diffuse = color * (1.0 - spec.reflectance) * (1.0 - metallic);
|
|
526
|
+
let reflected = spec.light * (env.exposure * IRRADIANCE_CALIBRATION);
|
|
527
|
+
if (translucent) {
|
|
528
|
+
finalAlpha = finalAlpha * TRANSLUCENT_OPACITY_SCALE;
|
|
529
|
+
}
|
|
530
|
+
if (glass) {
|
|
531
|
+
// The transparent pipelines blend straight alpha:
|
|
532
|
+
// out = c * a + behind * (1 - a). A pane passes what is behind
|
|
533
|
+
// it except what its body absorbs and its surface reflects, and
|
|
534
|
+
// its reflection is not dimmed by the body's opacity, so solve
|
|
535
|
+
// for (c, a). The reflectance rising at grazing angles is what
|
|
536
|
+
// makes glass more opaque there; a bright sun glint raises the
|
|
537
|
+
// alpha further so it is not clipped to the body's opacity.
|
|
538
|
+
let body = finalAlpha;
|
|
539
|
+
let reflectance = dot(spec.reflectance, vec3<f32>(0.299, 0.587, 0.114));
|
|
540
|
+
let premultiplied = diffuse * body + reflected;
|
|
541
|
+
let peak = max(premultiplied.r, max(premultiplied.g, premultiplied.b));
|
|
542
|
+
finalAlpha = clamp(max(body + reflectance * (1.0 - body), peak), 0.0, 1.0);
|
|
543
|
+
color = premultiplied / max(finalAlpha, 0.0001);
|
|
544
|
+
} else {
|
|
545
|
+
color = diffuse + reflected;
|
|
546
|
+
}
|
|
543
547
|
}
|
|
544
548
|
|
|
545
549
|
// Hue-preserving highlight roll-off (color-transfer.wgsl.ts). No
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.wgsl.js","sourceRoot":"","sources":["../../src/shaders/main.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D
|
|
1
|
+
{"version":3,"file":"main.wgsl.js","sourceRoot":"","sources":["../../src/shaders/main.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;yCAmBS,sBAAsB;UACrD,iBAAiB;UACjB,WAAW;;;;;;;;;;;;;;;;;;;;;;8CAsByB,sBAAsB;iDACnB,yBAAyB;UAChE,iBAAiB;UACjB,YAAY;;UAEZ,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0fjB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specular reflection for the geometry fragment stage (#5386).
|
|
3
|
+
*
|
|
4
|
+
* Two terms, both in the units of `fs_main`'s `lightTerm`, so the caller
|
|
5
|
+
* scales them by the same exposure and `IRRADIANCE_CALIBRATION` as the
|
|
6
|
+
* diffuse light and every preset stays consistent:
|
|
7
|
+
*
|
|
8
|
+
* - the sun: a Cook-Torrance lobe (GGX distribution, Smith-Schlick
|
|
9
|
+
* visibility, Schlick Fresnel). `fs_main` lights a Lambertian albedo as
|
|
10
|
+
* `albedo * intensity`, i.e. the sun's irradiance is `pi * intensity`, so
|
|
11
|
+
* the lobe is scaled by the same `pi` and a white dielectric reflects no
|
|
12
|
+
* more than physics allows next to its diffuse.
|
|
13
|
+
* - the environment: the same two-colour hemisphere that lights the diffuse
|
|
14
|
+
* ambient, read along the reflection vector and weighted by the
|
|
15
|
+
* split-sum environment BRDF (Karis's analytic fit, "Physically Based
|
|
16
|
+
* Shading on Mobile", 2014). The fit already accounts for the lobe's
|
|
17
|
+
* shadowing, so a rough surface picks up almost nothing at grazing angles
|
|
18
|
+
* while a smooth one (glass) turns into a mirror there.
|
|
19
|
+
*
|
|
20
|
+
* `reflectance` is that directional albedo of the specular lobe. The caller
|
|
21
|
+
* takes it off the diffuse (`1 - reflectance`), so a highlight never adds
|
|
22
|
+
* energy on top of a full diffuse, and glass uses it as the light it no
|
|
23
|
+
* longer transmits.
|
|
24
|
+
*
|
|
25
|
+
* Reads the `env` lighting uniform, like `sunShadowFactor`.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Smallest roughness the lobe is evaluated at. Below this the GGX peak is a
|
|
29
|
+
* sub-pixel spike that flickers from frame to frame. The value is Filament's
|
|
30
|
+
* `MIN_PERCEPTUAL_ROUGHNESS` for 32-bit floats.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MIN_SPECULAR_ROUGHNESS = 0.045;
|
|
33
|
+
export declare const specularWgsl = "\n const MIN_SPECULAR_ROUGHNESS: f32 = 0.045;\n const DIELECTRIC_F0: f32 = 0.04;\n const PI: f32 = 3.14159265;\n\n fn fresnelSchlick(cosTheta: f32, F0: vec3<f32>) -> vec3<f32> {\n return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);\n }\n\n fn distributionGGX(NdotH: f32, roughness: f32) -> f32 {\n let a = roughness * roughness;\n let a2 = a * a;\n let NdotH2 = NdotH * NdotH;\n let denomBase = (NdotH2 * (a2 - 1.0) + 1.0);\n return a2 / max(PI * denomBase * denomBase, 0.0000001);\n }\n\n fn geometrySchlickGGX(NdotV: f32, roughness: f32) -> f32 {\n let r = (roughness + 1.0);\n let k = (r * r) / 8.0;\n return NdotV / max(NdotV * (1.0 - k) + k, 0.0000001);\n }\n\n fn geometrySmith(NdotV: f32, NdotL: f32, roughness: f32) -> f32 {\n return geometrySchlickGGX(NdotL, roughness) * geometrySchlickGGX(NdotV, roughness);\n }\n\n // Split-sum environment BRDF, analytic fit (Karis 2014).\n fn envBrdfApprox(F0: vec3<f32>, roughness: f32, NdotV: f32) -> vec3<f32> {\n let r = roughness * vec4<f32>(-1.0, -0.0275, -0.572, 0.022) + vec4<f32>(1.0, 0.0425, 1.04, -0.04);\n let a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;\n let ab = vec2<f32>(-1.04, 1.04) * a004 + r.zw;\n return F0 * ab.x + ab.y;\n }\n\n struct SurfaceSpecular {\n // Reflected light, in lightTerm units (unexposed, uncalibrated).\n light: vec3<f32>,\n // Directional albedo of the specular lobe for this view.\n reflectance: vec3<f32>,\n }\n\n // N and V are unit vectors; V points from the surface to the eye.\n // sunLight is the sun's diffuse-equivalent intensity: sunColor *\n // sunIntensity * sunShadow, exactly what scales the diffuse sun term.\n fn surfaceSpecular(\n N: vec3<f32>,\n V: vec3<f32>,\n albedo: vec3<f32>,\n metallic: f32,\n roughnessIn: f32,\n sunLight: vec3<f32>,\n ) -> SurfaceSpecular {\n var out: SurfaceSpecular;\n let NdotV = dot(N, V);\n // A face turned away from the eye is its back side: nothing it\n // reflects can reach the eye, and its diffuse keeps full weight.\n if (NdotV <= 0.0) {\n out.light = vec3<f32>(0.0);\n out.reflectance = vec3<f32>(0.0);\n return out;\n }\n let roughness = clamp(roughnessIn, MIN_SPECULAR_ROUGHNESS, 1.0);\n let F0 = mix(vec3<f32>(DIELECTRIC_F0), albedo, metallic);\n\n let L = env.sunDirection;\n let rawNdotL = dot(N, L);\n let NdotL = max(rawNdotL, 0.0);\n // A face the sun is behind (rawNdotL <= 0) contributes nothing to\n // the direct lobe anyway (NdotL clamps it to 0 below), but V + L\n // can be exactly zero there \u2014 the sun exactly opposite the eye\n // reflection, e.g. N = V = (0,-1,0), sun = (0,1,0), both satisfy\n // NdotV > 0 above. normalize(vec3(0)) is NaN in WGSL, and NaN * 0\n // is NaN, not 0, so it would poison sun and everything summed with\n // it instead of being multiplied away. Skip the half-vector\n // entirely in that case rather than relying on the NdotL factor.\n var sun = vec3<f32>(0.0);\n if (rawNdotL > 0.0) {\n let H = normalize(V + L);\n let D = distributionGGX(max(dot(N, H), 0.0), roughness);\n let G = geometrySmith(NdotV, NdotL, roughness);\n let F = fresnelSchlick(max(dot(V, H), 0.0), F0);\n // BRDF * NdotL * (pi * intensity); the NdotL cancels the BRDF's.\n sun = F * (D * G * PI / (4.0 * NdotV)) * sunLight;\n }\n\n // The hemisphere ambient, looked up along the reflection. A rough\n // lobe gathers from around the normal, so lean the lookup toward N.\n let R = reflect(-V, N);\n let Rd = normalize(mix(R, N, roughness * roughness));\n let sky = mix(env.groundColor, env.skyColor, Rd.y * 0.5 + 0.5) * env.ambientIntensity;\n let reflectance = envBrdfApprox(F0, roughness, NdotV);\n\n out.light = sun + sky * reflectance;\n out.reflectance = reflectance;\n return out;\n }\n";
|
|
34
|
+
//# sourceMappingURL=specular.wgsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specular.wgsl.d.ts","sourceRoot":"","sources":["../../src/shaders/specular.wgsl.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C,eAAO,MAAM,YAAY,u1IAiGxB,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Specular reflection for the geometry fragment stage (#5386).
|
|
6
|
+
*
|
|
7
|
+
* Two terms, both in the units of `fs_main`'s `lightTerm`, so the caller
|
|
8
|
+
* scales them by the same exposure and `IRRADIANCE_CALIBRATION` as the
|
|
9
|
+
* diffuse light and every preset stays consistent:
|
|
10
|
+
*
|
|
11
|
+
* - the sun: a Cook-Torrance lobe (GGX distribution, Smith-Schlick
|
|
12
|
+
* visibility, Schlick Fresnel). `fs_main` lights a Lambertian albedo as
|
|
13
|
+
* `albedo * intensity`, i.e. the sun's irradiance is `pi * intensity`, so
|
|
14
|
+
* the lobe is scaled by the same `pi` and a white dielectric reflects no
|
|
15
|
+
* more than physics allows next to its diffuse.
|
|
16
|
+
* - the environment: the same two-colour hemisphere that lights the diffuse
|
|
17
|
+
* ambient, read along the reflection vector and weighted by the
|
|
18
|
+
* split-sum environment BRDF (Karis's analytic fit, "Physically Based
|
|
19
|
+
* Shading on Mobile", 2014). The fit already accounts for the lobe's
|
|
20
|
+
* shadowing, so a rough surface picks up almost nothing at grazing angles
|
|
21
|
+
* while a smooth one (glass) turns into a mirror there.
|
|
22
|
+
*
|
|
23
|
+
* `reflectance` is that directional albedo of the specular lobe. The caller
|
|
24
|
+
* takes it off the diffuse (`1 - reflectance`), so a highlight never adds
|
|
25
|
+
* energy on top of a full diffuse, and glass uses it as the light it no
|
|
26
|
+
* longer transmits.
|
|
27
|
+
*
|
|
28
|
+
* Reads the `env` lighting uniform, like `sunShadowFactor`.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Smallest roughness the lobe is evaluated at. Below this the GGX peak is a
|
|
32
|
+
* sub-pixel spike that flickers from frame to frame. The value is Filament's
|
|
33
|
+
* `MIN_PERCEPTUAL_ROUGHNESS` for 32-bit floats.
|
|
34
|
+
*/
|
|
35
|
+
export const MIN_SPECULAR_ROUGHNESS = 0.045;
|
|
36
|
+
export const specularWgsl = `
|
|
37
|
+
const MIN_SPECULAR_ROUGHNESS: f32 = ${MIN_SPECULAR_ROUGHNESS};
|
|
38
|
+
const DIELECTRIC_F0: f32 = 0.04;
|
|
39
|
+
const PI: f32 = 3.14159265;
|
|
40
|
+
|
|
41
|
+
fn fresnelSchlick(cosTheta: f32, F0: vec3<f32>) -> vec3<f32> {
|
|
42
|
+
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fn distributionGGX(NdotH: f32, roughness: f32) -> f32 {
|
|
46
|
+
let a = roughness * roughness;
|
|
47
|
+
let a2 = a * a;
|
|
48
|
+
let NdotH2 = NdotH * NdotH;
|
|
49
|
+
let denomBase = (NdotH2 * (a2 - 1.0) + 1.0);
|
|
50
|
+
return a2 / max(PI * denomBase * denomBase, 0.0000001);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fn geometrySchlickGGX(NdotV: f32, roughness: f32) -> f32 {
|
|
54
|
+
let r = (roughness + 1.0);
|
|
55
|
+
let k = (r * r) / 8.0;
|
|
56
|
+
return NdotV / max(NdotV * (1.0 - k) + k, 0.0000001);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fn geometrySmith(NdotV: f32, NdotL: f32, roughness: f32) -> f32 {
|
|
60
|
+
return geometrySchlickGGX(NdotL, roughness) * geometrySchlickGGX(NdotV, roughness);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Split-sum environment BRDF, analytic fit (Karis 2014).
|
|
64
|
+
fn envBrdfApprox(F0: vec3<f32>, roughness: f32, NdotV: f32) -> vec3<f32> {
|
|
65
|
+
let r = roughness * vec4<f32>(-1.0, -0.0275, -0.572, 0.022) + vec4<f32>(1.0, 0.0425, 1.04, -0.04);
|
|
66
|
+
let a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
|
|
67
|
+
let ab = vec2<f32>(-1.04, 1.04) * a004 + r.zw;
|
|
68
|
+
return F0 * ab.x + ab.y;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
struct SurfaceSpecular {
|
|
72
|
+
// Reflected light, in lightTerm units (unexposed, uncalibrated).
|
|
73
|
+
light: vec3<f32>,
|
|
74
|
+
// Directional albedo of the specular lobe for this view.
|
|
75
|
+
reflectance: vec3<f32>,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// N and V are unit vectors; V points from the surface to the eye.
|
|
79
|
+
// sunLight is the sun's diffuse-equivalent intensity: sunColor *
|
|
80
|
+
// sunIntensity * sunShadow, exactly what scales the diffuse sun term.
|
|
81
|
+
fn surfaceSpecular(
|
|
82
|
+
N: vec3<f32>,
|
|
83
|
+
V: vec3<f32>,
|
|
84
|
+
albedo: vec3<f32>,
|
|
85
|
+
metallic: f32,
|
|
86
|
+
roughnessIn: f32,
|
|
87
|
+
sunLight: vec3<f32>,
|
|
88
|
+
) -> SurfaceSpecular {
|
|
89
|
+
var out: SurfaceSpecular;
|
|
90
|
+
let NdotV = dot(N, V);
|
|
91
|
+
// A face turned away from the eye is its back side: nothing it
|
|
92
|
+
// reflects can reach the eye, and its diffuse keeps full weight.
|
|
93
|
+
if (NdotV <= 0.0) {
|
|
94
|
+
out.light = vec3<f32>(0.0);
|
|
95
|
+
out.reflectance = vec3<f32>(0.0);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
let roughness = clamp(roughnessIn, MIN_SPECULAR_ROUGHNESS, 1.0);
|
|
99
|
+
let F0 = mix(vec3<f32>(DIELECTRIC_F0), albedo, metallic);
|
|
100
|
+
|
|
101
|
+
let L = env.sunDirection;
|
|
102
|
+
let rawNdotL = dot(N, L);
|
|
103
|
+
let NdotL = max(rawNdotL, 0.0);
|
|
104
|
+
// A face the sun is behind (rawNdotL <= 0) contributes nothing to
|
|
105
|
+
// the direct lobe anyway (NdotL clamps it to 0 below), but V + L
|
|
106
|
+
// can be exactly zero there — the sun exactly opposite the eye
|
|
107
|
+
// reflection, e.g. N = V = (0,-1,0), sun = (0,1,0), both satisfy
|
|
108
|
+
// NdotV > 0 above. normalize(vec3(0)) is NaN in WGSL, and NaN * 0
|
|
109
|
+
// is NaN, not 0, so it would poison sun and everything summed with
|
|
110
|
+
// it instead of being multiplied away. Skip the half-vector
|
|
111
|
+
// entirely in that case rather than relying on the NdotL factor.
|
|
112
|
+
var sun = vec3<f32>(0.0);
|
|
113
|
+
if (rawNdotL > 0.0) {
|
|
114
|
+
let H = normalize(V + L);
|
|
115
|
+
let D = distributionGGX(max(dot(N, H), 0.0), roughness);
|
|
116
|
+
let G = geometrySmith(NdotV, NdotL, roughness);
|
|
117
|
+
let F = fresnelSchlick(max(dot(V, H), 0.0), F0);
|
|
118
|
+
// BRDF * NdotL * (pi * intensity); the NdotL cancels the BRDF's.
|
|
119
|
+
sun = F * (D * G * PI / (4.0 * NdotV)) * sunLight;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// The hemisphere ambient, looked up along the reflection. A rough
|
|
123
|
+
// lobe gathers from around the normal, so lean the lookup toward N.
|
|
124
|
+
let R = reflect(-V, N);
|
|
125
|
+
let Rd = normalize(mix(R, N, roughness * roughness));
|
|
126
|
+
let sky = mix(env.groundColor, env.skyColor, Rd.y * 0.5 + 0.5) * env.ambientIntensity;
|
|
127
|
+
let reflectance = envBrdfApprox(F0, roughness, NdotV);
|
|
128
|
+
|
|
129
|
+
out.light = sun + sky * reflectance;
|
|
130
|
+
out.reflectance = reflectance;
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
`;
|
|
134
|
+
//# sourceMappingURL=specular.wgsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specular.wgsl.js","sourceRoot":"","sources":["../../src/shaders/specular.wgsl.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG;8CACkB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGnE,CAAC"}
|
|
@@ -22,10 +22,16 @@ export type ResolvedVisualEnhancement = {
|
|
|
22
22
|
radius: number;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Accepted `separationLines.radius`, in pixels: the tap distance the edge
|
|
27
|
+
* pass (#5385) offsets its cardinal and (at `high` quality) diagonal
|
|
28
|
+
* samples by. Widened from 1-2 to 1-3 when the pass gained diagonal taps and
|
|
29
|
+
* a normal-crease/silhouette test alongside the entity-id test, so `high`
|
|
30
|
+
* quality has room to space its 8 taps out from the 4-tap `low` default.
|
|
31
|
+
*/
|
|
26
32
|
export declare const SEPARATION_RADIUS_RANGE_PX: {
|
|
27
33
|
readonly min: 1;
|
|
28
|
-
readonly max:
|
|
34
|
+
readonly max: 3;
|
|
29
35
|
};
|
|
30
36
|
/**
|
|
31
37
|
* Resolves per-frame `VisualEnhancementOptions` against the last-resolved
|
|
@@ -45,7 +51,8 @@ export declare class VisualEnhancementResolver {
|
|
|
45
51
|
export interface LivePostEffects {
|
|
46
52
|
/** The quality to run ambient occlusion at, or null when it does not run. */
|
|
47
53
|
ambientOcclusion: AoQuality | null;
|
|
48
|
-
|
|
54
|
+
/** The edge pass (#5385): entity-id, normal-crease and silhouette lines. Option name stays `separationLines`. */
|
|
55
|
+
edges: boolean;
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
58
|
* The post passes to run this frame: those the options ask for, while
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-enhancement.d.ts","sourceRoot":"","sources":["../src/visual-enhancement.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE1G,MAAM,MAAM,yBAAyB,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,cAAc,EAAE;QACZ,OAAO,EAAE,qBAAqB,CAAC;QAC/B,cAAc;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,6CAA6C;QAC7C,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,sBAAsB,CAAC;QAChC,cAAc;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,mDAAmD;QACnD,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"visual-enhancement.d.ts","sourceRoot":"","sources":["../src/visual-enhancement.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE1G,MAAM,MAAM,yBAAyB,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,cAAc,EAAE;QACZ,OAAO,EAAE,qBAAqB,CAAC;QAC/B,cAAc;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,6CAA6C;QAC7C,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,eAAe,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,sBAAsB,CAAC;QAChC,cAAc;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,mDAAmD;QACnD,MAAM,EAAE,MAAM,CAAC;KAClB,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B;;;CAA8B,CAAC;AAWtE;;;;;;;;;GASG;AACH,qBAAa,yBAAyB;IAClC,OAAO,CAAC,KAAK,CAKX;IAEF,OAAO,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,yBAAyB;CA+BzE;AAED,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC5B,6EAA6E;IAC7E,gBAAgB,EAAE,SAAS,GAAG,IAAI,CAAC;IACnC,iHAAiH;IACjH,KAAK,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,yBAAyB,EAAE,WAAW,EAAE,OAAO,GAAG,eAAe,CAOpG"}
|
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
import { AO_RADIUS_RANGE } from './ao-params.js';
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Accepted `separationLines.radius`, in pixels: the tap distance the edge
|
|
7
|
+
* pass (#5385) offsets its cardinal and (at `high` quality) diagonal
|
|
8
|
+
* samples by. Widened from 1-2 to 1-3 when the pass gained diagonal taps and
|
|
9
|
+
* a normal-crease/silhouette test alongside the entity-id test, so `high`
|
|
10
|
+
* quality has room to space its 8 taps out from the 4-tap `low` default.
|
|
11
|
+
*/
|
|
12
|
+
export const SEPARATION_RADIUS_RANGE_PX = { min: 1, max: 3 };
|
|
7
13
|
/**
|
|
8
14
|
* `value` clamped to [min, max]; a missing or non-finite value keeps
|
|
9
15
|
* `previous` (which is already in range).
|
|
@@ -66,7 +72,7 @@ export function livePostEffects(ve, effectsLive) {
|
|
|
66
72
|
const aoQuality = ve.contactShading.quality;
|
|
67
73
|
return {
|
|
68
74
|
ambientOcclusion: live && aoQuality !== 'off' ? aoQuality : null,
|
|
69
|
-
|
|
75
|
+
edges: live && ve.separationLines.enabled && ve.separationLines.quality !== 'off',
|
|
70
76
|
};
|
|
71
77
|
}
|
|
72
78
|
//# sourceMappingURL=visual-enhancement.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visual-enhancement.js","sourceRoot":"","sources":["../src/visual-enhancement.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAAE,eAAe,EAAkB,MAAM,gBAAgB,CAAC;AA0BjE
|
|
1
|
+
{"version":3,"file":"visual-enhancement.js","sourceRoot":"","sources":["../src/visual-enhancement.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "WebGPU renderer for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@ifc-lite/geometry": "^7.5.
|
|
16
|
+
"@ifc-lite/geometry": "^7.5.2",
|
|
17
17
|
"@ifc-lite/spatial": "^1.15.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
package/dist/post-processor.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Separation-line overlay: a fullscreen pass that darkens pixels where a
|
|
3
|
-
* neighbour belongs to a different entity AND the depth creases or steps
|
|
4
|
-
* there, so abutting elements read as separate parts.
|
|
5
|
-
*
|
|
6
|
-
* Ambient occlusion used to share this pass as "contact shading"; it now
|
|
7
|
-
* lives in `ao-pass.ts` (#5384).
|
|
8
|
-
*/
|
|
9
|
-
import { WebGPUDevice } from './device.js';
|
|
10
|
-
export type PostProcessQuality = 'low' | 'high';
|
|
11
|
-
export interface SeparationLinePassOptions {
|
|
12
|
-
targetView: GPUTextureView;
|
|
13
|
-
depthView: GPUTextureView;
|
|
14
|
-
objectIdView: GPUTextureView;
|
|
15
|
-
quality: PostProcessQuality;
|
|
16
|
-
/** Tap distance in pixels at `high` quality; `low` always uses 1. */
|
|
17
|
-
radius: number;
|
|
18
|
-
intensity: number;
|
|
19
|
-
}
|
|
20
|
-
export declare class PostProcessor {
|
|
21
|
-
private _device;
|
|
22
|
-
private colorFormat;
|
|
23
|
-
private isMultisampled;
|
|
24
|
-
private uniformBuffer;
|
|
25
|
-
private uniformStaging;
|
|
26
|
-
private uniformF32;
|
|
27
|
-
private uniformU32;
|
|
28
|
-
private bindGroupLayout;
|
|
29
|
-
private pipeline;
|
|
30
|
-
private cachedBindGroup;
|
|
31
|
-
private cachedDepthView;
|
|
32
|
-
private cachedObjectIdView;
|
|
33
|
-
constructor(device: WebGPUDevice, sampleCount: number);
|
|
34
|
-
/**
|
|
35
|
-
* Draw the separation lines over `targetView` in a fullscreen overlay pass.
|
|
36
|
-
*/
|
|
37
|
-
apply(commandEncoder: GPUCommandEncoder, options: SeparationLinePassOptions): void;
|
|
38
|
-
private destroyed;
|
|
39
|
-
/**
|
|
40
|
-
* Destroy all GPU resources held by this post-processor.
|
|
41
|
-
* After calling this method the post-processor is no longer usable.
|
|
42
|
-
* Safe to call multiple times.
|
|
43
|
-
*/
|
|
44
|
-
destroy(): void;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=post-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"post-processor.d.ts","sourceRoot":"","sources":["../src/post-processor.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,yBAAyB;IACtC,UAAU,EAAE,cAAc,CAAC;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,YAAY,EAAE,cAAc,CAAC;IAC7B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,aAAa;IACtB,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,eAAe,CAA+B;IACtD,OAAO,CAAC,kBAAkB,CAA+B;gBAE7C,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM;IAwOrD;;OAEG;IACH,KAAK,CAAC,cAAc,EAAE,iBAAiB,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAmClF,OAAO,CAAC,SAAS,CAAS;IAE1B;;;;OAIG;IACH,OAAO,IAAI,IAAI;CAQlB"}
|