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