Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/Utility/XMLParser.cpp

Diff revisions: vs.
  @@ -166,8 +166,10 @@
166 166 TextureWrap wrapU = getWrapMode(pt.get<std::string>(textureNode+".MapU","TEXTURE_REPEAT").c_str());
167 167 TextureWrap wrapV = getWrapMode(pt.get<std::string>(textureNode+".MapV","TEXTURE_REPEAT").c_str());
168 168 TextureWrap wrapW = getWrapMode(pt.get<std::string>(textureNode+".MapW","TEXTURE_REPEAT").c_str());
169 - TextureFilter minFilterValue = getFilter(pt.get<std::string>(textureNode+".minFilter","TEXTURE_FILTER_LINEAR").c_str());
170 - TextureFilter magFilterValue = getFilter(pt.get<std::string>(textureNode+".magFilter","TEXTURE_FILTER_LINEAR").c_str());
169 + TextureFilter minFilterValue = getFilter(pt.get<std::string>(textureNode+".minFilter",
170 + "TEXTURE_FILTER_LINEAR").c_str());
171 + TextureFilter magFilterValue = getFilter(pt.get<std::string>(textureNode+".magFilter",
172 + "TEXTURE_FILTER_LINEAR").c_str());
171 173 U32 anisotropy = pt.get(textureNode+".anisotropy", 0);
172 174
173 175 SamplerDescriptor sampDesc;
  @@ -305,36 +307,53 @@
305 307 scene->state().getWaterLevel() = pt.get("water.waterLevel",0.0f);
306 308 scene->state().getWaterDepth() = pt.get("water.waterDepth",-75);
307 309
308 - if (boost::optional<ptree &> cameraPositionOverride = pt.get_child_optional("options.cameraStartPosition")) {
309 - par.setParam("options.cameraStartPosition.x", pt.get("options.cameraStartPosition.<xmlattr>.x",0.0f));
310 - par.setParam("options.cameraStartPosition.y", pt.get("options.cameraStartPosition.<xmlattr>.y",0.0f));
311 - par.setParam("options.cameraStartPosition.z", pt.get("options.cameraStartPosition.<xmlattr>.z",0.0f));
312 - par.setParam("options.cameraStartOrientation.xOffsetDegrees",pt.get("options.cameraStartPosition.<xmlattr>.xOffsetDegrees",0.0f));
313 - par.setParam("options.cameraStartOrientation.yOffsetDegrees",pt.get("options.cameraStartPosition.<xmlattr>.yOffsetDegrees",0.0f));
310 + if (boost::optional<ptree &> cameraPositionOverride =
311 + pt.get_child_optional("options.cameraStartPosition")) {
312 + par.setParam("options.cameraStartPosition.x",
313 + pt.get("options.cameraStartPosition.<xmlattr>.x",0.0f));
314 + par.setParam("options.cameraStartPosition.y",
315 + pt.get("options.cameraStartPosition.<xmlattr>.y",0.0f));
316 + par.setParam("options.cameraStartPosition.z",
317 + pt.get("options.cameraStartPosition.<xmlattr>.z",0.0f));
318 + par.setParam("options.cameraStartOrientation.xOffsetDegrees",
319 + pt.get("options.cameraStartPosition.<xmlattr>.xOffsetDegrees",0.0f));
320 + par.setParam("options.cameraStartOrientation.yOffsetDegrees",
321 + pt.get("options.cameraStartPosition.<xmlattr>.yOffsetDegrees",0.0f));
314 322 par.setParam("options.cameraStartPositionOverride",true);
315 323 } else {
316 324 par.setParam("options.cameraStartPositionOverride",false);
317 325 }
318 326
319 - if (boost::optional<ptree &> physicsCook = pt.get_child_optional("options.autoCookPhysicsAssets")) {
320 - par.setParam("options.autoCookPhysicsAssets", pt.get<bool>("options.autoCookPhysicsAssets",false));
327 + if (boost::optional<ptree &> physicsCook =
328 + pt.get_child_optional("options.autoCookPhysicsAssets")) {
329 + par.setParam("options.autoCookPhysicsAssets",
330 + pt.get<bool>("options.autoCookPhysicsAssets",false));
321 331 } else {
322 - par.setParam("options.autoCookPhysicsAssets", false);
332 + par.setParam("options.autoCookPhysicsAssets",
333 + false);
323 334 }
324 335
325 - if (boost::optional<ptree &> cameraPositionOverride = pt.get_child_optional("options.cameraSpeed")) {
326 - par.setParam("options.cameraSpeed.move",pt.get("options.cameraSpeed.<xmlattr>.move", 35.0f));
327 - par.setParam("options.cameraSpeed.turn",pt.get("options.cameraSpeed.<xmlattr>.turn", 35.0f));
336 + if (boost::optional<ptree &> cameraPositionOverride =
337 + pt.get_child_optional("options.cameraSpeed")) {
338 + par.setParam("options.cameraSpeed.move",
339 + pt.get("options.cameraSpeed.<xmlattr>.move", 35.0f));
340 + par.setParam("options.cameraSpeed.turn",
341 + pt.get("options.cameraSpeed.<xmlattr>.turn", 35.0f));
328 342 } else {
329 343 par.setParam("options.cameraSpeed.move", 35.0f);
330 344 par.setParam("options.cameraSpeed.turn", 35.0f);
331 345 }
332 346
333 - if (boost::optional<ptree &> fog = pt.get_child_optional("fog")) {
334 - par.setParam("rendering.sceneState.fogDensity", pt.get("fog.fogDensity",0.01f));
335 - par.setParam("rendering.sceneState.fogColor.r", pt.get<F32>("fog.fogColor.<xmlattr>.r", 0.2f));
336 - par.setParam("rendering.sceneState.fogColor.g", pt.get<F32>("fog.fogColor.<xmlattr>.g", 0.2f));
337 - par.setParam("rendering.sceneState.fogColor.b", pt.get<F32>("fog.fogColor.<xmlattr>.b", 0.2f));
347 + if (boost::optional<ptree &> fog =
348 + pt.get_child_optional("fog")) {
349 + par.setParam("rendering.sceneState.fogDensity",
350 + pt.get("fog.fogDensity",0.01f));
351 + par.setParam("rendering.sceneState.fogColor.r",
352 + pt.get<F32>("fog.fogColor.<xmlattr>.r", 0.2f));
353 + par.setParam("rendering.sceneState.fogColor.g",
354 + pt.get<F32>("fog.fogColor.<xmlattr>.g", 0.2f));
355 + par.setParam("rendering.sceneState.fogColor.b",
356 + pt.get<F32>("fog.fogColor.<xmlattr>.b", 0.2f));
338 357 }
339 358
340 359 scene->state().getFogDesc()._fogDensity = par.getParam<F32>("rendering.sceneState.fogDensity");
  @@ -355,26 +374,38 @@
355 374 ptree::iterator itTexture;
356 375 std::string assetLocation(ParamHandler::getInstance().getParam<std::string>("assetsLocation") + "/");
357 376
358 - for (itTerrain = pt.get_child("terrainList").begin(); itTerrain != pt.get_child("terrainList").end(); ++itTerrain) {
359 - std::string name = itTerrain->second.data(); //The actual terrain name
360 - std::string tag = itTerrain->first.data(); //The <name> tag for valid terrains or <xmlcomment> for comments
377 + for (itTerrain = pt.get_child("terrainList").begin();
378 + itTerrain != pt.get_child("terrainList").end();
379 + ++itTerrain) {
380 + //The actual terrain name
381 + std::string name = itTerrain->second.data();
382 + //The <name> tag for valid terrains or <xmlcomment> for comments
383 + std::string tag = itTerrain->first.data();
361 384 //Check and skip commented terrain
362 385 if (tag.find("<xmlcomment>") != std::string::npos) {
363 386 continue;
364 387 }
365 388 //Load the rest of the terrain
366 389 TerrainDescriptor* ter = CreateResource<TerrainDescriptor>(ResourceDescriptor(stringAlg::toBase(name +"_descriptor")));
367 - ter->addVariable("terrainName", stringAlg::toBase(name));
368 - ter->addVariable("heightmap", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".heightmap")));
369 - ter->addVariable("waterCaustics", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".waterCaustics")));
370 - ter->addVariable("underwaterAlbedoTexture", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".underwaterAlbedoTexture")));
371 - ter->addVariable("underwaterDetailTexture", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".underwaterDetailTexture")));
372 - ter->addVariable("underwaterDiffuseScale", pt.get<F32>(name + ".underwaterDiffuseScale"));
390 + ter->addVariable("terrainName",
391 + stringAlg::toBase(name));
392 + ter->addVariable("heightmap",
393 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".heightmap")));
394 + ter->addVariable("waterCaustics",
395 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".waterCaustics")));
396 + ter->addVariable("underwaterAlbedoTexture",
397 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".underwaterAlbedoTexture")));
398 + ter->addVariable("underwaterDetailTexture",
399 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".underwaterDetailTexture")));
400 + ter->addVariable("underwaterDiffuseScale",
401 + pt.get<F32>(name + ".underwaterDiffuseScale"));
373 402
374 403 I32 i = 0;
375 404 std::string temp;
376 405 std::string layerOffsetStr;
377 - for (itTexture = pt.get_child(name + ".textureLayers").begin(); itTexture != pt.get_child(name + ".textureLayers").end(); ++itTexture, ++i) {
406 + for (itTexture = pt.get_child(name + ".textureLayers").begin();
407 + itTexture != pt.get_child(name + ".textureLayers").end();
408 + ++itTexture, ++i) {
378 409 std::string layerName(itTexture->second.data());
379 410 std::string format(itTexture->first.data());
380 411
  @@ -422,31 +453,49 @@
422 453 ter->addVariable(stringAlg::toBase("alphaDetail" + layerOffsetStr), stringAlg::toBase(assetLocation + temp));
423 454 }
424 455
425 - ter->addVariable(stringAlg::toBase("diffuseScaleR" + layerOffsetStr), pt.get<F32>(layerName + ".redDiffuseScale", 0.0f));
426 - ter->addVariable(stringAlg::toBase("detailScaleR" + layerOffsetStr), pt.get<F32>(layerName + ".redDetailScale", 0.0f));
427 - ter->addVariable(stringAlg::toBase("diffuseScaleG" + layerOffsetStr), pt.get<F32>(layerName + ".greenDiffuseScale", 0.0f));
428 - ter->addVariable(stringAlg::toBase("detailScaleG" + layerOffsetStr), pt.get<F32>(layerName + ".greenDetailScale", 0.0f));
429 - ter->addVariable(stringAlg::toBase("diffuseScaleB" + layerOffsetStr), pt.get<F32>(layerName + ".blueDiffuseScale", 0.0f));
430 - ter->addVariable(stringAlg::toBase("detailScaleB" + layerOffsetStr), pt.get<F32>(layerName + ".blueDetailScale", 0.0f));
431 - ter->addVariable(stringAlg::toBase("diffuseScaleA" + layerOffsetStr), pt.get<F32>(layerName + ".alphaDiffuseScale", 0.0f));
432 - ter->addVariable(stringAlg::toBase("detailScaleA" + layerOffsetStr), pt.get<F32>(layerName + ".alphaDetailScale", 0.0f));
456 + ter->addVariable(stringAlg::toBase("diffuseScaleR" + layerOffsetStr),
457 + pt.get<F32>(layerName + ".redDiffuseScale", 0.0f));
458 + ter->addVariable(stringAlg::toBase("detailScaleR" + layerOffsetStr),
459 + pt.get<F32>(layerName + ".redDetailScale", 0.0f));
460 + ter->addVariable(stringAlg::toBase("diffuseScaleG" + layerOffsetStr),
461 + pt.get<F32>(layerName + ".greenDiffuseScale", 0.0f));
462 + ter->addVariable(stringAlg::toBase("detailScaleG" + layerOffsetStr),
463 + pt.get<F32>(layerName + ".greenDetailScale", 0.0f));
464 + ter->addVariable(stringAlg::toBase("diffuseScaleB" + layerOffsetStr),
465 + pt.get<F32>(layerName + ".blueDiffuseScale", 0.0f));
466 + ter->addVariable(stringAlg::toBase("detailScaleB" + layerOffsetStr),
467 + pt.get<F32>(layerName + ".blueDetailScale", 0.0f));
468 + ter->addVariable(stringAlg::toBase("diffuseScaleA" + layerOffsetStr),
469 + pt.get<F32>(layerName + ".alphaDiffuseScale", 0.0f));
470 + ter->addVariable(stringAlg::toBase("detailScaleA" + layerOffsetStr),
471 + pt.get<F32>(layerName + ".alphaDetailScale", 0.0f));
433 472 }
434 473
435 474 ter->setTextureLayerCount(i);
436 - ter->addVariable("grassMap", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.map")));
437 - ter->addVariable("grassBillboard1", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard1", "")));
438 - ter->addVariable("grassBillboard2", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard2", "")));
439 - ter->addVariable("grassBillboard3", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard3", "")));
440 - ter->addVariable("grassBillboard4", stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard4", "")));
475 + ter->addVariable("grassMap",
476 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.map")));
477 + ter->addVariable("grassBillboard1",
478 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard1", "")));
479 + ter->addVariable("grassBillboard2",
480 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard2", "")));
481 + ter->addVariable("grassBillboard3",
482 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard3", "")));
483 + ter->addVariable("grassBillboard4",
484 + stringAlg::toBase(assetLocation + pt.get<std::string>(name + ".vegetation.grassBillboard4", "")));
441 485 ter->setGrassDensity(pt.get<F32>(name + ".vegetation.<xmlattr>.grassDensity"));
442 486 ter->setTreeDensity(pt.get<F32>(name + ".vegetation.<xmlattr>.treeDensity"));
443 487 ter->setGrassScale(pt.get<F32>(name + ".vegetation.<xmlattr>.grassScale"));
444 488 ter->setTreeScale(pt.get<F32>(name + ".vegetation.<xmlattr>.treeScale"));
445 489 ter->set16Bit(pt.get<bool>(name + ".is16Bit", false));
446 - ter->setPosition(vec3<F32>(pt.get<F32>(name + ".position.<xmlattr>.x", 0.0f), pt.get<F32>(name + ".position.<xmlattr>.y", 0.0f), pt.get<F32>(name + ".position.<xmlattr>.z", 0.0f)));
447 - ter->setScale(vec2<F32>(pt.get<F32>(name + ".scale", 1.0f), pt.get<F32>(name + ".heightFactor", 1.0f)));
448 - ter->setDimensions(vec2<U16>(pt.get<U16>(name + ".terrainWidth", 0), pt.get<U16>(name + ".terrainHeight", 0)));
449 - ter->setAltitudeRange(vec2<F32>(pt.get<F32>(name + ".altitudeRange.<xmlattr>.min", 0.0f), pt.get<F32>(name + ".altitudeRange.<xmlattr>.max", 255.0f)));
490 + ter->setPosition(vec3<F32>(pt.get<F32>(name + ".position.<xmlattr>.x", 0.0f),
491 + pt.get<F32>(name + ".position.<xmlattr>.y", 0.0f),
492 + pt.get<F32>(name + ".position.<xmlattr>.z", 0.0f)));
493 + ter->setScale(vec2<F32>(pt.get<F32>(name + ".scale", 1.0f),
494 + pt.get<F32>(name + ".heightFactor", 1.0f)));
495 + ter->setDimensions(vec2<U16>(pt.get<U16>(name + ".terrainWidth", 0),
496 + pt.get<U16>(name + ".terrainHeight", 0)));
497 + ter->setAltitudeRange(vec2<F32>(pt.get<F32>(name + ".altitudeRange.<xmlattr>.min", 0.0f),
498 + pt.get<F32>(name + ".altitudeRange.<xmlattr>.max", 255.0f)));
450 499 ter->setActive(pt.get<bool>(name + ".active", true));
451 500 ter->setChunkSize(pt.get<U32>(name + ".nodeChunkSize", 256));
452 501 ter->setCreatePXActor(pt.get<bool>(name + ".addToPhysics", false));
  @@ -713,7 +762,7 @@
713 762 mat->setDoubleSided(pt.get<bool>("material.doubleSided",false));
714 763 mat->setShadingMode(Material::SHADING_BLINN_PHONG);
715 764 if (boost::optional<ptree &> child = pt.get_child_optional("diffuseTexture1")) {
716 - mat->setTexture(ShaderProgram::TEXTURE_UNIT0, loadTextureXML("diffuseTexture1", pt.get("diffuseTexture1.file","none")));
765 + mat->setTexture(ShaderProgram::TEXTURE_UNIT0,loadTextureXML("diffuseTexture1", pt.get("diffuseTexture1.file","none")));
717 766 }
718 767
719 768 if (boost::optional<ptree &> child = pt.get_child_optional("diffuseTexture2")) {