our_dick/include/wip/ogl_renderer.hpp

69 lines
1.8 KiB
C++

/**
This file is a part of our_dick
Copyright (C) 2022 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUR_DICK_GRAPHICS_WIP_OGL_RENDERER_HPP
#define OUR_DICK_GRAPHICS_WIP_OGL_RENDERER_HPP
#include "gfx/resource_container.hpp"
#include <rml/vec.hpp>
#include <rml/mat.hpp>
#include "gfx/ogl/ubo.hpp"
#include "ogl_resource_manager.hpp"
#include "draw_command.hpp"
namespace wip::gfx::ogl{
class renderer : public resource_manager
{
public:
template<class T>
using container_type = resource_manager::container_type<T>;
protected:
::gfx::ogl::ubo<rml::mat4f> m_camera_uniform;
::gfx::ogl::ubo<rml::mat4f> m_model_uniform;
public:
renderer(void) = default;
renderer(const renderer&) = default;
renderer(renderer&&) = default;
~renderer(void) = default;
renderer& operator=(const renderer&) = default;
renderer& operator=(renderer&&) = default;
void set_viewport(const rml::vec4f& vp);
void set_model_matrix(const rml::mat4f& mat);
void set_camera(const rml::mat4f& view, const rml::mat4f& proj);
void bind_default_surface(void);
void clear_current_surface(void);
void draw_tris(int offset, int vertex_count);
void process_command(draw_command& c);
};
}
#endif