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.

61 lines 1.66 kB
import { RegisterClass } from "../../../../Misc/typeStore.js"; import "../../../../Rendering/depthRendererSceneComponent.js"; import { ImageSourceBlock } from "./imageSourceBlock.js"; /** * Block used to provide an depth texture for a TextureBlock */ export class DepthSourceBlock extends ImageSourceBlock { /** * Creates a new DepthSourceBlock * @param name defines the block name */ constructor(name) { super(name); } /** * Gets or sets the texture associated with the node */ get texture() { return this._texture; } set texture(texture) { // Do nothing, we always use the depth texture from the scene } /** * Bind data to effect * @param effect - the effect to bind to * @param nodeMaterial - the node material */ bind(effect, nodeMaterial) { const scene = nodeMaterial.getScene(); const renderer = scene.enableDepthRenderer(); this._texture = renderer.getDepthMap(); super.bind(effect, nodeMaterial); } /** * Checks if the block is ready * @returns true if ready */ isReady() { return true; } /** * Gets the current class name * @returns the class name */ getClassName() { return "DepthSourceBlock"; } _dumpPropertiesCode() { return super._dumpPropertiesCode(true); } /** * Serializes the block * @returns the serialized object */ serialize() { return super.serialize(true); } } RegisterClass("BABYLON.DepthSourceBlock", DepthSourceBlock); //# sourceMappingURL=depthSourceBlock.js.map