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
|
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||||
|
#if OCCLUSION
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.GraphicsAPI;
|
||||||
|
|
||||||
@ -92,4 +93,5 @@ namespace ClassicalSharp {
|
|||||||
if( tZ0 && tZ1 ) solidZ = false;
|
if( tZ0 && tZ1 ) solidZ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -108,15 +108,18 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void GetDrawInfo( int x, int y, int z, ref ChunkPartInfo[] normalParts,
|
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;
|
if( !BuildChunk( x, y, z ) ) return;
|
||||||
|
|
||||||
for( int i = 0; i < arraysCount; i++ ) {
|
for( int i = 0; i < arraysCount; i++ ) {
|
||||||
SetPartInfo( drawInfoNormal[i], i, ref normalParts );
|
SetPartInfo( drawInfoNormal[i], i, ref normalParts );
|
||||||
SetPartInfo( drawInfoTranslucent[i], i, ref translucentParts );
|
SetPartInfo( drawInfoTranslucent[i], i, ref translucentParts );
|
||||||
}
|
}
|
||||||
|
#if OCCLUSION
|
||||||
|
// , ref byte occlusionFlags
|
||||||
if( normalParts != null || translucentParts != null )
|
if( normalParts != null || translucentParts != null )
|
||||||
occlusionFlags = 0;//(byte)ComputeOcclusion();
|
occlusionFlags = (byte)ComputeOcclusion();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 minBB, maxBB;
|
Vector3 minBB, maxBB;
|
||||||
@ -163,8 +166,10 @@ namespace ClassicalSharp {
|
|||||||
int xMax = Math.Min( width, x1 + chunkSize );
|
int xMax = Math.Min( width, x1 + chunkSize );
|
||||||
int yMax = Math.Min( height, y1 + chunkSize );
|
int yMax = Math.Min( height, y1 + chunkSize );
|
||||||
int zMax = Math.Min( length, z1 + chunkSize );
|
int zMax = Math.Min( length, z1 + chunkSize );
|
||||||
|
#if OCCLUSION
|
||||||
|
int flags = ComputeOcclusion();
|
||||||
|
#endif
|
||||||
#if DEBUG_OCCLUSION
|
#if DEBUG_OCCLUSION
|
||||||
int flags = ComputeOcclusion();
|
|
||||||
FastColour col = new FastColour( 60, 60, 60, 255 );
|
FastColour col = new FastColour( 60, 60, 60, 255 );
|
||||||
if( (flags & 1) != 0 ) col.R = 255; // x
|
if( (flags & 1) != 0 ) col.R = 255; // x
|
||||||
if( (flags & 4) != 0 ) col.G = 255; // y
|
if( (flags & 4) != 0 ) col.G = 255; // y
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||||
|
#if OCCLUSION
|
||||||
using System;
|
using System;
|
||||||
using ClassicalSharp.GraphicsAPI;
|
using ClassicalSharp.GraphicsAPI;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -269,4 +270,4 @@ namespace ClassicalSharp.Renderers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@ -25,7 +25,9 @@ namespace ClassicalSharp.Renderers {
|
|||||||
}
|
}
|
||||||
api.AlphaTest = false;
|
api.AlphaTest = false;
|
||||||
api.Texturing = false;
|
api.Texturing = false;
|
||||||
|
#if DEBUG_OCCLUSION
|
||||||
DebugPickedPos();
|
DebugPickedPos();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render translucent(liquid) blocks. These 'blend' into other blocks.
|
// Render translucent(liquid) blocks. These 'blend' into other blocks.
|
||||||
@ -70,7 +72,11 @@ namespace ClassicalSharp.Renderers {
|
|||||||
void RenderNormalBatch( int batch ) {
|
void RenderNormalBatch( int batch ) {
|
||||||
for( int i = 0; i < chunks.Length; i++ ) {
|
for( int i = 0; i < chunks.Length; i++ ) {
|
||||||
ChunkInfo info = chunks[i];
|
ChunkInfo info = chunks[i];
|
||||||
|
#if OCCLUSION
|
||||||
if( info.NormalParts == null || !info.Visible || info.Occluded ) continue;
|
if( info.NormalParts == null || !info.Visible || info.Occluded ) continue;
|
||||||
|
#else
|
||||||
|
if( info.NormalParts == null || !info.Visible ) continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
ChunkPartInfo part = info.NormalParts[batch];
|
ChunkPartInfo part = info.NormalParts[batch];
|
||||||
if( part.IndicesCount == 0 ) continue;
|
if( part.IndicesCount == 0 ) continue;
|
||||||
@ -92,7 +98,11 @@ namespace ClassicalSharp.Renderers {
|
|||||||
void RenderTranslucentBatch( int batch ) {
|
void RenderTranslucentBatch( int batch ) {
|
||||||
for( int i = 0; i < chunks.Length; i++ ) {
|
for( int i = 0; i < chunks.Length; i++ ) {
|
||||||
ChunkInfo info = chunks[i];
|
ChunkInfo info = chunks[i];
|
||||||
|
#if OCCLUSION
|
||||||
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
||||||
|
#else
|
||||||
|
if( info.TranslucentParts == null || !info.Visible ) continue;
|
||||||
|
#endif
|
||||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||||
|
|
||||||
if( part.IndicesCount == 0 ) continue;
|
if( part.IndicesCount == 0 ) continue;
|
||||||
@ -104,7 +114,11 @@ namespace ClassicalSharp.Renderers {
|
|||||||
void RenderTranslucentBatchDepthPass( int batch ) {
|
void RenderTranslucentBatchDepthPass( int batch ) {
|
||||||
for( int i = 0; i < chunks.Length; i++ ) {
|
for( int i = 0; i < chunks.Length; i++ ) {
|
||||||
ChunkInfo info = chunks[i];
|
ChunkInfo info = chunks[i];
|
||||||
|
#if OCCLUSION
|
||||||
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
if( info.TranslucentParts == null || !info.Visible || info.Occluded ) continue;
|
||||||
|
#else
|
||||||
|
if( info.TranslucentParts == null || !info.Visible ) continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
ChunkPartInfo part = info.TranslucentParts[batch];
|
ChunkPartInfo part = info.TranslucentParts[batch];
|
||||||
if( part.IndicesCount == 0 ) continue;
|
if( part.IndicesCount == 0 ) continue;
|
||||||
|
@ -14,10 +14,12 @@ namespace ClassicalSharp.Renderers {
|
|||||||
class ChunkInfo {
|
class ChunkInfo {
|
||||||
|
|
||||||
public ushort CentreX, CentreY, CentreZ;
|
public ushort CentreX, CentreY, CentreZ;
|
||||||
public bool Visible = true, Occluded = false;
|
public bool Visible = true, Empty = false;
|
||||||
public bool Visited = false, Empty = false;
|
|
||||||
public bool DrawLeft, DrawRight, DrawFront, DrawBack, DrawBottom, DrawTop;
|
public bool DrawLeft, DrawRight, DrawFront, DrawBack, DrawBottom, DrawTop;
|
||||||
|
#if OCCLUSION
|
||||||
|
public bool Visited = false, Occluded = false;
|
||||||
public byte OcclusionFlags, OccludedFlags, DistanceFlags;
|
public byte OcclusionFlags, OccludedFlags, DistanceFlags;
|
||||||
|
#endif
|
||||||
|
|
||||||
public ChunkPartInfo[] NormalParts;
|
public ChunkPartInfo[] NormalParts;
|
||||||
public ChunkPartInfo[] TranslucentParts;
|
public ChunkPartInfo[] TranslucentParts;
|
||||||
@ -189,8 +191,10 @@ namespace ClassicalSharp.Renderers {
|
|||||||
|
|
||||||
void DeleteChunk( ChunkInfo info ) {
|
void DeleteChunk( ChunkInfo info ) {
|
||||||
info.Empty = false;
|
info.Empty = false;
|
||||||
|
#if OCCLUSION
|
||||||
info.OcclusionFlags = 0;
|
info.OcclusionFlags = 0;
|
||||||
info.OccludedFlags = 0;
|
info.OccludedFlags = 0;
|
||||||
|
#endif
|
||||||
DeleteData( ref info.NormalParts );
|
DeleteData( ref info.NormalParts );
|
||||||
DeleteData( ref info.TranslucentParts );
|
DeleteData( ref info.TranslucentParts );
|
||||||
}
|
}
|
||||||
@ -343,7 +347,7 @@ namespace ClassicalSharp.Renderers {
|
|||||||
void BuildChunk( ChunkInfo info, ref int chunkUpdates ) {
|
void BuildChunk( ChunkInfo info, ref int chunkUpdates ) {
|
||||||
game.ChunkUpdates++;
|
game.ChunkUpdates++;
|
||||||
builder.GetDrawInfo( info.CentreX - 8, info.CentreY - 8, info.CentreZ - 8,
|
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 ) {
|
if( info.NormalParts == null && info.TranslucentParts == null ) {
|
||||||
info.Empty = true;
|
info.Empty = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user