OGRE  1.9.0
OgreUnifiedHighLevelGpuProgram.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __UnifiedHighLevelGpuProgram_H__
29#define __UnifiedHighLevelGpuProgram_H__
30
31#include "OgrePrerequisites.h"
34
35namespace Ogre {
36
61 {
62 public:
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
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
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;
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);
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
#define _OgreExport
Definition: OgrePlatform.h:260
Defines a program which runs on the GPU such as a vertex or fragment program.
Interface definition for factories of HighLevelGpuProgram.
Abstract base class representing a high-level program (a vertex or fragment program).
Interface describing a manual resource loader.
Definition: OgreResource.h:515
Abstract class which is command object which gets/sets parameters.
Defines a generic resource handler.
LoadingState
Enum identifying the loading state of the resource.
Definition: OgreResource.h:128
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.
void destroy(HighLevelGpuProgram *prog)
Command object for setting delegate (can set more than once)
String doGet(const void *target) const
void doSet(void *target, const String &val)
Specialisation of HighLevelGpuProgram which just delegates its implementation to one other high level...
void reload(void)
Reloads the resource, if it is already loaded.
GpuProgramParametersSharedPtr getDefaultParameters(void)
Get a reference to the default parameters which are to be used for all uses of this program.
bool hasCompileError(void) const
Did this program encounter a compile error when loading?
StringVector mDelegateNames
Ordered list of potential delegates.
void load(bool backgroundThread=false)
Loads the resource, if it is not already.
bool isBackgroundLoaded(void) const
Returns whether this Resource has been earmarked for background loading.
GpuProgram * _getBindingDelegate(void)
Returns the GpuProgram which should be bound to the pipeline.
bool isPoseAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform pose animation.
void unloadHighLevelImpl(void)
Internal unload implementation, must be implemented by subclasses.
void clearDelegatePrograms()
Remove all delegate programs.
void touch(void)
'Touches' the resource to indicate it has been used.
void addDelegateProgram(const String &name)
Adds a new delegate program to the list.
HighLevelGpuProgramPtr mChosenDelegate
The chosen delegate.
virtual size_t calculateSize(void) const
Calculate the size of a resource; this will only be called after 'load'.
void escalateLoading()
Escalates the loading of a background loaded resource.
bool hasDefaultParameters(void) const
Returns true if default parameters have been set up.
bool getPassTransformStates(void) const
Returns whether a vertex program wants transform state to be passed through fixed pipeline low level ...
bool isReloadable(void) const
Returns true if the Resource is reloadable, false otherwise.
void createLowLevelImpl(void)
Internal method for creating an appropriate low-level program from this high-level program,...
bool isLoading() const
Returns whether the resource is currently in the process of background loading.
void unload(void)
Unloads the resource; this is not permanent, the resource can be reloaded later if required.
LoadingState getLoadingState() const
Returns the current loading state.
const String & getLanguage(void) const
Returns a string that specifies the language of the gpu programs as specified in a material script.
void buildConstantDefinitions() const
Build the constant definition map, must be overridden.
bool isVertexTextureFetchRequired(void) const
Returns whether this vertex program requires support for vertex texture fetch from the hardware.
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.
bool isMorphAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform morph animation.
bool getPassFogStates(void) const
Returns whether a fragment program wants fog state to be passed through fixed pipeline low level API ...
bool isLoaded(void) const
Returns true if the Resource has been loaded, false otherwise.
const HighLevelGpuProgramPtr & _getDelegate() const
Get the chosen delegate.
size_t getSize(void) const
Retrieves info about the size of the resource.
bool isSkeletalAnimationIncluded(void) const
Returns whether a vertex program includes the required instructions to perform skeletal animation.
void setBackgroundLoaded(bool bl)
Tells the resource whether it is background loaded or not.
void loadFromSource(void)
Virtual method which must be implemented by subclasses, load from mSource.
bool isSupported(void) const
Returns whether this program can be supported on the current renderer and hardware.
void removeListener(Listener *lis)
Remove a listener on this resource.
GpuProgramParametersSharedPtr createParameters(void)
Creates a new parameters object compatible with this program definition.
void addListener(Listener *lis)
Register a listener on this resource.
void resetCompileError(void)
Reset a compile error if it occurred, allowing the load to be retried.
bool getPassSurfaceAndLightStates(void) const
Returns whether a vertex program wants light and material states to be passed through fixed pipeline ...
void chooseDelegate() const
Choose the delegate to use.
vector< String >::type StringVector
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
_StringBase String