OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
textureunit.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (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, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef TEXTUREUNIT_H
19 #define TEXTUREUNIT_H
20 
21 #include "index.h"
22 #include "meshmanager.h"
23 #include "shadermanager.h"
24 #include "texturemanager.h"
25 #include "positionmanager.h"
26 #include "framebuffermanager.h"
27 #include "embedded_resource.h"
28 
29 namespace Engine
30 {
31  using FBOList = std::list< FrameBuffer *>;
32 
37  {
38  public:
39 
40  explicit TextureUnit( const std::string & name );
41  virtual ~TextureUnit();
42 
43  void setTextureSize( int width , int height );
44 
45  Texture * colour_height_op( Texture * height_map , Texture * texture_array , float textures , float alpha_factor = 0.5f );
46  Texture * colour_rgb_op ( Texture * alpha , Texture * texture0_r, Texture * texture1_g , Texture * texture2_b );
47  Texture * colour_alpha_add_op( Texture * alpha , Texture * texture0 , Texture * texture1 );
48  Texture * colour_alpha_add_op( float alpha_factor , Texture * texture0 , Texture * texture1 );
49 
50  Texture * loadTexture( const std::string & resource_file );
51 
52  protected:
53 
54  std::string m_texture_unit_name;
55 
56  int m_texture_width;
57  int m_texture_height;
58 
59  private:
60 
61  Mesh * m_fbo_screen;
62  Position * m_screen_pos;
63  FBOList m_fbo_list;
64 
65  void RenderToTextureStart( FrameBuffer * fbo );
66  void RenderToTextureStop ( FrameBuffer * fbo );
67  };
68 }
69 
70 #endif // TEXTUREUNIT_H
The Texture class.
Definition: texture.h:37
The TextureUnit class.
Definition: textureunit.h:36
Definition: element.h:23
The Mesh class.
Definition: mesh.h:32
The FrameBuffer class.
Definition: framebuffer.h:31
The Position class.
Definition: position.h:29