mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Shader like vectors for C# Scripting
This commit is contained in:
@@ -69,6 +69,12 @@ static
|
||||
#endregion
|
||||
|
||||
#region modf / frac / trunc
|
||||
|
||||
// Splits the value x into fractional and integer parts, each of which has the same sign as x.
|
||||
public static float modf(float x, out float integerPart)
|
||||
{
|
||||
return Math.[Friend]modff(x.X, out integerPart);
|
||||
}
|
||||
|
||||
// Splits the value x into fractional and integer parts, each of which has the same sign as x.
|
||||
public static float2 modf(float2 x, out float2 integerPart)
|
||||
|
||||
@@ -53,6 +53,8 @@ static class ScriptGlue
|
||||
public static void Init()
|
||||
{
|
||||
RegisterCalls();
|
||||
|
||||
RegisterMathFunctions();
|
||||
}
|
||||
|
||||
public static void RegisterManagedComponents()
|
||||
@@ -284,6 +286,18 @@ static class ScriptGlue
|
||||
|
||||
#endregion Physics2D
|
||||
|
||||
#region Math
|
||||
|
||||
private static void RegisterMathFunctions()
|
||||
{
|
||||
RegisterCall<function float(float, out float)>("ScriptGlue::modf_float", => GlitchyEngine.Math.modf);
|
||||
RegisterCall<function float2(float2, out float2)>("ScriptGlue::modf_float2", => GlitchyEngine.Math.modf);
|
||||
RegisterCall<function float3(float3, out float3)>("ScriptGlue::modf_float3", => GlitchyEngine.Math.modf);
|
||||
RegisterCall<function float4(float4, out float4)>("ScriptGlue::modf_float4", => GlitchyEngine.Math.modf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static void RegisterCall<T>(String name, T method) where T : var
|
||||
{
|
||||
Mono.mono_add_internal_call(scope $"GlitchyEngine.{name}", (void*)method);
|
||||
|
||||
Reference in New Issue
Block a user