载入中...
搜索中...
未找到
SurfaceDropletSimulation.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
7
8#include <glm/glm.hpp>
9
10#include <cstdint>
11#include <vector>
12
13namespace eve::fluids {
14
18 glm::vec3 gravity{0.f, -9.8f, 0.f};
20 float friction = 1.5f;
22 float maxSpeed = 12.f;
26 int maxCrossings = 16;
28 float contactAngleDegrees = 72.f;
30 float mergeRadiusScale = 0.72f;
32 float trailDeposition = 0.22f;
34 float airDrag = 0.08f;
36 float reattachDistance = 0.035f;
37};
38
41 uint64_t id = 0;
43 glm::vec3 relativeVelocity{0.f};
45 float volume = 1.f;
47};
48
51 glm::vec3 position{0.f};
52 glm::vec3 velocity{0.f};
53 float volume = 1.f;
54};
55
58 glm::vec3 position{0.f};
59 glm::vec3 velocity{0.f};
60 float volume = 1.f;
61 float age = 0.f;
62};
63
73public:
77 const SurfaceDropletParams& params = {},
78 SurfaceWetnessField* wetness = nullptr);
79
81 bool addDroplet(const SurfaceLocation& location, float volume = 1.f,
82 const glm::vec3& relativeVelocity = glm::vec3(0.f));
83
85 void step(float dt);
86
89 const std::vector<SurfaceDroplet>& droplets() const { return droplets_; }
90
93 const std::vector<DetachedDroplet>& detachedDroplets() const { return detached_; }
94
97 const std::vector<AirborneDroplet>& airborneDroplets() const { return airborne_; }
98
101 float dropletRadius(float volume) const;
102
105 SurfaceDropletParams& params() { return params_; }
106
109 const SurfaceDropletParams& params() const { return params_; }
110
112 void clear();
113
114private:
115 void stepSubstep(float dt, float poseDt);
116
117 FluidSurfaceBinding* binding_ = nullptr;
118 SurfaceDropletParams params_;
119 SurfaceWetnessField* wetness_ = nullptr;
120 std::vector<SurfaceDroplet> droplets_;
121 std::vector<DetachedDroplet> detached_;
122 std::vector<AirborneDroplet> airborne_;
123 uint64_t nextDropletId_ = 1;
124};
125
126} // namespace eve::fluids
double volume
float wetness
#define EVENGINE_API_DOMAINS
Definition Export.h:110
eve::action::ActionVfxBinding binding
float step
Definition TreeMesh.cpp:314
Dynamic triangle surface used to bind films and droplets to deforming meshes.
CPU reference solver for droplets moving over static, rigid or deforming surfaces.
const std::vector< AirborneDroplet > & airborneDroplets() const
Airborne droplets.
const SurfaceDropletParams & params() const
Params.
const std::vector< SurfaceDroplet > & droplets() const
Droplets.
const std::vector< DetachedDroplet > & detachedDroplets() const
Detached droplets.
Lightweight material-space wet-film field stored at mesh vertices.
std::vector< ParamSpec > params
GLSL compute kernels for the GPU surface-flow solver.
Definition FluidTarget.h:12
Persistent world-space droplet after it has detached from a surface.
Droplet converted from a surface-bound state to a free world-space state.
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.
One droplet addressed in material space on a dynamic triangle surface.
Stable material-space address of a point on a triangle surface.