- Timestamp:
- 04/27/06 09:24:44 (19 years ago)
- Location:
- GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticCasterRenderTechnique.cpp
r790 r836 115 115 getCausticCubeMapTextureName(); 116 116 } 117 118 119 ///Technique Parsers 120 namespace CausticCasterParsers 121 { 122 void parseStartFrame(String& params, RenderTechniqueFactory* factory) 123 { 124 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 125 f->startFrame = StringConverter::parseUnsignedLong(params); 126 } 127 void parsePhotonMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 128 { 129 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 130 f->photonMapUpdateInterval = StringConverter::parseUnsignedLong(params); 131 } 132 133 void parsePhotonMapResolution(String& params, RenderTechniqueFactory* factory) 134 { 135 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 136 f->photonMapResolution = StringConverter::parseUnsignedInt(params); 137 } 138 139 void parseCausticCubeMapResolution(String& params, RenderTechniqueFactory* factory) 140 { 141 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 142 f->causticCubeMapResolution = StringConverter::parseUnsignedInt(params); 143 } 144 145 void parseTexID(String& params, RenderTechniqueFactory* factory) 146 { 147 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 148 f->photonMapTexID = StringConverter::parseUnsignedInt(params); 149 } 150 151 void parseUseDistance(String& params, RenderTechniqueFactory* factory) 152 { 153 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 154 f->useDistance = StringConverter::parseBool(params); 155 } 156 157 void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 158 { 159 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 160 f->updateAllFace = StringConverter::parseBool(params); 161 } 162 163 void parsePhotonMapMaterial(String& params, RenderTechniqueFactory* factory) 164 { 165 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 166 f->photonMapMaterialName = params; 167 } 168 169 void parseCauMapMaterial(String& params, RenderTechniqueFactory* factory) 170 { 171 OgreCausticCasterRenderTechniqueFactory* f = (OgreCausticCasterRenderTechniqueFactory*) factory; 172 f->causticMapMaterialName = params; 173 } 174 } 175 176 177 ///Technique factory 178 OgreCausticCasterRenderTechniqueFactory::OgreCausticCasterRenderTechniqueFactory() 179 { 180 typeName = "CausticCaster"; 181 182 using namespace CausticCasterParsers; 183 184 //register parsers 185 this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 186 this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parsePhotonMapUpdateInterval)); 187 this->attributeParsers.insert(AttribParserList::value_type("photonmap_resolution", (ILLUM_ATTRIBUTE_PARSER) parsePhotonMapResolution)); 188 this->attributeParsers.insert(AttribParserList::value_type("caustic_cubemap_resolution", (ILLUM_ATTRIBUTE_PARSER) parseCausticCubeMapResolution)); 189 this->attributeParsers.insert(AttribParserList::value_type("photon_map_material", (ILLUM_ATTRIBUTE_PARSER) parsePhotonMapMaterial)); 190 this->attributeParsers.insert(AttribParserList::value_type("caustic_map_material", (ILLUM_ATTRIBUTE_PARSER) parseCauMapMaterial)); 191 this->attributeParsers.insert(AttribParserList::value_type("photon_map_tex_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 192 this->attributeParsers.insert(AttribParserList::value_type("distance_impostor", (ILLUM_ATTRIBUTE_PARSER) parseUseDistance)); 193 this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 194 195 } 196 197 OgreRenderTechnique* OgreCausticCasterRenderTechniqueFactory::createInstance( 198 IllumTechniqueParams* params, 199 Pass* pass, 200 OgreRenderable* parentRenderable, 201 OgreTechniqueGroup* parentTechniqueGroup) 202 { 203 //reset parameters 204 startFrame = 0; 205 photonMapUpdateInterval = 1; 206 photonMapResolution = 64; 207 causticCubeMapResolution = 128; 208 photonMapMaterialName = "GameTools/PhotonMapCaustic"; 209 causticMapMaterialName = "GameTools/Cau"; 210 photonMapTexID = 0; 211 useDistance = true; 212 updateAllFace = false; 213 214 parseParams(params); 215 216 OgreCausticCasterRenderTechnique* result = new OgreCausticCasterRenderTechnique( 217 startFrame, 218 photonMapUpdateInterval, 219 photonMapResolution, 220 causticCubeMapResolution, 221 photonMapMaterialName, 222 causticMapMaterialName, 223 photonMapTexID, 224 updateAllFace, 225 useDistance, 226 pass, 227 parentRenderable, 228 parentTechniqueGroup); 229 230 return result; 231 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticRecieverRenderTechnique.cpp
r808 r836 113 113 } 114 114 115 116 namespace CausticRecieverParsers 117 { 118 ///Technique parsers 119 void parseMaxCasters(String& params, RenderTechniqueFactory* factory) 120 { 121 OgreCausticRecieverRenderTechniqueFactory* f = (OgreCausticRecieverRenderTechniqueFactory*) factory; 122 f->maxcasters = StringConverter::parseInt(params); 123 } 124 125 void parseVertexProgram(String& params, RenderTechniqueFactory* factory) 126 { 127 OgreCausticRecieverRenderTechniqueFactory* f = (OgreCausticRecieverRenderTechniqueFactory*) factory; 128 f->causticVertexProgram = params; 129 } 130 131 void parseFragmentProgram(String& params, RenderTechniqueFactory* factory) 132 { 133 OgreCausticRecieverRenderTechniqueFactory* f = (OgreCausticRecieverRenderTechniqueFactory*) factory; 134 f->causticFragmentProgram = params; 135 } 136 } 137 OgreCausticRecieverRenderTechniqueFactory::OgreCausticRecieverRenderTechniqueFactory() 138 { 139 typeName = "CausticReciever"; 140 141 using namespace CausticRecieverParsers; 142 //register parsers 143 this->attributeParsers.insert(AttribParserList::value_type("max_caster_count", (ILLUM_ATTRIBUTE_PARSER) parseMaxCasters)); 144 this->attributeParsers.insert(AttribParserList::value_type("vertex_program_name", (ILLUM_ATTRIBUTE_PARSER) parseVertexProgram)); 145 this->attributeParsers.insert(AttribParserList::value_type("fragment_program_name", (ILLUM_ATTRIBUTE_PARSER) parseFragmentProgram)); 146 } 147 148 OgreRenderTechnique* OgreCausticRecieverRenderTechniqueFactory::createInstance( 149 IllumTechniqueParams* params, 150 Pass* pass, 151 OgreRenderable* parentRenderable, 152 OgreTechniqueGroup* parentTechniqueGroup) 153 { 154 //reset parameters 155 maxcasters = 1; 156 causticVertexProgram = "GameTools/Caustic/DefaultVS"; 157 causticFragmentProgram = "GameTools/Caustic/DefaultPS"; 158 159 parseParams(params); 160 161 OgreCausticRecieverRenderTechnique* result = new OgreCausticRecieverRenderTechnique( 162 maxcasters, 163 causticVertexProgram, 164 causticFragmentProgram, 165 pass, 166 parentRenderable, 167 parentTechniqueGroup); 168 169 return result; 170 } -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreConvolvedCubeMapRenderTechnique.cpp
r790 r836 91 91 } 92 92 93 93 ///Technique Parsers 94 namespace ConvolvedCubemapParsers 95 { 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 void parseReducedCubeMapResolution(String& params, RenderTechniqueFactory* factory) 114 { 115 OgreConvoledCubeMapRenderTechniqueFactory* f = (OgreConvoledCubeMapRenderTechniqueFactory*) factory; 116 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 } 172 } 173 ///Technique factory 174 OgreConvoledCubeMapRenderTechniqueFactory::OgreConvoledCubeMapRenderTechniqueFactory() 175 { 176 typeName = "ReducedColorCubeMap"; 177 178 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 189 } 190 191 OgreRenderTechnique* OgreConvoledCubeMapRenderTechniqueFactory::createInstance( 192 IllumTechniqueParams* params, 193 Pass* pass, 194 OgreRenderable* parentRenderable, 195 OgreTechniqueGroup* parentTechniqueGroup) 196 { 197 //reset parameters 198 startFrame = 0; 199 cubeMapUpdateInterval = 1; 200 cubeMapResolution = 256; 201 reducedCubeMapResolution = 8; 202 texID = 0; 203 useDistCalc = 1; 204 useFaceAngleCalc = false; 205 distTolerance = 2.0; 206 angleTolerance = 2.0; 207 updateAllFace = false; 208 209 parseParams(params); 210 211 OgreConvolvedCubeMapRenderTechnique* result = new OgreConvolvedCubeMapRenderTechnique( 212 startFrame, 213 cubeMapUpdateInterval, 214 cubeMapResolution, 215 reducedCubeMapResolution, 216 texID, 217 useDistCalc, 218 useFaceAngleCalc, 219 distTolerance, 220 angleTolerance, 221 updateAllFace, 222 pass, 223 parentRenderable, 224 parentTechniqueGroup); 225 226 return result; 227 } 228 229 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCubeMapRenderTechnique.cpp
r790 r836 66 66 } 67 67 68 ///Technique Parsers 69 namespace ColorCubemapParsers 70 { 71 void parseStartFrame(String& params, RenderTechniqueFactory* factory) 72 { 73 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 74 f->startFrame = StringConverter::parseUnsignedLong(params); 75 } 76 void parseCubeMapUpdateInterval(String& params, RenderTechniqueFactory* factory) 77 { 78 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 79 f->cubeMapUpdateInterval = StringConverter::parseUnsignedLong(params); 80 } 68 81 82 void parseCubeMapResolution(String& params, RenderTechniqueFactory* factory) 83 { 84 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 85 f->cubeMapResolution = StringConverter::parseUnsignedInt(params); 86 } 87 88 void parseTexID(String& params, RenderTechniqueFactory* factory) 89 { 90 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 91 f->texID = StringConverter::parseUnsignedInt(params); 92 } 93 94 void parseUseDistCalc(String& params, RenderTechniqueFactory* factory) 95 { 96 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 97 // format: on/off tolerance(float) 98 StringVector vecparams = StringUtil::split(params, " \t"); 99 100 if(StringConverter::parseBool(vecparams[0]))//on 101 { 102 f->useDistCalc = true; 103 104 if(vecparams.size()>1) 105 { 106 f->distTolerance = StringConverter::parseReal(vecparams[1]); 107 } 108 } 109 else 110 { 111 f->useDistCalc = false; 112 } 113 } 114 115 void parseUseFaceAngleCalc(String& params, RenderTechniqueFactory* factory) 116 { 117 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 118 // format: on/off tolerance(float) 119 StringVector vecparams = StringUtil::split(params, " \t"); 120 121 if(StringConverter::parseBool(vecparams[0]))//on 122 { 123 f->useFaceAngleCalc = true; 124 125 if(vecparams.size()>1) 126 { 127 f->angleTolerance = StringConverter::parseReal(vecparams[1]); 128 } 129 } 130 else 131 { 132 f->useFaceAngleCalc = false; 133 } 134 } 135 136 void parseUpdateAllFace(String& params, RenderTechniqueFactory* factory) 137 { 138 OgreColorCubeMapRenderTechniqueFactory* f = (OgreColorCubeMapRenderTechniqueFactory*) factory; 139 f->updateAllFace = StringConverter::parseBool(params); 140 } 141 } 142 ///Technique factory 143 OgreColorCubeMapRenderTechniqueFactory::OgreColorCubeMapRenderTechniqueFactory() 144 { 145 typeName = "ColorCubeMap"; 146 147 using namespace ColorCubemapParsers; 148 149 //register parsers 150 this->attributeParsers.insert(AttribParserList::value_type("start_frame", (ILLUM_ATTRIBUTE_PARSER) parseStartFrame)); 151 this->attributeParsers.insert(AttribParserList::value_type("update_interval", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapUpdateInterval)); 152 this->attributeParsers.insert(AttribParserList::value_type("resolution", (ILLUM_ATTRIBUTE_PARSER) parseCubeMapResolution)); 153 this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseTexID)); 154 this->attributeParsers.insert(AttribParserList::value_type("distance_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseDistCalc)); 155 this->attributeParsers.insert(AttribParserList::value_type("face_angle_calc", (ILLUM_ATTRIBUTE_PARSER) parseUseFaceAngleCalc)); 156 this->attributeParsers.insert(AttribParserList::value_type("update_all_face", (ILLUM_ATTRIBUTE_PARSER) parseUpdateAllFace)); 157 158 } 159 160 OgreRenderTechnique* OgreColorCubeMapRenderTechniqueFactory::createInstance( 161 IllumTechniqueParams* params, 162 Pass* pass, 163 OgreRenderable* parentRenderable, 164 OgreTechniqueGroup* parentTechniqueGroup) 165 { 166 //reset parameters 167 startFrame = 0; 168 cubeMapUpdateInterval = 1; 169 cubeMapResolution = 256; 170 texID = 0; 171 useDistCalc = 1; 172 useFaceAngleCalc = false; 173 distTolerance = 2.0; 174 angleTolerance = 2.0; 175 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; 194 } 195 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDepthShadowRecieverRenderTechnique.cpp
r790 r836 108 108 } 109 109 110 111 ///Technique parsers 112 namespace DepthShadowRecieverParsers 113 { 114 void parseMaxLights(String& params, RenderTechniqueFactory* factory) 115 { 116 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 117 f->maxlights = StringConverter::parseInt(params); 118 } 119 120 void parseVertexProgram(String& params, RenderTechniqueFactory* factory) 121 { 122 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 123 f->shadowVertexProgram = params; 124 } 125 126 void parseFragmentProgram(String& params, RenderTechniqueFactory* factory) 127 { 128 OgreDepthShadowRecieverRenderTechniqueFactory* f = (OgreDepthShadowRecieverRenderTechniqueFactory*) factory; 129 f->shadowFragmentProgram = params; 130 } 131 } 132 133 OgreDepthShadowRecieverRenderTechniqueFactory::OgreDepthShadowRecieverRenderTechniqueFactory() 134 { 135 typeName = "DepthShadowReciever"; 136 137 using namespace DepthShadowRecieverParsers; 138 //register parsers 139 this->attributeParsers.insert(AttribParserList::value_type("max_light_count", (ILLUM_ATTRIBUTE_PARSER) parseMaxLights)); 140 this->attributeParsers.insert(AttribParserList::value_type("vertex_program_name", (ILLUM_ATTRIBUTE_PARSER) parseVertexProgram)); 141 this->attributeParsers.insert(AttribParserList::value_type("fragment_program_name", (ILLUM_ATTRIBUTE_PARSER) parseFragmentProgram)); 142 } 143 144 OgreRenderTechnique* OgreDepthShadowRecieverRenderTechniqueFactory::createInstance( 145 IllumTechniqueParams* params, 146 Pass* pass, 147 OgreRenderable* parentRenderable, 148 OgreTechniqueGroup* parentTechniqueGroup) 149 { 150 //reset parameters 151 maxlights = 1; 152 shadowVertexProgram = "GameTools/ShadowMap/ShadowVS"; 153 shadowFragmentProgram = "GameTools/ShadowMap/ShadowPS"; 154 155 parseParams(params); 156 157 OgreDepthShadowRecieverRenderTechnique* result = new OgreDepthShadowRecieverRenderTechnique( 158 maxlights, 159 shadowVertexProgram, 160 shadowFragmentProgram, 161 pass, 162 parentRenderable, 163 parentTechniqueGroup); 164 165 return result; 166 } 167 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreDistanceCubeMapRenderTechnique.cpp
r790 r836 68 68 69 69 70 ///Technique Parsers 71 namespace CausticCubemapParsers 72 { 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]))//on 103 { 104 f->useDistCalc = true; 105 106 if(vecparams.size()>1) 107 { 108 f->distTolerance = StringConverter::parseReal(vecparams[1]); 109 } 110 } 111 else 112 { 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]))//on 124 { 125 f->useFaceAngleCalc = true; 126 127 if(vecparams.size()>1) 128 { 129 f->angleTolerance = StringConverter::parseReal(vecparams[1]); 130 } 131 } 132 else 133 { 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 ///Technique factory 145 OgreDistanceCubeMapRenderTechniqueFactory::OgreDistanceCubeMapRenderTechniqueFactory() 146 { 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 159 } 160 161 OgreRenderTechnique* OgreDistanceCubeMapRenderTechniqueFactory::createInstance( 162 IllumTechniqueParams* params, 163 Pass* pass, 164 OgreRenderable* parentRenderable, 165 OgreTechniqueGroup* parentTechniqueGroup) 166 { 167 //reset parameters 168 startFrame = 0; 169 cubeMapUpdateInterval = 1; 170 cubeMapResolution = 256; 171 texID = 1; 172 useDistCalc = 1; 173 useFaceAngleCalc = false; 174 distTolerance = 2.0; 175 angleTolerance = 2.0; 176 updateAllFace = false; 177 178 parseParams(params); 179 180 OgreDistanceCubeMapRenderTechnique* result = new OgreDistanceCubeMapRenderTechnique( 181 startFrame, 182 cubeMapUpdateInterval, 183 cubeMapResolution, 184 texID, 185 useDistCalc, 186 useFaceAngleCalc, 187 distTolerance, 188 angleTolerance, 189 updateAllFace, 190 pass, 191 parentRenderable, 192 parentTechniqueGroup); 193 194 return result; 195 } 196 -
GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreSBBRenderTechnique.cpp
r790 r836 33 33 } 34 34 35 namespace SBBParsers 36 { 37 ///Technique parsers 38 void parseDepthTexID(String& params, RenderTechniqueFactory* factory) 39 { 40 OgreSBBRenderTechniqueFactory* f = (OgreSBBRenderTechniqueFactory*) factory; 41 f->depthTexID = StringConverter::parseUnsignedInt(params); 42 } 43 } 44 45 OgreSBBRenderTechniqueFactory::OgreSBBRenderTechniqueFactory() 46 { 47 typeName = "SphericalBillboard"; 48 49 using namespace SBBParsers; 50 51 //register parsers 52 this->attributeParsers.insert(AttribParserList::value_type("texture_unit_id", (ILLUM_ATTRIBUTE_PARSER) parseDepthTexID)); 53 } 54 55 OgreRenderTechnique* OgreSBBRenderTechniqueFactory::createInstance( 56 IllumTechniqueParams* params, 57 Pass* pass, 58 OgreRenderable* parentRenderable, 59 OgreTechniqueGroup* parentTechniqueGroup) 60 { 61 //reset parameters 62 depthTexID = 0; 63 64 parseParams(params); 65 66 OgreSBBRenderTechnique* result = new OgreSBBRenderTechnique( 67 depthTexID, 68 pass, 69 parentRenderable, 70 parentTechniqueGroup); 71 return result; 72 } 73 74 75
Note: See TracChangeset
for help on using the changeset viewer.