class MAGES::MeshDeformations::WedgeUvLayout

Overview

Single source of truth for the per-face-corner wedge-UV storage layout shared by the offline unwrap (SimulationMeshSurface) and the runtime render-mesh rebuild (DynamicSoftbodyActor.RecreateFlatMeshJob). More…

class WedgeUvLayout
{
public:
    // fields

    static const int CornersPerTet = 12;
    static readonly int[] FaceCornerLocalCorner =         {             1, 3, 2,              0, 2, 3,              0, 3, 1,              0, 1, 2,          };

    // methods

    static int Key(int volumeConstraint, int faceSlot, int cornerInFace);
};

Detailed Documentation

Single source of truth for the per-face-corner wedge-UV storage layout shared by the offline unwrap (SimulationMeshSurface) and the runtime render-mesh rebuild (DynamicSoftbodyActor.RecreateFlatMeshJob).

A tetrahedron exposes up to four boundary faces, and a single tet corner (particle) is shared by up to three of them. The earlier per-tet-corner layout (vc*4 + localCorner) stored one UV per corner, so faces of the same tet that shared a corner had to agree on its UV. A congruent per-triangle atlas gives every face its own disjoint cell, so those faces disagree — collapsing them into one slot (last-write-wins) teleported the losing face’s shared corners into another cell and produced the scattered “rainbow” triangles.

This layout stores a distinct UV per (face, corner) : twelve slots per tet (vc*12 + faceSlot*3 + cornerInFace), so no two faces ever share a slot and per-triangle UVs round-trip exactly. Box-projection / cut-derived UVs, which are already corner-coherent, simply write the same corner UV into every face slot that references it (see FaceCornerLocalCorner).

Lockstep contract: the face-slot → corner triples below must stay identical to DynamicSoftbodyActor.RecreateFlatMeshJob.Execute and SimulationMeshSurface.BuildBoundarySurface(VolumeConstraint[], Particle[]). Change one, change all three.

Fields

static const int CornersPerTet = 12

Number of UV slots stored per tetrahedron: 4 faces × 3 corners.

static readonly int[] FaceCornerLocalCorner =         {             1, 3, 2,              0, 2, 3,              0, 3, 1,              0, 1, 2,          }

Maps each per-face-corner slot (faceSlot*3 + cornerInFace, 0..11) to the tet’s local corner (A=0, B=1, C=2, D=3) it draws from. Matches the face emission order: slot 0 → B,D,C; slot 1 → A,C,D; slot 2 → A,D,B; slot 3 → A,B,C.

Methods

static int Key(int volumeConstraint, int faceSlot, int cornerInFace)

The storage key for a face-corner: volumeConstraint*12 + faceSlot*3 + cornerInFace.

Parameters:

volumeConstraint

The volume-constraint (tet) index.

faceSlot

Which of the tet’s four faces (0..3).

cornerInFace

Which corner within that face (0..2).

Returns:

The flat index into a per-face-corner UV array.