mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-06-01 07:34:36 +00:00
Add a Very Wip Entity Distance option code
TODO: * maxChunkDistance dont need to be hardcoded. * Add Entity Distance Slider and Classic Entity Distance Checkbox.
This commit is contained in:
@@ -1324,18 +1324,48 @@ void Entity::awardKillScore(shared_ptr<Entity> victim, int score)
|
||||
|
||||
bool Entity::shouldRender(Vec3 *c)
|
||||
{
|
||||
double xd = x - c->x;
|
||||
double yd = y - c->y;
|
||||
double zd = z - c->z;
|
||||
double distance = xd * xd + yd * yd + zd * zd;
|
||||
return shouldRenderAtSqrDistance(distance);
|
||||
/*
|
||||
if (!app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ClassicEntityRender))
|
||||
{
|
||||
int entityChunkX = (int)std::floor(x / 16.0);
|
||||
int entityChunkY = (int)std::floor(y / 16.0);
|
||||
int entityChunkZ = (int)std::floor(z / 16.0);
|
||||
|
||||
int cameraChunkX = (int)std::floor(c->x / 16.0);
|
||||
int cameraChunkY = (int)std::floor(c->y / 16.0);
|
||||
int cameraChunkZ = (int)std::floor(c->z / 16.0);
|
||||
|
||||
int chunkDiffX = std::abs(entityChunkX - cameraChunkX);
|
||||
int chunkDiffY = std::abs(entityChunkY - cameraChunkY);
|
||||
int chunkDiffZ = std::abs(entityChunkZ - cameraChunkZ);
|
||||
|
||||
int maxXZ = (chunkDiffX > chunkDiffZ) ? chunkDiffX : chunkDiffZ;
|
||||
int chunkDistance = (maxXZ > chunkDiffY) ? maxXZ : chunkDiffY;
|
||||
return shouldRenderAtSqrDistance(chunkDistance);
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
double xd = x - c->x;
|
||||
double yd = y - c->y;
|
||||
double zd = z - c->z;
|
||||
double distance = xd * xd + yd * yd + zd * zd;
|
||||
return shouldRenderAtSqrDistance(distance);
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::shouldRenderAtSqrDistance(double distance)
|
||||
{
|
||||
double size = bb->getSize();
|
||||
size *= 64.0f * viewScale;
|
||||
return distance < size * size;
|
||||
/*
|
||||
if (!app.GetGameSettings(localplayer->GetXboxPad(),eGameSetting_ClassicEntityRender))
|
||||
return distance <= maxChunkDistance;
|
||||
else
|
||||
*/
|
||||
{
|
||||
double size = bb->getSize();
|
||||
size *= 64.0f * viewScale;
|
||||
return distance < size * size;
|
||||
}
|
||||
}
|
||||
|
||||
bool Entity::isCreativeModeAllowed()
|
||||
|
||||
Reference in New Issue
Block a user