载入中...
搜索中...
未找到
CloudShadow.h
浏览该文件的文档.
1#pragma once
2
4
5namespace eve::procgen {
6
22public:
23 struct Params {
24 CloudField field; // the cloud field being shadowed
25 float sunDirX = 0.f; // normalized, toward the light (up)
26 float sunDirY = 1.f;
27 float sunDirZ = 0.f;
28 float cloudAltitude = 60.f; // cloud plane height above ground
29 float strength = 0.8f; // 0..1 shadow darkness
30 };
31
32 CloudShadow() = default;
33 explicit CloudShadow(const Params &params) { setParams(params); }
34
35 const Params &params() const { return params_; }
36 void setParams(const Params &params);
37
38 void setSunDirection(float x, float y, float z);
39 void setCloudAltitude(float altitude);
40 void setStrength(float strength);
41
43 float coverageAt(float x, float z, float time) const;
44
46 float shadowFactorAt(float x, float z, float time) const;
47
49 void cloudOffset(float &ox, float &oz) const;
50
52 void sampleCoverage(float *out, int width, int height, float time, float x0, float z0,
53 float extent) const;
54
56 void sampleFactor(float *out, int width, int height, float time, float x0, float z0,
57 float extent) const;
58
59private:
60 Params params_;
61};
62
63} // namespace eve::procgen
int y
Definition Grass.cpp:135
int z
Definition Grass.cpp:135
float height
Definition Grass.cpp:235
int x
Definition Grass.cpp:135
int width
Deterministic, seamlessly-tiling, time-animated procedural cloud field.
Definition CloudField.h:17
Cloud shadows cast onto the ground plane.
Definition CloudShadow.h:21
void sampleFactor(float *out, int width, int height, float time, float x0, float z0, float extent) const
Fill a buffer with shadow light-multiplier factors for a world region.
const Params & params() const
Definition CloudShadow.h:35
void setSunDirection(float x, float y, float z)
CloudShadow(const Params &params)
Definition CloudShadow.h:33
void setParams(const Params &params)
float coverageAt(float x, float z, float time) const
Cloud coverage projected onto ground (x, z) at time t, in [0,1].
void sampleCoverage(float *out, int width, int height, float time, float x0, float z0, float extent) const
Fill a buffer with projected coverage for a world region.
void cloudOffset(float &ox, float &oz) const
World-space cloud-point offset implied by sun + altitude.
float shadowFactorAt(float x, float z, float time) const
Light multiplier in [0,1]: 1 = fully lit, (1-strength) = fully shadowed.
void setCloudAltitude(float altitude)
void setStrength(float strength)
Generation parameters. Algorithm-specific keys live in values as strings (no overloads; typed setters...
Definition Params.h:13