Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 49beaeb

Browse files
small perf fix
1 parent edaf1ff commit 49beaeb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/Voxel/ChunkAllocator.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ public function findIntersectingChunks(AABB $aabb) : array
282282

283283
public function fillVAOWithGeometry(Chunk $chunk, ChunkRenderData $rd): void
284284
{
285-
$floatBuffer = new FloatBuffer();
286-
287285
// load the neighboring chunks
288286
$leftChunk = $this->chunks[($chunk->x - 1) . ':' . $chunk->y . ':' . $chunk->z] ?? null;
289287
$rightChunk = $this->chunks[($chunk->x + 1) . ':' . $chunk->y . ':' . $chunk->z] ?? null;
@@ -311,6 +309,7 @@ public function fillVAOWithGeometry(Chunk $chunk, ChunkRenderData $rd): void
311309
$frontChunk ??= $this->emptyChunk;
312310
$backChunk ??= $this->emptyChunk;
313311

312+
$floatBuffer = new FloatBuffer();
314313

315314
// Unfolded cube
316315
// *---* F = Front

‎src/Voxel/ChunkRenderer.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ function(PipelineContainer $data, PipelineResources $resources) use($renderTarge
101101
continue;
102102
}
103103

104-
if ($cameraData->frustum->isAABBInView($chunk->aabb) === false) {
104+
if (!$cameraData->frustum->isSphereInView($chunk->aabb->getCenter(), $chunk->aabb->width() * 0.5)) {
105+
if ($showFrustum) Debug3DRenderer::aabb(new Vec3(), $chunk->aabb->min + new Vec3(5), $chunk->aabb->max - new Vec3(5), new Vec3(1, 0, 0));
105106
continue;
106107
}
107108

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /