OgreUnifiedHighLevelGpuProgram.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __UnifiedHighLevelGpuProgram_H__
29 #define __UnifiedHighLevelGpuProgram_H__
30 
31 #include "OgrePrerequisites.h"
34 
35 namespace Ogre {
36 
61  {
62  public:
64  class CmdDelegate : public ParamCommand
65  {
66  public:
67  String doGet(const void* target) const;
68  void doSet(void* target, const String& val);
69  };
70 
71  protected:
73 
78 
80  void chooseDelegate() const;
81 
82  void createLowLevelImpl(void);
83  void unloadHighLevelImpl(void);
85  void loadFromSource(void);
86 
87  public:
90  const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
92 
93  virtual size_t calculateSize(void) const;
94 
99  void addDelegateProgram(const String& name);
100 
103 
106 
108  const String& getLanguage(void) const;
109 
120 
121  // All the following methods must delegate to the implementation
122 
124  bool isSupported(void) const;
125 
127  bool isSkeletalAnimationIncluded(void) const;
128 
129  bool isMorphAnimationIncluded(void) const;
130 
131  bool isPoseAnimationIncluded(void) const;
132 
135  bool hasDefaultParameters(void) const;
137  bool getPassFogStates(void) const;
138  bool getPassTransformStates(void) const;
139  bool hasCompileError(void) const;
140  void resetCompileError(void);
141 
142  void load(bool backgroundThread = false);
143  void reload(void);
144  bool isReloadable(void) const;
145  bool isLoaded(void) const;
146  bool isLoading() const;
148  void unload(void);
149  size_t getSize(void) const;
150  void touch(void);
151  bool isBackgroundLoaded(void) const;
152  void setBackgroundLoaded(bool bl);
154  void addListener(Listener* lis);
156 
157  };
158 
161  {
162  public:
166  const String& getLanguage(void) const;
168  const String& name, ResourceHandle handle,
169  const String& group, bool isManual, ManualResourceLoader* loader);
171 
172  };
173 
177 }
178 #endif
Ogre::UnifiedHighLevelGpuProgram::getPassSurfaceAndLightStates
bool getPassSurfaceAndLightStates(void) const
Returns whether a vertex program wants light and material states to be passed through fixed pipeline ...
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::UnifiedHighLevelGpuProgramFactory::destroy
void destroy(HighLevelGpuProgram *prog)
Ogre::UnifiedHighLevelGpuProgram::msCmdDelegate
static CmdDelegate msCmdDelegate
Definition: OgreUnifiedHighLevelGpuProgram.h:72
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::UnifiedHighLevelGpuProgram::addDelegateProgram
void addDelegateProgram(const String &name)
Adds a new delegate program to the list.
Ogre::UnifiedHighLevelGpuProgram::mDelegateNames
StringVector mDelegateNames
Ordered list of potential delegates.
Definition: OgreUnifiedHighLevelGpuProgram.h:75
Ogre::UnifiedHighLevelGpuProgram::getDefaultParameters
GpuProgramParametersSharedPtr getDefaultParameters(void)
Get a reference to the default parameters which are to be used for all uses of this program.
Ogre::UnifiedHighLevelGpuProgram::loadFromSource
void loadFromSource(void)
Virtual method which must be implemented by subclasses, load from mSource.
Ogre::UnifiedHighLevelGpuProgram::~UnifiedHighLevelGpuProgram
~UnifiedHighLevelGpuProgram()
Ogre::UnifiedHighLevelGpuProgram::isLoaded
bool isLoaded(void) const
Returns true if the Resource has been loaded, false otherwise.
OgreHighLevelGpuProgram.h
Ogre::UnifiedHighLevelGpuProgram::escalateLoading
void escalateLoading()
Escalates the loading of a background loaded resource.
Ogre::UnifiedHighLevelGpuProgram::touch
void touch(void)
'Touches' the resource to indicate it has been used.
Ogre::UnifiedHighLevelGpuProgram::isSupported
bool isSupported(void) const
Returns whether this program can be supported on the current renderer and hardware.
OgreHighLevelGpuProgramManager.h
Ogre::UnifiedHighLevelGpuProgram::CmdDelegate::doSet
void doSet(void *target, const String &val)
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
Ogre::GpuProgram
Defines a program which runs on the GPU such as a vertex or fragment program.
Definition: OgreGpuProgram.h:70
Ogre::UnifiedHighLevelGpuProgram::unloadHighLevelImpl
void unloadHighLevelImpl(void)
Internal unload implementation, must be implemented by subclasses.
Ogre::UnifiedHighLevelGpuProgramFactory
Factory class for Unified programs.
Definition: OgreUnifiedHighLevelGpuProgram.h:161
Ogre::UnifiedHighLevelGpuProgramFactory::getLanguage
const String & getLanguage(void) const
Get the name of the language this factory creates programs for.
Ogre::UnifiedHighLevelGpuProgram::setBackgroundLoaded
void setBackgroundLoaded(bool bl)
Tells the resource whether it is background loaded or not.
Ogre::HighLevelGpuProgramFactory
Interface definition for factories of HighLevelGpuProgram.
Definition: OgreHighLevelGpuProgramManager.h:48
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::UnifiedHighLevelGpuProgram::getPassFogStates
bool getPassFogStates(void) const
Returns whether a fragment program wants fog state to be passed through fixed pipeline low level API ...
Ogre::UnifiedHighLevelGpuProgram::reload
void reload(void)
Reloads the resource, if it is already loaded.
Ogre::UnifiedHighLevelGpuProgram::resetCompileError
void resetCompileError(void)
Reset a compile error if it occurred, allowing the load to be retried.
Ogre::UnifiedHighLevelGpuProgram::CmdDelegate::doGet
String doGet(const void *target) const
Ogre::UnifiedHighLevelGpuProgram::isSkeletalAnimationIncluded
bool isSkeletalAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform skeletal animation.
Ogre::UnifiedHighLevelGpuProgram::mChosenDelegate
HighLevelGpuProgramPtr mChosenDelegate
The chosen delegate.
Definition: OgreUnifiedHighLevelGpuProgram.h:77
Ogre::UnifiedHighLevelGpuProgram::isVertexTextureFetchRequired
bool isVertexTextureFetchRequired(void) const
Returns whether this vertex program requires support for vertex texture fetch from the hardware.
Ogre::UnifiedHighLevelGpuProgram::calculateSize
virtual size_t calculateSize(void) const
Calculate the size of a resource; this will only be called after 'load'.
Ogre::UnifiedHighLevelGpuProgramFactory::UnifiedHighLevelGpuProgramFactory
UnifiedHighLevelGpuProgramFactory()
Ogre::ParamCommand
Abstract class which is command object which gets/sets parameters.
Definition: OgreStringInterface.h:80
Ogre::UnifiedHighLevelGpuProgramFactory::create
HighLevelGpuProgram * create(ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual, ManualResourceLoader *loader)
Ogre::UnifiedHighLevelGpuProgram::UnifiedHighLevelGpuProgram
UnifiedHighLevelGpuProgram(ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
Constructor, should be used only by factory classes.
Ogre::UnifiedHighLevelGpuProgram::_getBindingDelegate
GpuProgram * _getBindingDelegate(void)
Returns the GpuProgram which should be bound to the pipeline.
Ogre::UnifiedHighLevelGpuProgram::hasCompileError
bool hasCompileError(void) const
Did this program encounter a compile error when loading?
Ogre::UnifiedHighLevelGpuProgram::getPassTransformStates
bool getPassTransformStates(void) const
Returns whether a vertex program wants transform state to be passed through fixed pipeline low level ...
OgrePrerequisites.h
Ogre::UnifiedHighLevelGpuProgram::createLowLevelImpl
void createLowLevelImpl(void)
Internal method for creating an appropriate low-level program from this high-level program,...
Ogre::UnifiedHighLevelGpuProgram::removeListener
void removeListener(Listener *lis)
Remove a listener on this resource.
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Resource::LoadingState
LoadingState
Enum identifying the loading state of the resource.
Definition: OgreResource.h:128
Ogre::UnifiedHighLevelGpuProgram::CmdDelegate
Command object for setting delegate (can set more than once)
Definition: OgreUnifiedHighLevelGpuProgram.h:65
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:123
Ogre::UnifiedHighLevelGpuProgram::getLanguage
const String & getLanguage(void) const
Returns a string that specifies the language of the gpu programs as specified in a material script.
Ogre::UnifiedHighLevelGpuProgram::chooseDelegate
void chooseDelegate() const
Choose the delegate to use.
Ogre::SharedPtr< HighLevelGpuProgram >
Ogre::UnifiedHighLevelGpuProgram::buildConstantDefinitions
void buildConstantDefinitions() const
Build the constant definition map, must be overridden.
Ogre::UnifiedHighLevelGpuProgram::isBackgroundLoaded
bool isBackgroundLoaded(void) const
Returns whether this Resource has been earmarked for background loading.
Ogre::UnifiedHighLevelGpuProgram::hasDefaultParameters
bool hasDefaultParameters(void) const
Returns true if default parameters have been set up.
Ogre::UnifiedHighLevelGpuProgram::addListener
void addListener(Listener *lis)
Register a listener on this resource.
Ogre::UnifiedHighLevelGpuProgram::isPoseAnimationIncluded
bool isPoseAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform pose animation.
Ogre::UnifiedHighLevelGpuProgramFactory::~UnifiedHighLevelGpuProgramFactory
~UnifiedHighLevelGpuProgramFactory()
Ogre::Resource::Listener
Definition: OgreResource.h:84
Ogre::UnifiedHighLevelGpuProgram::_getDelegate
const HighLevelGpuProgramPtr & _getDelegate() const
Get the chosen delegate.
Ogre::UnifiedHighLevelGpuProgram::isLoading
bool isLoading() const
Returns whether the resource is currently in the process of background loading.
Ogre::UnifiedHighLevelGpuProgram::load
void load(bool backgroundThread=false)
Loads the resource, if it is not already.
Ogre::UnifiedHighLevelGpuProgram::unload
void unload(void)
Unloads the resource; this is not permanent, the resource can be reloaded later if required.
Ogre::UnifiedHighLevelGpuProgram::clearDelegatePrograms
void clearDelegatePrograms()
Remove all delegate programs.
Ogre::UnifiedHighLevelGpuProgram::isMorphAnimationIncluded
bool isMorphAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform morph animation.
Ogre::UnifiedHighLevelGpuProgram
Specialisation of HighLevelGpuProgram which just delegates its implementation to one other high level...
Definition: OgreUnifiedHighLevelGpuProgram.h:61
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:515
Ogre::HighLevelGpuProgram
Abstract base class representing a high-level program (a vertex or fragment program).
Definition: OgreHighLevelGpuProgram.h:64
Ogre::UnifiedHighLevelGpuProgram::getLoadingState
LoadingState getLoadingState() const
Returns the current loading state.
Ogre::UnifiedHighLevelGpuProgram::getSize
size_t getSize(void) const
Retrieves info about the size of the resource.
Ogre::UnifiedHighLevelGpuProgram::isReloadable
bool isReloadable(void) const
Returns true if the Resource is reloadable, false otherwise.
Ogre::UnifiedHighLevelGpuProgram::createParameters
GpuProgramParametersSharedPtr createParameters(void)
Creates a new parameters object compatible with this program definition.

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