diff --git a/src/Components/Camera.h b/src/Components/Camera.h index 2cd379d..d30c537 100755 --- a/src/Components/Camera.h +++ b/src/Components/Camera.h @@ -8,8 +8,12 @@ namespace Components struct Camera : Component { - Camera() : FOV(glm::radians(45.f)), NearClip(0.1f), FarClip(100.f) { } + Camera() + : FOV(glm::radians(45.f)) + , NearClip(0.1f) + , FarClip(100.f) { } + std::string Viewport; float FOV; float NearClip; float FarClip; diff --git a/src/GUI/Viewport.h b/src/GUI/Viewport.h new file mode 100644 index 0000000..b4568b5 --- /dev/null +++ b/src/GUI/Viewport.h @@ -0,0 +1,21 @@ +#ifndef GUI_Viewport_h__ +#define GUI_Viewport_h__ + +#include + +#include "GUI/Frame.h" + +namespace GUI +{ + +class Viewport : public Frame +{ +public: + // Create a frame as a child + Viewport(std::shared_ptr parent) + : Frame(parent) { } +}; + +} + +#endif // GUI_Viewport_h__ diff --git a/src/RenderQueue.h b/src/RenderQueue.h new file mode 100644 index 0000000..7439de2 --- /dev/null +++ b/src/RenderQueue.h @@ -0,0 +1,62 @@ +#ifndef RenderQueue_h__ +#define RenderQueue_h__ + +#include +#include + +#include "ResourceManager.h" +#include "Texture.h" +#include "Model.h" + +class RenderQueue; + +struct RenderJob +{ + friend class RenderQueue; + + unsigned int ViewportID; + unsigned int TextureID; + + GLuint DiffuseTexture; + GLuint NormalTexture; + GLuint SpecularTexture; + GLuint VAO; + unsigned int StartIndex; + unsigned int EndIndex; + glm::mat4 ModelMatrix; + +protected: + uint64_t Hash; + + void CalculateHash() + { + Hash = ViewportID << 58 // 6 bits + | TextureID << 42; // 16 bits + } + + bool operator<(const RenderJob& rhs) + { + return this->Hash < rhs.Hash; + } +}; + +class RenderQueue +{ +public: + void Add(RenderJob &job) + { + job.CalculateHash(); + m_Jobs.push_front(job); + m_Jobs.sort(); + } + + void Clear() + { + m_Jobs.clear(); + } + +private: + std::forward_list m_Jobs; +}; + +#endif // RenderQueue_h__ diff --git a/vs11/Returngeance/Returngeance.vcxproj b/vs11/Returngeance/Returngeance.vcxproj index f9a533a..1de7fd5 100755 --- a/vs11/Returngeance/Returngeance.vcxproj +++ b/vs11/Returngeance/Returngeance.vcxproj @@ -155,6 +155,7 @@ + @@ -162,6 +163,7 @@ + diff --git a/vs11/Returngeance/Returngeance.vcxproj.filters b/vs11/Returngeance/Returngeance.vcxproj.filters index f0145be..51e5aa8 100755 --- a/vs11/Returngeance/Returngeance.vcxproj.filters +++ b/vs11/Returngeance/Returngeance.vcxproj.filters @@ -279,6 +279,12 @@ Input + + Rendering + + + GUI +