mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
Don't use face culling for translucent liquids, fixes #55.
This commit is contained in:
parent
03b21b62a7
commit
6df70aa383
@ -5,8 +5,6 @@ namespace ClassicalSharp {
|
|||||||
public partial class BlockInfo {
|
public partial class BlockInfo {
|
||||||
|
|
||||||
int[] textures = new int[BlocksCount * TileSide.Sides];
|
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() {
|
void SetupOptimTextures() {
|
||||||
// Row 1
|
// Row 1
|
||||||
@ -71,7 +69,6 @@ namespace ClassicalSharp {
|
|||||||
textures[i] = textureId;
|
textures[i] = textureId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int texId;
|
|
||||||
|
|
||||||
void SetTopAndBottom( int textureId, Block blockId ) {
|
void SetTopAndBottom( int textureId, Block blockId ) {
|
||||||
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
|
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
|
||||||
@ -86,10 +83,10 @@ namespace ClassicalSharp {
|
|||||||
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
|
textures[(byte)blockId * TileSide.Sides + TileSide.Bottom] = textureId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int texId;
|
||||||
void SetAll( params Block[] blocks ) {
|
void SetAll( params Block[] blocks ) {
|
||||||
for( int i = 0; i < blocks.Length; i++ ) {
|
for( int i = 0; i < blocks.Length; i++ ) {
|
||||||
SetAll( texId, blocks[i] );
|
SetAll( texId, blocks[i] ); texId++;
|
||||||
texId++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace ClassicalSharp {
|
|||||||
if( part.IndicesCount > maxIndices ) {
|
if( part.IndicesCount > maxIndices ) {
|
||||||
DrawBigPart( info, ref part );
|
DrawBigPart( info, ref part );
|
||||||
} else {
|
} else {
|
||||||
DrawPart( info, ref part );
|
DrawPart( info, ref part, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( part.spriteCount > 0 )
|
if( part.spriteCount > 0 )
|
||||||
@ -37,7 +37,7 @@ namespace ClassicalSharp {
|
|||||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||||
|
|
||||||
if( part.IndicesCount == 0 ) continue;
|
if( part.IndicesCount == 0 ) continue;
|
||||||
DrawPart( info, ref part );
|
DrawPart( info, ref part, false );
|
||||||
game.Vertices += part.IndicesCount;
|
game.Vertices += part.IndicesCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,11 +49,11 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||||
if( part.IndicesCount == 0 ) continue;
|
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 );
|
api.BindVb( part.VbId );
|
||||||
bool drawLeft = info.DrawLeft && part.leftCount > 0;
|
bool drawLeft = info.DrawLeft && part.leftCount > 0;
|
||||||
bool drawRight = info.DrawRight && part.rightCount > 0;
|
bool drawRight = info.DrawRight && part.rightCount > 0;
|
||||||
@ -63,7 +63,7 @@ namespace ClassicalSharp {
|
|||||||
bool drawBack = info.DrawBack && part.backCount > 0;
|
bool drawBack = info.DrawBack && part.backCount > 0;
|
||||||
|
|
||||||
if( drawLeft && drawRight ) {
|
if( drawLeft && drawRight ) {
|
||||||
api.FaceCulling = true;
|
api.FaceCulling = faceCulling;
|
||||||
api.DrawIndexedVb_TrisT2fC4b( part.leftCount + part.rightCount, part.leftIndex );
|
api.DrawIndexedVb_TrisT2fC4b( part.leftCount + part.rightCount, part.leftIndex );
|
||||||
api.FaceCulling = false;
|
api.FaceCulling = false;
|
||||||
} else if( drawLeft ) {
|
} else if( drawLeft ) {
|
||||||
@ -73,7 +73,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( drawFront && drawBack ) {
|
if( drawFront && drawBack ) {
|
||||||
api.FaceCulling = true;
|
api.FaceCulling = faceCulling;
|
||||||
api.DrawIndexedVb_TrisT2fC4b( part.frontCount + part.backCount, part.frontIndex );
|
api.DrawIndexedVb_TrisT2fC4b( part.frontCount + part.backCount, part.frontIndex );
|
||||||
api.FaceCulling = false;
|
api.FaceCulling = false;
|
||||||
} else if( drawFront ) {
|
} else if( drawFront ) {
|
||||||
@ -83,7 +83,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( drawBottom && drawTop ) {
|
if( drawBottom && drawTop ) {
|
||||||
api.FaceCulling = true;
|
api.FaceCulling = faceCulling;
|
||||||
api.DrawIndexedVb_TrisT2fC4b( part.bottomCount + part.topCount, part.bottomIndex );
|
api.DrawIndexedVb_TrisT2fC4b( part.bottomCount + part.topCount, part.bottomIndex );
|
||||||
api.FaceCulling = false;
|
api.FaceCulling = false;
|
||||||
} else if( drawBottom ) {
|
} else if( drawBottom ) {
|
||||||
|
@ -8,9 +8,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
@ -22,14 +21,6 @@ namespace OpenTK.Platform.X11
|
|||||||
// It seems the Choose* methods do not take multisampling into account (at least on some
|
// It seems the Choose* methods do not take multisampling into account (at least on some
|
||||||
// drivers).
|
// drivers).
|
||||||
|
|
||||||
#region Constructors
|
|
||||||
|
|
||||||
public X11GraphicsMode()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region IGraphicsMode Members
|
#region IGraphicsMode Members
|
||||||
|
|
||||||
public override GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, int buffers)
|
public override GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, int buffers)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user