OgreUnifiedHighLevelGpuProgram.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __UnifiedHighLevelGpuProgram_H__
#define __UnifiedHighLevelGpuProgram_H__
#include "OgrePrerequisites.h"
#include "OgreHighLevelGpuProgram.h"
#include "OgreHighLevelGpuProgramManager.h"
namespace Ogre {
class _OgreExport UnifiedHighLevelGpuProgram : public HighLevelGpuProgram
{
public:
class CmdDelegate : public ParamCommand
{
public:
String doGet(const void* target) const;
void doSet(void* target, const String& val);
};
protected:
static CmdDelegate msCmdDelegate;
StringVector mDelegateNames;
mutable HighLevelGpuProgramPtr mChosenDelegate;
void chooseDelegate() const;
void createLowLevelImpl(void);
void unloadHighLevelImpl(void);
void buildConstantDefinitions() const;
void loadFromSource(void);
public:
UnifiedHighLevelGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
~UnifiedHighLevelGpuProgram();
virtual size_t calculateSize(void) const;
void addDelegateProgram(const String& name);
void clearDelegatePrograms();
const HighLevelGpuProgramPtr& _getDelegate() const;
const String& getLanguage(void) const;
GpuProgramParametersSharedPtr createParameters(void);
GpuProgram* _getBindingDelegate(void);
// All the following methods must delegate to the implementation
bool isSupported(void) const;
bool isSkeletalAnimationIncluded(void) const;
bool isMorphAnimationIncluded(void) const;
bool isPoseAnimationIncluded(void) const;
bool isVertexTextureFetchRequired(void) const;
GpuProgramParametersSharedPtr getDefaultParameters(void);
bool hasDefaultParameters(void) const;
bool getPassSurfaceAndLightStates(void) const;
bool getPassFogStates(void) const;
bool getPassTransformStates(void) const;
bool hasCompileError(void) const;
void resetCompileError(void);
void load(bool backgroundThread = false);
void reload(void);
bool isReloadable(void) const;
bool isLoaded(void) const;
bool isLoading() const;
LoadingState getLoadingState() const;
void unload(void);
size_t getSize(void) const;
void touch(void);
bool isBackgroundLoaded(void) const;
void setBackgroundLoaded(bool bl);
void escalateLoading();
void addListener(Listener* lis);
void removeListener(Listener* lis);
};
class UnifiedHighLevelGpuProgramFactory : public HighLevelGpuProgramFactory
{
public:
UnifiedHighLevelGpuProgramFactory();
~UnifiedHighLevelGpuProgramFactory();
const String& getLanguage(void) const;
HighLevelGpuProgram* create(ResourceManager* creator,
const String& name, ResourceHandle handle,
const String& group, bool isManual, ManualResourceLoader* loader);
void destroy(HighLevelGpuProgram* prog);
};
}
#endif
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
Ogre::HighLevelGpuProgram
Abstract base class representing a high-level program (a vertex or fragment program).
Definition: OgreHighLevelGpuProgram.h:63
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:514
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::Resource::Listener
Definition: OgreResource.h:83
OgreHighLevelGpuProgramManager.h
OgrePrerequisites.h
Ogre::UnifiedHighLevelGpuProgram::CmdDelegate
Command object for setting delegate (can set more than once)
Definition: OgreUnifiedHighLevelGpuProgram.h:64
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::UnifiedHighLevelGpuProgramFactory
Factory class for Unified programs.
Definition: OgreUnifiedHighLevelGpuProgram.h:160
Ogre::UnifiedHighLevelGpuProgram
Specialisation of HighLevelGpuProgram which just delegates its implementation to one other high level...
Definition: OgreUnifiedHighLevelGpuProgram.h:60
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:122
Ogre::GpuProgram
Defines a program which runs on the GPU such as a vertex or fragment program.
Definition: OgreGpuProgram.h:69
Ogre::UnifiedHighLevelGpuProgram::mChosenDelegate
HighLevelGpuProgramPtr mChosenDelegate
The chosen delegate.
Definition: OgreUnifiedHighLevelGpuProgram.h:77
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::UnifiedHighLevelGpuProgram::mDelegateNames
StringVector mDelegateNames
Ordered list of potential delegates.
Definition: OgreUnifiedHighLevelGpuProgram.h:75
Ogre::Resource::LoadingState
LoadingState
Enum identifying the loading state of the resource.
Definition: OgreResource.h:127
Ogre::SharedPtr< HighLevelGpuProgram >
Ogre::UnifiedHighLevelGpuProgram::msCmdDelegate
static CmdDelegate msCmdDelegate
Definition: OgreUnifiedHighLevelGpuProgram.h:72
Ogre::HighLevelGpuProgramFactory
Interface definition for factories of HighLevelGpuProgram.
Definition: OgreHighLevelGpuProgramManager.h:47
Ogre::ParamCommand
Abstract class which is command object which gets/sets parameters.
Definition: OgreStringInterface.h:79
OgreHighLevelGpuProgram.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.