daily update on 20240513 by nitload youmu, instancing render added

This commit is contained in:
YoumuLiu
2024-05-13 03:39:54 +08:00
parent 56459deec5
commit a3506c96a3
78 changed files with 2562 additions and 1098 deletions
+12 -11
View File
@@ -167,9 +167,9 @@ namespace StgSharp.Graphics
_isLookAtAvailable = false;
Linear.Normalize(ref direction, ref up);
Linear.Orthogonalize(ref direction, ref up);
vec3d right = Linear.Normalize(Linear.Cross(up, direction));
vec3d right = Linear.Orthogonalize(Linear.Cross(up, direction));
cameraAtt.colum0.vec = right.vec;
cameraAtt.colum1.vec = up.vec;
@@ -209,12 +209,21 @@ namespace StgSharp.Graphics
Console.WriteLine(Projection);
Console.WriteLine(Projection * View);
Console.WriteLine(View);
foreach (var item in vec)
foreach (vec4d item in vec)
{
Console.Write($"{Projection * View * item};");
}
}
ShaderStruct IglConvertable.GetConvertedGLtype()
{
throw new NotImplementedException();
}
~Camera()
{
}
#region ratation
public void Yaw(Radius r)
@@ -306,14 +315,6 @@ namespace StgSharp.Graphics
#endregion
ShaderStruct IglConvertable.GetConvertedGLtype()
{
throw new NotImplementedException();
}
~Camera()
{
}
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Math
{
public interface IVector
{
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix2x2.cs"
// file="Matrix22.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
+3 -3
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix2x3.cs"
// file="Matrix23.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -36,13 +36,13 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = ((3 + 2) * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix23:IMat
public struct Matrix23 : IMat
{
[FieldOffset(5 * 4 * sizeof(float))] internal bool isTransposed;
[FieldOffset(3 * 4 * sizeof(float))] internal Mat2 transpose;
[FieldOffset(0)] internal Mat3 mat;
[FieldOffset(3 * 4 * sizeof(float))] internal Mat2 transpose;
internal Matrix23(
Vector4 c0,
+3 -3
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix2x4.cs"
// file="Matrix24.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -36,13 +36,13 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = ((4 + 2) * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix24:IMat
public struct Matrix24 : IMat
{
[FieldOffset(6 * 4 * sizeof(float))] internal bool isTransposed;
[FieldOffset(4 * 4 * sizeof(float))] internal Mat2 transpose;
[FieldOffset(0)] internal Mat4 mat;
[FieldOffset(4 * 4 * sizeof(float))] internal Mat2 transpose;
[FieldOffset(0)] public vec2d Colum0;
[FieldOffset(16)] public vec2d Colum1;
+5 -4
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix3x2.cs"
// file="Matrix32.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -36,16 +36,17 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = (5 * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix32:IMat
public struct Matrix32 : IMat
{
[FieldOffset(0)] internal vec3d colum0;
[FieldOffset(4 * 4)] internal vec3d colum1;
[FieldOffset(5 * 4 * sizeof(float))] internal bool isTransposed;
[FieldOffset(0)] internal Mat2 mat;
[FieldOffset(2 * 4 * sizeof(float))] internal Mat3 transpose;
[FieldOffset(0)] internal vec3d colum0;
[FieldOffset(4 * 4)] internal vec3d colum1;
internal Matrix32(
Vector4 c0,
Vector4 c1
+2 -2
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix3x3.cs"
// file="Matrix33.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -36,7 +36,7 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = (6 * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix33:IMat
public struct Matrix33 : IMat
{
[FieldOffset(6 * 4 * sizeof(float))] internal bool isTransposed;
+3 -3
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix3x4.cs"
// file="Matrix34.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -38,13 +38,13 @@ namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = (7 * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix34:IMat
public struct Matrix34 : IMat
{
[FieldOffset(7 * 4 * sizeof(float))] internal bool isTransposed;
[FieldOffset(4 * 4 * sizeof(float))] internal Mat3 transpose;
[FieldOffset(0)] internal Mat4 mat;
[FieldOffset(4 * 4 * sizeof(float))] internal Mat3 transpose;
[FieldOffset(0 * 4 * sizeof(float))] public vec3d Colum0;
[FieldOffset(1 * 4 * sizeof(float))] public vec3d Colum1;
+2 -2
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix4x2.cs"
// file="Matrix42.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -39,7 +39,7 @@ namespace StgSharp.Math
[StructLayout(LayoutKind.Explicit, Size = ((16 + 8) * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix42:IMat
public struct Matrix42 : IMat
{
[FieldOffset((16 + 8) * sizeof(float))] internal bool isTransposed;
+2 -2
View File
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="matrix4x3.cs"
// file="Matrix43.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -37,7 +37,7 @@ using System.Runtime.InteropServices;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = (7 * 4 * sizeof(float)) + sizeof(bool), Pack = 16)]
public struct Matrix43 : IEquatable<Matrix43>,IMat
public struct Matrix43 : IEquatable<Matrix43>, IMat
{
[FieldOffset(7 * 4 * sizeof(float))]
+10 -10
View File
@@ -49,9 +49,9 @@ namespace StgSharp.Math
[FieldOffset(0)] internal Mat4 mat;
[FieldOffset(16 * sizeof(float))] internal Mat4 transpose;
[FieldOffset(0 * sizeof(float))] internal vec4d colum0;
[FieldOffset(4 * sizeof(float))] internal vec4d colum1;
[FieldOffset(8 * sizeof(float))] internal vec4d colum2;
[FieldOffset(0 * sizeof(float))] internal vec4d colum0;
[FieldOffset(4 * sizeof(float))] internal vec4d colum1;
[FieldOffset(8 * sizeof(float))] internal vec4d colum2;
[FieldOffset(12 * sizeof(float))] internal vec4d colum3;
internal Matrix44(Mat4 mat)
@@ -151,6 +151,13 @@ namespace StgSharp.Math
0, 0, 1, 0,
0, 0, 0, 1
);
public static Matrix44 WNegativeUnit
=> new Matrix44(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, -1
);
public static Matrix44 XNegativeUnit
=> new Matrix44(
@@ -174,13 +181,6 @@ namespace StgSharp.Math
0, 0, -1, 0,
0, 0, 0, 1
);
public static Matrix44 WNegativeUnit
=> new Matrix44(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, -1
);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe float Det()
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Linear.Cross.cs"
// file="Vector.Cross.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Linear.GetAngle.cs"
// file="Vector.GetAngle.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Linear.GetLength.cs"
// file="Vector.GetLength.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -0,0 +1,106 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Vector.Orthogonalize.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp
{
internal static partial class InternalIO
{
[DllImport(SSC_libName, EntryPoint = "normalize",
CallingConvention = CallingConvention.Cdecl)]
internal static extern unsafe void Normalize(M128* source, M128* target);
}
}
namespace StgSharp.Math
{
public static partial class Linear
{
public static vec4d Orthogonalize(vec4d vec)
{
return new vec4d { vec = Vector4.Normalize(vec.vec) };
}
public static vec3d Orthogonalize(vec3d vec)
{
return new vec3d { vec = Vector4.Normalize(vec.vec) };
}
public static unsafe void Orthogonalize(ref vec4d source, ref vec4d target)
{
Vector4 s = source.vec;
Vector4 t = target.vec;
s = Vector4.Normalize(s);
float dotProduct = Vector4.Dot(s, t);
Vector4 projection = Vector4.Multiply(s, t);
t -= projection;
source.vec = s;
target.vec = t;
}
/// <summary>
/// Orthogonalize two <see cref="vec3d"/>s, let their length be 1
/// and perpendicular to each other.
/// </summary>
/// <param name="source"></param>
/// <param name="target"></param>
public static unsafe void Orthogonalize(ref vec3d source, ref vec3d target)
{
Vector3 s = source.v;
Vector3 t = target.v;
s = Vector3.Normalize(s);
Vector3 projection = (Vector3.Dot(t, s) / Vector3.Dot(s, s)) * s;
t -= projection;
t = Vector3.Normalize(t);
source.v = s;
target.v = t;
}
}
}
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Linear.VectorTransform.cs"
// file="Vector.VectorTransform.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
+4 -3
View File
@@ -68,6 +68,7 @@ namespace StgSharp
#endregion
#region transpose
@@ -93,9 +94,6 @@ namespace StgSharp.Math
internal struct Mat2 : IEquatable<Mat2>
{
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
[FieldOffset(0 * sizeof(float))] internal float m00;
[FieldOffset(4 * sizeof(float))] internal float m01;
[FieldOffset(1 * sizeof(float))] internal float m10;
@@ -105,6 +103,9 @@ namespace StgSharp.Math
[FieldOffset(3 * sizeof(float))] internal float m30;
[FieldOffset(7 * sizeof(float))] internal float m31;
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
internal Mat2(
Vector4 c0,
Vector4 c1
+5 -4
View File
@@ -49,6 +49,7 @@ namespace StgSharp
#endregion
#region transpose
[DllImport(SSC_libName, EntryPoint = "transpose3to4",
@@ -77,10 +78,6 @@ namespace StgSharp.Math
public struct Mat3 : IEquatable<Mat3>, IMat
{
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
[FieldOffset(8 * sizeof(float))] internal Vector4 colum2;
[FieldOffset(0 * sizeof(float))] internal float m00;
[FieldOffset(4 * sizeof(float))] internal float m01;
@@ -96,6 +93,10 @@ namespace StgSharp.Math
[FieldOffset(7 * sizeof(float))] internal float m31;
[FieldOffset(11 * sizeof(float))] internal float m32;
[FieldOffset(0)] internal Vector4 colum0;
[FieldOffset(4 * sizeof(float))] internal Vector4 colum1;
[FieldOffset(8 * sizeof(float))] internal Vector4 colum2;
public override bool Equals(object? obj)
{
return (obj is Mat3 mat) && Equals(mat);
+6 -4
View File
@@ -36,20 +36,20 @@ namespace StgSharp.Math
{
/// <summary>
/// A two dimension vector defined by two elements.
/// Vec2Ds in StgSharp are defaultly usaed as colum vector.
/// Vec2Ds in StgSharp are default used as colum vector.
/// </summary>
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
public struct vec2d
public struct vec2d:IVector
{
[FieldOffset(0)] internal unsafe fixed float num[2];
[FieldOffset(0)]
internal Vector2 v;
[FieldOffset(0)]
internal Vector4 vec;
[FieldOffset(0)] internal unsafe fixed float num[2];
[FieldOffset(0)]
public float X;
[FieldOffset(4)]
@@ -120,6 +120,7 @@ namespace StgSharp.Math
{
return new vec2d(tuple.Item1, tuple.Item2);
}
}
public static class Vec2d
@@ -128,5 +129,6 @@ namespace StgSharp.Math
public static vec2d Unit => new vec2d(1, 1);
public static vec2d Zero => new vec2d(0, 0);
}
}
+33 -34
View File
@@ -40,18 +40,18 @@ using System.Security.AccessControl;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
public struct vec3d : IEquatable<vec3d>
public struct vec3d : IEquatable<vec3d>, IVector
{
[FieldOffset(0)] internal unsafe fixed float num[3];
[FieldOffset(0)]
internal M128 reg;
[FieldOffset(0)]
internal Vector3 v;
[FieldOffset(0)]
internal Vector4 vec;
[FieldOffset(0)]
internal M128 reg;
[FieldOffset(0)] internal unsafe fixed float num[3];
[FieldOffset(0)] public float X;
[FieldOffset(4)] public float Y;
@@ -67,6 +67,12 @@ namespace StgSharp.Math
v = vector;
}
public vec3d(vec2d xy, float z)
{
vec = xy.vec;
Z = z;
}
public vec3d(
float x, float y, float z)
{
@@ -76,20 +82,16 @@ namespace StgSharp.Math
v = new Vector3(x, y, z);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public vec3d Cross(vec3d right)
public vec3d XYZ
{
return new vec3d(
(this.Y * right.Z) - (this.Z * right.Y),
(this.X * right.Z) - (this.Z * right.X),
(this.X * right.Y) - (this.Y * right.X)
);
get { return new vec3d(v); }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float Dot(vec3d right)
{
return Vector3.Dot(v,right.v);
return Vector3.Dot(v, right.v);
}
public bool Equals(vec3d other)
@@ -178,20 +180,10 @@ namespace StgSharp.Math
return new vec3d(vec.v / value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe implicit operator vec3d((float, float, float) tuple)
{
vec3d v = *(vec3d*)&tuple;
v.vec.W = 0.0f;
return v;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static vec3d operator +(vec3d left, vec3d right)
{
return new vec3d(
left.vec + right.vec
);
return new vec3d(left.vec + right.vec);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -200,17 +192,25 @@ namespace StgSharp.Math
return left.v == right.v;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe implicit operator vec3d((float, float, float) tuple)
{
vec3d v = *(vec3d*)&tuple;
v.vec.W = 0.0f;
return v;
}
}
public static class Vec3d
{
public static bool IsParallel(vec3d left, vec3d right)
{
return Cross(left,right) == Zero;
}
public static vec3d One => new vec3d(1, 1, 1);
public static vec3d UnitX => new vec3d(1, 0, 0);
public static vec3d UnitY => new vec3d(0, 1, 0);
public static vec3d UnitZ => new vec3d(0, 0, 1);
public static vec3d Zero => new vec3d(0, 0, 0);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static vec3d Cross(vec3d left, vec3d right)
@@ -218,11 +218,10 @@ namespace StgSharp.Math
return Linear.Cross(left, right);
}
public static vec3d One => new vec3d(1, 1, 1);
public static vec3d Zero => new vec3d(0, 0, 0);
public static bool IsParallel(vec3d left, vec3d right)
{
return Cross(left, right) == Zero;
}
public static vec3d UnitZ => new vec3d(0, 0, 1);
public static vec3d UnitX => new vec3d(1, 0, 0);
public static vec3d UnitY => new vec3d(0, 1, 0);
}
}
-6
View File
@@ -28,12 +28,6 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
//
//
// some of the code is rewritten from the AMD code:
// https://github.com/amd/aocl-libm-ose/blob/a43e092b03213eb0e129a1cc129900e6e4475778/src/ref/asinf.c
using System;
+39
View File
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Math
{
public static partial class Scaler
{
public static float MaxOf(params float[] stream)
{
float ret = stream[0];
foreach (var num in stream)
{
if (ret < num)
{
ret = num;
}
}
return ret;
}
public static float MinOf(params float[] stream)
{
float ret = stream[0];
foreach (var num in stream)
{
if (ret > num)
{
ret = num;
}
}
return ret;
}
}
}
+1
View File
@@ -35,6 +35,7 @@ namespace StgSharp.Math
{
public static partial class Scaler
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Cos(float x)
{
+14 -14
View File
@@ -44,13 +44,7 @@ namespace StgSharp.Math
public static unsafe partial class Scaler
{
internal static float currentSeed
#if DEBUG
= 0.5f;
#else
= Abs(System.DateTime.UtcNow.GetHashCode());
#endif
private static byte[] randomSeed;
/// <summary>
/// returns a random float number between 0 and 1.
@@ -82,8 +76,6 @@ namespace StgSharp.Math
}
private static byte[] randomSeed;
/// <summary>
///
/// </summary>
@@ -94,13 +86,13 @@ namespace StgSharp.Math
,INumber
#endif
{
if (randomSeed==null)
if (randomSeed == null)
{
randomSeed = new byte[64];
var originSeed =
$"{(Assembly.GetEntryAssembly()==null? Assembly.GetAssembly(typeof(StgSharp))!:
Assembly.GetEntryAssembly())}" +
$"{DateTime.UtcNow.ToString("o")}";
string originSeed =
($"{((Assembly.GetEntryAssembly() == null) ? (Assembly.GetAssembly(typeof(StgSharp))!) :
Assembly.GetEntryAssembly())}") +
($"{DateTime.UtcNow.ToString("o")}");
using (SHA256 sha = SHA256.Create())
{
randomSeed = sha.ComputeHash(Encoding.UTF8.GetBytes(originSeed));
@@ -131,5 +123,13 @@ namespace StgSharp.Math
return *(int*)&seedValue;
}
internal static float currentSeed
#if DEBUG
= 0.5f;
#else
= Abs(System.DateTime.UtcNow.GetHashCode());
#endif
}
}
+34 -2
View File
@@ -1,4 +1,34 @@
using System;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="SignOf.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
@@ -9,6 +39,7 @@ namespace StgSharp.Math
{
public static unsafe partial class Scaler
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe int SignOf(float x)
{
@@ -16,7 +47,7 @@ namespace StgSharp.Math
{
return 0;
}
if (x>0)
if (x > 0)
{
return 1;
}
@@ -35,5 +66,6 @@ namespace StgSharp.Math
}
return -1;
}
}
}