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 | ||
| ) |
◆ addVertex()
| std::uint32_t eve::hexmap::HexMeshData::addVertex | ( | HexVec3 | position, |
| float | u, | ||
| float | v | ||
| ) |
Appends one vertex.
- 参数
-
position Vertex position in world space. Callers apply noise perturbation themselves so a vertex is never displaced twice. u First texture coordinate (surface-specific encoding). v Second texture coordinate (surface-specific encoding).
- 返回
- Index of the new vertex.
在文件 HexMeshData.cpp 第 14 行定义.
◆ clear()
|
noexcept |
Removes every vertex and index, keeping the allocated capacity.
在文件 HexMeshData.cpp 第 7 行定义.
被这些函数引用 eve::hexmap::buildChunkSurfaceMesh(), eve::hexmap::buildFeatureMesh(), eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildSphereTerrainMesh(), eve::hexmap::buildSphereWaterMesh(), eve::hexmap::buildTerrainMesh(), eve::hexmap::buildWallMesh() , 以及 eve::hexmap::buildWaterMesh().
◆ empty()
|
inlinenoexcept |
Whether the mesh has no triangles.
在文件 HexMeshData.h 第 30 行定义.
◆ finalize()
|
noexcept |
Computes flat per-face normals. Must be called before upload.
在文件 HexMeshData.cpp 第 35 行定义.
引用了 a, ab, ac, at, b, c, n, t , 以及 eve::hexmap::HexVec3::y.
被这些函数引用 eve::hexmap::buildChunkSurfaceMesh(), eve::hexmap::buildFeatureMesh(), eve::hexmap::buildFogMesh(), eve::hexmap::buildRiverMesh(), eve::hexmap::buildRoadMesh(), eve::hexmap::buildSphereTerrainMesh(), eve::hexmap::buildSphereWaterMesh(), eve::hexmap::buildTerrainMesh(), eve::hexmap::buildWallMesh() , 以及 eve::hexmap::buildWaterMesh().
◆ hasNormals()
|
inlinenoexcept |
Whether finalize() produced a normal for every vertex.
在文件 HexMeshData.h 第 65 行定义.
◆ indices()
|
inlinenoexcept |
Triangle index stream.
在文件 HexMeshData.h 第 62 行定义.
◆ normals()
|
inlinenoexcept |
Normal stream (xyz per vertex), valid after finalize().
在文件 HexMeshData.h 第 58 行定义.
◆ positions()
|
inlinenoexcept |
Interleaved-free position stream (xyz per vertex).
在文件 HexMeshData.h 第 56 行定义.
◆ triangleCount()
|
inlinenoexcept |
Number of triangles.
在文件 HexMeshData.h 第 34 行定义.
◆ uvs()
|
inlinenoexcept |
Texture coordinate stream (uv per vertex).
在文件 HexMeshData.h 第 60 行定义.
◆ vertexCount()
|
inlinenoexcept |
该类的文档由以下文件生成:
- src/modules/hexmap/HexMeshData.h
- src/modules/hexmap/HexMeshData.cpp