Don't use face culling for translucent liquids, fixes #55.

This commit is contained in:
UnknownShadow200 2015-09-06 17:33:00 +10:00
parent 03b21b62a7
commit 6df70aa383
3 changed files with 11 additions and 23 deletions

View File

@ -5,8 +5,6 @@ namespace ClassicalSharp {
public partial class BlockInfo {
int[] textures = new int[BlocksCount * TileSide.Sides];
const int Row1 = 0, Row2 = 16, Row3 = 32, Row4 = 48,
Row5 = 64, Row6 = 80, Row7 = 96, Row8 = 112, Row9 = 128;
void SetupOptimTextures() {
// Row 1
@ -70,8 +68,7 @@ namespace ClassicalSharp {
for( int i = index; i < index + TileSide.Bottom; i++ ) {
textures[i] = textureId;
}
}
int texId;
}
void SetTopAndBottom( int textureId, Block blockId ) {
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
@ -86,10 +83,10 @@ namespace ClassicalSharp {
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
}
int texId;
void SetAll( params Block[] blocks ) {
for( int i = 0; i < blocks.Length; i++ ) {
SetAll( texId, blocks[i] );
texId++;
SetAll( texId, blocks[i] ); texId++;
}
}

View File

@ -21,7 +21,7 @@ namespace ClassicalSharp {
if( part.IndicesCount > maxIndices ) {
DrawBigPart( info, ref part );
} else {
DrawPart( info, ref part );
DrawPart( info, ref part, true );
}
if( part.spriteCount > 0 )
@ -37,7 +37,7 @@ namespace ClassicalSharp {
ChunkPartInfo part = info.TranslucentParts[batch];
if( part.IndicesCount == 0 ) continue;
DrawPart( info, ref part );
DrawPart( info, ref part, false );
game.Vertices += part.IndicesCount;
}
}
@ -49,11 +49,11 @@ namespace ClassicalSharp {
ChunkPartInfo part = info.TranslucentParts[batch];
if( part.IndicesCount == 0 ) continue;
DrawPart( info, ref part );
DrawPart( info, ref part, false );
}
}
void DrawPart( ChunkInfo info, ref ChunkPartInfo part ) {
void DrawPart( ChunkInfo info, ref ChunkPartInfo part, bool faceCulling ) {
api.BindVb( part.VbId );
bool drawLeft = info.DrawLeft && part.leftCount > 0;
bool drawRight = info.DrawRight && part.rightCount > 0;
@ -63,7 +63,7 @@ namespace ClassicalSharp {
bool drawBack = info.DrawBack && part.backCount > 0;
if( drawLeft && drawRight ) {
api.FaceCulling = true;
api.FaceCulling = faceCulling;
api.DrawIndexedVb_TrisT2fC4b( part.leftCount + part.rightCount, part.leftIndex );
api.FaceCulling = false;
} else if( drawLeft ) {
@ -73,7 +73,7 @@ namespace ClassicalSharp {
}
if( drawFront && drawBack ) {
api.FaceCulling = true;
api.FaceCulling = faceCulling;
api.DrawIndexedVb_TrisT2fC4b( part.frontCount + part.backCount, part.frontIndex );
api.FaceCulling = false;
} else if( drawFront ) {
@ -83,7 +83,7 @@ namespace ClassicalSharp {
}
if( drawBottom && drawTop ) {
api.FaceCulling = true;
api.FaceCulling = faceCulling;
api.DrawIndexedVb_TrisT2fC4b( part.bottomCount + part.topCount, part.bottomIndex );
api.FaceCulling = false;
} else if( drawBottom ) {

View File

@ -8,9 +8,8 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Runtime.InteropServices;
using OpenTK.Graphics;
@ -21,14 +20,6 @@ namespace OpenTK.Platform.X11
// Todo: Add custom visual selection algorithm, instead of ChooseFBConfig/ChooseVisual.
// It seems the Choose* methods do not take multisampling into account (at least on some
// drivers).
#region Constructors
public X11GraphicsMode()
{
}
#endregion
#region IGraphicsMode Members