载入中...
搜索中...
未找到
eve::gpuagents::SurfaceField类 参考

2.5D surface + life-field textures for Life Network. 更多...

#include <SurfaceField.h>

Public 成员函数

void initFlat (const glm::vec3 &originMin, float size, int res, float planeY=0.f)
 Allocate grids and fill a flat plane at y = planeY.
 
glm::vec2 worldToUv (const glm::vec3 &p) const
 World XZ → texel UV in [0,1].
 
float sampleHeight (float x, float z) const
 Bilinear sample of height at world XZ.
 
glm::vec3 sampleNormal (float x, float z) const
 Bilinear sample of surface normal.
 
glm::vec4 sampleLife (float x, float z) const
 Bilinear sample of life RGBA.
 
glm::vec3 project (const glm::vec3 &p) const
 Project a world point onto the surface (Y from height).
 
void stepLife (float dt, float decayRate, float halfLife, float diffusion, const std::vector< glm::vec3 > &deposits, float depositStrength)
 Advance trail deposit / decay / diffusion / danger for one fixed step.
 

Public 属性

glm::vec3 origin {-16.f, 0.f, -16.f}
 
float worldSize = 32.f
 
int resolution = 64
 
std::vector< float > height
 Height samples, resolution^2, row-major X then Z.
 
std::vector< glm::vec3 > normals
 Packed normals as vec3 per texel.
 
std::vector< glm::vec4 > lifeField
 Life field RGBA: R=trail, G=nutrient, B=danger, A=freshness.
 

详细描述

2.5D surface + life-field textures for Life Network.

Height/normal come from an orthographic surface capture (or a procedural plane). Trail / nutrient / danger channels live in lifeField (RGBA float texels).

在文件 SurfaceField.h 第 16 行定义.

成员函数说明

◆ initFlat()

void eve::gpuagents::SurfaceField::initFlat ( const glm::vec3 &  originMin,
float  size,
int  res,
float  planeY = 0.f 
)

Allocate grids and fill a flat plane at y = planeY.

在文件 SurfaceField.cpp 第 10 行定义.

引用了 EV_PARAM_CHECK, height, lifeField, n, normals, origin, resolution, size , 以及 worldSize.

被这些函数引用 eve::gpuagents::SurfaceCapture::captureFromTriangles().

◆ project()

glm::vec3 eve::gpuagents::SurfaceField::project ( const glm::vec3 &  p) const

Project a world point onto the surface (Y from height).

在文件 SurfaceField.cpp 第 79 行定义.

引用了 p , 以及 sampleHeight().

被这些函数引用 eve::gpuagents::LifeNetworkSolver::step().

◆ sampleHeight()

float eve::gpuagents::SurfaceField::sampleHeight ( float  x,
float  z 
) const

Bilinear sample of height at world XZ.

在文件 SurfaceField.cpp 第 34 行定义.

引用了 height, index, resolution, uv, worldToUv(), x , 以及 z.

被这些函数引用 project().

◆ sampleLife()

glm::vec4 eve::gpuagents::SurfaceField::sampleLife ( float  x,
float  z 
) const

Bilinear sample of life RGBA.

在文件 SurfaceField.cpp 第 73 行定义.

引用了 lifeField, uv, worldToUv(), x , 以及 z.

被这些函数引用 eve::gpuagents::LifeNetworkSolver::step().

◆ sampleNormal()

glm::vec3 eve::gpuagents::SurfaceField::sampleNormal ( float  x,
float  z 
) const

Bilinear sample of surface normal.

在文件 SurfaceField.cpp 第 52 行定义.

引用了 index, normals, resolution, uv, worldToUv(), x , 以及 z.

被这些函数引用 eve::gpuagents::LifeNetworkSolver::step().

◆ stepLife()

void eve::gpuagents::SurfaceField::stepLife ( float  dt,
float  decayRate,
float  halfLife,
float  diffusion,
const std::vector< glm::vec3 > &  deposits,
float  depositStrength 
)

Advance trail deposit / decay / diffusion / danger for one fixed step.

参数
dtFixed substep seconds.
decayRateTrail exponential decay rate.
halfLifeFreshness half-life seconds.
diffusionDiffusion coefficient.
depositsWorld positions that deposit trail this step.
depositStrengthPer-deposit trail add.

在文件 SurfaceField.cpp 第 83 行定义.

引用了 c, count, dx, dz, EV_PARAM_CHECK, index, lifeField, nx, nz, p, resolution, uv, worldToUv(), x , 以及 z.

被这些函数引用 eve::gpuagents::LifeNetworkSolver::step().

◆ worldToUv()

glm::vec2 eve::gpuagents::SurfaceField::worldToUv ( const glm::vec3 &  p) const

World XZ → texel UV in [0,1].

在文件 SurfaceField.cpp 第 22 行定义.

引用了 origin, p , 以及 worldSize.

被这些函数引用 sampleHeight(), sampleLife(), sampleNormal() , 以及 stepLife().

类成员变量说明

◆ height

std::vector<float> eve::gpuagents::SurfaceField::height

Height samples, resolution^2, row-major X then Z.

在文件 SurfaceField.h 第 23 行定义.

被这些函数引用 eve::gpuagents::SurfaceCapture::captureFromTriangles(), initFlat() , 以及 sampleHeight().

◆ lifeField

std::vector<glm::vec4> eve::gpuagents::SurfaceField::lifeField

Life field RGBA: R=trail, G=nutrient, B=danger, A=freshness.

在文件 SurfaceField.h 第 27 行定义.

被这些函数引用 initFlat(), sampleLife() , 以及 stepLife().

◆ normals

std::vector<glm::vec3> eve::gpuagents::SurfaceField::normals

Packed normals as vec3 per texel.

在文件 SurfaceField.h 第 25 行定义.

被这些函数引用 initFlat() , 以及 sampleNormal().

◆ origin

glm::vec3 eve::gpuagents::SurfaceField::origin {-16.f, 0.f, -16.f}

在文件 SurfaceField.h 第 18 行定义.

被这些函数引用 initFlat() , 以及 worldToUv().

◆ resolution

int eve::gpuagents::SurfaceField::resolution = 64

在文件 SurfaceField.h 第 20 行定义.

被这些函数引用 initFlat(), sampleHeight(), sampleNormal() , 以及 stepLife().

◆ worldSize

float eve::gpuagents::SurfaceField::worldSize = 32.f

在文件 SurfaceField.h 第 19 行定义.

被这些函数引用 initFlat() , 以及 worldToUv().


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