PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: EffectTechnique.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_EFFECT_EFFECTTECHNIQUE_H__ 00024 #define __PLRENDERER_EFFECT_EFFECTTECHNIQUE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include <PLCore/String/String.h> 00032 #include <PLCore/Container/Array.h> 00033 #include "PLRenderer/PLRenderer.h" 00034 00035 00036 //[-------------------------------------------------------] 00037 //[ Namespace ] 00038 //[-------------------------------------------------------] 00039 namespace PLRenderer { 00040 00041 00042 //[-------------------------------------------------------] 00043 //[ Forward declarations ] 00044 //[-------------------------------------------------------] 00045 class Effect; 00046 class EffectPass; 00047 class ParameterManager; 00048 00049 00050 //[-------------------------------------------------------] 00051 //[ Classes ] 00052 //[-------------------------------------------------------] 00053 /** 00054 * @brief 00055 * Effect technique class 00056 */ 00057 class EffectTechnique { 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Friends ] 00062 //[-------------------------------------------------------] 00063 friend class Effect; 00064 00065 00066 //[-------------------------------------------------------] 00067 //[ Public functions ] 00068 //[-------------------------------------------------------] 00069 public: 00070 /** 00071 * @brief 00072 * Returns the owner effect 00073 * 00074 * @return 00075 * Owner effect 00076 */ 00077 inline Effect &GetEffect() const; 00078 00079 /** 00080 * @brief 00081 * Returns whether the technique is valid or not 00082 * 00083 * @return 00084 * 'true' if the technique is valid, else 'false' 00085 * 00086 * @remarks 00087 * If an technique is invalid for instance because an used 00088 * shader isn't supported by the hardware you shouldn't use this 00089 * technique because it may produce ugly results! 00090 */ 00091 inline bool IsValid() const; 00092 00093 /** 00094 * @brief 00095 * Sets whether the technique is valid or not 00096 * 00097 * @param[in] bValid 00098 * Technique valid? 00099 */ 00100 inline void SetValid(bool bValid); 00101 00102 /** 00103 * @brief 00104 * Gets the name of the technique 00105 * 00106 * @return 00107 * Name of the technique 00108 */ 00109 inline PLCore::String GetName() const; 00110 00111 /** 00112 * @brief 00113 * Sets the name of the technique 00114 * 00115 * @param[in] sName 00116 * New technique name 00117 */ 00118 inline void SetName(const PLCore::String &sName = ""); 00119 00120 /** 00121 * @brief 00122 * Gets the number of render passes the technique is using 00123 * 00124 * @return 00125 * Number of passes 00126 */ 00127 inline PLCore::uint32 GetNumOfPasses() const; 00128 00129 /** 00130 * @brief 00131 * Adds a pass 00132 * 00133 * @param[in] nIndex 00134 * Pass index in the technique where to add the new pass, if < 0 add at the end 00135 * 00136 * @return 00137 * The new pass, a null pointer on error 00138 */ 00139 PLRENDERER_API EffectPass *AddPass(int nIndex = -1); 00140 00141 /** 00142 * @brief 00143 * Removes a pass 00144 * 00145 * @param[in] nIndex 00146 * Pass index in the technique to remove 00147 * 00148 * @return 00149 * 'true' if all went fine, else 'false' 00150 */ 00151 PLRENDERER_API bool RemovePass(PLCore::uint32 nIndex = 0); 00152 00153 /** 00154 * @brief 00155 * Removes all passes 00156 */ 00157 PLRENDERER_API void RemoveAllPasses(); 00158 00159 /** 00160 * @brief 00161 * Gets a pass 00162 * 00163 * @param[in] nIndex 00164 * Pass index in the technique 00165 * 00166 * @return 00167 * The requested pass, a null pointer on error 00168 */ 00169 inline EffectPass *GetPass(PLCore::uint32 nIndex = 0) const; 00170 00171 /** 00172 * @brief 00173 * Setup the given path 00174 * 00175 * @param[in] nIndex 00176 * Index of the path to setup 00177 * @param[in] pParameterManager 00178 * Parameters set instead of existing effect parameters, if a null pointer, use THIS parameter manager 00179 * 00180 * @return 00181 * 'true' if all went fine, else 'false' 00182 */ 00183 PLRENDERER_API bool SetupPass(PLCore::uint32 nIndex = 0, ParameterManager *pParameterManager = nullptr) const; 00184 00185 00186 //[-------------------------------------------------------] 00187 //[ Private functions ] 00188 //[-------------------------------------------------------] 00189 private: 00190 /** 00191 * @brief 00192 * Constructor 00193 * 00194 * @param[in] cFX 00195 * Owner effect 00196 */ 00197 EffectTechnique(Effect &cFX); 00198 00199 /** 00200 * @brief 00201 * Destructor 00202 */ 00203 ~EffectTechnique(); 00204 00205 /** 00206 * @brief 00207 * Copy operator 00208 * 00209 * @param[in] cSource 00210 * Source to copy from 00211 * 00212 * @return 00213 * Reference to this effect technique 00214 */ 00215 EffectTechnique &operator =(const EffectTechnique &cSource); 00216 00217 00218 //[-------------------------------------------------------] 00219 //[ Private data ] 00220 //[-------------------------------------------------------] 00221 private: 00222 Effect *m_pFX; /**< Owner effect (always valid!) */ 00223 bool m_bValid; /**< Is the technique valid? */ 00224 PLCore::String m_sName; /**< Technique name */ 00225 PLCore::Array<EffectPass*> m_lstPass; /**< List of passes */ 00226 00227 00228 }; 00229 00230 00231 //[-------------------------------------------------------] 00232 //[ Namespace ] 00233 //[-------------------------------------------------------] 00234 } // PLRenderer 00235 00236 00237 //[-------------------------------------------------------] 00238 //[ Implementation ] 00239 //[-------------------------------------------------------] 00240 #include "PLRenderer/Effect/EffectTechnique.inl" 00241 00242 00243 #endif // __PLRENDERER_EFFECT_EFFECTTECHNIQUE_H__
|