Commit 0044f2b1 authored by Benjamin Castel's avatar Benjamin Castel
Browse files

feat: Enabled displaying of (non-working) hitboxes

parent 800cb2bf
Loading
Loading
Loading
Loading
+1 −1
Changes for CMakeLists.txt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -18,5 +18,5 @@ include_directories("glitter/ext/tinyobjloader"
		${OPENGL_INCLUDE_DIR})

add_executable(GLE-test src/main.cpp src/RenderObject.cpp src/RenderObjectPart.cpp src/GlApplication.cpp
               src/model/Spaceship.cpp src/model/Entity.cpp src/model/Missile.cpp)
               src/model/Spaceship.cpp src/model/Entity.cpp src/model/Missile.cpp src/model/Box.cpp)
target_link_libraries(GLE-test utils ${GLFW3_LIBRARIES} ${GLEW_LIBRARIES})
+5 −1
Changes for include/GlApplication.hpp: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ class GlApplication : public Application {

        void setFramebufferSize(int framebufferWidth, int framebufferHeight);
        void quickLog() const;
        void toggleHitboxes();

    private:
        enum ModelKeys {
@@ -37,7 +38,8 @@ class GlApplication : public Application {
            LASER_2,
            SKYBOX,
            PLANKS,
            TRON
            TRON,
            OBB
        };

        void loadModels();
@@ -53,6 +55,8 @@ class GlApplication : public Application {
        void processPlayer1Input(GLFWwindow *window, float deltaTime);
        void processPlayer2Input(GLFWwindow *window, float deltaTime);
    private:
        bool drawBoundingBoxes;

        std::map<ModelKeys, std::vector<std::shared_ptr<Entity>>> m_entities;  ///< objects to render
        std::map<ModelKeys, std::unique_ptr<RenderObject>> m_models;           ///< loaded models

+4 −0
Changes for include/RenderObject.hpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ class RenderObject {

		void setDisableLightning(const bool &disableLightning);

		glm::vec3 get_dimensions() const;

	private:
		RenderObject();
		void loadWavefront(const std::string & objname);
@@ -63,4 +65,6 @@ class RenderObject {
		std::unique_ptr<Sampler> m_specularmap;

		std::shared_ptr<Program> program;

		glm::vec3 dimensions;
};
+2 −0
Changes for include/RenderObjectPart.hpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ class RenderObjectPart {
                void draw(Sampler * colormap, Sampler * normalmap, Sampler * specularmap);
                void update(const glm::mat4 & proj, const glm::mat4 & view, const glm::mat4 & mw);
                
                glm::vec3 get_dimensions() const;

            private:
                std::shared_ptr<VAO> m_vao;
                std::shared_ptr<Program> m_program;

include/model/Box.hpp

0 → 100644
+16 −0
Changes for include/model/Box.hpp: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
#pragma once


#include <glm/ext.hpp>


#include "model/Entity.hpp"

class Box {
    private:
        glm::vec3 scales;

    public:
        Box(glm::vec3 &scales);
        bool is_point_inside(glm::vec3 &point, glm::vec3 &center);
};
Loading