mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Occlusion code does not work currently and was disabled, therefore there is no need to include it in the output binary.
This commit is contained in:
parent
48496794fe
commit
b1a6e87d92
@ -1,4 +1,5 @@
|
||||
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||
#if OCCLUSION
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
|
||||
@ -92,4 +93,5 @@ namespace ClassicalSharp {
|
||||
if( tZ0 && tZ1 ) solidZ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -108,15 +108,18 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
public void GetDrawInfo( int x, int y, int z, ref ChunkPartInfo[] normalParts,
|
||||
ref ChunkPartInfo[] translucentParts, ref byte occlusionFlags ) {
|
||||
ref ChunkPartInfo[] translucentParts ) {
|
||||
if( !BuildChunk( x, y, z ) ) return;
|
||||
|
||||
for( int i = 0; i < arraysCount; i++ ) {
|
||||
SetPartInfo( drawInfoNormal[i], i, ref normalParts );
|
||||
SetPartInfo( drawInfoTranslucent[i], i, ref translucentParts );
|
||||
}
|
||||
#if OCCLUSION
|
||||
// , ref byte occlusionFlags
|
||||
if( normalParts != null || translucentParts != null )
|
||||
occlusionFlags = 0;//(byte)ComputeOcclusion();
|
||||
occlusionFlags = (byte)ComputeOcclusion();
|
||||
#endif
|
||||
}
|
||||
|
||||
Vector3 minBB, maxBB;
|
||||
@ -163,8 +166,10 @@ namespace ClassicalSharp {
|
||||
int xMax = Math.Min( width, x1 + chunkSize );
|
||||
int yMax = Math.Min( height, y1 + chunkSize );
|
||||
int zMax = Math.Min( length, z1 + chunkSize );
|
||||
#if OCCLUSION
|
||||
int flags = ComputeOcclusion();
|
||||
#endif
|
||||
#if DEBUG_OCCLUSION
|
||||
int flags = ComputeOcclusion();
|
||||
FastColour col = new FastColour( 60, 60, 60, 255 );
|
||||
if( (flags & 1) != 0 ) col.R = 255; // x
|
||||
if( (flags & 4) != 0 ) col.G = 255; // y
|
||||
|
@ -1,4 +1,5 @@
|
||||
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||
#if OCCLUSION
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
using OpenTK;
|
||||
@ -269,4 +270,4 @@ namespace ClassicalSharp.Renderers {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -25,7 +25,9 @@ namespace ClassicalSharp.Renderers {
|
||||
}
|
||||
api.AlphaTest = false;
|
||||
api.Texturing = false;
|
||||
#if DEBUG_OCCLUSION
|
||||
DebugPickedPos();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Render translucent(liquid) blocks. These 'blend' into other blocks.
|
||||
@ -70,7 +72,11 @@ namespace ClassicalSharp.Renderers {
|
||||
void RenderNormalBatch( int batch ) {
|
||||
for( int i = 0; i < chunks.Length; i++ ) {
|
||||
ChunkInfo info = chunks[i];
|
||||
#if OCCLUSION
|
||||
if( info.NormalParts == null || !info.Visible || info.Occluded ) continue;
|
||||
#else
|
||||
if( info.NormalParts == null || !info.Visible ) continue;
|
||||
#endif
|
||||
|
||||
ChunkPartInfo part = info.NormalParts[batch];
|
||||
if( part.IndicesCount == 0 ) continue;
|
||||
@ -92,7 +98,11 @@ namespace ClassicalSharp.Renderers {
|
||||
void RenderTranslucentBatch( int batch ) {
|
||||
for( int i = 0; i < chunks.Length; i++ ) {
|
||||
ChunkInfo info = chunks[i];
|
||||
#if OCCLUSION
|
||||
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
||||
#else
|
||||
if( info.TranslucentParts == null || !info.Visible ) continue;
|
||||
#endif
|
||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||
|
||||
if( part.IndicesCount == 0 ) continue;
|
||||
@ -104,7 +114,11 @@ namespace ClassicalSharp.Renderers {
|
||||
void RenderTranslucentBatchDepthPass( int batch ) {
|
||||
for( int i = 0; i < chunks.Length; i++ ) {
|
||||
ChunkInfo info = chunks[i];
|
||||
#if OCCLUSION
|
||||
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
||||
#else
|
||||
if( info.TranslucentParts == null || !info.Visible ) continue;
|
||||
#endif
|
||||
|
||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||
if( part.IndicesCount == 0 ) continue;
|
||||
|
@ -14,10 +14,12 @@ namespace ClassicalSharp.Renderers {
|
||||
class ChunkInfo {
|
||||
|
||||
public ushort CentreX, CentreY, CentreZ;
|
||||
public bool Visible = true, Occluded = false;
|
||||
public bool Visited = false, Empty = false;
|
||||
public bool Visible = true, Empty = false;
|
||||
public bool DrawLeft, DrawRight, DrawFront, DrawBack, DrawBottom, DrawTop;
|
||||
#if OCCLUSION
|
||||
public bool Visited = false, Occluded = false;
|
||||
public byte OcclusionFlags, OccludedFlags, DistanceFlags;
|
||||
#endif
|
||||
|
||||
public ChunkPartInfo[] NormalParts;
|
||||
public ChunkPartInfo[] TranslucentParts;
|
||||
@ -189,8 +191,10 @@ namespace ClassicalSharp.Renderers {
|
||||
|
||||
void DeleteChunk( ChunkInfo info ) {
|
||||
info.Empty = false;
|
||||
#if OCCLUSION
|
||||
info.OcclusionFlags = 0;
|
||||
info.OccludedFlags = 0;
|
||||
#endif
|
||||
DeleteData( ref info.NormalParts );
|
||||
DeleteData( ref info.TranslucentParts );
|
||||
}
|
||||
@ -343,7 +347,7 @@ namespace ClassicalSharp.Renderers {
|
||||
void BuildChunk( ChunkInfo info, ref int chunkUpdates ) {
|
||||
game.ChunkUpdates++;
|
||||
builder.GetDrawInfo( info.CentreX - 8, info.CentreY - 8, info.CentreZ - 8,
|
||||
ref info.NormalParts, ref info.TranslucentParts, ref info.OcclusionFlags );
|
||||
ref info.NormalParts, ref info.TranslucentParts );
|
||||
|
||||
if( info.NormalParts == null && info.TranslucentParts == null ) {
|
||||
info.Empty = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user