Added Summeries
This commit is contained in:
parent
71a22df8bd
commit
8296d9b8a9
47 changed files with 812 additions and 177 deletions
|
|
@ -10,22 +10,46 @@ using SM.Base.Utility;
|
|||
|
||||
namespace SM2D.Types
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class Transformation : GenericTransformation
|
||||
{
|
||||
public static int ZIndexPercision = 300;
|
||||
/// <summary>
|
||||
/// The precision of the Z-Index.
|
||||
/// <para>High values can result into "z-fighting" and cliping.</para>
|
||||
/// </summary>
|
||||
public static int ZIndexPercision = 100;
|
||||
|
||||
/// <summary>
|
||||
/// The transformations translation.
|
||||
/// </summary>
|
||||
public CVector2 Position { get; set; } = new CVector2(0);
|
||||
|
||||
/// <summary>
|
||||
/// The scaling.
|
||||
/// </summary>
|
||||
public CVector2 Size { get; set; } = new CVector2(50);
|
||||
|
||||
/// <summary>
|
||||
/// The rotation.
|
||||
/// </summary>
|
||||
public CVector1 Rotation { get; set; } = new CVector1(0);
|
||||
|
||||
/// <summary>
|
||||
/// If true, the object get rotated on the X-Axis by 180°.
|
||||
/// </summary>
|
||||
public bool HorizontalFlip { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// If true, the object get rotated on the Y-Axis by 180°.
|
||||
/// </summary>
|
||||
public bool VerticalFlip { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The ZIndex.
|
||||
/// </summary>
|
||||
public CVector1 ZIndex { get; set; } = new CVector1(0);
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Matrix4 RequestMatrix()
|
||||
{
|
||||
float z = 1 / (float) ZIndexPercision * ZIndex;
|
||||
|
|
@ -37,11 +61,18 @@ namespace SM2D.Types
|
|||
Matrix4.CreateTranslation(Position.X, Position.Y, z);
|
||||
}
|
||||
|
||||
public void TurnTo(Vector2 v)
|
||||
/// <summary>
|
||||
/// Rotates the object, so it SHOULD turn toward the position.
|
||||
/// </summary>
|
||||
public void TurnTo(Vector2 turnposition)
|
||||
{
|
||||
Rotation.Set(RotationUtility.TurnTowards(Position, v));
|
||||
Rotation.Set(RotationUtility.TurnTowards(Position, turnposition));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the vector the object is looking.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Vector2 LookAtVector()
|
||||
{
|
||||
if (_modelMatrix.Determinant < 0.0001) return new Vector2(0);
|
||||
|
|
@ -51,11 +82,20 @@ namespace SM2D.Types
|
|||
return vec.Xy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The object scale gets set to the same as the resolution of the texture.
|
||||
/// </summary>
|
||||
/// <param name="texture"></param>
|
||||
public void ApplyTextureSize(Texture texture)
|
||||
{
|
||||
Size.Set(texture.Width, texture.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The object scale gets set to the same aspect ratio as the texture and then it will set the width..
|
||||
/// </summary>
|
||||
/// <param name="texture"></param>
|
||||
/// <param name="width"></param>
|
||||
public void ApplyTextureSize(Texture texture, float width)
|
||||
{
|
||||
Size.Set(width, width / texture.Aspect);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue