- Timestamp:
- 11/03/06 09:51:53 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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.