diff --git a/client/source/graphics/PlayerBox.cpp b/client/source/graphics/PlayerBox.cpp index 71dc81cf..2b15cfa5 100644 --- a/client/source/graphics/PlayerBox.cpp +++ b/client/source/graphics/PlayerBox.cpp @@ -25,47 +25,223 @@ * ===================================================================================== */ #include +#include #include "PlayerBox.hpp" -constexpr int NUM_QUADS = 6; +constexpr int NUM_QUADS = 34; static const float modelCoords[NUM_QUADS * 4 * 3] = { + + // LEFT LEG // West - -0.3125f, -0.3125f, 0.f, - -0.3125f, -0.3125f, 1.75f, - -0.3125f, 0.3125f, 1.75f, - -0.3125f, 0.3125f, 0.f, + -0.15f, -0.15f - 0.18f, 0.f, + -0.15f, -0.15f - 0.18f, 0.575f, + -0.15f, 0.15f - 0.18f, 0.575f, + -0.15f, 0.15f - 0.18f, 0.f, // East - 0.3125f, -0.3125f, 1.75f, - 0.3125f, -0.3125f, 0.f, - 0.3125f, 0.3125f, 0.f, - 0.3125f, 0.3125f, 1.75f, + 0.15f, -0.15f - 0.18f, 0.575f, + 0.15f, -0.15f - 0.18f, 0.f, + 0.15f, 0.15f - 0.18f, 0.f, + 0.15f, 0.15f - 0.18f, 0.575f, // South - -0.3125f, -0.3125f, 0.f, - 0.3125f, -0.3125f, 0.f, - 0.3125f, -0.3125f, 1.75f, - -0.3125f, -0.3125f, 1.75f, + -0.15f, -0.15f - 0.18f, 0.f, + 0.15f, -0.15f - 0.18f, 0.f, + 0.15f, -0.15f - 0.18f, 0.575f, + -0.15f, -0.15f - 0.18f, 0.575f, // North - -0.3125f, 0.3125f, 1.75f, - 0.3125f, 0.3125f, 1.75f, - 0.3125f, 0.3125f, 0.f, - -0.3125f, 0.3125f, 0.f, + -0.15f, 0.15f - 0.18f, 0.575f, + 0.15f, 0.15f - 0.18f, 0.575f, + 0.15f, 0.15f - 0.18f, 0.f, + -0.15f, 0.15f - 0.18f, 0.f, // Bottom - 0.3125f, -0.3125f, 0.f, - -0.3125f, -0.3125f, 0.f, - -0.3125f, 0.3125f, 0.f, - 0.3125f, 0.3125f, 0.f, + 0.15f, -0.15f - 0.18f, 0.f, + -0.15f, -0.15f - 0.18f, 0.f, + -0.15f, 0.15f - 0.18f, 0.f, + 0.15f, 0.15f - 0.18f, 0.f, - // Top - -0.3125f, -0.3125f, 1.75f, - 0.3125f, -0.3125f, 1.75f, - 0.3125f, 0.3125f, 1.75f, - -0.3125f, 0.3125f, 1.75f, + // RIGHT LEG + // West + -0.15f, -0.15f + 0.18f, 0.f, + -0.15f, -0.15f + 0.18f, 0.575f, + -0.15f, 0.15f + 0.18f, 0.575f, + -0.15f, 0.15f + 0.18f, 0.f, + + // East + 0.15f, -0.15f + 0.18f, 0.575f, + 0.15f, -0.15f + 0.18f, 0.f, + 0.15f, 0.15f + 0.18f, 0.f, + 0.15f, 0.15f + 0.18f, 0.575f, + + // South + -0.15f, -0.15f + 0.18f, 0.f, + 0.15f, -0.15f + 0.18f, 0.f, + 0.15f, -0.15f + 0.18f, 0.575f, + -0.15f, -0.15f + 0.18f, 0.575f, + + // North + -0.15f, 0.15f + 0.18f, 0.575f, + 0.15f, 0.15f + 0.18f, 0.575f, + 0.15f, 0.15f + 0.18f, 0.f, + -0.15f, 0.15f + 0.18f, 0.f, + + // Bottom + 0.15f, -0.15f + 0.18f, 0.f, + -0.15f, -0.15f + 0.18f, 0.f, + -0.15f, 0.15f + 0.18f, 0.f, + 0.15f, 0.15f + 0.18f, 0.f, + + // BODY + // West + -0.15f, -0.33f, 0.575f, + -0.15f, -0.33f, 1.35f, + -0.15f, 0.33f, 1.35f, + -0.15f, 0.33f, 0.575f, + + // East + 0.15f, -0.33f, 1.35f, + 0.15f, -0.33f, 0.575f, + 0.15f, 0.33f, 0.575f, + 0.15f, 0.33f, 1.35f, + + // South + -0.15f, -0.33f, 0.575f, + 0.15f, -0.33f, 0.575f, + 0.15f, -0.33f, 1.35f, + -0.15f, -0.33f, 1.35f, + + // North + -0.15f, 0.33f, 1.35f, + 0.15f, 0.33f, 1.35f, + 0.15f, 0.33f, 0.575f, + -0.15f, 0.33f, 0.575f, + + // Bottom + 0.15f, -0.33f, 0.575f, + -0.15f, -0.33f, 0.575f, + -0.15f, 0.33f, 0.575f, + 0.15f, 0.33f, 0.575f, + + // Top + -0.15f, -0.33f, 1.35f, + 0.15f, -0.33f, 1.35f, + 0.15f, 0.33f, 1.35f, + -0.15f, 0.33f, 1.35f, + + // LEFT ARM + // West + -0.15f, -0.15f - 0.48f, 0.675f, + -0.15f, -0.15f - 0.48f, 1.35f, + -0.15f, 0.15f - 0.48f, 1.35f, + -0.15f, 0.15f - 0.48f, 0.675f, + + // East + 0.15f, -0.15f - 0.48f, 1.35f, + 0.15f, -0.15f - 0.48f, 0.675f, + 0.15f, 0.15f - 0.48f, 0.675f, + 0.15f, 0.15f - 0.48f, 1.35f, + + // South + -0.15f, -0.15f - 0.48f, 0.675f, + 0.15f, -0.15f - 0.48f, 0.675f, + 0.15f, -0.15f - 0.48f, 1.35f, + -0.15f, -0.15f - 0.48f, 1.35f, + + // North + -0.15f, 0.15f - 0.48f, 1.35f, + 0.15f, 0.15f - 0.48f, 1.35f, + 0.15f, 0.15f - 0.48f, 0.675f, + -0.15f, 0.15f - 0.48f, 0.675f, + + // Bottom + 0.15f, -0.15f - 0.48f, 0.675f, + -0.15f, -0.15f - 0.48f, 0.675f, + -0.15f, 0.15f - 0.48f, 0.675f, + 0.15f, 0.15f - 0.48f, 0.675f, + + // Top + -0.15f, -0.15f - 0.48f, 1.35f, + 0.15f, -0.15f - 0.48f, 1.35f, + 0.15f, 0.15f - 0.48f, 1.35f, + -0.15f, 0.15f - 0.48f, 1.35f, + + // RIGHT ARM + // West + -0.15f, -0.15f + 0.48f, 0.675f, + -0.15f, -0.15f + 0.48f, 1.35f, + -0.15f, 0.15f + 0.48f, 1.35f, + -0.15f, 0.15f + 0.48f, 0.675f, + + // East + 0.15f, -0.15f + 0.48f, 1.35f, + 0.15f, -0.15f + 0.48f, 0.675f, + 0.15f, 0.15f + 0.48f, 0.675f, + 0.15f, 0.15f + 0.48f, 1.35f, + + // South + -0.15f, -0.15f + 0.48f, 0.675f, + 0.15f, -0.15f + 0.48f, 0.675f, + 0.15f, -0.15f + 0.48f, 1.35f, + -0.15f, -0.15f + 0.48f, 1.35f, + + // North + -0.15f, 0.15f + 0.48f, 1.35f, + 0.15f, 0.15f + 0.48f, 1.35f, + 0.15f, 0.15f + 0.48f, 0.675f, + -0.15f, 0.15f + 0.48f, 0.675f, + + // Bottom + 0.15f, -0.15f + 0.48f, 0.675f, + -0.15f, -0.15f + 0.48f, 0.675f, + -0.15f, 0.15f + 0.48f, 0.675f, + 0.15f, 0.15f + 0.48f, 0.675f, + + // Top + -0.15f, -0.15f + 0.48f, 1.35f, + 0.15f, -0.15f + 0.48f, 1.35f, + 0.15f, 0.15f + 0.48f, 1.35f, + -0.15f, 0.15f + 0.48f, 1.35f, + + // HEAD + // West + -0.2f, -0.2f, 1.35f, + -0.2f, -0.2f, 1.75f, + -0.2f, 0.2f, 1.75f, + -0.2f, 0.2f, 1.35f, + + // East + 0.2f, -0.2f, 1.75f, + 0.2f, -0.2f, 1.35f, + 0.2f, 0.2f, 1.35f, + 0.2f, 0.2f, 1.75f, + + // South + -0.2f, -0.2f, 1.35f, + 0.2f, -0.2f, 1.35f, + 0.2f, -0.2f, 1.75f, + -0.2f, -0.2f, 1.75f, + + // North + -0.2f, 0.2f, 1.75f, + 0.2f, 0.2f, 1.75f, + 0.2f, 0.2f, 1.35f, + -0.2f, 0.2f, 1.35f, + + // Bottom + 0.2f, -0.2f, 1.35f, + -0.2f, -0.2f, 1.35f, + -0.2f, 0.2f, 1.35f, + 0.2f, 0.2f, 1.35f, + + // Top + -0.2f, -0.2f, 1.75f, + 0.2f, -0.2f, 1.75f, + 0.2f, 0.2f, 1.75f, + -0.2f, 0.2f, 1.75f, }; PlayerBox::PlayerBox(const gk::Camera &camera) : m_camera(camera) { @@ -98,6 +274,7 @@ void PlayerBox::draw(gk::RenderTarget &target, gk::RenderStates states) const { states.transform *= getTransform(); + glCheck(glEnable(GL_CULL_FACE)); target.draw(m_vbo, GL_QUADS, 0, NUM_QUADS * 4, states); }