PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: SurfaceTextureBuffer.h * 00003 * 00004 * Copyright (C) 2002-2011 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLRENDERER_SURFACE_TEXTUREBUFFER_H__ 00024 #define __PLRENDERER_SURFACE_TEXTUREBUFFER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLRenderer/Renderer/TextureBuffer.h" 00032 #include "PLRenderer/Renderer/Surface.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLRenderer { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * A texture buffer renderer surface where we can render in (RTT -> Render To Texture) 00047 */ 00048 class SurfaceTextureBuffer : public Surface { 00049 00050 00051 //[-------------------------------------------------------] 00052 //[ Public definitions ] 00053 //[-------------------------------------------------------] 00054 public: 00055 /** 00056 * @brief 00057 * Texture buffer surface flags 00058 */ 00059 enum EFlags { 00060 Depth = 1<<0, /**< Depth buffer */ 00061 Stencil = 1<<1, /**< Stencil buffer */ 00062 Mipmaps = 1<<2, /**< Mipmaps (created "on the fly" by the GPU) */ 00063 NoMultisampleAntialiasing = 1<<3 /**< Do not use multisample antialiasing */ 00064 }; 00065 00066 00067 //[-------------------------------------------------------] 00068 //[ Public functions ] 00069 //[-------------------------------------------------------] 00070 public: 00071 /** 00072 * @brief 00073 * Destructor 00074 */ 00075 PLRENDERER_API virtual ~SurfaceTextureBuffer(); 00076 00077 /** 00078 * @brief 00079 * Returns the texture buffer format 00080 * 00081 * @return 00082 * The texture buffer format 00083 */ 00084 inline TextureBuffer::EPixelFormat GetFormat() const; 00085 00086 /** 00087 * @brief 00088 * Returns the texture buffer surface flags 00089 * 00090 * @return 00091 * The texture buffer surface flags (see EFlags) 00092 */ 00093 inline PLCore::uint32 GetFlags() const; 00094 00095 /** 00096 * @brief 00097 * Returns the maximum number of color render targets 00098 * 00099 * @return 00100 * The maximum number of color render targets 00101 */ 00102 inline PLCore::uint8 GetMaxColorTargets() const; 00103 00104 /** 00105 * @brief 00106 * Sets the maximum number of color render targets 00107 * 00108 * @param[in] nMaxColorTargets 00109 * The maximum number of color render targets 00110 */ 00111 inline void SetMaxColorTargets(PLCore::uint8 nMaxColorTargets); 00112 00113 00114 //[-------------------------------------------------------] 00115 //[ Public virtual SurfaceTextureBuffer functions ] 00116 //[-------------------------------------------------------] 00117 public: 00118 /** 00119 * @brief 00120 * Returns the renderer texture buffer this surface will render in 00121 * 00122 * @return 00123 * The renderer texture buffer this surface will render in, can be a null pointer 00124 * 00125 * @note 00126 * - If you currently render into the texture buffer it can't be used for texturing! 00127 */ 00128 virtual PLRenderer::TextureBuffer *GetTextureBuffer() const = 0; 00129 00130 /** 00131 * @brief 00132 * Returns the current renderer texture buffer face this surface will render in 00133 * 00134 * @return 00135 * The current renderer texture buffer face this surface will render in 00136 * 00137 * @note 00138 * - Only valid if the target texture buffer is a cube map! 00139 * 00140 * @see 00141 * - 'TextureBufferCube.h' for more information about cube maps 00142 */ 00143 virtual PLCore::uint8 GetTextureBufferFace() const = 0; 00144 00145 /** 00146 * @brief 00147 * Takes over the control of the depth buffer of the given surface texture buffer 00148 * 00149 * @param[in] cSurfaceTextureBuffer 00150 * Surface texture buffer we take the depth buffer away 00151 */ 00152 virtual void TakeDepthBufferFromSurfaceTextureBuffer(SurfaceTextureBuffer &cSurfaceTextureBuffer) = 0; 00153 00154 00155 //[-------------------------------------------------------] 00156 //[ Protected functions ] 00157 //[-------------------------------------------------------] 00158 protected: 00159 /** 00160 * @brief 00161 * Constructor 00162 * 00163 * @param[in] cRenderer 00164 * Owner renderer 00165 * @param[in] nFlags 00166 * Texture buffer surface flags (see EFlags) 00167 * @param[in] nMaxColorTargets 00168 * Maximum number of color render targets. This must be at least 1 - main renderer 00169 * target color. 00170 */ 00171 PLRENDERER_API SurfaceTextureBuffer(Renderer &cRenderer, PLCore::uint32 nFlags = Depth | Stencil, PLCore::uint8 nMaxColorTargets = 1); 00172 00173 00174 //[-------------------------------------------------------] 00175 //[ Protected data ] 00176 //[-------------------------------------------------------] 00177 protected: 00178 PLCore::uint32 m_nFlags; /**< Texture buffer surface flags (see EFlags) */ 00179 PLCore::uint8 m_nMaxColorTargets; /**< Maximum number of color render targets */ 00180 00181 00182 //[-------------------------------------------------------] 00183 //[ Private functions ] 00184 //[-------------------------------------------------------] 00185 private: 00186 /** 00187 * @brief 00188 * Copy constructor 00189 * 00190 * @param[in] cSource 00191 * Source to copy from 00192 */ 00193 SurfaceTextureBuffer(const SurfaceTextureBuffer &cSource); 00194 00195 /** 00196 * @brief 00197 * Copy operator 00198 * 00199 * @param[in] cSource 00200 * Source to copy from 00201 * 00202 * @return 00203 * Reference to this instance 00204 */ 00205 SurfaceTextureBuffer &operator =(const SurfaceTextureBuffer &cSource); 00206 00207 00208 }; 00209 00210 00211 //[-------------------------------------------------------] 00212 //[ Namespace ] 00213 //[-------------------------------------------------------] 00214 } // PLRenderer 00215 00216 00217 //[-------------------------------------------------------] 00218 //[ Implementation ] 00219 //[-------------------------------------------------------] 00220 #include "PLRenderer/Renderer/SurfaceTextureBuffer.inl" 00221 00222 00223 #endif // __PLRENDERER_SURFACE_TEXTUREBUFFER_H__
|