Skip to content

Commit cc9b0cb

Browse files
committed
Add flow transform on racial transform.
1 parent 188b41f commit cc9b0cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using System.Security.AccessControl;
2626
using xivModdingFramework.Models.Enums;
2727
using MathNet.Numerics.LinearAlgebra;
28+
using System.Security.Cryptography;
2829

2930
namespace xivModdingFramework.Models.Helpers
3031
{
@@ -1357,6 +1358,7 @@ public static async Task ApplyRacialDeform(TTModel model, XivRace targetRace, bo
13571358
Vector3 normal = Vector3.Zero;
13581359
Vector3 binormal = Vector3.Zero;
13591360
Vector3 tangent = Vector3.Zero;
1361+
Vector3 flow = Vector3.Zero;
13601362

13611363
// And each bone in that vertex.
13621364
for (var b = 0; b < v.Weights.Length; b++)
@@ -1381,12 +1383,17 @@ public static async Task ApplyRacialDeform(TTModel model, XivRace targetRace, bo
13811383
normal += MatrixTransform(v.Normal, normalMatrix) * boneWeight;
13821384
binormal += MatrixTransform(v.Binormal, matrix) * boneWeight;
13831385
tangent += MatrixTransform(v.Tangent, matrix) * boneWeight;
1386+
if (v.FlowDirection != Vector3.Zero)
1387+
{
1388+
flow += MatrixTransform(v.FlowDirection, matrix) * boneWeight;
1389+
}
13841390
}
13851391

13861392
v.Position = position;
13871393
v.Normal = normal;
13881394
v.Binormal = binormal;
13891395
v.Tangent = tangent;
1396+
v.FlowDirection = flow;
13901397
}
13911398

13921399
// Same thing, but for the Shape Data parts.
@@ -1398,6 +1405,7 @@ public static async Task ApplyRacialDeform(TTModel model, XivRace targetRace, bo
13981405
Vector3 normal = Vector3.Zero;
13991406
Vector3 binormal = Vector3.Zero;
14001407
Vector3 tangent = Vector3.Zero;
1408+
Vector3 flow = Vector3.Zero;
14011409

14021410
// And each bone in that vertex.
14031411
for (var b = 0; b < v.Weights.Length; b++)
@@ -1422,12 +1430,17 @@ public static async Task ApplyRacialDeform(TTModel model, XivRace targetRace, bo
14221430
normal += MatrixTransform(v.Normal, normalMatrix) * boneWeight;
14231431
binormal += MatrixTransform(v.Binormal, matrix) * boneWeight;
14241432
tangent += MatrixTransform(v.Tangent, matrix) * boneWeight;
1433+
if (v.FlowDirection != Vector3.Zero)
1434+
{
1435+
flow += MatrixTransform(v.FlowDirection, matrix) * boneWeight;
1436+
}
14251437
}
14261438

14271439
v.Position = position;
14281440
v.Normal = normal;
14291441
v.Binormal = binormal;
14301442
v.Tangent = tangent;
1443+
v.FlowDirection = flow;
14311444
}
14321445
}
14331446

0 commit comments

Comments
 (0)