5#include <unordered_map>
54using std::unordered_map;
99#define AVOID_NULLPTR_STRING(arg) (arg == nullptr?"":arg)
108 this->
rampTerrainBrushTexture = TextureReader::read(
"./resources/engine/textures",
"terrain_ramp.png",
false,
false);
139 if (prototype ==
nullptr)
return;
143 if (prototype->getFileName().empty() ==
true)
throw ExceptionBase(
"Could not save file. No filename known");
145 Tools::getPathName(prototype->getFileName()),
146 Tools::getFileName(prototype->getFileName())
155 class OnModelSave:
public virtual Action
158 void performAction()
override {
160 modelEditorTabController->view->saveFile(
161 modelEditorTabController->popUps->getFileDialogScreenController()->getPathName(),
162 modelEditorTabController->popUps->getFileDialogScreenController()->getFileName()
165 modelEditorTabController->showErrorPopUp(
"Warning", (
string(exception.what())));
167 modelEditorTabController->popUps->getFileDialogScreenController()->close();
183 if (prototype ==
nullptr)
return;
187 prototype->getFileName().empty() ==
false?Tools::getPathName(prototype->getFileName()):
string(),
190 Tools::getFileName(prototype->getFileName()),
192 new OnModelSave(
this)
207 if (node->
getId() ==
"selectbox_outliner") {
211 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_add") ==
true) {
218 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_substract") ==
true) {
225 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_flatten") ==
true) {
232 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_smooth") ==
true) {
239 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_ramp") ==
true) {
246 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_terrain_delete") ==
true) {
253 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_water_water") ==
true) {
260 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_water_delete") ==
true) {
267 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_foliage_add") ==
true) {
274 if (StringTools::startsWith(node->
getId(),
view->
getTabId() +
"_tab_foliage_delete") ==
true) {
282 if (node->
getId() == textureBrushApplyNode) {
288 if (node->
getId() == foliageBrushApplyNode) {
295 if (node->
getId() == foliageBrushPrototypeApplyNode) {
314 if (node->
getId() ==
"selectbox_outliner") {
316 if (StringTools::startsWith(outlinerNode,
"terrain.waters.") ==
true) {
320 class OnTerrainWaterDelete:
public virtual Action
323 void performAction()
override {
324 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
325 auto waterIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.waters.").size(), outlinerNode.size()));
326 terrainEditorTabController->deleteWater(waterIdx);
328 class ReloadOutlinerAction:
public Action {
330 void performAction()
override {
331 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(
"terrain.waters");
333 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
338 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(terrainEditorTabController));
340 OnTerrainWaterDelete(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
350 if (outlinerNode ==
"terrain.foliage") {
354 class OnTerrainFoliageAddBrush:
public virtual Action
357 void performAction()
override {
358 auto prototype = terrainEditorTabController->view->getPrototype();
359 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
360 if (terrain ==
nullptr)
return;
361 auto brush = terrain->addBrush();
363 class ReloadOutlinerAction:
public Action {
365 void performAction()
override {
366 string outlinerNode =
"terrain.foliage";
367 auto prototype = terrainEditorTabController->view->getPrototype();
368 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
369 if (terrain !=
nullptr) outlinerNode =
"terrain.foliage." + to_string(terrain->getBrushes().size() - 1);
370 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(outlinerNode);
372 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
377 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(terrainEditorTabController));
379 OnTerrainFoliageAddBrush(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
389 if (StringTools::startsWith(outlinerNode,
"terrain.foliagebrushes.") ==
true) {
394 class OnTerrainDeleteFoliageBrush:
public virtual Action
397 void performAction()
override {
398 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
399 auto foliageBrushIdx = -1;
400 auto foliageBrushPrototypeIdx = -1;
401 if (terrainEditorTabController->checkOutlinerFoliageBrushPrototype(outlinerNode, foliageBrushIdx, foliageBrushPrototypeIdx) ==
false)
return;
402 auto prototype = terrainEditorTabController->view->getPrototype();
403 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
404 if (terrain ==
nullptr)
return;
405 auto brush = terrain->getBrush(foliageBrushIdx);
406 brush->removePrototype(foliageBrushPrototypeIdx);
407 auto newOutlinerNode =
"terrain.brushes." + to_string(foliageBrushIdx);
410 class ReloadOutlinerAction:
public Action {
412 void performAction()
override {
413 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(outlinerNode);
415 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController,
const string& outlinerNode): terrainEditorTabController(terrainEditorTabController), outlinerNode(outlinerNode) {
421 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(terrainEditorTabController, newOutlinerNode));
423 OnTerrainDeleteFoliageBrush(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
433 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
439 class OnTerrainAddFoliageBrushPrototype:
public virtual Action
442 void performAction()
override {
443 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
444 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
445 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
446 auto prototype = terrainEditorTabController->view->getPrototype();
447 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
448 if (terrain ==
nullptr)
return;
449 auto brush = terrain->getBrush(foliageBrushIdx);
450 if (brush ==
nullptr)
return;
451 auto brushPrototype = brush->addPrototype();
452 auto newOutlinerNode =
"terrain.foliagebrushes." + to_string(foliageBrushIdx) +
"." + to_string(brush->getPrototypes().size() - 1);
455 class ReloadOutlinerAction:
public Action {
457 void performAction()
override {
458 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(outlinerNode);
460 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController,
const string& outlinerNode): terrainEditorTabController(terrainEditorTabController), outlinerNode(outlinerNode) {
466 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(terrainEditorTabController, newOutlinerNode));
468 OnTerrainAddFoliageBrushPrototype(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
477 class OnTerrainDeleteFoliageBrush:
public virtual Action
480 void performAction()
override {
481 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
482 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
483 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
484 auto prototype = terrainEditorTabController->view->getPrototype();
485 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
486 if (terrain ==
nullptr)
return;
487 terrain->removeBrush(foliageBrushIdx);
490 class ReloadOutlinerAction:
public Action {
492 void performAction()
override {
493 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(
"terrain.foliage");
495 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
500 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(terrainEditorTabController));
502 OnTerrainDeleteFoliageBrush(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
519 if (node->
getId() ==
"terrain_create") {
522 if (node->
getId() ==
"foliagebrush_texture_open") {
524 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
525 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
527 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
528 if (terrain ==
nullptr)
return;
529 auto brush = terrain->
getBrush(foliageBrushIdx);
530 if (brush ==
nullptr)
return;
533 class OnFoliageBrushFileOpenAction:
public virtual Action
536 void performAction()
override {
537 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
538 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
539 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
540 auto prototype = terrainEditorTabController->view->getPrototype();
541 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
542 if (terrain ==
nullptr)
return;
543 auto brush = terrain->getBrush(foliageBrushIdx);
544 if (brush ==
nullptr)
return;
546 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getPathName() +
548 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getFileName()
550 required_dynamic_cast<GUIImageNode*>(terrainEditorTabController->screenNode->getNodeById(
"foliagebrush_texture"))->setSource(brush->getFileName());
551 terrainEditorTabController->updateFoliageBrush();
552 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->close();
559 OnFoliageBrushFileOpenAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
566 vector<string> extensions = TextureReader::getTextureExtensions();
568 brush->getFileName().empty() ==
false?Tools::getPathName(brush->getFileName()):
string(),
569 "Load foliage brush texture from: ",
571 Tools::getFileName(brush->getFileName()),
573 new OnFoliageBrushFileOpenAction(
this)
576 if (node->
getId() ==
"foliagebrush_texture_remove") {
578 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
579 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
581 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
582 if (terrain ==
nullptr)
return;
583 auto brush = terrain->
getBrush(foliageBrushIdx);
584 if (brush ==
nullptr)
return;
586 required_dynamic_cast<GUIImageNode*>(
screenNode->
getNodeById(
"foliagebrush_texture"))->setSource(brush->getFileName());
589 if (node->
getId() ==
"foliagebrush_texture_browseto") {
592 if (node->
getId() ==
"foliagebrush_prototype_file_open") {
593 class OnTerrainBrushPrototypeFileOpenAction:
public virtual Action
596 void performAction()
override {
597 auto prototype = terrainEditorTabController->view->getPrototype();
598 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
599 if (terrain ==
nullptr)
return;
601 auto outlinerNode = terrainEditorTabController->view->getEditorView()->getScreenController()->getOutlinerSelection();
602 auto foliageBrushIdx = -1;
603 auto foliageBrushPrototypeIdx = -1;
604 if (terrainEditorTabController->checkOutlinerFoliageBrushPrototype(outlinerNode, foliageBrushIdx, foliageBrushPrototypeIdx) ==
false)
return;
605 auto brush = terrain->getBrush(foliageBrushIdx);
606 if (brush ==
nullptr)
return;
607 auto brushPrototype = brush->getPrototype(foliageBrushPrototypeIdx);
608 brushPrototype->setFileName(
609 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getPathName() +
611 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getFileName()
614 required_dynamic_cast<GUIImageNode*>(terrainEditorTabController->screenNode->getNodeById(
"foliagebrush_prototype_file"))->setSource(brushPrototype->getFileName());
616 Console::println(
string(
"OnTerrainBrushPrototypeFileOpenAction::performAction(): ") + exception.what());
618 terrainEditorTabController->updateFoliageBrush();
619 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->close();
626 OnTerrainBrushPrototypeFileOpenAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
634 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
635 if (terrain ==
nullptr)
return;
638 auto foliageBrushIdx = -1;
639 auto foliageBrushPrototypeIdx = -1;
641 auto brush = terrain->getBrush(foliageBrushIdx);
642 if (brush ==
nullptr)
return;
643 auto brushPrototype = brush->getPrototype(foliageBrushPrototypeIdx);
644 if (brushPrototype ==
nullptr)
return;
646 vector<string> extensions = {
"tmodel"};
648 brushPrototype->getFileName().empty() ==
false?Tools::getPathName(brushPrototype->getFileName()):
string(),
649 "Load terrain brush texture from: ",
651 Tools::getFileName(brushPrototype->getFileName()),
653 new OnTerrainBrushPrototypeFileOpenAction(
this)
656 if (node->
getId() ==
"foliagebrush_prototype_file_remove") {
658 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
659 if (terrain ==
nullptr)
return;
662 auto foliageBrushIdx = -1;
663 auto foliageBrushPrototypeIdx = -1;
665 auto brush = terrain->getBrush(foliageBrushIdx);
666 if (brush ==
nullptr)
return;
667 auto brushPrototype = brush->getPrototype(foliageBrushPrototypeIdx);
668 if (brushPrototype ==
nullptr)
return;
669 brushPrototype->setFileName(
string());
672 required_dynamic_cast<GUIImageNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_file"))->setSource(brushPrototype->getFileName());
674 Console::println(
string(
"TerrainEditorTabController::onActionPerformed(): ") + exception.what());
677 if (node->
getId() ==
"terrainbrush_texture_open") {
678 class OnTerrainBrushFileOpenAction:
public virtual Action
681 void performAction()
override {
682 if (terrainEditorTabController->currentTerrainBrushTexture !=
nullptr) terrainEditorTabController->currentTerrainBrushTexture->releaseReference();
683 terrainEditorTabController->currentTerrainBrushTexture =
nullptr;
684 terrainEditorTabController->currentTerrainBrushTextureFileName =
685 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getPathName() +
687 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->getFileName();
688 terrainEditorTabController->currentTerrainBrushTexture =
690 Tools::getPathName(terrainEditorTabController->currentTerrainBrushTextureFileName),
691 Tools::getFileName(terrainEditorTabController->currentTerrainBrushTextureFileName),
695 required_dynamic_cast<GUITextureNode*>(terrainEditorTabController->screenNode->getNodeById(
"terrainbrush_texture"))->setTexture(terrainEditorTabController->currentTerrainBrushTexture);
696 terrainEditorTabController->view->setBrush(
697 terrainEditorTabController->currentTerrainBrushTexture,
698 terrainEditorTabController->currentTerrainBrushScale,
699 terrainEditorTabController->currentTerrainBrushStrength
701 terrainEditorTabController->view->getPopUps()->getFileDialogScreenController()->close();
708 OnTerrainBrushFileOpenAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
715 vector<string> extensions = TextureReader::getTextureExtensions();
718 "Load terrain brush texture from: ",
722 new OnTerrainBrushFileOpenAction(
this)
725 if (node->
getId() ==
"terrainbrush_texture_remove") {
730 if (node->
getId() ==
"terrainbrush_texture_browseto") {
732 if (node->
getId() ==
"terrain_mirrormode_apply") {
734 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
735 if (terrain ==
nullptr)
return;
736 auto mirrorMode = required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"terrain_mirrormode"))->getController()->getValue().getString();
737 auto flipped = required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"terrain_mirrormode_flipped"))->getController()->getValue().getString() ==
"1";
739 if (mirrorMode ==
"1") {
742 if (mirrorMode ==
"2") {
743 Terrain2::mirrorXAxis(
747 terrain->getHeightVector(),
748 terrain->getWaterPositionMapsHeight(),
749 terrain->getWaterPositionMaps(),
750 terrain->getFoliageMaps()
752 terrain->setWidth(terrain->getWidth() * 2.0f);
754 if (mirrorMode ==
"3") {
755 Terrain2::mirrorZAxis(
759 terrain->getHeightVector(),
760 terrain->getWaterPositionMapsHeight(),
761 terrain->getWaterPositionMaps(),
762 terrain->getFoliageMaps()
764 terrain->setDepth(terrain->getDepth() * 2.0f);
766 if (mirrorMode ==
"4") {
767 Terrain2::mirrorXAxis(
771 terrain->getHeightVector(),
772 terrain->getWaterPositionMapsHeight(),
773 terrain->getWaterPositionMaps(),
774 terrain->getFoliageMaps()
776 terrain->setWidth(terrain->getWidth() * 2.0f);
777 Terrain2::mirrorZAxis(
781 terrain->getHeightVector(),
782 terrain->getWaterPositionMapsHeight(),
783 terrain->getWaterPositionMaps(),
784 terrain->getFoliageMaps()
786 terrain->setDepth(terrain->getDepth() * 2.0f);
796 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
798 xml+=
"<selectbox-parent-option image=\"resources/engine/images/folder.png\" text=\"" + GUIParser::escapeQuotes(
"Terrain") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain") +
"\">\n";
800 xml+=
"<selectbox-option image=\"resources/engine/images/terrain.png\" text=\"" + GUIParser::escapeQuotes(
"Terrain Brush") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.brush") +
"\" />\n";
801 if (terrain !=
nullptr && terrain->getWaterPositionMapsIndices().empty() ==
false) {
802 xml+=
"<selectbox-parent-option image=\"resources/engine/images/terrain_water.png\" text=\"" + GUIParser::escapeQuotes(
"Water") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.waters") +
"\">\n";
804 for (
auto waterIdx: terrain->getWaterPositionMapsIndices()) {
805 xml+=
"<selectbox-option image=\"resources/engine/images/terrain_water.png\" text=\"" + GUIParser::escapeQuotes(
"Water " + to_string(i)) +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.waters." + to_string(waterIdx)) +
"\" />\n";
808 xml+=
"</selectbox-parent-option>\n";
810 xml+=
"<selectbox-option image=\"resources/engine/images/terrain_water.png\" text=\"" + GUIParser::escapeQuotes(
"Water") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.waters") +
"\" />\n";
812 if (terrain !=
nullptr && terrain->getBrushes().empty() ==
false) {
813 xml+=
"<selectbox-parent-option image=\"resources/engine/images/folder.png\" text=\"" + GUIParser::escapeQuotes(
"Foliage") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliage") +
"\">\n";
815 for (
auto brush: terrain->getBrushes()) {
816 if (brush->getPrototypes().empty() ==
false) {
817 xml+=
"<selectbox-parent-option image=\"resources/engine/images/foliage.png\" text=\"" + GUIParser::escapeQuotes(
"Foliage Brush " + to_string(i)) +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliage." + to_string(i)) +
"\" >\n";
819 for (
auto brushPrototype: brush->getPrototypes()) {
820 xml+=
"<selectbox-option image=\"resources/engine/images/mesh.png\" text=\"" + GUIParser::escapeQuotes(
"Prototype " + to_string(j)) +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliagebrushes." + to_string(i) +
"." + to_string(j)) +
"\" />\n";
823 xml+=
"</selectbox-parent-option>\n";
825 xml+=
"<selectbox-option image=\"resources/engine/images/foliage.png\" text=\"" + GUIParser::escapeQuotes(
"Foliage Brush " + to_string(i)) +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliage." + to_string(i)) +
"\" />\n";
829 xml+=
"</selectbox-parent-option>\n";
831 xml+=
"<selectbox-option image=\"resources/engine/images/folder.png\" text=\"" + GUIParser::escapeQuotes(
"Foliage") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliage") +
"\" />\n";
833 auto foliagePrototypeIndices = terrain !=
nullptr?terrain->getFoliagePrototypeIndices():vector<int>();
834 if (foliagePrototypeIndices.empty() ==
false) {
835 xml+=
"<selectbox-parent-option image=\"resources/engine/images/folder.png\" text=\"" + GUIParser::escapeQuotes(
"Prototypes") +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliageprototypes") +
"\">\n";
837 for (
auto prototypeIdx: foliagePrototypeIndices) {
838 auto foliagePrototype = terrain->getFoliagePrototype(prototypeIdx);
839 xml+=
"<selectbox-option image=\"resources/engine/images/mesh.png\" text=\"" + GUIParser::escapeQuotes(Tools::removeFileEnding(Tools::getFileName(foliagePrototype->getFileName()))) +
"\" value=\"" + GUIParser::escapeQuotes(
"terrain.foliageprototypes." + to_string(prototypeIdx)) +
"\" />\n";
842 xml+=
"</selectbox-parent-option>\n";
844 xml+=
"</selectbox-parent-option>\n";
854 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
855 if (terrain ==
nullptr)
return;
860 auto width = Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"terrain_size_x"))->getController()->getValue().getString());
861 auto depth = Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"terrain_size_z"))->getController()->getValue().getString());
862 if (width < 1.0f || width > 4000.0f)
throw ExceptionBase(
"Width must be within 1 .. 4000");
863 if (depth < 1.0f || depth > 4000.0f)
throw ExceptionBase(
"Depth must be within 1 .. 4000");
864 terrain->getHeightVector().clear();
865 for (
auto idx: terrain->getWaterPositionMapsIndices()) terrain->removeWaterPositionMap(idx);
867 vector<Model*> terrainModels;
868 Terrain2::createTerrainModels(width, depth, 0.0f, terrain->getHeightVector(), terrainBoundingBox, terrainModels);
869 Terrain2::createFoliageMaps(terrainBoundingBox, terrain->getFoliageMaps());
879 class ReloadOutlinerAction:
public Action {
881 void performAction()
override {
882 terrainEditorTabController->view->getEditorView()->reloadTabOutliner(
"terrain");
884 ReloadOutlinerAction(
TerrainEditorTabController* terrainEditorTabController): terrainEditorTabController(terrainEditorTabController) {
889 Engine::getInstance()->enqueueAction(
new ReloadOutlinerAction(
this));
901 auto foliageBrushIdx = -1;
902 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
903 foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
905 auto foliageBrushPrototypeIdx = -1;
909 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
910 if (terrain ==
nullptr)
return;
911 auto brush = terrain->
getBrush(foliageBrushIdx);
912 if (brush ==
nullptr)
return;
928 auto foliageBrushIdx = -1;
929 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
930 foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
932 auto foliageBrushPrototypeIdx = -1;
936 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
937 if (terrain ==
nullptr)
return;
938 auto brush = terrain->
getBrush(foliageBrushIdx);
939 if (brush ==
nullptr)
return;
948 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
949 if (terrain ==
nullptr)
return;
953 "<template id=\"details_terrain\" src=\"resources/engine/gui/template_details_terrain.xml\" />\n"
958 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_terrain"))->getActiveConditions().add(
"open");
962 Console::println(
string(
"TerrainEditorTabController::setTerrainDetails(): An error occurred: ") + exception.what());;
969 "<template id=\"details_terrainbrush\" src=\"resources/engine/gui/template_details_terrainbrush.xml\" />\n"
974 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_terrainbrush"))->getActiveConditions().add(
"open");
977 Console::println(
string(
"TerrainEditorTabController::setTerrainBrushDetails(): An error occurred: ") + exception.what());;
990 Console::println(
string(
"TerrainEditorTabController::updateTerrainBrushDetails(): An error occurred: ") + exception.what());;
1000 Console::println(
string(
"TerrainEditorTabController::setTerrainBrushDetails(): An error occurred: ") + exception.what());;
1009 "<template id=\"details_foliagebrush\" src=\"resources/engine/gui/template_details_foliagebrush.xml\" />\n"
1014 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_foliagebrush"))->getActiveConditions().add(
"open");
1016 Console::println(
string(
"TerrainEditorTabController::setFoliageBrushDetails(): An error occurred: ") + exception.what());;
1027 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
1028 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
1030 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
1031 if (terrain ==
nullptr)
return;
1032 auto brush = terrain->
getBrush(foliageBrushIdx);
1033 if (brush ==
nullptr)
return;
1037 required_dynamic_cast<GUIImageNode*>(
screenNode->
getNodeById(
"foliagebrush_texture"))->setSource(brush->getFileName());
1041 Console::println(
string(
"TerrainEditorTabController::updateFoliageBrushDetails(): An error occurred: ") + exception.what());
1049 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
false)
return;
1050 auto foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
1052 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
1053 if (terrain ==
nullptr)
return;
1054 auto brush = terrain->
getBrush(foliageBrushIdx);
1055 if (brush ==
nullptr)
return;
1059 brush->
setSize(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_size"))->getController()->getValue().getString()));
1060 brush->setDensity(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_density"))->getController()->getValue().getString()));
1062 Console::println(
string(
"TerrainEditorTabController::applyFoliageBrushDetails(): An error occurred: ") + exception.what());;
1069 "<template id=\"details_foliagebrush_prototype\" src=\"resources/engine/gui/template_details_foliagebrush_prototype.xml\" />\n"
1073 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
1074 if (terrain ==
nullptr)
return;
1077 auto foliageBrushIdx = -1;
1078 auto foliageBrushPrototypeIdx = -1;
1080 auto brush = terrain->getBrush(foliageBrushIdx);
1081 if (brush ==
nullptr)
return;
1082 auto brushPrototype = brush->getPrototype(foliageBrushPrototypeIdx);
1083 if (brushPrototype ==
nullptr)
return;
1087 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"details_foliagebrush_prototype"))->getActiveConditions().add(
"open");
1089 required_dynamic_cast<GUIImageNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_file"))->setSource(brushPrototype->getFileName());
1090 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_object_count"))->getController()->setValue(
MutableString(brushPrototype->getCount()));
1091 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_normalalign"))->getController()->setValue(
MutableString(brushPrototype->isNormalAlign() ==
true?
"1":
""));
1092 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_x_min"))->getController()->setValue(
MutableString(brushPrototype->getRotationXMin()));
1093 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_x_max"))->getController()->setValue(
MutableString(brushPrototype->getRotationXMax()));
1094 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_y_min"))->getController()->setValue(
MutableString(brushPrototype->getRotationYMin()));
1095 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_y_max"))->getController()->setValue(
MutableString(brushPrototype->getRotationYMax()));
1096 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_z_min"))->getController()->setValue(
MutableString(brushPrototype->getRotationZMin()));
1097 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_z_max"))->getController()->setValue(
MutableString(brushPrototype->getRotationZMax()));
1098 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_scalerange_min"))->getController()->setValue(
MutableString(brushPrototype->getScaleMin()));
1099 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_scalerange_max"))->getController()->setValue(
MutableString(brushPrototype->getScaleMax()));
1100 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_heightrange_min"))->getController()->setValue(
MutableString(brushPrototype->getHeightMin()));
1101 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_heightrange_max"))->getController()->setValue(
MutableString(brushPrototype->getHeightMax()));
1102 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_sloperange_min"))->getController()->setValue(
MutableString(brushPrototype->getSlopeMin()));
1103 required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_sloperange_max"))->getController()->setValue(
MutableString(brushPrototype->getSlopeMax()));
1105 Console::println(
string(
"TerrainEditorTabController::setFoliageBrushPrototypeDetails(): An error occurred: ") + exception.what());;
1112 auto terrain = prototype !=
nullptr?prototype->
getTerrain():
nullptr;
1113 if (terrain ==
nullptr)
return;
1116 auto foliageBrushIdx = -1;
1117 auto foliageBrushPrototypeIdx = -1;
1119 auto brush = terrain->getBrush(foliageBrushIdx);
1120 if (brush ==
nullptr)
return;
1121 auto brushPrototype = brush->getPrototype(foliageBrushPrototypeIdx);
1122 if (brushPrototype ==
nullptr)
return;
1125 brushPrototype->setCount(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_object_count"))->getController()->getValue().getString()));
1126 brushPrototype->setNormalAlign(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_normalalign"))->getController()->getValue().getString() ==
"1");
1127 brushPrototype->setRotationXMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_x_min"))->getController()->getValue().getString()));
1128 brushPrototype->setRotationXMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_x_max"))->getController()->getValue().getString()));
1129 brushPrototype->setRotationYMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_y_min"))->getController()->getValue().getString()));
1130 brushPrototype->setRotationYMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_y_max"))->getController()->getValue().getString()));
1131 brushPrototype->setRotationZMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_z_min"))->getController()->getValue().getString()));
1132 brushPrototype->setRotationZMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_rotationrange_z_max"))->getController()->getValue().getString()));
1133 brushPrototype->setScaleMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_scalerange_min"))->getController()->getValue().getString()));
1134 brushPrototype->setScaleMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_scalerange_max"))->getController()->getValue().getString()));
1135 brushPrototype->setHeightMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_heightrange_min"))->getController()->getValue().getString()));
1136 brushPrototype->setHeightMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_heightrange_max"))->getController()->getValue().getString()));
1137 brushPrototype->setSlopeMin(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_sloperange_min"))->getController()->getValue().getString()));
1138 brushPrototype->setSlopeMax(Float::parse(required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
"foliagebrush_prototype_sloperange_max"))->getController()->getValue().getString()));
1140 Console::println(
string(
"TerrainEditorTabController::applyFoliageBrushPrototypeDetails(): An error occurred: ") + exception.what());;
1146 if (StringTools::startsWith(outlinerNode,
"terrain.foliagebrushes.") ==
false)
return false;
1147 auto brushIdxBeginIdx = string(
"terrain.foliagebrushes.").size();
1148 auto brushIdxEndIdx = outlinerNode.find(
'.', brushIdxBeginIdx + 1);
1149 auto prototypeBeginIdx = brushIdxEndIdx + 1;
1150 auto prototypeEndIdx = outlinerNode.size();
1151 foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode, brushIdxBeginIdx, brushIdxEndIdx));
1152 foliageBrushPrototypeIdx = Integer::parse(StringTools::substring(outlinerNode, prototypeBeginIdx, prototypeEndIdx));
1158 if (outlinerNode ==
"terrain") {
1165 if (outlinerNode ==
"terrain.brush") {
1172 if (outlinerNode ==
"terrain.waters" || StringTools::startsWith(outlinerNode,
"terrain.waters.") ==
true) {
1178 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
1185 if (StringTools::startsWith(outlinerNode,
"terrain.foliagebrushes.") ==
true) {
1202 if (prototype ==
nullptr)
return;
1207 auto depth = prototype->getTerrain()->getDepth();
1209 vector<Model*> terrainModels;
1210 Terrain2::createTerrainModels(width, depth, 0.0f, prototype->getTerrain()->getHeightVector(), terrainBoundingBox, terrainModels);
1213 auto waterPositionMapsIndices = prototype->getTerrain()->getWaterPositionMapsIndices();
1214 for (
auto waterPositionMapIdx: waterPositionMapsIndices) {
1215 vector<Model*> waterModels;
1216 Terrain2::createWaterModels(
1218 prototype->getTerrain()->getWaterPositionMap(waterPositionMapIdx),
1219 prototype->getTerrain()->getWaterPositionMapHeight(waterPositionMapIdx),
1220 waterPositionMapIdx,
1224 waterPositionMapIdx,
1226 Terrain2::computeWaterReflectionEnvironmentMappingPosition(
1227 prototype->getTerrain()->getWaterPositionMap(waterPositionMapIdx),
1228 prototype->getTerrain()->getWaterPositionMapHeight(waterPositionMapIdx)
1243 if (prototype ==
nullptr)
return;
1244 if (terrainModels.empty() ==
true)
return;
1247 Terrain2::applyBrushToTerrainModels(
1250 prototype->getTerrain()->getHeightVector(),
1251 brushCenterPosition,
1267 Terrain2::updateFoliageTerrainBrush(
1269 prototype->getTerrain()->getHeightVector(),
1270 brushCenterPosition,
1272 prototype->getTerrain()->getFoliageMaps(),
1283 if (prototype ==
nullptr)
return false;
1290 if (terrainModels.empty() ==
true)
return false;
1291 auto terrainModel = terrainModels[0];
1292 if (terrainModel ==
nullptr)
return false;
1296 prototype->getTerrain()->getHeightVector(),
1297 brushCenterPosition,
1305 if (prototype ==
nullptr)
return false;
1309 if (terrainModels.empty() ==
true)
return false;
1310 auto terrainModel = terrainModels[0];
1311 if (terrainModel ==
nullptr)
return false;
1312 return Terrain2::getTerrainModelsHeight(
1315 prototype->getTerrain()->getHeightVector(),
1327 if (prototype ==
nullptr)
return;
1328 if (terrainModels.empty() ==
true)
return;
1331 Terrain2::applyRampBrushToTerrainModels(
1334 prototype->getTerrain()->getHeightVector(),
1344 Terrain2::updateFoliageTerrainRampBrush(
1346 prototype->getTerrain()->getHeightVector(),
1351 prototype->getTerrain()->getFoliageMaps(),
1362 if (prototype ==
nullptr)
return;
1365 if (Terrain2::computeWaterPositionMap(
1367 prototype->getTerrain()->getHeightVector(),
1368 brushCenterPosition,
1369 prototype->getTerrain()->getWaterPositionMapHeight(waterPositionMapIdx),
1370 prototype->getTerrain()->getWaterPositionMap(waterPositionMapIdx)) ==
true) {
1372 Terrain2::createWaterModels(
1374 prototype->getTerrain()->getWaterPositionMap(waterPositionMapIdx),
1375 prototype->getTerrain()->getWaterPositionMapHeight(waterPositionMapIdx),
1376 waterPositionMapIdx,
1379 waterReflectionEnvironmentMappingPosition = Terrain2::computeWaterReflectionEnvironmentMappingPosition(
1380 prototype->getTerrain()->getWaterPositionMap(waterPositionMapIdx),
1381 prototype->getTerrain()->getWaterPositionMapHeight(waterPositionMapIdx)
1384 waterPositionMapIdx,
1386 waterReflectionEnvironmentMappingPosition
1394 if (prototype ==
nullptr)
return;
1402 if (prototype ==
nullptr)
return;
1406 auto foliageBrushIdx = -1;
1407 auto foliageBrushPrototypeIdx = -1;
1409 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
1410 if (terrain ==
nullptr)
return;
1411 auto brush = terrain->getBrush(foliageBrushIdx);
1412 if (brush ==
nullptr)
return;
1415 auto foliageBrushTexture = TextureReader::read(Tools::getPathName(brush->getFileName()), Tools::getFileName(brush->getFileName()),
false,
false);
1416 if (foliageBrushTexture ==
nullptr)
return;
1419 view->
setBrush(foliageBrushTexture, brush->getSize(), brush->getDensity());
1424 if (prototype ==
nullptr)
return;
1428 auto foliageBrushIdx = -1;
1429 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
1430 foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
1432 auto foliageBrushPrototypeIdx = -1;
1437 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
1438 if (terrain ==
nullptr)
return;
1439 auto brush = terrain->getBrush(foliageBrushIdx);
1440 if (brush ==
nullptr)
return;
1446 foliageBrush.brushTexture = TextureReader::read(Tools::getPathName(brush->getFileName()), Tools::getFileName(brush->getFileName()),
false,
false);
1453 for (
auto foliageBrushPrototype: brush->getPrototypes()) {
1455 if (foliageBrushPrototype->getFileName().empty() ==
false) {
1457 foliagePrototype = PrototypeReader::read(
1458 PrototypeReader::getResourcePathName(Tools::getPathName(foliageBrushPrototype->getFileName()), foliageBrushPrototype->getFileName()),
1459 Tools::getFileName(foliageBrushPrototype->getFileName())
1462 Console::println(
"TerrainEditorTabController::updateFoliageBrush(): failed to load prototype: " + foliageBrushPrototype->getFileName());
1465 if (foliagePrototype ==
nullptr)
continue;
1468 .prototypeId = terrain->getFoliagePrototypeIndex(foliagePrototype),
1469 .count = foliageBrushPrototype->getCount(),
1470 .normalAlign = foliageBrushPrototype->isNormalAlign(),
1471 .rotationXMin = foliageBrushPrototype->getRotationXMin(),
1472 .rotationXMax = foliageBrushPrototype->getRotationXMax(),
1473 .rotationYMin = foliageBrushPrototype->getRotationYMin(),
1474 .rotationYMax = foliageBrushPrototype->getRotationYMax(),
1475 .rotationZMin = foliageBrushPrototype->getRotationZMin(),
1476 .rotationZMax = foliageBrushPrototype->getRotationZMax(),
1477 .scaleMin = foliageBrushPrototype->getScaleMin(),
1478 .scaleMax = foliageBrushPrototype->getScaleMax(),
1479 .heightMin = foliageBrushPrototype->getHeightMin(),
1480 .heightMax = foliageBrushPrototype->getHeightMax(),
1481 .slopeMin = foliageBrushPrototype->getSlopeMin(),
1482 .slopeMax = foliageBrushPrototype->getSlopeMax()
1493 if (prototype ==
nullptr)
return;
1497 auto foliageBrushIdx = -1;
1498 if (StringTools::startsWith(outlinerNode,
"terrain.foliage.") ==
true) {
1499 foliageBrushIdx = Integer::parse(StringTools::substring(outlinerNode,
string(
"terrain.foliage.").size(), outlinerNode.size()));
1501 auto foliageBrushPrototypeIdx = -1;
1504 auto terrain = prototype !=
nullptr?prototype->getTerrain():
nullptr;
1505 if (terrain ==
nullptr)
return;
1506 auto brush = terrain->getBrush(foliageBrushIdx);
1507 if (brush ==
nullptr)
return;
1511 auto haveBrushPrototypeIds =
false;
1513 if (foliageBrushPrototype.prototypeId != -1) haveBrushPrototypeIds =
true;
1515 if (haveBrushPrototypeIds ==
false)
return;
1520 case Terrain2::BRUSHOPERATION_ADD:
1522 Terrain2::applyFoliageDeleteBrush(
1524 brushCenterPosition,
1527 Terrain2::BRUSHOPERATION_DELETE,
1528 prototype->getTerrain()->getFoliageMaps(),
1532 Terrain2::applyFoliageBrush(
1534 prototype->getTerrain()->getHeightVector(),
1535 brushCenterPosition,
1539 prototype->getTerrain()->getFoliageMaps(),
1543 case Terrain2::BRUSHOPERATION_DELETE:
1545 Terrain2::applyFoliageDeleteBrush(
1547 brushCenterPosition,
1551 prototype->getTerrain()->getFoliageMaps(),
1568 return Terrain2::BRUSHOPERATION_ADD;
1570 if (required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
view->
getTabId() +
"_tab_terrain_substract"))->getController()->getValue().equals(
"1") ==
true) {
1571 return Terrain2::BRUSHOPERATION_SUBTRACT;
1573 if (required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
view->
getTabId() +
"_tab_terrain_flatten"))->getController()->getValue().equals(
"1") ==
true) {
1574 return Terrain2::BRUSHOPERATION_FLATTEN;
1576 if (required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
view->
getTabId() +
"_tab_terrain_smooth"))->getController()->getValue().equals(
"1") ==
true) {
1577 return Terrain2::BRUSHOPERATION_SMOOTH;
1580 return Terrain2::BRUSHOPERATION_RAMP;
1582 if (required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
view->
getTabId() +
"_tab_terrain_delete"))->getController()->getValue().equals(
"1") ==
true) {
1583 return Terrain2::BRUSHOPERATION_DELETE;
1585 return Terrain2::BRUSHOPERATION_NONE;
1591 return Terrain2::BRUSHOPERATION_WATER_ADD;
1594 return Terrain2::BRUSHOPERATION_WATER_DELETE;
1596 return Terrain2::BRUSHOPERATION_NONE;
1602 return Terrain2::BRUSHOPERATION_ADD;
1604 if (required_dynamic_cast<GUIElementNode*>(
screenNode->
getNodeById(
view->
getTabId() +
"_tab_foliage_delete"))->getController()->getValue().equals(
"1") ==
true) {
1605 return Terrain2::BRUSHOPERATION_DELETE;
1607 return Terrain2::BRUSHOPERATION_NONE;
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
const Vector3 & getDimensions() const
void setDensity(float density)
Set density.
void setFileName(const string &fileName)
Set texture file name.
void setSize(float size)
Set size.
Prototype terrain definition.
int allocateWaterPositionMapIdx()
void removeWaterPositionMap(int idx)
Remove water position map at given water position map index.
PrototypeTerrainBrush * getBrush(int idx)
Get prototype terrain brush.
PrototypeTerrain * getTerrain()
GUI node controller base class.
GUI parent node base class thats supporting child nodes.
GUI screen node that represents a screen that can be rendered via GUI system.
GUINode * getNodeById(const string &nodeId)
Get GUI node by id.
File system singleton class.
void releaseReference()
releases a reference, thus decrementing the counter and delete it if reference counter is zero
An attribute is a name-value pair.
Always the top level node.
The element is a container class.
std::exception Exception
Exception base class.