Volumetric light + fog. 更多...
#include <Volumetric.h>
Public 成员函数 | |
| Volumetric (Graphics *gfx) | |
| Volumetric. | |
| ~Volumetric () | |
| Volumetric. | |
| Volumetric (const Volumetric &)=delete | |
| Volumetric & | operator= (const Volumetric &)=delete |
| void | setQuality (const std::string &quality) |
| "low" | "medium" | "high" (unknown → medium). | |
| std::string | getQuality () const |
| Returns the quality. | |
| void | setMode (const std::string &mode) |
| "screenspace" | "raymarch" | "fog" | "froxel" | "cloud". | |
| std::string | getMode () const |
| Returns the mode. | |
| void | setLightScreenUV (float u, float v) |
| Light position in UV (0..1), origin top-left to match 2D UVs. | |
| float | getLightScreenU () const |
| Returns the light screen u. | |
| float | getLightScreenV () const |
| Returns the light screen v. | |
| 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) |
| Sets the shaft color. | |
| void | setFogColor (float r, float g, float b) |
| Sets the fog color. | |
| void | setIntensity (float intensity) |
| Sets the intensity. | |
| void | setTime (float seconds) |
| Sets the time. | |
| void | setDensity (float density) |
| Sets the density. | |
| void | setAnisotropy (float g) |
| Henyey–Greenstein anisotropy for raymarch shafts in [-0.99, 0.99]. Positive values produce forward-scattering god rays; negative back-scatters. | |
| float | getAnisotropy () const |
| Current raymarch anisotropy. | |
| void | setFogHeight (float worldY) |
| Height fog: denser near world Y = fogHeight; falloff is 1/meters scale. | |
| void | setFogHeightFalloff (float falloff) |
| Sets the fog height falloff. | |
| void | setFogStart (float startDistance) |
| View-distance ramp where fog appears (world units along the ray). | |
| void | setFogEnd (float endDistance) |
| Sets the fog end. | |
| void | setFogNoise (float amount) |
| Sets the fog noise. | |
| void | setCloudLayer (float bottom, float top) |
| Set cloud layer world-space bottom and top heights. | |
| void | setCloudCoverage (float coverage) |
| Cloud cover fraction in [0,1]. | |
| void | setCloudDensity (float density) |
| Cloud density multiplier, clamped non-negative. | |
| void | setCloudScale (float worldScale) |
| Horizontal size of procedural cloud features in world units. | |
| void | setCloudWind (float x, float z) |
| Cloud wind velocity in world X/Z units per second. | |
| void | setCloudLightColor (float r, float g, float b) |
| Direct sunlight color used by cloud single scattering. | |
| bool | hasParam (const std::string &name) const |
| True when param. | |
| void | setFloat (const std::string &name, float value) |
| Sets the float. | |
| float | getFloat (const std::string &name) const |
| Returns the float. | |
| int | getSampleCount () const |
| Returns the sample count. | |
| float | getDownscale () const |
| Returns the downscale. | |
| 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) |
| Draws occluder texture. | |
| 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) |
| Applies from scene to. | |
| 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) |
| Ray march to. | |
| 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) |
| Applies fog to. | |
| Result< void > | projectDirectionalCookie (Graphics *gfx, Texture *depth, Texture *cookie, float worldSize, float intensity=1.f) |
| Project a repeating directional-light cookie over visible scene surfaces. | |
| void | renderClouds (Graphics *gfx, Texture *linearDepth) |
| Render the bounded cloud layer using scene linear depth for occlusion. | |
| void | renderCloudsTo (Graphics *gfx, Texture *linearDepth, Canvas *dest) |
| Renders clouds to. | |
| void | configureFroxelGrid (int width, int height, int depth, float nearDistance, float farDistance) |
| Configure the CPU reference/fallback froxel grid used by the atlas renderer. Quality presets choose suitable defaults, but explicit dimensions are useful for tests. | |
| AtmosphereVolume * | getAtmosphereVolume () const |
| Access the froxel media grid for native density/light injection. | |
| const glm::mat4 & | getInvViewProj () const |
| Inverse view-projection last written by setCamera / setInvViewProj. | |
| void | clearFroxelGrid () |
| Clear all media in the configured froxel grid. | |
| void | injectFroxelHeightFog (float extinction, float albedoR, float albedoG, float albedoB, float baseHeight, float heightFalloff, float minWorldY, float maxWorldY) |
| Inject an exponential global height layer into the froxel grid. | |
| void | injectFroxelLocalVolume (FogVolume *volume) |
| Inject an analytic local fog volume using the camera from setCamera(). | |
| void | integrateFroxel (float lightR, float lightG, float lightB, float phaseScale=1.f) |
| Integrate the current froxel media using a uniform incident light. | |
| Result< int > | collectSceneLights3D (std::vector< VolumetricLight > &out, int maxCount=32) |
| Collect enabled Light3D with volumetric=true into froxel light snapshots. | |
| Result< void > | driveFromLight3D (Light3D *light, float viewportW, float viewportH) |
| Drive shaft UV/direction/color/intensity from one Light3D using setCamera(). Directional lights set lightDir; point lights aim from the camera toward the light and project the light position to screen UV for SS occlusion. | |
| Result< void > | driveFromPrimarySceneLight3D (float viewportW, float viewportH) |
| Drive shafts from the strongest volumetric Light3D currently in ECS. | |
| Result< void > | integrateFroxelFromSceneLights (float ambientR, float ambientG, float ambientB, const glm::vec3 &worldMin, const glm::vec3 &worldMax, int maxLights=16) |
| Integrate froxels with volumetric Light3D (+ emissive proxies) from ECS. Falls back to uniform ambient-only integrate when no volumetric lights are present. | |
| Result< int > | beginOcclusionMapFromSceneLights2D (Graphics *gfx, Canvas *canvasFilter=nullptr, float defaultRadiusPixels=24.f) |
| Clear the occlusion canvas and draw bright discs for every volumetric Light2D. Sets the primary (brightest) light UV for the first scatter pass. | |
| Result< int > | scatterFromSceneLights2D (Graphics *gfx, Texture *occlusion, Canvas *canvasFilter=nullptr) |
| Multi-pass screenspace scatter: one radial blur per volumetric Light2D. Uses additive blending so overlapping shafts accumulate. Spot lights upload their beam direction and cos(outer/inner) so shafts are masked to the flashlight cone; point lights leave the cone off (full radial). The occlusion texture must not be the active canvas's color target (Vulkan/WebGPU feedback rule). | |
| Result< void > | injectEmissiveLightProxy (float x, float y, float z, float r, float g, float b, float radius, float intensity) |
| Inject a one-shot emissive glow proxy into the froxel integrate light list. Accumulates until the next integrateFroxel / integrateFroxelFromSceneLights call. | |
| void | uploadFroxel (Graphics *gfx) |
| Upload integrated froxels into a slice atlas sampled by applyFroxel. | |
| void | applyFroxel (Graphics *gfx, Texture *linearDepth) |
| Composite the uploaded froxel volume over the current target using scene depth. | |
| void | applyFroxelTo (Graphics *gfx, Texture *linearDepth, Canvas *dest) |
| Composite the uploaded froxel volume into an explicit destination. | |
| Texture * | newLinearDepthTexture (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). | |
| Shader * | getShader () const |
| Returns the shader. | |
| Shader * | getRayMarchShader () const |
| Returns the ray march shader. | |
| Shader * | getFogShader () const |
| Returns the fog shader. | |
| Shader * | getCloudShader () const |
| Returns the cloud shader. | |
| Shader * | getFroxelShader () const |
| Returns the froxel shader. | |
| Texture * | getFroxelAtlas () const |
| Returns the froxel atlas. | |
详细描述
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)
- "cloud" — bounded procedural cloud layer with self-shadowing
Quality presets ("low" | "medium" | "high") control sample count and suggested downscale via resolutionFor().
在文件 Volumetric.h 第 38 行定义.
构造及析构函数说明
◆ Volumetric() [1/2]
|
explicit |
在文件 Volumetric.cpp 第 262 行定义.
◆ ~Volumetric()
|
default |
◆ Volumetric() [2/2]
|
delete |
成员函数说明
◆ applyFog()
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.cpp 第 710 行定义.
被这些函数引用 applyFogTo().
◆ applyFogTo()
Applies fog to.
在文件 Volumetric.cpp 第 715 行定义.
引用了 applyFog(), eve::graphics::Graphics::getCanvas() , 以及 eve::graphics::Graphics::setCanvas().
◆ applyFromScene()
Single-pass: treat source as the scene (bright regions ≈ light), add shafts + dust/fog onto it. Writes to current canvas.
在文件 Volumetric.cpp 第 682 行定义.
引用了 scene.
被这些函数引用 applyFromSceneTo().
◆ applyFromSceneTo()
Applies from scene to.
在文件 Volumetric.cpp 第 687 行定义.
引用了 applyFromScene(), eve::graphics::Graphics::getCanvas(), scene , 以及 eve::graphics::Graphics::setCanvas().
◆ applyFroxel()
Composite the uploaded froxel volume over the current target using scene depth.
在文件 Volumetric.cpp 第 850 行定义.
引用了 eve::graphics::Graphics::drawTexturedRectShaderDepth(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth() , 以及 eve::graphics::Canvas::getWidth().
被这些函数引用 applyFroxelTo().
◆ applyFroxelTo()
| void eve::graphics::Volumetric::applyFroxelTo | ( | Graphics * | gfx, |
| Texture * | linearDepth, | ||
| Canvas * | dest | ||
| ) |
Composite the uploaded froxel volume into an explicit destination.
在文件 Volumetric.cpp 第 860 行定义.
引用了 applyFroxel(), eve::graphics::Graphics::getCanvas() , 以及 eve::graphics::Graphics::setCanvas().
◆ 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.cpp 第 624 行定义.
引用了 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, r, setLightScreenPos() , 以及 w.
◆ beginOcclusionMapFromSceneLights2D()
| Result< int > eve::graphics::Volumetric::beginOcclusionMapFromSceneLights2D | ( | Graphics * | gfx, |
| Canvas * | canvasFilter = nullptr, |
||
| float | defaultRadiusPixels = 24.f |
||
| ) |
Clear the occlusion canvas and draw bright discs for every volumetric Light2D. Sets the primary (brightest) light UV for the first scatter pass.
- 参数
-
canvasFilter Optional canvas match; nullptr accepts lights with null canvas.
- 返回
- Number of discs drawn.
在文件 VolumetricLights.cpp 第 370 行定义.
引用了 eve::graphics::Canvas::clear(), d, eve::graphics::Graphics::drawSolidRect(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth(), eve::graphics::Canvas::getWidth(), h, eve::InvalidArgument, lights, px, py, r, setIntensity(), setLightScreenPos(), setShaftColor(), eve::Result< T >::success(), sx, sy , 以及 w.
◆ clearFroxelGrid()
| void eve::graphics::Volumetric::clearFroxelGrid | ( | ) |
Clear all media in the configured froxel grid.
在文件 Volumetric.cpp 第 767 行定义.
◆ collectSceneLights3D()
| Result< int > eve::graphics::Volumetric::collectSceneLights3D | ( | std::vector< VolumetricLight > & | out, |
| int | maxCount = 32 |
||
| ) |
Collect enabled Light3D with volumetric=true into froxel light snapshots.
- 参数
-
out Cleared then filled; not retained. maxCount Cap on collected lights (clamped to at least 1).
- 返回
- Number of lights written, or InvalidArgument when out storage is unusable. @thread Render/main thread with a live ECS world.
在文件 VolumetricLights.cpp 第 199 行定义.
引用了 a, b, d, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, light, n, eve::graphics::VolumetricLight::position, s, score, eve::Result< T >::success() , 以及 view.
被这些函数引用 integrateFroxelFromSceneLights().
◆ configureFroxelGrid()
| void eve::graphics::Volumetric::configureFroxelGrid | ( | int | width, |
| int | height, | ||
| int | depth, | ||
| float | nearDistance, | ||
| float | farDistance | ||
| ) |
Configure the CPU reference/fallback froxel grid used by the atlas renderer. Quality presets choose suitable defaults, but explicit dimensions are useful for tests.
在文件 Volumetric.cpp 第 758 行定义.
◆ drawOccluder()
| void eve::graphics::Volumetric::drawOccluder | ( | Graphics * | gfx, |
| Drawable * | drawable, | ||
| const glm::mat4 & | matrix | ||
| ) |
Drawable occlusion (respects Drawable::getCastOcclusion).
在文件 Volumetric.cpp 第 636 行定义.
◆ 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.cpp 第 652 行定义.
引用了 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.cpp 第 641 行定义.
引用了 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 | ||
| ) |
Draws occluder texture.
在文件 Volumetric.cpp 第 646 行定义.
引用了 eve::graphics::Graphics::drawOcclusionTexture(), h, w, x , 以及 y.
◆ driveFromLight3D()
| Result< void > eve::graphics::Volumetric::driveFromLight3D | ( | Light3D * | light, |
| float | viewportW, | ||
| float | viewportH | ||
| ) |
Drive shaft UV/direction/color/intensity from one Light3D using setCamera(). Directional lights set lightDir; point lights aim from the camera toward the light and project the light position to screen UV for SS occlusion.
- 参数
-
light Borrowed; not retained. viewportW Viewport width in pixels; must be positive. viewportH Viewport height in pixels; must be positive.
- 返回
- Success or InvalidArgument / NotFound.
在文件 VolumetricLights.cpp 第 239 行定义.
引用了 d, dir, eve::Diagnostic::error(), eye, eve::Result< T >::failure(), eve::InvalidArgument, light, eve::NotFound, setIntensity(), setLightDirection(), setLightScreenUV(), setShaftColor(), eve::Result< T >::success(), u, v , 以及 viewProj.
被这些函数引用 driveFromPrimarySceneLight3D().
◆ driveFromPrimarySceneLight3D()
| Result< void > eve::graphics::Volumetric::driveFromPrimarySceneLight3D | ( | float | viewportW, |
| float | viewportH | ||
| ) |
Drive shafts from the strongest volumetric Light3D currently in ECS.
- 返回
- Success, NotFound when none exist, or InvalidArgument for bad viewport.
在文件 VolumetricLights.cpp 第 286 行定义.
引用了 best, d, driveFromLight3D(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, score , 以及 view.
◆ getAnisotropy()
| float eve::graphics::Volumetric::getAnisotropy | ( | ) | const |
Current raymarch anisotropy.
在文件 VolumetricLights.cpp 第 197 行定义.
◆ getAtmosphereVolume()
|
inline |
Access the froxel media grid for native density/light injection.
在文件 Volumetric.h 第 213 行定义.
被这些函数引用 eve::graphics::fog::FogSystem::injectToVolumetric() , 以及 eve::graphics::fog::FogSystem::syncToVolumetric().
◆ getCloudShader()
|
inline |
Returns the cloud shader.
在文件 Volumetric.h 第 329 行定义.
◆ getDownscale()
|
inline |
Returns the downscale.
在文件 Volumetric.h 第 135 行定义.
◆ getFloat()
| float eve::graphics::Volumetric::getFloat | ( | const std::string & | name | ) | const |
Returns the float.
在文件 Volumetric.cpp 第 527 行定义.
引用了 eve::graphics::Shader::getFromVar(), eve::graphics::Shader::hasUniform(), name , 以及 v.
被这些函数引用 eve::daynight::DayNight::applyAtmosphere(), getLightScreenU(), getLightScreenV() , 以及 getSampleCount().
◆ getFogShader()
|
inline |
Returns the fog shader.
在文件 Volumetric.h 第 327 行定义.
◆ getFroxelAtlas()
|
inline |
Returns the froxel atlas.
在文件 Volumetric.h 第 333 行定义.
◆ getFroxelShader()
|
inline |
Returns the froxel shader.
在文件 Volumetric.h 第 331 行定义.
◆ getInvViewProj()
|
inline |
Inverse view-projection last written by setCamera / setInvViewProj.
在文件 Volumetric.h 第 215 行定义.
被这些函数引用 eve::graphics::fog::FogSystem::injectToVolumetric() , 以及 eve::graphics::fog::FogSystem::syncToVolumetric().
◆ getLightScreenU()
| float eve::graphics::Volumetric::getLightScreenU | ( | ) | const |
◆ getLightScreenV()
| float eve::graphics::Volumetric::getLightScreenV | ( | ) | const |
◆ getMode()
|
inline |
◆ getQuality()
|
inline |
◆ getRayMarchShader()
|
inline |
Returns the ray march shader.
在文件 Volumetric.h 第 325 行定义.
◆ getSampleCount()
| int eve::graphics::Volumetric::getSampleCount | ( | ) | const |
◆ getShader()
|
inline |
◆ hasParam()
| bool eve::graphics::Volumetric::hasParam | ( | const std::string & | name | ) | const |
◆ injectEmissiveLightProxy()
| Result< void > eve::graphics::Volumetric::injectEmissiveLightProxy | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | r, | ||
| float | g, | ||
| float | b, | ||
| float | radius, | ||
| float | intensity | ||
| ) |
Inject a one-shot emissive glow proxy into the froxel integrate light list. Accumulates until the next integrateFroxel / integrateFroxelFromSceneLights call.
在文件 VolumetricLights.cpp 第 454 行定义.
引用了 b, eve::Diagnostic::error(), eve::Result< T >::failure(), g, eve::InvalidArgument, light, eve::graphics::VolumetricLight::position, r, radius, eve::Result< T >::success(), x, y , 以及 z.
◆ injectFroxelHeightFog()
| void eve::graphics::Volumetric::injectFroxelHeightFog | ( | float | extinction, |
| float | albedoR, | ||
| float | albedoG, | ||
| float | albedoB, | ||
| float | baseHeight, | ||
| float | heightFalloff, | ||
| float | minWorldY, | ||
| float | maxWorldY | ||
| ) |
Inject an exponential global height layer into the froxel grid.
在文件 Volumetric.cpp 第 769 行定义.
引用了 extinction.
◆ injectFroxelLocalVolume()
| void eve::graphics::Volumetric::injectFroxelLocalVolume | ( | FogVolume * | volume | ) |
Inject an analytic local fog volume using the camera from setCamera().
在文件 Volumetric.cpp 第 777 行定义.
引用了 volume.
◆ integrateFroxel()
| void eve::graphics::Volumetric::integrateFroxel | ( | float | lightR, |
| float | lightG, | ||
| float | lightB, | ||
| float | phaseScale = 1.f |
||
| ) |
◆ integrateFroxelFromSceneLights()
| Result< void > eve::graphics::Volumetric::integrateFroxelFromSceneLights | ( | float | ambientR, |
| float | ambientG, | ||
| float | ambientB, | ||
| const glm::vec3 & | worldMin, | ||
| const glm::vec3 & | worldMax, | ||
| int | maxLights = 16 |
||
| ) |
Integrate froxels with volumetric Light3D (+ emissive proxies) from ECS. Falls back to uniform ambient-only integrate when no volumetric lights are present.
- 参数
-
worldMin World AABB min represented by the froxel grid. worldMax World AABB max represented by the froxel grid.
在文件 VolumetricLights.cpp 第 311 行定义.
引用了 a, ambient, ambientB, ambientG, ambientR, b, collectSceneLights3D(), eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, light, lights, n, s, scene, score , 以及 eve::Result< T >::success().
◆ 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.
- 参数
-
depth01 Float.
在文件 Volumetric.cpp 第 868 行定义.
引用了 b, d, height, eve::graphics::Graphics::newTexture(), width, x , 以及 y.
◆ operator=()
|
delete |
◆ projectDirectionalCookie()
| Result< void > eve::graphics::Volumetric::projectDirectionalCookie | ( | Graphics * | gfx, |
| Texture * | depth, | ||
| Texture * | cookie, | ||
| float | worldSize, | ||
| float | intensity = 1.f |
||
| ) |
Project a repeating directional-light cookie over visible scene surfaces.
- 参数
-
gfx Borrowed graphics provider used synchronously. depth Hardware depth texture used to reconstruct world positions. cookie Borrowed repeating RGB cookie sampled synchronously. worldSize Cookie repeat size in world units; must be positive. intensity Non-negative overlay intensity.
- 返回
- Success or InvalidArgument; validation completes before drawing. @thread Render thread only; no argument is retained.
在文件 Volumetric.cpp 第 724 行定义.
引用了 depth, eve::graphics::Graphics::drawTexturedRectShaderDepth(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), eve::graphics::Graphics::getWidth(), eve::graphics::Canvas::getWidth(), height, eve::InvalidArgument, eve::graphics::Shader::sendFloat(), eve::graphics::Shader::sendMatrix(), eve::Result< T >::success() , 以及 width.
◆ rayMarch()
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.cpp 第 696 行定义.
被这些函数引用 rayMarchTo().
◆ rayMarchTo()
Ray march to.
在文件 Volumetric.cpp 第 701 行定义.
引用了 eve::graphics::Graphics::getCanvas(), rayMarch() , 以及 eve::graphics::Graphics::setCanvas().
◆ renderClouds()
Render the bounded cloud layer using scene linear depth for occlusion.
在文件 Volumetric.cpp 第 744 行定义.
被这些函数引用 renderCloudsTo().
◆ renderCloudsTo()
| void eve::graphics::Volumetric::renderCloudsTo | ( | Graphics * | gfx, |
| Texture * | linearDepth, | ||
| Canvas * | dest | ||
| ) |
Renders clouds to.
在文件 Volumetric.cpp 第 749 行定义.
引用了 eve::graphics::Graphics::getCanvas(), renderClouds() , 以及 eve::graphics::Graphics::setCanvas().
◆ 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.cpp 第 562 行定义.
◆ scatter()
Scatter-only: occlusion → shafts with alpha (draw over a prior scene). Writes to the currently bound canvas / screen.
在文件 Volumetric.cpp 第 668 行定义.
被这些函数引用 scatterTo().
◆ scatterFromSceneLights2D()
| Result< int > eve::graphics::Volumetric::scatterFromSceneLights2D | ( | Graphics * | gfx, |
| Texture * | occlusion, | ||
| Canvas * | canvasFilter = nullptr |
||
| ) |
Multi-pass screenspace scatter: one radial blur per volumetric Light2D. Uses additive blending so overlapping shafts accumulate. Spot lights upload their beam direction and cos(outer/inner) so shafts are masked to the flashlight cone; point lights leave the cone off (full radial). The occlusion texture must not be the active canvas's color target (Vulkan/WebGPU feedback rule).
- 返回
- Number of scatter passes executed.
在文件 VolumetricLights.cpp 第 415 行定义.
引用了 eve::Additive, d, eve::graphics::Graphics::drawTexturedRectShaderUV(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::graphics::Graphics::getCanvas(), eve::graphics::Graphics::getHeight(), eve::graphics::Canvas::getHeight(), getShader(), eve::graphics::Canvas::getTexture(), eve::graphics::Graphics::getWidth(), eve::graphics::Canvas::getWidth(), h, eve::InvalidArgument, lights, setIntensity(), setLightScreenPos(), setShaftColor(), eve::Result< T >::success(), sx, sy , 以及 w.
◆ scatterTo()
Same as scatter but into an explicit destination.
在文件 Volumetric.cpp 第 673 行定义.
引用了 eve::graphics::Graphics::getCanvas(), scatter() , 以及 eve::graphics::Graphics::setCanvas().
◆ setAnisotropy()
| void eve::graphics::Volumetric::setAnisotropy | ( | float | g | ) |
Henyey–Greenstein anisotropy for raymarch shafts in [-0.99, 0.99]. Positive values produce forward-scattering god rays; negative back-scatters.
在文件 VolumetricLights.cpp 第 192 行定义.
引用了 g.
◆ 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.cpp 第 403 行定义.
引用了 fovRad, eve::graphics::perspectiveVulkanRH_ZO(), proj, eve::graphics::Shader::sendFloat(), setInvViewProj(), targetX , 以及 view.
◆ setCloudCoverage()
| void eve::graphics::Volumetric::setCloudCoverage | ( | float | coverage | ) |
Cloud cover fraction in [0,1].
在文件 Volumetric.cpp 第 485 行定义.
◆ setCloudDensity()
| void eve::graphics::Volumetric::setCloudDensity | ( | float | density | ) |
Cloud density multiplier, clamped non-negative.
在文件 Volumetric.cpp 第 490 行定义.
◆ setCloudLayer()
| void eve::graphics::Volumetric::setCloudLayer | ( | float | bottom, |
| float | top | ||
| ) |
Set cloud layer world-space bottom and top heights.
在文件 Volumetric.cpp 第 478 行定义.
引用了 bottom, eve::graphics::Shader::sendFloat() , 以及 top.
◆ setCloudLightColor()
| void eve::graphics::Volumetric::setCloudLightColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
Direct sunlight color used by cloud single scattering.
在文件 Volumetric.cpp 第 506 行定义.
引用了 b, g, r , 以及 eve::graphics::Shader::sendFloat().
◆ setCloudScale()
| void eve::graphics::Volumetric::setCloudScale | ( | float | worldScale | ) |
Horizontal size of procedural cloud features in world units.
在文件 Volumetric.cpp 第 495 行定义.
◆ setCloudWind()
| void eve::graphics::Volumetric::setCloudWind | ( | float | x, |
| float | z | ||
| ) |
Cloud wind velocity in world X/Z units per second.
在文件 Volumetric.cpp 第 500 行定义.
引用了 eve::graphics::Shader::sendFloat(), x , 以及 z.
◆ setDensity()
| void eve::graphics::Volumetric::setDensity | ( | float | density | ) |
Sets the density.
在文件 Volumetric.cpp 第 447 行定义.
引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 eve::graphics::applyWaterUnderwaterFog().
◆ setFloat()
| void eve::graphics::Volumetric::setFloat | ( | const std::string & | name, |
| float | value | ||
| ) |
Sets the float.
在文件 Volumetric.cpp 第 519 行定义.
引用了 eve::graphics::Shader::hasUniform(), name, eve::graphics::Shader::sendFloat() , 以及 value.
被这些函数引用 setDensity(), setFogColor(), setIntensity(), setLightScreenUV(), setShaftColor() , 以及 setTime().
◆ setFogColor()
| void eve::graphics::Volumetric::setFogColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
Sets the fog color.
在文件 Volumetric.cpp 第 430 行定义.
引用了 b, g, r, eve::graphics::Shader::sendFloat() , 以及 setFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 eve::graphics::applyWaterUnderwaterFog().
◆ setFogEnd()
| void eve::graphics::Volumetric::setFogEnd | ( | float | endDistance | ) |
Sets the fog end.
在文件 Volumetric.cpp 第 468 行定义.
引用了 eve::graphics::Shader::sendFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 eve::graphics::applyWaterUnderwaterFog().
◆ setFogHeight()
| void eve::graphics::Volumetric::setFogHeight | ( | float | worldY | ) |
Height fog: denser near world Y = fogHeight; falloff is 1/meters scale.
在文件 Volumetric.cpp 第 453 行定义.
◆ setFogHeightFalloff()
| void eve::graphics::Volumetric::setFogHeightFalloff | ( | float | falloff | ) |
◆ setFogNoise()
| void eve::graphics::Volumetric::setFogNoise | ( | float | amount | ) |
◆ setFogStart()
| void eve::graphics::Volumetric::setFogStart | ( | float | startDistance | ) |
View-distance ramp where fog appears (world units along the ray).
在文件 Volumetric.cpp 第 463 行定义.
引用了 eve::graphics::Shader::sendFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 eve::graphics::applyWaterUnderwaterFog().
◆ setIntensity()
| void eve::graphics::Volumetric::setIntensity | ( | float | intensity | ) |
Sets the intensity.
在文件 Volumetric.cpp 第 439 行定义.
引用了 eve::graphics::Shader::sendFloat() , 以及 setFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere(), beginOcclusionMapFromSceneLights2D(), driveFromLight3D() , 以及 scatterFromSceneLights2D().
◆ setInvViewProj()
| void eve::graphics::Volumetric::setInvViewProj | ( | const glm::mat4 & | invViewProj | ) |
Raw inverse view-projection (column-major, matching glm).
在文件 Volumetric.cpp 第 396 行定义.
引用了 invViewProj , 以及 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.cpp 第 380 行定义.
引用了 d, dx, dy, dz , 以及 eve::graphics::Shader::sendFloat().
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 driveFromLight3D().
◆ setLightScreenPos()
| void eve::graphics::Volumetric::setLightScreenPos | ( | float | x, |
| float | y, | ||
| float | width, | ||
| float | height | ||
| ) |
Pixel-space helper (converts with width/height).
在文件 Volumetric.cpp 第 374 行定义.
引用了 height, setLightScreenUV(), width, x , 以及 y.
被这些函数引用 beginOcclusionMap(), beginOcclusionMapFromSceneLights2D() , 以及 scatterFromSceneLights2D().
◆ setLightScreenUV()
| void eve::graphics::Volumetric::setLightScreenUV | ( | float | u, |
| float | v | ||
| ) |
Light position in UV (0..1), origin top-left to match 2D UVs.
在文件 Volumetric.cpp 第 364 行定义.
引用了 eve::graphics::Shader::sendFloat(), setFloat(), u , 以及 v.
被这些函数引用 driveFromLight3D() , 以及 setLightScreenPos().
◆ setMode()
| void eve::graphics::Volumetric::setMode | ( | const std::string & | mode | ) |
"screenspace" | "raymarch" | "fog" | "froxel" | "cloud".
在文件 Volumetric.cpp 第 350 行定义.
被这些函数引用 eve::daynight::DayNight::applyAtmosphere() , 以及 eve::graphics::applyWaterUnderwaterFog().
◆ setQuality()
| void eve::graphics::Volumetric::setQuality | ( | const std::string & | quality | ) |
"low" | "medium" | "high" (unknown → medium).
在文件 Volumetric.cpp 第 345 行定义.
◆ setShaftColor()
| void eve::graphics::Volumetric::setShaftColor | ( | float | r, |
| float | g, | ||
| float | b | ||
| ) |
Sets the shaft color.
在文件 Volumetric.cpp 第 421 行定义.
引用了 b, g, r, eve::graphics::Shader::sendFloat() , 以及 setFloat().
被这些函数引用 beginOcclusionMapFromSceneLights2D(), driveFromLight3D() , 以及 scatterFromSceneLights2D().
◆ setTime()
| void eve::graphics::Volumetric::setTime | ( | float | seconds | ) |
◆ uploadFroxel()
| void eve::graphics::Volumetric::uploadFroxel | ( | Graphics * | gfx | ) |
Upload integrated froxels into a slice atlas sampled by applyFroxel.
在文件 Volumetric.cpp 第 813 行定义.
引用了 d, eve::graphics::Texture::getHeight(), eve::graphics::Texture::getWidth(), h, eve::graphics::Graphics::newTexture(), offset, ox, oy, eve::graphics::Shader::sendFloat(), u, eve::graphics::Graphics::updateTexture(), value, w, x, y , 以及 z.
该类的文档由以下文件生成:
- src/modules/graphics/Volumetric.h
- src/modules/graphics/Volumetric.cpp
- src/modules/graphics/VolumetricLights.cpp