forked from cafeberry/cafeberry
LCEMP commit: support more max players
This commit is contained in:
@@ -38,13 +38,35 @@ PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0
|
||||
armorParts2 = new HumanoidModel(0.5f);
|
||||
}
|
||||
|
||||
static unsigned int HsvToArgb(float h, float s, float v)
|
||||
{
|
||||
float c = v * s;
|
||||
float x = c * (1.0f - fabsf(fmodf(h / 60.0f, 2.0f) - 1.0f));
|
||||
float m = v - c;
|
||||
float r, g, b;
|
||||
if (h < 60) { r = c; g = x; b = 0; }
|
||||
else if (h < 120) { r = x; g = c; b = 0; }
|
||||
else if (h < 180) { r = 0; g = c; b = x; }
|
||||
else if (h < 240) { r = 0; g = x; b = c; }
|
||||
else if (h < 300) { r = x; g = 0; b = c; }
|
||||
else { r = c; g = 0; b = x; }
|
||||
unsigned int ri = (unsigned int)((r + m) * 255.0f);
|
||||
unsigned int gi = (unsigned int)((g + m) * 255.0f);
|
||||
unsigned int bi = (unsigned int)((b + m) * 255.0f);
|
||||
return 0xFF000000 | (ri << 16) | (gi << 8) | bi;
|
||||
}
|
||||
|
||||
unsigned int PlayerRenderer::getNametagColour(int index)
|
||||
{
|
||||
if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS)
|
||||
{
|
||||
return s_nametagColors[index];
|
||||
}
|
||||
return 0xFF000000;
|
||||
|
||||
float hue = fmodf(index * 137.508f, 360.0f);
|
||||
float sat = 0.65f + (float)(index % 3) * 0.15f;
|
||||
float val = 0.75f + (float)(index % 4) * 0.08f;
|
||||
return HsvToArgb(hue, sat, val);
|
||||
}
|
||||
|
||||
int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, float a)
|
||||
|
||||
Reference in New Issue
Block a user