Buffer-level screen-space fluid renderer. 更多...
#include <FluidSurfaceRenderer.h>
Public 成员函数 | |
| FluidSurfaceRenderer (const FluidSurfaceParams ¶ms, bool preferGpu) | |
| Fluid surface renderer. | |
| ~FluidSurfaceRenderer () | |
| Fluid surface renderer. | |
| FluidSurfaceRenderer (const FluidSurfaceRenderer &)=delete | |
| FluidSurfaceRenderer & | operator= (const FluidSurfaceRenderer &)=delete |
| void | render (const std::vector< glm::vec3 > &positions, float particleRadius) |
| Reconstruct a frame from particle positions. | |
| void | render (const FluidSimulator &sim) |
| Reconstruct a frame from a simulator's live particles. | |
| void | renderVolume (const VolumeFluid &sim) |
| Reconstructs a volume-fluid snapshot and shades its diffusing particle colors. | |
| Result< void > | renderVolumeInterpolated (const VolumeFluid &sim, float alpha) |
| Reconstructs from fixed-step interpolated volume positions using the existing SSF pipeline. | |
| void | renderVolumeColorOnly (const VolumeFluid &sim) |
| Reconstructs only the RGBA output for display, skipping auxiliary GPU readback when color is uniform. | |
| Result< void > | renderGasVolume (const VolumeFluid &sim, float absorption=5.f) |
| Renders gas particles as a blurred, translucent thickness volume. | |
| Result< void > | renderVolumeWithoutSurface (const VolumeFluid &sim, float absorption=5.f) |
| Renders every material phase as a blurred color/thickness volume without reconstructing a surface. | |
| Result< void > | renderConfiguredVolume (const VolumeFluid &sim) |
| Renders through Fluid3D's configured generateSurface policy. | |
| Result< void > | prepare () |
| Prepares the preferred reconstruction backend before frame timing begins. | |
| Result< void > | copyToTexture (graphics::Graphics *graphics, graphics::Texture *texture) |
| Present the current RGBA8 result into an existing graphics texture. | |
| Result< void > | renderVolumeColorToTexture (const VolumeFluid &sim, graphics::Graphics *graphics, graphics::Texture *texture) |
| Reconstruct and present a uniform-color volume without host color readback when supported. | |
| Result< void > | compositeDiffuse (const VolumeFluidDiffuse &pool, float radius, float opacity, float fadeSeconds) |
| Composites white secondary particles over the last reconstructed frame. | |
| Result< void > | configureFoam (bool enabled, int downsample=1) |
| Configures Fluid3D-compatible foam generation visibility and render-target downsampling. | |
| Result< void > | occludeWithSceneDepth (std::span< const float > sceneDepth, float depthBias=0.001f) |
| Removes fluid and diffuse color hidden by borrowed linear scene depth. | |
| Result< void > | compositeSceneRefraction (std::span< const uint8_t > sceneColor, float distortion=8.f, float absorption=3.f) |
| Refracts a matching opaque RGBA8 scene through the current liquid surface. | |
| Result< void > | configureRefraction (float transparency, float absorption, float coefficient, int downsample) |
| Configure Fluid3D-compatible scene refraction controls atomically. | |
| Result< void > | configureRefractionEnabled (bool enabled) |
| Enables or disables Fluid3D's configured refraction stage without losing its controls. | |
| Result< void > | compositeConfiguredSceneRefraction (std::span< const uint8_t > sceneColor) |
| Apply the configured Fluid3D-compatible refraction to a matching opaque RGBA8 scene. | |
| Result< void > | configureSurfaceBlend (int source, int destination) |
| Atomically configures Fluid3D's final surface source and destination blend factors. | |
| Result< void > | compositeConfiguredSurfaceBlend (std::span< const uint8_t > sceneColor) |
| Composites the current surface over a matching RGBA8 scene using the configured Fluid3D factors. | |
| Result< void > | configureParticleBlend (int source, int destination, bool depthWrite) |
| Configures Fluid3D's particle-color target blending and depth writes atomically. | |
| Result< void > | configureSurface (float thicknessScale, float thicknessCutoff, float depthFalloff, int smoothIterations) |
| Atomically configures thickness reconstruction and surface smoothing. | |
| Result< void > | configureSurfaceEnabled (bool enabled) |
| Enables or disables Fluid3D's generateSurface policy for renderConfiguredVolume. | |
| Result< void > | configureRendererSettings (const FluidRendererSettings &settings) |
| Validates and atomically applies every Fluid3DRendererSettings field. | |
| FluidRendererSettings | rendererSettings () const noexcept |
| Returns an owning snapshot of the current Fluid3D renderer settings without allocation. | |
| Result< void > | configureSurfaceBlurRadius (float radius) |
| Sets Fluid3D's world-space surface blur radius for subsequent reconstruction. | |
| Result< void > | configureMaterial (bool lighting, float smoothness, float metalness, float ambientMultiplier, float reflection, float opacity) |
| Atomically configures lighting and material response for subsequent liquid frames. | |
| Result< void > | configureReflection (bool enabled) |
| Enables or disables the configured reflection contribution without losing its coefficient. | |
| Result< void > | configureColors (const glm::vec3 &baseColor, const glm::vec3 &reflectionColor) |
| Sets the linear RGB base and reflection colors atomically. | |
| Result< void > | configureAnisotropy (bool enabled) |
| Enables oriented-ellipsoid projection for volume-fluid particles. | |
| Result< void > | configureSurfaceDownsample (int factor) |
| Configures Fluid3D-style surface target downsampling. | |
| Result< void > | configureThicknessDownsample (int factor) |
| Sets the independently reconstructed liquid-thickness target divisor. | |
| Result< void > | configureProjection (bool orthographic, float verticalHalfSize=1.f) |
| Selects perspective or orthographic reconstruction for subsequent frames. | |
| void | renderFrom (FluidSimulator *sim) |
| Script-friendly wrapper: render(*sim) with a null check. | |
| int | getWidth () const |
| Returns the width. | |
| int | getHeight () const |
| Returns the height. | |
| const std::vector< float > & | depth () const |
| Linear view depth per pixel (FLT_MAX where no fluid). | |
| const std::vector< glm::vec3 > & | normals () const |
| View-space normals (0 where no fluid). | |
| const std::vector< float > & | thickness () const |
| Accumulated thickness per pixel. | |
| const std::vector< uint8_t > & | color () const |
| RGBA8 shaded output. | |
| bool | usingGpu () const |
| Using gpu. | |
| void | setMode (int mode) |
| Switch shading: 0 water, 1 mud. | |
| void | setCamera (const glm::vec3 &eye, const glm::vec3 &target, const glm::vec3 &up, float fovYDeg) |
| Update the camera. | |
| void | writePpm (const std::string &path) const |
| Write the color buffer as a PPM image (debug artifact). | |
详细描述
Buffer-level screen-space fluid renderer.
在文件 FluidSurfaceRenderer.h 第 103 行定义.
构造及析构函数说明
◆ FluidSurfaceRenderer() [1/2]
| eve::fluids::FluidSurfaceRenderer::FluidSurfaceRenderer | ( | const FluidSurfaceParams & | params, |
| bool | preferGpu | ||
| ) |
Fluid surface renderer.
- 参数
-
params camera / resolution / material tuning. preferGpu use compute kernels when a device is available.
在文件 FluidSurfaceRenderer.cpp 第 48 行定义.
引用了 eve::fluids::FluidSurfaceParams::aspect, eve::fluids::FluidSurfaceParams::height, pixels , 以及 eve::fluids::FluidSurfaceParams::width.
◆ ~FluidSurfaceRenderer()
| eve::fluids::FluidSurfaceRenderer::~FluidSurfaceRenderer | ( | ) |
Fluid surface renderer.
在文件 FluidSurfaceRenderer.cpp 第 62 行定义.
◆ FluidSurfaceRenderer() [2/2]
|
delete |
成员函数说明
◆ color()
|
inline |
◆ compositeConfiguredSceneRefraction()
| Result< void > eve::fluids::FluidSurfaceRenderer::compositeConfiguredSceneRefraction | ( | std::span< const uint8_t > | sceneColor | ) |
Apply the configured Fluid3D-compatible refraction to a matching opaque RGBA8 scene.
- 参数
-
sceneColor Borrowed width*height*4 background bytes.
- 返回
- Success after one bounded composition, or failure before color mutation.
Reuses an owned target no larger than the output, submits no GPU work and retains no input.
在文件 VolumeFluidSurface.cpp 第 46 行定义.
引用了 at, eve::Diagnostic::error(), eve::Result< T >::failure(), height, eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, pixels, eve::PreconditionViolation, px, py, source, sourceX, eve::Result< T >::success(), u, v, width, eve::fluids::FluidSurfaceParams::width, x , 以及 y.
◆ compositeConfiguredSurfaceBlend()
| Result< void > eve::fluids::FluidSurfaceRenderer::compositeConfiguredSurfaceBlend | ( | std::span< const uint8_t > | sceneColor | ) |
Composites the current surface over a matching RGBA8 scene using the configured Fluid3D factors.
- 参数
-
sceneColor Borrowed width*height*4 destination bytes; never retained.
- 返回
- Success after one bounded linear host pass, or failure before output mutation.
Supports every Unity BlendMode factor without creating parameterized Vulkan pipelines. Render-thread affine. The resident color-only GPU path is rejected because host RGBA is not current. @ownership No ownership transfer occurs. @lifetime The input span is borrowed only for this synchronous call and is never retained. @thread Render-thread affine; do not race with rendering or presentation.
在文件 FluidSurfaceBlend.cpp 第 39 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, offset, eve::PreconditionViolation, source, eve::Result< T >::success() , 以及 eve::fluids::FluidSurfaceParams::width.
◆ compositeDiffuse()
| Result< void > eve::fluids::FluidSurfaceRenderer::compositeDiffuse | ( | const VolumeFluidDiffuse & | pool, |
| float | radius, | ||
| float | opacity, | ||
| float | fadeSeconds | ||
| ) |
Composites white secondary particles over the last reconstructed frame.
- 参数
-
pool Borrowed secondary particles; no pointer is retained or state advanced. radius World-space splat radius in (0,1]. opacity Peak alpha in [0,1]. fadeSeconds Remaining-life interval in (0,86400] used for fading.
Render-thread affine, no concurrent calls or callbacks. Call after render/renderVolume with the same camera, before image upload. Modifies only RGBA output, preserving liquid depth/normals/thickness. Tests liquid depth, not external scene geometry. Repeated calls accumulate until the next render. Preflights at most 4M covered bounding-box pixels; failure leaves color intact. Uses CPU buffers already read back by SSF; no new GPU submission or readback.
在文件 VolumeFluidFoamSurface.cpp 第 17 行定义.
引用了 at, c, color(), eve::fluids::VolumeFluidDiffuse::copyRenderData(), dx, dy, eve::Diagnostic::error(), eve::fluids::FluidSurfaceParams::eye, eve::Result< T >::failure(), eve::fluids::FluidSurfaceParams::farZ, eve::fluids::FluidSurfaceParams::fovYDeg, height, eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, message, eve::fluids::FluidSurfaceParams::nearZ, opacity, p, eve::fluids::VolumeFluidDiffuse::particleCount(), q, radius, s, eve::Result< T >::success(), sx, sy, tangent, eve::fluids::FluidSurfaceParams::target, eve::fluids::FluidSurfaceParams::up, v, value, view, width, eve::fluids::FluidSurfaceParams::width, x , 以及 y.
◆ compositeSceneRefraction()
| Result< void > eve::fluids::FluidSurfaceRenderer::compositeSceneRefraction | ( | std::span< const uint8_t > | sceneColor, |
| float | distortion = 8.f, |
||
| float | absorption = 3.f |
||
| ) |
Refracts a matching opaque RGBA8 scene through the current liquid surface.
- 参数
-
sceneColor Borrowed width*height*4 RGBA8 background; it is never retained. distortion Maximum screen-space displacement in pixels, in [0,64]. absorption Beer-Lambert absorption coefficient in [0,30].
- 返回
- Success, or a structured error before any output mutation.
Render-thread affine. Call after a full render/renderVolume. Performs one allocation-free bounded pixel pass, modifies only RGBA output, and submits no GPU work. The color-only GPU fast path is rejected because it has no current host auxiliaries.
在文件 FluidSurfaceRenderer.cpp 第 520 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, pixels, eve::PreconditionViolation, eve::Result< T >::success(), sx, sy, u, eve::fluids::FluidSurfaceParams::width, x , 以及 y.
◆ configureAnisotropy()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureAnisotropy | ( | bool | enabled | ) |
Enables oriented-ellipsoid projection for volume-fluid particles.
- 参数
-
enabled When true, renderVolume uses particle radii and orientations.
- 返回
- Success. GPU resources are created lazily on the next nonempty frame.
The disabled path performs no shape copy, anisotropy preprocessing, extra upload or dispatch. Enabling replaces the spherical splat dispatch; it does not add a second dispatch. Render-thread affine.
在文件 FluidSurfaceRenderer.cpp 第 714 行定义.
引用了 enabled , 以及 eve::Result< T >::success().
◆ configureColors()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureColors | ( | const glm::vec3 & | baseColor, |
| const glm::vec3 & | reflectionColor | ||
| ) |
Sets the linear RGB base and reflection colors atomically.
- 参数
-
baseColor Linear RGB base color with finite channels in [0,1]. reflectionColor Linear RGB reflection tint with finite channels in [0,1].
- 返回
- Success, or a structured error without changing prior configuration.
在文件 FluidSurfaceRenderer.cpp 第 698 行定义.
引用了 c, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::Result< T >::success() , 以及 valid.
◆ configureFoam()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureFoam | ( | bool | enabled, |
| int | downsample = 1 |
||
| ) |
Configures Fluid3D-compatible foam generation visibility and render-target downsampling.
- 参数
-
enabled When false, compositeDiffuse returns success without touching the current frame. downsample Integer foam target divisor in [1,4].
- 返回
- Success, or invalid argument without changing prior configuration.
Render-thread affine. Configuration allocates nothing. Factors above one reduce particle splat visits on each axis, reuse one owned scalar coverage target, then composite through one linear output pass.
在文件 VolumeFluidFoamSurface.cpp 第 8 行定义.
引用了 enabled, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ configureMaterial()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureMaterial | ( | bool | lighting, |
| float | smoothness, | ||
| float | metalness, | ||
| float | ambientMultiplier, | ||
| float | reflection, | ||
| float | opacity | ||
| ) |
Atomically configures lighting and material response for subsequent liquid frames.
- 参数
-
lighting Enables diffuse and specular lighting. smoothness Specular smoothness in [0,1]. metalness Reflection tint metalness in [0,1]. ambientMultiplier Ambient contribution in [0,6]. reflection Fresnel reflection coefficient in [0,1]. opacity Thickness-to-alpha coefficient in [0,30].
- 返回
- Success, or a structured error without changing prior configuration.
在文件 FluidSurfaceRenderer.cpp 第 662 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, lighting, opacity, eve::Result< T >::success(), unit , 以及 value.
◆ configureParticleBlend()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureParticleBlend | ( | int | source, |
| int | destination, | ||
| bool | depthWrite | ||
| ) |
Configures Fluid3D's particle-color target blending and depth writes atomically.
- 参数
-
source Unity BlendMode integer in [0,10]. destination Unity BlendMode integer in [0,10]. depthWrite When true, only the nearest particle-color fragment at each pixel survives.
- 返回
- Success, or invalid argument without changing the prior configuration.
Enabling this explicit package path disables the uniform-color shortcut because overlap order affects the result. It reuses the existing tint and weight arrays and creates no GPU resources or passes. @ownership No external resource is accepted or retained. @lifetime The values live with this renderer. @thread Render-thread affine; do not race configuration with rendering.
在文件 FluidSurfaceBlend.cpp 第 69 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::fluids::OneMinusSourceAlpha, source, eve::Result< T >::success() , 以及 eve::fluids::Zero.
◆ configureProjection()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureProjection | ( | bool | orthographic, |
| float | verticalHalfSize = 1.f |
||
| ) |
Selects perspective or orthographic reconstruction for subsequent frames.
- 参数
-
orthographic Enables an orthographic camera matching Fluid3D camera setup. verticalHalfSize Positive orthographic world-space half height in [0.001,10000].
- 返回
- Success, or invalid argument without changing the prior projection.
Render-thread affine. Reuses existing buffers and push constants; no GPU resource is created.
在文件 FluidSurfaceRenderer.cpp 第 134 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::fluids::FluidSurfaceParams::orthographic, eve::fluids::FluidSurfaceParams::orthographicSize , 以及 eve::Result< T >::success().
◆ configureReflection()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureReflection | ( | bool | enabled | ) |
Enables or disables the configured reflection contribution without losing its coefficient.
- 参数
-
enabled Matches Fluid3D's generateReflection renderer setting.
- 返回
- Success. No resource is created and the current output is unchanged until the next render.
Render-thread affine. Disabling reflection makes the next shaded frame omit its Fresnel reflection; enabling it restores the coefficient last supplied to configureMaterial.
在文件 FluidSurfaceRenderer.cpp 第 690 行定义.
引用了 enabled , 以及 eve::Result< T >::success().
◆ configureRefraction()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureRefraction | ( | float | transparency, |
| float | absorption, | ||
| float | coefficient, | ||
| int | downsample | ||
| ) |
Configure Fluid3D-compatible scene refraction controls atomically.
- 参数
-
transparency Blend between particle color and refracted scene in [0,1]. absorption Per-channel Beer-Lambert coefficient in [0,30]. coefficient Signed normalized-screen bend coefficient in [-0.1,0.1]. downsample Refraction scene target divisor in [1,4].
- 返回
- Success, or invalid argument without changing prior configuration.
在文件 VolumeFluidSurface.cpp 第 26 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ configureRefractionEnabled()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureRefractionEnabled | ( | bool | enabled | ) |
Enables or disables Fluid3D's configured refraction stage without losing its controls.
- 参数
-
enabled When false, compositeConfiguredSceneRefraction is a zero-work no-op.
- 返回
- Success. The current frame and owned scratch are unchanged.
Render-thread affine; no allocation, scene copy or GPU work occurs during configuration.
在文件 VolumeFluidSurface.cpp 第 41 行定义.
引用了 enabled , 以及 eve::Result< T >::success().
◆ configureRendererSettings()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureRendererSettings | ( | const FluidRendererSettings & | settings | ) |
Validates and atomically applies every Fluid3DRendererSettings field.
- 参数
-
settings Owning value borrowed for this render-thread call only.
- 返回
- Success, or invalid argument without changing any renderer configuration.
Resets existing lazy reduced renderers once after commit; allocates and submits no GPU work.
在文件 FluidSurfaceRenderer.cpp 第 587 行定义.
引用了 blend, eve::Diagnostic::error(), eve::InvalidArgument, maximum, minimum, settings, eve::Result< T >::success() , 以及 value.
◆ configureSurface()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureSurface | ( | float | thicknessScale, |
| float | thicknessCutoff, | ||
| float | depthFalloff, | ||
| int | smoothIterations | ||
| ) |
Atomically configures thickness reconstruction and surface smoothing.
- 参数
-
thicknessScale Thickness multiplier in [0,16]. thicknessCutoff Fluid3D normalized thickness discard threshold in [0,5]; compares against thickness*10. depthFalloff Bilateral depth falloff in (0,1]. smoothIterations Bounded bilateral pass count in [0,8].
- 返回
- Success, or a structured error without changing prior configuration.
在文件 FluidSurfaceRenderer.cpp 第 565 行定义.
引用了 eve::fluids::FluidSurfaceParams::depthFalloff, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::fluids::FluidSurfaceParams::smoothIterations, eve::Result< T >::success() , 以及 eve::fluids::FluidSurfaceParams::thicknessScale.
◆ configureSurfaceBlend()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureSurfaceBlend | ( | int | source, |
| int | destination | ||
| ) |
Atomically configures Fluid3D's final surface source and destination blend factors.
- 参数
-
source Unity BlendMode integer in [0,10]. destination Unity BlendMode integer in [0,10].
- 返回
- Success, or invalid argument without changing the prior pair.
Configuration allocates nothing and creates no graphics pipeline. The package defaults are SourceAlpha value 5 and OneMinusSourceAlpha value 10. @ownership No external resource is accepted or retained. @lifetime The selected value pair lives with this renderer. @thread Render-thread affine; do not race configuration with rendering.
在文件 FluidSurfaceBlend.cpp 第 28 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::fluids::OneMinusSourceAlpha, source, eve::Result< T >::success() , 以及 eve::fluids::Zero.
◆ configureSurfaceBlurRadius()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureSurfaceBlurRadius | ( | float | radius | ) |
Sets Fluid3D's world-space surface blur radius for subsequent reconstruction.
- 参数
-
radius Finite world-space radius in [0,0.1] metres.
- 返回
- Success, or invalid argument without changing the prior radius.
The radius is converted to a bounded 0-4 pixel kernel per depth sample inside the existing bilateral smoothing passes. It adds no pass, resource, descriptor or submission. Render-thread affine.
在文件 FluidSurfaceRenderer.cpp 第 680 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, radius , 以及 eve::Result< T >::success().
◆ configureSurfaceDownsample()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureSurfaceDownsample | ( | int | factor | ) |
Configures Fluid3D-style surface target downsampling.
- 参数
-
factor Integer reconstruction divisor in [1,4].
- 返回
- Success, or a structured error without changing the prior factor.
Factors above one run splat, smoothing, normals and shading at the reduced dimensions, then expand outputs in one bounded linear host pass. Resources are created lazily and retained. Render-thread affine.
在文件 FluidSurfaceRenderer.cpp 第 721 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ configureSurfaceEnabled()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureSurfaceEnabled | ( | bool | enabled | ) |
Enables or disables Fluid3D's generateSurface policy for renderConfiguredVolume.
- 参数
-
enabled True selects existing SSF; false selects existing bounded thickness volume.
- 返回
- Success without allocating or changing the current frame.
Render-thread affine; the configured value is owned by this renderer.
在文件 FluidSurfaceRenderer.cpp 第 582 行定义.
引用了 enabled , 以及 eve::Result< T >::success().
◆ configureThicknessDownsample()
| Result< void > eve::fluids::FluidSurfaceRenderer::configureThicknessDownsample | ( | int | factor | ) |
Sets the independently reconstructed liquid-thickness target divisor.
- 参数
-
factor Integer divisor in [1,4].
- 返回
- Success, or an invalid-argument diagnostic without changing configuration.
renderVolume reconstructs thickness at dimensions ceil-divided by factor, expands it once, then performs material shading. The target is independent of surfaceDownsample and created lazily. Render-thread affine. @ownership No external object or pointer is retained. @lifetime The owned reduced target lives until reconfiguration or renderer destruction. @thread Render thread only; do not race configuration with rendering. @reentrancy Must not be called from renderer callbacks.
在文件 FluidSurfaceRenderer.cpp 第 731 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ copyToTexture()
| Result< void > eve::fluids::FluidSurfaceRenderer::copyToTexture | ( | graphics::Graphics * | graphics, |
| graphics::Texture * | texture | ||
| ) |
Present the current RGBA8 result into an existing graphics texture.
- 参数
-
graphics Borrowed active graphics module. texture Borrowed matching single-mip texture owned by graphics.
- 返回
- Success after presentation, or a structured argument/upload failure.
Uses an allocation-free device-local copy when the current frame was shaded on the GPU without CPU post-processing. Other backends and modified frames use the existing host color upload. No resource or pointer is retained. @thread Render-thread affine and synchronous.
在文件 FluidSurfaceRenderer.cpp 第 279 行定义.
引用了 eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, eve::gpgpu::GpuBuffer::residentView(), eve::Result< T >::success(), eve::Unsupported, eve::graphics::Graphics::updateTexture(), eve::graphics::Graphics::updateTextureFromResidentRgba8() , 以及 eve::fluids::FluidSurfaceParams::width.
被这些函数引用 renderVolumeColorToTexture().
◆ depth()
|
inline |
Linear view depth per pixel (FLT_MAX where no fluid).
在文件 FluidSurfaceRenderer.h 第 403 行定义.
◆ getHeight()
|
inline |
Returns the height.
在文件 FluidSurfaceRenderer.h 第 400 行定义.
◆ getWidth()
|
inline |
Returns the width.
在文件 FluidSurfaceRenderer.h 第 398 行定义.
◆ normals()
|
inline |
View-space normals (0 where no fluid).
在文件 FluidSurfaceRenderer.h 第 406 行定义.
◆ occludeWithSceneDepth()
| Result< void > eve::fluids::FluidSurfaceRenderer::occludeWithSceneDepth | ( | std::span< const float > | sceneDepth, |
| float | depthBias = 0.001f |
||
| ) |
Removes fluid and diffuse color hidden by borrowed linear scene depth.
- 参数
-
sceneDepth One finite, nonnegative view-space depth per output pixel; use a large finite value for no geometry. depthBias Nonnegative view-space tolerance in [0,1] metres for coincident surfaces.
- 返回
- Success, or a structured error before any color mutation. @lifetime sceneDepth is borrowed for this call and is never retained.
Render-thread affine. Call after full render/renderVolume/renderGasVolume and optional compositeDiffuse. This performs one allocation-free linear pixel pass and changes only RGBA. The color-only GPU fast path has no current host depth and is rejected explicitly.
在文件 FluidSurfaceRenderer.cpp 第 496 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::fluids::FluidSurfaceParams::height, eve::InvalidArgument, pixels, eve::PreconditionViolation, eve::Result< T >::success(), u, value , 以及 eve::fluids::FluidSurfaceParams::width.
◆ operator=()
|
delete |
◆ prepare()
| Result< void > eve::fluids::FluidSurfaceRenderer::prepare | ( | ) |
Prepares the preferred reconstruction backend before frame timing begins.
Render-thread affine. GPU resource and shader creation is attempted once; an unavailable GPU leaves the renderer on its CPU implementation. No simulation or output state is changed. Call usingGpu() afterwards to observe the selected path.
在文件 FluidSurfaceRenderer.cpp 第 144 行定义.
◆ render() [1/2]
| void eve::fluids::FluidSurfaceRenderer::render | ( | const FluidSimulator & | sim | ) |
Reconstruct a frame from a simulator's live particles.
在文件 FluidSurfaceRenderer.cpp 第 123 行定义.
引用了 eve::fluids::FluidSimulator::params(), eve::fluids::FluidParams::particleRadius, pos, eve::fluids::FluidSimulator::readPositions() , 以及 render().
◆ render() [2/2]
| void eve::fluids::FluidSurfaceRenderer::render | ( | const std::vector< glm::vec3 > & | positions, |
| float | particleRadius | ||
| ) |
Reconstruct a frame from particle positions.
在文件 FluidSurfaceRenderer.cpp 第 163 行定义.
引用了 positions.
被这些函数引用 render() , 以及 renderFrom().
◆ renderConfiguredVolume()
| Result< void > eve::fluids::FluidSurfaceRenderer::renderConfiguredVolume | ( | const VolumeFluid & | sim | ) |
Renders through Fluid3D's configured generateSurface policy.
- 参数
-
sim Borrowed simulator read only for this render-thread call.
- 返回
- Success, or a structured budget failure from the surface-disabled volume path.
Enabled uses the existing SSF reconstruction. Disabled uses the existing bounded all-phase thickness volume, skipping surface depth smoothing, normals, lighting, reflection, refraction and GPU work. No simulator or callback is retained.
在文件 VolumeFluidSurface.cpp 第 268 行定义.
引用了 renderVolumeWithoutSurface() , 以及 eve::Result< T >::success().
◆ rendererSettings()
|
noexcept |
Returns an owning snapshot of the current Fluid3D renderer settings without allocation.
在文件 FluidSurfaceRenderer.cpp 第 634 行定义.
引用了 eve::fluids::FluidRendererSettings::blendSource , 以及 settings.
◆ renderFrom()
| void eve::fluids::FluidSurfaceRenderer::renderFrom | ( | FluidSimulator * | sim | ) |
Script-friendly wrapper: render(*sim) with a null check.
- 参数
-
sim Borrowed simulator; null performs no work. @ownership The simulator is never retained. @lifetime The borrow lasts only for this call.
在文件 FluidSurfaceRenderer.cpp 第 129 行定义.
引用了 render().
◆ renderGasVolume()
| Result< void > eve::fluids::FluidSurfaceRenderer::renderGasVolume | ( | const VolumeFluid & | sim, |
| float | absorption = 5.f |
||
| ) |
Renders gas particles as a blurred, translucent thickness volume.
- 参数
-
sim Borrowed simulator read during this call only. absorption Beer-Lambert extinction coefficient in [0.01,30].
- 返回
- Success, or a structured error when inputs or the fixed frame budget are exceeded. @lifetime The simulator is borrowed for this call and is never retained.
Render-thread affine. Selects Gas particles only and does not run liquid surface reconstruction or submit GPU work. The frame is limited to 65536 particles and four million quarter-resolution projected bounding-box pixels; a failure preserves the previous output. Reuses frame scratch.
在文件 VolumeFluidSurface.cpp 第 260 行定义.
◆ renderVolume()
| void eve::fluids::FluidSurfaceRenderer::renderVolume | ( | const VolumeFluid & | sim | ) |
Reconstructs a volume-fluid snapshot and shades its diffusing particle colors.
在文件 VolumeFluidSurface.cpp 第 14 行定义.
◆ renderVolumeColorOnly()
| void eve::fluids::FluidSurfaceRenderer::renderVolumeColorOnly | ( | const VolumeFluid & | sim | ) |
Reconstructs only the RGBA output for display, skipping auxiliary GPU readback when color is uniform.
- 参数
-
sim Borrowed simulator read during this call only. @lifetime The simulator is borrowed for the duration of this call and is never retained.
Render-thread affine. depth(), normals(), and thickness() remain unchanged; do not call compositeDiffuse() after this method. Multicolor frames transparently use the full renderVolume path.
在文件 VolumeFluidSurface.cpp 第 16 行定义.
被这些函数引用 renderVolumeColorToTexture().
◆ renderVolumeColorToTexture()
| Result< void > eve::fluids::FluidSurfaceRenderer::renderVolumeColorToTexture | ( | const VolumeFluid & | sim, |
| graphics::Graphics * | graphics, | ||
| graphics::Texture * | texture | ||
| ) |
Reconstruct and present a uniform-color volume without host color readback when supported.
- 参数
-
sim Borrowed solver used only during this call. graphics Borrowed active graphics module. texture Borrowed matching destination texture.
- 返回
- Success after reconstruction and presentation, or a structured failure.
Vulkan keeps the shaded RGBA8 buffer device-local. Unsupported backends retain the normal host-visible color contract followed by texture upload. Do not insert CPU color compositing between reconstruction and presentation; use renderVolume plus copyToTexture for those modes.
在文件 FluidSurfaceRenderer.cpp 第 295 行定义.
引用了 copyToTexture(), eve::Diagnostic::error(), EV_PROFILE_MODULE, eve::Result< T >::failure(), eve::InvalidArgument , 以及 renderVolumeColorOnly().
◆ renderVolumeInterpolated()
| Result< void > eve::fluids::FluidSurfaceRenderer::renderVolumeInterpolated | ( | const VolumeFluid & | sim, |
| float | alpha | ||
| ) |
Reconstructs from fixed-step interpolated volume positions using the existing SSF pipeline.
- 参数
-
sim Borrowed solver; no pointer is retained. alpha Finite fraction in [0,1] between previous and current successful step endpoints.
- 返回
- Success, or invalid argument before replacing renderer outputs.
Position interpolation is fused into the existing CPU upload-data copy. It adds no reconstruction pass, buffer, texture, descriptor or GPU submission. Render-thread affine.
在文件 VolumeFluidSurface.cpp 第 18 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ renderVolumeWithoutSurface()
| Result< void > eve::fluids::FluidSurfaceRenderer::renderVolumeWithoutSurface | ( | const VolumeFluid & | sim, |
| float | absorption = 5.f |
||
| ) |
Renders every material phase as a blurred color/thickness volume without reconstructing a surface.
- 参数
-
sim Borrowed simulator read during this call only. absorption Beer-Lambert extinction coefficient in [0.01,30].
- 返回
- Success, or a structured error when inputs or the fixed frame budget are exceeded. @lifetime The simulator and its particle view are borrowed for this call and are never retained.
Implements Fluid3D's generateSurface=false presentation contract. Render-thread affine; performs no GPU work and disables surface lighting implicitly by producing a volume frame directly. The frame is limited to 65536 particles and four million quarter-resolution projected bounding-box pixels. Scratch storage is reused, and a budget failure preserves the previous output.
在文件 VolumeFluidSurface.cpp 第 264 行定义.
被这些函数引用 renderConfiguredVolume().
◆ setCamera()
| void eve::fluids::FluidSurfaceRenderer::setCamera | ( | const glm::vec3 & | eye, |
| const glm::vec3 & | target, | ||
| const glm::vec3 & | up, | ||
| float | fovYDeg | ||
| ) |
Update the camera.
在文件 FluidSurfaceRenderer.cpp 第 113 行定义.
引用了 eve::fluids::FluidSurfaceParams::aspect, eve::fluids::FluidSurfaceParams::eye, eye, eve::fluids::FluidSurfaceParams::fovYDeg, eve::fluids::FluidSurfaceParams::height, target, eve::fluids::FluidSurfaceParams::target, eve::fluids::FluidSurfaceParams::up, up , 以及 eve::fluids::FluidSurfaceParams::width.
◆ setMode()
|
inline |
◆ thickness()
|
inline |
Accumulated thickness per pixel.
在文件 FluidSurfaceRenderer.h 第 409 行定义.
◆ usingGpu()
|
inline |
◆ writePpm()
| void eve::fluids::FluidSurfaceRenderer::writePpm | ( | const std::string & | path | ) | const |
Write the color buffer as a PPM image (debug artifact).
在文件 FluidSurfaceRenderer.cpp 第 1093 行定义.
引用了 eve::fluids::FluidSurfaceParams::height, path , 以及 eve::fluids::FluidSurfaceParams::width.
该类的文档由以下文件生成:
- src/modules/fluids/FluidSurfaceRenderer.h
- src/modules/fluids/FluidSurfaceBlend.cpp
- src/modules/fluids/FluidSurfaceRenderer.cpp
- src/modules/fluids/VolumeFluidFoamSurface.cpp
- src/modules/fluids/VolumeFluidSurface.cpp