PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: EffectPassLayer.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_EFFECT_EFFECTPASSLAYER_H__ 00024 #define __PLRENDERER_EFFECT_EFFECTPASSLAYER_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLRenderer/Renderer/SamplerStates.h" 00032 #include "PLRenderer/Renderer/FixedFunctionsTextureStageStates.h" 00033 #include "PLRenderer/Texture/Texture.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLRenderer { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Forward declarations ] 00044 //[-------------------------------------------------------] 00045 class Parameter; 00046 class EffectPass; 00047 class ParameterManager; 00048 00049 00050 //[-------------------------------------------------------] 00051 //[ Classes ] 00052 //[-------------------------------------------------------] 00053 /** 00054 * @brief 00055 * Effect pass layer class 00056 */ 00057 class EffectPassLayer { 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Friends ] 00062 //[-------------------------------------------------------] 00063 friend class EffectPass; 00064 00065 00066 //[-------------------------------------------------------] 00067 //[ Public functions ] 00068 //[-------------------------------------------------------] 00069 public: 00070 /** 00071 * @brief 00072 * Returns the layer owner 00073 * 00074 * @return 00075 * The layer owner 00076 */ 00077 inline EffectPass &GetPass() const; 00078 00079 /** 00080 * @brief 00081 * Makes the texture buffer of the texture handlers texture to the current renderer texture buffer 00082 * 00083 * @param[in] nStage 00084 * Which texture stage? 00085 * @param[in] pParameterManager 00086 * Parameters set instead of existing effect parameters, can be a null pointer 00087 * 00088 * @return 00089 * 'true' if all went fine, else 'false' 00090 * 00091 * @note 00092 * - The texture handlers texture transformation matrix is also set! 00093 * - If there's no texture parameter name or an invalid one no texture is bound 00094 */ 00095 PLRENDERER_API bool Bind(PLCore::uint32 nStage, ParameterManager *pParameterManager = nullptr) const; 00096 00097 /** 00098 * @brief 00099 * Returns the name of the used texture parameter 00100 * 00101 * @return 00102 * The name of the used texture parameter 00103 */ 00104 inline PLCore::String GetTexture() const; 00105 00106 /** 00107 * @brief 00108 * Sets the name of the used texture parameter 00109 * 00110 * @param[in] sTexture 00111 * The name of the used texture parameter 00112 */ 00113 inline void SetTexture(const PLCore::String &sTexture); 00114 00115 /** 00116 * @brief 00117 * Returns the sampler states 00118 * 00119 * @return 00120 * The sampler states 00121 */ 00122 inline SamplerStates &GetSamplerStates(); 00123 inline const SamplerStates &GetSamplerStates() const; 00124 00125 /** 00126 * @brief 00127 * Returns the fixed functions texture stage states 00128 * 00129 * @return 00130 * The fixed functions texture stage states 00131 */ 00132 inline FixedFunctionsTextureStageStates &GetFixedFunctionsTextureStageStates(); 00133 inline const FixedFunctionsTextureStageStates &GetFixedFunctionsTextureStageStates() const; 00134 00135 /** 00136 * @brief 00137 * Copy operator 00138 * 00139 * @param[in] cSource 00140 * Source to copy from 00141 * 00142 * @return 00143 * This instance 00144 */ 00145 inline EffectPassLayer &operator =(const EffectPassLayer &cSource); 00146 00147 00148 //[-------------------------------------------------------] 00149 //[ Private functions ] 00150 //[-------------------------------------------------------] 00151 private: 00152 /** 00153 * @brief 00154 * Constructor 00155 * 00156 * @param[in] cFXPass 00157 * Layer owner 00158 */ 00159 inline EffectPassLayer(EffectPass &cFXPass); 00160 00161 /** 00162 * @brief 00163 * Destructor 00164 */ 00165 inline ~EffectPassLayer(); 00166 00167 /** 00168 * @brief 00169 * Binds a texture 00170 * 00171 * @param[in] pParameter 00172 * Texture parameter to bind, if a null pointer, nothing happens... 00173 * @param[in] nStage 00174 * Stage to bind at, if a shader is used, this information is ignored 00175 * 00176 * @return 00177 * 'true' if all went fine, else 'false' 00178 */ 00179 bool BindTexture(const Parameter *pParameter, PLCore::uint32 nStage) const; 00180 00181 00182 //[-------------------------------------------------------] 00183 //[ Private data ] 00184 //[-------------------------------------------------------] 00185 private: 00186 EffectPass *m_pFXPass; /**< Layer owner (NEVER a null pointer!) */ 00187 PLCore::String m_sTexture; /**< The name of the used texture parameter */ 00188 SamplerStates m_cSamplerStates; /**< Sampler states */ 00189 FixedFunctionsTextureStageStates m_cFixedFunctionsTextureStageStates; /**< Fixed functions texture stage states */ 00190 00191 00192 }; 00193 00194 00195 //[-------------------------------------------------------] 00196 //[ Namespace ] 00197 //[-------------------------------------------------------] 00198 } // PLRenderer 00199 00200 00201 //[-------------------------------------------------------] 00202 //[ Implementation ] 00203 //[-------------------------------------------------------] 00204 #include "PLRenderer/Effect/EffectPassLayer.inl" 00205 00206 00207 #endif // __PLRENDERER_EFFECT_EFFECTPASSLAYER_H__
|