]> git.lizzy.rs Git - irrlicht.git/blob - include/IRenderTarget.h
Drop ETS_TEXTURE_1
[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 Textures;\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                 //! Returns an array of active surface for cube textures\r
52                 const core::array<E_CUBE_SURFACE>& getCubeSurfaces() const\r
53                 {\r
54                         return CubeSurfaces;\r
55                 }\r
56 \r
57                 //! Set multiple textures.\r
58                 /** Set multiple textures for the render target.\r
59                 \param texture Array of texture objects. These textures are used for a color outputs.\r
60                 \param depthStencil Depth or packed depth-stencil texture. This texture is used as depth\r
61                 or depth-stencil buffer. You can pass getDepthStencil() if you don't want to change it.\r
62                 \param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.\r
63                 */\r
64                 void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>())\r
65                 {\r
66                         setTextures(texture.const_pointer(), texture.size(), depthStencil, cubeSurfaces.const_pointer(), cubeSurfaces.size());\r
67                 }\r
68 \r
69                 //! Sets one texture + depthStencil\r
70                 //! You can pass getDepthStencil() for depthStencil if you don't want to change that one\r
71                 void setTexture(ITexture* texture, ITexture* depthStencil)\r
72                 {\r
73                         if ( texture )\r
74                         {\r
75                                 setTextures(&texture, 1, depthStencil);\r
76                         }\r
77                         else\r
78                         {\r
79                                 setTextures(0, 0, depthStencil);\r
80                         }\r
81                 }\r
82 \r
83                 //! Set one cube surface texture.\r
84                 void setTexture(ITexture* texture, ITexture* depthStencil, E_CUBE_SURFACE cubeSurface)\r
85                 {\r
86                         if ( texture )\r
87                         {\r
88                                 setTextures(&texture, 1, depthStencil, &cubeSurface, 1);\r
89                         }\r
90                         else\r
91                         {\r
92                                 setTextures(0, 0, depthStencil, &cubeSurface, 1);\r
93                         }\r
94                 }\r
95 \r
96                 //! Get driver type of render target.\r
97                 E_DRIVER_TYPE getDriverType() const\r
98                 {\r
99                         return DriverType;\r
100                 }\r
101 \r
102         protected:\r
103 \r
104                 //! Set multiple textures.\r
105                 // NOTE: working with pointers instead of arrays to avoid unnecessary memory allocations for the single textures case\r
106                 virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces=0, u32 numCubeSurfaces=0) = 0;\r
107 \r
108                 //! Textures assigned to render target.\r
109                 core::array<ITexture*> Textures;\r
110 \r
111                 //! Depth or packed depth-stencil texture assigned to render target.\r
112                 ITexture* DepthStencil;\r
113 \r
114                 //! Active surface of cube textures\r
115                 core::array<E_CUBE_SURFACE> CubeSurfaces;\r
116 \r
117                 //! Driver type of render target.\r
118                 E_DRIVER_TYPE DriverType;\r
119 \r
120         private:\r
121                 // no copying (IReferenceCounted still allows that for reasons which take some time to work around)\r
122                 IRenderTarget(const IRenderTarget&);\r
123                 IRenderTarget& operator=(const IRenderTarget&);\r
124         };\r
125 \r
126 }\r
127 }\r
128 \r
129 #endif\r