PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: TextureBufferRectangle.h * 00003 * 00004 * Copyright (C) 2002-2012 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_TEXTUREBUFFERRECTANGLE_H__ 00024 #define __PLRENDERER_TEXTUREBUFFERRECTANGLE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLMath/Vector2i.h> 00032 #include "PLRenderer/Renderer/TextureBuffer.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLRenderer { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Abstract renderer rectangle texture buffer resource 00047 * 00048 * @remarks 00049 * The hardware texturing is limited to images with power-of-two dimensions and an optional 00050 * 1-texel border. But there’s also an special kind of texture buffers called ’rectangle textures’ without 00051 * requiring power-of-two dimensions.\n 00052 * Non-power-of-two dimensioned texture buffers are useful for storing video images that do not 00053 * have power-of-two dimensions. Re-sampling artifacts are avoided and less texture buffer memory 00054 * may be required by using non-power-of-two dimensioned texture buffers. Non-power-of-two dimensioned 00055 * texture buffers are also useful for shadow maps and window-space texturing.\n 00056 * However, non-power-of-two dimensioned (NPOTD) texture buffers have limitations that do not 00057 * apply to power-of-two dimensioned (POT) texture buffers. NPOTD texture buffers may not use mipmap 00058 * filtering; POTD texture buffers support both mipmapped and non-mipmapped filtering. NPOTD 00059 * texture buffers support only the CLAMP, CLAMP TO EDGE, and CLAMP TO BORDER wrap 00060 * modes; POTD texture buffers support CLAMP TO EDGE, REPEAT, CLAMP, MIRRORED 00061 * REPEAT, and CLAMP TO BORDER. NPOTD texture buffers do not support an optional 1- 00062 * texel border; POTD texture buffers do support an optional 1-texel border.\n 00063 */ 00064 class TextureBufferRectangle : public TextureBuffer { 00065 00066 00067 //[-------------------------------------------------------] 00068 //[ Public functions ] 00069 //[-------------------------------------------------------] 00070 public: 00071 /** 00072 * @brief 00073 * Destructor 00074 */ 00075 PLRENDERER_API virtual ~TextureBufferRectangle(); 00076 00077 /** 00078 * @brief 00079 * Returns the texture buffer size 00080 * 00081 * @return 00082 * Texture buffer size 00083 */ 00084 inline const PLMath::Vector2i &GetSize() const; 00085 00086 00087 //[-------------------------------------------------------] 00088 //[ Protected functions ] 00089 //[-------------------------------------------------------] 00090 protected: 00091 /** 00092 * @brief 00093 * Constructor 00094 * 00095 * @param[in] cRenderer 00096 * Owner renderer 00097 * @param[in] nFlags 00098 * Texture buffer flags (see EFlags) 00099 */ 00100 PLRENDERER_API TextureBufferRectangle(Renderer &cRenderer, PLCore::uint32 nFlags); 00101 00102 00103 //[-------------------------------------------------------] 00104 //[ Protected data ] 00105 //[-------------------------------------------------------] 00106 protected: 00107 PLMath::Vector2i m_vSize; /**< Texture buffer size */ 00108 00109 00110 //[-------------------------------------------------------] 00111 //[ Private functions ] 00112 //[-------------------------------------------------------] 00113 private: 00114 /** 00115 * @brief 00116 * Copy constructor 00117 * 00118 * @param[in] cSource 00119 * Source to copy from 00120 */ 00121 TextureBufferRectangle(const TextureBufferRectangle &cSource); 00122 00123 /** 00124 * @brief 00125 * Copy operator 00126 * 00127 * @param[in] cSource 00128 * Source to copy from 00129 * 00130 * @return 00131 * Reference to this instance 00132 */ 00133 TextureBufferRectangle &operator =(const TextureBufferRectangle &cSource); 00134 00135 00136 //[-------------------------------------------------------] 00137 //[ Public virtual TextureBuffer functions ] 00138 //[-------------------------------------------------------] 00139 public: 00140 PLRENDERER_API virtual bool IsPowerOfTwo() const override; 00141 PLRENDERER_API virtual PLCore::uint32 GetNumOfPixels(PLCore::uint32 nMipmap = 0) const override; 00142 PLRENDERER_API virtual PLCore::uint32 GetNumOfBytes(PLCore::uint32 nMipmap = 0, EPixelFormat nFormat = Unknown) const override; 00143 00144 00145 }; 00146 00147 00148 //[-------------------------------------------------------] 00149 //[ Namespace ] 00150 //[-------------------------------------------------------] 00151 } // PLRenderer 00152 00153 00154 //[-------------------------------------------------------] 00155 //[ Implementation ] 00156 //[-------------------------------------------------------] 00157 #include "PLRenderer/Renderer/TextureBufferRectangle.inl" 00158 00159 00160 #endif // __PLRENDERER_TEXTUREBUFFERRECTANGLE_H__
|