mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-05-22 10:44:49 +00:00
TU24
This commit is contained in:
@@ -29,107 +29,6 @@ EntityRenderer::~EntityRenderer()
|
||||
delete tileRenderer;
|
||||
}
|
||||
|
||||
// TU25
|
||||
/*
|
||||
bool EntityRenderer::shouldRender(shared_ptr<Entity> entity, Culler* culler, double x, double y, double z)
|
||||
{
|
||||
if (entity->shouldRenderAt(x, y, z))
|
||||
{
|
||||
if (entity->ignoreFrustumCheck)
|
||||
return true;
|
||||
|
||||
AABB* boundingBox = entity->getBoundingBox();
|
||||
|
||||
return culler->isVisible(boundingBox);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EntityRenderer::renderName(shared_ptr<Entity> entity, double x, double y, double z)
|
||||
{
|
||||
if (!this->shouldShowName(entity))
|
||||
return;
|
||||
|
||||
wstring nameTag = entity->getDisplayName();
|
||||
|
||||
if (!msg.empty())
|
||||
{
|
||||
Font* msg = this->getFont();
|
||||
|
||||
if (font != nullptr)
|
||||
{
|
||||
float dist = entity->distanceToSqr(entityRenderDispatcher->cameraEntity);
|
||||
|
||||
if (dist < 64.0f * 64.0f)
|
||||
renderNameTags(entity, nameTag, x, y, z, 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool EntityRenderer::shouldShowName(shared_ptr<Entity> entity)
|
||||
{
|
||||
if (!entity)
|
||||
return false;
|
||||
|
||||
if (entity->shouldShowName())
|
||||
{
|
||||
if (entity->hasCustomName())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int EntityRenderer::renderNameTags(shared_ptr<Entity> entity, double x, double y, double z, const wstring& name, float opacity, double distance, int color)
|
||||
{
|
||||
// if (!this->entityRenderDispatcher->allowNameTagRendering())
|
||||
// return 0;
|
||||
|
||||
Font* font = getFont();
|
||||
|
||||
if (font == nullptr)
|
||||
return 0;
|
||||
|
||||
float fScale = 0.02666667f;
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef((float)x, (float)y + entity->getHeadHeight() + 0.5f, (float)z);
|
||||
glNormal3f(0.0f, 1.0f, 0.0f);
|
||||
|
||||
glRotatef(-this->entityRenderDispatcher->playerRotY, 0.0f, 1.0f, 0.0f);
|
||||
glRotatef(this->entityRenderDispatcher->playerRotX, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
glScalef(-fScale, -fScale, fScale);
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDepthMask(false);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
Tesselator* t = Tesselator::getInstance();
|
||||
int width = font->width(name) / 2;
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
t->begin();
|
||||
t->color(0.0f, 0.0f, 0.0f, 0.25f * opacity);
|
||||
t->vertex(-width - 1, -1, 0.0f);
|
||||
t->vertex(-width - 1, 8, 0.0f);
|
||||
t->vertex(width + 1, 8, 0.0f);
|
||||
t->vertex(width + 1, -1, 0.0f);
|
||||
t->end();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
font->draw(name, -width, 0, color);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glDisable(GL_BLEND);
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
glPopMatrix();
|
||||
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
void EntityRenderer::bindTexture(shared_ptr<Entity> entity)
|
||||
{
|
||||
bindTexture(getTextureLocation(entity));
|
||||
|
||||
Reference in New Issue
Block a user