mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 01:55:19 -04:00
More work on weather.
This commit is contained in:
parent
cfbcbc56a3
commit
b27302a47f
@ -259,6 +259,7 @@ namespace ClassicalSharp {
|
|||||||
Picking.Render( e.Time );
|
Picking.Render( e.Time );
|
||||||
EnvRenderer.Render( e.Time );
|
EnvRenderer.Render( e.Time );
|
||||||
MapRenderer.Render( e.Time );
|
MapRenderer.Render( e.Time );
|
||||||
|
WeatherRenderer.Render( e.Time );
|
||||||
SelectionManager.Render( e.Time );
|
SelectionManager.Render( e.Time );
|
||||||
bool left = IsMousePressed( MouseButton.Left );
|
bool left = IsMousePressed( MouseButton.Left );
|
||||||
bool right = IsMousePressed( MouseButton.Right );
|
bool right = IsMousePressed( MouseButton.Right );
|
||||||
|
@ -216,13 +216,11 @@ namespace ClassicalSharp {
|
|||||||
Graphics.AlphaTest = false;
|
Graphics.AlphaTest = false;
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
Graphics.EndIndexedVbBatch();
|
Graphics.EndIndexedVbBatch();
|
||||||
Window.WeatherRenderer.Render( deltaTime );
|
|
||||||
Window.MapEnvRenderer.RenderMapSides( deltaTime );
|
Window.MapEnvRenderer.RenderMapSides( deltaTime );
|
||||||
Window.MapEnvRenderer.RenderMapEdges( deltaTime );
|
Window.MapEnvRenderer.RenderMapEdges( deltaTime );
|
||||||
|
|
||||||
// Render translucent(liquid) blocks. These 'blend' into other blocks.
|
// Render translucent(liquid) blocks. These 'blend' into other blocks.
|
||||||
Graphics.BeginIndexedVbBatch();
|
Graphics.BeginIndexedVbBatch();
|
||||||
Graphics.AlphaTest = false;
|
|
||||||
Graphics.Texturing = false;
|
Graphics.Texturing = false;
|
||||||
Graphics.AlphaBlending = false;
|
Graphics.AlphaBlending = false;
|
||||||
|
|
||||||
|
@ -17,30 +17,45 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
int rainTexture;
|
int rainTexture;
|
||||||
//short[] rainHeightmap;
|
//short[] rainHeightmap;
|
||||||
|
VertexPos3fTex2fCol4b[] vertices = new VertexPos3fTex2fCol4b[12 * 9 * 9];
|
||||||
public void Render( double deltaTime ) {
|
public void Render( double deltaTime ) {
|
||||||
graphics.Texturing = true;
|
graphics.Texturing = true;
|
||||||
graphics.Bind2DTexture( rainTexture );
|
graphics.Bind2DTexture( rainTexture );
|
||||||
graphics.PushMatrix();
|
|
||||||
Vector3 pos = Window.LocalPlayer.Position;
|
Vector3 pos = Window.LocalPlayer.Position;
|
||||||
graphics.Translate( pos.X, pos.Y, pos.Z );
|
|
||||||
graphics.SetMatrixMode( MatrixType.Texture );
|
graphics.SetMatrixMode( MatrixType.Texture );
|
||||||
graphics.PushMatrix();
|
graphics.PushMatrix();
|
||||||
graphics.Translate( 0, (float)( -Window.accumulator / 2 ), 0 );
|
graphics.Translate( 0, (float)( -Window.accumulator / 2 ), 0 );
|
||||||
|
|
||||||
VertexPos3fTex2f[] vertices = new VertexPos3fTex2f[6];
|
int index = 0;
|
||||||
vertices[0] = new VertexPos3fTex2f( -1, 0, -0.5f, 0, 1 );
|
graphics.AlphaBlending = true;
|
||||||
vertices[1] = new VertexPos3fTex2f( -1, 6, -0.5f, 0, 0 );
|
FastColour col = FastColour.White;
|
||||||
vertices[2] = new VertexPos3fTex2f( -1, 6, 0.5f, 1, 0 );
|
col.A = 110;
|
||||||
|
MakeRainForSquare( (int)pos.X + 4, (int)pos.Y, 6, (int)pos.Z, col, ref index );
|
||||||
vertices[3] = new VertexPos3fTex2f( -1, 6, 0.5f, 1, 0 );
|
graphics.DrawVertices( DrawMode.Triangles, vertices, 12 );
|
||||||
vertices[4] = new VertexPos3fTex2f( -1, 0, 0.5f, 1, 1 );
|
graphics.AlphaBlending = false;
|
||||||
vertices[5] = new VertexPos3fTex2f( -1, 0, -0.5f, 0, 1 );
|
|
||||||
graphics.DrawVertices( DrawMode.Triangles, vertices );
|
|
||||||
|
|
||||||
graphics.PopMatrix();
|
graphics.PopMatrix();
|
||||||
graphics.SetMatrixMode( MatrixType.Modelview );
|
graphics.SetMatrixMode( MatrixType.Modelview );
|
||||||
graphics.Texturing = false;
|
graphics.Texturing = false;
|
||||||
graphics.PopMatrix();
|
}
|
||||||
|
|
||||||
|
void MakeRainForSquare( int x, int y, int height, int z, FastColour col, ref int index ) {
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y, z, 0, 1, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y + height, z, 0, 0, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y + height, z + 1, 2, 0, col );
|
||||||
|
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y + height, z + 1, 2, 0, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y, z + 1, 2, 1, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y, z, 0, 1, col );
|
||||||
|
|
||||||
|
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y, z, 2, 1, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y + height, z, 2, 0, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y + height, z + 1, 0, 0, col );
|
||||||
|
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y + height, z + 1, 0, 0, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x, y, z + 1, 0, 1, col );
|
||||||
|
vertices[index++] = new VertexPos3fTex2fCol4b( x + 1, y, z, 2, 1, col );
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnNewMap( object sender, EventArgs e ) {
|
void OnNewMap( object sender, EventArgs e ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user