Changeset 1711 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Timestamp:
- 11/03/06 09:51:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreIlluminationManager.h
r1670 r1711 4 4 #include "OgreTechniqueGroup.h" 5 5 #include "OgreRenderable.h" 6 #include "OgreC ubeMapRenderTechnique.h"6 #include "OgreColorCubeMapRenderTechnique.h" 7 7 #include "OgreDistanceCubeMapRenderTechnique.h" 8 8 #include "OgreConvolvedCubeMapRenderTechnique.h" -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.h
r836 r1711 9 9 10 10 #include "ConvolvedCubeMapRenderTechnique.h" 11 #include "Ogre RenderTechnique.h"11 #include "OgreCubeMapRenderTechnique.h" 12 12 #include "Ogre.h" 13 13 … … 18 18 */ 19 19 class OgreConvolvedCubeMapRenderTechnique : public ConvolvedCubeMapRenderTechnique, 20 public OgreRenderTechnique20 public OgreCubeMapRenderTechnique 21 21 { 22 22 public: … … 43 43 unsigned int cubeMapResolution, 44 44 unsigned int reducedCubeMapResolution, 45 unsigned char reducedTexID,45 unsigned char texID, 46 46 bool useDistCalc, 47 47 bool useFaceAngleCalc, … … 49 49 float angleTolerance, 50 50 bool updateAllFace, 51 bool renderSelf, 51 52 Pass* pass, 52 53 OgreRenderable* parentRenderable, … … 62 63 63 64 protected: 64 /**65 @brief the id of the texture unit state the resulting cubemap should be bound to66 */67 unsigned char reducedTexID;68 65 69 66 //inherited … … 80 77 81 78 82 class OgreConvoledCubeMapRenderTechniqueFactory : public RenderTechniqueFactory79 class OgreConvoledCubeMapRenderTechniqueFactory : public OgreCubeMapRenderTechniqueFactory 83 80 { 84 81 public: … … 92 89 93 90 94 unsigned long startFrame;95 unsigned long cubeMapUpdateInterval;96 unsigned int cubeMapResolution;97 91 unsigned int reducedCubeMapResolution; 98 unsigned char texID;99 bool useDistCalc;100 bool useFaceAngleCalc;101 float distTolerance;102 float angleTolerance;103 bool updateAllFace;104 105 92 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreCubeMapRenderTechnique.h
r836 r1711 17 17 @brief CubeMapRenderTechnique used in an Ogre environment. 18 18 */ 19 class OgreCubeMapRenderTechnique : public CubeMapRenderTechnique,19 class OgreCubeMapRenderTechnique : virtual public CubeMapRenderTechnique, 20 20 public OgreRenderTechnique 21 21 { … … 47 47 float angleTolerance, 48 48 bool updateAllFace, 49 bool renderSelf, 49 50 Pass* pass, 50 51 OgreRenderable* parentRenderable, … … 55 56 */ 56 57 ~OgreCubeMapRenderTechnique(); 57 58 //inherited 59 void update(unsigned long frameNum); 60 58 61 59 protected: 62 60 … … 64 62 @brief the id of the texture unit state the resulting cubemap should be bound to 65 63 */ 66 unsigned char texID; 67 68 //inherited 69 void colorCubeMapRunChanged(RenderingRun* run); 70 //inherited 71 RenderingRun* createColorCubeMapRun(); 72 73 64 unsigned char texID; 74 65 }; 75 66 76 class OgreC olorCubeMapRenderTechniqueFactory : public RenderTechniqueFactory67 class OgreCubeMapRenderTechniqueFactory : public RenderTechniqueFactory 77 68 { 78 69 public: 79 70 80 OgreColorCubeMapRenderTechniqueFactory(); 81 82 OgreRenderTechnique* createInstance(IllumTechniqueParams* params, 83 Pass* pass, 84 OgreRenderable* parentRenderable, 85 OgreTechniqueGroup* parentTechniqueGroup); 86 87 71 OgreCubeMapRenderTechniqueFactory(); 72 88 73 unsigned long startFrame; 89 74 unsigned long cubeMapUpdateInterval; … … 95 80 float angleTolerance; 96 81 bool updateAllFace; 82 bool renderSelf; 83 84 void resetParams(); 97 85 98 86 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/RenderTechniques/OgreDistanceCubeMapRenderTechnique.h
r836 r1711 9 9 10 10 #include "DistanceCubeMapRenderTechnique.h" 11 #include "Ogre RenderTechnique.h"11 #include "OgreCubeMapRenderTechnique.h" 12 12 #include "Ogre.h" 13 13 … … 18 18 */ 19 19 class OgreDistanceCubeMapRenderTechnique : public DistanceCubeMapRenderTechnique, 20 public OgreRenderTechnique20 public OgreCubeMapRenderTechnique 21 21 { 22 22 public: … … 47 47 float angleTolerance, 48 48 bool updateAllFace, 49 bool renderSelf, 49 50 Pass* pass, 50 51 OgreRenderable* parentRenderable, … … 60 61 61 62 protected: 62 /** 63 @brief the id of the texture unit state the resulting cubemap should be bound to 64 */ 65 unsigned char texID; 66 63 67 64 //inherited 68 65 void distanceCubeMapRunChanged(RenderingRun* run); … … 76 73 77 74 78 class OgreDistanceCubeMapRenderTechniqueFactory : public RenderTechniqueFactory75 class OgreDistanceCubeMapRenderTechniqueFactory : public OgreCubeMapRenderTechniqueFactory 79 76 { 80 77 public: … … 85 82 Pass* pass, 86 83 OgreRenderable* parentRenderable, 87 OgreTechniqueGroup* parentTechniqueGroup); 88 89 90 unsigned long startFrame; 91 unsigned long cubeMapUpdateInterval; 92 unsigned int cubeMapResolution; 93 unsigned char texID; 94 bool useDistCalc; 95 bool useFaceAngleCalc; 96 float distTolerance; 97 float angleTolerance; 98 bool updateAllFace; 84 OgreTechniqueGroup* parentTechniqueGroup); 99 85 100 86 }; -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/scripts/OgreIllumModule.vcproj
r1681 r1711 42 42 Optimization="0" 43 43 AdditionalIncludeDirectories=""$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\include;..\include\RenderingRuns;..\include\RenderTechniques;..\..\IllumModule\include;..\..\IllumModule\include\RenderingRuns;..\..\IllumModule\include\RenderTechniques;"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include\"" 44 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE ;GTP_VISIBILITY_MODIFIED_OGRE"44 PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE" 45 45 MinimalRebuild="true" 46 46 BasicRuntimeChecks="3" … … 115 115 OmitFramePointers="true" 116 116 AdditionalIncludeDirectories=""$(OGRE_PATH)\Samples\Common\include";"$(OGRE_PATH)\OgreMain\include";..\include;..\include\RenderingRuns;..\include\RenderTechniques;..\..\IllumModule\include;..\..\IllumModule\include\RenderingRuns;..\..\IllumModule\include\RenderTechniques;"$(OGRE_PATH)\PlugIns\OctreeSceneManager\include\"" 117 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE ;GTP_VISIBILITY_MODIFIED_OGRE"117 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;GAMETOOLS_ILLUMINATION_MODULE" 118 118 StringPooling="true" 119 119 MinimalRebuild="true" … … 201 201 </File> 202 202 <File 203 RelativePath="..\src\RenderTechniques\OgreColorCubeMapRenderTechnique.cpp" 204 > 205 </File> 206 <File 203 207 RelativePath="..\src\RenderTechniques\OgreConvolvedCubeMapRenderTechnique.cpp" 204 208 > … … 327 331 </File> 328 332 <File 333 RelativePath="..\include\RenderTechniques\OgreColorCubeMapRenderTechnique.h" 334 > 335 </File> 336 <File 329 337 RelativePath="..\include\RenderTechniques\OgreConvolvedCubeMapRenderTechnique.h" 330 338 > -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.cpp
r874 r1711 8 8 unsigned int cubeMapResolution, 9 9 unsigned int reducedCubeMapResolution, 10 unsigned char reducedTexID,10 unsigned char texID, 11 11 bool useDistCalc, 12 12 bool useFaceAngleCalc, … … 14 14 float angleTolerance, 15 15 bool updateAllFace, 16 bool renderSelf, 16 17 Pass* pass, 17 18 OgreRenderable* parentRenderable, 18 19 OgreTechniqueGroup* parentTechniqueGroup) 19 :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 20 ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup), 20 : 21 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, pass, parentRenderable, parentTechniqueGroup), 22 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 23 ConvolvedCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, reducedCubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 21 24 RenderTechnique(parentRenderable, parentTechniqueGroup) 22 25 { 23 this->reducedTexID = reducedTexID;24 25 26 if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0) 26 27 sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun()); … … 49 50 String cubemapname = cuberun->getReducedCubeMapTextureName(); 50 51 51 pass->getTextureUnitState( reducedTexID)->setTextureName(cubemapname);52 pass->getTextureUnitState(texID)->setTextureName(cubemapname); 52 53 } 53 54 … … 94 95 namespace ConvolvedCubemapParsers 95 96 { 96 void parseStartFrame(String& params, RenderTechniqueFactory* factory)97 {98 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory;99 f->startFrame = StringConverter::parseUnsignedLong(params);100 }101 void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory)102 {103 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory;104 f->cubeMapUpdateInterval = StringConverter::parseUnsignedLong(params);105 }106 107 void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory)108 {109 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory;110 f->cubeMapResolution = StringConverter::parseUnsignedInt(params);111 }112 113 97 void parseReducedCubeMapResolution(String& params, RenderTechniqueFactory* factory) 114 98 { 115 99 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 116 100 f->reducedCubeMapResolution = StringConverter::parseUnsignedInt(params); 117 } 118 119 void parseTexID(String& params, RenderTechniqueFactory* factory) 120 { 121 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 122 f->texID = StringConverter::parseUnsignedInt(params); 123 } 124 125 void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 126 { 127 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 128 // format: on/off tolerance(float) 129 StringVector vecparams = StringUtil::split(params, " \t"); 130 131 if(StringConverter::parseBool(vecparams[0]))//on 132 { 133 f->useDistCalc = true; 134 135 if(vecparams.size()>1) 136 { 137 f->distTolerance = StringConverter::parseReal(vecparams[1]); 138 } 139 } 140 else 141 { 142 f->useDistCalc = false; 143 } 144 } 145 146 void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 147 { 148 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 149 // format: on/off tolerance(float) 150 StringVector vecparams = StringUtil::split(params, " \t"); 151 152 if(StringConverter::parseBool(vecparams[0]))//on 153 { 154 f->useFaceAngleCalc = true; 155 156 if(vecparams.size()>1) 157 { 158 f->angleTolerance = StringConverter::parseReal(vecparams[1]); 159 } 160 } 161 else 162 { 163 f->useFaceAngleCalc = false; 164 } 165 } 166 167 void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 168 { 169 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 170 f->updateAllFace = StringConverter::parseBool(params); 171 } 101 } 172 102 } 173 103 ///Technique factory … … 177 107 178 108 using namespace ConvolvedCubemapParsers; 179 //register parsers 180 this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 181 this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapUpdateInterval)); 182 this->attributeParsers.insert(AttribParserList::value_type("resolution", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapResolution)); 183 this->attributeParsers.insert(AttribParserList::value_type("reduced_resolution", (ILLUM_ATTRIBUTE_PARSER) parseReducedCubeMapResolution)); 184 this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 185 this->attributeParsers.insert(AttribParserList::value_type("distance_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseDistCalc)); 186 this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 187 this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 188 109 this->attributeParsers.insert(AttribParserList::value_type("reduced_resolution", (ILLUM_ATTRIBUTE_PARSER) parseReducedCubeMapResolution)); 189 110 } 190 111 … … 195 116 OgreTechniqueGroup* parentTechniqueGroup) 196 117 { 197 //reset parameters198 startFrame = 1;199 cubeMapUpdateInterval = 1;200 cubeMapResolution = 256;201 118 reducedCubeMapResolution = 8; 202 texID = 0;203 useDistCalc = 1;204 useFaceAngleCalc = false;205 distTolerance = 2.0;206 angleTolerance = 2.0;207 updateAllFace = false;208 119 120 OgreCubeMapRenderTechniqueFactory::resetParams(); 121 OgreCubeMapRenderTechniqueFactory::parseParams(params); 209 122 parseParams(params); 210 123 … … 220 133 angleTolerance, 221 134 updateAllFace, 135 renderSelf, 222 136 pass, 223 137 parentRenderable, -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCubeMapRenderTechnique.cpp
r874 r1711 12 12 float angleTolerance, 13 13 bool updateAllFace, 14 bool renderSelf, 14 15 Pass* pass, 15 16 OgreRenderable* parentRenderable, 16 17 OgreTechniqueGroup* parentTechniqueGroup) 17 18 :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 18 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup),19 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 19 20 RenderTechnique(parentRenderable, parentTechniqueGroup) 20 21 { 21 this->texID = texID; 22 23 if(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP) == 0) 24 sharedRuns->addRun(ILLUMRUN_COLOR_CUBEMAP, createColorCubeMapRun()); 25 26 colorCubeMapRunChanged(sharedRuns->getRun(ILLUMRUN_COLOR_CUBEMAP)); 22 this->texID = texID; 27 23 } 28 24 … … 33 29 } 34 30 35 void OgreCubeMapRenderTechnique::update(unsigned long frameNum)36 {37 CubeMapRenderTechnique::update(frameNum);38 /*39 GpuProgramParametersSharedPtr fpParams = pass->getFragmentProgramParameters();40 Vector3 center = ((OgreSharedRuns*) sharedRuns)->getRootPosition();41 fpParams->setNamedConstant("lastCenter",center);42 pass->setFragmentProgramParameters(fpParams); */43 44 }45 46 void OgreCubeMapRenderTechnique::colorCubeMapRunChanged(RenderingRun* run)47 {48 OgreColorCubeMapRenderingRun* cuberun =(OgreColorCubeMapRenderingRun*) (run->asOgreRenderingRun());49 String cubemapname = cuberun->getColorCubeMapTextureName();50 51 pass->getTextureUnitState(texID)->setTextureName(cubemapname);52 }53 54 RenderingRun* OgreCubeMapRenderTechnique::createColorCubeMapRun()55 {56 return new OgreColorCubeMapRenderingRun( (OgreSharedRuns*) parentTechniqueGroup->getSharedRuns(),57 parentOgreRenderable->getName() + "_COLORCUBEMAP",58 startFrame,59 cubeMapUpdateInterval,60 cubeMapResolution,61 useDistCalc,62 useFaceAngleCalc,63 distTolerance,64 angleTolerance,65 updateAllFace);66 }67 68 31 ///Technique Parsers 69 namespace C olorCubemapParsers32 namespace CubemapParsers 70 33 { 71 34 void parseStartFrame(String& params, RenderTechniqueFactory* factory) 72 35 { 73 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;36 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 74 37 f->startFrame = StringConverter::parseUnsignedLong(params); 75 38 } 76 39 void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 77 40 { 78 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;41 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 79 42 f->cubeMapUpdateInterval = StringConverter::parseUnsignedLong(params); 80 43 } … … 82 45 void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory) 83 46 { 84 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;47 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 85 48 f->cubeMapResolution = StringConverter::parseUnsignedInt(params); 86 49 } … … 88 51 void parseTexID(String& params, RenderTechniqueFactory* factory) 89 52 { 90 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;53 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 91 54 f->texID = StringConverter::parseUnsignedInt(params); 92 55 } … … 94 57 void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 95 58 { 96 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;59 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 97 60 // format: on/off tolerance(float) 98 61 StringVector vecparams = StringUtil::split(params, " \t"); … … 115 78 void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 116 79 { 117 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;80 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 118 81 // format: on/off tolerance(float) 119 82 StringVector vecparams = StringUtil::split(params, " \t"); … … 136 99 void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 137 100 { 138 OgreC olorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory;101 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 139 102 f->updateAllFace = StringConverter::parseBool(params); 103 } 104 105 void parseRenderSelf(String& params, RenderTechniqueFactory* factory) 106 { 107 OgreCubeMapRenderTechniqueFactory* f = (OgreCubeMapRenderTechniqueFactory*) factory; 108 f->renderSelf = StringConverter::parseBool(params); 140 109 } 141 110 } 142 111 ///Technique factory 143 OgreC olorCubeMapRenderTechniqueFactory::OgreColorCubeMapRenderTechniqueFactory()112 OgreCubeMapRenderTechniqueFactory::OgreCubeMapRenderTechniqueFactory() 144 113 { 145 typeName = "ColorCubeMap"; 146 147 using namespace ColorCubemapParsers; 114 115 using namespace CubemapParsers; 148 116 149 117 //register parsers … … 155 123 this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 156 124 this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 125 this->attributeParsers.insert(AttribParserList::value_type("render_self", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 157 126 158 127 } 159 128 160 OgreRenderTechnique* OgreColorCubeMapRenderTechniqueFactory::createInstance( 161 IllumTechniqueParams* params, 162 Pass* pass, 163 OgreRenderable* parentRenderable, 164 OgreTechniqueGroup* parentTechniqueGroup) 165 { 166 //reset parameters 129 void OgreCubeMapRenderTechniqueFactory::resetParams() 130 { 167 131 startFrame = 1; 168 132 cubeMapUpdateInterval = 1; … … 174 138 angleTolerance = 2.0; 175 139 updateAllFace = false; 176 177 parseParams(params); 178 179 OgreCubeMapRenderTechnique* result = new OgreCubeMapRenderTechnique( 180 startFrame, 181 cubeMapUpdateInterval, 182 cubeMapResolution, 183 texID, 184 useDistCalc, 185 useFaceAngleCalc, 186 distTolerance, 187 angleTolerance, 188 updateAllFace, 189 pass, 190 parentRenderable, 191 parentTechniqueGroup); 192 193 return result; 140 renderSelf = false; 194 141 } 195 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDistanceCubeMapRenderTechnique.cpp
r874 r1711 12 12 float angleTolerance, 13 13 bool updateAllFace, 14 bool renderSelf, 14 15 Pass* pass, 15 16 OgreRenderable* parentRenderable, 16 17 OgreTechniqueGroup* parentTechniqueGroup) 17 :OgreRenderTechnique( pass, parentRenderable, parentTechniqueGroup), 18 DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, parentRenderable, parentTechniqueGroup), 18 : 19 OgreCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, texID, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, pass, parentRenderable, parentTechniqueGroup), 20 CubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 21 DistanceCubeMapRenderTechnique(startFrame, cubeMapUpdateInterval, cubeMapResolution, useDistCalc, useFaceAngleCalc, distTolerance, angleTolerance, updateAllFace, renderSelf, parentRenderable, parentTechniqueGroup), 19 22 RenderTechnique(parentRenderable, parentTechniqueGroup) 20 23 { 21 this->texID = texID;22 23 24 if(sharedRuns->getRun(ILLUMRUN_DISTANCE_CUBEMAP) == 0) 24 25 sharedRuns->addRun(ILLUMRUN_DISTANCE_CUBEMAP, createDistanceCubeMapRun()); … … 67 68 } 68 69 69 70 ///Technique Parsers71 namespace CausticCubemapParsers72 {73 void parseStartFrame(String& params, RenderTechniqueFactory* factory)74 {75 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;76 f->startFrame = StringConverter::parseUnsignedLong(params);77 }78 void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory)79 {80 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;81 f->cubeMapUpdateInterval = StringConverter::parseUnsignedLong(params);82 }83 84 void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory)85 {86 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;87 f->cubeMapResolution = StringConverter::parseUnsignedInt(params);88 }89 90 void parseTexID(String& params, RenderTechniqueFactory* factory)91 {92 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;93 f->texID = StringConverter::parseUnsignedInt(params);94 }95 96 void parseUseDistCalc(String& params, RenderTechniqueFactory* factory)97 {98 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;99 // format: on/off tolerance(float)100 StringVector vecparams = StringUtil::split(params, " \t");101 102 if(StringConverter::parseBool(vecparams[0]))//on103 {104 f->useDistCalc = true;105 106 if(vecparams.size()>1)107 {108 f->distTolerance = StringConverter::parseReal(vecparams[1]);109 }110 }111 else112 {113 f->useDistCalc = false;114 }115 }116 117 void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory)118 {119 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;120 // format: on/off tolerance(float)121 StringVector vecparams = StringUtil::split(params, " \t");122 123 if(StringConverter::parseBool(vecparams[0]))//on124 {125 f->useFaceAngleCalc = true;126 127 if(vecparams.size()>1)128 {129 f->angleTolerance = StringConverter::parseReal(vecparams[1]);130 }131 }132 else133 {134 f->useFaceAngleCalc = false;135 }136 }137 138 void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory)139 {140 OgreDistanceCubeMapRenderTechniqueFactory* f = (OgreDistanceCubeMapRenderTechniqueFactory*) factory;141 f->updateAllFace = StringConverter::parseBool(params);142 }143 }144 70 ///Technique factory 145 71 OgreDistanceCubeMapRenderTechniqueFactory::OgreDistanceCubeMapRenderTechniqueFactory() 146 72 { 147 typeName = "DistanceCubeMap"; 148 149 using namespace CausticCubemapParsers; 150 //register parsers 151 this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 152 this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapUpdateInterval)); 153 this->attributeParsers.insert(AttribParserList::value_type("resolution", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapResolution)); 154 this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 155 this->attributeParsers.insert(AttribParserList::value_type("distance_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseDistCalc)); 156 this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 157 this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 158 73 typeName = "DistanceCubeMap"; 159 74 } 160 75 … … 165 80 OgreTechniqueGroup* parentTechniqueGroup) 166 81 { 167 //reset parameters 168 startFrame = 1; 169 cubeMapUpdateInterval = 1; 170 cubeMapResolution = 256; 82 OgreCubeMapRenderTechniqueFactory::resetParams(); 171 83 texID = 1; 172 useDistCalc = 1; 173 useFaceAngleCalc = false; 174 distTolerance = 2.0; 175 angleTolerance = 2.0; 176 updateAllFace = false; 177 84 OgreCubeMapRenderTechniqueFactory::parseParams(params); 178 85 parseParams(params); 179 86 180 87 OgreDistanceCubeMapRenderTechnique* result = new OgreDistanceCubeMapRenderTechnique( 181 88 startFrame, … … 188 95 angleTolerance, 189 96 updateAllFace, 97 renderSelf, 190 98 pass, 191 99 parentRenderable,
Note: See TracChangeset
for help on using the changeset viewer.