-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Matrix math for model-space handling
+ add option to disable character texture computation + add further ktisis credits (alloc class for transform matrices) + use model transform in debug view option selected is in model space
- Loading branch information
1 parent
751a948
commit a82213c
Showing
8 changed files
with
148 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Runtime.InteropServices; | ||
using FFXIVClientStructs.FFXIV.Common.Math; | ||
using FFXIVClientStructs.Havok.Common.Base.Math.Matrix; | ||
using FFXIVClientStructs.Havok.Common.Base.Math.QsTransform; | ||
|
||
namespace Meddle.Plugin.Utils; | ||
|
||
// https://github.com/ktisis-tools/Ktisis/blob/88c1af74f748298d1b1d01135aa58ce0a9530419/Ktisis/Interop/Alloc.cs | ||
internal static class Alloc { | ||
// Allocations | ||
private static IntPtr MatrixAlloc; | ||
|
||
// Access | ||
internal static unsafe Matrix4x4* Matrix; // Align to 16-byte boundary | ||
internal static unsafe Matrix4x4 GetMatrix(hkQsTransformf* transform) { | ||
transform->get4x4ColumnMajor((float*)Matrix); | ||
return *Matrix; | ||
} | ||
|
||
// internal static unsafe void SetMatrix(hkQsTransformf* transform, Matrix4x4 matrix) { | ||
// *Matrix = matrix; | ||
// transform->set((hkMatrix4f*)Matrix); | ||
// } | ||
|
||
// Init & dispose | ||
public static unsafe void Init() { | ||
// Allocate space for our matrix to be aligned on a 16-byte boundary. | ||
// This is required due to ffxiv's use of the MOVAPS instruction. | ||
// Thanks to Fayti1703 for helping with debugging and coming up with this fix. | ||
MatrixAlloc = Marshal.AllocHGlobal(sizeof(float) * 16 + 16); | ||
Matrix = (Matrix4x4*)(16 * ((long)(MatrixAlloc + 15) / 16)); | ||
} | ||
public static void Dispose() { | ||
Marshal.FreeHGlobal(MatrixAlloc); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters