# OgreCgProgram.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 __CgProgram_H__
    00026 #define __CgProgram_H__
    00027
    00028 #include "OgreCgPrerequisites.h"
    00029 #include "OgreHighLevelGpuProgram.h"
    00030 #include "OgreStringVector.h"
    00031
    00032 namespace Ogre {
    00042     class CgProgram : public HighLevelGpuProgram
    00043     {
    00044     public:
    00046         class CmdEntryPoint : public ParamCommand
    00047         {
    00048         public:
    00049             String doGet(const void* target) const;
    00050             void doSet(void* target, const String& val);
    00051         };
    00053         class CmdProfiles : public ParamCommand
    00054         {
    00055         public:
    00056             String doGet(const void* target) const;
    00057             void doSet(void* target, const String& val);
    00058         };
    00060         class CmdArgs : public ParamCommand
    00061         {
    00062         public:
    00063             String doGet(const void* target) const;
    00064             void doSet(void* target, const String& val);
    00065         };
    00066
    00067     protected:
    00068
    00069         static CmdEntryPoint msCmdEntryPoint;
    00070         static CmdProfiles msCmdProfiles;
    00071         static CmdArgs msCmdArgs;
    00072
    00074         CGcontext mCgContext;
    00076         CGprogram mCgProgram;
    00079         void loadFromSource(void);
    00082         void createLowLevelImpl(void);
    00084         void unloadHighLevelImpl(void);
    00086         void populateParameterNames(GpuProgramParametersSharedPtr params);
    00087
    00088         StringVector mProfiles;
    00089         String mEntryPoint;
    00090         String mSelectedProfile;
    00091         CGprofile mSelectedCgProfile;
    00092         String mCompileArgs;
    00093         // Unfortunately Cg uses char** for arguments - bleh
    00094         // This is a null-terminated list of char* (each null terminated)
    00095         char** mCgArguments;
    00096
    00098         void selectProfile(void);
    00100         void buildArgs(void);
    00102         void freeCgArgs(void);
    00103
    00104
    00105     public:
    00106         CgProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
    00107             const String& group, bool isManual, ManualResourceLoader* loader,
    00108             CGcontext context);
    00109         ~CgProgram();
    00110
    00112         void setEntryPoint(const String& entryPoint) { mEntryPoint = entryPoint; }
    00114         const String& getEntryPoint(void) const { return mEntryPoint; }
    00116         void setProfiles(const StringVector& profiles);
    00118         const StringVector& getProfiles(void) const { return mProfiles; }
    00120         void setCompileArguments(const String& args) { mCompileArgs = args; }
    00122         const String& getCompileArguments(void) const { return mCompileArgs; }
    00124         bool isSupported(void) const;
    00125     };
    00126 }
    00127
    00128 #endif

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