OGRE  1.9
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-2014 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  virtual size_t calculateSize(void) const;
94 
99  void addDelegateProgram(const String& name);
100 
102  void clearDelegatePrograms();
103 
105  const HighLevelGpuProgramPtr& _getDelegate() const;
106 
108  const String& getLanguage(void) const;
109 
117  GpuProgramParametersSharedPtr createParameters(void);
119  GpuProgram* _getBindingDelegate(void);
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 
133  bool isVertexTextureFetchRequired(void) const;
134  GpuProgramParametersSharedPtr getDefaultParameters(void);
135  bool hasDefaultParameters(void) const;
136  bool getPassSurfaceAndLightStates(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;
147  LoadingState getLoadingState() 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);
153  void escalateLoading();
154  void addListener(Listener* lis);
155  void removeListener(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);
170  void destroy(HighLevelGpuProgram* prog);
171 
172  };
173 
177 }
178 #endif
#define _OgreExport
Definition: OgrePlatform.h:260
Command object for setting delegate (can set more than once)
LoadingState
Enum identifying the loading state of the resource.
Definition: OgreResource.h:127
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:514
Interface definition for factories of HighLevelGpuProgram.
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:41
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.