@babylonjs/smart-filters 0.3.9-alpha → 0.3.10-alpha
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/blocks/outputBlock.d.ts +3 -3
- package/dist/blocks/outputBlock.d.ts.map +1 -1
- package/dist/blocks/outputBlock.js +3 -3
- package/dist/blocks/outputBlock.js.map +1 -1
- package/dist/blocks/shaderBlock.js +3 -3
- package/dist/blocks/shaderBlock.js.map +1 -1
- package/dist/runtime/renderTargetGenerator.d.ts.map +1 -1
- package/dist/runtime/renderTargetGenerator.js +3 -5
- package/dist/runtime/renderTargetGenerator.js.map +1 -1
- package/dist/utils/renderTargetUtils.d.ts +7 -7
- package/dist/utils/renderTargetUtils.d.ts.map +1 -1
- package/dist/utils/renderTargetUtils.js +8 -9
- package/dist/utils/renderTargetUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/blocks/outputBlock.ts +4 -4
- package/src/blocks/shaderBlock.ts +3 -3
- package/src/runtime/renderTargetGenerator.ts +3 -4
- package/src/utils/renderTargetUtils.ts +9 -10
|
@@ -2,7 +2,7 @@ import type { InitializationData, SmartFilter } from "../smartFilter";
|
|
|
2
2
|
import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
3
3
|
import { BaseBlock } from "./baseBlock.js";
|
|
4
4
|
import type { Nullable } from "@babylonjs/core/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { RenderTargetWrapper } from "@babylonjs/core/Engines/renderTargetWrapper";
|
|
6
6
|
/**
|
|
7
7
|
* The output block of a smart filter.
|
|
8
8
|
*
|
|
@@ -20,10 +20,10 @@ export declare class OutputBlock extends BaseBlock {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly input: import("../connection/connectionPoint").ConnectionPoint<ConnectionPointType.Texture>;
|
|
22
22
|
/**
|
|
23
|
-
* If supplied, the Smart Filter will render into this
|
|
23
|
+
* If supplied, the Smart Filter will render into this RenderTargetWrapper. Otherwise, it renders
|
|
24
24
|
* into the the canvas or WebGL context the ThinEngine is using for rendering.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
renderTargetWrapper: Nullable<RenderTargetWrapper>;
|
|
27
27
|
/**
|
|
28
28
|
* Create a new output block.
|
|
29
29
|
* @param smartFilter - The smart filter this block belongs to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/outputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"outputBlock.d.ts","sourceRoot":"","sources":["../../src/blocks/outputBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAMvF;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACtC;;OAEG;IACH,OAAuB,SAAS,SAAiB;IAEjD;;;OAGG;IACH,SAAgB,KAAK,uFAA6D;IAElF;;;OAGG;IACI,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAQ;IAEjE;;;OAGG;gBACS,WAAW,EAAE,WAAW;IAIpC;;OAEG;IACa,iBAAiB,IAAI,IAAI;IAQzC;;OAEG;IACa,oBAAoB,IAAI,IAAI;IAQ5C;;;;OAIG;IACa,qCAAqC,CACjD,kBAAkB,EAAE,kBAAkB,EACtC,WAAW,EAAE,OAAO,GACrB,IAAI;CAmBV"}
|
|
@@ -22,10 +22,10 @@ export class OutputBlock extends BaseBlock {
|
|
|
22
22
|
*/
|
|
23
23
|
this.input = this._registerInput("input", ConnectionPointType.Texture);
|
|
24
24
|
/**
|
|
25
|
-
* If supplied, the Smart Filter will render into this
|
|
25
|
+
* If supplied, the Smart Filter will render into this RenderTargetWrapper. Otherwise, it renders
|
|
26
26
|
* into the the canvas or WebGL context the ThinEngine is using for rendering.
|
|
27
27
|
*/
|
|
28
|
-
this.
|
|
28
|
+
this.renderTargetWrapper = null;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Prepares all blocks for runtime by traversing the graph.
|
|
@@ -61,7 +61,7 @@ export class OutputBlock extends BaseBlock {
|
|
|
61
61
|
const shaderBlockRuntime = new ShaderRuntime(runtime.effectRenderer, shaderProgram, new OutputShaderBinding(this.input.runtimeData));
|
|
62
62
|
initializationData.initializationPromises.push(shaderBlockRuntime.onReadyAsync);
|
|
63
63
|
runtime.registerResource(shaderBlockRuntime);
|
|
64
|
-
registerFinalRenderCommand(this.
|
|
64
|
+
registerFinalRenderCommand(this.renderTargetWrapper, runtime, this, shaderBlockRuntime);
|
|
65
65
|
super.generateCommandsAndGatherInitPromises(initializationData, finalOutput);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputBlock.js","sourceRoot":"","sources":["../../src/blocks/outputBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BA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/B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACtF,CAAC;CACJ"}
|
|
@@ -4,7 +4,7 @@ import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
|
4
4
|
import { createCommand } from "../command/command.js";
|
|
5
5
|
import { DisableableBlock } from "./disableableBlock.js";
|
|
6
6
|
import { undecorateSymbol } from "../utils/shaderCodeUtils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { getRenderTargetWrapper, registerFinalRenderCommand } from "../utils/renderTargetUtils.js";
|
|
8
8
|
/**
|
|
9
9
|
* This is the base class for all shader blocks.
|
|
10
10
|
*
|
|
@@ -80,10 +80,10 @@ export class ShaderBlock extends DisableableBlock {
|
|
|
80
80
|
initializationData.initializationPromises.push(shaderBlockRuntime.onReadyAsync);
|
|
81
81
|
runtime.registerResource(shaderBlockRuntime);
|
|
82
82
|
if (finalOutput) {
|
|
83
|
-
registerFinalRenderCommand(initializationData.outputBlock.
|
|
83
|
+
registerFinalRenderCommand(initializationData.outputBlock.renderTargetWrapper, runtime, this, shaderBlockRuntime);
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
const renderTarget =
|
|
86
|
+
const renderTarget = getRenderTargetWrapper((_a = this.output.runtimeData) === null || _a === void 0 ? void 0 : _a.value, this.getClassName());
|
|
87
87
|
runtime.registerCommand(createCommand(`${this.getClassName()}.render`, this, () => {
|
|
88
88
|
shaderBlockRuntime.renderToTexture(renderTarget);
|
|
89
89
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaderBlock.js","sourceRoot":"","sources":["../../src/blocks/shaderBlock.ts"],"names":[],"mappings":"AACA,OAAO,2DAA2D,CAAC;AAMnE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAA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AAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"renderTargetGenerator.d.ts","sourceRoot":"","sources":["../../src/runtime/renderTargetGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAqBtE;;GAEG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,iBAAiB,CAAsC;IAC/D,OAAO,CAAC,kBAAkB,CAAC;IAE3B;;;OAGG;gBACS,QAAQ,UAAO;IAM3B;;OAEG;IACH,IAAW,iBAAiB,WAE3B;IAED;;;;OAIG;IACI,iBAAiB,CAAC,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB;IAqDzF,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,WAAW;IAgCnB,OAAO,CAAC,eAAe;IAoBvB;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CAwCzB"}
|
|
@@ -129,7 +129,6 @@ export class RenderTargetGenerator {
|
|
|
129
129
|
* @returns The render target texture
|
|
130
130
|
*/
|
|
131
131
|
_createTexture(runtime, smartFilter, ratio) {
|
|
132
|
-
var _a;
|
|
133
132
|
const engine = runtime.engine;
|
|
134
133
|
// We are only rendering full screen post process without depth or stencil information
|
|
135
134
|
const setup = {
|
|
@@ -141,10 +140,9 @@ export class RenderTargetGenerator {
|
|
|
141
140
|
// Get the smartFilter output size - either from the output block's renderTargetTexture or the engine's render size
|
|
142
141
|
let outputWidth;
|
|
143
142
|
let outputHeight;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
outputHeight = renderTargetTextureSize.height;
|
|
143
|
+
if (smartFilter.outputBlock.renderTargetWrapper) {
|
|
144
|
+
outputWidth = smartFilter.outputBlock.renderTargetWrapper.width;
|
|
145
|
+
outputHeight = smartFilter.outputBlock.renderTargetWrapper.height;
|
|
148
146
|
}
|
|
149
147
|
else {
|
|
150
148
|
outputWidth = engine.getRenderWidth(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTargetGenerator.js","sourceRoot":"","sources":["../../src/runtime/renderTargetGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAC;AAKxG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAiB3E;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAK9B;;;OAGG;IACH,YAAY,QAAQ,GAAG,IAAI;QACvB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;QACnC,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,IAAW,iBAAiB;QACxB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACI,iBAAiB,CAAC,WAAwB,EAAE,kBAAsC;QACrF,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAC/B,kBAAkB,EAClB,CAAC,KAAgB,EAAE,kBAAsC,EAAE,EAAE;YACzD,IAAI,CAAC,CAAC,KAAK,YAAY,WAAW,CAAC,EAAE,CAAC;gBAClC,OAAO;YACX,CAAC;YAED,IAAI,iBAAiB,GAAgC,IAAI,CAAC;YAE1D,kGAAkG;YAClG,qIAAqI;YACrI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,KAAK,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;gBACxF,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,OAAO,EAAE,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IAAI,EAAE,KAAK,CAAC,CAAC;QAC3E,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAE5C,6DAA6D;QAC7D,iBAAiB,CAAC,KAAK,GAAG,CAAC,CAAC;QAC5B,iBAAiB,CAAC,KAAK,GAAG,CAAC,CAAC;QAE5B,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import type { RenderTargetWrapper } from "@babylonjs/core/Engines/renderTargetWrapper";
|
|
2
|
-
import type { ThinRenderTargetTexture } from "@babylonjs/core/Materials/Textures/thinRenderTargetTexture";
|
|
3
2
|
import type { Nullable } from "@babylonjs/core/types";
|
|
4
3
|
import type { BaseBlock } from "../blocks/baseBlock";
|
|
5
4
|
import type { ShaderRuntime } from "../runtime/shaderRuntime";
|
|
6
5
|
import type { InternalSmartFilterRuntime } from "../runtime/smartFilterRuntime";
|
|
6
|
+
import type { ThinRenderTargetTexture } from "@babylonjs/core/Materials/Textures/thinRenderTargetTexture.js";
|
|
7
7
|
/**
|
|
8
|
-
* Tries to get a
|
|
9
|
-
* @param renderTargetTexture - The
|
|
8
|
+
* Tries to get a renderTargetWrapper from a ThinRenderTargetTexture, and throws an error if it fails.
|
|
9
|
+
* @param renderTargetTexture - The ThinRenderTargetTexture to get the renderTarget from.
|
|
10
10
|
* @param callerName - The name of the component calling this one, used for a more descriptive error message.
|
|
11
|
-
* @returns - The renderTarget or throws an Error if it fails.
|
|
11
|
+
* @returns - The renderTarget or it throws an Error if it fails.
|
|
12
12
|
*/
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function getRenderTargetWrapper(renderTargetTexture: Nullable<ThinRenderTargetTexture>, callerName: string): RenderTargetWrapper;
|
|
14
14
|
/**
|
|
15
15
|
* Registers the final command of the command queue - the one that draws to either the canvas or
|
|
16
16
|
* renderTargetTexture.
|
|
17
|
-
* @param
|
|
17
|
+
* @param renderTargetWrapper - If non-null, the RenderTargetWrapper to render to, otherwise the command will
|
|
18
18
|
* render to the canvas.
|
|
19
19
|
* @param runtime - The smart filter runtime to use.
|
|
20
20
|
* @param commandOwner - The owner of the command.
|
|
21
21
|
* @param shaderBlockRuntime - The shader block runtime to use.
|
|
22
22
|
*/
|
|
23
|
-
export declare function registerFinalRenderCommand(
|
|
23
|
+
export declare function registerFinalRenderCommand(renderTargetWrapper: Nullable<RenderTargetWrapper>, runtime: InternalSmartFilterRuntime, commandOwner: BaseBlock, shaderBlockRuntime: ShaderRuntime): void;
|
|
24
24
|
//# sourceMappingURL=renderTargetUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTargetUtils.d.ts","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"renderTargetUtils.d.ts","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+DAA+D,CAAC;AAE7G;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,mBAAmB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,EACtD,UAAU,EAAE,MAAM,GACnB,mBAAmB,CAMrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACtC,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EAClD,OAAO,EAAE,0BAA0B,EACnC,YAAY,EAAE,SAAS,EACvB,kBAAkB,EAAE,aAAa,GAClC,IAAI,CAeN"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createCommand } from "../command/command.js";
|
|
2
2
|
/**
|
|
3
|
-
* Tries to get a
|
|
4
|
-
* @param renderTargetTexture - The
|
|
3
|
+
* Tries to get a renderTargetWrapper from a ThinRenderTargetTexture, and throws an error if it fails.
|
|
4
|
+
* @param renderTargetTexture - The ThinRenderTargetTexture to get the renderTarget from.
|
|
5
5
|
* @param callerName - The name of the component calling this one, used for a more descriptive error message.
|
|
6
|
-
* @returns - The renderTarget or throws an Error if it fails.
|
|
6
|
+
* @returns - The renderTarget or it throws an Error if it fails.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function getRenderTargetWrapper(renderTargetTexture, callerName) {
|
|
9
9
|
const renderTarget = renderTargetTexture === null || renderTargetTexture === void 0 ? void 0 : renderTargetTexture.renderTarget;
|
|
10
10
|
if (!renderTarget) {
|
|
11
11
|
throw new Error(`${callerName} could not get a renderTarget it needed.`);
|
|
@@ -15,18 +15,17 @@ export function getRenderTarget(renderTargetTexture, callerName) {
|
|
|
15
15
|
/**
|
|
16
16
|
* Registers the final command of the command queue - the one that draws to either the canvas or
|
|
17
17
|
* renderTargetTexture.
|
|
18
|
-
* @param
|
|
18
|
+
* @param renderTargetWrapper - If non-null, the RenderTargetWrapper to render to, otherwise the command will
|
|
19
19
|
* render to the canvas.
|
|
20
20
|
* @param runtime - The smart filter runtime to use.
|
|
21
21
|
* @param commandOwner - The owner of the command.
|
|
22
22
|
* @param shaderBlockRuntime - The shader block runtime to use.
|
|
23
23
|
*/
|
|
24
|
-
export function registerFinalRenderCommand(
|
|
24
|
+
export function registerFinalRenderCommand(renderTargetWrapper, runtime, commandOwner, shaderBlockRuntime) {
|
|
25
25
|
const commandOwnerClassName = commandOwner.getClassName();
|
|
26
|
-
if (
|
|
27
|
-
const renderTarget = getRenderTarget(renderTargetTexture, commandOwnerClassName);
|
|
26
|
+
if (renderTargetWrapper) {
|
|
28
27
|
runtime.registerCommand(createCommand(`${commandOwnerClassName}.renderToFinalTexture`, commandOwner, () => {
|
|
29
|
-
shaderBlockRuntime.renderToTexture(
|
|
28
|
+
shaderBlockRuntime.renderToTexture(renderTargetWrapper);
|
|
30
29
|
}));
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderTargetUtils.js","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderTargetUtils.js","sourceRoot":"","sources":["../../src/utils/renderTargetUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAClC,mBAAsD,EACtD,UAAkB;IAElB,MAAM,YAAY,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,YAAY,CAAC;IACvD,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,0CAA0C,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,YAAY,CAAC;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CACtC,mBAAkD,EAClD,OAAmC,EACnC,YAAuB,EACvB,kBAAiC;IAEjC,MAAM,qBAAqB,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;IAC1D,IAAI,mBAAmB,EAAE,CAAC;QACtB,OAAO,CAAC,eAAe,CACnB,aAAa,CAAC,GAAG,qBAAqB,uBAAuB,EAAE,YAAY,EAAE,GAAG,EAAE;YAC9E,kBAAkB,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;QAC5D,CAAC,CAAC,CACL,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,eAAe,CACnB,aAAa,CAAC,GAAG,qBAAqB,iBAAiB,EAAE,YAAY,EAAE,GAAG,EAAE;YACxE,kBAAkB,CAAC,cAAc,EAAE,CAAC;QACxC,CAAC,CAAC,CACL,CAAC;IACN,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
|
3
3
|
import { BaseBlock } from "./baseBlock.js";
|
|
4
4
|
import { Binding, ShaderRuntime } from "../runtime/shaderRuntime.js";
|
|
5
5
|
import type { Nullable } from "@babylonjs/core/types";
|
|
6
|
-
import type {
|
|
6
|
+
import type { RenderTargetWrapper } from "@babylonjs/core/Engines/renderTargetWrapper";
|
|
7
7
|
import { registerFinalRenderCommand } from "../utils/renderTargetUtils.js";
|
|
8
8
|
import type { RuntimeData } from "../connection/connectionPoint";
|
|
9
9
|
import type { Effect } from "@babylonjs/core/Materials/effect";
|
|
@@ -28,10 +28,10 @@ export class OutputBlock extends BaseBlock {
|
|
|
28
28
|
public readonly input = this._registerInput("input", ConnectionPointType.Texture);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* If supplied, the Smart Filter will render into this
|
|
31
|
+
* If supplied, the Smart Filter will render into this RenderTargetWrapper. Otherwise, it renders
|
|
32
32
|
* into the the canvas or WebGL context the ThinEngine is using for rendering.
|
|
33
33
|
*/
|
|
34
|
-
public
|
|
34
|
+
public renderTargetWrapper: Nullable<RenderTargetWrapper> = null;
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Create a new output block.
|
|
@@ -85,7 +85,7 @@ export class OutputBlock extends BaseBlock {
|
|
|
85
85
|
initializationData.initializationPromises.push(shaderBlockRuntime.onReadyAsync);
|
|
86
86
|
runtime.registerResource(shaderBlockRuntime);
|
|
87
87
|
|
|
88
|
-
registerFinalRenderCommand(this.
|
|
88
|
+
registerFinalRenderCommand(this.renderTargetWrapper, runtime, this, shaderBlockRuntime);
|
|
89
89
|
|
|
90
90
|
super.generateCommandsAndGatherInitPromises(initializationData, finalOutput);
|
|
91
91
|
}
|
|
@@ -10,7 +10,7 @@ import { ConnectionPointType } from "../connection/connectionPointType.js";
|
|
|
10
10
|
import { createCommand } from "../command/command.js";
|
|
11
11
|
import { DisableableBlock } from "./disableableBlock.js";
|
|
12
12
|
import { undecorateSymbol } from "../utils/shaderCodeUtils.js";
|
|
13
|
-
import {
|
|
13
|
+
import { getRenderTargetWrapper, registerFinalRenderCommand } from "../utils/renderTargetUtils.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* This is the base class for all shader blocks.
|
|
@@ -123,13 +123,13 @@ export abstract class ShaderBlock extends DisableableBlock {
|
|
|
123
123
|
|
|
124
124
|
if (finalOutput) {
|
|
125
125
|
registerFinalRenderCommand(
|
|
126
|
-
initializationData.outputBlock.
|
|
126
|
+
initializationData.outputBlock.renderTargetWrapper,
|
|
127
127
|
runtime,
|
|
128
128
|
this,
|
|
129
129
|
shaderBlockRuntime
|
|
130
130
|
);
|
|
131
131
|
} else {
|
|
132
|
-
const renderTarget =
|
|
132
|
+
const renderTarget = getRenderTargetWrapper(
|
|
133
133
|
this.output.runtimeData?.value as ThinRenderTargetTexture,
|
|
134
134
|
this.getClassName()
|
|
135
135
|
);
|
|
@@ -199,10 +199,9 @@ export class RenderTargetGenerator {
|
|
|
199
199
|
// Get the smartFilter output size - either from the output block's renderTargetTexture or the engine's render size
|
|
200
200
|
let outputWidth: number;
|
|
201
201
|
let outputHeight: number;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
outputHeight = renderTargetTextureSize.height;
|
|
202
|
+
if (smartFilter.outputBlock.renderTargetWrapper) {
|
|
203
|
+
outputWidth = smartFilter.outputBlock.renderTargetWrapper.width;
|
|
204
|
+
outputHeight = smartFilter.outputBlock.renderTargetWrapper.height;
|
|
206
205
|
} else {
|
|
207
206
|
outputWidth = engine.getRenderWidth(true);
|
|
208
207
|
outputHeight = engine.getRenderHeight(true);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { RenderTargetWrapper } from "@babylonjs/core/Engines/renderTargetWrapper";
|
|
2
|
-
import type { ThinRenderTargetTexture } from "@babylonjs/core/Materials/Textures/thinRenderTargetTexture";
|
|
3
2
|
import type { Nullable } from "@babylonjs/core/types";
|
|
4
3
|
import { createCommand } from "../command/command.js";
|
|
5
4
|
import type { BaseBlock } from "../blocks/baseBlock";
|
|
6
5
|
import type { ShaderRuntime } from "../runtime/shaderRuntime";
|
|
7
6
|
import type { InternalSmartFilterRuntime } from "../runtime/smartFilterRuntime";
|
|
7
|
+
import type { ThinRenderTargetTexture } from "@babylonjs/core/Materials/Textures/thinRenderTargetTexture.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Tries to get a
|
|
11
|
-
* @param renderTargetTexture - The
|
|
10
|
+
* Tries to get a renderTargetWrapper from a ThinRenderTargetTexture, and throws an error if it fails.
|
|
11
|
+
* @param renderTargetTexture - The ThinRenderTargetTexture to get the renderTarget from.
|
|
12
12
|
* @param callerName - The name of the component calling this one, used for a more descriptive error message.
|
|
13
|
-
* @returns - The renderTarget or throws an Error if it fails.
|
|
13
|
+
* @returns - The renderTarget or it throws an Error if it fails.
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function getRenderTargetWrapper(
|
|
16
16
|
renderTargetTexture: Nullable<ThinRenderTargetTexture>,
|
|
17
17
|
callerName: string
|
|
18
18
|
): RenderTargetWrapper {
|
|
@@ -26,24 +26,23 @@ export function getRenderTarget(
|
|
|
26
26
|
/**
|
|
27
27
|
* Registers the final command of the command queue - the one that draws to either the canvas or
|
|
28
28
|
* renderTargetTexture.
|
|
29
|
-
* @param
|
|
29
|
+
* @param renderTargetWrapper - If non-null, the RenderTargetWrapper to render to, otherwise the command will
|
|
30
30
|
* render to the canvas.
|
|
31
31
|
* @param runtime - The smart filter runtime to use.
|
|
32
32
|
* @param commandOwner - The owner of the command.
|
|
33
33
|
* @param shaderBlockRuntime - The shader block runtime to use.
|
|
34
34
|
*/
|
|
35
35
|
export function registerFinalRenderCommand(
|
|
36
|
-
|
|
36
|
+
renderTargetWrapper: Nullable<RenderTargetWrapper>,
|
|
37
37
|
runtime: InternalSmartFilterRuntime,
|
|
38
38
|
commandOwner: BaseBlock,
|
|
39
39
|
shaderBlockRuntime: ShaderRuntime
|
|
40
40
|
): void {
|
|
41
41
|
const commandOwnerClassName = commandOwner.getClassName();
|
|
42
|
-
if (
|
|
43
|
-
const renderTarget = getRenderTarget(renderTargetTexture, commandOwnerClassName);
|
|
42
|
+
if (renderTargetWrapper) {
|
|
44
43
|
runtime.registerCommand(
|
|
45
44
|
createCommand(`${commandOwnerClassName}.renderToFinalTexture`, commandOwner, () => {
|
|
46
|
-
shaderBlockRuntime.renderToTexture(
|
|
45
|
+
shaderBlockRuntime.renderToTexture(renderTargetWrapper);
|
|
47
46
|
})
|
|
48
47
|
);
|
|
49
48
|
} else {
|