mirror of
https://github.com/ReMinecraftPE/mcpe.git
synced 2025-01-23 17:52:10 -05:00
Add ENH_3D_INVENTORY_TILES
Replaces the functionality of gui_blocks.png by actually 3D rendering inventory item tiles.
This commit is contained in:
parent
c99b23f579
commit
6feff32c51
2 changed files with 40 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
#define ENH_USE_GUI_SCALE_2 // Use a 2x GUI scale instead of 3x. Looks better on PC
|
||||
#define ENH_ALLOW_SCROLL_WHEEL // Allow use of the scroll wheel to change selected inventory slots
|
||||
#define ENH_DISABLE_TURN_ACCEL // Disable the turn acceleration mechanism. It should only be used on Xperia Play
|
||||
#define ENH_3D_INVENTORY_TILES // Uses 3D rendered inventory tiles, use with ENH_SHADE_HELD_TILES to render correctly.
|
||||
|
||||
// Mods
|
||||
//#define MOD_USE_FLAT_WORLD // Use a flat world instead of the regular world generation
|
||||
|
|
|
@ -84,6 +84,7 @@ void ItemRenderer::render(Entity* pEntity, float x, float y, float z, float a, f
|
|||
# define PARM_HACK
|
||||
#endif
|
||||
tileRenderer->renderTile(Tile::tiles[itemID], pItemInstance->m_auxValue PARM_HACK);
|
||||
#undef PARM_HACK
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -177,13 +178,23 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, ItemInstance* i
|
|||
|
||||
bool bCanRenderAsIs = false;
|
||||
|
||||
if (COND_PRE (TileRenderer::canRender(Tile::tiles[itemID]->getRenderShape()) || g_ItemFrames[itemID] != 0))
|
||||
#ifdef ENH_3D_INVENTORY_TILES
|
||||
// We don't need to care about g_ItemFrames at all since blocks will get 3D rendered and 2D props will use the terrain.png as the texture.
|
||||
if (COND_PRE(TileRenderer::canRender(Tile::tiles[itemID]->getRenderShape())))
|
||||
{
|
||||
bCanRenderAsIs = true;
|
||||
}
|
||||
#else
|
||||
if (COND_PRE(TileRenderer::canRender(Tile::tiles[itemID]->getRenderShape()) || g_ItemFrames[itemID] != 0))
|
||||
{
|
||||
bCanRenderAsIs = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (itemID < C_MAX_TILES && bCanRenderAsIs)
|
||||
{
|
||||
#ifndef ENH_3D_INVENTORY_TILES
|
||||
textures->loadAndBindTexture(C_BLOCKS_NAME);
|
||||
|
||||
float texU = float(g_ItemFrames[instance->m_itemID] % 10) * 48.0f;
|
||||
|
@ -197,6 +208,33 @@ void ItemRenderer::renderGuiItem(Font* font, Textures* textures, ItemInstance* i
|
|||
t.vertexUV(float(x + 16), float(y + 0), 0.0f, (texU + 48.0f) / 512.0f, texV / 512.0f);
|
||||
t.vertexUV(float(x + 0), float(y + 0), 0.0f, texU / 512.0f, texV / 512.0f);
|
||||
t.draw();
|
||||
#else
|
||||
textures->loadAndBindTexture(C_TERRAIN_NAME);
|
||||
|
||||
//glDisable(GL_BLEND);
|
||||
//glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
// scale, rotate, and translate the tile onto the correct screen coordinate
|
||||
glTranslatef((GLfloat)x + 8, (GLfloat)y + 8, -8);
|
||||
glScalef(10, 10, 10);
|
||||
glRotatef(210.0f, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(45.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
#ifdef ENH_SHADE_HELD_TILES
|
||||
# define PARM_HACK , 1
|
||||
#else
|
||||
# define PARM_HACK
|
||||
#endif
|
||||
tileRenderer->renderTile(Tile::tiles[itemID], instance->m_auxValue PARM_HACK);
|
||||
#undef PARM_HACK
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
//glEnable(GL_BLEND);
|
||||
#endif
|
||||
}
|
||||
else if (instance->getIcon() >= 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue