载入中...
搜索中...
未找到
SurfaceFluidRuntime.cpp
浏览该文件的文档.
2
6
7namespace eve::fluids_editing {
8
13 if (!simulation || !render || !wetness)
14 return eve::editing::failed<void>(
15 EditorStatus::Rejected, RuleId("editor.surface-fluid.runtime-services"),
16 "Surface fluid runtime publication requires simulation, render and wetness targets");
17 for (const auto& diagnostic : target.validate())
18 if (diagnostic.severity() == DiagnosticSeverity::Error)
19 return eve::editing::failed<void>(EditorStatus::Rejected, RuleId("editor.surface-fluid.runtime-invalid"),
20 "Surface fluid document is invalid");
21 const SurfaceFluidSettings s = target.settings();
22
24 droplet.gravity = {static_cast<float>(s.gravityX), static_cast<float>(s.gravityY), static_cast<float>(s.gravityZ)};
25 droplet.friction = static_cast<float>(s.friction);
26 droplet.maxSpeed = static_cast<float>(s.maxSpeed);
27 droplet.adhesionAcceleration = static_cast<float>(s.adhesionAcceleration);
28 droplet.maxCrossings = s.maxCrossings;
29 droplet.contactAngleDegrees = static_cast<float>(s.contactAngleDegrees);
30 droplet.mergeRadiusScale = static_cast<float>(s.mergeRadiusScale);
31 droplet.trailDeposition = static_cast<float>(s.trailDeposition);
32 droplet.airDrag = static_cast<float>(s.airDrag);
33 droplet.reattachDistance = static_cast<float>(s.reattachDistance);
34
36 nextWetness.diffusion = static_cast<float>(s.diffusion);
37 nextWetness.evaporation = static_cast<float>(s.evaporation);
38 nextWetness.maxWetness = static_cast<float>(s.maxWetness);
39
41 nextRender.velocityStretch = static_cast<float>(s.velocityStretch);
42 nextRender.maxAspectRatio = static_cast<float>(s.maxAspectRatio);
43 nextRender.surfaceOffset = static_cast<float>(s.surfaceOffset);
44 nextRender.wetMaterial.dryRoughness = static_cast<float>(s.dryRoughness);
45 nextRender.wetMaterial.wetRoughness = static_cast<float>(s.wetRoughness);
46 nextRender.wetMaterial.drySpecular = static_cast<float>(s.drySpecular);
47 nextRender.wetMaterial.wetSpecular = static_cast<float>(s.wetSpecular);
48 nextRender.wetMaterial.wetDarkening = static_cast<float>(s.wetDarkening);
49 nextRender.wetMaterial.normalStrength = static_cast<float>(s.normalStrength);
50
51 simulation->params() = droplet;
52 *render = nextRender;
53 *wetness = nextWetness;
54 return eve::editing::applied<void>();
55}
56
57} // namespace eve::fluids_editing
LogicalId target
const std::string & s
float wetness
Move-only operation result carrying either a value or Status.
Definition Result.h:155
CPU reference solver for droplets moving over static, rigid or deforming surfaces.
Result< void > apply(const SurfaceFluidTarget &target, fluids::SurfaceDropletSimulation *simulation, fluids::SurfaceFluidRenderParams *render, fluids::SurfaceWetnessParams *wetness) const
Apply droplet parameters and emit matching render/wetness parameters atomically.
Reversible document for surface droplets, wet traces and material response.
editing::RuleId RuleId
Definition FluidTarget.h:39
Material and integration parameters for surface-bound droplets.
float reattachDistance
Maximum distance at which an airborne droplet can reattach.
int maxCrossings
Maximum number of triangle edges crossed by one step.
float mergeRadiusScale
Multiplier for the sum of cap radii used by droplet merging.
float adhesionAcceleration
Maximum outward acceleration retained by adhesion.
float airDrag
Air drag applied after a droplet leaves the surface.
float trailDeposition
Wet-film amount deposited per world-space unit travelled.
float contactAngleDegrees
Water contact angle in degrees, used to derive a visible cap radius.
glm::vec3 gravity
World-space gravity in units per second squared.
float friction
Exponential damping of velocity relative to the surface.
float maxSpeed
Maximum relative droplet speed.
Tuning for converting simulated droplets into render instances.
Parameters controlling persistent wet-film traces on a triangle surface.
float evaporation
Exponential evaporation rate per second.
float maxWetness
Saturation limit for each field vertex.
float diffusion
Material-space diffusion rate per second.
Renderer-neutral droplet motion, wet-film and wet-material authoring values.