mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-07 16:37:15 +00:00
fix(gui): resolve transparency, lighting, and culling issues in item rendering
tile lighting is only really fully fixed in the hotbar at the moment, still looks weird everywhere else
This commit is contained in:
parent
e45d3cb587
commit
d6f5d2e28d
|
|
@ -720,10 +720,21 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, std::shar
|
|||
float scaleX = bwidth / 16.0f;
|
||||
float scaleY = bheight / 16.0f;
|
||||
|
||||
// 4jcraft: make sure we cull the back to not make transparent blocks (like
|
||||
// leaves) look weird
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
// 4jcraft: needed for transparency in the item renders (like in the
|
||||
// crafting menu)
|
||||
if (fAlpha < 1) {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glPushMatrix();
|
||||
Lighting::turnOnGui();
|
||||
glRotatef(120, 1, 0, 0);
|
||||
Lighting::turnOn();
|
||||
glPopMatrix();
|
||||
|
||||
float pop = item->popTime;
|
||||
|
|
@ -770,6 +781,10 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, std::shar
|
|||
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
glDisable(GL_CULL_FACE);
|
||||
if (fAlpha < 1) {
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
// 4J Stu - Not threadsafe
|
||||
|
|
|
|||
Loading…
Reference in a new issue