add serialization (use yaml-cpp), add stencil to render outline for selected entity, add play mode, UUIDS, add orthographic and perspective camera, add editor camera

This commit is contained in:
2025-12-09 16:30:53 +08:00
parent 3ffb4cc449
commit dc53f9517a
49 changed files with 2801 additions and 796 deletions

View File

@ -4,17 +4,15 @@ namespace Prism
{
public class Entity
{
public uint SceneID { get; private set; }
public uint EntityID { get; private set; }
public ulong ID { get; private set; }
~Entity()
{
Console.WriteLine("Destroyed Entity {0}:{1}", SceneID, EntityID);
}
public T CreateComponent<T>() where T : Component, new()
{
CreateComponent_Native(SceneID, EntityID, typeof(T));
CreateComponent_Native(ID, typeof(T));
T component = new T();
component.Entity = this;
return component;
@ -22,7 +20,7 @@ namespace Prism
public bool HasComponent<T>() where T : Component, new()
{
return HasComponent_Native(SceneID, EntityID, typeof(T));
return HasComponent_Native(ID, typeof(T));
}
public T GetComponent<T>() where T : Component, new()
@ -39,23 +37,23 @@ namespace Prism
public Mat4 GetTransform()
{
Mat4 mat4Instance;
GetTransform_Native(SceneID, EntityID, out mat4Instance);
GetTransform_Native(ID, out mat4Instance);
return mat4Instance;
}
public void SetTransform(Mat4 transform)
{
SetTransform_Native(SceneID, EntityID, ref transform);
SetTransform_Native(ID, ref transform);
}
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void CreateComponent_Native(uint sceneID, uint entityID, Type type);
private static extern void CreateComponent_Native(ulong entityID, Type type);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool HasComponent_Native(uint sceneID, uint entityID, Type type);
private static extern bool HasComponent_Native(ulong entityID, Type type);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void GetTransform_Native(uint sceneID, uint entityID, out Mat4 matrix);
private static extern void GetTransform_Native(ulong entityID, out Mat4 matrix);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void SetTransform_Native(uint sceneID, uint entityID, ref Mat4 matrix);
private static extern void SetTransform_Native(ulong entityID, ref Mat4 matrix);
}
}