]> git.lizzy.rs Git - irrlicht.git/blob - include/IRenderTarget.h
Add a unified cross platform OpenGL core profile binding (#52)
[irrlicht.git] / include / IRenderTarget.h
1 // Copyright (C) 2015 Patryk Nadrowski\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_RENDER_TARGET_H_INCLUDED__\r
6 #define __I_RENDER_TARGET_H_INCLUDED__\r
7 \r
8 #include "IReferenceCounted.h"\r
9 #include "EDriverTypes.h"\r
10 #include "irrArray.h"\r
11 \r
12 namespace irr\r
13 {\r
14 namespace video\r
15 {\r
16         class ITexture;\r
17 \r
18         //! Enumeration of cube texture surfaces\r
19         enum E_CUBE_SURFACE\r
20         {\r
21                 ECS_POSX  = 0,\r
22                 ECS_NEGX,\r
23                 ECS_POSY,\r
24                 ECS_NEGY,\r
25                 ECS_POSZ, \r
26                 ECS_NEGZ\r
27         };\r
28 \r
29         //! Interface of a Render Target.\r
30         class IRenderTarget : public virtual IReferenceCounted\r
31         {\r
32         public:\r
33 \r
34                 //! constructor\r
35                 IRenderTarget() : DepthStencil(0), DriverType(EDT_NULL)\r
36                 {\r
37                 }\r
38 \r
39                 //! Returns an array of previously set textures.\r
40                 const core::array<ITexture*>& getTexture() const\r
41                 {\r
42                         return Texture;\r
43                 }\r
44 \r
45                 //! Returns a of previously set depth / depth-stencil texture.\r
46                 ITexture* getDepthStencil() const\r
47                 {\r
48                         return DepthStencil;\r
49                 }\r
50 \r
51                 //! Set multiple textures.\r
52                 /** Set multiple textures for the render target.\r
53                 \param texture Array of texture objects. These textures are used for a color outputs.\r
54                 \param depthStencil Depth or packed depth-stencil texture. This texture is used as depth\r
55                 or depth-stencil buffer. \r
56                 \param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.\r
57                 */\r
58                 virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>()) = 0;\r
59 \r
60                 //! Set one texture.\r
61                 void setTexture(ITexture* texture, ITexture* depthStencil)\r
62                 {\r
63                         core::array<ITexture*> textureArray(1);\r
64                         textureArray.push_back(texture);\r
65 \r
66                         setTexture(textureArray, depthStencil);\r
67                 }\r
68 \r
69                 //! Set one cube surface texture.\r
70                 void setTexture(ITexture* texture, ITexture* depthStencil, E_CUBE_SURFACE cubeSurface)\r
71                 {\r
72                         core::array<ITexture*> textureArray(1);\r
73                         textureArray.push_back(texture);\r
74 \r
75                         core::array<E_CUBE_SURFACE> cubeSurfaces(1);\r
76                         cubeSurfaces.push_back(cubeSurface);\r
77 \r
78                         setTexture(textureArray, depthStencil, cubeSurfaces);\r
79                 }\r
80 \r
81                 //! Get driver type of render target.\r
82                 E_DRIVER_TYPE getDriverType() const\r
83                 {\r
84                         return DriverType;\r
85                 }\r
86 \r
87         protected:\r
88 \r
89                 //! Textures assigned to render target.\r
90                 core::array<ITexture*> Texture;\r
91 \r
92                 //! Depth or packed depth-stencil texture assigned to render target.\r
93                 ITexture* DepthStencil;\r
94 \r
95                 //! Active surface of cube textures\r
96                 core::array<E_CUBE_SURFACE> CubeSurfaces;\r
97 \r
98                 //! Driver type of render target.\r
99                 E_DRIVER_TYPE DriverType;\r
100 \r
101         private:\r
102                 // no copying (IReferenceCounted still allows that for reasons which take some time to work around)\r
103                 IRenderTarget(const IRenderTarget&);\r
104                 IRenderTarget& operator=(const IRenderTarget&);\r
105         };\r
106 \r
107 }\r
108 }\r
109 \r
110 #endif\r