OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
84  void buildConstantDefinitions() const;
85  void loadFromSource(void);
86 
87  public:
90  const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
92 
93 
98  void addDelegateProgram(const String& name);
99 
101  void clearDelegatePrograms();
102 
104  const HighLevelGpuProgramPtr& _getDelegate() const;
105 
107  const String& getLanguage(void) const;
108 
116  GpuProgramParametersSharedPtr createParameters(void);
118  GpuProgram* _getBindingDelegate(void);
119 
120  // All the following methods must delegate to the implementation
121 
123  bool isSupported(void) const;
124 
126  bool isSkeletalAnimationIncluded(void) const;
127 
128  bool isMorphAnimationIncluded(void) const;
129 
130  bool isPoseAnimationIncluded(void) const;
131 
132  bool isVertexTextureFetchRequired(void) const;
133  GpuProgramParametersSharedPtr getDefaultParameters(void);
134  bool hasDefaultParameters(void) const;
135  bool getPassSurfaceAndLightStates(void) const;
136  bool getPassFogStates(void) const;
137  bool getPassTransformStates(void) const;
138  bool hasCompileError(void) const;
139  void resetCompileError(void);
140 
141  void load(bool backgroundThread = false);
142  void reload(void);
143  bool isReloadable(void) const;
144  bool isLoaded(void) const;
145  bool isLoading() const;
146  LoadingState getLoadingState() const;
147  void unload(void);
148  size_t getSize(void) const;
149  void touch(void);
150  bool isBackgroundLoaded(void) const;
151  void setBackgroundLoaded(bool bl);
152  void escalateLoading();
153  void addListener(Listener* lis);
154  void removeListener(Listener* lis);
155 
156  };
157 
160  {
161  public:
165  const String& getLanguage(void) const;
167  const String& name, ResourceHandle handle,
168  const String& group, bool isManual, ManualResourceLoader* loader);
169  void destroy(HighLevelGpuProgram* prog);
170 
171  };
172 
176 }
177 #endif
#define _OgreExport
Definition: OgrePlatform.h:233
Command object for setting delegate (can set more than once)
LoadingState
Enum identifying the loading state of the resource.
Definition: OgreResource.h:126
HighLevelGpuProgram * create(ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual, ManualResourceLoader *loader)
const String & getLanguage(void) const
Get the name of the language this factory creates programs for.
Defines a program which runs on the GPU such as a vertex or fragment program.
Interface describing a manual resource loader.
Definition: OgreResource.h:513
Interface definition for factories of HighLevelGpuProgram.
Specialisation of SharedPtr to allow SharedPtr to be assigned to HighLevelGpuProgramPtr.
StringVector mDelegateNames
Ordered list of potential delegates.
Specialisation of HighLevelGpuProgram which just delegates its implementation to one other high level...
HighLevelGpuProgramPtr mChosenDelegate
The chosen delegate.
vector< String >::type StringVector
unsigned long long int ResourceHandle
Definition: OgreResource.h:40
Defines a generic resource handler.
_StringBase String
Abstract base class representing a high-level program (a vertex or fragment program).
void destroy(HighLevelGpuProgram *prog)
Abstract class which is command object which gets/sets parameters.