mirror of
https://gitea.sffnetwork.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-11-23 10:59:45 +00:00
the whole game
This commit is contained in:
parent
816e9060b4
commit
f0617a5d22
2069 changed files with 581500 additions and 0 deletions
41
src/client/renderer/entity/ItemSpriteRenderer.cpp
Executable file
41
src/client/renderer/entity/ItemSpriteRenderer.cpp
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#include "ItemSpriteRenderer.h"
|
||||
#include "EntityRenderDispatcher.h"
|
||||
#include "../Tesselator.h"
|
||||
#include "../../../world/entity/Entity.h"
|
||||
|
||||
|
||||
ItemSpriteRenderer::ItemSpriteRenderer( int icon )
|
||||
: icon(icon)
|
||||
{
|
||||
}
|
||||
|
||||
void ItemSpriteRenderer::render( Entity* e, float x, float y, float z, float rot, float a )
|
||||
{
|
||||
glPushMatrix2();
|
||||
|
||||
glTranslatef2((float) x, (float) y, (float) z);
|
||||
glScalef2(1 / 2.0f, 1 / 2.0f, 1 / 2.0f);
|
||||
bindTexture("gui/items.png");
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
float u0 = ((icon % 16) * 16 + 0) / 256.0f;
|
||||
float u1 = ((icon % 16) * 16 + 16) / 256.0f;
|
||||
float v0 = ((icon / 16) * 16 + 0) / 256.0f;
|
||||
float v1 = ((icon / 16) * 16 + 16) / 256.0f;
|
||||
|
||||
|
||||
float r = 1.0f;
|
||||
float xo = 0.5f;
|
||||
float yo = 0.25f;
|
||||
|
||||
glRotatef2(180 - entityRenderDispatcher->playerRotY, 0, 1, 0);
|
||||
glRotatef2(-entityRenderDispatcher->playerRotX, 1, 0, 0);
|
||||
t.begin();
|
||||
t.vertexUV(0 - xo, 0 - yo, 0, u0, v1);
|
||||
t.vertexUV(r - xo, 0 - yo, 0, u1, v1);
|
||||
t.vertexUV(r - xo, 1 - yo, 0, u1, v0);
|
||||
t.vertexUV(0 - xo, 1 - yo, 0, u0, v0);
|
||||
t.draw();
|
||||
|
||||
glPopMatrix2();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue