class MAGES::MeshDeformations::TetUvSidecar¶
Overview¶
Text serializer/parser for the .tetuv per-wedge UV sidecar that lives beside a SimulationMesh asset. More…
class TetUvSidecar
{
public:
// fields
static const string Magic = "# MAGES per-wedge tet UV sidecar(.tetuv)";
static const int Version = 2;
// methods
static string Write(
float2[] tetCornerUVs,
int volumeConstraintCount,
int particleCount
);
static bool TryRead(
string text,
int expectedVolumeConstraintCount,
int expectedParticleCount,
out float2[] tetCornerUVs
);
static bool TryReadRaw(
string text,
out int volumeConstraintCount,
out int particleCount,
out float2[] tetCornerUVs
);
};
Detailed Documentation¶
Text serializer/parser for the .tetuv per-wedge UV sidecar that lives beside a SimulationMesh asset.
The payload is the per-face-corner UV array laid out vc*12 + faceSlot*3 + cornerInFace (see WedgeUvLayout) — the same order as DynamicSoftbodyActor.tetCornerUVs — so a parsed array loads directly with no remapping. The encoding mirrors the existing .uvmap text format (ObjExporter.WedgeKeysToUvMap / TryParseUvMap): a header/magic line, comment lines ignored on read, and one datum per line formatted with CultureInfo.InvariantCulture so the decimal separator is locale-independent.
Version 2 switched the payload from the old per-tet-corner layout (vc*4, one UV per corner) to the per-face-corner layout above (vc*12). A version-1 file no longer matches its mesh (its length is vc*4, not vc*12) and is rejected by the consumer’s length guard, so stale sidecars must be re-baked.
A validation stamp — the source mesh’s volume-constraint count and particle count — is recorded so a consumer can reject a sidecar that no longer matches its mesh. A topology-hash field is reserved for a later version (bump Version when adding it).
Fields¶
static const string Magic = "# MAGES per-wedge tet UV sidecar(.tetuv)"
Magic header line identifying a .tetuv sidecar.
static const int Version = 2
Current sidecar format version. Version 2 changed the payload layout from per-tet-corner (vc*4) to per-face-corner (vc*12, see WedgeUvLayout). The topology-hash validation field is reserved for a future bump.
Methods¶
static string Write(
float2[] tetCornerUVs,
int volumeConstraintCount,
int particleCount
)
Serializes a per-corner UV array to .tetuv text.
Parameters:
tetCornerUVs |
The per-face-corner UVs in |
volumeConstraintCount |
The source mesh volume-constraint count (validation stamp). |
particleCount |
The source mesh particle count (validation stamp). |
Returns:
The sidecar file contents.
static bool TryRead(
string text,
int expectedVolumeConstraintCount,
int expectedParticleCount,
out float2[] tetCornerUVs
)
Parses .tetuv text produced by Write and validates its stamp against the expected source mesh counts. Comment lines (starting with #) and blank lines are ignored.
Parameters:
text |
The sidecar file contents. |
expectedVolumeConstraintCount |
The current mesh’s volume-constraint count. |
expectedParticleCount |
The current mesh’s particle count. |
tetCornerUVs |
On success, the parsed per-face-corner UV array (length |
Returns:
true if the sidecar parsed, its declared counts were internally consistent, and the stamp matched the expected counts; otherwise false (no silent load).
static bool TryReadRaw(
string text,
out int volumeConstraintCount,
out int particleCount,
out float2[] tetCornerUVs
)
Parses .tetuv text without validating the stamp, returning the recorded counts. Useful for diagnostics / reporting a mismatch to the user.
Parameters:
text |
The sidecar file contents. |
volumeConstraintCount |
On success, the recorded volume-constraint stamp. |
particleCount |
On success, the recorded particle stamp. |
tetCornerUVs |
On success, the parsed per-corner UV array. |
Returns:
true if the sidecar parsed and was internally consistent.