diff --git a/ClassicalSharp/Entities/Particles/Particle.cs b/ClassicalSharp/Entities/Particles/Particle.cs index 5fd736ab2..991712162 100644 --- a/ClassicalSharp/Entities/Particles/Particle.cs +++ b/ClassicalSharp/Entities/Particles/Particle.cs @@ -7,9 +7,8 @@ namespace ClassicalSharp.Particles { public Vector3 Position; public Vector3 Velocity; - public Vector2 Size = new Vector2( 1 / 16f, 1 / 16f ); public TextureRectangle Rectangle; - public double Lifetime; + public float Lifetime; protected Game game; protected Vector3 lastPos, nextPos; @@ -21,16 +20,17 @@ namespace ClassicalSharp.Particles { game = window; Position = lastPos = nextPos = pos; Velocity = velocity; - Lifetime = lifetime; + Lifetime = (float)lifetime; Rectangle = rec; } public virtual bool Tick( double delta ) { - Lifetime -= delta; + Lifetime -= (float)delta; return Lifetime < 0; } // http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/ + protected static Vector2 Size; protected void TranslatePoints( out Vector3 p111, out Vector3 p121, out Vector3 p212, out Vector3 p222 ) { Vector3 centre = Position; Matrix4 camera = game.View; diff --git a/ClassicalSharp/Entities/Particles/TerrainParticle.cs b/ClassicalSharp/Entities/Particles/TerrainParticle.cs index 01311ea49..4354168b9 100644 --- a/ClassicalSharp/Entities/Particles/TerrainParticle.cs +++ b/ClassicalSharp/Entities/Particles/TerrainParticle.cs @@ -6,6 +6,7 @@ namespace ClassicalSharp.Particles { public sealed class TerrainParticle : Particle { const float gravity = 2.4f; + static Vector2 terrainSize = new Vector2( 1/16f, 1/16f ); public TerrainParticle( Game game, Vector3 pos, Vector3 velocity, double lifetime, TextureRectangle rec ) : base( game, pos, velocity, lifetime, rec ) { @@ -14,6 +15,7 @@ namespace ClassicalSharp.Particles { public override void Render( double delta, float t, VertexPos3fTex2fCol4b[] vertices, ref int index ) { Position = Vector3.Lerp( lastPos, nextPos, t ); Vector3 p111, p121, p212, p222; + Size = terrainSize; TranslatePoints( out p111, out p121, out p212, out p222 ); Map map = game.Map; FastColour col = map.IsLit( Vector3I.Floor( Position ) ) ? map.Sunlight : map.Shadowlight;