From ac3b1b0571e08c2da1f13ab643822fe78fc6739b Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 18 Jun 2015 16:41:35 +1000 Subject: [PATCH] Fix chunk loading. (oops). --- Map/ChunkMeshBuilder.cs | 5 ++--- Rendering/MapRenderer.cs | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Map/ChunkMeshBuilder.cs b/Map/ChunkMeshBuilder.cs index f3cff74ca..8546a30d4 100644 --- a/Map/ChunkMeshBuilder.cs +++ b/Map/ChunkMeshBuilder.cs @@ -92,13 +92,12 @@ namespace ClassicalSharp { return allAir || allSolid; } - public bool GetDrawInfo( int x, int y, int z, ref ChunkPartInfo[] solidParts, + public void GetDrawInfo( int x, int y, int z, ref ChunkPartInfo[] solidParts, ref ChunkPartInfo[] spriteParts, ref ChunkPartInfo[] translucentParts ) { if( !BuildChunk( x, y, z ) ) - return false; + return; GetChunkInfo( x, y, z, ref solidParts, ref spriteParts, ref translucentParts ); - return true; } public void RenderTile( int chunkIndex, int xx, int yy, int zz, int x, int y, int z ) { diff --git a/Rendering/MapRenderer.cs b/Rendering/MapRenderer.cs index 41e430215..a38eecc57 100644 --- a/Rendering/MapRenderer.cs +++ b/Rendering/MapRenderer.cs @@ -267,14 +267,15 @@ namespace ClassicalSharp { if( info.SolidParts == null && info.SpriteParts == null && info.TranslucentParts == null ) { if( inRange && chunksUpdatedThisFrame < 4 ) { Window.ChunkUpdates++; - if( !builder.GetDrawInfo( info.CentreX - 8, info.CentreY - 8, info.CentreZ - 8, - ref info.SolidParts, ref info.SpriteParts, ref info.TranslucentParts ) ) { + builder.GetDrawInfo( info.CentreX - 8, info.CentreY - 8, info.CentreZ - 8, + ref info.SolidParts, ref info.SpriteParts, ref info.TranslucentParts ); + if( info.SolidParts == null && info.SpriteParts == null && info.TranslucentParts == null ) { info.Empty = true; } chunksUpdatedThisFrame++; } } - info.Visible = inRange && + info.Visible = inRange && Window.Culling.SphereInFrustum( info.CentreX, info.CentreY, info.CentreZ, 14 ); // 14 ~ sqrt(3 * 8^2) } }