esp::gfx_batch::DepthShader class

Depth-only shader.

Outputs depth values without projection applied. Can also unproject existing depth buffer if Flag::UnprojectExistingDepth is enabled.

Public types

enum class Flag { UnprojectExistingDepth = 1 << 0, NoFarPlanePatching = 1 << 1 }
Flag.
using Flags = Corrade::Containers::EnumSet<Flag>
Flags.

Constructors, destructors, conversion operators

DepthShader(Flags flags = {}) explicit
Constructor.

Public functions

auto setTransformationMatrix(const Magnum::Matrix4& matrix) -> DepthShader&
Set transformation and projection matrix.
auto setDepthUnprojection(const Magnum::Vector2& depthUnprojection) -> DepthShader&
Set the depth unprojection parameters directly.
auto setProjectionMatrix(const Magnum::Matrix4& matrix) -> DepthShader&
Set projection matrix for unprojection.
auto bindDepthTexture(Magnum::GL::Texture2D& texture) -> DepthShader&
Bind depth texture.
auto flags() const -> Flags
The flags passed to the Constructor.

Enum documentation

enum class esp::gfx_batch::DepthShader::Flag

Flag.

Enumerators
UnprojectExistingDepth

Perform unprojection of an existing depth buffer. If enabled, instead of rendering particular polygons bind a depth texture with bindDepthTexture(). The shader will then render a full-screen triangle and unprojects the depth using an inverse of the matrix passed in setProjectionMatrix().

NoFarPlanePatching

By default, depth values on the far plane are patched to have a value of 0.0f (instead of 100.0f or whatever the far plane is set to). This might have some performance penalty and can be turned off with this flag.

Function documentation

DepthShader& esp::gfx_batch::DepthShader::setTransformationMatrix(const Magnum::Matrix4& matrix)

Set transformation and projection matrix.

Returns Reference to self (for method chaining)

Expects that Flag::UnprojectExistingDepth is not set.

DepthShader& esp::gfx_batch::DepthShader::setDepthUnprojection(const Magnum::Vector2& depthUnprojection)

Set the depth unprojection parameters directly.

Returns Reference to self (for method chaining)

DepthShader& esp::gfx_batch::DepthShader::setProjectionMatrix(const Magnum::Matrix4& matrix)

Set projection matrix for unprojection.

Returns Reference to self (for method chaining)

DepthShader& esp::gfx_batch::DepthShader::bindDepthTexture(Magnum::GL::Texture2D& texture)

Bind depth texture.

Returns Reference to self (for method chaining)

Expects that Flag::UnprojectExistingDepth is set.