载入中...
搜索中...
未找到
CloudField.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <cstdint>
6
7namespace eve::procgen {
8
20public:
22 struct Params {
23 uint32_t seed = 1337;
24 float worldScale = 96.f; // world units per tile (larger = larger clouds)
25 float coverage = 0.55f; // 0..1 fraction of sky covered (threshold)
26 float softness = 0.12f; // 0..1 edge softness of cloud blobs
27 float detail = 0.5f; // 0..1 high-frequency wisp detail amount
28 float windSpeed = 4.f; // world units / second drift speed
29 float windAngle = 0.f; // drift direction (radians, +z axis = 0)
30 int octaves = 4;
31 float lacunarity = 2.f;
32 float gain = 0.5f;
33 float warp = 2.2f; // domain-warp amplitude (organic puffs)
34 bool seamless = true;
35 };
36
37 CloudField() = default;
38 explicit CloudField(const Params &params) { setParams(params); }
39
40 const Params &params() const { return params_; }
41 void setParams(const Params &params);
42
43 void setSeed(uint32_t seed);
44 void setWorldScale(float worldScale);
45 void setCoverage(float coverage);
46 void setSoftness(float softness);
47 void setDetail(float detail);
48 void setWind(float speed, float angleRad);
49 void setOctaves(int octaves);
50 void setWarp(float warp);
51 void setSeamless(bool seamless);
52
54 float coverageAt(float x, float z, float time) const;
55
57 void sample(float *out, int width, int height, float time, float x0, float z0,
58 float extent) const;
59
61 void windVelocity(float &vx, float &vz) const;
62
64 static constexpr int kLattice = 64;
65
66private:
67 Params params_;
68};
69
70} // namespace eve::procgen
float x
Definition AnimClip.cpp:738
float z
Definition AnimClip.cpp:738
bool seamless
#define EVENGINE_API_DOMAINS
Definition Export.h:110
float warp
std::uint32_t height
std::uint32_t width
std::uint32_t seed
Definition PointSet.cpp:807
int detail
float vz
float vx
Deterministic, seamlessly-tiling, time-animated procedural cloud field.
Definition CloudField.h:19
CloudField(const Params &params)
Definition CloudField.h:38
const Params & params() const
Definition CloudField.h:40
Owning, typed generation parameters.
Definition Params.h:27
std::vector< ParamSpec > params
double sample(const Heightmap &map, double u, double v)
Sample.