载入中...
搜索中...
未找到
eve::graphics::Volumetric类 参考

Volumetric light + fog. 更多...

#include <Volumetric.h>

Public 成员函数

 Volumetric (Graphics *gfx)
 
 ~Volumetric ()
 
 Volumetric (const Volumetric &)=delete
 
Volumetricoperator= (const Volumetric &)=delete
 
void setQuality (const std::string &quality)
 "low" | "medium" | "high" (unknown → medium).
 
std::string getQuality () const
 
void setMode (const std::string &mode)
 "screenspace" | "raymarch" | "fog" — selects which shader params quality tweaks.
 
std::string getMode () const
 
void setLightScreenUV (float u, float v)
 Light position in UV (0..1), origin top-left to match 2D UVs.
 
float getLightScreenU () const
 
float getLightScreenV () const
 
void setLightScreenPos (float x, float y, float width, float height)
 Pixel-space helper (converts with width/height).
 
void setLightDirection (float dx, float dy, float dz)
 World-space direction toward the lit surface (ray march / phase).
 
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 ray march reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by rayMarch*.
 
void setInvViewProj (const glm::mat4 &invViewProj)
 Raw inverse view-projection (column-major, matching glm).
 
void setShaftColor (float r, float g, float b)
 
void setFogColor (float r, float g, float b)
 
void setIntensity (float intensity)
 
void setTime (float seconds)
 
void setDensity (float density)
 
void setFogHeight (float worldY)
 Height fog: denser near world Y = fogHeight; falloff is 1/meters scale.
 
void setFogHeightFalloff (float falloff)
 
void setFogStart (float startDistance)
 View-distance ramp where fog appears (world units along the ray).
 
void setFogEnd (float endDistance)
 
void setFogNoise (float amount)
 
bool hasParam (const std::string &name) const
 
void setFloat (const std::string &name, float value)
 
float getFloat (const std::string &name) const
 
int getSampleCount () const
 
float getDownscale () const
 
void beginOcclusionMap (Graphics *gfx, float lightPixelX, float lightPixelY, float lightRadiusPixels=24.f)
 Clear the current canvas to black and draw a bright light disc (start of an occlusion map). Call drawOcclusion* afterward.
 
void drawOccluder (Graphics *gfx, Drawable *drawable, const glm::mat4 &matrix)
 Drawable occlusion (respects Drawable::getCastOcclusion).
 
void drawOccluderSolid (Graphics *gfx, float x, float y, float w, float h)
 Convenience 2D black silhouette (solid or textured alpha).
 
void drawOccluderTexture (Graphics *gfx, Texture *texture, float x, float y, float w, float h)
 
void scatter (Graphics *gfx, Texture *occlusion)
 Scatter-only: occlusion → shafts with alpha (draw over a prior scene). Writes to the currently bound canvas / screen.
 
void scatterTo (Graphics *gfx, Texture *occlusion, Canvas *dest)
 Same as scatter but into an explicit destination.
 
void applyFromScene (Graphics *gfx, Texture *scene)
 Single-pass: treat source as the scene (bright regions ≈ light), add shafts + dust/fog onto it. Writes to current canvas.
 
void applyFromSceneTo (Graphics *gfx, Texture *scene, Canvas *dest)
 
void rayMarch (Graphics *gfx, Texture *linearDepth)
 Ray march participating media using a linear-depth texture (R channel, 0=near .. 1=far). Screen-space steps toward light UV approximate CSM occlusion. Call setCamera / setLightDirection / setLightScreenUV first.
 
void rayMarchTo (Graphics *gfx, Texture *linearDepth, Canvas *dest)
 
void applyFog (Graphics *gfx, Texture *linearDepth)
 Volumetric height/distance fog from a linear-depth texture. Writes fog RGB with alpha = 1-transmittance (overlay with alpha blend). Call setCamera / setFogHeight* / setFogStart/End first.
 
void applyFogTo (Graphics *gfx, Texture *linearDepth, Canvas *dest)
 
TexturenewLinearDepthTexture (Graphics *gfx, int width, int height, float(*depth01)(int x, int y, void *userdata), void *userdata)
 Build an RGBA8 texture with linear depth in R (G=B=R, A=255). depth01(x,y) should return values in [0,1]. Owned by Graphics.
 
int resolutionFor (int fullSize) const
 Downscale helper: returns floor(dim / downscale), at least 1. Callers create occlusion / scatter canvases at this size for the active quality tier.
 
void drawOccluders2D (Graphics *gfx)
 Draw all visible Renderable2D with castOcclusion into the current canvas as black silhouettes (shadow-analogue occlusion pass).
 
ShadergetShader () const
 
ShadergetRayMarchShader () const
 
ShadergetFogShader () const
 

详细描述

Volumetric light + fog.

Modes:

  • "screenspace" — Mitchell radial blur god rays (+ dust/fog tint)
  • "raymarch" — depth ray march light shafts (SS occlusion ≈ CSM)
  • "fog" — height + distance volumetric fog (Beer-Lambert)

Quality presets ("low" | "medium" | "high") control sample count and suggested downscale via resolutionFor().

在文件 Volumetric.h27 行定义.

构造及析构函数说明

◆ Volumetric() [1/2]

eve::graphics::Volumetric::Volumetric ( Graphics gfx)
explicit

在文件 Volumetric.cpp163 行定义.

◆ ~Volumetric()

eve::graphics::Volumetric::~Volumetric ( )
default

◆ Volumetric() [2/2]

eve::graphics::Volumetric::Volumetric ( const Volumetric )
delete

成员函数说明

◆ applyFog()

void eve::graphics::Volumetric::applyFog ( Graphics gfx,
Texture linearDepth 
)

Volumetric height/distance fog from a linear-depth texture. Writes fog RGB with alpha = 1-transmittance (overlay with alpha blend). Call setCamera / setFogHeight* / setFogStart/End first.

在文件 Volumetric.cpp522 行定义.

被这些函数引用 applyFogTo().

◆ applyFogTo()

void eve::graphics::Volumetric::applyFogTo ( Graphics gfx,
Texture linearDepth,
Canvas dest 
)

◆ applyFromScene()

void eve::graphics::Volumetric::applyFromScene ( Graphics gfx,
Texture scene 
)

Single-pass: treat source as the scene (bright regions ≈ light), add shafts + dust/fog onto it. Writes to current canvas.

在文件 Volumetric.cpp494 行定义.

被这些函数引用 applyFromSceneTo().

◆ applyFromSceneTo()

void eve::graphics::Volumetric::applyFromSceneTo ( Graphics gfx,
Texture scene,
Canvas dest 
)

◆ beginOcclusionMap()

void eve::graphics::Volumetric::beginOcclusionMap ( Graphics gfx,
float  lightPixelX,
float  lightPixelY,
float  lightRadiusPixels = 24.f 
)

Clear the current canvas to black and draw a bright light disc (start of an occlusion map). Call drawOcclusion* afterward.

在文件 Volumetric.cpp436 行定义.

引用了 eve::graphics::Canvas::clear(), eve::graphics::Graphics::drawSolidRect(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth(), eve::graphics::Canvas::getWidth(), h, setLightScreenPos() , 以及 w.

◆ drawOccluder()

void eve::graphics::Volumetric::drawOccluder ( Graphics gfx,
Drawable drawable,
const glm::mat4 &  matrix 
)

Drawable occlusion (respects Drawable::getCastOcclusion).

在文件 Volumetric.cpp448 行定义.

引用了 eve::graphics::Graphics::drawOcclusion().

◆ drawOccluders2D()

void eve::graphics::Volumetric::drawOccluders2D ( Graphics gfx)

Draw all visible Renderable2D with castOcclusion into the current canvas as black silhouettes (shadow-analogue occlusion pass).

在文件 Volumetric.cpp464 行定义.

引用了 eve::graphics::Graphics::drawOcclusionSolid(), eve::graphics::Graphics::drawOcclusionTexture(), h, view , 以及 w.

◆ drawOccluderSolid()

void eve::graphics::Volumetric::drawOccluderSolid ( Graphics gfx,
float  x,
float  y,
float  w,
float  h 
)

Convenience 2D black silhouette (solid or textured alpha).

在文件 Volumetric.cpp453 行定义.

引用了 eve::graphics::Graphics::drawOcclusionSolid(), h, w, x , 以及 y.

◆ drawOccluderTexture()

void eve::graphics::Volumetric::drawOccluderTexture ( Graphics gfx,
Texture texture,
float  x,
float  y,
float  w,
float  h 
)

在文件 Volumetric.cpp458 行定义.

引用了 eve::graphics::Graphics::drawOcclusionTexture(), h, w, x , 以及 y.

◆ getDownscale()

float eve::graphics::Volumetric::getDownscale ( ) const
inline

在文件 Volumetric.h84 行定义.

◆ getFloat()

float eve::graphics::Volumetric::getFloat ( const std::string &  name) const

◆ getFogShader()

Shader * eve::graphics::Volumetric::getFogShader ( ) const
inline

在文件 Volumetric.h154 行定义.

◆ getLightScreenU()

float eve::graphics::Volumetric::getLightScreenU ( ) const

在文件 Volumetric.cpp250 行定义.

引用了 getFloat().

◆ getLightScreenV()

float eve::graphics::Volumetric::getLightScreenV ( ) const

在文件 Volumetric.cpp251 行定义.

引用了 getFloat().

◆ getMode()

std::string eve::graphics::Volumetric::getMode ( ) const
inline

在文件 Volumetric.h41 行定义.

◆ getQuality()

std::string eve::graphics::Volumetric::getQuality ( ) const
inline

在文件 Volumetric.h37 行定义.

◆ getRayMarchShader()

Shader * eve::graphics::Volumetric::getRayMarchShader ( ) const
inline

在文件 Volumetric.h153 行定义.

◆ getSampleCount()

int eve::graphics::Volumetric::getSampleCount ( ) const

在文件 Volumetric.cpp390 行定义.

引用了 getFloat().

◆ getShader()

Shader * eve::graphics::Volumetric::getShader ( ) const
inline

在文件 Volumetric.h152 行定义.

◆ hasParam()

bool eve::graphics::Volumetric::hasParam ( const std::string &  name) const

在文件 Volumetric.cpp353 行定义.

引用了 eve::graphics::Shader::hasUniform() , 以及 name.

◆ newLinearDepthTexture()

Texture * eve::graphics::Volumetric::newLinearDepthTexture ( Graphics gfx,
int  width,
int  height,
float(*)(int x, int y, void *userdata)  depth01,
void *  userdata 
)

Build an RGBA8 texture with linear depth in R (G=B=R, A=255). depth01(x,y) should return values in [0,1]. Owned by Graphics.

在文件 Volumetric.cpp536 行定义.

引用了 b, d, height, eve::graphics::Graphics::newTexture(), width, x , 以及 y.

◆ operator=()

Volumetric & eve::graphics::Volumetric::operator= ( const Volumetric )
delete

◆ rayMarch()

void eve::graphics::Volumetric::rayMarch ( Graphics gfx,
Texture linearDepth 
)

Ray march participating media using a linear-depth texture (R channel, 0=near .. 1=far). Screen-space steps toward light UV approximate CSM occlusion. Call setCamera / setLightDirection / setLightScreenUV first.

在文件 Volumetric.cpp508 行定义.

被这些函数引用 rayMarchTo().

◆ rayMarchTo()

void eve::graphics::Volumetric::rayMarchTo ( Graphics gfx,
Texture linearDepth,
Canvas dest 
)

◆ resolutionFor()

int eve::graphics::Volumetric::resolutionFor ( int  fullSize) const

Downscale helper: returns floor(dim / downscale), at least 1. Callers create occlusion / scatter canvases at this size for the active quality tier.

在文件 Volumetric.cpp392 行定义.

◆ scatter()

void eve::graphics::Volumetric::scatter ( Graphics gfx,
Texture occlusion 
)

Scatter-only: occlusion → shafts with alpha (draw over a prior scene). Writes to the currently bound canvas / screen.

在文件 Volumetric.cpp480 行定义.

被这些函数引用 scatterTo().

◆ scatterTo()

void eve::graphics::Volumetric::scatterTo ( Graphics gfx,
Texture occlusion,
Canvas dest 
)

Same as scatter but into an explicit destination.

在文件 Volumetric.cpp485 行定义.

引用了 eve::graphics::Graphics::getCanvas(), scatter() , 以及 eve::graphics::Graphics::setCanvas().

◆ setCamera()

void eve::graphics::Volumetric::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 ray march reconstruction (RH + ZO). Builds inv(viewProj) and near/far used by rayMarch*.

在文件 Volumetric.cpp278 行定义.

引用了 fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj() , 以及 view.

◆ setDensity()

void eve::graphics::Volumetric::setDensity ( float  density)

在文件 Volumetric.cpp322 行定义.

引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().

◆ setFloat()

void eve::graphics::Volumetric::setFloat ( const std::string &  name,
float  value 
)

◆ setFogColor()

void eve::graphics::Volumetric::setFogColor ( float  r,
float  g,
float  b 
)

在文件 Volumetric.cpp305 行定义.

引用了 b, eve::graphics::Shader::sendFloat() , 以及 setFloat().

◆ setFogEnd()

void eve::graphics::Volumetric::setFogEnd ( float  endDistance)

在文件 Volumetric.cpp343 行定义.

引用了 eve::graphics::Shader::sendFloat().

◆ setFogHeight()

void eve::graphics::Volumetric::setFogHeight ( float  worldY)

Height fog: denser near world Y = fogHeight; falloff is 1/meters scale.

在文件 Volumetric.cpp328 行定义.

引用了 eve::graphics::Shader::sendFloat().

◆ setFogHeightFalloff()

void eve::graphics::Volumetric::setFogHeightFalloff ( float  falloff)

在文件 Volumetric.cpp333 行定义.

引用了 eve::graphics::Shader::sendFloat().

◆ setFogNoise()

void eve::graphics::Volumetric::setFogNoise ( float  amount)

在文件 Volumetric.cpp348 行定义.

引用了 eve::graphics::Shader::sendFloat().

◆ setFogStart()

void eve::graphics::Volumetric::setFogStart ( float  startDistance)

View-distance ramp where fog appears (world units along the ray).

在文件 Volumetric.cpp338 行定义.

引用了 eve::graphics::Shader::sendFloat().

◆ setIntensity()

void eve::graphics::Volumetric::setIntensity ( float  intensity)

在文件 Volumetric.cpp314 行定义.

引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().

◆ setInvViewProj()

void eve::graphics::Volumetric::setInvViewProj ( const glm::mat4 &  invViewProj)

Raw inverse view-projection (column-major, matching glm).

在文件 Volumetric.cpp272 行定义.

引用了 eve::graphics::Shader::sendMatrix().

被这些函数引用 setCamera().

◆ setLightDirection()

void eve::graphics::Volumetric::setLightDirection ( float  dx,
float  dy,
float  dz 
)

World-space direction toward the lit surface (ray march / phase).

在文件 Volumetric.cpp259 行定义.

引用了 d , 以及 eve::graphics::Shader::sendFloat().

◆ setLightScreenPos()

void eve::graphics::Volumetric::setLightScreenPos ( float  x,
float  y,
float  width,
float  height 
)

Pixel-space helper (converts with width/height).

在文件 Volumetric.cpp253 行定义.

引用了 height, setLightScreenUV(), width, x , 以及 y.

被这些函数引用 beginOcclusionMap().

◆ setLightScreenUV()

void eve::graphics::Volumetric::setLightScreenUV ( float  u,
float  v 
)

Light position in UV (0..1), origin top-left to match 2D UVs.

在文件 Volumetric.cpp243 行定义.

引用了 eve::graphics::Shader::sendFloat(), setFloat(), u , 以及 v.

被这些函数引用 setLightScreenPos().

◆ setMode()

void eve::graphics::Volumetric::setMode ( const std::string &  mode)

"screenspace" | "raymarch" | "fog" — selects which shader params quality tweaks.

在文件 Volumetric.cpp233 行定义.

◆ setQuality()

void eve::graphics::Volumetric::setQuality ( const std::string &  quality)

"low" | "medium" | "high" (unknown → medium).

在文件 Volumetric.cpp228 行定义.

◆ setShaftColor()

void eve::graphics::Volumetric::setShaftColor ( float  r,
float  g,
float  b 
)

在文件 Volumetric.cpp296 行定义.

引用了 b, eve::graphics::Shader::sendFloat() , 以及 setFloat().

◆ setTime()

void eve::graphics::Volumetric::setTime ( float  seconds)

在文件 Volumetric.cpp320 行定义.

引用了 setFloat().


该类的文档由以下文件生成: