ruby-ogre 0.0.3-x86-linux → 0.0.4-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -8
- data/bindings/ogre/interface/ogre_all.i +1 -0
- data/bindings/ogre/interface/ogre_wrap.cpp +591 -46
- data/bindings/ogre/interface/ogre_wrap.o +0 -0
- data/bindings/ogrebites/interface/ogrebites_wrap.o +0 -0
- data/bindings/procedural/interface/procedural_wrap.o +0 -0
- data/deps/include/OGRE/OgreAny.h +23 -1
- data/deps/include/OGRE/OgreBillboardChain.h +5 -1
- data/deps/include/OGRE/OgreBillboardParticleRenderer.h +2 -0
- data/deps/include/OGRE/OgreConfigDialog.h +0 -2
- data/deps/include/OGRE/OgreDynLib.h +1 -7
- data/deps/include/OGRE/OgreErrorDialog.h +0 -2
- data/deps/include/OGRE/OgreHeaderSuffix.h +3 -3
- data/deps/include/OGRE/OgreInstanceBatch.h +4 -0
- data/deps/include/OGRE/OgreInstanceManager.h +5 -0
- data/deps/include/OGRE/OgreIteratorRange.h +13 -2
- data/deps/include/OGRE/OgreParticleSystem.h +2 -0
- data/deps/include/OGRE/OgreParticleSystemRenderer.h +4 -0
- data/deps/include/OGRE/OgrePlatform.h +5 -28
- data/deps/include/OGRE/OgrePrerequisites.h +1 -1
- data/deps/include/OGRE/OgreProfiler.h +102 -59
- data/deps/include/OGRE/OgreProgressiveMesh.h +2 -2
- data/deps/include/OGRE/OgreRenderSystem.h +18 -1
- data/deps/include/OGRE/OgreRoot.h +1 -1
- data/deps/include/OGRE/OgreSearchOps.h +0 -5
- data/deps/include/OGRE/OgreSimpleRenderable.h +1 -1
- data/deps/include/OGRE/OgreStdHeaders.h +2 -2
- data/deps/include/OGRE/OgreStringConverter.h +5 -0
- data/deps/include/OGRE/OgreTimer.h +1 -1
- data/deps/include/OGRE/OgreUTFString.h +0 -2
- data/deps/include/OGRE/OgreWindowEventUtilities.h +3 -1
- data/deps/include/OGRE/OgreWorkQueue.h +2 -2
- data/deps/include/OGRE/RTShaderSystem/OgreShaderCGProgramProcessor.h +5 -5
- data/deps/include/OGRE/RTShaderSystem/OgreShaderCGProgramWriter.h +17 -15
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExDualQuaternionSkinning.h +3 -3
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExHardwareSkinning.h +5 -4
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExHardwareSkinningTechnique.h +3 -3
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExIntegratedPSSM3.h +50 -32
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExLayeredBlending.h +13 -9
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExLinearSkinning.h +7 -7
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExNormalMapLighting.h +149 -95
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExPerPixelLighting.h +91 -59
- data/deps/include/OGRE/RTShaderSystem/OgreShaderExTextureAtlasSampler.h +14 -9
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPColour.h +33 -24
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPFog.h +44 -30
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPLighting.h +70 -45
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPRenderStateBuilder.h +11 -10
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPTexturing.h +73 -64
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFFPTransform.h +8 -8
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFunction.h +42 -35
- data/deps/include/OGRE/RTShaderSystem/OgreShaderFunctionAtom.h +38 -32
- data/deps/include/OGRE/RTShaderSystem/OgreShaderGLSLESProgramProcessor.h +9 -8
- data/deps/include/OGRE/RTShaderSystem/OgreShaderGLSLESProgramWriter.h +45 -36
- data/deps/include/OGRE/RTShaderSystem/OgreShaderGLSLProgramProcessor.h +9 -8
- data/deps/include/OGRE/RTShaderSystem/OgreShaderGLSLProgramWriter.h +26 -20
- data/deps/include/OGRE/RTShaderSystem/OgreShaderGenerator.h +211 -160
- data/deps/include/OGRE/RTShaderSystem/OgreShaderHLSLProgramProcessor.h +5 -5
- data/deps/include/OGRE/RTShaderSystem/OgreShaderHLSLProgramWriter.h +17 -15
- data/deps/include/OGRE/RTShaderSystem/OgreShaderMaterialSerializerListener.h +5 -3
- data/deps/include/OGRE/RTShaderSystem/OgreShaderParameter.h +86 -73
- data/deps/include/OGRE/RTShaderSystem/OgreShaderProgram.h +36 -30
- data/deps/include/OGRE/RTShaderSystem/OgreShaderProgramManager.h +38 -31
- data/deps/include/OGRE/RTShaderSystem/OgreShaderProgramProcessor.h +54 -43
- data/deps/include/OGRE/RTShaderSystem/OgreShaderProgramSet.h +18 -14
- data/deps/include/OGRE/RTShaderSystem/OgreShaderProgramWriter.h +10 -10
- data/deps/include/OGRE/RTShaderSystem/OgreShaderRenderState.h +28 -23
- data/deps/include/OGRE/RTShaderSystem/OgreShaderScriptTranslator.h +2 -1
- data/deps/include/OGRE/RTShaderSystem/OgreShaderSubRenderState.h +35 -32
- data/deps/include/OGRE/RenderSystems/GL/GL/wglew.h +2 -2
- data/deps/include/OGRE/RenderSystems/GL/GL/wglext.h +2 -2
- data/deps/include/OGRE/RenderSystems/GL/OgreGLRenderSystem.h +10 -1
- data/deps/include/OGRE/RenderSystems/GL/OgreGLTextureManager.h +2 -0
- data/deps/include/OGRE/Sample.h +5 -0
- data/deps/include/OGRE/SampleContext.h +13 -3
- data/deps/lib/OGRE/Plugin_BSPSceneManager.so +0 -0
- data/deps/lib/OGRE/Plugin_BSPSceneManager.so.1.8.1 +0 -0
- data/deps/lib/OGRE/Plugin_CgProgramManager.so +0 -0
- data/deps/lib/OGRE/Plugin_CgProgramManager.so.1.8.1 +0 -0
- data/deps/lib/OGRE/Plugin_OctreeSceneManager.so +0 -0
- data/deps/lib/OGRE/Plugin_OctreeSceneManager.so.1.8.1 +0 -0
- data/deps/lib/OGRE/Plugin_OctreeZone.so +0 -0
- data/deps/lib/OGRE/Plugin_OctreeZone.so.1.8.1 +0 -0
- data/deps/lib/OGRE/Plugin_PCZSceneManager.so +0 -0
- data/deps/lib/OGRE/Plugin_PCZSceneManager.so.1.8.1 +0 -0
- data/deps/lib/OGRE/Plugin_ParticleFX.so +0 -0
- data/deps/lib/OGRE/Plugin_ParticleFX.so.1.8.1 +0 -0
- data/deps/lib/OGRE/RenderSystem_GL.so +0 -0
- data/deps/lib/OGRE/RenderSystem_GL.so.1.8.1 +0 -0
- data/deps/lib/libOgreMain.so +0 -0
- data/deps/lib/libOgreMain.so.1.8.1 +0 -0
- data/deps/lib/libOgrePaging.so +0 -0
- data/deps/lib/libOgrePaging.so.1.8.1 +0 -0
- data/deps/lib/libOgreProcedural.so +0 -0
- data/deps/lib/libOgreRTShaderSystem.so +0 -0
- data/deps/lib/libOgreRTShaderSystem.so.1.8.1 +0 -0
- data/deps/lib/libOgreTerrain.so +0 -0
- data/deps/lib/libOgreTerrain.so.1.8.1 +0 -0
- data/deps/share/OGRE/media/materials/programs/DiffuseOneTexture.glsles +17 -0
- data/deps/share/OGRE/media/packs/profiler.zip +0 -0
- data/lib/ogre.so +0 -0
- data/lib/ogrebites.so +0 -0
- data/lib/procedural.so +0 -0
- data/lib/version.rb +1 -1
- data/sample/charactor/sinbad.rb +8 -4
- metadata +16 -4
@@ -58,10 +58,10 @@ public:
|
|
58
58
|
};
|
59
59
|
|
60
60
|
/** Get the name of this function */
|
61
|
-
const String&
|
61
|
+
const String& getName() const { return mName; }
|
62
62
|
|
63
63
|
/** Get the description of this function */
|
64
|
-
const String&
|
64
|
+
const String& getDescription() const { return mDescription; }
|
65
65
|
|
66
66
|
/** Resolve input parameter of this function
|
67
67
|
@param semantic The desired parameter semantic.
|
@@ -71,7 +71,7 @@ public:
|
|
71
71
|
Return parameter instance in case of that resolve operation succeeded.
|
72
72
|
@remarks Pass -1 as index parameter to create a new parameter with the desired semantic and type.
|
73
73
|
*/
|
74
|
-
ParameterPtr
|
74
|
+
ParameterPtr resolveInputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type);
|
75
75
|
|
76
76
|
|
77
77
|
/** Resolve output parameter of this function
|
@@ -82,7 +82,7 @@ public:
|
|
82
82
|
Return parameter instance in case of that resolve operation succeeded.
|
83
83
|
@remarks Pass -1 as index parameter to create a new parameter with the desired semantic and type.
|
84
84
|
*/
|
85
|
-
ParameterPtr
|
85
|
+
ParameterPtr resolveOutputParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type);
|
86
86
|
|
87
87
|
/** Resolve local parameter of this function
|
88
88
|
@param semantic The desired parameter semantic.
|
@@ -91,7 +91,7 @@ public:
|
|
91
91
|
@param type The type of the desired parameter.
|
92
92
|
Return parameter instance in case of that resolve operation succeeded.
|
93
93
|
*/
|
94
|
-
ParameterPtr
|
94
|
+
ParameterPtr resolveLocalParameter(Parameter::Semantic semantic, int index, const String& name, GpuConstantType type);
|
95
95
|
|
96
96
|
/** Resolve local parameter of this function
|
97
97
|
@param semantic The desired parameter semantic.
|
@@ -100,7 +100,7 @@ public:
|
|
100
100
|
@param type The type of the desired parameter.
|
101
101
|
Return parameter instance in case of that resolve operation succeeded.
|
102
102
|
*/
|
103
|
-
ParameterPtr
|
103
|
+
ParameterPtr resolveLocalParameter(Parameter::Semantic semantic, int index, const Parameter::Content content, GpuConstantType type);
|
104
104
|
|
105
105
|
|
106
106
|
/**
|
@@ -109,7 +109,7 @@ public:
|
|
109
109
|
@param name The name of the parameter to search in the list.
|
110
110
|
@remarks Return NULL if no matching parameter found.
|
111
111
|
*/
|
112
|
-
static ParameterPtr
|
112
|
+
static ParameterPtr getParameterByName(const ShaderParameterList& parameterList, const String& name);
|
113
113
|
|
114
114
|
/**
|
115
115
|
Get parameter by a given semantic and index from the given parameter list.
|
@@ -118,7 +118,7 @@ public:
|
|
118
118
|
@param index The index of the parameter to search in the list.
|
119
119
|
@remarks Return NULL if no matching parameter found.
|
120
120
|
*/
|
121
|
-
static ParameterPtr
|
121
|
+
static ParameterPtr getParameterBySemantic(const ShaderParameterList& parameterList, const Parameter::Semantic semantic, int index);
|
122
122
|
|
123
123
|
|
124
124
|
/**
|
@@ -128,53 +128,53 @@ public:
|
|
128
128
|
@param type The type of the parameter to search in the list.
|
129
129
|
@remarks Return NULL if no matching parameter found.
|
130
130
|
*/
|
131
|
-
ParameterPtr
|
131
|
+
ParameterPtr getParameterByContent(const ShaderParameterList& parameterList, const Parameter::Content content, GpuConstantType type);
|
132
132
|
|
133
133
|
/** Return a list of input parameters. */
|
134
|
-
const ShaderParameterList&
|
134
|
+
const ShaderParameterList& getInputParameters() const { return mInputParameters; }
|
135
135
|
|
136
136
|
/** Return a list of output parameters. */
|
137
|
-
const ShaderParameterList&
|
137
|
+
const ShaderParameterList& getOutputParameters() const { return mOutputParameters; }
|
138
138
|
|
139
139
|
/** Return a list of local parameters. */
|
140
|
-
const ShaderParameterList&
|
140
|
+
const ShaderParameterList& getLocalParameters() const { return mLocalParameters; }
|
141
141
|
|
142
142
|
/** Add a function atom instance to this function.
|
143
143
|
@param atomInstance The atom instance to add.
|
144
144
|
*/
|
145
|
-
void
|
145
|
+
void addAtomInstance(FunctionAtom* atomInstance);
|
146
146
|
|
147
147
|
/** Delete a function atom instance from this function.
|
148
148
|
@param atomInstance The atom instance to OGRE_DELETE.
|
149
149
|
*/
|
150
|
-
bool
|
150
|
+
bool deleteAtomInstance(FunctionAtom* atomInstance);
|
151
151
|
|
152
152
|
/** Sort all atom instances of this function. */
|
153
|
-
void
|
153
|
+
void sortAtomInstances();
|
154
154
|
|
155
155
|
/** Return list of atom instances composing this function. */
|
156
|
-
FunctionAtomInstanceList&
|
156
|
+
FunctionAtomInstanceList& getAtomInstances() { return mAtomInstances; }
|
157
157
|
|
158
158
|
/** Return list of atom instances composing this function. (Const version) */
|
159
|
-
const FunctionAtomInstanceList&
|
159
|
+
const FunctionAtomInstanceList& getAtomInstances() const { return mAtomInstances; }
|
160
160
|
|
161
161
|
/** Add input parameter to this function. */
|
162
|
-
void
|
162
|
+
void addInputParameter(ParameterPtr parameter);
|
163
163
|
|
164
164
|
/** Add output parameter to this function. */
|
165
|
-
void
|
165
|
+
void addOutputParameter(ParameterPtr parameter);
|
166
166
|
|
167
167
|
/** Delete input parameter from this function. */
|
168
|
-
void
|
168
|
+
void deleteInputParameter(ParameterPtr parameter);
|
169
169
|
|
170
170
|
/** Delete output parameter from this function. */
|
171
|
-
void
|
171
|
+
void deleteOutputParameter(ParameterPtr parameter);
|
172
172
|
|
173
173
|
/** Delete all input parameters from this function. */
|
174
|
-
void
|
174
|
+
void deleteAllInputParameters();
|
175
175
|
|
176
176
|
/** Delete all output parameters from this function. */
|
177
|
-
void
|
177
|
+
void deleteAllOutputParameters();
|
178
178
|
|
179
179
|
/** get function type. */
|
180
180
|
FunctionType getFunctionType() const;
|
@@ -187,28 +187,35 @@ protected:
|
|
187
187
|
@param desc The description of this function.
|
188
188
|
@remarks This class is allocated via an instance of Program class.
|
189
189
|
*/
|
190
|
-
Function
|
190
|
+
Function(const String& name, const String& desc, const FunctionType functionType);
|
191
191
|
|
192
192
|
/** Class destructor */
|
193
|
-
~Function
|
193
|
+
~Function();
|
194
194
|
|
195
195
|
/** Add parameter to given list */
|
196
|
-
void
|
196
|
+
void addParameter(ShaderParameterList& parameterList, ParameterPtr parameter);
|
197
197
|
|
198
198
|
/** Delete parameter from a given list */
|
199
|
-
void
|
199
|
+
void deleteParameter(ShaderParameterList& parameterList, ParameterPtr parameter);
|
200
200
|
|
201
201
|
/** Function atom comparison function used to sort atoms. */
|
202
|
-
static int
|
202
|
+
static int sAtomInstanceCompare(const void * p0, const void *p1);
|
203
203
|
|
204
204
|
protected:
|
205
|
-
|
206
|
-
String
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
205
|
+
// Function name.
|
206
|
+
String mName;
|
207
|
+
// Function description.
|
208
|
+
String mDescription;
|
209
|
+
// Input parameters.
|
210
|
+
ShaderParameterList mInputParameters;
|
211
|
+
// Output parameters.
|
212
|
+
ShaderParameterList mOutputParameters;
|
213
|
+
// Local parameters.
|
214
|
+
ShaderParameterList mLocalParameters;
|
215
|
+
// Atom instances composing this function.
|
216
|
+
FunctionAtomInstanceList mAtomInstances;
|
217
|
+
// Function type
|
218
|
+
FunctionType mFunctionType;
|
212
219
|
|
213
220
|
private:
|
214
221
|
friend class Program;
|
@@ -50,27 +50,29 @@ class _OgreRTSSExport FunctionAtom : public RTShaderSystemAlloc
|
|
50
50
|
// Interface.
|
51
51
|
public:
|
52
52
|
/** Class default constructor. */
|
53
|
-
FunctionAtom
|
53
|
+
FunctionAtom();
|
54
54
|
|
55
55
|
/** Class default destructor. */
|
56
|
-
virtual ~FunctionAtom
|
56
|
+
virtual ~FunctionAtom() {}
|
57
57
|
|
58
58
|
/** Get the group execution order of this function atom. */
|
59
|
-
int
|
59
|
+
int getGroupExecutionOrder() const;
|
60
60
|
|
61
61
|
/** Get an internal execution order within a group of this function atom. */
|
62
|
-
int
|
62
|
+
int getInternalExecutionOrder() const;
|
63
63
|
|
64
64
|
/** Abstract method that writes a source code to the given output stream in the target shader language. */
|
65
|
-
virtual void
|
65
|
+
virtual void writeSourceCode(std::ostream& os, const String& targetLanguage) const = 0;
|
66
66
|
|
67
67
|
/** Return the type of this atom instance implementation. */
|
68
|
-
virtual const String&
|
68
|
+
virtual const String& getFunctionAtomType() = 0;
|
69
69
|
|
70
70
|
// Attributes.
|
71
71
|
protected:
|
72
|
-
|
73
|
-
int
|
72
|
+
// The owner group execution order.
|
73
|
+
int mGroupExecutionOrder;
|
74
|
+
// The execution order within the group.
|
75
|
+
int mInternalExecutionOrder;
|
74
76
|
};
|
75
77
|
|
76
78
|
/** A class that represents a function operand (its the combination of a parameter the in/out semantic and the used fields)
|
@@ -119,41 +121,45 @@ public:
|
|
119
121
|
~Operand();
|
120
122
|
|
121
123
|
/** Returns the parameter object as weak reference */
|
122
|
-
const ParameterPtr& getParameter
|
124
|
+
const ParameterPtr& getParameter() const { return mParameter; }
|
123
125
|
|
124
126
|
/** Returns true if not all fields used. (usage is described through semantic)*/
|
125
|
-
bool
|
127
|
+
bool hasFreeFields() const { return ((mMask & ~OPM_ALL) && ((mMask & ~OPM_X) || (mMask & ~OPM_Y) || (mMask & ~OPM_Z) || (mMask & ~OPM_W))); }
|
126
128
|
|
127
129
|
/** Returns the mask bitfield. */
|
128
|
-
int
|
130
|
+
int getMask() const { return mMask; }
|
129
131
|
|
130
132
|
/** Returns the operand semantic (do we read/write or both with the parameter). */
|
131
|
-
OpSemantic
|
133
|
+
OpSemantic getSemantic() const { return mSemantic; }
|
132
134
|
|
133
135
|
/** Returns the level of indirection.
|
134
136
|
The greater the indirection level the more the parameter needs to be nested in brackets.
|
135
137
|
For example given 4 parameters x1...x4 with the indirections levels 0,1,1,2
|
136
138
|
respectively. The parameters should form the following string: x1[x2][x3[x4]].
|
137
139
|
*/
|
138
|
-
ushort
|
140
|
+
ushort getIndirectionLevel() const { return mIndirectionLevel; }
|
139
141
|
|
140
142
|
/** Returns the parameter name and the usage mask like this 'color.xyz' */
|
141
|
-
String
|
143
|
+
String toString() const;
|
142
144
|
|
143
145
|
/** Returns the given mask as string representation. */
|
144
|
-
static String
|
146
|
+
static String getMaskAsString(int mask);
|
145
147
|
|
146
148
|
/** Return the float count of the given mask. */
|
147
|
-
static int
|
149
|
+
static int getFloatCount(int mask);
|
148
150
|
|
149
151
|
/** Return the gpu constant type of the given mask. */
|
150
|
-
static GpuConstantType
|
152
|
+
static GpuConstantType getGpuConstantType(int mask);
|
151
153
|
|
152
154
|
protected:
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
155
|
+
/// The parameter being carried by the operand
|
156
|
+
ParameterPtr mParameter;
|
157
|
+
/// Tells if the parameter is of type input,output or both
|
158
|
+
OpSemantic mSemantic;
|
159
|
+
/// Which part of the parameter should be passed (x,y,z,w)
|
160
|
+
int mMask;
|
161
|
+
/// The level of indirection. @see getIndirectionLevel
|
162
|
+
ushort mIndirectionLevel;
|
157
163
|
};
|
158
164
|
|
159
165
|
/** A class that represents function invocation code from shader based program function.
|
@@ -178,15 +184,15 @@ public:
|
|
178
184
|
/**
|
179
185
|
@see FunctionAtom::writeSourceCode
|
180
186
|
*/
|
181
|
-
virtual void
|
187
|
+
virtual void writeSourceCode(std::ostream& os, const String& targetLanguage) const;
|
182
188
|
|
183
189
|
/**
|
184
190
|
@see FunctionAtom::getFunctionAtomType
|
185
191
|
*/
|
186
|
-
virtual const String&
|
192
|
+
virtual const String& getFunctionAtomType() { return Type; }
|
187
193
|
|
188
194
|
/** Get a list of parameters this function invocation will use in the function call as arguments. */
|
189
|
-
OperandVector&
|
195
|
+
OperandVector& getOperandList() { return mOperands; }
|
190
196
|
|
191
197
|
/** Push a new operand (on the end) to the function.
|
192
198
|
@param parameter A function parameter.
|
@@ -194,13 +200,13 @@ public:
|
|
194
200
|
@param opMask The field mask of the parameter.
|
195
201
|
@param indirectionLevel The level of nesting inside brackets
|
196
202
|
*/
|
197
|
-
void
|
203
|
+
void pushOperand(ParameterPtr parameter, Operand::OpSemantic opSemantic, int opMask = Operand::OPM_ALL, int indirectionLevel = 0);
|
198
204
|
|
199
205
|
/** Return the function name */
|
200
|
-
const String&
|
206
|
+
const String& getFunctionName() const { return mFunctionName; }
|
201
207
|
|
202
208
|
/** Return the return type */
|
203
|
-
const String&
|
209
|
+
const String& getReturnType() const { return mReturnType; }
|
204
210
|
|
205
211
|
/** Determines if the current object is equal to the compared one. */
|
206
212
|
bool operator == ( const FunctionInvocation& rhs ) const;
|
@@ -216,7 +222,7 @@ public:
|
|
216
222
|
*/
|
217
223
|
struct FunctionInvocationLessThan
|
218
224
|
{
|
219
|
-
bool operator
|
225
|
+
bool operator()(FunctionInvocation const& lhs, FunctionInvocation const& rhs) const;
|
220
226
|
};
|
221
227
|
|
222
228
|
/** Comparator function to be used for comparisons.
|
@@ -224,7 +230,7 @@ public:
|
|
224
230
|
*/
|
225
231
|
struct FunctionInvocationCompare
|
226
232
|
{
|
227
|
-
bool operator
|
233
|
+
bool operator()(FunctionInvocation const& lhs, FunctionInvocation const& rhs) const;
|
228
234
|
};
|
229
235
|
|
230
236
|
/// The type of this class.
|
@@ -232,9 +238,9 @@ public:
|
|
232
238
|
|
233
239
|
// Attributes.
|
234
240
|
protected:
|
235
|
-
String
|
236
|
-
String
|
237
|
-
OperandVector
|
241
|
+
String mFunctionName;
|
242
|
+
String mReturnType;
|
243
|
+
OperandVector mOperands;
|
238
244
|
};
|
239
245
|
|
240
246
|
typedef vector<FunctionAtom*>::type FunctionAtomInstanceList;
|
@@ -52,33 +52,34 @@ public:
|
|
52
52
|
/** Class constructor.
|
53
53
|
@param type The type of this program.
|
54
54
|
*/
|
55
|
-
GLSLESProgramProcessor
|
55
|
+
GLSLESProgramProcessor();
|
56
56
|
|
57
57
|
/** Class destructor */
|
58
|
-
virtual ~GLSLESProgramProcessor
|
58
|
+
virtual ~GLSLESProgramProcessor();
|
59
59
|
|
60
60
|
/** Return the target language of this processor. */
|
61
|
-
virtual const String&
|
61
|
+
virtual const String& getTargetLanguage() const { return TargetLanguage; }
|
62
62
|
|
63
63
|
/**
|
64
64
|
@see ProgramProcessor::preCreateGpuPrograms
|
65
65
|
*/
|
66
|
-
virtual bool
|
66
|
+
virtual bool preCreateGpuPrograms(ProgramSet* programSet);
|
67
67
|
|
68
68
|
/**
|
69
69
|
@see ProgramProcessor::postCreateGpuPrograms
|
70
70
|
*/
|
71
|
-
virtual bool
|
71
|
+
virtual bool postCreateGpuPrograms(ProgramSet* programSet);
|
72
72
|
|
73
73
|
|
74
74
|
private:
|
75
75
|
|
76
76
|
/** Bind texture samplers. */
|
77
|
-
void
|
77
|
+
void bindTextureSamplers(Program* pCpuProgram, GpuProgramPtr pGpuProgram);
|
78
78
|
|
79
|
-
static String
|
79
|
+
static String TargetLanguage;
|
80
80
|
|
81
|
-
|
81
|
+
// The list of created library shaders.
|
82
|
+
StringVector mLibraryPrograms;
|
82
83
|
};
|
83
84
|
|
84
85
|
|
@@ -50,47 +50,47 @@ public:
|
|
50
50
|
/** Class constructor.
|
51
51
|
@param language The target shader language.
|
52
52
|
*/
|
53
|
-
GLSLESProgramWriter
|
53
|
+
GLSLESProgramWriter();
|
54
54
|
|
55
55
|
/** Class destructor */
|
56
|
-
virtual ~GLSLESProgramWriter
|
56
|
+
virtual ~GLSLESProgramWriter();
|
57
57
|
|
58
58
|
|
59
59
|
/**
|
60
60
|
@see ProgramWriter::writeSourceCode.
|
61
61
|
*/
|
62
62
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
63
|
-
virtual void
|
63
|
+
virtual void writeSourceCode(StringSerialiser& os, Program* program);
|
64
64
|
#else
|
65
|
-
virtual void
|
65
|
+
virtual void writeSourceCode(std::ostream& os, Program* program);
|
66
66
|
#endif
|
67
67
|
|
68
68
|
/**
|
69
69
|
@see ProgramWriter::getTargetLanguage.
|
70
70
|
*/
|
71
|
-
virtual const String&
|
71
|
+
virtual const String& getTargetLanguage() const { return TargetLanguage; }
|
72
72
|
|
73
73
|
static String TargetLanguage;
|
74
74
|
|
75
75
|
protected:
|
76
|
-
typedef
|
77
|
-
typedef
|
78
|
-
typedef
|
79
|
-
typedef
|
80
|
-
typedef
|
81
|
-
typedef
|
82
|
-
typedef
|
83
|
-
typedef
|
84
|
-
typedef
|
76
|
+
typedef std::map<GpuConstantType, const char*> GpuConstTypeToStringMap;
|
77
|
+
typedef std::map<Parameter::Semantic, const char*> ParamSemanticToStringMap;
|
78
|
+
typedef std::map<Parameter::Content, const char*> ParamContentToStringMap;
|
79
|
+
typedef std::map<String, String> StringMap;
|
80
|
+
typedef std::map<FunctionInvocation, String> FunctionMap;
|
81
|
+
typedef std::vector<FunctionInvocation> FunctionVector;
|
82
|
+
typedef FunctionMap::const_iterator FunctionMapIterator;
|
83
|
+
typedef FunctionVector::const_iterator FunctionVectorIterator;
|
84
|
+
typedef GpuConstTypeToStringMap::const_iterator GpuConstTypeToStringMapIterator;
|
85
85
|
|
86
86
|
// Protected methods.
|
87
87
|
protected:
|
88
88
|
|
89
89
|
/** Initialize string maps. */
|
90
|
-
void
|
90
|
+
void initializeStringMaps();
|
91
91
|
|
92
92
|
/** Cache functions of a dependency */
|
93
|
-
virtual void
|
93
|
+
virtual void cacheDependencyFunctions(const String & libName);
|
94
94
|
|
95
95
|
|
96
96
|
/** Create a FunctionInvocation object from a string taken out of a shader library. */
|
@@ -98,30 +98,30 @@ protected:
|
|
98
98
|
|
99
99
|
/** Write the program dependencies. */
|
100
100
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
101
|
-
void
|
101
|
+
void writeProgramDependencies(StringSerialiser& os, Program* program);
|
102
102
|
#else
|
103
|
-
void
|
103
|
+
void writeProgramDependencies(std::ostream& os, Program* program);
|
104
104
|
#endif
|
105
105
|
|
106
106
|
/** Write a local parameter. */
|
107
107
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
108
|
-
void
|
108
|
+
void writeLocalParameter(StringSerialiser& os, ParameterPtr parameter);
|
109
109
|
#else
|
110
|
-
void
|
110
|
+
void writeLocalParameter(std::ostream& os, ParameterPtr parameter);
|
111
111
|
#endif
|
112
112
|
|
113
113
|
/** Write the input params of the function */
|
114
114
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
115
|
-
void
|
115
|
+
void writeInputParameters(StringSerialiser& os, Function* function, GpuProgramType gpuType);
|
116
116
|
#else
|
117
|
-
void
|
117
|
+
void writeInputParameters(std::ostream& os, Function* function, GpuProgramType gpuType);
|
118
118
|
#endif
|
119
119
|
|
120
120
|
/** Write the output params of the function */
|
121
121
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
122
|
-
void
|
122
|
+
void writeOutParameters(StringSerialiser& os, Function* function, GpuProgramType gpuType);
|
123
123
|
#else
|
124
|
-
void
|
124
|
+
void writeOutParameters(std::ostream& os, Function* function, GpuProgramType gpuType);
|
125
125
|
#endif
|
126
126
|
|
127
127
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
@@ -133,23 +133,32 @@ protected:
|
|
133
133
|
String processOperand(Operand op, GpuProgramType gpuType);
|
134
134
|
|
135
135
|
/** Check if a string matches one of the GLSL ES basic types */
|
136
|
-
bool
|
136
|
+
bool isBasicType(String &type);
|
137
137
|
|
138
138
|
/** Search within a function body for non-builtin functions that a given function invocation depends on. */
|
139
|
-
void
|
139
|
+
void discoverFunctionDependencies(const FunctionInvocation &invoc, FunctionVector &depVector);
|
140
140
|
|
141
141
|
// Attributes.
|
142
142
|
protected:
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
143
|
+
// Map between GPU constant type to string value.
|
144
|
+
GpuConstTypeToStringMap mGpuConstTypeMap;
|
145
|
+
// Map between parameter semantic to string value.
|
146
|
+
ParamSemanticToStringMap mParamSemanticMap;
|
147
|
+
|
148
|
+
// Map parameter name to a new parameter name (sometimes renaming is required to match names between vertex and fragment shader)
|
149
|
+
StringMap mInputToGLStatesMap;
|
150
|
+
// Map function invocation to body. Used as a cache to reduce library file reads and for inlining
|
151
|
+
FunctionMap mFunctionCacheMap;
|
152
|
+
// Map of #defines and the function library that contains them
|
153
|
+
StringMap mDefinesMap;
|
154
|
+
// Map parameter content to vertex attributes
|
155
|
+
ParamContentToStringMap mContentToPerVertexAttributes;
|
156
|
+
// Holds the current glsl es version
|
157
|
+
int mGLSLVersion;
|
158
|
+
// Holds the fragment input params
|
159
|
+
StringVector mFragInputParams;
|
160
|
+
// Holds the cached function libraries
|
161
|
+
StringMap mCachedFunctionLibraries;
|
153
162
|
};
|
154
163
|
|
155
164
|
/** GLSL ES program writer factory implementation.
|
@@ -53,36 +53,37 @@ public:
|
|
53
53
|
/** Class constructor.
|
54
54
|
@param type The type of this program.
|
55
55
|
*/
|
56
|
-
GLSLProgramProcessor
|
56
|
+
GLSLProgramProcessor();
|
57
57
|
|
58
58
|
/** Class destructor */
|
59
|
-
virtual ~GLSLProgramProcessor
|
59
|
+
virtual ~GLSLProgramProcessor();
|
60
60
|
|
61
61
|
/** Return the target language of this processor. */
|
62
|
-
virtual const String&
|
62
|
+
virtual const String& getTargetLanguage() const { return TargetLanguage; }
|
63
63
|
|
64
64
|
/**
|
65
65
|
@see ProgramProcessor::preCreateGpuPrograms
|
66
66
|
*/
|
67
|
-
virtual bool
|
67
|
+
virtual bool preCreateGpuPrograms(ProgramSet* programSet);
|
68
68
|
|
69
69
|
/**
|
70
70
|
@see ProgramProcessor::postCreateGpuPrograms
|
71
71
|
*/
|
72
|
-
virtual bool
|
72
|
+
virtual bool postCreateGpuPrograms(ProgramSet* programSet);
|
73
73
|
|
74
74
|
|
75
75
|
private:
|
76
76
|
|
77
77
|
/** Bind texture samplers. */
|
78
|
-
void
|
78
|
+
void bindTextureSamplers(Program* pCpuProgram, GpuProgramPtr pGpuProgram);
|
79
79
|
|
80
80
|
/** Compiles sub shaders (only if the not exists) and attach them to the main gpu program. */
|
81
|
-
void
|
81
|
+
void bindSubShaders(Program* program, GpuProgramPtr pGpuProgram);
|
82
82
|
|
83
83
|
static String TargetLanguage;
|
84
84
|
|
85
|
-
|
85
|
+
// The list of created library shaders.
|
86
|
+
StringVector mLibraryPrograms;
|
86
87
|
|
87
88
|
};
|
88
89
|
|