载入中...
搜索中...
未找到
eve::hexmap::HexMeshData类 参考

CPU-side triangle soup for one hex chunk surface. 更多...

#include <HexMeshData.h>

Public 成员函数

void clear () noexcept
 Removes every vertex and index, keeping the allocated capacity.
 
bool empty () const noexcept
 Whether the mesh has no triangles.
 
std::size_t vertexCount () const noexcept
 Number of vertices.
 
std::size_t triangleCount () const noexcept
 Number of triangles.
 
std::uint32_t addVertex (HexVec3 position, float u, float v)
 Appends one vertex.
 
void addTriangle (std::uint32_t a, std::uint32_t b, std::uint32_t c)
 Appends a triangle with counter-clockwise winding.
 
void addQuad (std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d)
 Appends a quad as two triangles (a,c,b and b,c,d).
 
void finalize () noexcept
 Computes flat per-face normals. Must be called before upload.
 
const std::vector< float > & positions () const noexcept
 Interleaved-free position stream (xyz per vertex).
 
const std::vector< float > & normals () const noexcept
 Normal stream (xyz per vertex), valid after finalize().
 
const std::vector< float > & uvs () const noexcept
 Texture coordinate stream (uv per vertex).
 
const std::vector< std::uint32_t > & indices () const noexcept
 Triangle index stream.
 
bool hasNormals () const noexcept
 Whether finalize() produced a normal for every vertex.
 

详细描述

CPU-side triangle soup for one hex chunk surface.

Vertices are intentionally not shared between triangles: the reference hex-map mesh builder emits every triangle with its own three vertices, which keeps the blend/terrace/cliff seams crisp and makes flat face normals exact. finalize() therefore computes per-face normals and duplicates them across the three vertices of each triangle.

注解
Owns plain host memory; upload is the caller's responsibility (gfx.newMeshFromArrays / gfx.updateMeshVertices).

在文件 HexMeshData.h 第 24 行定义.

成员函数说明

◆ addQuad()

void eve::hexmap::HexMeshData::addQuad ( std::uint32_t  a,
std::uint32_t  b,
std::uint32_t  c,
std::uint32_t  d 
)

Appends a quad as two triangles (a,c,b and b,c,d).

在文件 HexMeshData.cpp 第 30 行定义.

引用了 a, addTriangle(), b, c , 以及 d.

◆ addTriangle()

void eve::hexmap::HexMeshData::addTriangle ( std::uint32_t  a,
std::uint32_t  b,
std::uint32_t  c 
)

Appends a triangle with counter-clockwise winding.

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

引用了 a, b , 以及 c.

被这些函数引用 addQuad().

◆ addVertex()

std::uint32_t eve::hexmap::HexMeshData::addVertex ( HexVec3  position,
float  u,
float  v 
)

Appends one vertex.

参数
positionVertex position in world space. Callers apply noise perturbation themselves so a vertex is never displaced twice.
uFirst texture coordinate (surface-specific encoding).
vSecond texture coordinate (surface-specific encoding).
返回
Index of the new vertex.

在文件 HexMeshData.cpp 第 14 行定义.

引用了 index, position, u , 以及 v.

◆ clear()

◆ empty()

bool eve::hexmap::HexMeshData::empty ( ) const
inlinenoexcept

Whether the mesh has no triangles.

在文件 HexMeshData.h 第 30 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ finalize()

◆ hasNormals()

bool eve::hexmap::HexMeshData::hasNormals ( ) const
inlinenoexcept

Whether finalize() produced a normal for every vertex.

在文件 HexMeshData.h 第 65 行定义.

◆ indices()

const std::vector< std::uint32_t > & eve::hexmap::HexMeshData::indices ( ) const
inlinenoexcept

Triangle index stream.

在文件 HexMeshData.h 第 62 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ normals()

const std::vector< float > & eve::hexmap::HexMeshData::normals ( ) const
inlinenoexcept

Normal stream (xyz per vertex), valid after finalize().

在文件 HexMeshData.h 第 58 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ positions()

const std::vector< float > & eve::hexmap::HexMeshData::positions ( ) const
inlinenoexcept

Interleaved-free position stream (xyz per vertex).

在文件 HexMeshData.h 第 56 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ triangleCount()

std::size_t eve::hexmap::HexMeshData::triangleCount ( ) const
inlinenoexcept

Number of triangles.

在文件 HexMeshData.h 第 34 行定义.

◆ uvs()

const std::vector< float > & eve::hexmap::HexMeshData::uvs ( ) const
inlinenoexcept

Texture coordinate stream (uv per vertex).

在文件 HexMeshData.h 第 60 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().

◆ vertexCount()

std::size_t eve::hexmap::HexMeshData::vertexCount ( ) const
inlinenoexcept

Number of vertices.

在文件 HexMeshData.h 第 32 行定义.

被这些函数引用 eve::hexmap::HexMapModule::rebuildChunk().


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