载入中...
搜索中...
未找到
OceanWake.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4
5#include "common/Result.h"
6
7#include <glm/glm.hpp>
8#include <memory>
9#include <span>
10#include <vector>
11
12namespace eve::fluids {
13class OceanSpectrumFrame;
14class OceanWakeStep;
17 unsigned resolution = 64;
18 double length = 128.0;
19 double depth = 100.0;
20 double gravity = 9.81;
21 double damping = 0.15;
22 double absorptionWidth = 16.0;
23 double foamDecay = 0.5;
24 glm::dvec2 center{0.0};
25};
28 glm::dvec2 position{0.0};
29 double radius = 2.0;
30 double velocity = 0.0;
31 glm::dvec2 direction{0.0};
32 double foam = 0.0;
33};
36 double height = 0.0;
37 double velocity = 0.0;
38 glm::dvec2 gradient{0.0};
39 double foam = 0.0;
40};
44 double time = 0.0;
45 std::span<const double> height;
46 std::span<const double> foam;
47};
120public:
122 OceanWakeStep(const OceanWakeStep&) = delete;
124
125private:
126 friend class OceanWake;
127 explicit OceanWakeStep(std::unique_ptr<OceanWake> candidate);
128 std::unique_ptr<OceanWake> candidate_;
129 bool consumed_ = false;
130};
131} // namespace eve::fluids
eve::Duration endTime
void * impl
#define EVENGINE_API_DOMAINS
Definition Export.h:110
glm::dvec2 center
double dt
ssq::Object water
Move-only, checked operation results for the common layer.
float step
Definition TreeMesh.cpp:451
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Immutable spatial projection at one simulation timestamp, independent of its spectrum owner....
Owning, single-use candidate; no source frame, owner pointer or GPU resource is retained....
Definition OceanWake.h:119
OceanWakeStep(const OceanWakeStep &)=delete
EVENGINE_API_DOMAINS ~OceanWakeStep()
OceanWakeStep & operator=(const OceanWakeStep &)=delete
Caller-owned wave field with finite-depth gravity dispersion and absorbing boundaries....
Definition OceanWake.h:53
EVENGINE_API_DOMAINS Result< void > recenter(glm::dvec2 center)
Move the window by whole cells, retaining overlapping world-space history.
EVENGINE_API_DOMAINS OceanWakeSettings settings() const
Owning configuration including current window center.
EVENGINE_API_DOMAINS Result< void > commitStep(OceanWakeStep &step)
Publish a prepared candidate by constant-time state swap without allocation.
Definition OceanWake.cpp:87
static EVENGINE_API_DOMAINS Result< std::unique_ptr< OceanWake > > create(const OceanWakeSettings &settings)
Construct a checked field via explicit settings; copies settings and retains no input.
Definition OceanWake.cpp:30
EVENGINE_API_DOMAINS Result< void > inject(std::span< const OceanWakeImpulse > impulses)
Inject a bounded batch of localized disturbances atomically into vertical velocity/foam.
Definition OceanWake.cpp:46
OceanWake(const OceanWake &)=delete
EVENGINE_API_DOMAINS Result< std::unique_ptr< OceanWakeStep > > prepareStep(double dt, double endTime, const OceanSpectrumFrame &water) const
Prepare an owning candidate for one fixed step with exact per-mode dispersion omega² = g*k*tanh(k*dep...
Definition OceanWake.cpp:78
EVENGINE_API_DOMAINS double time() const
Current externally advanced simulation time, initially zero.
EVENGINE_API_DOMAINS OceanWakeGridView gridView() const
Borrow raw height/foam for immediate GPU upload; never retain across mutation or destruction.
EVENGINE_API_DOMAINS Result< OceanWakeSample > sample(glm::dvec2 worldXZ) const
Query a world point; returns zero outside the tile, InvalidArgument for nonfinite inputs.
OceanWake & operator=(const OceanWake &)=delete
EVENGINE_API_DOMAINS ~OceanWake()
GLSL compute kernels for the GPU surface-flow solver.
Definition FluidTarget.h:12
Call-only borrowed raw grids; owner must remain alive and unmodified during consumption.
Definition OceanWake.h:42
std::span< const double > foam
Definition OceanWake.h:46
std::span< const double > height
Definition OceanWake.h:45
OceanWakeSettings settings
Definition OceanWake.h:43
Localized vertical velocity impulse, with optional directional bow/stern dipole.
Definition OceanWake.h:27
Local world-space height perturbation, world slope and vertical particle speed.
Definition OceanWake.h:35
Local dispersive wave tile, SI units; kept independent of the observing camera.
Definition OceanWake.h:16