载入中...
搜索中...
未找到
eve::weather::SnowField类 参考

Interactive snow depth field: a dense [0,1] float grid. 更多...

#include <SnowField.h>

Public 成员函数

 SnowField ()=default
 Snow field.
 
 SnowField (int width, int height)
 Snow field.
 
void resize (int width, int height)
 Resize.
 
int getWidth () const
 Returns the width.
 
int getHeight () const
 Returns the height.
 
bool inBounds (int x, int y) const
 Compatibility predicate returning whether a cell is inside the field.
 
void fill (float v)
 Set every cell to v (clamped to [0,1]).
 
void setHeight (int x, int y, float h)
 Set one cell (clamped to [0,1]); out-of-bounds is a no-op.
 
float height (int x, int y) const
 Cell value in [0,1]; out-of-bounds reads 0.
 
bool isDirty () const
 True when any cell changed since the last clearDirty().
 
void clearDirty ()
 Clears dirty.
 
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 raised rim at the edges.
 
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 outside the bowl.
 
void addSnowfall (float amount)
 Snowfall recovery: raise every cell toward 1 by amount. Call with dt * snowfallRate each frame; clamped per cell.
 
std::vector< uint8_t > toHeightRGBA () const
 POM height map as RGBA8 (width x height x 4): R = snow depth, G = B = 0, A = 255 (white = raised toward the viewer, matches parallax_map.glsl).
 
std::vector< uint8_t > toAlbedoRGBA () const
 Albedo as RGBA8: cool-white snow blended to dark ground by depth, plus a tiny per-cell hash, so bare ground reads dark and deep snow white.
 
std::vector< uint8_t > toNormalRGBA () const
 Tangent-space normal map as RGBA8 derived from the snow-depth gradient (flat = 128,128,255, OpenGL-style, matches applyNormalMap).
 
const std::vector< float > & data () const
 Return an immediate read-only view of the dense field storage. @ownership Borrowed from this SnowField. @lifetime Invalidated by resize or destruction of this SnowField. @thread The caller must externally synchronize mutation.
 

详细描述

Interactive snow depth field: a dense [0,1] float grid.

1.0 = full snow cover, 0.0 = bare ground. The grid drives both the terrain-surface displacement (snow thickness) and the POM height map (R channel, white = raised), so footprints and impact craters deform the rendered snow surface instead of being a flat decal.

Pure CPU data (no graphics / procgen includes): render and heightmap bridging live in the weather module (Snow.h).

在文件 SnowField.h 第 21 行定义.

构造及析构函数说明

◆ SnowField() [1/2]

eve::weather::SnowField::SnowField ( )
default

Snow field.

◆ SnowField() [2/2]

eve::weather::SnowField::SnowField ( int  width,
int  height 
)

Snow field.

在文件 SnowField.cpp 第 24 行定义.

引用了 height, resize() , 以及 width.

成员函数说明

◆ addSnowfall()

void eve::weather::SnowField::addSnowfall ( float  amount)

Snowfall recovery: raise every cell toward 1 by amount. Call with dt * snowfallRate each frame; clamped per cell.

在文件 SnowField.cpp 第 141 行定义.

引用了 v.

◆ clearDirty()

void eve::weather::SnowField::clearDirty ( )
inline

Clears dirty.

在文件 SnowField.h 第 47 行定义.

◆ data()

const std::vector< float > & eve::weather::SnowField::data ( ) const
inline

Return an immediate read-only view of the dense field storage. @ownership Borrowed from this SnowField. @lifetime Invalidated by resize or destruction of this SnowField. @thread The caller must externally synchronize mutation.

在文件 SnowField.h 第 104 行定义.

◆ fill()

void eve::weather::SnowField::fill ( float  v)

Set every cell to v (clamped to [0,1]).

在文件 SnowField.cpp 第 39 行定义.

引用了 c , 以及 v.

◆ getHeight()

int eve::weather::SnowField::getHeight ( ) const
inline

Returns the height.

在文件 SnowField.h 第 33 行定义.

被这些函数引用 eve::lighting_editing::SnowFieldTarget::height().

◆ getWidth()

int eve::weather::SnowField::getWidth ( ) const
inline

Returns the width.

在文件 SnowField.h 第 31 行定义.

被这些函数引用 eve::lighting_editing::SnowFieldTarget::width().

◆ height()

float eve::weather::SnowField::height ( int  x,
int  y 
) const

Cell value in [0,1]; out-of-bounds reads 0.

在文件 SnowField.cpp 第 51 行定义.

引用了 inBounds(), x , 以及 y.

被这些函数引用 eve::lighting_editing::SnowFieldTarget::readScalar() , 以及 eve::lighting_editing::SnowFieldTarget::writeScalar().

◆ inBounds()

bool eve::weather::SnowField::inBounds ( int  x,
int  y 
) const

Compatibility predicate returning whether a cell is inside the field.

在文件 SnowField.cpp 第 35 行定义.

引用了 x , 以及 y.

被这些函数引用 eve::lighting_editing::SnowFieldTarget::containsCell(), height(), setHeight(), stampFootprint() , 以及 stampImpact().

◆ isDirty()

bool eve::weather::SnowField::isDirty ( ) const
inline

True when any cell changed since the last clearDirty().

在文件 SnowField.h 第 45 行定义.

◆ resize()

void eve::weather::SnowField::resize ( int  width,
int  height 
)

Resize.

在文件 SnowField.cpp 第 28 行定义.

引用了 height , 以及 width.

被这些函数引用 SnowField().

◆ setHeight()

void eve::weather::SnowField::setHeight ( int  x,
int  y,
float  h 
)

Set one cell (clamped to [0,1]); out-of-bounds is a no-op.

在文件 SnowField.cpp 第 45 行定义.

引用了 h, inBounds(), x , 以及 y.

被这些函数引用 eve::lighting_editing::SnowFieldTarget::writeScalar().

◆ stampFootprint()

void eve::weather::SnowField::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 raised rim at the edges.

参数
cx/ cz center in grid cell coordinates (may be fractional)
dirX/ dirZ travel direction (need not be normalized)
radiushalf length along the travel direction, in cells
depthdepression strength [0,1]

在文件 SnowField.cpp 第 56 行定义.

引用了 across, cell, cx, d, depth, dx, dz, inBounds(), margin, n, r, radius, x , 以及 z.

◆ stampImpact()

void eve::weather::SnowField::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 outside the bowl.

参数
cx/ cz center in grid cell coordinates
radiuscrater radius in cells
depthcrater depth [0,1]

在文件 SnowField.cpp 第 107 行定义.

引用了 cell, cx, d, depth, dx, dz, inBounds(), margin, n, r, radius, x , 以及 z.

◆ toAlbedoRGBA()

std::vector< uint8_t > eve::weather::SnowField::toAlbedoRGBA ( ) const

Albedo as RGBA8: cool-white snow blended to dark ground by depth, plus a tiny per-cell hash, so bare ground reads dark and deep snow white.

@ownership Returned value owns its pixels. @lifetime Independent of this field after return.

在文件 SnowField.cpp 第 164 行定义.

引用了 c, n, s, v, x , 以及 z.

◆ toHeightRGBA()

std::vector< uint8_t > eve::weather::SnowField::toHeightRGBA ( ) const

POM height map as RGBA8 (width x height x 4): R = snow depth, G = B = 0, A = 255 (white = raised toward the viewer, matches parallax_map.glsl).

@ownership Returned value owns its pixels. @lifetime Independent of this field after return.

在文件 SnowField.cpp 第 149 行定义.

引用了 s, x , 以及 z.

◆ toNormalRGBA()

std::vector< uint8_t > eve::weather::SnowField::toNormalRGBA ( ) const

Tangent-space normal map as RGBA8 derived from the snow-depth gradient (flat = 128,128,255, OpenGL-style, matches applyNormalMap).

@ownership Returned value owns its pixels. @lifetime Independent of this field after return.

在文件 SnowField.cpp 第 189 行定义.

引用了 nx, ny, nz, x , 以及 z.


该类的文档由以下文件生成: