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
@@ -49,10 +49,10 @@ class _OgreRTSSExport ProgramManager : public Singleton<ProgramManager>, public
|
|
49
49
|
public:
|
50
50
|
|
51
51
|
/** Class default constructor */
|
52
|
-
ProgramManager
|
52
|
+
ProgramManager();
|
53
53
|
|
54
54
|
/** Class destructor */
|
55
|
-
~ProgramManager
|
55
|
+
~ProgramManager();
|
56
56
|
|
57
57
|
|
58
58
|
/** Override standard Singleton retrieval.
|
@@ -70,7 +70,7 @@ public:
|
|
70
70
|
but the implementation stays in this single compilation unit,
|
71
71
|
preventing link errors.
|
72
72
|
*/
|
73
|
-
static ProgramManager&
|
73
|
+
static ProgramManager& getSingleton();
|
74
74
|
|
75
75
|
/** Override standard Singleton retrieval.
|
76
76
|
@remarks
|
@@ -87,23 +87,23 @@ public:
|
|
87
87
|
but the implementation stays in this single compilation unit,
|
88
88
|
preventing link errors.
|
89
89
|
*/
|
90
|
-
static ProgramManager*
|
90
|
+
static ProgramManager* getSingletonPtr();
|
91
91
|
|
92
92
|
/** Acquire CPU/GPU programs set associated with the given render state and bind them to the pass.
|
93
93
|
@param pass The pass to bind the programs to.
|
94
94
|
@param renderState The render state that describes the program that need to be generated.
|
95
95
|
*/
|
96
|
-
void
|
96
|
+
void acquirePrograms(Pass* pass, TargetRenderState* renderState);
|
97
97
|
|
98
98
|
/** Release CPU/GPU programs set associated with the given render state and pass.
|
99
99
|
@param pass The pass to release the programs from.
|
100
100
|
@param renderState The render state holds the programs.
|
101
101
|
*/
|
102
|
-
void
|
102
|
+
void releasePrograms(Pass* pass, TargetRenderState* renderState);
|
103
103
|
|
104
104
|
/** Flush the local GPU programs cache.
|
105
105
|
*/
|
106
|
-
void
|
106
|
+
void flushGpuProgramsCache();
|
107
107
|
|
108
108
|
protected:
|
109
109
|
|
@@ -128,34 +128,34 @@ protected:
|
|
128
128
|
|
129
129
|
protected:
|
130
130
|
/** Create default program processors. */
|
131
|
-
void
|
131
|
+
void createDefaultProgramProcessors();
|
132
132
|
|
133
133
|
/** Destroy default program processors. */
|
134
|
-
void
|
134
|
+
void destroyDefaultProgramProcessors();
|
135
135
|
|
136
136
|
/** Create default program processors. */
|
137
|
-
void
|
137
|
+
void createDefaultProgramWriterFactories();
|
138
138
|
|
139
139
|
/** Destroy default program processors. */
|
140
|
-
void
|
140
|
+
void destroyDefaultProgramWriterFactories();
|
141
141
|
|
142
142
|
/** Destroy all program writers. */
|
143
|
-
void
|
143
|
+
void destroyProgramWriters();
|
144
144
|
|
145
145
|
/** Create CPU program .
|
146
146
|
@param type The type of the program to create.
|
147
147
|
*/
|
148
|
-
Program*
|
148
|
+
Program* createCpuProgram(GpuProgramType type);
|
149
149
|
|
150
150
|
/** Destroy a CPU program by name.
|
151
151
|
@param shaderProgram The CPU program instance to destroy.
|
152
152
|
*/
|
153
|
-
void
|
153
|
+
void destroyCpuProgram(Program* shaderProgram);
|
154
154
|
|
155
155
|
/** Create GPU programs for the given program set based on the CPU programs it contains.
|
156
156
|
@param programSet The program set container.
|
157
157
|
*/
|
158
|
-
bool
|
158
|
+
bool createGpuPrograms(ProgramSet* programSet);
|
159
159
|
|
160
160
|
/** Create GPU program based on the give CPU program.
|
161
161
|
@param shaderProgram The CPU program instance.
|
@@ -165,7 +165,7 @@ protected:
|
|
165
165
|
@param profiles The profiles string for program compilation as string list.
|
166
166
|
@param cachePath The output path to write the program into.
|
167
167
|
*/
|
168
|
-
GpuProgramPtr
|
168
|
+
GpuProgramPtr createGpuProgram(Program* shaderProgram,
|
169
169
|
ProgramWriter* programWriter,
|
170
170
|
const String& language,
|
171
171
|
const String& profiles,
|
@@ -176,49 +176,56 @@ protected:
|
|
176
176
|
Add program processor instance to this manager.
|
177
177
|
@param processor The instance to add.
|
178
178
|
*/
|
179
|
-
void
|
179
|
+
void addProgramProcessor(ProgramProcessor* processor);
|
180
180
|
|
181
181
|
/**
|
182
182
|
Remove program processor instance from this manager.
|
183
183
|
@param processor The instance to remove.
|
184
184
|
*/
|
185
|
-
void
|
185
|
+
void removeProgramProcessor(ProgramProcessor* processor);
|
186
186
|
|
187
187
|
/** Destroy a GPU program by name.
|
188
188
|
@param name The name of the program to destroy.
|
189
189
|
@param type The type of the program to destroy.
|
190
190
|
*/
|
191
|
-
void
|
191
|
+
void destroyGpuProgram(GpuProgramPtr& gpuProgram);
|
192
192
|
|
193
193
|
/** Flush the local GPU programs cache.
|
194
194
|
@param gpuProgramsMap The GPU programs cache.
|
195
195
|
*/
|
196
|
-
void
|
196
|
+
void flushGpuProgramsCache(GpuProgramsMap& gpuProgramsMap);
|
197
197
|
|
198
198
|
/** Return the number of created vertex shaders. */
|
199
|
-
size_t
|
199
|
+
size_t getVertexShaderCount() const { return mVertexShaderMap.size(); }
|
200
200
|
|
201
201
|
/** Return the number of created fragment shaders. */
|
202
|
-
size_t
|
202
|
+
size_t getFragmentShaderCount() const { return mFragmentShaderMap.size(); }
|
203
203
|
|
204
204
|
/** Fix the input of the pixel shader to be the same as the output of the vertex shader */
|
205
|
-
void
|
205
|
+
void synchronizePixelnToBeVertexOut(ProgramSet* programSet);
|
206
206
|
|
207
207
|
/** Bind the uniform parameters of a given CPU and GPU program set. */
|
208
|
-
void
|
208
|
+
void bindUniformParameters(Program* pCpuProgram, const GpuProgramParametersSharedPtr& passParams);
|
209
209
|
|
210
210
|
|
211
211
|
protected:
|
212
212
|
|
213
213
|
|
214
214
|
protected:
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
215
|
+
// CPU programs list.
|
216
|
+
ProgramList mCpuProgramsList;
|
217
|
+
// Map between target language and shader program writer.
|
218
|
+
ProgramWriterMap mProgramWritersMap;
|
219
|
+
// Map between target language and shader program processor.
|
220
|
+
ProgramProcessorMap mProgramProcessorsMap;
|
221
|
+
// Holds standard shader writer factories
|
222
|
+
ProgramWriterFactoryList mProgramWriterFactories;
|
223
|
+
// The generated vertex shaders.
|
224
|
+
GpuProgramsMap mVertexShaderMap;
|
225
|
+
// The generated fragment shaders.
|
226
|
+
GpuProgramsMap mFragmentShaderMap;
|
227
|
+
// The default program processors.
|
228
|
+
ProgramProcessorList mDefaultProgramProcessors;
|
222
229
|
|
223
230
|
private:
|
224
231
|
friend class ProgramSet;
|
@@ -55,26 +55,26 @@ public:
|
|
55
55
|
/** Class constructor.
|
56
56
|
@param type The type of this program.
|
57
57
|
*/
|
58
|
-
ProgramProcessor
|
58
|
+
ProgramProcessor();
|
59
59
|
|
60
60
|
/** Class destructor */
|
61
|
-
virtual ~ProgramProcessor
|
61
|
+
virtual ~ProgramProcessor();
|
62
62
|
|
63
63
|
/** Return the target language of this processor. */
|
64
|
-
virtual const String&
|
64
|
+
virtual const String& getTargetLanguage() const = 0;
|
65
65
|
|
66
66
|
/** Called before creation of the GPU programs.
|
67
67
|
Do several preparation operation such as validation, register compaction and specific target language optimizations.
|
68
68
|
@param programSet The program set container.
|
69
69
|
Return true on success.
|
70
70
|
*/
|
71
|
-
virtual bool
|
71
|
+
virtual bool preCreateGpuPrograms(ProgramSet* programSet) = 0;
|
72
72
|
|
73
73
|
/** Called after creation of the GPU programs.
|
74
74
|
@param programSet The program set container.
|
75
75
|
Return true on success.
|
76
76
|
*/
|
77
|
-
virtual bool
|
77
|
+
virtual bool postCreateGpuPrograms(ProgramSet* programSet) = 0;
|
78
78
|
|
79
79
|
// Protected types.
|
80
80
|
protected:
|
@@ -90,42 +90,48 @@ protected:
|
|
90
90
|
|
91
91
|
|
92
92
|
/** Clear the state of this merge parameter. */
|
93
|
-
void
|
93
|
+
void clear();
|
94
94
|
|
95
95
|
/** Add source parameter to this merged */
|
96
|
-
void
|
96
|
+
void addSourceParameter(ParameterPtr srcParam, int mask);
|
97
97
|
|
98
98
|
/** Return the source parameter count. */
|
99
|
-
size_t
|
99
|
+
size_t getSourceParameterCount() const { return mSrcParameterCount; }
|
100
100
|
|
101
101
|
/** Return source parameter by index. */
|
102
|
-
ParameterPtr
|
102
|
+
ParameterPtr getSourceParameter(unsigned int index) { return mSrcParameter[index]; }
|
103
103
|
|
104
104
|
/** Return source parameter mask by index. */
|
105
|
-
int
|
105
|
+
int getSourceParameterMask(unsigned int index) const { return mSrcParameterMask[index]; }
|
106
106
|
|
107
107
|
/** Return destination parameter mask by index. */
|
108
|
-
int
|
108
|
+
int getDestinationParameterMask(unsigned int index) const { return mDstParameterMask[index]; }
|
109
109
|
|
110
110
|
/** Return the number of used floats. */
|
111
|
-
int
|
111
|
+
int getUsedFloatCount();
|
112
112
|
|
113
113
|
/** Return the destination parameter. */
|
114
|
-
ParameterPtr
|
114
|
+
ParameterPtr getDestinationParameter(int usage, int index);
|
115
115
|
|
116
116
|
protected:
|
117
117
|
|
118
118
|
/** Creates the destination parameter by a given class and index. */
|
119
|
-
void
|
119
|
+
void createDestinationParameter(int usage, int index);
|
120
120
|
|
121
121
|
|
122
122
|
protected:
|
123
|
-
|
124
|
-
ParameterPtr
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
123
|
+
// Destination merged parameter.
|
124
|
+
ParameterPtr mDstParameter;
|
125
|
+
// Source parameters - 4 source at max 1,1,1,1 -> 4.
|
126
|
+
ParameterPtr mSrcParameter[4];
|
127
|
+
// Source parameters mask. OPM_ALL means all fields used, otherwise it is split source parameter.
|
128
|
+
int mSrcParameterMask[4];
|
129
|
+
// Destination parameters mask. OPM_ALL means all fields used, otherwise it is split source parameter.
|
130
|
+
int mDstParameterMask[4];
|
131
|
+
// The actual source parameters count.
|
132
|
+
size_t mSrcParameterCount;
|
133
|
+
// The number of used floats.
|
134
|
+
size_t mUsedFloatCount;
|
129
135
|
};
|
130
136
|
typedef vector<MergeParameter>::type MergeParameterList;
|
131
137
|
|
@@ -134,8 +140,10 @@ protected:
|
|
134
140
|
// A struct that defines merge parameters combination.
|
135
141
|
struct _OgreRTSSExport MergeCombination
|
136
142
|
{
|
137
|
-
|
138
|
-
|
143
|
+
// The count of each source type. I.E (1 FLOAT1, 0 FLOAT2, 1 FLOAT3, 0 FLOAT4).
|
144
|
+
size_t srcParamterTypeCount[4];
|
145
|
+
// Source parameters mask. OPM_ALL means all fields used, otherwise it is split source parameter.
|
146
|
+
int srcParameterMask[4];
|
139
147
|
|
140
148
|
MergeCombination(
|
141
149
|
int float1Count, int float1Mask,
|
@@ -164,48 +172,48 @@ protected:
|
|
164
172
|
protected:
|
165
173
|
|
166
174
|
/** Build parameter merging combinations. */
|
167
|
-
void
|
175
|
+
void buildMergeCombinations();
|
168
176
|
|
169
177
|
/** Compact the vertex shader output registers.
|
170
178
|
@param vsMain The vertex shader entry function.
|
171
179
|
@param fsMain The fragment shader entry function.
|
172
180
|
Return true on success.
|
173
181
|
*/
|
174
|
-
virtual bool
|
182
|
+
virtual bool compactVsOutputs(Function* vsMain, Function* fsMain);
|
175
183
|
|
176
184
|
/** Internal method that counts vertex shader texcoord output slots and output floats.
|
177
185
|
@param vsMain The vertex shader entry function.
|
178
186
|
@param outTexCoordSlots Will hold the number of used output texcoord slots.
|
179
187
|
@param outTexCoordFloats Will hold the total number of floats used by output texcoord slots.
|
180
188
|
*/
|
181
|
-
void
|
189
|
+
void countVsTexcoordOutputs(Function* vsMain, int& outTexCoordSlots, int& outTexCoordFloats);
|
182
190
|
|
183
191
|
/** Internal function that builds parameters table.
|
184
192
|
@param paramList The parameter list.
|
185
193
|
@param outParamsTable Will hold the texcoord params sorted by types in each row.
|
186
194
|
*/
|
187
|
-
void
|
195
|
+
void buildTexcoordTable(const ShaderParameterList& paramList, ShaderParameterList outParamsTable[4]);
|
188
196
|
|
189
197
|
|
190
198
|
/** Merge the parameters from the given table.
|
191
199
|
@param paramsTable Source parameters table.
|
192
200
|
@param mergedParams Will hold the merged parameters list.
|
193
201
|
*/
|
194
|
-
void
|
202
|
+
void mergeParameters(ShaderParameterList paramsTable[4], MergeParameterList& mergedParams, ShaderParameterList& splitParams);
|
195
203
|
|
196
204
|
|
197
205
|
/** Internal function that creates merged parameter using pre defined combinations.
|
198
206
|
@param paramsTable Source parameters table.
|
199
207
|
@param mergedParams The merged parameters list.
|
200
208
|
*/
|
201
|
-
void
|
209
|
+
void mergeParametersByPredefinedCombinations(ShaderParameterList paramsTable[4], MergeParameterList& mergedParams);
|
202
210
|
|
203
211
|
/** Internal function that creates merged parameter from given combination.
|
204
212
|
@param combination The merge combination to try.
|
205
213
|
@param paramsTable The params table sorted by types in each row.
|
206
214
|
@param mergedParameter Will hold the merged parameter.
|
207
215
|
*/
|
208
|
-
bool
|
216
|
+
bool mergeParametersByCombination(const MergeCombination& combination, ShaderParameterList paramsTable[4],
|
209
217
|
MergeParameter* mergedParameter);
|
210
218
|
|
211
219
|
/** Merge reminders parameters that could not be merged into one slot using the predefined combinations.
|
@@ -213,44 +221,47 @@ protected:
|
|
213
221
|
@param mergedParams The merged parameters list.
|
214
222
|
@param splitParams The split parameters list.
|
215
223
|
*/
|
216
|
-
void
|
224
|
+
void mergeParametersReminders(ShaderParameterList paramsTable[4], MergeParameterList& mergedParams, ShaderParameterList& splitParams);
|
217
225
|
|
218
226
|
|
219
227
|
/** Generates local parameters for the split parameters and perform packing/unpacking operation using them. */
|
220
|
-
void
|
228
|
+
void generateLocalSplitParameters(Function* func, GpuProgramType progType, MergeParameterList& mergedParams, ShaderParameterList& splitParams, LocalParameterMap& localParamsMap);
|
221
229
|
|
222
230
|
/** Rebuild the given parameters list using the merged parameters.
|
223
231
|
*/
|
224
|
-
void
|
232
|
+
void rebuildParameterList(Function* func, int paramsUsage, MergeParameterList& mergedParams);
|
225
233
|
|
226
234
|
/** Rebuild function invocations by replacing references to old source parameters with the matching merged parameters components. */
|
227
|
-
void
|
235
|
+
void rebuildFunctionInvocations(FunctionAtomInstanceList& funcAtomList, MergeParameterList& mergedParams, LocalParameterMap& localParamsMap);
|
228
236
|
|
229
237
|
/** Builds a map between parameter and all the references to it. */
|
230
|
-
void
|
238
|
+
void buildParameterReferenceMap(FunctionAtomInstanceList& funcAtomList, ParameterOperandMap& paramsRefMap);
|
231
239
|
|
232
240
|
/** Replace references to old parameters with the new merged parameters. */
|
233
|
-
void
|
241
|
+
void replaceParametersReferences(MergeParameterList& mergedParams, ParameterOperandMap& paramsRefMap);
|
234
242
|
|
235
243
|
/** Replace references to old parameters that have been split with the new local parameters that represents them. */
|
236
|
-
void
|
244
|
+
void replaceSplitParametersReferences(LocalParameterMap& localParamsMap, ParameterOperandMap& paramsRefMap);
|
237
245
|
|
238
246
|
/** Return number of floats needed by the given type. */
|
239
|
-
static int
|
247
|
+
static int getParameterFloatCount(GpuConstantType type);
|
240
248
|
|
241
249
|
/** Return the parameter mask of by the given parameter type (I.E: X|Y for FLOAT2 etc..) */
|
242
|
-
static int
|
250
|
+
static int getParameterMaskByType(GpuConstantType type);
|
243
251
|
|
244
252
|
/** Return the parameter mask of by the float count type (I.E: X|Y for 2 etc..) */
|
245
|
-
static int
|
253
|
+
static int getParameterMaskByFloatCount(int floatCount);
|
246
254
|
|
247
255
|
/** Bind the auto parameters for a given CPU and GPU program set. */
|
248
|
-
void
|
256
|
+
void bindAutoParameters(Program* pCpuProgram, GpuProgramPtr pGpuProgram);
|
249
257
|
|
250
258
|
protected:
|
251
|
-
|
252
|
-
|
253
|
-
|
259
|
+
// Merging combinations defs.
|
260
|
+
MergeCombinationList mParamMergeCombinations;
|
261
|
+
// Maximum texcoord slots.
|
262
|
+
int mMaxTexCoordSlots;
|
263
|
+
// Maximum texcoord floats count.
|
264
|
+
int mMaxTexCoordFloats;
|
254
265
|
std::map<Function *, String *> mFunctionMap; // Map between function signatures and source code
|
255
266
|
|
256
267
|
};
|
@@ -49,38 +49,42 @@ class _OgreRTSSExport ProgramSet : public RTShaderSystemAlloc
|
|
49
49
|
// Interface.
|
50
50
|
public:
|
51
51
|
/** Class default constructor */
|
52
|
-
ProgramSet
|
52
|
+
ProgramSet();
|
53
53
|
|
54
54
|
/** Class destructor */
|
55
|
-
~ProgramSet
|
55
|
+
~ProgramSet();
|
56
56
|
|
57
57
|
/** Get the vertex shader CPU program. */
|
58
|
-
Program*
|
58
|
+
Program* getCpuVertexProgram();
|
59
59
|
|
60
60
|
/** Get the fragment shader CPU program. */
|
61
|
-
Program*
|
61
|
+
Program* getCpuFragmentProgram();
|
62
62
|
|
63
63
|
/** Get the vertex shader GPU program. */
|
64
|
-
GpuProgramPtr
|
64
|
+
GpuProgramPtr getGpuVertexProgram();
|
65
65
|
|
66
66
|
/** Get the fragment shader GPU program. */
|
67
|
-
GpuProgramPtr
|
67
|
+
GpuProgramPtr getGpuFragmentProgram();
|
68
68
|
|
69
69
|
// Protected methods.
|
70
70
|
protected:
|
71
|
-
void
|
72
|
-
void
|
71
|
+
void setCpuVertexProgram(Program* vsCpuProgram);
|
72
|
+
void setCpuFragmentProgram(Program* psCpuProgram);
|
73
73
|
|
74
|
-
void
|
75
|
-
void
|
74
|
+
void setGpuVertexProgram(GpuProgramPtr vsGpuProgram);
|
75
|
+
void setGpuFragmentProgram(GpuProgramPtr psGpuProgram);
|
76
76
|
|
77
77
|
|
78
78
|
// Attributes.
|
79
79
|
protected:
|
80
|
-
|
81
|
-
Program*
|
82
|
-
|
83
|
-
|
80
|
+
// Vertex shader CPU program.
|
81
|
+
Program* mVSCpuProgram;
|
82
|
+
// Fragment shader CPU program.
|
83
|
+
Program* mPSCpuProgram;
|
84
|
+
// Vertex shader GPU program.
|
85
|
+
GpuProgramPtr mVSGpuProgram;
|
86
|
+
// Fragment shader CPU program.
|
87
|
+
GpuProgramPtr mPSGpuProgram;
|
84
88
|
|
85
89
|
private:
|
86
90
|
friend class ProgramManager;
|
@@ -59,7 +59,7 @@ class _OgreRTSSExport ProgramWriter : public RTShaderSystemAlloc
|
|
59
59
|
public:
|
60
60
|
|
61
61
|
/** Class destructor */
|
62
|
-
virtual ~ProgramWriter
|
62
|
+
virtual ~ProgramWriter() {}
|
63
63
|
|
64
64
|
|
65
65
|
/** Write the program shader source code.
|
@@ -67,35 +67,35 @@ public:
|
|
67
67
|
@param program The source CPU program for the GPU program code.
|
68
68
|
*/
|
69
69
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
70
|
-
virtual void
|
70
|
+
virtual void writeSourceCode(StringSerialiser& os, Program* program) = 0;
|
71
71
|
#else
|
72
|
-
virtual void
|
72
|
+
virtual void writeSourceCode(std::ostream& os, Program* program) = 0;
|
73
73
|
#endif
|
74
74
|
|
75
75
|
/** Return the target language of this writer. */
|
76
|
-
virtual const String&
|
76
|
+
virtual const String& getTargetLanguage() const = 0;
|
77
77
|
|
78
78
|
// Protected methods.
|
79
79
|
protected:
|
80
80
|
/** Write the program title. */
|
81
81
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
82
|
-
void
|
82
|
+
void writeProgramTitle(StringSerialiser& os, Program* program);
|
83
83
|
#else
|
84
|
-
void
|
84
|
+
void writeProgramTitle(std::ostream& os, Program* program);
|
85
85
|
#endif
|
86
86
|
|
87
87
|
/** Write the uniform parameters title. */
|
88
88
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
89
|
-
void
|
89
|
+
void writeUniformParametersTitle(StringSerialiser& os, Program* program);
|
90
90
|
#else
|
91
|
-
void
|
91
|
+
void writeUniformParametersTitle(std::ostream& os, Program* program);
|
92
92
|
#endif
|
93
93
|
|
94
94
|
/** Write a function title. */
|
95
95
|
#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
|
96
|
-
void
|
96
|
+
void writeFunctionTitle(StringSerialiser& os, Function* function);
|
97
97
|
#else
|
98
|
-
void
|
98
|
+
void writeFunctionTitle(std::ostream& os, Function* function);
|
99
99
|
#endif
|
100
100
|
};
|
101
101
|
|
@@ -60,20 +60,20 @@ public:
|
|
60
60
|
virtual ~RenderState();
|
61
61
|
|
62
62
|
/** Reset this render state */
|
63
|
-
void
|
63
|
+
void reset();
|
64
64
|
|
65
65
|
/** Add a template sub render state to this render state.
|
66
66
|
@param subRenderState The sub render state template to add.
|
67
67
|
*/
|
68
|
-
void
|
68
|
+
void addTemplateSubRenderState(SubRenderState* subRenderState);
|
69
69
|
|
70
70
|
/** Remove a template sub render state from this render state.
|
71
71
|
@param subRenderState The sub render state to remove.
|
72
72
|
*/
|
73
|
-
void
|
73
|
+
void removeTemplateSubRenderState(SubRenderState* subRenderState);
|
74
74
|
|
75
75
|
/** Get the list of the template sub render states composing this render state. */
|
76
|
-
const SubRenderStateList&
|
76
|
+
const SubRenderStateList& getTemplateSubRenderStateList() const { return mSubRenderStateList; }
|
77
77
|
|
78
78
|
/**
|
79
79
|
Set the light count per light type.
|
@@ -83,7 +83,7 @@ public:
|
|
83
83
|
lightCount[1] defines the directional light count.
|
84
84
|
lightCount[2] defines the spot light count.
|
85
85
|
*/
|
86
|
-
void
|
86
|
+
void setLightCount(const int lightCount[3]);
|
87
87
|
|
88
88
|
/**
|
89
89
|
Get the light count per light type.
|
@@ -93,7 +93,7 @@ public:
|
|
93
93
|
lightCount[1] defines the directional light count.
|
94
94
|
lightCount[2] defines the spot light count.
|
95
95
|
*/
|
96
|
-
void
|
96
|
+
void getLightCount(int lightCount[3]) const;
|
97
97
|
|
98
98
|
/**
|
99
99
|
Set the light count auto update state.
|
@@ -101,22 +101,25 @@ public:
|
|
101
101
|
If the value is true the light count will be updated from the owner shader generator scheme based on current scene lights.
|
102
102
|
The default is true.
|
103
103
|
*/
|
104
|
-
void
|
104
|
+
void setLightCountAutoUpdate(bool autoUpdate) { mLightCountAutoUpdate = autoUpdate; }
|
105
105
|
|
106
106
|
/**
|
107
107
|
Return true if this render state override the light count.
|
108
108
|
If light count is not overridden it will be updated from the shader generator based on current scene lights.
|
109
109
|
*/
|
110
|
-
bool
|
110
|
+
bool getLightCountAutoUpdate() const { return mLightCountAutoUpdate; }
|
111
111
|
|
112
112
|
|
113
113
|
|
114
114
|
|
115
115
|
// Attributes.
|
116
116
|
protected:
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
// The sub render states list.
|
118
|
+
SubRenderStateList mSubRenderStateList;
|
119
|
+
// The light count per light type definition.
|
120
|
+
int mLightCount[3];
|
121
|
+
// True if light count was explicitly set.
|
122
|
+
bool mLightCountAutoUpdate;
|
120
123
|
|
121
124
|
private:
|
122
125
|
friend class ProgramManager;
|
@@ -151,7 +154,7 @@ public:
|
|
151
154
|
@param srcPass The source pass that this render state is constructed from.
|
152
155
|
@param dstPass The destination pass that constructed from this render state.
|
153
156
|
*/
|
154
|
-
void
|
157
|
+
void link(const RenderState& other, Pass* srcPass, Pass* dstPass);
|
155
158
|
|
156
159
|
/** Update the GPU programs constant parameters before a renderable is rendered.
|
157
160
|
@param rend The renderable object that is going to be rendered.
|
@@ -159,48 +162,50 @@ public:
|
|
159
162
|
@param source The auto parameter auto source instance.
|
160
163
|
@param pLightList The light list used for the current rendering operation.
|
161
164
|
*/
|
162
|
-
void
|
165
|
+
void updateGpuProgramsParams(Renderable* rend, Pass* pass, const AutoParamDataSource* source, const LightList* pLightList);
|
163
166
|
|
164
167
|
// Protected methods
|
165
168
|
protected:
|
166
169
|
|
167
170
|
/** Sort the sub render states composing this render state. */
|
168
|
-
void
|
171
|
+
void sortSubRenderStates();
|
169
172
|
|
170
173
|
/** Comparison function of the sub render states. */
|
171
|
-
static int
|
174
|
+
static int sSubRenderStateCompare(const void * p0, const void *p1);
|
172
175
|
|
173
176
|
|
174
177
|
/** Create CPU programs that represent this render state.
|
175
178
|
*/
|
176
|
-
bool
|
179
|
+
bool createCpuPrograms();
|
177
180
|
|
178
181
|
/** Create the program set of this render state.
|
179
182
|
*/
|
180
|
-
ProgramSet*
|
183
|
+
ProgramSet* createProgramSet();
|
181
184
|
|
182
185
|
/* Destroy the program set of this render state. */
|
183
|
-
void
|
186
|
+
void destroyProgramSet();
|
184
187
|
|
185
188
|
/** Return the program set of this render state.
|
186
189
|
*/
|
187
|
-
ProgramSet*
|
190
|
+
ProgramSet* getProgramSet() { return mProgramSet; }
|
188
191
|
|
189
192
|
/** Add sub render state to this render state.
|
190
193
|
@param subRenderState The sub render state to add.
|
191
194
|
*/
|
192
|
-
void
|
195
|
+
void addSubRenderStateInstance(SubRenderState* subRenderState);
|
193
196
|
|
194
197
|
/** Remove sub render state from this render state.
|
195
198
|
@param subRenderState The sub render state to remove.
|
196
199
|
*/
|
197
|
-
void
|
200
|
+
void removeSubRenderStateInstance(SubRenderState* subRenderState);
|
198
201
|
|
199
202
|
|
200
203
|
// Attributes.
|
201
204
|
protected:
|
202
|
-
|
203
|
-
|
205
|
+
// Tells if the list of the sub render states is sorted.
|
206
|
+
bool mSubRenderStateSortValid;
|
207
|
+
// The program set of this RenderState.
|
208
|
+
ProgramSet* mProgramSet;
|
204
209
|
|
205
210
|
|
206
211
|
private:
|