Refactor and enhance math, memory, and utilities
Refactored `sincos` usage in `quaternion` to use tuple-based returns for improved readability. Introduced a `random` struct with methods for generating random values of various types and dimensions, including ranges and directions. Added a `DynamicArray` class for dynamic resizing and manipulation of collections. Enhanced `SlotMap` with new methods for safe access and updates. Updated `uint` vector types with `NumericConvertable` attributes for better type interoperability. Removed the `MathUtilities` class and refactored `adj` and `adjInverse` methods for encapsulation. Improved memory management with `StackAllocator` and `UnsafeArray` enhancements. Added geometry utilities like `AABB`, `OBB`, `Plane`, and `SphereBounds` for 3D operations. Updated project configuration for versioning and NuGet packaging. Performed general code cleanup, improved validation, and aligned with modern C# practices.
This commit is contained in:
@@ -8,6 +8,9 @@ namespace Misaki.HighPerformance.Mathematics.CodeGen.Generators
|
||||
{
|
||||
protected const string INLINE_METHOD_ATTRIBUTE = "[global::System.Runtime.CompilerServices.MethodImpl(global::System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]";
|
||||
|
||||
protected static readonly string[] s_matrixComponents = new[] { "c0", "c1", "c2", "c3" };
|
||||
protected static readonly string[] s_vectorComponents = new[] { "x", "y", "z", "w" };
|
||||
|
||||
protected readonly StringBuilder sourceBuilder = new();
|
||||
protected NumericTypeInfo typeInfo = null!;
|
||||
|
||||
@@ -30,13 +33,31 @@ namespace Misaki.HighPerformance.Mathematics.CodeGen.Generators
|
||||
return sourceBuilder.ToString();
|
||||
}
|
||||
|
||||
protected void StartRegion(string name)
|
||||
{
|
||||
sourceBuilder.AppendLine($@"
|
||||
#region {name}");
|
||||
}
|
||||
|
||||
protected void EndRegion()
|
||||
{
|
||||
sourceBuilder.AppendLine($@"
|
||||
#endregion");
|
||||
}
|
||||
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void GenerateHeader()
|
||||
{
|
||||
sourceBuilder.AppendLine("// <auto-generated/>");
|
||||
sourceBuilder.AppendLine(@"// <auto-generated>
|
||||
// This code is generated by tool. Do not edit manually.
|
||||
// Update this file may introduce incorrect behavior and will be lost if the code is regenerated.
|
||||
// To update this file, edit the generator in the Misaki.HighPerformance.Mathematics.CodeGen and recompile it.
|
||||
// </auto-generated>
|
||||
");
|
||||
sourceBuilder.AppendLine("#nullable enable");
|
||||
}
|
||||
|
||||
protected virtual void GenerateNamespaceStart()
|
||||
|
||||
Reference in New Issue
Block a user