Project

General

Profile

SO3Engine
SO3Pass.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3PASS_H__
33#define __SO3PASS_H__
34
38
39namespace SO3
40{
41
42class _SO3_Export SPass : public SData
43{
44public:
46 {
47 SO3_POLYGONMODE_POINTS = 1,
48 SO3_POLYGONMODE_WIREFRAME = 2,
49 SO3_POLYGONMODE_SOLID = 3
50 };
83protected:
84 Ogre::Pass* ogrePass;
88private:
89
90public:
93 SPass(STechnique* technique, Ogre::Pass* ogrePassRef);
94
97 ~SPass();
98
101 static std::string GetTextureUnitTypedName(Ogre::TextureUnitState* unit);
102
105 static SShaderGenerator::ShaderMapType GetTextureUnitType(Ogre::TextureUnitState* unit);
106
109 STechnique* GetTechnique();
110
113 Ogre::Pass* GetOgrePassPointer();
114
117 int GetNumTextureUnitStates();
118
121 std::string GetTextureUnitName(const unsigned int& textureUnit);
122
125 int GetTextureUnitIndexByName(const std::string& texname);
126
129 std::string GetTextureName(const unsigned int& textureUnit);
130
133 std::string GetTextureFileName(const unsigned int& textureUnit);
134
138 void SetTextureUScroll(const unsigned int& textureUnit, const float& value);
139
142 float GetTextureUScroll(const unsigned int& textureUnit);
143
147 void SetTextureVScroll(const unsigned int& textureUnit, const float& value);
148
151 float GetTextureVScroll(const unsigned int& textureUnit);
152
156 void SetTextureUScale(const unsigned int& textureUnit, const float& value);
157
160 float GetTextureUScale(const unsigned int& textureUnit);
161
165 void SetTextureVScale(const unsigned int& textureUnit, const float& value);
166
169 float GetTextureVScale(const unsigned int& textureUnit);
170
174 void SetTextureRotate(const unsigned int& textureUnit, const float& radianAngle);
175
178 const float GetTextureRotate(const unsigned int& textureUnit);
179
183 void SetTextureScrollAnimation(const unsigned int& textureUnit, const float& uSpeed, const float& vSpeed);
184
188 void SetTextureRotateAnimation(const unsigned int& textureUnit, const float& speed);
189
192 bool GetLightingEnabled();
193
196 void SetLightingEnabled(const bool& state);
197
200 void SetAmbientColor(const int& color);
201 void SetAmbientColor(Ogre::ColourValue color);
202
205 int GetAmbientColor();
206
209 void SetDiffuseColor(const int& color);
210 void SetDiffuseColor(Ogre::ColourValue color);
211
214 int GetDiffuseColor();
215
218 void SetSpecularColor(const int& color);
219 void SetSpecularColor(Ogre::ColourValue color);
220
223 int GetSpecularColor();
224
227 void SetSelfIlluminationColor(const int& color);
228 void SetSelfIlluminationColor(Ogre::ColourValue color);
229
232 int GetSelfIlluminationColor();
233
236 void SetShininess(const float& value);
237
240 float GetShininess();
241
244 void SetUseVertexColor(bool state);
245
248 bool GetUseVertexColor();
249
252 void SetTexture(const unsigned int& textureUnit, STexture* texture, std::string name = "");
253
256 STexture* GetTexture(const unsigned int& textureUnit);
257
260 int GetTextureUnitByType(SShaderGenerator::ShaderMapType type);
261
264 const Ogre::GpuNamedConstants GetVertexProgramParameters();
265
268 void SetVertexProgramAutoParameter(const std::string& paramName, const Ogre::GpuProgramParameters::AutoConstantType& paramType, const size_t& paramExtraInfos);
269
272 void SetVertexProgramParameter(const std::string& paramName, const std::string& value);
273
276 const Ogre::GpuNamedConstants GetFragmentProgramParameters();
277
280 void SetFragmentProgramAutoParameter(const std::string& paramName, const Ogre::GpuProgramParameters::AutoConstantType& paramType, const size_t& paramExtraInfos);
281
284 void SetFragmentProgramParameter(const std::string& paramName, const std::string& value);
285
288 SceneBlendFactor GetSourceBlendFactor() const;
289
292 SceneBlendFactor GetDestBlendFactor() const;
293
296 SceneBlendFactor GetSourceBlendFactorAlpha() const;
297
300 SceneBlendFactor GetDestBlendFactorAlpha() const;
301
304 void SetSceneBlending(const SPass::SceneBlendFactor sourceFactor, const SPass::SceneBlendFactor destFactor);
305
308 void SetSceneBlending(const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha);
309
312 SceneBlendOperation GetSceneBlendingOperation() const;
313
316 SceneBlendOperation GetSceneBlendingOperationAlpha() const;
317
320 void SetSceneBlendingOperation(SceneBlendOperation op, SceneBlendOperation alphaOp);
321
325 void SetDepthCheckEnabled(bool enabled);
326
330 bool GetDepthCheckEnabled() const;
331
335 void SetDepthWriteEnabled(bool enabled);
336
340 bool GetDepthWriteEnabled() const;
341
345 void SetDepthFunction(CompareFunction func);
346
350 CompareFunction GetDepthFunction() const;
351
355 void SetAlphaRejection(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled=false);
356
360 CompareFunction GetAlphaRejectionFunction() const;
361
365 unsigned char GetAlphaRejectionValue() const;
366
370 bool GetAlphaToCoverage() const;
371
375 void SetColourWriteEnabled(bool state);
376
380 bool GetColourWriteEnabled() const;
381
385 void SetCullingMode(const bool state);
386
390 bool GetCullingMode() const;
391
395 void SetPointSize(Ogre::Real size);
396
399 float GetPointSize();
400
404 bool IsPointCloud();
405
409 void SetPolygonMode(PolygonMode mode);
410
414 PolygonMode GetPolygonMode();
415
418 bool IsShaderGenerated();
419
422 void CleanGeneratedShader();
423
426 void BuildShader(bool force = false);
427
430 void SetTextureUnitColorBlendModeFactor(const unsigned int& textureUnit, float factor);
431
434 float GetTextureUnitColorBlendModeFactor(const unsigned int& textureUnit);
435
438 void RemoveTexture(const unsigned int& textureUnit);
439
442 void SetTextureByType(STexture* tex, SShaderGenerator::ShaderMapType type);
443
446 std::string GetTextureUnitNameByType(SShaderGenerator::ShaderMapType type);
447
450 void UpdateGeneratedPass(bool full = false);
451
454 void OrderTexturesUnitsByType();
455
456protected:
457private:
461 SPass();
462
465 Ogre::TextureUnitState* GetTextureUnitState(const unsigned int& textureUnit);
466
467};
468
469}
470
471#endif
librairies include
bool mGeneratedShader
Definition SO3Pass.h:86
CompareFunction
Definition SO3Pass.h:73
@ SO3_COMPARE_FUNCTION_ALWAYS_PASS
Definition SO3Pass.h:75
@ SO3_COMPARE_FUNCTION_GREATER_EQUAL
Definition SO3Pass.h:80
@ SO3_COMPARE_FUNCTION_ALWAYS_FAIL
Definition SO3Pass.h:74
@ SO3_COMPARE_FUNCTION_LESS_EQUAL
Definition SO3Pass.h:77
@ SO3_COMPARE_FUNCTION_EQUAL
Definition SO3Pass.h:78
@ SO3_COMPARE_FUNCTION_LESS
Definition SO3Pass.h:76
@ SO3_COMPARE_FUNCTION_NOT_EQUAL
Definition SO3Pass.h:79
float mPointSize
Definition SO3Pass.h:87
SceneBlendOperation
Definition SO3Pass.h:52
@ SO3_SCENE_BLEND_OPERATION_REVERSE_SUBTRACT
Definition SO3Pass.h:55
@ SO3_SCENE_BLEND_OPERATION_ADD
Definition SO3Pass.h:53
@ SO3_SCENE_BLEND_OPERATION_SUBTRACT
Definition SO3Pass.h:54
@ SO3_SCENE_BLEND_OPERATION_MIN
Definition SO3Pass.h:56
STechnique * parentTechnique
Definition SO3Pass.h:85
Ogre::Pass * ogrePass
Definition SO3Pass.h:84
SceneBlendFactor
Definition SO3Pass.h:60
@ SO3_SCENE_BLEND_FACTOR_ONE
Definition SO3Pass.h:61
@ SO3_SCENE_BLEND_FACTOR_DEST_ALPHA
Definition SO3Pass.h:67
@ SO3_SCENE_BLEND_FACTOR_SOURCE_COLOUR
Definition SO3Pass.h:64
@ SO3_SCENE_BLEND_FACTOR_DEST_COLOUR
Definition SO3Pass.h:63
@ SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_ALPHA
Definition SO3Pass.h:69
@ SO3_SCENE_BLEND_FACTOR_ONE_MINUS_SOURCE_COLOUR
Definition SO3Pass.h:66
@ SO3_SCENE_BLEND_FACTOR_SOURCE_ALPHA
Definition SO3Pass.h:68
@ SO3_SCENE_BLEND_FACTOR_ONE_MINUS_DEST_COLOUR
Definition SO3Pass.h:65
@ SO3_SCENE_BLEND_FACTOR_ZERO
Definition SO3Pass.h:62