19 lines
763 B
C#
19 lines
763 B
C#
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;
|
|
} |