@babylonjs/core 8.30.3 → 8.30.5
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/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.d.ts +30 -0
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js +105 -0
- package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +1 -1
- package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +2 -1
- package/FrameGraph/Node/nodeRenderGraph.js +5 -2
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +17 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +23 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -1
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +3 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/standardMaterial.js +1 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +21 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +2 -1
- package/Misc/copyTextureToTexture.js +12 -4
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.d.ts +4 -2
- package/PostProcesses/convolutionPostProcess.js +32 -22
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/index.d.ts +1 -0
- package/PostProcesses/index.js +1 -0
- package/PostProcesses/index.js.map +1 -1
- package/PostProcesses/thinConvolutionPostProcess.d.ts +59 -0
- package/PostProcesses/thinConvolutionPostProcess.js +83 -0
- package/PostProcesses/thinConvolutionPostProcess.js.map +1 -0
- package/Shaders/copyTextureToTexture.fragment.js +6 -1
- package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
- package/ShadersWGSL/copyTextureToTexture.fragment.js +11 -2
- package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -33,8 +33,9 @@ export declare class CopyTextureToTexture {
|
|
|
33
33
|
* Constructs a new instance of the class
|
|
34
34
|
* @param engine The engine to use for the copy
|
|
35
35
|
* @param isDepthTexture True means that we should write (using gl_FragDepth) into the depth texture attached to the destination (default: false)
|
|
36
|
+
* @param sameSizeCopy True means that the copy will be done without any sampling (more efficient, but requires the source and destination to be of the same size) (default: false)
|
|
36
37
|
*/
|
|
37
|
-
constructor(engine: AbstractEngine, isDepthTexture?: boolean);
|
|
38
|
+
constructor(engine: AbstractEngine, isDepthTexture?: boolean, sameSizeCopy?: boolean);
|
|
38
39
|
private _shadersLoaded;
|
|
39
40
|
private _initShaderSourceAsync;
|
|
40
41
|
/**
|
|
@@ -26,8 +26,9 @@ export class CopyTextureToTexture {
|
|
|
26
26
|
* Constructs a new instance of the class
|
|
27
27
|
* @param engine The engine to use for the copy
|
|
28
28
|
* @param isDepthTexture True means that we should write (using gl_FragDepth) into the depth texture attached to the destination (default: false)
|
|
29
|
+
* @param sameSizeCopy True means that the copy will be done without any sampling (more efficient, but requires the source and destination to be of the same size) (default: false)
|
|
29
30
|
*/
|
|
30
|
-
constructor(engine, isDepthTexture = false) {
|
|
31
|
+
constructor(engine, isDepthTexture = false, sameSizeCopy = false) {
|
|
31
32
|
/** Shader language used */
|
|
32
33
|
this._shaderLanguage = 0 /* ShaderLanguage.GLSL */;
|
|
33
34
|
this._shadersLoaded = false;
|
|
@@ -35,9 +36,9 @@ export class CopyTextureToTexture {
|
|
|
35
36
|
this._isDepthTexture = isDepthTexture;
|
|
36
37
|
this._renderer = new EffectRenderer(engine);
|
|
37
38
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
38
|
-
this._initShaderSourceAsync(isDepthTexture);
|
|
39
|
+
this._initShaderSourceAsync(isDepthTexture, sameSizeCopy);
|
|
39
40
|
}
|
|
40
|
-
async _initShaderSourceAsync(isDepthTexture) {
|
|
41
|
+
async _initShaderSourceAsync(isDepthTexture, sameSizeCopy) {
|
|
41
42
|
const engine = this._engine;
|
|
42
43
|
if (engine.isWebGPU) {
|
|
43
44
|
this._shaderLanguage = 1 /* ShaderLanguage.WGSL */;
|
|
@@ -47,6 +48,13 @@ export class CopyTextureToTexture {
|
|
|
47
48
|
await import("../Shaders/copyTextureToTexture.fragment.js");
|
|
48
49
|
}
|
|
49
50
|
this._shadersLoaded = true;
|
|
51
|
+
const defines = [];
|
|
52
|
+
if (isDepthTexture) {
|
|
53
|
+
defines.push("#define DEPTH_TEXTURE");
|
|
54
|
+
}
|
|
55
|
+
if (sameSizeCopy) {
|
|
56
|
+
defines.push("#define NO_SAMPLER");
|
|
57
|
+
}
|
|
50
58
|
this._effectWrapper = new EffectWrapper({
|
|
51
59
|
engine: engine,
|
|
52
60
|
name: "CopyTextureToTexture",
|
|
@@ -54,7 +62,7 @@ export class CopyTextureToTexture {
|
|
|
54
62
|
useShaderStore: true,
|
|
55
63
|
uniformNames: ["conversion"],
|
|
56
64
|
samplerNames: ["textureSampler"],
|
|
57
|
-
defines
|
|
65
|
+
defines,
|
|
58
66
|
shaderLanguage: this._shaderLanguage,
|
|
59
67
|
});
|
|
60
68
|
this._effectWrapper.onApplyObservable.add(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyTextureToTexture.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/copyTextureToTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,gCAA+B;AAKnD;;GAEG;AACH,MAAM,CAAN,IAAkB,cAIjB;AAJD,WAAkB,cAAc;IAC5B,mDAAQ,CAAA;IACR,qEAAiB,CAAA;IACjB,mEAAgB,CAAA;AACpB,CAAC,EAJiB,cAAc,KAAd,cAAc,QAI/B;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAW7B;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAEO,kBAAkB,CAAC,OAAsC;QAC7D,OAAQ,OAAuB,CAAC,kBAAkB,KAAK,SAAS,CAAC;IACrE,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"copyTextureToTexture.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/copyTextureToTexture.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5E,OAAO,EAAE,SAAS,EAAE,gCAA+B;AAKnD;;GAEG;AACH,MAAM,CAAN,IAAkB,cAIjB;AAJD,WAAkB,cAAc;IAC5B,mDAAQ,CAAA;IACR,qEAAiB,CAAA;IACjB,mEAAgB,CAAA;AACpB,CAAC,EAJiB,cAAc,KAAd,cAAc,QAI/B;AAED;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAW7B;;OAEG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAEO,k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AI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACxD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,+EAA+E;QAErI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAExD,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAE5C,IAAI,IAAI,CAAC,eAAe,IAAI,eAAe,EAAE,CAAC;YAC1C,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import type { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport type { InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport { EffectRenderer, EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport type { IRenderTargetTexture, RenderTargetWrapper } from \"../Engines/renderTargetWrapper\";\r\nimport type { ThinTexture } from \"../Materials/Textures/thinTexture\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\r\n\r\n/**\r\n * Conversion modes available when copying a texture into another one\r\n */\r\nexport const enum ConversionMode {\r\n None = 0,\r\n ToLinearSpace = 1,\r\n ToGammaSpace = 2,\r\n}\r\n\r\n/**\r\n * Class used for fast copy from one texture to another\r\n */\r\nexport class CopyTextureToTexture {\r\n private _engine: AbstractEngine;\r\n private _isDepthTexture: boolean;\r\n private _renderer: EffectRenderer;\r\n private _effectWrapper: EffectWrapper;\r\n private _source: InternalTexture | ThinTexture;\r\n private _conversion: number;\r\n\r\n /** Shader language used */\r\n protected _shaderLanguage = ShaderLanguage.GLSL;\r\n\r\n /**\r\n * Gets the shader language\r\n */\r\n public get shaderLanguage(): ShaderLanguage {\r\n return this._shaderLanguage;\r\n }\r\n\r\n private _textureIsInternal(texture: InternalTexture | ThinTexture): texture is InternalTexture {\r\n return (texture as ThinTexture).getInternalTexture === undefined;\r\n }\r\n\r\n /**\r\n * Constructs a new instance of the class\r\n * @param engine The engine to use for the copy\r\n * @param isDepthTexture True means that we should write (using gl_FragDepth) into the depth texture attached to the destination (default: false)\r\n * @param sameSizeCopy True means that the copy will be done without any sampling (more efficient, but requires the source and destination to be of the same size) (default: false)\r\n */\r\n constructor(engine: AbstractEngine, isDepthTexture = false, sameSizeCopy = false) {\r\n this._engine = engine;\r\n this._isDepthTexture = isDepthTexture;\r\n\r\n this._renderer = new EffectRenderer(engine);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._initShaderSourceAsync(isDepthTexture, sameSizeCopy);\r\n }\r\n\r\n private _shadersLoaded = false;\r\n private async _initShaderSourceAsync(isDepthTexture: boolean, sameSizeCopy: boolean) {\r\n const engine = this._engine;\r\n\r\n if (engine.isWebGPU) {\r\n this._shaderLanguage = ShaderLanguage.WGSL;\r\n\r\n await import(\"../ShadersWGSL/copyTextureToTexture.fragment\");\r\n } else {\r\n await import(\"../Shaders/copyTextureToTexture.fragment\");\r\n }\r\n\r\n this._shadersLoaded = true;\r\n\r\n const defines: string[] = [];\r\n\r\n if (isDepthTexture) {\r\n defines.push(\"#define DEPTH_TEXTURE\");\r\n }\r\n if (sameSizeCopy) {\r\n defines.push(\"#define NO_SAMPLER\");\r\n }\r\n\r\n this._effectWrapper = new EffectWrapper({\r\n engine: engine,\r\n name: \"CopyTextureToTexture\",\r\n fragmentShader: \"copyTextureToTexture\",\r\n useShaderStore: true,\r\n uniformNames: [\"conversion\"],\r\n samplerNames: [\"textureSampler\"],\r\n defines,\r\n shaderLanguage: this._shaderLanguage,\r\n });\r\n\r\n this._effectWrapper.onApplyObservable.add(() => {\r\n if (isDepthTexture) {\r\n engine.setState(false);\r\n engine.setDepthBuffer(true);\r\n engine.depthCullingState.depthMask = true;\r\n engine.depthCullingState.depthFunc = Constants.ALWAYS;\r\n } else {\r\n engine.depthCullingState.depthMask = false;\r\n // other states are already set by EffectRenderer.applyEffectWrapper\r\n }\r\n\r\n if (this._textureIsInternal(this._source)) {\r\n this._effectWrapper.effect._bindTexture(\"textureSampler\", this._source);\r\n } else {\r\n this._effectWrapper.effect.setTexture(\"textureSampler\", this._source);\r\n }\r\n this._effectWrapper.effect.setFloat(\"conversion\", this._conversion);\r\n });\r\n }\r\n\r\n /**\r\n * Indicates if the effect is ready to be used for the copy\r\n * @returns true if \"copy\" can be called without delay, else false\r\n */\r\n public isReady(): boolean {\r\n return this._shadersLoaded && !!this._effectWrapper?.effect?.isReady();\r\n }\r\n\r\n /**\r\n * Copy one texture into another\r\n * @param source The source texture\r\n * @param destination The destination texture. If null, copy the source to the currently bound framebuffer\r\n * @param conversion The conversion mode that should be applied when copying\r\n * @returns\r\n */\r\n public copy(source: InternalTexture | ThinTexture, destination: Nullable<RenderTargetWrapper | IRenderTargetTexture> = null, conversion = ConversionMode.None): boolean {\r\n if (!this.isReady()) {\r\n return false;\r\n }\r\n\r\n this._source = source;\r\n this._conversion = conversion;\r\n\r\n const engineDepthFunc = this._engine.getDepthFunction();\r\n const engineDepthMask = this._engine.getDepthWrite(); // for some reasons, depthWrite is not restored by EffectRenderer.restoreStates\r\n\r\n this._renderer.render(this._effectWrapper, destination);\r\n\r\n this._engine.setDepthWrite(engineDepthMask);\r\n\r\n if (this._isDepthTexture && engineDepthFunc) {\r\n this._engine.setDepthFunction(engineDepthFunc);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Releases all the resources used by the class\r\n */\r\n public dispose(): void {\r\n this._effectWrapper?.dispose();\r\n this._renderer.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -4,6 +4,7 @@ import type { Nullable } from "../types.js";
|
|
|
4
4
|
import type { Camera } from "../Cameras/camera.js";
|
|
5
5
|
import type { AbstractEngine } from "../Engines/abstractEngine.js";
|
|
6
6
|
import type { Scene } from "../scene.js";
|
|
7
|
+
import { ThinConvolutionPostProcess } from "./thinConvolutionPostProcess.js";
|
|
7
8
|
/**
|
|
8
9
|
* The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the
|
|
9
10
|
* input texture to perform effects such as edge detection or sharpening
|
|
@@ -11,12 +12,14 @@ import type { Scene } from "../scene.js";
|
|
|
11
12
|
*/
|
|
12
13
|
export declare class ConvolutionPostProcess extends PostProcess {
|
|
13
14
|
/** Array of 9 values corresponding to the 3x3 kernel to be applied */
|
|
14
|
-
kernel: number[];
|
|
15
|
+
get kernel(): number[];
|
|
16
|
+
set kernel(value: number[]);
|
|
15
17
|
/**
|
|
16
18
|
* Gets a string identifying the name of the class
|
|
17
19
|
* @returns "ConvolutionPostProcess" string
|
|
18
20
|
*/
|
|
19
21
|
getClassName(): string;
|
|
22
|
+
protected _effectWrapper: ThinConvolutionPostProcess;
|
|
20
23
|
/**
|
|
21
24
|
* Creates a new instance ConvolutionPostProcess
|
|
22
25
|
* @param name The name of the effect.
|
|
@@ -29,7 +32,6 @@ export declare class ConvolutionPostProcess extends PostProcess {
|
|
|
29
32
|
* @param textureType Type of textures used when performing the post process. (default: 0)
|
|
30
33
|
*/
|
|
31
34
|
constructor(name: string, kernel: number[], options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number);
|
|
32
|
-
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
33
35
|
/**
|
|
34
36
|
* @internal
|
|
35
37
|
*/
|
|
@@ -4,12 +4,20 @@ import { PostProcess } from "./postProcess.js";
|
|
|
4
4
|
import { RegisterClass } from "../Misc/typeStore.js";
|
|
5
5
|
import { serialize } from "../Misc/decorators.js";
|
|
6
6
|
import { SerializationHelper } from "../Misc/decorators.serialization.js";
|
|
7
|
+
import { ThinConvolutionPostProcess } from "./thinConvolutionPostProcess.js";
|
|
7
8
|
/**
|
|
8
9
|
* The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the
|
|
9
10
|
* input texture to perform effects such as edge detection or sharpening
|
|
10
11
|
* See http://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
11
12
|
*/
|
|
12
13
|
export class ConvolutionPostProcess extends PostProcess {
|
|
14
|
+
/** Array of 9 values corresponding to the 3x3 kernel to be applied */
|
|
15
|
+
get kernel() {
|
|
16
|
+
return this._effectWrapper.kernel;
|
|
17
|
+
}
|
|
18
|
+
set kernel(value) {
|
|
19
|
+
this._effectWrapper.kernel = value;
|
|
20
|
+
}
|
|
13
21
|
/**
|
|
14
22
|
* Gets a string identifying the name of the class
|
|
15
23
|
* @returns "ConvolutionPostProcess" string
|
|
@@ -29,22 +37,24 @@ export class ConvolutionPostProcess extends PostProcess {
|
|
|
29
37
|
* @param textureType Type of textures used when performing the post process. (default: 0)
|
|
30
38
|
*/
|
|
31
39
|
constructor(name, kernel, options, camera, samplingMode, engine, reusable, textureType = 0) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const localOptions = {
|
|
41
|
+
uniforms: ThinConvolutionPostProcess.Uniforms,
|
|
42
|
+
size: typeof options === "number" ? options : undefined,
|
|
43
|
+
camera,
|
|
44
|
+
samplingMode,
|
|
45
|
+
engine,
|
|
46
|
+
reusable,
|
|
47
|
+
textureType,
|
|
48
|
+
...options,
|
|
49
|
+
};
|
|
50
|
+
super(name, ThinConvolutionPostProcess.FragmentUrl, {
|
|
51
|
+
effectWrapper: typeof options === "number" || !options.effectWrapper ? new ThinConvolutionPostProcess(name, engine, kernel, localOptions) : undefined,
|
|
52
|
+
...localOptions,
|
|
53
|
+
});
|
|
54
|
+
this.onApply = (_effect) => {
|
|
55
|
+
this._effectWrapper.textureWidth = this.width;
|
|
56
|
+
this._effectWrapper.textureHeight = this.height;
|
|
37
57
|
};
|
|
38
|
-
}
|
|
39
|
-
_gatherImports(useWebGPU, list) {
|
|
40
|
-
if (useWebGPU) {
|
|
41
|
-
this._webGPUReady = true;
|
|
42
|
-
list.push(Promise.all([import("../ShadersWGSL/convolution.fragment.js")]));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
list.push(Promise.all([import("../Shaders/convolution.fragment.js")]));
|
|
46
|
-
}
|
|
47
|
-
super._gatherImports(useWebGPU, list);
|
|
48
58
|
}
|
|
49
59
|
/**
|
|
50
60
|
* @internal
|
|
@@ -59,29 +69,29 @@ export class ConvolutionPostProcess extends PostProcess {
|
|
|
59
69
|
/**
|
|
60
70
|
* Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
61
71
|
*/
|
|
62
|
-
ConvolutionPostProcess.EdgeDetect0Kernel =
|
|
72
|
+
ConvolutionPostProcess.EdgeDetect0Kernel = ThinConvolutionPostProcess.EdgeDetect0Kernel;
|
|
63
73
|
/**
|
|
64
74
|
* Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
65
75
|
*/
|
|
66
|
-
ConvolutionPostProcess.EdgeDetect1Kernel =
|
|
76
|
+
ConvolutionPostProcess.EdgeDetect1Kernel = ThinConvolutionPostProcess.EdgeDetect1Kernel;
|
|
67
77
|
/**
|
|
68
78
|
* Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
69
79
|
*/
|
|
70
|
-
ConvolutionPostProcess.EdgeDetect2Kernel =
|
|
80
|
+
ConvolutionPostProcess.EdgeDetect2Kernel = ThinConvolutionPostProcess.EdgeDetect2Kernel;
|
|
71
81
|
/**
|
|
72
82
|
* Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
73
83
|
*/
|
|
74
|
-
ConvolutionPostProcess.SharpenKernel =
|
|
84
|
+
ConvolutionPostProcess.SharpenKernel = ThinConvolutionPostProcess.SharpenKernel;
|
|
75
85
|
/**
|
|
76
86
|
* Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
77
87
|
*/
|
|
78
|
-
ConvolutionPostProcess.EmbossKernel =
|
|
88
|
+
ConvolutionPostProcess.EmbossKernel = ThinConvolutionPostProcess.EmbossKernel;
|
|
79
89
|
/**
|
|
80
90
|
* Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
81
91
|
*/
|
|
82
|
-
ConvolutionPostProcess.GaussianKernel =
|
|
92
|
+
ConvolutionPostProcess.GaussianKernel = ThinConvolutionPostProcess.GaussianKernel;
|
|
83
93
|
__decorate([
|
|
84
94
|
serialize()
|
|
85
|
-
], ConvolutionPostProcess.prototype, "kernel",
|
|
95
|
+
], ConvolutionPostProcess.prototype, "kernel", null);
|
|
86
96
|
RegisterClass("BABYLON.ConvolutionPostProcess", ConvolutionPostProcess);
|
|
87
97
|
//# sourceMappingURL=convolutionPostProcess.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convolutionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/convolutionPostProcess.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"convolutionPostProcess.js","sourceRoot":"","sources":["../../../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AC","sourcesContent":["import type { PostProcessOptions } from \"./postProcess\";\r\nimport { PostProcess } from \"./postProcess\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport type { AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { Constants } from \"../Engines/constants\";\r\n\r\nimport { RegisterClass } from \"../Misc/typeStore\";\r\nimport { serialize } from \"../Misc/decorators\";\r\nimport { SerializationHelper } from \"../Misc/decorators.serialization\";\r\n\r\nimport type { Scene } from \"../scene\";\r\nimport { ThinConvolutionPostProcess } from \"./thinConvolutionPostProcess\";\r\n\r\n/**\r\n * The ConvolutionPostProcess applies a 3x3 kernel to every pixel of the\r\n * input texture to perform effects such as edge detection or sharpening\r\n * See http://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\nexport class ConvolutionPostProcess extends PostProcess {\r\n /** Array of 9 values corresponding to the 3x3 kernel to be applied */\r\n @serialize()\r\n public get kernel() {\r\n return this._effectWrapper.kernel;\r\n }\r\n\r\n public set kernel(value: number[]) {\r\n this._effectWrapper.kernel = value;\r\n }\r\n\r\n /**\r\n * Gets a string identifying the name of the class\r\n * @returns \"ConvolutionPostProcess\" string\r\n */\r\n public override getClassName(): string {\r\n return \"ConvolutionPostProcess\";\r\n }\r\n\r\n protected override _effectWrapper: ThinConvolutionPostProcess;\r\n\r\n /**\r\n * Creates a new instance ConvolutionPostProcess\r\n * @param name The name of the effect.\r\n * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied\r\n * @param options The required width/height ratio to downsize to before computing the render pass.\r\n * @param camera The camera to apply the render pass to.\r\n * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)\r\n * @param engine The engine which the post process will be applied. (default: current engine)\r\n * @param reusable If the post process can be reused on the same frame. (default: false)\r\n * @param textureType Type of textures used when performing the post process. (default: 0)\r\n */\r\n constructor(\r\n name: string,\r\n kernel: number[],\r\n options: number | PostProcessOptions,\r\n camera: Nullable<Camera>,\r\n samplingMode?: number,\r\n engine?: AbstractEngine,\r\n reusable?: boolean,\r\n textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE\r\n ) {\r\n const localOptions = {\r\n uniforms: ThinConvolutionPostProcess.Uniforms,\r\n size: typeof options === \"number\" ? options : undefined,\r\n camera,\r\n samplingMode,\r\n engine,\r\n reusable,\r\n textureType,\r\n ...(options as PostProcessOptions),\r\n };\r\n\r\n super(name, ThinConvolutionPostProcess.FragmentUrl, {\r\n effectWrapper: typeof options === \"number\" || !options.effectWrapper ? new ThinConvolutionPostProcess(name, engine, kernel, localOptions) : undefined,\r\n ...localOptions,\r\n });\r\n\r\n this.onApply = (_effect: Effect) => {\r\n this._effectWrapper.textureWidth = this.width;\r\n this._effectWrapper.textureHeight = this.height;\r\n };\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static override _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<ConvolutionPostProcess> {\r\n return SerializationHelper.Parse(\r\n () => {\r\n return new ConvolutionPostProcess(\r\n parsedPostProcess.name,\r\n parsedPostProcess.kernel,\r\n parsedPostProcess.options,\r\n targetCamera,\r\n parsedPostProcess.renderTargetSamplingMode,\r\n scene.getEngine(),\r\n parsedPostProcess.reusable,\r\n parsedPostProcess.textureType\r\n );\r\n },\r\n parsedPostProcess,\r\n scene,\r\n rootUrl\r\n );\r\n }\r\n\r\n // Statics\r\n /**\r\n * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect0Kernel = ThinConvolutionPostProcess.EdgeDetect0Kernel;\r\n /**\r\n * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect1Kernel = ThinConvolutionPostProcess.EdgeDetect1Kernel;\r\n /**\r\n * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect2Kernel = ThinConvolutionPostProcess.EdgeDetect2Kernel;\r\n /**\r\n * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static SharpenKernel = ThinConvolutionPostProcess.SharpenKernel;\r\n /**\r\n * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EmbossKernel = ThinConvolutionPostProcess.EmbossKernel;\r\n /**\r\n * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static GaussianKernel = ThinConvolutionPostProcess.GaussianKernel;\r\n}\r\n\r\nRegisterClass(\"BABYLON.ConvolutionPostProcess\", ConvolutionPostProcess);\r\n"]}
|
package/PostProcesses/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from "./thinBloomEffect.js";
|
|
|
37
37
|
export * from "./thinBlurPostProcess.js";
|
|
38
38
|
export * from "./thinChromaticAberrationPostProcess.js";
|
|
39
39
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
40
|
+
export * from "./thinConvolutionPostProcess.js";
|
|
40
41
|
export * from "./thinDepthOfFieldEffect.js";
|
|
41
42
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
42
43
|
export * from "./thinFXAAPostProcess.js";
|
package/PostProcesses/index.js
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./thinBloomEffect.js";
|
|
|
38
38
|
export * from "./thinBlurPostProcess.js";
|
|
39
39
|
export * from "./thinChromaticAberrationPostProcess.js";
|
|
40
40
|
export * from "./thinCircleOfConfusionPostProcess.js";
|
|
41
|
+
export * from "./thinConvolutionPostProcess.js";
|
|
41
42
|
export * from "./thinDepthOfFieldEffect.js";
|
|
42
43
|
export * from "./thinExtractHighlightsPostProcess.js";
|
|
43
44
|
export * from "./thinFXAAPostProcess.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,uB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BAAmB;AACnB,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AAExD,cAAc;AACd,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,SAAS;AACT,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,aAAa;AACb,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,UAAU;AACV,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,UAAU;AACV,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./anaglyphPostProcess\";\r\nexport * from \"./blackAndWhitePostProcess\";\r\nexport * from \"./bloomEffect\";\r\nexport * from \"./bloomMergePostProcess\";\r\nexport * from \"./blurPostProcess\";\r\nexport * from \"./chromaticAberrationPostProcess\";\r\nexport * from \"./circleOfConfusionPostProcess\";\r\nexport * from \"./colorCorrectionPostProcess\";\r\nexport * from \"./convolutionPostProcess\";\r\nexport * from \"./depthOfFieldBlurPostProcess\";\r\nexport * from \"./depthOfFieldEffect\";\r\nexport * from \"./depthOfFieldMergePostProcess\";\r\nexport * from \"./displayPassPostProcess\";\r\nexport * from \"./extractHighlightsPostProcess\";\r\nexport * from \"./filterPostProcess\";\r\nexport * from \"./fxaaPostProcess\";\r\nexport * from \"./grainPostProcess\";\r\nexport * from \"./highlightsPostProcess\";\r\nexport * from \"./imageProcessingPostProcess\";\r\nexport * from \"./motionBlurPostProcess\";\r\nexport * from \"./passPostProcess\";\r\nexport * from \"./postProcess\";\r\nexport * from \"./postProcessManager\";\r\nexport * from \"./refractionPostProcess\";\r\nexport * from \"./RenderPipeline/index\";\r\nexport * from \"./sharpenPostProcess\";\r\nexport * from \"./stereoscopicInterlacePostProcess\";\r\nexport * from \"./tonemapPostProcess\";\r\nexport * from \"./volumetricLightScatteringPostProcess\";\r\nexport * from \"./vrDistortionCorrectionPostProcess\";\r\nexport * from \"./vrMultiviewToSingleviewPostProcess\";\r\nexport * from \"./screenSpaceReflectionPostProcess\";\r\nexport * from \"./screenSpaceCurvaturePostProcess\";\r\n\r\nexport * from \"./thinAnaglyphPostProcess\";\r\nexport * from \"./thinBlackAndWhitePostProcess\";\r\nexport * from \"./thinBloomEffect\";\r\nexport * from \"./thinBlurPostProcess\";\r\nexport * from \"./thinChromaticAberrationPostProcess\";\r\nexport * from \"./thinCircleOfConfusionPostProcess\";\r\nexport * from \"./thinDepthOfFieldEffect\";\r\nexport * from \"./thinExtractHighlightsPostProcess\";\r\nexport * from \"./thinFXAAPostProcess\";\r\nexport * from \"./thinGrainPostProcess\";\r\nexport * from \"./thinImageProcessingPostProcess\";\r\nexport * from \"./thinMotionBlurPostProcess\";\r\nexport * from \"./thinPassPostProcess\";\r\n\r\n// Postprocess\r\nexport * from \"../Shaders/postprocess.vertex\";\r\nexport * from \"../ShadersWGSL/postprocess.vertex\";\r\n\r\n// Blur postprocess\r\nexport * from \"../Shaders/kernelBlur.fragment\";\r\nexport * from \"../Shaders/kernelBlur.vertex\";\r\nexport * from \"../ShadersWGSL/kernelBlur.fragment\";\r\nexport * from \"../ShadersWGSL/kernelBlur.vertex\";\r\n\r\n// Pass postprocess\r\nexport * from \"../Shaders/pass.fragment\";\r\nexport * from \"../Shaders/passCube.fragment\";\r\nexport * from \"../ShadersWGSL/pass.fragment\";\r\nexport * from \"../ShadersWGSL/passCube.fragment\";\r\n\r\n// vrDFistortionCorrection postprocess\r\nexport * from \"../Shaders/vrDistortionCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/vrDistortionCorrection.fragment\";\r\n\r\n// Image processing postprocess\r\nexport * from \"../ShadersWGSL/imageProcessing.fragment\";\r\nexport * from \"../Shaders/imageProcessing.fragment\";\r\n\r\n// Sharpen\r\nexport * from \"../Shaders/sharpen.fragment\";\r\nexport * from \"../ShadersWGSL/sharpen.fragment\";\r\n\r\n// Grain\r\nexport * from \"../Shaders/grain.fragment\";\r\nexport * from \"../ShadersWGSL/grain.fragment\";\r\n\r\n// Chromatic Aberration\r\nexport * from \"../Shaders/chromaticAberration.fragment\";\r\nexport * from \"../ShadersWGSL/chromaticAberration.fragment\";\r\n\r\n// Depth of field merge\r\nexport * from \"../Shaders/depthOfFieldMerge.fragment\";\r\nexport * from \"../ShadersWGSL/depthOfFieldMerge.fragment\";\r\n\r\n// Circle of confusion\r\nexport * from \"../Shaders/circleOfConfusion.fragment\";\r\nexport * from \"../ShadersWGSL/circleOfConfusion.fragment\";\r\n\r\n// Bloom\r\nexport * from \"../Shaders/bloomMerge.fragment\";\r\nexport * from \"../ShadersWGSL/bloomMerge.fragment\";\r\n\r\n// Extract highlights\r\nexport * from \"../Shaders/extractHighlights.fragment\";\r\nexport * from \"../ShadersWGSL/extractHighlights.fragment\";\r\n\r\n// FXAA\r\nexport * from \"../Shaders/fxaa.fragment\";\r\nexport * from \"../Shaders/fxaa.vertex\";\r\nexport * from \"../ShadersWGSL/fxaa.fragment\";\r\nexport * from \"../ShadersWGSL/fxaa.vertex\";\r\n\r\n// B&W\r\nexport * from \"../Shaders/blackAndWhite.fragment\";\r\nexport * from \"../ShadersWGSL/blackAndWhite.fragment\";\r\n\r\n// Anaglyph\r\nexport * from \"../Shaders/anaglyph.fragment\";\r\nexport * from \"../ShadersWGSL/anaglyph.fragment\";\r\n\r\n// Convolution\r\nexport * from \"../Shaders/convolution.fragment\";\r\nexport * from \"../ShadersWGSL/convolution.fragment\";\r\n\r\n// Color correction\r\nexport * from \"../Shaders/colorCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/colorCorrection.fragment\";\r\n\r\n// Motion blur\r\nexport * from \"../Shaders/motionBlur.fragment\";\r\nexport * from \"../ShadersWGSL/motionBlur.fragment\";\r\n\r\n// Filter\r\nexport * from \"../Shaders/filter.fragment\";\r\nexport * from \"../ShadersWGSL/filter.fragment\";\r\n\r\n// Highlights\r\nexport * from \"../Shaders/highlights.fragment\";\r\nexport * from \"../ShadersWGSL/highlights.fragment\";\r\n\r\n// Display\r\nexport * from \"../Shaders/displayPass.fragment\";\r\nexport * from \"../ShadersWGSL/displayPass.fragment\";\r\n\r\n// Tonemap\r\nexport * from \"../Shaders/tonemap.fragment\";\r\nexport * from \"../ShadersWGSL/tonemap.fragment\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAElD,cAAc,2BAA2B,CAAC;AAC1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CAAuC,CAAC;AACtD,cAAc,2CAA2C,CAAC;AAE1D,OAAO;AACP,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAE3C,MAAM;AACN,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AAEtD,WAAW;AACX,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,mBAAmB;AACnB,cAAc,qCAAqC,CAAC;AACpD,cAAc,yCAAyC,CAAC;AAExD,cAAc;AACd,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,SAAS;AACT,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAE/C,aAAa;AACb,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AAEnD,UAAU;AACV,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AAEpD,UAAU;AACV,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./anaglyphPostProcess\";\r\nexport * from \"./blackAndWhitePostProcess\";\r\nexport * from \"./bloomEffect\";\r\nexport * from \"./bloomMergePostProcess\";\r\nexport * from \"./blurPostProcess\";\r\nexport * from \"./chromaticAberrationPostProcess\";\r\nexport * from \"./circleOfConfusionPostProcess\";\r\nexport * from \"./colorCorrectionPostProcess\";\r\nexport * from \"./convolutionPostProcess\";\r\nexport * from \"./depthOfFieldBlurPostProcess\";\r\nexport * from \"./depthOfFieldEffect\";\r\nexport * from \"./depthOfFieldMergePostProcess\";\r\nexport * from \"./displayPassPostProcess\";\r\nexport * from \"./extractHighlightsPostProcess\";\r\nexport * from \"./filterPostProcess\";\r\nexport * from \"./fxaaPostProcess\";\r\nexport * from \"./grainPostProcess\";\r\nexport * from \"./highlightsPostProcess\";\r\nexport * from \"./imageProcessingPostProcess\";\r\nexport * from \"./motionBlurPostProcess\";\r\nexport * from \"./passPostProcess\";\r\nexport * from \"./postProcess\";\r\nexport * from \"./postProcessManager\";\r\nexport * from \"./refractionPostProcess\";\r\nexport * from \"./RenderPipeline/index\";\r\nexport * from \"./sharpenPostProcess\";\r\nexport * from \"./stereoscopicInterlacePostProcess\";\r\nexport * from \"./tonemapPostProcess\";\r\nexport * from \"./volumetricLightScatteringPostProcess\";\r\nexport * from \"./vrDistortionCorrectionPostProcess\";\r\nexport * from \"./vrMultiviewToSingleviewPostProcess\";\r\nexport * from \"./screenSpaceReflectionPostProcess\";\r\nexport * from \"./screenSpaceCurvaturePostProcess\";\r\n\r\nexport * from \"./thinAnaglyphPostProcess\";\r\nexport * from \"./thinBlackAndWhitePostProcess\";\r\nexport * from \"./thinBloomEffect\";\r\nexport * from \"./thinBlurPostProcess\";\r\nexport * from \"./thinChromaticAberrationPostProcess\";\r\nexport * from \"./thinCircleOfConfusionPostProcess\";\r\nexport * from \"./thinConvolutionPostProcess\";\r\nexport * from \"./thinDepthOfFieldEffect\";\r\nexport * from \"./thinExtractHighlightsPostProcess\";\r\nexport * from \"./thinFXAAPostProcess\";\r\nexport * from \"./thinGrainPostProcess\";\r\nexport * from \"./thinImageProcessingPostProcess\";\r\nexport * from \"./thinMotionBlurPostProcess\";\r\nexport * from \"./thinPassPostProcess\";\r\n\r\n// Postprocess\r\nexport * from \"../Shaders/postprocess.vertex\";\r\nexport * from \"../ShadersWGSL/postprocess.vertex\";\r\n\r\n// Blur postprocess\r\nexport * from \"../Shaders/kernelBlur.fragment\";\r\nexport * from \"../Shaders/kernelBlur.vertex\";\r\nexport * from \"../ShadersWGSL/kernelBlur.fragment\";\r\nexport * from \"../ShadersWGSL/kernelBlur.vertex\";\r\n\r\n// Pass postprocess\r\nexport * from \"../Shaders/pass.fragment\";\r\nexport * from \"../Shaders/passCube.fragment\";\r\nexport * from \"../ShadersWGSL/pass.fragment\";\r\nexport * from \"../ShadersWGSL/passCube.fragment\";\r\n\r\n// vrDFistortionCorrection postprocess\r\nexport * from \"../Shaders/vrDistortionCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/vrDistortionCorrection.fragment\";\r\n\r\n// Image processing postprocess\r\nexport * from \"../ShadersWGSL/imageProcessing.fragment\";\r\nexport * from \"../Shaders/imageProcessing.fragment\";\r\n\r\n// Sharpen\r\nexport * from \"../Shaders/sharpen.fragment\";\r\nexport * from \"../ShadersWGSL/sharpen.fragment\";\r\n\r\n// Grain\r\nexport * from \"../Shaders/grain.fragment\";\r\nexport * from \"../ShadersWGSL/grain.fragment\";\r\n\r\n// Chromatic Aberration\r\nexport * from \"../Shaders/chromaticAberration.fragment\";\r\nexport * from \"../ShadersWGSL/chromaticAberration.fragment\";\r\n\r\n// Depth of field merge\r\nexport * from \"../Shaders/depthOfFieldMerge.fragment\";\r\nexport * from \"../ShadersWGSL/depthOfFieldMerge.fragment\";\r\n\r\n// Circle of confusion\r\nexport * from \"../Shaders/circleOfConfusion.fragment\";\r\nexport * from \"../ShadersWGSL/circleOfConfusion.fragment\";\r\n\r\n// Bloom\r\nexport * from \"../Shaders/bloomMerge.fragment\";\r\nexport * from \"../ShadersWGSL/bloomMerge.fragment\";\r\n\r\n// Extract highlights\r\nexport * from \"../Shaders/extractHighlights.fragment\";\r\nexport * from \"../ShadersWGSL/extractHighlights.fragment\";\r\n\r\n// FXAA\r\nexport * from \"../Shaders/fxaa.fragment\";\r\nexport * from \"../Shaders/fxaa.vertex\";\r\nexport * from \"../ShadersWGSL/fxaa.fragment\";\r\nexport * from \"../ShadersWGSL/fxaa.vertex\";\r\n\r\n// B&W\r\nexport * from \"../Shaders/blackAndWhite.fragment\";\r\nexport * from \"../ShadersWGSL/blackAndWhite.fragment\";\r\n\r\n// Anaglyph\r\nexport * from \"../Shaders/anaglyph.fragment\";\r\nexport * from \"../ShadersWGSL/anaglyph.fragment\";\r\n\r\n// Convolution\r\nexport * from \"../Shaders/convolution.fragment\";\r\nexport * from \"../ShadersWGSL/convolution.fragment\";\r\n\r\n// Color correction\r\nexport * from \"../Shaders/colorCorrection.fragment\";\r\nexport * from \"../ShadersWGSL/colorCorrection.fragment\";\r\n\r\n// Motion blur\r\nexport * from \"../Shaders/motionBlur.fragment\";\r\nexport * from \"../ShadersWGSL/motionBlur.fragment\";\r\n\r\n// Filter\r\nexport * from \"../Shaders/filter.fragment\";\r\nexport * from \"../ShadersWGSL/filter.fragment\";\r\n\r\n// Highlights\r\nexport * from \"../Shaders/highlights.fragment\";\r\nexport * from \"../ShadersWGSL/highlights.fragment\";\r\n\r\n// Display\r\nexport * from \"../Shaders/displayPass.fragment\";\r\nexport * from \"../ShadersWGSL/displayPass.fragment\";\r\n\r\n// Tonemap\r\nexport * from \"../Shaders/tonemap.fragment\";\r\nexport * from \"../ShadersWGSL/tonemap.fragment\";\r\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
|
|
2
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
3
|
+
/**
|
|
4
|
+
* Post process used to apply a convolution effect
|
|
5
|
+
*/
|
|
6
|
+
export declare class ThinConvolutionPostProcess extends EffectWrapper {
|
|
7
|
+
/**
|
|
8
|
+
* Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
9
|
+
*/
|
|
10
|
+
static EdgeDetect0Kernel: number[];
|
|
11
|
+
/**
|
|
12
|
+
* Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
13
|
+
*/
|
|
14
|
+
static EdgeDetect1Kernel: number[];
|
|
15
|
+
/**
|
|
16
|
+
* Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
17
|
+
*/
|
|
18
|
+
static EdgeDetect2Kernel: number[];
|
|
19
|
+
/**
|
|
20
|
+
* Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
21
|
+
*/
|
|
22
|
+
static SharpenKernel: number[];
|
|
23
|
+
/**
|
|
24
|
+
* Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
25
|
+
*/
|
|
26
|
+
static EmbossKernel: number[];
|
|
27
|
+
/**
|
|
28
|
+
* Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
29
|
+
*/
|
|
30
|
+
static GaussianKernel: number[];
|
|
31
|
+
/**
|
|
32
|
+
* The fragment shader url
|
|
33
|
+
*/
|
|
34
|
+
static readonly FragmentUrl = "convolution";
|
|
35
|
+
/**
|
|
36
|
+
* The list of uniforms used by the effect
|
|
37
|
+
*/
|
|
38
|
+
static readonly Uniforms: string[];
|
|
39
|
+
protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new convolution post process
|
|
42
|
+
* @param name Name of the effect
|
|
43
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
44
|
+
* @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied
|
|
45
|
+
* @param options Options to configure the effect
|
|
46
|
+
*/
|
|
47
|
+
constructor(name: string, engine: Nullable<AbstractEngine> | undefined, kernel: number[], options?: EffectWrapperCreationOptions);
|
|
48
|
+
/** Array of 9 values corresponding to the 3x3 kernel to be applied */
|
|
49
|
+
kernel: number[];
|
|
50
|
+
/**
|
|
51
|
+
* The width of the source texture
|
|
52
|
+
*/
|
|
53
|
+
textureWidth: number;
|
|
54
|
+
/**
|
|
55
|
+
* The height of the source texture
|
|
56
|
+
*/
|
|
57
|
+
textureHeight: number;
|
|
58
|
+
bind(noDefaultBindings?: boolean): void;
|
|
59
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EffectWrapper } from "../Materials/effectRenderer.js";
|
|
2
|
+
import { Engine } from "../Engines/engine.js";
|
|
3
|
+
/**
|
|
4
|
+
* Post process used to apply a convolution effect
|
|
5
|
+
*/
|
|
6
|
+
export class ThinConvolutionPostProcess extends EffectWrapper {
|
|
7
|
+
_gatherImports(useWebGPU, list) {
|
|
8
|
+
if (useWebGPU) {
|
|
9
|
+
this._webGPUReady = true;
|
|
10
|
+
list.push(import("../ShadersWGSL/convolution.fragment.js"));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
list.push(import("../Shaders/convolution.fragment.js"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new convolution post process
|
|
18
|
+
* @param name Name of the effect
|
|
19
|
+
* @param engine Engine to use to render the effect. If not provided, the last created engine will be used
|
|
20
|
+
* @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied
|
|
21
|
+
* @param options Options to configure the effect
|
|
22
|
+
*/
|
|
23
|
+
constructor(name, engine = null, kernel, options) {
|
|
24
|
+
super({
|
|
25
|
+
...options,
|
|
26
|
+
name,
|
|
27
|
+
engine: engine || Engine.LastCreatedEngine,
|
|
28
|
+
useShaderStore: true,
|
|
29
|
+
useAsPostProcess: true,
|
|
30
|
+
fragmentShader: ThinConvolutionPostProcess.FragmentUrl,
|
|
31
|
+
uniforms: ThinConvolutionPostProcess.Uniforms,
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The width of the source texture
|
|
35
|
+
*/
|
|
36
|
+
this.textureWidth = 0;
|
|
37
|
+
/**
|
|
38
|
+
* The height of the source texture
|
|
39
|
+
*/
|
|
40
|
+
this.textureHeight = 0;
|
|
41
|
+
this.kernel = kernel;
|
|
42
|
+
}
|
|
43
|
+
bind(noDefaultBindings = false) {
|
|
44
|
+
super.bind(noDefaultBindings);
|
|
45
|
+
const effect = this._drawWrapper.effect;
|
|
46
|
+
effect.setFloat2("screenSize", this.textureWidth, this.textureHeight);
|
|
47
|
+
effect.setArray("kernel", this.kernel);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Statics
|
|
51
|
+
/**
|
|
52
|
+
* Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
53
|
+
*/
|
|
54
|
+
ThinConvolutionPostProcess.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];
|
|
55
|
+
/**
|
|
56
|
+
* Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
57
|
+
*/
|
|
58
|
+
ThinConvolutionPostProcess.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];
|
|
59
|
+
/**
|
|
60
|
+
* Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
61
|
+
*/
|
|
62
|
+
ThinConvolutionPostProcess.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];
|
|
63
|
+
/**
|
|
64
|
+
* Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
65
|
+
*/
|
|
66
|
+
ThinConvolutionPostProcess.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];
|
|
67
|
+
/**
|
|
68
|
+
* Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
69
|
+
*/
|
|
70
|
+
ThinConvolutionPostProcess.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];
|
|
71
|
+
/**
|
|
72
|
+
* Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
|
|
73
|
+
*/
|
|
74
|
+
ThinConvolutionPostProcess.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];
|
|
75
|
+
/**
|
|
76
|
+
* The fragment shader url
|
|
77
|
+
*/
|
|
78
|
+
ThinConvolutionPostProcess.FragmentUrl = "convolution";
|
|
79
|
+
/**
|
|
80
|
+
* The list of uniforms used by the effect
|
|
81
|
+
*/
|
|
82
|
+
ThinConvolutionPostProcess.Uniforms = ["kernel", "screenSize"];
|
|
83
|
+
//# sourceMappingURL=thinConvolutionPostProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinConvolutionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinConvolutionPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,aAAa;IAqCtC,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,MAAgB,EAAE,OAAsC;QACvH,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,iBAAkB;YAC3C,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,0BAA0B,CAAC,WAAW;YACtD,QAAQ,EAAE,0BAA0B,CAAC,QAAQ;SAChD,CAAC,CAAC;QAQP;;WAEG;QACI,iBAAY,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;QAd7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAee,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY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AAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,AAA9B,CAA+B;AAE3D;;GAEG;AACoB,sCAAW,GAAG,aAAa,AAAhB,CAAiB;AAEnD;;GAEG;AACoB,mCAAQ,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,AAA3B,CAA4B","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\n\r\n/**\r\n * Post process used to apply a convolution effect\r\n */\r\nexport class ThinConvolutionPostProcess extends EffectWrapper {\r\n // Statics\r\n /**\r\n * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];\r\n /**\r\n * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];\r\n /**\r\n * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];\r\n /**\r\n * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];\r\n /**\r\n * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];\r\n /**\r\n * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];\r\n\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"convolution\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"kernel\", \"screenSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/convolution.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/convolution.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new convolution post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, kernel: number[], options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinConvolutionPostProcess.FragmentUrl,\r\n uniforms: ThinConvolutionPostProcess.Uniforms,\r\n });\r\n\r\n this.kernel = kernel;\r\n }\r\n\r\n /** Array of 9 values corresponding to the 3x3 kernel to be applied */\r\n public kernel: number[];\r\n\r\n /**\r\n * The width of the source texture\r\n */\r\n public textureWidth: number = 0;\r\n\r\n /**\r\n * The height of the source texture\r\n */\r\n public textureHeight: number = 0;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\r\n effect.setArray(\"kernel\", this.kernel);\r\n }\r\n}\r\n"]}
|
|
@@ -5,7 +5,12 @@ const name = "copyTextureToTexturePixelShader";
|
|
|
5
5
|
const shader = `uniform float conversion;uniform sampler2D textureSampler;varying vec2 vUV;
|
|
6
6
|
#include<helperFunctions>
|
|
7
7
|
void main(void)
|
|
8
|
-
{
|
|
8
|
+
{
|
|
9
|
+
#ifdef NO_SAMPLER
|
|
10
|
+
vec4 color=texelFetch(textureSampler,ivec2(gl_FragCoord.xy),0);
|
|
11
|
+
#else
|
|
12
|
+
vec4 color=texture2D(textureSampler,vUV);
|
|
13
|
+
#endif
|
|
9
14
|
#ifdef DEPTH_TEXTURE
|
|
10
15
|
gl_FragDepth=color.r;
|
|
11
16
|
#else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyTextureToTexture.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/copyTextureToTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"copyTextureToTexture.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/Shaders/copyTextureToTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;CAgBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC5C,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/helperFunctions\";\n\nconst name = \"copyTextureToTexturePixelShader\";\nconst shader = `uniform float conversion;uniform sampler2D textureSampler;varying vec2 vUV;\n#include<helperFunctions>\nvoid main(void) \n{\n#ifdef NO_SAMPLER\nvec4 color=texelFetch(textureSampler,ivec2(gl_FragCoord.xy),0);\n#else\nvec4 color=texture2D(textureSampler,vUV);\n#endif\n#ifdef DEPTH_TEXTURE\ngl_FragDepth=color.r;\n#else\nif (conversion==1.) {color=toLinearSpace(color);} else if (conversion==2.) {color=toGammaSpace(color);}\ngl_FragColor=color;\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const copyTextureToTexturePixelShader = { name, shader };\n"]}
|
|
@@ -2,10 +2,19 @@
|
|
|
2
2
|
import { ShaderStore } from "../Engines/shaderStore.js";
|
|
3
3
|
import "./ShadersInclude/helperFunctions.js";
|
|
4
4
|
const name = "copyTextureToTexturePixelShader";
|
|
5
|
-
const shader = `uniform conversion: f32;
|
|
5
|
+
const shader = `uniform conversion: f32;
|
|
6
|
+
#ifndef NO_SAMPLER
|
|
7
|
+
var textureSamplerSampler: sampler;
|
|
8
|
+
#endif
|
|
9
|
+
var textureSampler: texture_2d<f32>;varying vUV: vec2f;
|
|
6
10
|
#include<helperFunctions>
|
|
7
11
|
@fragment
|
|
8
|
-
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
12
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
13
|
+
#ifdef NO_SAMPLER
|
|
14
|
+
var color: vec4f=textureLoad(textureSampler,vec2u(fragmentInputs.position.xy),0);
|
|
15
|
+
#else
|
|
16
|
+
var color: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);
|
|
17
|
+
#endif
|
|
9
18
|
#ifdef DEPTH_TEXTURE
|
|
10
19
|
fragmentOutputs.fragDepth=color.r;
|
|
11
20
|
#else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyTextureToTexture.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/copyTextureToTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG
|
|
1
|
+
{"version":3,"file":"copyTextureToTexture.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/copyTextureToTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAG,iCAAiC,CAAC;AAC/C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;CAoBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mCAAmC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/helperFunctions\";\n\nconst name = \"copyTextureToTexturePixelShader\";\nconst shader = `uniform conversion: f32;\n#ifndef NO_SAMPLER\nvar textureSamplerSampler: sampler;\n#endif\nvar textureSampler: texture_2d<f32>;varying vUV: vec2f;\n#include<helperFunctions>\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#ifdef NO_SAMPLER\nvar color: vec4f=textureLoad(textureSampler,vec2u(fragmentInputs.position.xy),0);\n#else\nvar color: vec4f=textureSample(textureSampler,textureSamplerSampler,input.vUV);\n#endif\n#ifdef DEPTH_TEXTURE\nfragmentOutputs.fragDepth=color.r;\n#else\nif (uniforms.conversion==1.) {color=toLinearSpaceVec4(color);} else if (uniforms.conversion==2.) {color=toGammaSpace(color);}\nfragmentOutputs.color=color;\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const copyTextureToTexturePixelShaderWGSL = { name, shader };\n"]}
|