Skip to main content

Variable: lightmapFilter

const lightmapFilter: object

Defined in: modules/lighting/lightmap/lightmap-filter.ts:7

Internal accumulation/copy/dilation shader shared by the engine baker.

Type Declaration​

bindingLayout​

readonly bindingLayout: readonly [{ group: 0; name: "lightmapFilter"; }, { group: 0; name: "currentTexture"; }, { group: 0; name: "previousTexture"; }, { group: 0; name: "chartTexture"; }]

defaultUniforms​

readonly defaultUniforms: object

defaultUniforms.mode​

readonly mode: 0 = 0

defaultUniforms.weight​

readonly weight: 1 = 1

fs​

readonly fs: "\nlayout(std140) uniform lightmapFilterUniforms {\n float weight;\n int mode;\n} lightmapFilter;\nuniform sampler2D currentTexture;\nuniform sampler2D previousTexture;\nuniform sampler2D chartTexture;\nvec4 lightmapFilter_getColor(ivec2 coordinates) {\n vec4 current = texelFetch(currentTexture, coordinates, 0);\n if (lightmapFilter.mode == 0) {\n return vec4(mix(texelFetch(previousTexture, coordinates, 0).rgb, current.rgb, lightmapFilter.weight), current.a);\n }\n if (lightmapFilter.mode == 2 || current.a > 0.0) {return current;}\n float chart = texelFetch(chartTexture, coordinates, 0).r;\n ivec2 size = textureSize(currentTexture, 0);\n if (chart <= 0.0) return current;\n for (int y = -1; y <= 1; y++) {\n for (int x = -1; x <= 1; x++) {\n ivec2 neighbor = coordinates + ivec2(x,y);\n if (all(greaterThanEqual(neighbor, ivec2(0))) && all(lessThan(neighbor,size))) {\n vec4 candidate = texelFetch(currentTexture, neighbor, 0);\n if (candidate.a == chart) {return candidate;}\n }\n }\n }\n return current;\n}"

getUniforms​

readonly getUniforms: (props) => object

Parameters​

props​
mode?​

number

weight?​

number

Returns​

object

mode?​

optional mode?: number

weight?​

optional weight?: number

name​

readonly name: "lightmapFilter" = 'lightmapFilter'

source​

readonly source: "\nstruct LightmapFilterUniforms {weight: f32, mode: i32};\n@group(0) @binding(auto) var<uniform> lightmapFilter: LightmapFilterUniforms;\n@group(0) @binding(auto) var currentTexture: texture_2d<f32>;\n@group(0) @binding(auto) var previousTexture: texture_2d<f32>;\n@group(0) @binding(auto) var chartTexture: texture_2d<f32>;\nfn lightmapFilter_getColor(coordinates: vec2i) -> vec4f {\n let current = textureLoad(currentTexture, coordinates, 0);\n if (lightmapFilter.mode == 0) {\n let previous = textureLoad(previousTexture, coordinates, 0);\n return vec4f(mix(previous.rgb, current.rgb, lightmapFilter.weight), current.a);\n }\n if (lightmapFilter.mode == 2 || current.a > 0.0) {return current;}\n let chart = textureLoad(chartTexture, coordinates, 0).r;\n if (chart <= 0.0) {return current;}\n let size = vec2i(textureDimensions(currentTexture));\n for (var y = -1; y <= 1; y++) {\n for (var x = -1; x <= 1; x++) {\n let neighbor = coordinates + vec2i(x, y);\n if (all(neighbor >= vec2i(0)) && all(neighbor < size)) {\n let candidate = textureLoad(currentTexture, neighbor, 0);\n if (candidate.a == chart) {return candidate;}\n }\n }\n }\n return current;\n}"

uniformTypes​

readonly uniformTypes: object

uniformTypes.mode​

readonly mode: "i32" = 'i32'

uniformTypes.weight​

readonly weight: "f32" = 'f32'