Plus/src/GLSL/include/OgreGLSLProgram.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 __GLSLProgram_H__
29 #define __GLSLProgram_H__
30 
33 
34 namespace Ogre {
57  {
58  public:
60  class CmdAttach : public ParamCommand
61  {
62  public:
63  String doGet(const void* target) const;
64  void doSet(void* target, const String& shaderNames);
65  };
66 
69  {
70  public:
71  String doGet(const void* target) const;
72  void doSet(void* target, const String& val);
73  };
76  {
77  public:
78  String doGet(const void* target) const;
79  void doSet(void* target, const String& val);
80  };
83  {
84  public:
85  String doGet(const void* target) const;
86  void doSet(void* target, const String& val);
87  };
90  {
91  public:
92  String doGet(const void* target) const;
93  void doSet(void* target, const String& val);
94  };
97  {
98  public:
99  String doGet(const void* target) const;
100  void doSet(void* target, const String& val);
101  };
106  { return mInputOperationType; }
110  { return mOutputOperationType; }
114  virtual int getMaxOutputVertices(void) const { return mMaxOutputVertices; }
115 
119  { mInputOperationType = operationType; }
123  { mOutputOperationType = operationType; }
127  virtual void setMaxOutputVertices(int maxOutputVertices)
128  { mMaxOutputVertices = maxOutputVertices; }
129 
130  GLSLProgram(ResourceManager* creator,
131  const String& name, ResourceHandle handle,
132  const String& group, bool isManual, ManualResourceLoader* loader);
133  ~GLSLProgram();
134 
135  GLuint getGLShaderHandle() const { return mGLShaderHandle; }
136  GLuint getGLProgramHandle() const { return mGLProgramHandle; }
137  void attachToProgramObject( const GLuint programObject );
138  void detachFromProgramObject( const GLuint programObject );
139  String getAttachedShaderNames() const { return mAttachedShaderNames; }
140 
142  bool getPassTransformStates(void) const;
143  bool getPassSurfaceAndLightStates(void) const;
144  bool getPassFogStates(void) const;
145 
147  void attachChildShader(const String& name);
148 
150  void setPreprocessorDefines(const String& defines) { mPreprocessorDefines = defines; }
152  const String& getPreprocessorDefines(void) const { return mPreprocessorDefines; }
153 
155  const String& getLanguage(void) const;
157  void setColumnMajorMatrices(bool columnMajor) { mColumnMajorMatrices = columnMajor; }
159  bool getColumnMajorMatrices(void) const { return mColumnMajorMatrices; }
160 
162  GpuProgramParametersSharedPtr createParameters(void);
163 
165  bool compile( const bool checkErrors = false);
166 
167  protected:
174 
177  void loadFromSource(void);
183  void createLowLevelImpl(void);
185  void unloadHighLevelImpl(void);
187  void unloadImpl(void);
188 
190  void populateParameterNames(GpuProgramParametersSharedPtr params);
192  void buildConstantDefinitions() const;
198  void checkAndFixInvalidDefaultPrecisionError( String &message );
199  private:
204  GLint mCompiled;
217  typedef GLSLProgramContainer::iterator GLSLProgramContainerIterator;
221  };
222 }
223 
224 #endif // __GLSLProgram_H__
Ogre::ResourceHandle
unsigned long long int ResourceHandle
Definition: OgreResource.h:41
Ogre::GLSLProgram::getColumnMajorMatrices
bool getColumnMajorMatrices(void) const
Gets whether matrix packed in column-major order.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:159
Ogre::GLSLProgram::CmdInputOperationType
Command object for setting the input operation type (geometry shader only)
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:75
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::GLSLProgram::mAttachedGLSLPrograms
GLSLProgramContainer mAttachedGLSLPrograms
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:218
Ogre::GLSLProgram::getMaxOutputVertices
virtual int getMaxOutputVertices(void) const
Returns the maximum number of vertices that this geometry program can output in a single run.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:114
OgreHighLevelGpuProgram.h
Ogre::GLSLProgram::CmdColumnMajorMatrices
Command object for setting matrix packing in column-major order.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:96
Ogre::GLSLProgram::setPreprocessorDefines
void setPreprocessorDefines(const String &defines)
Sets the preprocessor defines use to compile the program.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:150
Ogre::GLSLProgram::setOutputOperationType
virtual void setOutputOperationType(RenderOperation::OperationType operationType)
Set the operation type that this geometry program will emit.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:122
Ogre::GLSLProgram::msCmdColumnMajorMatrices
static CmdColumnMajorMatrices msCmdColumnMajorMatrices
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:170
Ogre::GLSLProgram::CmdMaxOutputVertices
Command object for setting the maximum output vertices (geometry shader only)
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:89
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::GLSLProgram::mInputOperationType
RenderOperation::OperationType mInputOperationType
The input operation type for this (geometry) program.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:206
Ogre::GLSLProgram::setColumnMajorMatrices
void setColumnMajorMatrices(bool columnMajor)
Sets whether matrix packing in column-major order.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:157
Ogre::GLSLProgram::GLSLProgramContainer
vector< GLSLProgram * >::type GLSLProgramContainer
Container of attached programs.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:216
Ogre::GLSLProgram::getPreprocessorDefines
const String & getPreprocessorDefines(void) const
Sets the preprocessor defines use to compile the program.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:152
Ogre::ParamCommand
Abstract class which is command object which gets/sets parameters.
Definition: OgreStringInterface.h:79
Ogre::GLSLProgram::mGLShaderHandle
GLuint mGLShaderHandle
GL handle for shader object.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:201
_OgreGL3PlusExport
#define _OgreGL3PlusExport
Definition: OgreGL3PlusPrerequisites.h:91
Ogre::GLSLProgram::getInputOperationType
virtual RenderOperation::OperationType getInputOperationType(void) const
Returns the operation type that this geometry program expects to receive as input.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:105
Ogre::GLSLProgram::msCmdPreprocessorDefines
static CmdPreprocessorDefines msCmdPreprocessorDefines
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:168
Ogre::GLSLProgram::setMaxOutputVertices
virtual void setMaxOutputVertices(int maxOutputVertices)
Set the maximum number of vertices that a single run of this geometry program can emit.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:127
Ogre::GLSLProgram::mCompiled
GLint mCompiled
Flag indicating if shader object successfully compiled.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:204
Ogre::GLSLProgram::getOutputOperationType
virtual RenderOperation::OperationType getOutputOperationType(void) const
Returns the operation type that this geometry program will emit.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:109
OgreGL3PlusPrerequisites.h
Ogre::ResourceManager
Defines a generic resource handler.
Definition: OgreResourceManager.h:122
Ogre::GLSLProgram::getAttachedShaderNames
String getAttachedShaderNames() const
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:139
Ogre::GLSLProgram::getGLShaderHandle
GLuint getGLShaderHandle() const
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:135
Ogre::GLSLProgram
Specialisation of HighLevelGpuProgram to provide support for OpenGL Shader Language (GLSL).
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:56
Ogre::GLSLProgram::CmdPreprocessorDefines
Command object for setting macro defines.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:68
Ogre::GLSLProgram::msCmdAttach
static CmdAttach msCmdAttach
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:169
Ogre::SharedPtr< GpuProgramParameters >
Ogre::GLSLProgram::CmdAttach
Command object for attaching another GLSL Program.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:60
Ogre::GLSLProgram::mPreprocessorDefines
String mPreprocessorDefines
Preprocessor options.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:214
Ogre::GLSLProgram::mColumnMajorMatrices
bool mColumnMajorMatrices
Matrix in column major pack format?
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:220
Ogre::GLSLProgram::GLSLProgramContainerIterator
GLSLProgramContainer::iterator GLSLProgramContainerIterator
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:217
Ogre::GLSLProgram::msMaxOutputVerticesCmd
static CmdMaxOutputVertices msMaxOutputVerticesCmd
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:173
Ogre::GLSLProgram::mMaxOutputVertices
int mMaxOutputVertices
The maximum amount of vertices that this (geometry) program can output.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:210
Ogre::GLSLProgram::getGLProgramHandle
GLuint getGLProgramHandle() const
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:136
Ogre::RenderOperation::OperationType
OperationType
The rendering operation type to perform.
Definition: OgreRenderOperation.h:48
Ogre::GLSLProgram::mOutputOperationType
RenderOperation::OperationType mOutputOperationType
The output operation type for this (geometry) program.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:208
Ogre::GLSLProgram::mGLProgramHandle
GLuint mGLProgramHandle
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:202
Ogre::GLSLProgram::msOutputOperationTypeCmd
static CmdOutputOperationType msOutputOperationTypeCmd
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:172
Ogre::GLSLProgram::setInputOperationType
virtual void setInputOperationType(RenderOperation::OperationType operationType)
Sets the operation type that this geometry program expects to receive.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:118
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::GLSLProgram::mAttachedShaderNames
String mAttachedShaderNames
Attached Shader names.
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:212
Ogre::ManualResourceLoader
Interface describing a manual resource loader.
Definition: OgreResource.h:514
Ogre::HighLevelGpuProgram
Abstract base class representing a high-level program (a vertex or fragment program).
Definition: OgreHighLevelGpuProgram.h:63
Ogre::GLSLProgram::CmdOutputOperationType
Command object for setting the output operation type (geometry shader only)
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:82
Ogre::GLSLProgram::msInputOperationTypeCmd
static CmdInputOperationType msInputOperationTypeCmd
Definition: Plus/src/GLSL/include/OgreGLSLProgram.h:171

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Apr 13 2021 08:53:15