载入中...
搜索中...
未找到
Snow.cpp
浏览该文件的文档.
Definition Graphics.h:125
virtual bool updateTexture(Texture *texture, int width, int height, const uint8_t *rgba)=0
Replace an existing texture's pixels in place (pointer stays stable).
virtual Texture * newTexture(int width, int height, const uint8_t *rgba, bool repeatU=false, bool repeatV=false)=0
Creates a texture. @ownership Caller deletes unless documented otherwise.
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
In-memory terrain heightmap: a dense float grid (row-major, index = y * width + x) materialized from ...
Definition Heightmap.h:21
Interactive snow depth field: a dense [0,1] float grid.
Definition SnowField.h:21
bool isDirty() const
True when any cell changed since the last clearDirty().
Definition SnowField.h:45
void stampFootprint(float cx, float cz, float dirX, float dirZ, float radius, float depth)
Press a footprint into the snow: an ellipse along (dirX, dirZ) with a soft bowl depression and a rais...
Definition SnowField.cpp:56
float height(int x, int y) const
Cell value in [0,1]; out-of-bounds reads 0.
Definition SnowField.cpp:51
void addSnowfall(float amount)
Snowfall recovery: raise every cell toward 1 by amount. Call with dt * snowfallRate each frame; clamp...
Definition SnowField.cpp:141
void stampImpact(float cx, float cz, float radius, float depth)
Carve an impact crater: a parabolic bowl (deep center, shallow edge) plus a raised snow rim just outs...
Definition SnowField.cpp:107
void setHeight(int x, int y, float h)
Set one cell (clamped to [0,1]); out-of-bounds is a no-op.
Definition SnowField.cpp:45
bool updateTexture(SnowField *field, graphics::Texture *texture, graphics::Graphics *gfx, const std::string &kind)
Replace an uploaded snow texture's pixels in place.
Definition Snow.cpp:70
SnowField * newField(int width, int height)
New empty snow field. @ownership Ownership transfers to the script/native caller. @lifetime Valid unt...
Definition Snow.cpp:31
bool applyToHeightmap(SnowField *field, procgen::Heightmap *terrain, procgen::Heightmap *out, float heightScale)
Compatibility script wrapper around applySnowToHeightmap(). @ownership All pointers are borrowed; no ...
Definition Snow.cpp:35
graphics::Texture * uploadTexture(SnowField *field, graphics::Graphics *gfx, const std::string &kind)
Upload the field as an RGBA8 texture.
Definition Snow.cpp:62
Definition LightingTarget.h:19
void applySnowToHeightmap(const SnowField &field, const procgen::Heightmap &terrain, procgen::Heightmap &out, float heightScale)
out(x, y) = terrain(x, y) + field(x, y) * heightScale.
Definition Snow.cpp:18