SM.Core: + Particle System + scriptable system for scripts ~ Moved Texts- and Particles-namespace to SM.Base.Drawing ~ Changed how you tell the stopwatch to pause. (From method to property) ~ Fixed Randomize.GetFloat(min, max) ~ Now automaticly adds the DrawingBase.Transformation to DrawContext.ModelMatrix. No need to change DrawContext.Instances[0], anymore. SM.OGL: + "one-file-shader"-support SM2D: + DrawParticles (Control for Texture and Color not there yet) ~ Changed coordnate system to upper-right as (1,1) ~ Changed default shader to "one-file-shader"
45 lines
No EOL
1.1 KiB
C#
45 lines
No EOL
1.1 KiB
C#
#region usings
|
|
|
|
using OpenTK;
|
|
|
|
#endregion
|
|
|
|
namespace SM.Base.Drawing
|
|
{
|
|
/// <summary>
|
|
/// Contains methods for using transformations right.
|
|
/// </summary>
|
|
public abstract class GenericTransformation
|
|
{
|
|
/// <summary>
|
|
/// Contains the current model matrix.
|
|
/// </summary>
|
|
protected Matrix4 _modelMatrix { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Contains the last frame the matrix was calculated.
|
|
/// </summary>
|
|
protected ulong _lastFrame { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Returns the current model matrix.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Matrix4 GetMatrix()
|
|
{
|
|
if (_lastFrame != SMRenderer.CurrentFrame)
|
|
{
|
|
_lastFrame = SMRenderer.CurrentFrame;
|
|
_modelMatrix = RequestMatrix();
|
|
}
|
|
|
|
return _modelMatrix;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Calculates the current matrix.
|
|
/// </summary>
|
|
/// <returns>The current matrix.</returns>
|
|
protected abstract Matrix4 RequestMatrix();
|
|
}
|
|
} |