Screen-space contact shadows for the primary directional light. 更多...
#include <ContactShadow.h>
Public 成员函数 | |
| ContactShadow (Graphics *gfx) | |
| Owns post shaders created from the borrowed Graphics factory. | |
| ~ContactShadow () | |
| Releases owned shaders. | |
| ContactShadow (const ContactShadow &)=delete | |
| ContactShadow & | operator= (const ContactShadow &)=delete |
| void | setQuality (const std::string &quality) |
| "low" | "medium" | "high" (unknown → medium). | |
| std::string | getQuality () const |
| Returns the quality. | |
| void | setCamera (float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ, float fovYDeg, float aspect, float nearZ, float farZ) |
| Camera for depth reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by apply*. | |
| void | setInvViewProj (const glm::mat4 &invViewProj) |
| Sets the inv view proj. | |
| void | setLightDirection (float x, float y, float z) |
| World-space direction toward the light (normalized on write). Matches Light3D directional convention (points to the light). | |
| void | setLength (float length) |
| Sets the ray length in world units. | |
| void | setThickness (float thickness) |
| Sets the contact thickness in view-space meters. | |
| void | setIntensity (float intensity) |
| Sets the darkening intensity in [0, +inf). | |
| void | setStartBias (float bias) |
| Sets the start bias along normal/light in world units. | |
| float | getLength () const |
| Returns the ray length. | |
| float | getThickness () const |
| Returns the thickness. | |
| float | getIntensity () const |
| Returns the intensity. | |
| float | getStartBias () const |
| Returns the start bias. | |
| int | getStepCount () const |
| Returns the step count for the active quality. | |
| void | applyFromGBuffer (Graphics *gfx, Texture *hwDepth, Texture *worldNormal) |
| Darken the current target using contact shadows from GBuffer depth. | |
| Shader * | getShader () const |
| Returns the owned contact-shadow shader. @lifetime Returned shader is borrowed and owned by Graphics. | |
详细描述
Screen-space contact shadows for the primary directional light.
Ray-marches a short distance along the light direction through the GBuffer hardware depth attachment and darkens the already-lit scene with a black alpha overlay (same blending contract as AmbientOcclusion overlays).
@thread Render thread only.
在文件 ContactShadow.h 第 23 行定义.
构造及析构函数说明
◆ ContactShadow() [1/2]
|
explicit |
Owns post shaders created from the borrowed Graphics factory.
在文件 ContactShadow.cpp 第 68 行定义.
◆ ~ContactShadow()
|
default |
Releases owned shaders.
◆ ContactShadow() [2/2]
|
delete |
成员函数说明
◆ applyFromGBuffer()
| void eve::graphics::ContactShadow::applyFromGBuffer | ( | Graphics * | gfx, |
| Texture * | hwDepth, | ||
| Texture * | worldNormal | ||
| ) |
Darken the current target using contact shadows from GBuffer depth.
- 参数
-
hwDepth Hardware D32 depth (.r = Vulkan NDC z) or WebGPU depth color. worldNormal Optional GBuffer normal (RGB = n*0.5+0.5); may be null.
在文件 ContactShadow.cpp 第 159 行定义.
引用了 eve::Alpha, eve::graphics::Graphics::drawTexturedRectShaderDepth(), eve::graphics::Graphics::drawTexturedRectShaderUV(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Texture::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth(), eve::graphics::Texture::getWidth(), eve::graphics::Canvas::getWidth() , 以及 eve::graphics::Shader::sendFloat().
◆ getIntensity()
|
inline |
Returns the intensity.
在文件 ContactShadow.h 第 68 行定义.
◆ getLength()
|
inline |
Returns the ray length.
在文件 ContactShadow.h 第 64 行定义.
◆ getQuality()
|
inline |
Returns the quality.
在文件 ContactShadow.h 第 36 行定义.
◆ getShader()
|
inline |
Returns the owned contact-shadow shader. @lifetime Returned shader is borrowed and owned by Graphics.
在文件 ContactShadow.h 第 83 行定义.
◆ getStartBias()
|
inline |
Returns the start bias.
在文件 ContactShadow.h 第 70 行定义.
◆ getStepCount()
|
inline |
Returns the step count for the active quality.
在文件 ContactShadow.h 第 72 行定义.
◆ getThickness()
|
inline |
Returns the thickness.
在文件 ContactShadow.h 第 66 行定义.
◆ operator=()
|
delete |
◆ setCamera()
| void eve::graphics::ContactShadow::setCamera | ( | float | eyeX, |
| float | eyeY, | ||
| float | eyeZ, | ||
| float | targetX, | ||
| float | targetY, | ||
| float | targetZ, | ||
| float | upX, | ||
| float | upY, | ||
| float | upZ, | ||
| float | fovYDeg, | ||
| float | aspect, | ||
| float | nearZ, | ||
| float | farZ | ||
| ) |
Camera for depth reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by apply*.
在文件 ContactShadow.cpp 第 110 行定义.
引用了 fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj(), targetX , 以及 view.
◆ setIntensity()
| void eve::graphics::ContactShadow::setIntensity | ( | float | intensity | ) |
Sets the darkening intensity in [0, +inf).
在文件 ContactShadow.cpp 第 136 行定义.
◆ setInvViewProj()
| void eve::graphics::ContactShadow::setInvViewProj | ( | const glm::mat4 & | invViewProj | ) |
Sets the inv view proj.
在文件 ContactShadow.cpp 第 105 行定义.
引用了 invViewProj , 以及 eve::graphics::Shader::sendMatrix().
被这些函数引用 eve::graphics::RenderSystem3D::render() , 以及 setCamera().
◆ setLength()
| void eve::graphics::ContactShadow::setLength | ( | float | length | ) |
◆ setLightDirection()
| void eve::graphics::ContactShadow::setLightDirection | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
World-space direction toward the light (normalized on write). Matches Light3D directional convention (points to the light).
在文件 ContactShadow.cpp 第 126 行定义.
◆ setQuality()
| void eve::graphics::ContactShadow::setQuality | ( | const std::string & | quality | ) |
"low" | "medium" | "high" (unknown → medium).
在文件 ContactShadow.cpp 第 100 行定义.
◆ setStartBias()
| void eve::graphics::ContactShadow::setStartBias | ( | float | bias | ) |
◆ setThickness()
| void eve::graphics::ContactShadow::setThickness | ( | float | thickness | ) |
该类的文档由以下文件生成:
- src/modules/graphics/ContactShadow.h
- src/modules/graphics/ContactShadow.cpp