00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2003 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __Technique_H__ 00026 #define __Technique_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 #include "OgreIteratorWrappers.h" 00030 #include "OgreBlendMode.h" 00031 #include "OgreCommon.h" 00032 #include "OgrePass.h" 00033 00034 namespace Ogre { 00041 class _OgreExport Technique 00042 { 00043 protected: 00044 typedef std::vector<Pass*> Passes; 00046 Passes mPasses; 00048 IlluminationPassList mIlluminationPasses; 00049 Material* mParent; 00050 bool mIsSupported; 00051 unsigned short mLodIndex; 00052 00054 void clearIlluminationPasses(void); 00055 public: 00057 Technique(Material* parent); 00059 Technique(Material* parent, const Technique& oth); 00060 ~Technique(); 00066 bool isSupported(void) const; 00068 void _compile(bool autoManageTextureUnits); 00070 void _compileIlluminationPasses(void); 00071 00072 00083 Pass* createPass(void); 00085 Pass* getPass(unsigned short index); 00087 unsigned short getNumPasses(void) const; 00089 void removePass(unsigned short index); 00091 void removeAllPasses(void); 00092 typedef VectorIterator<Passes> PassIterator; 00094 const PassIterator getPassIterator(void); 00095 typedef VectorIterator<IlluminationPassList> IlluminationPassIterator; 00097 const IlluminationPassIterator getIlluminationPassIterator(void); 00099 Material* getParent(void) const { return mParent; } 00100 00102 Technique& operator=(const Technique& rhs); 00103 00112 bool isTransparent(void) const; 00113 00115 void _load(void); 00117 void _unload(void); 00118 00119 // Is this loaded? 00120 bool isLoaded(void) const; 00121 00123 void _notifyNeedsRecompile(void); 00124 00125 00126 // ------------------------------------------------------------------------------- 00127 // The following methods are to make migration from previous versions simpler 00128 // and to make code easier to write when dealing with simple materials 00129 // They set the properties which have been moved to Pass for all Techniques and all Passes 00130 00139 void setAmbient(Real red, Real green, Real blue); 00140 00149 void setAmbient(const ColourValue& ambient); 00150 00159 void setDiffuse(Real red, Real green, Real blue); 00160 00169 void setDiffuse(const ColourValue& diffuse); 00170 00179 void setSpecular(Real red, Real green, Real blue); 00180 00189 void setSpecular(const ColourValue& specular); 00190 00199 void setShininess(Real val); 00200 00209 void setSelfIllumination(Real red, Real green, Real blue); 00210 00219 void setSelfIllumination(const ColourValue& selfIllum); 00220 00229 void setDepthCheckEnabled(bool enabled); 00230 00239 void setDepthWriteEnabled(bool enabled); 00240 00249 void setDepthFunction( CompareFunction func ); 00250 00259 void setColourWriteEnabled(bool enabled); 00260 00269 void setCullingMode( CullingMode mode ); 00270 00279 void setManualCullingMode( ManualCullingMode mode ); 00280 00289 void setLightingEnabled(bool enabled); 00290 00299 void setShadingMode( ShadeOptions mode ); 00300 00309 void setFog( 00310 bool overrideScene, 00311 FogMode mode = FOG_NONE, 00312 const ColourValue& colour = ColourValue::White, 00313 Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 ); 00314 00323 void setDepthBias(ushort bias); 00324 00333 void setTextureFiltering(TextureFilterOptions filterType); 00342 void setTextureAnisotropy(unsigned int maxAniso); 00343 00352 void setSceneBlending( const SceneBlendType sbt ); 00353 00362 void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor); 00363 00380 void setLodIndex(unsigned short index); 00382 unsigned short getLodIndex(void) const { return mLodIndex; } 00383 00384 00385 }; 00386 00387 00388 } 00389 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:50 2004