mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-12-03 14:38:59 +01:00
optimization (renderer): apply frustum culling to an entity
based on existing patch: https://git.neolegacy.dev/neoStudiosLCE/neoLegacy/commit/784e7943ef0fe2ba1a2860a764ac0b7bfd42ef47
This commit is contained in:
1 parent
b780f4b5fd
commit
7b817484aa
1 file changed
+8
-4
@@ -93,6 +93,8 @@
|
||||
#include "GuardianModel.h"
|
||||
#include "MobRenderer.h"
|
||||
|
||||
#include "Frustum.h"
|
||||
|
||||
double EntityRenderDispatcher::xOff = 0.0;
|
||||
double EntityRenderDispatcher::yOff = 0.0;
|
||||
double EntityRenderDispatcher::zOff = 0.0;
|
||||
@@ -270,10 +272,7 @@ void EntityRenderDispatcher::prepare(Level *level, Textures *textures, Font *fon
|
||||
|
||||
void EntityRenderDispatcher::render(shared_ptr<Entity> entity, float a)
|
||||
{
|
||||
if (entity == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (entity == nullptr) return;
|
||||
|
||||
double x = entity->xOld + (entity->x - entity->xOld) * a;
|
||||
double y = entity->yOld + (entity->y - entity->yOld) * a;
|
||||
@@ -310,6 +309,11 @@ void EntityRenderDispatcher::render(shared_ptr<Entity> entity, float a)
|
||||
|
||||
void EntityRenderDispatcher::render(shared_ptr<Entity> entity, double x, double y, double z, float rot, float a, bool bItemFrame, bool bRenderPlayerShadow)
|
||||
{
|
||||
AABB* bb = AABB::newTemp(x - 1.0, y - 0.5, z - 1.0, x + 2.0, y + 1.5, z + 2.0);
|
||||
|
||||
// Check if the tile entity is in the camera field.. If it isn't, don't render it
|
||||
if (bb != nullptr && !Frustum::getFrustum()->isVisible(bb)) return;
|
||||
|
||||
EntityRenderer *renderer = getRenderer(entity);
|
||||
if (renderer != nullptr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user