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()
|
inlinenoexcept |
Read-only distance constraints, valid until this model is destroyed or assigned.
在文件 ClothModel.h 第 123 行定义.
◆ foldConstraints()
|
inlinenoexcept |
Read-only fold constraints, valid until this model is destroyed or assigned.
在文件 ClothModel.h 第 127 行定义.
◆ fromJson()
|
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()
|
static |
Bake an arbitrary indexed triangle mesh into a cloth model.
- 参数
-
positions Packed XYZ rest positions; size must be a non-zero multiple of three. triangleIndices Triangle indices; size must be a non-zero multiple of three. inverseMasses Optional 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()
|
static |
Decode strict eve.cloth-model/1 data; unknown fields are rejected.
在文件 ClothModel.cpp 第 311 行定义.
引用了 eve::Value::asInt(), eve::Value::asString(), cols, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), fromTriangles(), eve::editing::Value::getIf(), eve::Value::getIf(), grid(), eve::Value::isInt64(), eve::Value::isNull(), eve::Value::isString(), eve::ParseError, particles(), positions, root, rows, size, spacing, triangles(), eve::UnknownVersion , 以及 value.
被这些函数引用 fromJson() , 以及 eve::asset_physics::EvpackClothModelLoader::load().
◆ grid()
|
static |
Bake a regular XZ cloth grid with its top row pinned.
- 参数
-
cols Grid columns, at least two. rows Grid rows, at least two. spacing Positive particle spacing in meters. originX Rest-space origin X. originY Rest-space origin Y. originZ Rest-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()
|
inlinenoexcept |
Grid column metadata, or zero for an arbitrary mesh.
在文件 ClothModel.h 第 139 行定义.
◆ gridRows()
|
inlinenoexcept |
Grid row metadata, or zero for an arbitrary mesh.
在文件 ClothModel.h 第 141 行定义.
◆ gridSpacing()
|
inlinenoexcept |
Grid spacing metadata, or zero for an arbitrary mesh.
在文件 ClothModel.h 第 143 行定义.
◆ isClosed()
|
inlinenoexcept |
Whether every topology edge belongs to exactly two triangles.
在文件 ClothModel.h 第 135 行定义.
◆ particles()
|
inlinenoexcept |
Read-only particles, valid until this model is destroyed or assigned.
在文件 ClothModel.h 第 119 行定义.
被这些函数引用 fromValue().
◆ restVolume()
|
inlinenoexcept |
Signed rest volume for a consistently wound closed mesh, otherwise zero.
在文件 ClothModel.h 第 137 行定义.
◆ schemaVersion()
|
inlinenoexcept |
Schema version used by serialization adapters.
在文件 ClothModel.h 第 117 行定义.
◆ tetherConstraints()
|
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()
|
inlinenoexcept |
Read-only triangles, valid until this model is destroyed or assigned.
在文件 ClothModel.h 第 121 行定义.
被这些函数引用 fromValue() , 以及 toValue().
类成员变量说明
◆ SchemaVersion
|
staticconstexpr |
在文件 ClothModel.h 第 75 行定义.
该类的文档由以下文件生成:
- src/modules/physics/cloth/ClothModel.h
- src/modules/physics/cloth/ClothModel.cpp