SuperTuxKart
Loading...
Searching...
No Matches
render_target.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2014-2015 SuperTuxKart-Team
3//
4// This program is free software; you can redistribute it and/or
5// modify it under the terms of the GNU General Public License
6// as published by the Free Software Foundation; either version 3
7// of the License, or (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18#ifndef HEADER_RENDER_TARGET_HPP
19#define HEADER_RENDER_TARGET_HPP
20
21#include <dimension2d.h>
22#include <rect.h>
23#include <string>
24
25class FrameBuffer;
26class RTT;
28
29namespace irr
30{
31 namespace scene
32 {
33 class ICameraSceneNode; class ISceneNode;
34 }
35 namespace video
36 {
37 class ITexture; class SColor;
38 }
39}
40
42{
43public:
44 virtual ~RenderTarget() {}
45
46 virtual irr::core::dimension2du getTextureSize() const = 0;
47
48 virtual void renderToTexture(irr::scene::ICameraSceneNode* camera, float dt) = 0;
49 virtual void draw2DImage(const irr::core::rect<irr::s32>& dest_rect,
50 const irr::core::rect<irr::s32>* clip_rect,
51 const irr::video::SColor &colors,
52 bool use_alpha_channel_of_texture) const = 0;
53};
54
56{
57private:
60 irr::video::ITexture *m_render_target_texture;
61
63 irr::scene::ISceneNode *m_rtt_main_node;
64
65public:
66 GL1RenderTarget(const irr::core::dimension2du &dimension,
67 const std::string &name);
69
70 irr::core::dimension2du getTextureSize() const;
71
72 void renderToTexture(irr::scene::ICameraSceneNode* camera, float dt);
73 void draw2DImage(const irr::core::rect<irr::s32>& dest_rect,
74 const irr::core::rect<irr::s32>* clip_rect,
75 const irr::video::SColor &colors,
76 bool use_alpha_channel_of_texture) const;
77
78};
79
81{
82private:
83 ShaderBasedRenderer* m_renderer;
84 std::string m_name;
85 RTT* m_rtts;
86 FrameBuffer* m_frame_buffer;
87
88public:
89 GL3RenderTarget(const irr::core::dimension2du &dimension,
90 const std::string &name,
91 ShaderBasedRenderer *renderer);
93 void draw2DImage(const irr::core::rect<irr::s32>& dest_rect,
94 const irr::core::rect<irr::s32>* clip_rect,
95 const irr::video::SColor &colors,
96 bool use_alpha_channel_of_texture) const;
97 irr::core::dimension2du getTextureSize() const;
98 void renderToTexture(irr::scene::ICameraSceneNode* camera, float dt);
99 void setFrameBuffer(FrameBuffer* fb) { m_frame_buffer = fb; }
100
101};
102
103#endif
Definition: frame_buffer.hpp:33
Definition: render_target.hpp:56
irr::video::ITexture * m_render_target_texture
A pointer to texture on which a scene is rendered.
Definition: render_target.hpp:60
irr::scene::ISceneNode * m_rtt_main_node
Main node of the RTT scene.
Definition: render_target.hpp:63
Definition: render_target.hpp:81
Definition: rtts.hpp:101
Definition: render_target.hpp:42
Definition: shader_based_renderer.hpp:49