载入中...
搜索中...
未找到
eve::procgen::MeshBuild类 参考

CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packed; uvs are st-packed; indices are triangles. 更多...

#include <MeshBuild.h>

Public 成员函数

void clear ()
 Clears .
 
void reserve (int vertexCount, int indexCount)
 Reserve.
 
void addVertex (float px, float py, float pz, float nx, float ny, float nz, float u, float v)
 Adds vertex.
 
void addTriangle (uint32_t i0, uint32_t i1, uint32_t i2)
 Adds triangle.
 
bool appendTransformed (const MeshBuild *other, float tx, float ty, float tz, float yawDegrees, float sx, float sy, float sz)
 Append another procedural mesh after an affine transform.
 
int setActiveGroup (const std::string &name)
 Select/create the named group assigned to subsequently added triangles.
 
int getGroupCount () const
 Number of named triangle groups.
 
std::string getGroupName (int groupIndex) const
 Group name, or an empty string for an invalid index.
 
int getTriangleGroup (int triangleIndex) const
 Group index for a triangle (not an index-buffer element), or -1.
 
const std::vector< int > & triangleGroups () const
 Return the dense triangle-to-group assignments.
 
const std::vector< std::string > & groupNames () const
 Return the stable ordered group names.
 
int activeGroup () const
 Return the currently selected group, or -1 when none is active.
 
eve::Result< void > restoreGroupData (std::vector< std::string > names, std::vector< int > assignments, int activeGroup)
 Restore the complete group sidecar after dense streams are loaded.
 
std::unique_ptr< MeshBuild > copyGroup (int groupIndex) const
 Copies one named group into a standalone compact mesh.
 
int getVertexCount () const
 
int getIndexCount () const
 Returns the index count.
 
bool empty () const
 Empty.
 
float getPositionX (int i) const
 Returns the position x.
 
float getPositionY (int i) const
 Returns the position y.
 
float getPositionZ (int i) const
 Returns the position z.
 
float getNormalX (int i) const
 Returns the normal x.
 
float getNormalY (int i) const
 Returns the normal y.
 
float getNormalZ (int i) const
 Returns the normal z.
 
float getUvU (int i) const
 Returns the uv u.
 
float getUvV (int i) const
 Returns the uv v.
 
bool hasVertexColors () const noexcept
 Return whether this mesh owns one packed RGBA color per vertex.
 
float getColor (int vertexIndex, int component) const noexcept
 Return one color component, or 1 for an invalid vertex/component or an absent color stream.
 
eve::Result< void > setVertexColors (std::vector< float > colors)
 Atomically replace the optional packed RGBA stream; empty removes it.
 
eve::Result< void > setColor (int vertexIndex, float r, float g, float b, float a)
 Set one vertex RGBA (allocates a default-white stream if absent).
 
int getIndex (int i) const
 
void setMeta (const std::string &key, const std::string &value)
 Sets the meta.
 
std::string getMeta (const std::string &key, const std::string &defaultValue) const
 Returns the meta.
 
const std::vector< float > & positions () const
 Positions.
 
const std::vector< float > & normals () const
 Normals.
 
const std::vector< float > & uvs () const
 Uvs.
 
const std::vector< float > & colors () const
 Colors.
 
const std::vector< uint32_t > & indices () const
 Indices.
 
const std::unordered_map< std::string, std::string > & metadata () const
 Return all metadata key/value pairs in deterministic map order.
 
std::vector< float > & positions ()
 Positions.
 
std::vector< float > & normals ()
 Normals.
 
std::vector< float > & uvs ()
 Uvs.
 
std::vector< uint32_t > & indices ()
 Indices.
 

详细描述

CPU triangle mesh from procedural mesh recipes (e.g. marching cubes). Positions/normals are xyz-packed; uvs are st-packed; indices are triangles.

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

成员函数说明

◆ activeGroup()

int eve::procgen::MeshBuild::activeGroup ( ) const
inline

Return the currently selected group, or -1 when none is active.

在文件 MeshBuild.h 第 64 行定义.

被这些函数引用 restoreGroupData().

◆ addTriangle()

◆ addVertex()

◆ appendTransformed()

bool eve::procgen::MeshBuild::appendTransformed ( const MeshBuild *  other,
float  tx,
float  ty,
float  tz,
float  yawDegrees,
float  sx,
float  sy,
float  sz 
)

Append another procedural mesh after an affine transform.

This is the composition primitive for graph-style generation: recipe outputs can be instanced, transformed and merged without a GPU round trip. Normals are transformed with inverse scale and renormalized.

参数
otherSource mesh; null and self references are rejected.
txTranslation on X.
tyTranslation on Y.
tzTranslation on Z.
yawDegreesRotation about world Y, in degrees.
sxScale on X; must be non-zero.
syScale on Y; must be non-zero.
szScale on Z; must be non-zero.
返回
True when the source mesh was appended.

在文件 MeshBuild.cpp 第 125 行定义.

引用了 a, addTriangle(), addVertex(), b, c, empty(), getColor(), getGroupCount(), getGroupName(), getIndex(), getIndexCount(), getNormalX(), getNormalY(), getNormalZ(), getPositionX(), getPositionY(), getPositionZ(), getTriangleGroup(), getUvU(), getUvV(), getVertexCount(), hasVertexColors(), nx, ny, nz, px, py, pz, reserve(), s, setActiveGroup(), sx, sy , 以及 sz.

被这些函数引用 eve::procgen::MeshMergePlan::appendSource().

◆ clear()

◆ colors()

const std::vector< float > & eve::procgen::MeshBuild::colors ( ) const
inline

Colors.

在文件 MeshBuild.h 第 131 行定义.

被这些函数引用 eve::procgen::MeshMergePlan::appendSource() , 以及 setVertexColors().

◆ copyGroup()

std::unique_ptr< MeshBuild > eve::procgen::MeshBuild::copyGroup ( int  groupIndex) const

Copies one named group into a standalone compact mesh.

参数
groupIndexTriangle-group index to copy.
返回
A uniquely owned mesh, or null for an invalid or empty group. @ownership The returned mesh is owned by the caller.

在文件 MeshBuild.cpp 第 93 行定义.

引用了 found, getColor(), getGroupCount(), getNormalX(), getNormalY(), getNormalZ(), getPositionX(), getPositionY(), getPositionZ(), getUvU(), getUvV(), hasVertexColors(), remap , 以及 t.

◆ empty()

◆ getColor()

float eve::procgen::MeshBuild::getColor ( int  vertexIndex,
int  component 
) const
noexcept

Return one color component, or 1 for an invalid vertex/component or an absent color stream.

在文件 MeshBuild.cpp 第 209 行定义.

被这些函数引用 appendTransformed() , 以及 copyGroup().

◆ getGroupCount()

int eve::procgen::MeshBuild::getGroupCount ( ) const

Number of named triangle groups.

在文件 MeshBuild.cpp 第 63 行定义.

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed(), copyGroup() , 以及 getGroupName().

◆ getGroupName()

std::string eve::procgen::MeshBuild::getGroupName ( int  groupIndex) const

Group name, or an empty string for an invalid index.

在文件 MeshBuild.cpp 第 65 行定义.

引用了 getGroupCount().

被这些函数引用 appendTransformed() , 以及 eve::procgen::road::conformHeightmapToRoadWithReceipt().

◆ getIndex()

int eve::procgen::MeshBuild::getIndex ( int  i) const

◆ getIndexCount()

int eve::procgen::MeshBuild::getIndexCount ( ) const

◆ getMeta()

std::string eve::procgen::MeshBuild::getMeta ( const std::string &  key,
const std::string &  defaultValue 
) const

Returns the meta.

在文件 MeshBuild.cpp 第 246 行定义.

引用了 defaultValue , 以及 key.

◆ getNormalX()

float eve::procgen::MeshBuild::getNormalX ( int  i) const

Returns the normal x.

在文件 MeshBuild.cpp 第 186 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed() , 以及 copyGroup().

◆ getNormalY()

float eve::procgen::MeshBuild::getNormalY ( int  i) const

Returns the normal y.

在文件 MeshBuild.cpp 第 190 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed() , 以及 copyGroup().

◆ getNormalZ()

float eve::procgen::MeshBuild::getNormalZ ( int  i) const

Returns the normal z.

在文件 MeshBuild.cpp 第 194 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed() , 以及 copyGroup().

◆ getPositionX()

float eve::procgen::MeshBuild::getPositionX ( int  i) const

◆ getPositionY()

float eve::procgen::MeshBuild::getPositionY ( int  i) const

◆ getPositionZ()

float eve::procgen::MeshBuild::getPositionZ ( int  i) const

◆ getTriangleGroup()

int eve::procgen::MeshBuild::getTriangleGroup ( int  triangleIndex) const

Group index for a triangle (not an index-buffer element), or -1.

在文件 MeshBuild.cpp 第 70 行定义.

被这些函数引用 appendTransformed() , 以及 eve::procgen::road::conformHeightmapToRoadWithReceipt().

◆ getUvU()

float eve::procgen::MeshBuild::getUvU ( int  i) const

Returns the uv u.

在文件 MeshBuild.cpp 第 198 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed() , 以及 copyGroup().

◆ getUvV()

float eve::procgen::MeshBuild::getUvV ( int  i) const

Returns the uv v.

在文件 MeshBuild.cpp 第 202 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed() , 以及 copyGroup().

◆ getVertexCount()

◆ groupNames()

const std::vector< std::string > & eve::procgen::MeshBuild::groupNames ( ) const
inline

Return the stable ordered group names.

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

◆ hasVertexColors()

bool eve::procgen::MeshBuild::hasVertexColors ( ) const
noexcept

Return whether this mesh owns one packed RGBA color per vertex.

在文件 MeshBuild.cpp 第 206 行定义.

引用了 getVertexCount().

被这些函数引用 eve::procgen::MeshMergePlan::appendSource(), appendTransformed(), copyGroup() , 以及 setColor().

◆ indices() [1/2]

std::vector< uint32_t > & eve::procgen::MeshBuild::indices ( )
inline

Indices.

在文件 MeshBuild.h 第 144 行定义.

◆ indices() [2/2]

const std::vector< uint32_t > & eve::procgen::MeshBuild::indices ( ) const
inline

◆ metadata()

const std::unordered_map< std::string, std::string > & eve::procgen::MeshBuild::metadata ( ) const
inline

Return all metadata key/value pairs in deterministic map order.

在文件 MeshBuild.h 第 135 行定义.

◆ normals() [1/2]

std::vector< float > & eve::procgen::MeshBuild::normals ( )
inline

Normals.

在文件 MeshBuild.h 第 140 行定义.

◆ normals() [2/2]

◆ positions() [1/2]

std::vector< float > & eve::procgen::MeshBuild::positions ( )
inline

Positions.

在文件 MeshBuild.h 第 138 行定义.

◆ positions() [2/2]

◆ reserve()

◆ restoreGroupData()

eve::Result< void > eve::procgen::MeshBuild::restoreGroupData ( std::vector< std::string >  names,
std::vector< int >  assignments,
int  activeGroup 
)

Restore the complete group sidecar after dense streams are loaded.

参数
namesOrdered group names.
assignmentsOne group index per triangle.
activeGroupCurrent group used by subsequent addTriangle calls.
返回
Applied when the sidecar is structurally compatible with the mesh; otherwise a stable ProcgenGroupDataInvalid diagnostic. Failure leaves all existing group state unchanged.

在文件 MeshBuild.cpp 第 75 行定义.

引用了 activeGroup(), eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), group, eve::procgen::raster_detail::invalid(), message, name, path, eve::ProcgenGroupDataInvalid, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setActiveGroup()

int eve::procgen::MeshBuild::setActiveGroup ( const std::string &  name)

◆ setColor()

eve::Result< void > eve::procgen::MeshBuild::setColor ( int  vertexIndex,
float  r,
float  g,
float  b,
float  a 
)

Set one vertex RGBA (allocates a default-white stream if absent).

参数
vertexIndexVertex index in [0, getVertexCount()).

在文件 MeshBuild.cpp 第 224 行定义.

引用了 a, b, eve::Diagnostic::error(), eve::Result< T >::failure(), g, getVertexCount(), hasVertexColors(), eve::InvalidArgument, r , 以及 eve::Result< T >::success().

◆ setMeta()

◆ setVertexColors()

eve::Result< void > eve::procgen::MeshBuild::setVertexColors ( std::vector< float >  colors)

Atomically replace the optional packed RGBA stream; empty removes it.

在文件 MeshBuild.cpp 第 214 行定义.

引用了 colors(), eve::Diagnostic::error(), eve::Result< T >::failure(), getVertexCount(), eve::InvalidArgument, eve::Result< T >::success() , 以及 value.

被这些函数引用 eve::procgen::MeshMergePlan::appendSource() , 以及 eve::procgen::bakeGtsTerrainVertexColorsInto().

◆ triangleGroups()

const std::vector< int > & eve::procgen::MeshBuild::triangleGroups ( ) const
inline

Return the dense triangle-to-group assignments.

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

◆ uvs() [1/2]

std::vector< float > & eve::procgen::MeshBuild::uvs ( )
inline

Uvs.

在文件 MeshBuild.h 第 142 行定义.

◆ uvs() [2/2]

const std::vector< float > & eve::procgen::MeshBuild::uvs ( ) const
inline

Uvs.

在文件 MeshBuild.h 第 129 行定义.

被这些函数引用 eve::procgen::projectMeshUvResult().


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