Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const void User::render()
- {
- log(m_username + " " + m_view.getPosition().toString() + " " + m_view.getViewAngle().toString());
- Position pos = m_view.getPosition();
- double x = pos.getX(), y = pos.getY(), z = pos.getZ()
- , tX = 1.0 / 64.0, tY = 1.0 / 32.0;
- double n = 1.0 / 8.0;
- glBindTexture(GL_TEXTURE_2D, m_texture);
- x = 0; y = 0;
- /// HEAD
- glBegin(GL_QUADS); /// FRONT
- glTexCoord2d(8 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1, headHeight);
- glTexCoord2d(8 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1, headHeight + headSize);
- glTexCoord2d(16 * tX, 24 * tY); glVertex3d(x + headSize / 2, y + 1, headHeight + headSize);
- glTexCoord2d(16 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1, headHeight);
- glEnd();
- glBegin(GL_QUADS); /// BACK
- glTexCoord2d(32 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize, z + headHeight);
- glTexCoord2d(32 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize, z + headHeight + headSize);
- glTexCoord2d(24 * tX, 24 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize, z + headHeight + headSize);
- glTexCoord2d(24 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize, z + headHeight);
- glEnd();
- glBegin(GL_QUADS); /// RIGHT
- glTexCoord2d(16 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1, z + headHeight);
- glTexCoord2d(16 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1, z + headHeight + headSize);
- glTexCoord2d(24 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 2, z + headHeight + headSize);
- glTexCoord2d(24 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 2, z + headHeight);
- glEnd();
- glBegin(GL_QUADS); /// LEFT
- glTexCoord2d(0, 16 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 2, z + headHeight);
- glTexCoord2d(0, 24 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 2, z + headHeight + headSize);
- glTexCoord2d(8 * tX, 24 * tY); glVertex3d(x + headSize / 2, y + 1, z + headHeight + headSize);
- glTexCoord2d(8 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1, z + headHeight);
- glEnd();
- glBegin(GL_QUADS); /// TOP
- glTexCoord2d(8 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1, z + headHeight + headSize);
- glTexCoord2d(8 * tX, 32 * tY); glVertex3d(x + headSize / 2, y + 1, z + headHeight + headSize);
- glTexCoord2d(16 * tX, 32 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize, z + headHeight + headSize);
- glTexCoord2d(16 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize, z + headHeight + headSize);
- glEnd();
- /*glBegin(GL_QUADS); /// BOTTOM
- glTexCoord2d(16 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1, z + headHeight);
- glTexCoord2d(16 * tX, 32 * tY); glVertex3d(x + headSize / 2, y + 1, z + headHeight);
- glTexCoord2d(24 * tX, 32 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize, z + headHeight);
- glTexCoord2d(24 * tX, 24 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize, z + headHeight);
- glEnd();*/
- /// BODY
- glBegin(GL_QUADS); /// TOP
- glTexCoord2d(20 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 4, z + headHeight);
- glTexCoord2d(20 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(28 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(28 * tX, 12 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 4, z + headHeight);
- glEnd();
- glBegin(GL_QUADS); /// BOTTOM
- glTexCoord2d(28 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(28 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(36 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(36 * tX, 12 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 4, z + headHeight / 2);
- glEnd();
- /// SHOULER
- glBegin(GL_QUADS); /// LEFT
- glTexCoord2d(40 * tX, 12 * tY); glVertex3d(x + headSize, y + 1 + headSize / 4, z + headHeight);
- glTexCoord2d(40 * tX, 16 * tY); glVertex3d(x + headSize, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(44 * tX, 16 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(44 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 4, z + headHeight);
- glEnd();
- glBegin(GL_QUADS); /// RIGHT
- glTexCoord2d(44 * tX, 12 * tY); glVertex3d(x - headSize, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(44 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight);
- glTexCoord2d(48 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 4, z + headHeight);
- glTexCoord2d(48 * tX, 12 * tY); glVertex3d(x - headSize, y + 1 + headSize / 4, z + headHeight);
- glEnd();
- /// HAND
- glBegin(GL_QUADS); /// LEFT
- glTexCoord2d(48 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(48 * tX, 16 * tY); glVertex3d(x + headSize, y + 1 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(52 * tX, 16 * tY); glVertex3d(x + headSize, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(52 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glEnd();
- glBegin(GL_QUADS); /// RIGHT
- glTexCoord2d(52 * tX, 12 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(52 * tX, 16 * tY); glVertex3d(x - headSize / 2, y + 1 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(56 * tX, 16 * tY); glVertex3d(x - headSize, y + 1 + headSize / 4, z + headHeight / 2);
- glTexCoord2d(56 * tX, 12 * tY); glVertex3d(x - headSize, y + 1 + headSize / 2 + headSize / 4, z + headHeight / 2);
- glEnd();
- /// LEGS
- /// FOOT
- glBegin(GL_QUADS); /// LEFT
- glTexCoord2d(48 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 4, z);
- glTexCoord2d(48 * tX, 16 * tY); glVertex3d(x + headSize, y + 1 + headSize / 4, z);
- glTexCoord2d(52 * tX, 16 * tY); glVertex3d(x + headSize, y + 1 + headSize / 2 + headSize / 4, z);
- glTexCoord2d(52 * tX, 12 * tY); glVertex3d(x + headSize / 2, y + 1 + headSize / 2 + headSize / 4, z);
- glEnd();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement