The damage of one point of the weave: which of the threads it owns are torn, and which of the folds it owns have lost a thread.
A set of flags: the values combine. An enum over uint, in the namespace BorrowedTorch.FabricSimulator.Simulation: the bits of each word of Fabric.CopyTearState, one word per point, in ParticleIndex order. Each thread has one owner, so its two ends agree on whether it is torn: a point owns the threads to its right and above it, and both diagonals of the square to its upper right. FabricEffect.UpdateTearState expands the words into the mask the solver reads. The cuts page shows it in context, with code.
The three dead-fold bits are Fabric’s to keep: it works them out again from the torn bits after every cut, tear and mend. To replay saved damage, call Fabric.Tear once for each torn bit set, and leave the dead folds to it; damage replayed that way has no strokes, so CreateCutMesh draws its lips jagged. A host that uploads a tear state of its own through UpdateTearState sets the dead-fold bits as Fabric does.
Values
None →
- Every thread the point owns is whole, and so is every fold it owns. What every word reads on a sheet with no damage.
TornRight →
- The thread to the point at
(column + 1, row)is torn.
TornUp →
- The thread to the point at
(column, row + 1)is torn.
TornUpRightDiagonal →
- The diagonal to the point at
(column + 1, row + 1)is torn.
TornUpLeftDiagonal →
- The other diagonal of the square to the point’s upper right, from
(column + 1, row)to(column, row + 1), is torn. The point owns it without being one of its ends.
DeadFoldAcross →
- The across fold the point owns, hinged on its thread to the right, has lost a thread: its hinge, or an outer thread of one of the two triangles it joins. Its bending is no longer solved. Worked out from the torn bits, so the solver checks one bit per fold rather than five threads.
DeadFoldDown →
- The down fold the point owns, hinged on its thread upward, has lost a thread.
DeadFoldDiagonal →
- The diagonal fold the point owns, hinged on the diagonal of
TornUpLeftDiagonal, has lost a thread.