From 5987d152b1c1056344418c6730e10ab9cbd4afcb Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 1 Dec 2015 16:58:43 +1100 Subject: [PATCH] Respect whether a block is 'full bright' for block models. --- ClassicalSharp/2D/Screens/ChatScreen.cs | 4 ++-- ClassicalSharp/Model/BlockModel.cs | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ClassicalSharp/2D/Screens/ChatScreen.cs b/ClassicalSharp/2D/Screens/ChatScreen.cs index 06ec9583c..d73c0b085 100644 --- a/ClassicalSharp/2D/Screens/ChatScreen.cs +++ b/ClassicalSharp/2D/Screens/ChatScreen.cs @@ -88,7 +88,7 @@ namespace ClassicalSharp { fontSize = (int)(14 * game.GuiScale); Utils.Clamp( ref fontSize, 8, 60 ); announcementFont = new Font( "Arial", fontSize ); - blockSize = (int)(40 * game.GuiScale); + blockSize = (int)(23 * 2 * game.GuiScale); textInput = new TextInputWidget( game, chatFont, chatInputFont ); textInput.YOffset = blockSize + 5; @@ -182,7 +182,7 @@ namespace ClassicalSharp { public override void OnResize( int oldWidth, int oldHeight, int width, int height ) { announcementTex.X1 += (width - oldWidth) / 2; announcementTex.Y1 += (height - oldHeight) / 2; - blockSize = (int)(40 * game.GuiScale); + blockSize = (int)(23 * 2 * game.GuiScale); textInput.YOffset = blockSize + 5; bottomRight.YOffset = blockSize * 3 / 2; diff --git a/ClassicalSharp/Model/BlockModel.cs b/ClassicalSharp/Model/BlockModel.cs index 6532aa143..42220b504 100644 --- a/ClassicalSharp/Model/BlockModel.cs +++ b/ClassicalSharp/Model/BlockModel.cs @@ -11,6 +11,7 @@ namespace ClassicalSharp.Model { float blockHeight; TerrainAtlas1D atlas; const float adjust = 0.1f, extent = 0.5f; + bool bright; public BlockModel( Game game ) : base( game ) { } @@ -55,6 +56,7 @@ namespace ClassicalSharp.Model { lastTexId = -1; blockHeight = game.BlockInfo.Height[block]; atlas = game.TerrainAtlas1D; + bright = game.BlockInfo.FullBright[block]; if( game.BlockInfo.IsSprite[block] ) { SpriteXQuad( TileSide.Right, true ); @@ -83,7 +85,7 @@ namespace ClassicalSharp.Model { int texId = game.BlockInfo.GetTextureLoc( block, side ), texIndex = 0; TextureRec rec = atlas.GetTexRec( texId, 1, out texIndex ); FlushIfNotSame( texIndex ); - FastColour col = FastColour.Scale( this.col, shade ); + FastColour col = bright ? FastColour.White : FastColour.Scale( this.col, shade ); cache.vertices[index++] = new VertexPos3fTex2fCol4b( -extent, y, -extent, rec.U1, rec.V1, col ); cache.vertices[index++] = new VertexPos3fTex2fCol4b( extent, y, -extent, rec.U2, rec.V1, col ); @@ -95,7 +97,7 @@ namespace ClassicalSharp.Model { int texId = game.BlockInfo.GetTextureLoc( block, side ), texIndex = 0; TextureRec rec = atlas.GetTexRec( texId, 1, out texIndex ); FlushIfNotSame( texIndex ); - FastColour col = FastColour.Scale( this.col, shade ); + FastColour col = bright ? FastColour.White : FastColour.Scale( this.col, shade ); if( blockHeight != 1 ) rec.V2 = rec.V1 + blockHeight * atlas.invElementSize * (15.99f/16f); @@ -111,7 +113,7 @@ namespace ClassicalSharp.Model { int texId = game.BlockInfo.GetTextureLoc( block, side ), texIndex = 0; TextureRec rec = atlas.GetTexRec( texId, 1, out texIndex ); FlushIfNotSame( texIndex ); - FastColour col = FastColour.Scale( this.col, shade ); + FastColour col = bright ? FastColour.White : FastColour.Scale( this.col, shade ); if( blockHeight != 1 ) rec.V2 = rec.V1 + blockHeight * atlas.invElementSize * (15.99f/16f); @@ -129,6 +131,7 @@ namespace ClassicalSharp.Model { FlushIfNotSame( texIndex ); if( blockHeight != 1 ) rec.V2 = rec.V1 + blockHeight * atlas.invElementSize * (15.99f/16f); + FastColour col = bright ? FastColour.White : this.col; float p1, p2; if( firstPart ) { // Need to break into two quads for when drawing a sprite model in hand. @@ -148,6 +151,7 @@ namespace ClassicalSharp.Model { FlushIfNotSame( texIndex ); if( blockHeight != 1 ) rec.V2 = rec.V1 + blockHeight * atlas.invElementSize * (15.99f/16f); + FastColour col = bright ? FastColour.White : this.col; float x1, x2, z1, z2; if( firstPart ) {