载入中...
搜索中...
未找到

Reusable, validated cloth simulation asset. 更多...

#include <ClothModel.h>

Public 成员函数

eve::Value toValue () const
 Encode canonical owning eve.cloth-model/1 data.
 
eve::Result< std::string > toJson () const
 Serialize deterministic compact eve.cloth-model/1 JSON.
 
uint32_t schemaVersion () const noexcept
 Schema version used by serialization adapters.
 
std::span< const ClothModelParticle > particles () const noexcept
 Read-only particles, valid until this model is destroyed or assigned.
 
std::span< const ClothModelTriangle > triangles () const noexcept
 Read-only triangles, valid until this model is destroyed or assigned.
 
std::span< const ClothModelDistanceConstraint > distanceConstraints () const noexcept
 Read-only distance constraints, valid until this model is destroyed or assigned.
 
std::span< const ClothModelFoldConstraint > foldConstraints () const noexcept
 Read-only fold constraints, valid until this model is destroyed or assigned.
 
std::span< const ClothModelTetherConstraint > tetherConstraints () const noexcept
 Read-only geodesic tethers generated from fixed particles.
 
bool isClosed () const noexcept
 Whether every topology edge belongs to exactly two triangles.
 
float restVolume () const noexcept
 Signed rest volume for a consistently wound closed mesh, otherwise zero.
 
int gridCols () const noexcept
 Grid column metadata, or zero for an arbitrary mesh.
 
int gridRows () const noexcept
 Grid row metadata, or zero for an arbitrary mesh.
 
float gridSpacing () const noexcept
 Grid spacing metadata, or zero for an arbitrary mesh.
 

静态 Public 成员函数

static eve::Result< ClothModel > fromTriangles (std::span< const float > positions, std::span< const int > triangleIndices, std::span< const float > inverseMasses={})
 Bake an arbitrary indexed triangle mesh into a cloth model.
 
static eve::Result< ClothModel > grid (int cols, int rows, float spacing, float originX, float originY, float originZ)
 Bake a regular XZ cloth grid with its top row pinned.
 
static eve::Result< ClothModel > fromValue (const eve::Value &value)
 Decode strict eve.cloth-model/1 data; unknown fields are rejected.
 
static eve::Result< ClothModel > fromJson (std::string_view json)
 Parse and decode strict UTF-8 eve.cloth-model/1 JSON.
 

静态 Public 属性

static constexpr uint32_t SchemaVersion = 1
 

详细描述

Reusable, validated cloth simulation asset.

ClothModel owns rest-space particles, triangle topology and precomputed constraints. It contains no per-frame solver state, renderer object or collision-world reference, so one model may be copied into multiple cloth runtime instances. Construction is transactional: invalid topology produces a failed Result and no partially usable model.

@thread Construct off-thread when desired, then treat the published model as read-only. Accessors are safe for concurrent readers when no thread mutates the same ClothModel object. @reentrancy Construction and access invoke no callbacks.

在文件 ClothModel.h 第 73 行定义.

成员函数说明

◆ distanceConstraints()

std::span< const ClothModelDistanceConstraint > eve::physics::ClothModel::distanceConstraints ( ) const
inlinenoexcept

Read-only distance constraints, valid until this model is destroyed or assigned.

在文件 ClothModel.h 第 123 行定义.

◆ foldConstraints()

std::span< const ClothModelFoldConstraint > eve::physics::ClothModel::foldConstraints ( ) const
inlinenoexcept

Read-only fold constraints, valid until this model is destroyed or assigned.

在文件 ClothModel.h 第 127 行定义.

◆ fromJson()

eve::Result< ClothModel > eve::physics::ClothModel::fromJson ( std::string_view  json)
static

Parse and decode strict UTF-8 eve.cloth-model/1 JSON.

在文件 ClothModel.cpp 第 305 行定义.

引用了 eve::Result< T >::failure(), eve::Value::fromJson(), fromValue() , 以及 value.

◆ fromTriangles()

eve::Result< ClothModel > eve::physics::ClothModel::fromTriangles ( std::span< const float >  positions,
std::span< const int >  triangleIndices,
std::span< const float >  inverseMasses = {} 
)
static

Bake an arbitrary indexed triangle mesh into a cloth model.

参数
positionsPacked XYZ rest positions; size must be a non-zero multiple of three.
triangleIndicesTriangle indices; size must be a non-zero multiple of three.
inverseMassesOptional per-particle inverse masses. Zero pins a particle.
返回
Validated owning model, or a diagnostic without partial output.

在文件 ClothModel.cpp 第 53 行定义.

引用了 a, anchor, b, eve::physics::Bend, c, distance, dx, dy, dz, edge, edges, first, key, kind, nx, ny, nz, positions, second, eve::physics::Structural, eve::Result< T >::success() , 以及 triangle.

被这些函数引用 fromValue() , 以及 grid().

◆ fromValue()

◆ grid()

eve::Result< ClothModel > eve::physics::ClothModel::grid ( int  cols,
int  rows,
float  spacing,
float  originX,
float  originY,
float  originZ 
)
static

Bake a regular XZ cloth grid with its top row pinned.

参数
colsGrid columns, at least two.
rowsGrid rows, at least two.
spacingPositive particle spacing in meters.
originXRest-space origin X.
originYRest-space origin Y.
originZRest-space origin Z.
返回
Validated owning model, or a diagnostic without partial output.

在文件 ClothModel.cpp 第 207 行定义.

引用了 a, b, eve::physics::Bend, c, cols, d, dx, dy, dz, fromTriangles(), indices, kind, model, positions, rows, eve::physics::Shear, spacing, eve::physics::Structural , 以及 eve::Result< T >::success().

被这些函数引用 eve::physics::Cloth3D::Cloth3D() , 以及 fromValue().

◆ gridCols()

int eve::physics::ClothModel::gridCols ( ) const
inlinenoexcept

Grid column metadata, or zero for an arbitrary mesh.

在文件 ClothModel.h 第 139 行定义.

◆ gridRows()

int eve::physics::ClothModel::gridRows ( ) const
inlinenoexcept

Grid row metadata, or zero for an arbitrary mesh.

在文件 ClothModel.h 第 141 行定义.

◆ gridSpacing()

float eve::physics::ClothModel::gridSpacing ( ) const
inlinenoexcept

Grid spacing metadata, or zero for an arbitrary mesh.

在文件 ClothModel.h 第 143 行定义.

◆ isClosed()

bool eve::physics::ClothModel::isClosed ( ) const
inlinenoexcept

Whether every topology edge belongs to exactly two triangles.

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

◆ particles()

std::span< const ClothModelParticle > eve::physics::ClothModel::particles ( ) const
inlinenoexcept

Read-only particles, valid until this model is destroyed or assigned.

在文件 ClothModel.h 第 119 行定义.

被这些函数引用 fromValue().

◆ restVolume()

float eve::physics::ClothModel::restVolume ( ) const
inlinenoexcept

Signed rest volume for a consistently wound closed mesh, otherwise zero.

在文件 ClothModel.h 第 137 行定义.

◆ schemaVersion()

uint32_t eve::physics::ClothModel::schemaVersion ( ) const
inlinenoexcept

Schema version used by serialization adapters.

在文件 ClothModel.h 第 117 行定义.

◆ tetherConstraints()

std::span< const ClothModelTetherConstraint > eve::physics::ClothModel::tetherConstraints ( ) const
inlinenoexcept

Read-only geodesic tethers generated from fixed particles.

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

◆ toJson()

eve::Result< std::string > eve::physics::ClothModel::toJson ( ) const

Serialize deterministic compact eve.cloth-model/1 JSON.

在文件 ClothModel.cpp 第 303 行定义.

引用了 eve::Value::toJson() , 以及 toValue().

◆ toValue()

eve::Value eve::physics::ClothModel::toValue ( ) const

Encode canonical owning eve.cloth-model/1 data.

在文件 ClothModel.cpp 第 271 行定义.

引用了 positions, triangle , 以及 triangles().

被这些函数引用 toJson().

◆ triangles()

std::span< const ClothModelTriangle > eve::physics::ClothModel::triangles ( ) const
inlinenoexcept

Read-only triangles, valid until this model is destroyed or assigned.

在文件 ClothModel.h 第 121 行定义.

被这些函数引用 fromValue() , 以及 toValue().

类成员变量说明

◆ SchemaVersion

constexpr uint32_t eve::physics::ClothModel::SchemaVersion = 1
staticconstexpr

在文件 ClothModel.h 第 75 行定义.


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