X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fchunk.cpp;h=1d120bb2ebe8d2475a4be2ac1bc4799755b8d25d;hb=73d4dd2d78eda1e2f8889d1913a97a60cec86876;hp=fb4375599226226d3e80ddcf670935a77d78e3d7;hpb=33a9e73a4f9ed21c59a321fedeb4277318531abe;p=blank.git diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index fb43755..1d120bb 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -460,7 +460,7 @@ bool Chunk::Intersection( const glm::vec3 entity_coords(Mentity[3] - Mchunk[3]); const float ec_radius = entity.Radius() + Radius(); - if (distance_squared(entity_coords, Center()) > ec_radius * ec_radius) { + if (distance2(entity_coords, Center()) > ec_radius * ec_radius) { return false; } @@ -779,6 +779,7 @@ void ChunkRenderer::Render(Viewport &viewport) { for (int i = 0; i < index.TotalChunks(); ++i) { if (!index[i]) continue; + // TODO: optimize chunk culling, shoudn't be that hard glm::mat4 m(index[i]->Transform(index.Base())); glm::mat4 mvp(chunk_prog.GetVP() * m); if (!CullTest(Chunk::Bounds(), mvp)) {