Skip to content

Commit

Permalink
Fixed floating point issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lolleko committed Jul 13, 2020
1 parent 8ee65ea commit d2fa779
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/world/vs_chunk_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class VSChunkManager : public IVSDrawable

bool shouldReinitializeChunks() const;

bool isLocationInBounds(const glm::ivec3& location) const;
bool isLocationInBounds(const glm::vec3& location) const;

VSTraceResult lineTrace(const glm::vec3& start, const glm::vec3& end) const;

Expand Down
4 changes: 2 additions & 2 deletions source/world/vs_chunk_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ bool VSChunkManager::shouldReinitializeChunks() const
return bShouldReinitializeChunks.load();
}

bool VSChunkManager::isLocationInBounds(const glm::ivec3& location) const
bool VSChunkManager::isLocationInBounds(const glm::vec3& location) const
{
return (
(location.x >= -worldSizeHalf.x && location.x < worldSizeHalf.x) &&
Expand All @@ -531,7 +531,7 @@ VSChunkManager::lineTrace(const glm::vec3& start, const glm::vec3& end) const
while (!bShouldReinitializeChunks && t < maxRayLength)
{
const auto samplePos = start + rayDir * t;
if (isLocationInBounds(samplePos))
if (!bShouldReinitializeChunks && isLocationInBounds(samplePos))
{
const auto blockSample = getBlock(samplePos);
if (blockSample != VS_DEFAULT_BLOCK_ID)
Expand Down

0 comments on commit d2fa779

Please sign in to comment.