Push up sky rather than hide it.

This commit is contained in:
UnknownShadow200 2015-10-21 09:03:11 +11:00
parent cd7190e9eb
commit 70eb21ff4d

View File

@ -2,6 +2,7 @@
using System.Drawing; using System.Drawing;
using ClassicalSharp.GraphicsAPI; using ClassicalSharp.GraphicsAPI;
using OpenTK; using OpenTK;
using OpenTK;
namespace ClassicalSharp.Renderers { namespace ClassicalSharp.Renderers {
@ -27,11 +28,21 @@ namespace ClassicalSharp.Renderers {
Vector3 eyePos = game.LocalPlayer.EyePosition; Vector3 eyePos = game.LocalPlayer.EyePosition;
Vector3 pos = game.Camera.GetCameraPos( eyePos ); Vector3 pos = game.Camera.GetCameraPos( eyePos );
if( pos.Y < map.CloudHeight + 8 ) { float normalY = map.CloudHeight + 8;
float skyY = Math.Max( pos.Y + 8, normalY );
graphics.BeginVbBatch( VertexFormat.Pos3fCol4b ); graphics.BeginVbBatch( VertexFormat.Pos3fCol4b );
graphics.BindVb( skyVb ); graphics.BindVb( skyVb );
if( skyY == normalY ) {
graphics.DrawIndexedVb( DrawMode.Triangles, skyVertices * 6 / 4, 0 ); graphics.DrawIndexedVb( DrawMode.Triangles, skyVertices * 6 / 4, 0 );
} else {
Matrix4 m = Matrix4.Translate( 0, skyY - normalY, 0 );
graphics.PushMatrix();
graphics.MultiplyMatrix( ref m );
graphics.DrawIndexedVb( DrawMode.Triangles, skyVertices * 6 / 4, 0 );
graphics.PopMatrix();
} }
RenderClouds( deltaTime ); RenderClouds( deltaTime );
ResetFog(); ResetFog();
} }