#pragma once #include "../util.h" #include #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE #include #include #include #include #include "image.h" namespace progressia::main { struct Vertex { using Index = uint16_t; glm::vec3 position; glm::vec4 color; glm::vec3 normal; glm::vec2 texCoord; }; class Texture : private progressia::main::NonCopyable { private: struct Backend; std::unique_ptr backend; friend class GraphicsInterface; friend class Primitive; public: Texture(std::unique_ptr); ~Texture(); }; class Primitive : private progressia::main::NonCopyable { private: struct Backend; std::unique_ptr backend; friend class GraphicsInterface; public: Primitive(std::unique_ptr); ~Primitive(); void draw(); const Texture *getTexture() const; }; class View : private progressia::main::NonCopyable { private: struct Backend; std::unique_ptr backend; friend class GraphicsInterface; public: View(std::unique_ptr); ~View(); void configure(const glm::mat4 &proj, const glm::mat4 &view); void use(); }; class Light : private progressia::main::NonCopyable { private: struct Backend; std::unique_ptr backend; friend class GraphicsInterface; public: Light(std::unique_ptr); ~Light(); void configure(const glm::vec3 &color, const glm::vec3 &from, float contrast, float softness); void use(); }; class GraphicsInterface : private progressia::main::NonCopyable { public: using Backend = void *; private: Backend backend; public: GraphicsInterface(Backend); ~GraphicsInterface(); std::unique_ptr newTexture(const Image &); std::unique_ptr newPrimitive(const std::vector &, const std::vector &, Texture *texture); glm::vec2 getViewport() const; void setModelTransform(const glm::mat4 &); std::unique_ptr newView(); std::unique_ptr newLight(); void flush(); void startNextLayer(); float tmp_getTime(); uint64_t getLastStartedFrame(); }; } // namespace progressia::main