Changeset 836 for GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/src/RenderTechniques/OgreCausticCasterRenderTechnique.cpp
- Timestamp:
- 04/27/06 09:24:44 (19 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.