Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreTechnique.h

Go to the documentation of this file.
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 (c) 2000-2005 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; // raw pointer since we don't want child to stop parent's destruction
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 
00105         const String& getResourceGroup(void) const;
00106 
00115         bool isTransparent(void) const;
00116 
00118         void _load(void);
00120         void _unload(void);
00121 
00122         // Is this loaded?
00123         bool isLoaded(void) const;
00124 
00126         void _notifyNeedsRecompile(void);
00127 
00128 
00129         // -------------------------------------------------------------------------------
00130         // The following methods are to make migration from previous versions simpler
00131         // and to make code easier to write when dealing with simple materials
00132         // They set the properties which have been moved to Pass for all Techniques and all Passes
00133 
00142         void setAmbient(Real red, Real green, Real blue);
00143 
00152         void setAmbient(const ColourValue& ambient);
00153 
00162         void setDiffuse(Real red, Real green, Real blue, Real alpha);
00163 
00172         void setDiffuse(const ColourValue& diffuse);
00173 
00182         void setSpecular(Real red, Real green, Real blue, Real alpha);
00183 
00192         void setSpecular(const ColourValue& specular);
00193 
00202         void setShininess(Real val);
00203 
00212         void setSelfIllumination(Real red, Real green, Real blue);
00213 
00222         void setSelfIllumination(const ColourValue& selfIllum);
00223 
00232         void setDepthCheckEnabled(bool enabled);
00233 
00242         void setDepthWriteEnabled(bool enabled);
00243 
00252         void setDepthFunction( CompareFunction func );
00253 
00262         void setColourWriteEnabled(bool enabled);
00263 
00272         void setCullingMode( CullingMode mode );
00273 
00282         void setManualCullingMode( ManualCullingMode mode );
00283 
00292         void setLightingEnabled(bool enabled);
00293 
00302         void setShadingMode( ShadeOptions mode );
00303 
00312         void setFog(
00313             bool overrideScene,
00314             FogMode mode = FOG_NONE,
00315             const ColourValue& colour = ColourValue::White,
00316             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
00317 
00326         void setDepthBias(ushort bias);
00327 
00336         void setTextureFiltering(TextureFilterOptions filterType);
00345         void setTextureAnisotropy(unsigned int maxAniso);
00346 
00355         void setSceneBlending( const SceneBlendType sbt );
00356 
00365         void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
00366 
00383         void setLodIndex(unsigned short index);
00385         unsigned short getLodIndex(void) const { return mLodIndex; }
00386 
00388         bool isDepthWriteEnabled(void) const;
00389 
00391         bool isDepthCheckEnabled(void) const;
00392 
00393     };
00394 
00395 
00396 }
00397 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Wed Feb 23 00:19:14 2005