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         // illumination pass state type
00045         enum IlluminationPassesState
00046         {
00047             IPS_COMPILE_DISABLED = -1,
00048             IPS_NOT_COMPILED = 0,
00049             IPS_COMPILED = 1
00050         };
00051 
00052         typedef std::vector<Pass*> Passes;
00054         Passes mPasses;
00056         IlluminationPassList mIlluminationPasses;
00057         Material* mParent; // raw pointer since we don't want child to stop parent's destruction
00058         bool mIsSupported;
00059         IlluminationPassesState mIlluminationPassesCompilationPhase;
00061         unsigned short mLodIndex;
00065         unsigned short mSchemeIndex;
00066         String mName; // optional name for the technique
00067 
00069         void clearIlluminationPasses(void);
00070     public:
00072         Technique(Material* parent);
00074         Technique(Material* parent, const Technique& oth);
00075         ~Technique();
00081         bool isSupported(void) const;
00083         void _compile(bool autoManageTextureUnits);
00085         void _compileIlluminationPasses(void);
00086 
00087 
00098         Pass* createPass(void);
00100         Pass* getPass(unsigned short index);
00104         Pass* getPass(const String& name);
00106         unsigned short getNumPasses(void) const;
00108         void removePass(unsigned short index);
00110         void removeAllPasses(void);
00114         bool movePass(const unsigned short sourceIndex, const unsigned short destinationIndex);
00115         typedef VectorIterator<Passes> PassIterator;
00117         const PassIterator getPassIterator(void);
00118         typedef VectorIterator<IlluminationPassList> IlluminationPassIterator;
00120         const IlluminationPassIterator getIlluminationPassIterator(void);
00122         Material* getParent(void) const { return mParent; }
00123 
00125         Technique& operator=(const Technique& rhs);
00126 
00128         const String& getResourceGroup(void) const;
00129 
00138         bool isTransparent(void) const;
00139 
00141         void _load(void);
00143         void _unload(void);
00144 
00145         // Is this loaded?
00146         bool isLoaded(void) const;
00147 
00149         void _notifyNeedsRecompile(void);
00150 
00151 
00152         // -------------------------------------------------------------------------------
00153         // The following methods are to make migration from previous versions simpler
00154         // and to make code easier to write when dealing with simple materials
00155         // They set the properties which have been moved to Pass for all Techniques and all Passes
00156 
00165         void setPointSize(Real ps);
00166 
00175         void setAmbient(Real red, Real green, Real blue);
00176 
00185         void setAmbient(const ColourValue& ambient);
00186 
00195         void setDiffuse(Real red, Real green, Real blue, Real alpha);
00196 
00205         void setDiffuse(const ColourValue& diffuse);
00206 
00215         void setSpecular(Real red, Real green, Real blue, Real alpha);
00216 
00225         void setSpecular(const ColourValue& specular);
00226 
00235         void setShininess(Real val);
00236 
00245         void setSelfIllumination(Real red, Real green, Real blue);
00246 
00255         void setSelfIllumination(const ColourValue& selfIllum);
00256 
00265         void setDepthCheckEnabled(bool enabled);
00266 
00275         void setDepthWriteEnabled(bool enabled);
00276 
00285         void setDepthFunction( CompareFunction func );
00286 
00295         void setColourWriteEnabled(bool enabled);
00296 
00305         void setCullingMode( CullingMode mode );
00306 
00315         void setManualCullingMode( ManualCullingMode mode );
00316 
00325         void setLightingEnabled(bool enabled);
00326 
00335         void setShadingMode( ShadeOptions mode );
00336 
00345         void setFog(
00346             bool overrideScene,
00347             FogMode mode = FOG_NONE,
00348             const ColourValue& colour = ColourValue::White,
00349             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
00350 
00359         void setDepthBias(ushort bias);
00360 
00369         void setTextureFiltering(TextureFilterOptions filterType);
00378         void setTextureAnisotropy(unsigned int maxAniso);
00379 
00388         void setSceneBlending( const SceneBlendType sbt );
00389 
00398         void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
00399 
00416         void setLodIndex(unsigned short index);
00418         unsigned short getLodIndex(void) const { return mLodIndex; }
00419 
00437         void setSchemeName(const String& schemeName);
00441         const String& getSchemeName(void) const;
00442         
00444         unsigned short _getSchemeIndex(void) const;
00445             
00447         bool isDepthWriteEnabled(void) const;
00448 
00450         bool isDepthCheckEnabled(void) const;
00451 
00453         bool hasColourWriteDisabled(void) const;
00454 
00460         void setName(const String& name);
00462         const String& getName(void) const { return mName; }
00463 
00475         bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
00476 
00477 
00478     };
00479 
00480 
00481 }
00482 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:50 2006