This commit is contained in:
2024-12-04 22:35:04 +03:00
commit 3f1740f41f
43 changed files with 1757 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using OpenTK.Mathematics;
namespace Engine.Scene.Component;
public class Transform(GameObject gameObject) : Component(gameObject)
{
public Vector3 Position { get; set; } = Vector3.Zero;
public Quaternion Rotation { get; set; } = Quaternion.Identity;
public Vector3 Scale { get; set; } = Vector3.One;
public Vector3 LocalScale { get; set; } = Vector3.One;
public Matrix4 LocalTransformMatrix => Matrix4.CreateScale(Scale) *
Matrix4.CreateFromQuaternion(Rotation) *
Matrix4.CreateTranslation(Position);
public Matrix4 TransformMatrix => LocalTransformMatrix * ParentTransformMatrix;
private Matrix4 ParentTransformMatrix => Matrix4.Identity;
}