UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

65 lines 2.57 kB
import { NodeRenderGraphBlock } from "../../nodeRenderGraphBlock.js"; import { RegisterClass } from "../../../../Misc/typeStore.js"; import { NodeRenderGraphBlockConnectionPointTypes } from "../../Types/nodeRenderGraphTypes.js"; import { FrameGraphCopyToTextureTask } from "../../../Tasks/Texture/copyToTextureTask.js"; /** * Block used to copy a texture */ export class NodeRenderGraphCopyTextureBlock extends NodeRenderGraphBlock { /** * Gets the frame graph task associated with this block */ get task() { return this._frameGraphTask; } /** * Create a new NodeRenderGraphCopyTextureBlock * @param name defines the block name * @param frameGraph defines the hosting frame graph * @param scene defines the hosting scene */ constructor(name, frameGraph, scene) { super(name, frameGraph, scene); this.registerInput("source", NodeRenderGraphBlockConnectionPointTypes.AutoDetect); this.registerInput("target", NodeRenderGraphBlockConnectionPointTypes.AutoDetect); this._addDependenciesInput(); this.registerOutput("output", NodeRenderGraphBlockConnectionPointTypes.BasedOnInput); this.source.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAllButBackBuffer); this.target.addExcludedConnectionPointFromAllowedTypes(NodeRenderGraphBlockConnectionPointTypes.TextureAll); this.output._typeConnectionSource = this.target; this._frameGraphTask = new FrameGraphCopyToTextureTask(name, frameGraph); } /** * Gets the current class name * @returns the class name */ getClassName() { return "NodeRenderGraphCopyTextureBlock"; } /** * Gets the source input component */ get source() { return this._inputs[0]; } /** * Gets the target input component */ get target() { return this._inputs[1]; } /** * Gets the output component */ get output() { return this._outputs[0]; } _buildBlock(state) { super._buildBlock(state); this.output.value = this._frameGraphTask.outputTexture; // the value of the output connection point is the "output" texture of the task this._frameGraphTask.sourceTexture = this.source.connectedPoint?.value; this._frameGraphTask.targetTexture = this.target.connectedPoint?.value; } } RegisterClass("BABYLON.NodeRenderGraphCopyTextureBlock", NodeRenderGraphCopyTextureBlock); //# sourceMappingURL=copyTextureBlock.js.map