81 lines
2.0 KiB
C++
81 lines
2.0 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_RENDERER_HPP
|
|
#define OUR_DICK_GRAPHICS_WIP_RENDERER_HPP
|
|
|
|
#include "gfx/resource_container.hpp"
|
|
|
|
#include "math/vec.hpp"
|
|
|
|
#include "gfx/ogl/shader_program.hpp"
|
|
#include "gfx/ogl/texture.hpp"
|
|
#include "gfx/ogl/ubo.hpp"
|
|
|
|
namespace wip::gfx::ogl{
|
|
|
|
|
|
class material;
|
|
class mesh;
|
|
|
|
struct draw_command{
|
|
const material* mat;
|
|
const mesh* m;
|
|
float distance;
|
|
};
|
|
|
|
class renderer
|
|
{
|
|
public:
|
|
template<class T>
|
|
using container_type = ::gfx::resource_container<T>;
|
|
private:
|
|
container_type<material> m_shader_programs;
|
|
container_type<mesh> m_shaders;
|
|
::gfx::ogl::ubo<math::mat4f> m_camera; //TODO
|
|
|
|
public:
|
|
renderer(void) = default;
|
|
renderer(const renderer&) = default;
|
|
renderer(renderer&&) = default;
|
|
~renderer(void) = default;
|
|
|
|
renderer& operator=(const renderer&) = default;
|
|
renderer& operator=(renderer&&) = default;
|
|
|
|
void render(void);
|
|
void set_viewport(const math::vec4f& vp);
|
|
|
|
void draw_tris(int offset, int vertex_count);
|
|
|
|
//Access to resources
|
|
const container_type<mesh>& meshs(void)const;
|
|
container_type<mesh>& meshs(void);
|
|
const container_type<material>& materials(void)const;
|
|
container_type<material>& materials(void);
|
|
};
|
|
|
|
}
|
|
namespace wip::gfx{
|
|
class renderer : public wip::gfx::ogl::renderer{};
|
|
}
|
|
|
|
|
|
|
|
#endif
|