载入中...
搜索中...
未找到
OceanSurface.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4
5#include "common/Result.h"
6
7#include <glm/glm.hpp>
8#include <span>
9#include <vector>
10
11namespace eve::fluids {
12
14struct OceanWave {
15 glm::dvec2 direction{1.0, 0.0};
16 double amplitude = 0.25;
17 double wavelength = 12.0;
18 double phase = 0.0;
19 double choppiness = 0.5;
20};
21
24 double seaLevel = 0.0;
25 double gravity = 9.81;
26 glm::dvec2 current{0.0};
27 std::vector<OceanWave> waves;
28};
29
32 double height = 0.0;
33 glm::dvec3 normal{0.0, 1.0, 0.0};
35 glm::dvec3 velocity{0.0};
36 glm::dvec2 parameterPosition{0.0};
37 double time = 0.0;
38 double horizontalJacobian = 1.0;
39};
40
49public:
56
65
72
73private:
74 explicit OceanSurface(OceanSurfaceSettings settings) : settings_(std::move(settings)) {}
75 OceanSurfaceSettings settings_;
76};
77
80 glm::dvec3 center{0.0};
81 glm::dvec3 pointVelocity{0.0};
82 double radius = 0.5;
83 double volume = 0.5;
84 double dragCoefficient = 1.0;
85};
86
89 glm::dvec3 position{0.0};
90 glm::dvec3 force{0.0};
91 double submergedVolume = 0.0;
92};
93
105 double density, double gravity);
106
107} // namespace eve::fluids
#define EVENGINE_API_DOMAINS
Definition Export.h:110
ScriptForceVector gravity
float density
std::array< float, 3 > position
OceanWakeSettings settings
ssq::Object water
Move-only, checked operation results for the common layer.
Cell cell
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Immutable analytic sea shared by geometry and buoyancy consumers. Owns every wave; no scene,...
EVENGINE_API_DOMAINS Result< OceanSurfaceSample > sample(glm::dvec2 worldXZ, double time) const
Invert horizontal displacement and sample the actual world-space surface.
static EVENGINE_API_DOMAINS Result< OceanSurface > create(const OceanSurfaceSettings &settings)
Validate and copy a wave set, normalizing direction vectors.
GLSL compute kernels for the GPU surface-flow solver.
Definition FluidTarget.h:12
Result< OceanCellForce > evaluateOceanCellForce(const OceanBuoyancyCell &cell, const OceanSurfaceSample &water, double density, double gravity)
Integrate spherical-cap buoyancy and isotropic quadratic water drag.
Sphere with assigned displacement volume; several disjoint volumes approximate a hull.
Owning force at a hull point; the rigid-body owner applies it once per fixed step.
Owning sample of the displaced surface at a requested world XZ and time.
glm::dvec3 velocity
Gerstner surface particle velocity plus uniform current; a water-velocity approximation.
Immutable authored sea inputs copied into OceanSurface.
std::vector< OceanWave > waves
One deep-water Gerstner component; metres, radians, seconds, +Y up.