# 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;
    00060         unsigned short mLodIndex;
    00061
    00063         void clearIlluminationPasses(void);
    00064     public:
    00066         Technique(Material* parent);
    00068         Technique(Material* parent, const Technique& oth);
    00069         ~Technique();
    00075         bool isSupported(void) const;
    00077         void _compile(bool autoManageTextureUnits);
    00079         void _compileIlluminationPasses(void);
    00080
    00081
    00092         Pass* createPass(void);
    00094         Pass* getPass(unsigned short index);
    00096         unsigned short getNumPasses(void) const;
    00098         void removePass(unsigned short index);
    00100         void removeAllPasses(void);
    00101         typedef VectorIterator<Passes> PassIterator;
    00103         const PassIterator getPassIterator(void);
    00104         typedef VectorIterator<IlluminationPassList> IlluminationPassIterator;
    00106         const IlluminationPassIterator getIlluminationPassIterator(void);
    00108         Material* getParent(void) const { return mParent; }
    00109
    00111         Technique& operator=(const Technique& rhs);
    00112
    00114         const String& getResourceGroup(void) const;
    00115
    00124         bool isTransparent(void) const;
    00125
    00127         void _load(void);
    00129         void _unload(void);
    00130
    00131         // Is this loaded?
    00132         bool isLoaded(void) const;
    00133
    00135         void _notifyNeedsRecompile(void);
    00136
    00137
    00138         // -------------------------------------------------------------------------------
    00139         // The following methods are to make migration from previous versions simpler
    00140         // and to make code easier to write when dealing with simple materials
    00141         // They set the properties which have been moved to Pass for all Techniques and all Passes
    00142
    00151         void setAmbient(Real red, Real green, Real blue);
    00152
    00161         void setAmbient(const ColourValue& ambient);
    00162
    00171         void setDiffuse(Real red, Real green, Real blue, Real alpha);
    00172
    00181         void setDiffuse(const ColourValue& diffuse);
    00182
    00191         void setSpecular(Real red, Real green, Real blue, Real alpha);
    00192
    00201         void setSpecular(const ColourValue& specular);
    00202
    00211         void setShininess(Real val);
    00212
    00221         void setSelfIllumination(Real red, Real green, Real blue);
    00222
    00231         void setSelfIllumination(const ColourValue& selfIllum);
    00232
    00241         void setDepthCheckEnabled(bool enabled);
    00242
    00251         void setDepthWriteEnabled(bool enabled);
    00252
    00261         void setDepthFunction( CompareFunction func );
    00262
    00271         void setColourWriteEnabled(bool enabled);
    00272
    00281         void setCullingMode( CullingMode mode );
    00282
    00291         void setManualCullingMode( ManualCullingMode mode );
    00292
    00301         void setLightingEnabled(bool enabled);
    00302
    00311         void setShadingMode( ShadeOptions mode );
    00312
    00321         void setFog(
    00322             bool overrideScene,
    00323             FogMode mode = FOG_NONE,
    00324             const ColourValue& colour = ColourValue::White,
    00325             Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
    00326
    00335         void setDepthBias(ushort bias);
    00336
    00345         void setTextureFiltering(TextureFilterOptions filterType);
    00354         void setTextureAnisotropy(unsigned int maxAniso);
    00355
    00364         void setSceneBlending( const SceneBlendType sbt );
    00365
    00374         void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
    00375
    00392         void setLodIndex(unsigned short index);
    00394         unsigned short getLodIndex(void) const { return mLodIndex; }
    00395
    00397         bool isDepthWriteEnabled(void) const;
    00398
    00400         bool isDepthCheckEnabled(void) const;
    00401
    00402     };
    00403
    00404
    00405 }
    00406 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:08 2005