recrownedgtk/RecrownedGTK/Graphics/Camera.cs
Harrison 04f9aab10b Added documentation.
Added more documentation.

Corrected doc.
2020-04-04 18:24:25 -05:00

69 lines
1.9 KiB
C#

using OpenTK;
namespace RecrownedGTK.Graphics {
/// <summary>
/// Basic camera handling up to x, y and z axis.
/// </summary>
public class Camera {
private Vector3 scale = new Vector3(1f), translate, rotation;
/// <summary>
/// Scale factor multiplied to the camera coordinates.
/// </summary>
/// <value>The value to be multiplied.</value>
public Vector3 Scale {
get {
return scale;
}
set {
updated = true;
scale = value;
}
}
/// <summary>
/// The translation applied after scaling and rotating.
/// </summary>
/// <value></value>
public Vector3 Translate {
set {
updated = true;
translate = value;
}
}
/// <summary>
/// Rotation applied before translation.
/// </summary>
/// <value></value>
public Vector3 Rotation {
set {
updated = true;
rotation = value;
}
get {
return rotation;
}
}
private Matrix4 transform;
/// <summary>
/// If values have updated, recalculate transformation matrix.
/// </summary>
/// <value>The transformation matrix.</value>
public Matrix4 Transform {
get {
if (!updated) return transform;
updated = true;
transform =
Matrix4.CreateScale(scale) *
Matrix4.CreateRotationX(rotation.X) *
Matrix4.CreateRotationY(rotation.Y) *
Matrix4.CreateRotationZ(rotation.Z) *
Matrix4.CreateTranslation(translate);
transform = Matrix4.Transpose(transform);
return transform;
}
}
private bool updated;
}
}