66 lines
1.8 KiB
C++
66 lines
1.8 KiB
C++
/**
|
|
This file is a part of our_dick
|
|
Copyright (C) 2020-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_SCREEN_RENDERER_HPP
|
|
#define OUR_DICK_SCREEN_RENDERER_HPP
|
|
|
|
#include "gfx/ogl/vbo.hpp"
|
|
#include "gfx/ogl/vao.hpp"
|
|
#include "gfx/ogl/texture.hpp"
|
|
#include <rml/math.hpp>
|
|
#include "gfx/ogl/shader_program.hpp"
|
|
#include "wip/renderer.hpp"
|
|
|
|
#include "egn/font.hpp"
|
|
|
|
#include <memory> //shared_ptr
|
|
|
|
//TODO remove this file
|
|
class scene{};
|
|
|
|
class screen_renderer
|
|
{
|
|
private:
|
|
struct vertex{
|
|
rml::vec2f pos;
|
|
rml::vec2f tex_coord;
|
|
};
|
|
static constexpr vertex s_vertices[] = {
|
|
{{-1.0f, 1.0f}, {0.0f, 1.0f}},
|
|
{{-1.0f, -1.0f}, {0.0f, 0.0f}},
|
|
{{ 1.0f, -1.0f}, {1.0f, 0.0f}},
|
|
{{ 1.0f, -1.0f}, {1.0f, 0.0f}},
|
|
{{ 1.0f, 1.0f}, {1.0f, 1.0f}},
|
|
{{-1.0f, 1.0f}, {0.0f, 1.0f}}
|
|
};
|
|
private:
|
|
std::shared_ptr<gfx::ogl::shader_program> m_screen_shader;
|
|
gfx::ogl::vbo m_vbo;
|
|
gfx::ogl::vao m_vao;
|
|
std::shared_ptr<gfx::ogl::texture> m_texture;
|
|
int m_screen_width, m_screen_height;
|
|
|
|
public:
|
|
screen_renderer(wip::gfx::renderer& res, int width, int height, const std::shared_ptr<gfx::ogl::texture>& base_tex);
|
|
|
|
void render(scene&);
|
|
void resize_viewport(int width, int height);
|
|
};
|
|
|
|
#endif
|