Exceedingly odd build errors fixed

This commit is contained in:
2024-06-24 11:47:14 -04:00
parent d8dc4d9b82
commit 5518815a53
2 changed files with 12 additions and 8 deletions

View File

@@ -108,16 +108,22 @@ VertexArray Collision::getDrawable(const Shape& collider) {
return result; return result;
} }
if (const auto* s = dynamic_cast<const Sphere*>(&collider)) { if (const auto* s = dynamic_cast<const Sphere*>(&collider))
{
VertexArray result = genIcosahedron(s); VertexArray result = genIcosahedron(s);
if (s->Radius != 1.0f) //Scale if (s->Radius != 1.0f) //Scale
{
for (auto& vertex : result.vertices) 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 for (auto& v : result.vertices) //Translate
v += s->Position; v += s->Position;
return result; return result;
} }
return {}; return {};
} }

View File

@@ -1,6 +1,7 @@
#include <sstream> #include <sstream>
#include <thread> #include <thread>
#include <Redacted3D/engine/engine.h> #include <Redacted3D/engine/engine.h>
#include <Redacted3D/engine/utils/instanceOf.h>
#include <Redacted3D/types/entity/camera.h> #include <Redacted3D/types/entity/camera.h>
#include <JGL/JGL.h> #include <JGL/JGL.h>
#include <JGL/Colors.h> #include <JGL/Colors.h>
@@ -54,7 +55,6 @@ void outputErrorCode() {
break; break;
case ENGINE_ERROR_CODE::TEXTURE_ERASED_WHILE_IN_USE: case ENGINE_ERROR_CODE::TEXTURE_ERASED_WHILE_IN_USE:
std::cerr << "TEXTURE ERASED WHILE IN USE" << std::endl; std::cerr << "TEXTURE ERASED WHILE IN USE" << std::endl;
break;
case ENGINE_ERROR_CODE::VERTEX_ARRAY_ERASED_WHILE_IN_USE: case ENGINE_ERROR_CODE::VERTEX_ARRAY_ERASED_WHILE_IN_USE:
std::cerr << "VERTEX ARRAY ERASED WHILE IN USE" << std::endl; std::cerr << "VERTEX ARRAY ERASED WHILE IN USE" << std::endl;
break; break;
@@ -82,7 +82,6 @@ void Engine::initGL() const {
glDepthFunc(GL_LESS); glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE); glDepthMask(GL_TRUE);
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
} }
@@ -123,11 +122,9 @@ void Engine::initGL() const {
exit(0); exit(0);
//TODO JGL rendering pass. //TODO JGL rendering pass.
/*
glDisable(GL_LIGHTING); 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); glEnable(GL_LIGHTING);
*/
} }
void Engine::postRender() void Engine::postRender()
@@ -274,5 +271,6 @@ void Engine::takeScreenshot() {
file.write((char*)"\0", 1); file.write((char*)"\0", 1);
} }
} }
file.close(); file.close();
} }