# 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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __Technique_H__
    00030 #define __Technique_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreIteratorWrappers.h"
    00034 #include "OgreBlendMode.h"
    00035 #include "OgreCommon.h"
    00036 #include "OgrePass.h"
    00037
    00038 namespace Ogre {
    00045     class _OgreExport Technique
    00046     {
    00047     protected:
    00048         // illumination pass state type
    00049         enum IlluminationPassesState
    00050         {
    00051             IPS_COMPILE_DISABLED = -1,
    00052             IPS_NOT_COMPILED = 0,
    00053             IPS_COMPILED = 1
    00054         };
    00055
    00056         typedef std::vector<Pass*> Passes;
    00058         Passes mPasses;
    00060         IlluminationPassList mIlluminationPasses;
    00061         Material* mParent; // raw pointer since we don't want child to stop parent's destruction
    00062         bool mIsSupported;
    00063         IlluminationPassesState mIlluminationPassesCompilationPhase;
    00065         unsigned short mLodIndex;
    00069         unsigned short mSchemeIndex;
    00070         String mName; // optional name for the technique
    00071
    00073         void clearIlluminationPasses(void);
    00074     public:
    00076         Technique(Material* parent);
    00078         Technique(Material* parent, const Technique& oth);
    00079         ~Technique();
    00085         bool isSupported(void) const;
    00089         String _compile(bool autoManageTextureUnits);
    00091         void _compileIlluminationPasses(void);
    00092
    00093
    00104         Pass* createPass(void);
    00106         Pass* getPass(unsigned short index);
    00110         Pass* getPass(const String& name);
    00112         unsigned short getNumPasses(void) const;
    00114         void removePass(unsigned short index);
    00116         void removeAllPasses(void);
    00120         bool movePass(const unsigned short sourceIndex, const unsigned short destinationIndex);
    00121         typedef VectorIterator<Passes> PassIterator;
    00123         const PassIterator getPassIterator(void);
    00124         typedef VectorIterator<IlluminationPassList> IlluminationPassIterator;
    00126         const IlluminationPassIterator getIlluminationPassIterator(void);
    00128         Material* getParent(void) const { return mParent; }
    00129
    00131         Technique& operator=(const Technique& rhs);
    00132
    00134         const String& getResourceGroup(void) const;
    00135
    00144         bool isTransparent(void) const;
    00145
    00147         void _load(void);
    00149         void _unload(void);
    00150
    00151         // Is this loaded?
    00152         bool isLoaded(void) const;
    00153
    00155         void _notifyNeedsRecompile(void);
    00156
    00157
    00158         // -------------------------------------------------------------------------------
    00159         // The following methods are to make migration from previous versions simpler
    00160         // and to make code easier to write when dealing with simple materials
    00161         // They set the properties which have been moved to Pass for all Techniques and all Passes
    00162
    00171         void setPointSize(Real ps);
    00172
    00181         void setAmbient(Real red, Real green, Real blue);
    00182
    00191         void setAmbient(const ColourValue& ambient);
    00192
    00201         void setDiffuse(Real red, Real green, Real blue, Real alpha);
    00202
    00211         void setDiffuse(const ColourValue& diffuse);
    00212
    00221         void setSpecular(Real red, Real green, Real blue, Real alpha);
    00222
    00231         void setSpecular(const ColourValue& specular);
    00232
    00241         void setShininess(Real val);
    00242
    00251         void setSelfIllumination(Real red, Real green, Real blue);
    00252
    00261         void setSelfIllumination(const ColourValue& selfIllum);
    00262
    00271         void setDepthCheckEnabled(bool enabled);
    00272
    00281         void setDepthWriteEnabled(bool enabled);
    00282
    00291         void setDepthFunction( CompareFunction func );
    00292
    00301         void setColourWriteEnabled(bool enabled);
    00302
    00311         void setCullingMode( CullingMode mode );
    00312
    00321         void setManualCullingMode( ManualCullingMode mode );
    00322
    00331         void setLightingEnabled(bool enabled);
    00332
    00341         void setShadingMode( ShadeOptions mode );
    00342
    00351         void setFog(
    00352             bool overrideScene,
    00353             FogMode mode = FOG_NONE,
    00354             const ColourValue& colour = ColourValue::White,
    00355             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
    00356
    00365         void setDepthBias(float constantBias, float slopeScaleBias);
    00366
    00375         void setTextureFiltering(TextureFilterOptions filterType);
    00384         void setTextureAnisotropy(unsigned int maxAniso);
    00385
    00394         void setSceneBlending( const SceneBlendType sbt );
    00395
    00404         void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
    00405
    00422         void setLodIndex(unsigned short index);
    00424         unsigned short getLodIndex(void) const { return mLodIndex; }
    00425
    00443         void setSchemeName(const String& schemeName);
    00447         const String& getSchemeName(void) const;
    00448
    00450         unsigned short _getSchemeIndex(void) const;
    00451
    00453         bool isDepthWriteEnabled(void) const;
    00454
    00456         bool isDepthCheckEnabled(void) const;
    00457
    00459         bool hasColourWriteDisabled(void) const;
    00460
    00466         void setName(const String& name);
    00468         const String& getName(void) const { return mName; }
    00469
    00481         bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
    00482
    00483
    00484     };
    00485
    00486
    00487 }
    00488 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat May 10 16:25:04 2008