mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Script glue works!
This commit is contained in:
@@ -796,9 +796,9 @@ static class ScriptGlue
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RegisterCall("ScriptGlue::Entity_FindEntityWithName")]
|
[RegisterCall("ScriptGlue::Entity_FindEntityWithName")]
|
||||||
static void Entity_FindEntityWithName(MonoString* monoName, UUID* outUuid)
|
static void Entity_FindEntityWithName(MonoString* monoName, out UUID outUuid)
|
||||||
{
|
{
|
||||||
*outUuid = UUID(0);
|
outUuid = UUID(0);
|
||||||
|
|
||||||
char8* entityName = Mono.mono_string_to_utf8(monoName);
|
char8* entityName = Mono.mono_string_to_utf8(monoName);
|
||||||
|
|
||||||
@@ -809,7 +809,7 @@ static class ScriptGlue
|
|||||||
Mono.mono_free(entityName);
|
Mono.mono_free(entityName);
|
||||||
|
|
||||||
if (entityResult case .Ok(let entity))
|
if (entityResult case .Ok(let entity))
|
||||||
*outUuid = entity.UUID;
|
outUuid = entity.UUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
[RegisterCall("ScriptGlue::Entity_GetScriptInstance")]
|
[RegisterCall("ScriptGlue::Entity_GetScriptInstance")]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace GlitchyEngine.Core;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The type of projection used by a camera.
|
/// The type of projection used by a camera.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EngineClass("GlitchyEngine.World.SceneCamera.ProjectionType")]
|
||||||
public enum ProjectionType : byte
|
public enum ProjectionType : byte
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -99,6 +99,6 @@ public class Transform : Component
|
|||||||
ScriptGlue.Transform_GetScale(Entity.UUID, out float3 scale);
|
ScriptGlue.Transform_GetScale(Entity.UUID, out float3 scale);
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
set => ScriptGlue.Transform_SetScale(Entity.UUID, in value);
|
set => ScriptGlue.Transform_SetScale(Entity.UUID, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace GlitchyEngine.Core;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[DebuggerDisplay("{ToString()}")]
|
[DebuggerDisplay("{ToString()}")]
|
||||||
[EngineClass("GlitchyEngine.Core.UUID")]
|
[EngineClass("GlitchyEngine.Core.UUID")]
|
||||||
[EngineClass("GlitchyEngine.Core.AssetHandle")]
|
[EngineClass("GlitchyEngine.Content.AssetHandle")]
|
||||||
public struct UUID
|
public struct UUID
|
||||||
{
|
{
|
||||||
private ulong _uuid;
|
private ulong _uuid;
|
||||||
@@ -32,7 +32,7 @@ public struct UUID
|
|||||||
/// <returns>The newly created <see cref="UUID"/></returns>
|
/// <returns>The newly created <see cref="UUID"/></returns>
|
||||||
public static UUID CreateNew()
|
public static UUID CreateNew()
|
||||||
{
|
{
|
||||||
ScriptGlue.UUID_CreateNew(out UUID id);
|
ScriptGlue.UUID_Create(out UUID id);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Entity : EngineObject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get => ScriptGlue.Entity_GetName(_uuid);
|
get => "TODO!";//ScriptGlue.Entity_GetName(_uuid);
|
||||||
set => ScriptGlue.Entity_SetName(_uuid, value);
|
set => ScriptGlue.Entity_SetName(_uuid, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace GlitchyEngine.Graphics;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Material : Asset
|
public class Material : Asset
|
||||||
{
|
{
|
||||||
|
[EngineClass("GlitchyEngine.Renderer.ShaderVariableType")]
|
||||||
internal enum ShaderVariableType : byte
|
internal enum ShaderVariableType : byte
|
||||||
{
|
{
|
||||||
Bool,
|
Bool,
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
namespace GlitchyEngine.Graphics.Text;
|
using GlitchyEngine.Core;
|
||||||
|
|
||||||
|
namespace GlitchyEngine.Graphics.Text;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The horizontal alignment of text.
|
/// The horizontal alignment of text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EngineClass("GlitchyEngine.Renderer.Text.FontRenderer.HorizontalTextAlignment")]
|
||||||
public enum HorizontalTextAlignment : byte
|
public enum HorizontalTextAlignment : byte
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using GlitchyEngine.Core;
|
||||||
|
|
||||||
namespace GlitchyEngine.Math;
|
namespace GlitchyEngine.Math;
|
||||||
|
|
||||||
@@ -6,6 +7,7 @@ namespace GlitchyEngine.Math;
|
|||||||
/// Represents a rotation around an axis by a specific angle.
|
/// Represents a rotation around an axis by a specific angle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||||
|
[EngineClass("GlitchyEngine.Scripting.ScriptGlue.AxisAngle")]
|
||||||
public struct RotationAxisAngle
|
public struct RotationAxisAngle
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using GlitchyEngine.Core;
|
||||||
|
|
||||||
namespace GlitchyEngine.Physics;
|
namespace GlitchyEngine.Physics;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Describes whether the rigid body is static, dynamic or kinematic.
|
/// Describes whether the rigid body is static, dynamic or kinematic.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[EngineClass("GlitchyEngine.World.Rigidbody2DComponent.BodyType")]
|
||||||
public enum BodyType : byte
|
public enum BodyType : byte
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<BaseOutputPath>
|
<BaseOutputPath></BaseOutputPath>
|
||||||
</BaseOutputPath>
|
|
||||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||||
<RootNamespace>GlitchyEngine</RootNamespace>
|
<RootNamespace>GlitchyEngine</RootNamespace>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
@@ -14,8 +13,6 @@
|
|||||||
|
|
||||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||||
<EnableDynamicLoading>true</EnableDynamicLoading>
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
<!--<DebugType>embedded</DebugType>-->
|
|
||||||
<!--<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>-->
|
|
||||||
<GeneratedSchemaPath>$(ProjectDir)../generated/ScriptGlue.json</GeneratedSchemaPath>
|
<GeneratedSchemaPath>$(ProjectDir)../generated/ScriptGlue.json</GeneratedSchemaPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
|||||||
+288
-287
@@ -19,20 +19,21 @@ using GlitchyEngine.Graphics.Text;
|
|||||||
using GlitchyEngine.Math;
|
using GlitchyEngine.Math;
|
||||||
using GlitchyEngine.Physics;
|
using GlitchyEngine.Physics;
|
||||||
using GlitchyEngine.Serialization;
|
using GlitchyEngine.Serialization;
|
||||||
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace GlitchyEngine;
|
namespace GlitchyEngine;
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal unsafe partial struct EngineFunctions
|
internal unsafe partial struct EngineFunctions
|
||||||
{
|
{
|
||||||
public delegate* unmanaged[Cdecl]<GlitchyEngine.Log.LogLevel, char*, char*, int, void> Log_LogMessage;
|
//public delegate* unmanaged[Cdecl]<GlitchyEngine.Log.LogLevel, char*, char*, int, void> Log_LogMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All methods in here are glued to the ScriptGlue.bf in the engine.
|
/// All methods in here are glued to the ScriptGlue.bf in the engine.
|
||||||
/// TODO: This could be auto-generated fairly easily
|
/// TODO: This could be auto-generated fairly easily
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static partial class ScriptGlue
|
internal static unsafe partial class ScriptGlue
|
||||||
{
|
{
|
||||||
#region Script Glueing infrastructure
|
#region Script Glueing infrastructure
|
||||||
|
|
||||||
@@ -469,429 +470,429 @@ internal static partial class ScriptGlue
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Log
|
//#region Log
|
||||||
|
|
||||||
// public unsafe static void Log_LogMessage(GlitchyEngine.Log.LogLevel logLevel, string messagePtr, string fileNamePtr, int lineNumber)
|
// //public unsafe static void Log_LogMessage(GlitchyEngine.Log.LogLevel logLevel, string messagePtr, string fileNamePtr, int lineNumber)
|
||||||
// {
|
// //{
|
||||||
// fixed (char* messagePtrConverted = messagePtr) {
|
// // fixed (char* messagePtrConverted = messagePtr) {
|
||||||
// fixed (char* fileNamePtrConverted = fileNamePtr) {
|
// // fixed (char* fileNamePtrConverted = fileNamePtr) {
|
||||||
// _engineFunctions.Log_LogMessage(logLevel, messagePtrConverted, fileNamePtrConverted, lineNumber);
|
// // _engineFunctions.Log_LogMessage(logLevel, messagePtrConverted, fileNamePtrConverted, lineNumber);
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
//
|
// //
|
||||||
//
|
// //
|
||||||
// }
|
// //}
|
||||||
//internal static unsafe void Log_LogMessage(Log.LogLevel logLevel, string message, string filePath, int line)
|
// //internal static unsafe void Log_LogMessage(Log.LogLevel logLevel, string message, string filePath, int line)
|
||||||
//{
|
// //{
|
||||||
// // unsafe
|
// // // unsafe
|
||||||
// // {
|
// // // {
|
||||||
// // byte* mess = (byte*)Marshal.StringToCoTaskMemUTF8(message);
|
// // // byte* mess = (byte*)Marshal.StringToCoTaskMemUTF8(message);
|
||||||
// //
|
// // //
|
||||||
// // fixed (char* messagePtr = message)
|
// // // fixed (char* messagePtr = message)
|
||||||
// // fixed (char* filePathPtr = filePath)
|
// // // fixed (char* filePathPtr = filePath)
|
||||||
// // {
|
// // // {
|
||||||
// // _engineFunctions.Log_LogMessage(logLevel, messagePtr, filePathPtr, line);
|
// // // _engineFunctions.Log_LogMessage(logLevel, messagePtr, filePathPtr, line);
|
||||||
// // }
|
// // // }
|
||||||
// //
|
// // //
|
||||||
// // Marshal.FreeCoTaskMem((IntPtr)mess);
|
// // // Marshal.FreeCoTaskMem((IntPtr)mess);
|
||||||
// // }
|
// // // }
|
||||||
//}
|
// //}
|
||||||
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern void Log_LogException(Exception exception);
|
// public static extern void Log_LogException(Exception exception);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Entity
|
//#region Entity
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_Create(object scriptInstance, string? entityName, Type[]? componentTypes, out UUID entityId);
|
// internal static extern void Entity_Create(object scriptInstance, string? entityName, Type[]? componentTypes, out UUID entityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_Destroy(UUID entityId);
|
// internal static extern void Entity_Destroy(UUID entityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_CreateInstance(UUID entityId, out UUID newEntityId);
|
// internal static extern void Entity_CreateInstance(UUID entityId, out UUID newEntityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_AddComponent(UUID entityId, Type componentType);
|
// internal static extern void Entity_AddComponent(UUID entityId, Type componentType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_AddComponents(UUID entityId, Type[] componentTypes);
|
// internal static extern void Entity_AddComponents(UUID entityId, Type[] componentTypes);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Entity_HasComponent(UUID entityId, Type componentType);
|
// internal static extern bool Entity_HasComponent(UUID entityId, Type componentType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_RemoveComponent(UUID entityId, Type componentType);
|
// internal static extern void Entity_RemoveComponent(UUID entityId, Type componentType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_FindEntityWithName(string name, out UUID uuid);
|
// internal static extern void Entity_FindEntityWithName(string name, out UUID uuid);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_GetScriptInstance(UUID entityId, out object? instance);
|
// internal static extern void Entity_GetScriptInstance(UUID entityId, out object? instance);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern object Entity_SetScript(UUID entityId, Type scriptType);
|
// internal static extern object Entity_SetScript(UUID entityId, Type scriptType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Entity_RemoveScript(UUID entityId);
|
// internal static extern void Entity_RemoveScript(UUID entityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern string Entity_GetName(UUID entityId);
|
// public static extern string Entity_GetName(UUID entityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern string Entity_SetName(UUID entityId, string name);
|
// public static extern string Entity_SetName(UUID entityId, string name);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern void Entity_GetEditorFlags(UUID uuid, out EditorFlags flags);
|
// public static extern void Entity_GetEditorFlags(UUID uuid, out EditorFlags flags);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern void Entity_SetEditorFlags(UUID uuid, EditorFlags editorFlags);
|
// public static extern void Entity_SetEditorFlags(UUID uuid, EditorFlags editorFlags);
|
||||||
|
|
||||||
#endregion Entity
|
//#endregion Entity
|
||||||
|
|
||||||
#region TransformComponent
|
//#region TransformComponent
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetParent(UUID entityId, out UUID parentId);
|
// internal static extern void Transform_GetParent(UUID entityId, out UUID parentId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetParent(UUID entityId, in UUID parentId);
|
// internal static extern void Transform_SetParent(UUID entityId, in UUID parentId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetTranslation(UUID entityId, out float3 translation);
|
// internal static extern void Transform_GetTranslation(UUID entityId, out float3 translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetTranslation(UUID entityId, in float3 translation);
|
// internal static extern void Transform_SetTranslation(UUID entityId, in float3 translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetWorldTranslation(UUID entityId, out float3 translation);
|
// internal static extern void Transform_GetWorldTranslation(UUID entityId, out float3 translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetWorldTranslation(UUID entityId, in float3 translation);
|
// internal static extern void Transform_SetWorldTranslation(UUID entityId, in float3 translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetRotation(UUID entityId, out Quaternion rotation);
|
// internal static extern void Transform_GetRotation(UUID entityId, out Quaternion rotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetRotation(UUID entityId, in Quaternion rotation);
|
// internal static extern void Transform_SetRotation(UUID entityId, in Quaternion rotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetRotationEuler(UUID entityId, out float3 rotationEuler);
|
// internal static extern void Transform_GetRotationEuler(UUID entityId, out float3 rotationEuler);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetRotationEuler(UUID entityId, in float3 rotationEuler);
|
// internal static extern void Transform_SetRotationEuler(UUID entityId, in float3 rotationEuler);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetRotationAxisAngle(UUID entityId, out RotationAxisAngle translation);
|
// internal static extern void Transform_GetRotationAxisAngle(UUID entityId, out RotationAxisAngle translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetRotationAxisAngle(UUID entityId, RotationAxisAngle translation);
|
// internal static extern void Transform_SetRotationAxisAngle(UUID entityId, RotationAxisAngle translation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_GetScale(UUID entityId, out float3 scale);
|
// internal static extern void Transform_GetScale(UUID entityId, out float3 scale);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Transform_SetScale(UUID entityId, in float3 scale);
|
// internal static extern void Transform_SetScale(UUID entityId, in float3 scale);
|
||||||
|
|
||||||
#endregion TransformComponent
|
//#endregion TransformComponent
|
||||||
|
|
||||||
#region RigidBody2D
|
//#region RigidBody2D
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_ApplyForce(UUID entityId, in float2 force, float2 point, bool wakeUp);
|
// internal static extern void Rigidbody2D_ApplyForce(UUID entityId, in float2 force, float2 point, bool wakeUp);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_ApplyForceToCenter(UUID entityId, in float2 force, bool wakeUp);
|
// internal static extern void Rigidbody2D_ApplyForceToCenter(UUID entityId, in float2 force, bool wakeUp);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetPosition(UUID entityId, in float2 position);
|
// internal static extern void Rigidbody2D_SetPosition(UUID entityId, in float2 position);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetPosition(UUID entityId, out float2 position);
|
// internal static extern void Rigidbody2D_GetPosition(UUID entityId, out float2 position);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetRotation(UUID entityId, in float rotation);
|
// internal static extern void Rigidbody2D_SetRotation(UUID entityId, in float rotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetRotation(UUID entityId, out float rotation);
|
// internal static extern void Rigidbody2D_GetRotation(UUID entityId, out float rotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetLinearVelocity(UUID entityId, in float2 velocity);
|
// internal static extern void Rigidbody2D_SetLinearVelocity(UUID entityId, in float2 velocity);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetLinearVelocity(UUID entityId, out float2 velocity);
|
// internal static extern void Rigidbody2D_GetLinearVelocity(UUID entityId, out float2 velocity);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetAngularVelocity(UUID entityId, in float velocity);
|
// internal static extern void Rigidbody2D_SetAngularVelocity(UUID entityId, in float velocity);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetAngularVelocity(UUID entityId, out float velocity);
|
// internal static extern void Rigidbody2D_GetAngularVelocity(UUID entityId, out float velocity);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetBodyType(UUID entityId, out BodyType bodyType);
|
// internal static extern void Rigidbody2D_GetBodyType(UUID entityId, out BodyType bodyType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetBodyType(UUID entityId, in BodyType bodyType);
|
// internal static extern void Rigidbody2D_SetBodyType(UUID entityId, in BodyType bodyType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_IsFixedRotation(UUID entityId, out bool isFixedRotation);
|
// internal static extern void Rigidbody2D_IsFixedRotation(UUID entityId, out bool isFixedRotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetFixedRotation(UUID entityId, in bool isFixedRotation);
|
// internal static extern void Rigidbody2D_SetFixedRotation(UUID entityId, in bool isFixedRotation);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_GetGravityScale(UUID entityId, out float gravityScale);
|
// internal static extern void Rigidbody2D_GetGravityScale(UUID entityId, out float gravityScale);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Rigidbody2D_SetGravityScale(UUID entityId, in float gravityScale);
|
// internal static extern void Rigidbody2D_SetGravityScale(UUID entityId, in float gravityScale);
|
||||||
|
|
||||||
#endregion RigidBody2D
|
//#endregion RigidBody2D
|
||||||
|
|
||||||
#region Camera
|
//#region Camera
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetProjectionType(UUID entityId, out ProjectionType projectionType);
|
// internal static extern void Camera_GetProjectionType(UUID entityId, out ProjectionType projectionType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetProjectionType(UUID entityId, in ProjectionType projectionType);
|
// internal static extern void Camera_SetProjectionType(UUID entityId, in ProjectionType projectionType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetPerspectiveFovY(UUID entityId, out float fovY);
|
// internal static extern void Camera_GetPerspectiveFovY(UUID entityId, out float fovY);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetPerspectiveFovY(UUID entityId, float fovY);
|
// internal static extern void Camera_SetPerspectiveFovY(UUID entityId, float fovY);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetPerspectiveNearPlane(UUID entityId, out float nearPlane);
|
// internal static extern void Camera_GetPerspectiveNearPlane(UUID entityId, out float nearPlane);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetPerspectiveNearPlane(UUID entityId, float nearPlane);
|
// internal static extern void Camera_SetPerspectiveNearPlane(UUID entityId, float nearPlane);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetPerspectiveFarPlane(UUID entityId, out float farPlane);
|
// internal static extern void Camera_GetPerspectiveFarPlane(UUID entityId, out float farPlane);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetPerspectiveFarPlane(UUID entityId, float farPlane);
|
// internal static extern void Camera_SetPerspectiveFarPlane(UUID entityId, float farPlane);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetOrthographicHeight(UUID entityId, out float height);
|
// internal static extern void Camera_GetOrthographicHeight(UUID entityId, out float height);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetOrthographicHeight(UUID entityId, float height);
|
// internal static extern void Camera_SetOrthographicHeight(UUID entityId, float height);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetOrthographicNearPlane(UUID entityId, out float nearPlane);
|
// internal static extern void Camera_GetOrthographicNearPlane(UUID entityId, out float nearPlane);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetOrthographicNearPlane(UUID entityId, float nearPlane);
|
// internal static extern void Camera_SetOrthographicNearPlane(UUID entityId, float nearPlane);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetOrthographicFarPlane(UUID entityId, out float farPlane);
|
// internal static extern void Camera_GetOrthographicFarPlane(UUID entityId, out float farPlane);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetOrthographicFarPlane(UUID entityId, float farPlane);
|
// internal static extern void Camera_SetOrthographicFarPlane(UUID entityId, float farPlane);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetAspectRatio(UUID entityId, out float aspectRatio);
|
// internal static extern void Camera_GetAspectRatio(UUID entityId, out float aspectRatio);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetAspectRatio(UUID entityId, float aspectRatio);
|
// internal static extern void Camera_SetAspectRatio(UUID entityId, float aspectRatio);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_GetFixedAspectRatio(UUID entityId, out bool fixedAspectRatio);
|
// internal static extern void Camera_GetFixedAspectRatio(UUID entityId, out bool fixedAspectRatio);
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Camera_SetFixedAspectRatio(UUID entityId, bool fixedAspectRatio);
|
// internal static extern void Camera_SetFixedAspectRatio(UUID entityId, bool fixedAspectRatio);
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Physics2D
|
//#region Physics2D
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Physics2D_GetGravity(out float2 gravity);
|
// internal static extern void Physics2D_GetGravity(out float2 gravity);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Physics2D_SetGravity(in float2 gravity);
|
// internal static extern void Physics2D_SetGravity(in float2 gravity);
|
||||||
|
|
||||||
#endregion Physics2D
|
//#endregion Physics2D
|
||||||
|
|
||||||
#region CircleRenderer
|
//#region CircleRenderer
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
// internal static extern void CircleRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_SetColor(UUID entityId, ColorRGBA color);
|
// internal static extern void CircleRenderer_SetColor(UUID entityId, ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_GetUvTransform(UUID entityId, out float4 uvTransform);
|
// internal static extern void CircleRenderer_GetUvTransform(UUID entityId, out float4 uvTransform);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_SetUvTransform(UUID entityId, float4 uvTransform);
|
// internal static extern void CircleRenderer_SetUvTransform(UUID entityId, float4 uvTransform);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_GetInnerRadius(UUID entityId, out float innerRadius);
|
// internal static extern void CircleRenderer_GetInnerRadius(UUID entityId, out float innerRadius);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void CircleRenderer_SetInnerRadius(UUID entityId, float innerRadius);
|
// internal static extern void CircleRenderer_SetInnerRadius(UUID entityId, float innerRadius);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region SpriteRenderer
|
//#region SpriteRenderer
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
// internal static extern void SpriteRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_SetColor(UUID entityId, ColorRGBA color);
|
// internal static extern void SpriteRenderer_SetColor(UUID entityId, ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_GetUvTransform(UUID entityId, out UVTransform uvTransform);
|
// internal static extern void SpriteRenderer_GetUvTransform(UUID entityId, out UVTransform uvTransform);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_SetUvTransform(UUID entityId, UVTransform uvTransform);
|
// internal static extern void SpriteRenderer_SetUvTransform(UUID entityId, UVTransform uvTransform);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_GetMaterial(UUID entityId, out UUID materialId);
|
// internal static extern void SpriteRenderer_GetMaterial(UUID entityId, out UUID materialId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void SpriteRenderer_SetMaterial(UUID entityId, UUID materialId);
|
// internal static extern void SpriteRenderer_SetMaterial(UUID entityId, UUID materialId);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region TextRenderer
|
//#region TextRenderer
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool TextRenderer_GetIsRichText(UUID entityId);
|
// internal static extern bool TextRenderer_GetIsRichText(UUID entityId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_SetIsRichText(UUID entityId, bool isRichText);
|
// internal static extern void TextRenderer_SetIsRichText(UUID entityId, bool isRichText);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_GetText(UUID entityId, out string text);
|
// internal static extern void TextRenderer_GetText(UUID entityId, out string text);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_SetText(UUID entityId, string text);
|
// internal static extern void TextRenderer_SetText(UUID entityId, string text);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
// internal static extern void TextRenderer_GetColor(UUID entityId, out ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_SetColor(UUID entityId, ColorRGBA color);
|
// internal static extern void TextRenderer_SetColor(UUID entityId, ColorRGBA color);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_GetHorizontalAlignment(UUID entityId, out HorizontalTextAlignment horizontalAlignment);
|
// internal static extern void TextRenderer_GetHorizontalAlignment(UUID entityId, out HorizontalTextAlignment horizontalAlignment);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_SetHorizontalAlignment(UUID entityId, HorizontalTextAlignment horizontalAlignment);
|
// internal static extern void TextRenderer_SetHorizontalAlignment(UUID entityId, HorizontalTextAlignment horizontalAlignment);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_GetFontSize(UUID uuid, out float fontSize);
|
// internal static extern void TextRenderer_GetFontSize(UUID uuid, out float fontSize);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void TextRenderer_SetFontSize(UUID uuid, float fontSize);
|
// internal static extern void TextRenderer_SetFontSize(UUID uuid, float fontSize);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region MeshRenderer
|
//#region MeshRenderer
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void MeshRenderer_GetMaterial(UUID entityId, out UUID materialId);
|
// internal static extern void MeshRenderer_GetMaterial(UUID entityId, out UUID materialId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void MeshRenderer_SetMaterial(UUID entityId, UUID materialId);
|
// internal static extern void MeshRenderer_SetMaterial(UUID entityId, UUID materialId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void MeshRenderer_GetSharedMaterial(UUID entityId, out UUID materialId);
|
// internal static extern void MeshRenderer_GetSharedMaterial(UUID entityId, out UUID materialId);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Math
|
//#region Math
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern float modf_float(float x, out float integerPart);
|
// internal static extern float modf_float(float x, out float integerPart);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern float2 modf_float2(float2 x, out float2 integerPart);
|
// internal static extern float2 modf_float2(float2 x, out float2 integerPart);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern float3 modf_float3(float3 x, out float3 integerPart);
|
// internal static extern float3 modf_float3(float3 x, out float3 integerPart);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern float4 modf_float4(float4 x, out float4 integerPart);
|
// internal static extern float4 modf_float4(float4 x, out float4 integerPart);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void UUID_CreateNew(out UUID uuid);
|
// internal static extern void UUID_CreateNew(out UUID uuid);
|
||||||
|
|
||||||
#region Application
|
//#region Application
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Application_IsEditor();
|
// internal static extern bool Application_IsEditor();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Application_IsPlayer();
|
// internal static extern bool Application_IsPlayer();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Application_IsInEditMode();
|
// internal static extern bool Application_IsInEditMode();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Application_IsInPlayMode();
|
// internal static extern bool Application_IsInPlayMode();
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Serialization
|
//#region Serialization
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Serialization_SerializeField(IntPtr serializationContext, SerializationType type, string name, object? value, string? fullTypeName = null);
|
// internal static extern void Serialization_SerializeField(IntPtr serializationContext, SerializationType type, string name, object? value, string? fullTypeName = null);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Serialization_CreateObject(IntPtr currentContext, bool isStatic, string fullTypeName, out IntPtr context, out UUID id);
|
// internal static extern void Serialization_CreateObject(IntPtr currentContext, bool isStatic, string fullTypeName, out IntPtr context, out UUID id);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern unsafe void Serialization_DeserializeField(IntPtr internalContext, SerializationType expectedType, string fieldName, byte* value, out SerializationType actualType);
|
// public static extern unsafe void Serialization_DeserializeField(IntPtr internalContext, SerializationType expectedType, string fieldName, byte* value, out SerializationType actualType);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern void Serialization_GetObject(IntPtr internalContext, UUID id, out IntPtr objectContext);
|
// public static extern void Serialization_GetObject(IntPtr internalContext, UUID id, out IntPtr objectContext);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
public static extern void Serialization_GetObjectTypeName(IntPtr internalContext, out string fullTypeName);
|
// public static extern void Serialization_GetObjectTypeName(IntPtr internalContext, out string fullTypeName);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Asset
|
//#region Asset
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Asset_GetIdentifier(UUID assetId, out string text);
|
// internal static extern void Asset_GetIdentifier(UUID assetId, out string text);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void Asset_SetIdentifier(UUID assetId, string text);
|
// internal static extern void Asset_SetIdentifier(UUID assetId, string text);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region Material
|
//#region Material
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern unsafe bool Material_SetVariable(UUID assetId, string variableName, Material.ShaderVariableType elementType, int rows, int columns, int arrayLength, void* rawData, int dataLength);
|
// internal static extern unsafe bool Material_SetVariable(UUID assetId, string variableName, Material.ShaderVariableType elementType, int rows, int columns, int arrayLength, void* rawData, int dataLength);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Material_ResetVariable(UUID assetId, string variableName);
|
// internal static extern bool Material_ResetVariable(UUID assetId, string variableName);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Material_SetTexture(UUID materialId, string textureName, UUID textureId);
|
// internal static extern bool Material_SetTexture(UUID materialId, string textureName, UUID textureId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Material_GetTexture(UUID materialId, string textureName, out UUID textureId);
|
// internal static extern bool Material_GetTexture(UUID materialId, string textureName, out UUID textureId);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool Material_ResetTexture(UUID materialId, string textureName);
|
// internal static extern bool Material_ResetTexture(UUID materialId, string textureName);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region ImGui
|
//#region ImGui
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern void ImGuiExtension_ListElementGrabber();
|
// internal static extern void ImGuiExtension_ListElementGrabber();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
// [MethodImpl(MethodImplOptions.InternalCall)]
|
||||||
internal static extern bool ImGuiExtension_ShowAssetDropTarget(ref UUID assetId);
|
// internal static extern bool ImGuiExtension_ShowAssetDropTarget(ref UUID assetId);
|
||||||
|
|
||||||
#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
context.RegisterSourceOutput(combinedProvider, GenerateCode);
|
context.RegisterSourceOutput(combinedProvider, GenerateCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MappedType
|
private class MappedType
|
||||||
{
|
{
|
||||||
public string BeefTypeName;
|
public string BeefTypeName;
|
||||||
public string? UnderlyingEnumTypeName;
|
public string? UnderlyingEnumTypeName;
|
||||||
@@ -95,7 +95,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
private string _cSharpTypeName;
|
private string _cSharpTypeName;
|
||||||
private string _cSharpWrapperType;
|
private string _cSharpWrapperType;
|
||||||
|
|
||||||
public MappedType? CSharpUnderlyingEnumType;
|
public (MappedType, TypeModifier)? CSharpUnderlyingEnumType;
|
||||||
|
|
||||||
public string? WrapperConvertInput;
|
public string? WrapperConvertInput;
|
||||||
public string? WrapperCleanupInput;
|
public string? WrapperCleanupInput;
|
||||||
@@ -115,11 +115,37 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static MappedType DecodeType(string beefType, Dictionary<string, MappedType> beefTypeToMappedType)
|
private enum TypeModifier
|
||||||
{
|
{
|
||||||
|
None,
|
||||||
|
Ref,
|
||||||
|
In,
|
||||||
|
Out
|
||||||
|
}
|
||||||
|
|
||||||
|
private static (MappedType Type, TypeModifier Modifier) DecodeType(string beefType, Dictionary<string, MappedType> beefTypeToMappedType)
|
||||||
|
{
|
||||||
|
TypeModifier modifier = TypeModifier.None;
|
||||||
|
|
||||||
|
if (beefType.StartsWith("ref "))
|
||||||
|
{
|
||||||
|
modifier = TypeModifier.Ref;
|
||||||
|
beefType = beefType.Substring(4);
|
||||||
|
}
|
||||||
|
else if (beefType.StartsWith("out "))
|
||||||
|
{
|
||||||
|
modifier = TypeModifier.Out;
|
||||||
|
beefType = beefType.Substring(4);
|
||||||
|
}
|
||||||
|
else if (beefType.StartsWith("in "))
|
||||||
|
{
|
||||||
|
modifier = TypeModifier.In;
|
||||||
|
beefType = beefType.Substring(3);
|
||||||
|
}
|
||||||
|
|
||||||
if (beefTypeToMappedType.TryGetValue(beefType, out MappedType? mappedType))
|
if (beefTypeToMappedType.TryGetValue(beefType, out MappedType? mappedType))
|
||||||
{
|
{
|
||||||
return mappedType;
|
return (mappedType, modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
int colonIndex = beefType.IndexOf(':');
|
int colonIndex = beefType.IndexOf(':');
|
||||||
@@ -141,7 +167,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
mappedType.CSharpUnderlyingEnumType = DecodeType(underlyingEnumType, beefTypeToMappedType);
|
mappedType.CSharpUnderlyingEnumType = DecodeType(underlyingEnumType, beefTypeToMappedType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mappedType;
|
return (mappedType, modifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +181,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
beefTypeToMappedType[beefType] = newMapping;
|
beefTypeToMappedType[beefType] = newMapping;
|
||||||
beefTypeToMappedType[beefTypeName] = newMapping;
|
beefTypeToMappedType[beefTypeName] = newMapping;
|
||||||
|
|
||||||
return newMapping;
|
return (newMapping, modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeTypes(Dictionary<string, MappedType> beefTypeToMappedType)
|
private static void InitializeTypes(Dictionary<string, MappedType> beefTypeToMappedType)
|
||||||
@@ -166,6 +192,42 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
ReturnValueConversion = null
|
ReturnValueConversion = null
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("Mono.MonoString*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "object /*TODO: Mono.MonoString**/",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("Mono.MonoException*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "object /*TODO: Mono.MonoException**/",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("Mono.MonoArray*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "object /*TODO: Mono.MonoArray**/",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("Mono.MonoObject*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "object /*TODO: Mono.MonoObject**/",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("Mono.MonoReflectionType*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "object /*TODO: Mono.MonoReflectionType**/",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("uint8*", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "uint8*",
|
||||||
|
CSharpTypeName = "byte*"
|
||||||
|
});
|
||||||
|
|
||||||
beefTypeToMappedType.Add("char16*", new MappedType
|
beefTypeToMappedType.Add("char16*", new MappedType
|
||||||
{
|
{
|
||||||
BeefTypeName = "char16*",
|
BeefTypeName = "char16*",
|
||||||
@@ -175,20 +237,45 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
WrapperConvertInput = "fixed (char* {0} = {1}) {{",
|
WrapperConvertInput = "fixed (char* {0} = {1}) {{",
|
||||||
WrapperCleanupInput = "}}"
|
WrapperCleanupInput = "}}"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("int32", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "int32",
|
||||||
|
CSharpTypeName = "int"
|
||||||
|
});
|
||||||
|
|
||||||
|
beefTypeToMappedType.Add("GlitchyEngine.Math.Quaternion", new MappedType
|
||||||
|
{
|
||||||
|
BeefTypeName = "System.Numerics.Quaternion",
|
||||||
|
ReturnValueConversion = null
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GenerateFunctionPointer(GlueMethod method, Dictionary<string, MappedType> beefTypeToMappedType, StringBuilder output)
|
private static void GenerateFunctionPointer(GlueMethod method, Dictionary<string, MappedType> beefTypeToMappedType, StringBuilder output)
|
||||||
{
|
{
|
||||||
MappedType returnType = DecodeType(method.ReturnType, beefTypeToMappedType);
|
var (returnType, _) = DecodeType(method.ReturnType, beefTypeToMappedType);
|
||||||
|
|
||||||
List<MappedType> parameters = new();
|
List<MappedType> parameters = new();
|
||||||
StringBuilder parameterText = new();
|
StringBuilder parameterText = new();
|
||||||
|
|
||||||
foreach (var param in method.Parameters)
|
foreach (var param in method.Parameters)
|
||||||
{
|
{
|
||||||
MappedType parameterType = DecodeType(param.Type, beefTypeToMappedType);
|
var (parameterType, parameterModifier) = DecodeType(param.Type, beefTypeToMappedType);
|
||||||
parameters.Add(parameterType);
|
parameters.Add(parameterType);
|
||||||
|
|
||||||
|
switch (parameterModifier)
|
||||||
|
{
|
||||||
|
case TypeModifier.In:
|
||||||
|
parameterText.Append("in ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Out:
|
||||||
|
parameterText.Append("out ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Ref:
|
||||||
|
parameterText.Append("ref ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
parameterText.Append(parameterType.CSharpTypeName);
|
parameterText.Append(parameterType.CSharpTypeName);
|
||||||
parameterText.Append(", ");
|
parameterText.Append(", ");
|
||||||
}
|
}
|
||||||
@@ -206,7 +293,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
StringBuilder cleanup = new();
|
StringBuilder cleanup = new();
|
||||||
StringBuilder call = new();
|
StringBuilder call = new();
|
||||||
|
|
||||||
MappedType returnType = DecodeType(method.ReturnType, beefTypeToMappedType);
|
var (returnType, _) = DecodeType(method.ReturnType, beefTypeToMappedType);
|
||||||
|
|
||||||
if (returnType.ReturnValueConversion is not null)
|
if (returnType.ReturnValueConversion is not null)
|
||||||
{
|
{
|
||||||
@@ -217,7 +304,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
|
|
||||||
foreach (var param in method.Parameters)
|
foreach (var param in method.Parameters)
|
||||||
{
|
{
|
||||||
MappedType parameterType = DecodeType(param.Type, beefTypeToMappedType);
|
var (parameterType, parameterModifier) = DecodeType(param.Type, beefTypeToMappedType);
|
||||||
parameters.Add(parameterType);
|
parameters.Add(parameterType);
|
||||||
|
|
||||||
if (parameterText.Length > 0)
|
if (parameterText.Length > 0)
|
||||||
@@ -226,8 +313,34 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
call.Append(", ");
|
call.Append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (parameterModifier)
|
||||||
|
{
|
||||||
|
case TypeModifier.In:
|
||||||
|
parameterText.Append("in ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Out:
|
||||||
|
parameterText.Append("out ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Ref:
|
||||||
|
parameterText.Append("ref ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
parameterText.Append($"{parameterType.CSharpWrapperType} {param.Name}");
|
parameterText.Append($"{parameterType.CSharpWrapperType} {param.Name}");
|
||||||
|
|
||||||
|
switch (parameterModifier)
|
||||||
|
{
|
||||||
|
case TypeModifier.In:
|
||||||
|
call.Append("in ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Out:
|
||||||
|
call.Append("out ");
|
||||||
|
break;
|
||||||
|
case TypeModifier.Ref:
|
||||||
|
call.Append("ref ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (parameterType.WrapperConvertInput is not null)
|
if (parameterType.WrapperConvertInput is not null)
|
||||||
{
|
{
|
||||||
string convertedParamName = $"{param.Name}Converted";
|
string convertedParamName = $"{param.Name}Converted";
|
||||||
@@ -289,7 +402,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
if (beefTypeName is null)
|
if (beefTypeName is null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
MappedType newMapping = DecodeType(beefTypeName, beefTypeToMappedType);
|
(MappedType newMapping, _) = DecodeType(beefTypeName, beefTypeToMappedType);
|
||||||
newMapping.CSharpTypeName = csharpTypeName;
|
newMapping.CSharpTypeName = csharpTypeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,7 +418,6 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
|
|
||||||
unsafe internal partial struct EngineFunctions
|
unsafe internal partial struct EngineFunctions
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
""");
|
""");
|
||||||
|
|
||||||
wrappers.Append("""
|
wrappers.Append("""
|
||||||
@@ -314,7 +426,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
|
|
||||||
namespace GlitchyEngine;
|
namespace GlitchyEngine;
|
||||||
|
|
||||||
unsafe internal partial class ScriptGlue
|
internal static unsafe partial class ScriptGlue
|
||||||
{
|
{
|
||||||
""");
|
""");
|
||||||
|
|
||||||
@@ -338,20 +450,7 @@ public class ScriptGlueGenerator : IIncrementalGenerator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
engineFunctions.Append("\n}");
|
||||||
// foreach (var type in input.enumerations)
|
|
||||||
// {
|
|
||||||
// if (type is null)
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// GenerateCode(type, output);
|
|
||||||
// var typeNamespace = type.ContainingNamespace.IsGlobalNamespace
|
|
||||||
// ? null
|
|
||||||
// : $"{type.ContainingNamespace}.";
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
engineFunctions.Append("\n*/}");
|
|
||||||
wrappers.Append("\n}");
|
wrappers.Append("\n}");
|
||||||
|
|
||||||
context.AddSource("EngineFunctions.g.cs", engineFunctions.ToString());
|
context.AddSource("EngineFunctions.g.cs", engineFunctions.ToString());
|
||||||
|
|||||||
Reference in New Issue
Block a user