载入中...
搜索中...
未找到
SnowField.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <cstdint>
6#include <vector>
7
8namespace eve::weather {
9
22public:
24 SnowField() = default;
26 SnowField(int width, int height);
27
29 void resize(int width, int height);
31 int getWidth() const { return width_; }
33 int getHeight() const { return height_; }
35 bool inBounds(int x, int y) const;
36
38 void fill(float v);
40 void setHeight(int x, int y, float h);
42 float height(int x, int y) const;
43
45 bool isDirty() const { return dirty_; }
47 void clearDirty() { dirty_ = false; }
48
57 void stampFootprint(float cx, float cz, float dirX, float dirZ, float radius, float depth);
58
66 void stampImpact(float cx, float cz, float radius, float depth);
67
72 void addSnowfall(float amount);
73
80 std::vector<uint8_t> toHeightRGBA() const;
81
88 std::vector<uint8_t> toAlbedoRGBA() const;
89
96 std::vector<uint8_t> toNormalRGBA() const;
97
104 const std::vector<float> &data() const { return data_; }
105
106private:
107 static float clamp01(float v);
108
109 int width_ = 0;
110 int height_ = 0;
111 std::vector<float> data_;
112 bool dirty_ = true;
113};
114
115} // namespace eve::weather
float y
Definition AnimClip.cpp:738
float x
Definition AnimClip.cpp:738
float cx
Definition CardTypes.cpp:33
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
float v
int h
std::uint32_t height
std::uint32_t width
float radius
std::uint32_t depth
Interactive snow depth field: a dense [0,1] float grid.
Definition SnowField.h:21
const std::vector< float > & data() const
Return an immediate read-only view of the dense field storage. @ownership Borrowed from this SnowFiel...
Definition SnowField.h:104
bool isDirty() const
True when any cell changed since the last clearDirty().
Definition SnowField.h:45
void clearDirty()
Clears dirty.
Definition SnowField.h:47
int getWidth() const
Returns the width.
Definition SnowField.h:31
int getHeight() const
Returns the height.
Definition SnowField.h:33
SnowField()=default
Snow field.