diff --git a/src/engine/collision.cpp b/src/engine/collision.cpp index aa2902a..62a1666 100644 --- a/src/engine/collision.cpp +++ b/src/engine/collision.cpp @@ -108,16 +108,22 @@ VertexArray Collision::getDrawable(const Shape& collider) { return result; } - if (const auto* s = dynamic_cast(&collider)) { + if (const auto* s = dynamic_cast(&collider)) + { VertexArray result = genIcosahedron(s); if (s->Radius != 1.0f) //Scale + { for (auto& vertex : result.vertices) - vertex = Vector3::Normalized(vertex) * s->Radius; + { + // TODO: change to Normalized() with J3ML 2.2 + vertex = vertex.Normalized() * s->Radius; + } + } for (auto& v : result.vertices) //Translate v += s->Position; return result; } - return {}; + return {}; } \ No newline at end of file diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index f84b99e..5f905c5 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -54,7 +55,6 @@ void outputErrorCode() { break; case ENGINE_ERROR_CODE::TEXTURE_ERASED_WHILE_IN_USE: std::cerr << "TEXTURE ERASED WHILE IN USE" << std::endl; - break; case ENGINE_ERROR_CODE::VERTEX_ARRAY_ERASED_WHILE_IN_USE: std::cerr << "VERTEX ARRAY ERASED WHILE IN USE" << std::endl; break; @@ -82,7 +82,6 @@ void Engine::initGL() const { glDepthFunc(GL_LESS); glDepthMask(GL_TRUE); glEnable(GL_CULL_FACE); - glEnable(GL_LIGHTING); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); } @@ -123,11 +122,9 @@ void Engine::initGL() const { exit(0); //TODO JGL rendering pass. - /* glDisable(GL_LIGHTING); - JGL::J3D::DrawString3D(JGL::Colors::White, std::to_string((int) framerate()), {0.5f, 0, 0.5f}, 0.0125f); + JGL::J3D::DrawString3D(JGL::Colors::White, std::to_string((int) framerate()), {0.5f, 0, 0.5f}, 0.0125f); glEnable(GL_LIGHTING); - */ } void Engine::postRender() @@ -274,5 +271,6 @@ void Engine::takeScreenshot() { file.write((char*)"\0", 1); } } + file.close(); } \ No newline at end of file