Skip to content

Commit e0add24

Browse files
committed
Assign Binormal Handedness based on imported Tangent data
1 parent a517e38 commit e0add24

File tree

1 file changed

+13
-0
lines changed
  • xivModdingFramework/Models/DataContainers

1 file changed

+13
-0
lines changed

xivModdingFramework/Models/DataContainers/TTModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,19 @@ public static async Task<TTModel> LoadFromFile(string filePath, Action<bool, str
16721672
vertex.FlowDirection[0] = reader.GetFloat("flow_u");
16731673
vertex.FlowDirection[1] = reader.GetFloat("flow_v");
16741674

1675+
if(vertex.Binormal != Vector3.Zero)
1676+
{
1677+
var tangent = Vector3.Cross(vertex.Normal, vertex.Binormal).Normalized();
1678+
var dot = Vector3.Dot(tangent, vertex.Tangent);
1679+
if(dot < 0.5f)
1680+
{
1681+
vertex.Handedness = true;
1682+
} else
1683+
{
1684+
vertex.Handedness = false;
1685+
}
1686+
}
1687+
16751688
return vertex;
16761689
});
16771690

0 commit comments

Comments
 (0)