X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FViewport.hpp;h=69c66a7310ca5f04878a59cdcadbf01e6a854494;hb=HEAD;hp=d64e580e56676bcc9024ce302c01bc07f8528885;hpb=5d2da8a07411ad6417d6ed8d1be997189cf5ce89;p=blank.git diff --git a/src/graphics/Viewport.hpp b/src/graphics/Viewport.hpp index d64e580..69c66a7 100644 --- a/src/graphics/Viewport.hpp +++ b/src/graphics/Viewport.hpp @@ -1,14 +1,15 @@ #ifndef BLANK_GRAPHICS_VIEWPORT_HPP_ #define BLANK_GRAPHICS_VIEWPORT_HPP_ +#include "align.hpp" #include "BlendedSprite.hpp" #include "BlockLighting.hpp" #include "Camera.hpp" #include "Canvas.hpp" #include "DirectionalLighting.hpp" - -#include -#include +#include "glm.hpp" +#include "PlainColor.hpp" +#include "SkyBoxShader.hpp" namespace blank { @@ -21,9 +22,10 @@ public: Viewport(const Viewport &) = delete; Viewport &operator =(const Viewport &) = delete; - void VSync(bool b) noexcept; + void VSync(bool b); void EnableDepthTest() noexcept; + void EqualDepthTest() noexcept; void DisableDepthTest() noexcept; void EnableBackfaceCulling() noexcept; @@ -41,26 +43,41 @@ public: void Clear() noexcept; void ClearDepth() noexcept; + glm::vec2 GetPosition(const glm::vec2 &off, Gravity grav) const noexcept; + + void SetCursor(const glm::vec3 &) noexcept; + void SetCursor(const glm::vec3 &, Gravity) noexcept; + void MoveCursor(const glm::vec3 &) noexcept; + const glm::mat4 &Cursor() const noexcept { return cursor; } + + void OffsetCamera(const glm::vec3 &o) noexcept { cam_offset = o; } + const glm::vec3 &CameraOffset() const noexcept { return cam_offset; } + BlockLighting &ChunkProgram() noexcept; DirectionalLighting &EntityProgram() noexcept; DirectionalLighting &HUDProgram() noexcept; + PlainColor &WorldColorProgram() noexcept; + PlainColor &HUDColorProgram() noexcept; + SkyBoxShader &SkyBoxProgram() noexcept; BlendedSprite &SpriteProgram() noexcept; void WorldPosition(const glm::mat4 &) noexcept; const glm::mat4 &Perspective() const noexcept { return cam.Projection(); } const glm::mat4 &Ortho() const noexcept { return canv.Projection(); } - const glm::mat4 &CenterTransform() const noexcept { return center; } private: - SDL_GLContext ctx; Camera cam; Canvas canv; - glm::mat4 center; + glm::mat4 cursor; + + glm::vec3 cam_offset; BlockLighting chunk_prog; DirectionalLighting entity_prog; + PlainColor color_prog; + SkyBoxShader sky_prog; BlendedSprite sprite_prog; enum { @@ -68,6 +85,9 @@ private: CHUNK, ENTITY, HUD, + COLOR_WORLD, + COLOR_HUD, + SKY_BOX, SPRITE, } active_prog;