Heightmap editor + saving

This commit is contained in:
2025-12-07 01:31:25 +03:00
parent e0db570581
commit 44896ed0d9
13 changed files with 1901 additions and 172 deletions

View File

@@ -8,10 +8,12 @@
#include <OgreApplicationContext.h>
#include <OgreImGuiInputListener.h>
#include <OgreFontManager.h>
#include <OgreTerrainGroup.h>
#include "GameData.h"
#include "Components.h"
#include "LuaData.h"
#include "AppModule.h"
#include "TerrainModule.h"
#include "GUIModule.h"
namespace ECS
{
@@ -472,6 +474,9 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
bool enableMapEditor;
ImFont *smallFont, *midFont, *bigFont;
Ogre::FontPtr _smallFont, _midFont, _bigFont;
Ogre::TexturePtr worldMap;
Ogre::Image worldMapImage;
EditorGUIListener(Ogre::ImGuiOverlay *overlay)
: Ogre::RenderTargetListener()
{
@@ -488,13 +493,47 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
OgreAssert(midFont, "Could not load font");
bigFont = overlay->addFont("bigFont", "General");
OgreAssert(bigFont, "Could not load font");
worldMapImage.load(
"world_map.png",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
#if 0
Ogre::FontPtr _midFont = createFont("midFont", "General",
"Kenney Bold.ttf", 28.0f);
#endif
#if 0
ImGui::GetIO().Fonts->Build();
int x, y, i, j;
for (y = 0; y < worldMapImage.getWidth(); y++)
for (x = 0; x < worldMapImage.getWidth(); x++) {
float r = 0.0f;
for (i = -2; i < 3; i++)
for (j = -2; j < 3; j++) {
int xj = Ogre::Math::Clamp(
x + j, 0,
(int)worldMapImage
.getWidth() -
1);
int yi = Ogre::Math::Clamp(
y + i, 0,
(int)worldMapImage
.getHeight() -
1);
r += worldMapImage
.getColourAt(xj,
yi, 0)
.r;
}
r /= 25.0f;
Ogre::ColourValue cv =
worldMapImage.getColourAt(x, y, 0);
cv.r = r;
worldMapImage.setColourAt(cv, x, y, 0);
}
#endif
worldMap = Ogre::TextureManager::getSingleton().createManual(
"worldMap",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, worldMapImage.getWidth(),
worldMapImage.getHeight(),
worldMapImage.getNumMipmaps(),
worldMapImage.getFormat(), Ogre::TU_DYNAMIC_WRITE_ONLY);
worldMap->loadImage(worldMapImage);
OgreAssert(worldMap, "could not load world map");
}
Ogre::FontPtr createFont(const Ogre::String &name,
const Ogre::String &group,
@@ -533,6 +572,7 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
Ogre::Root::getSingleton().queueEndRendering();
if (ImGui::Button("Return"))
ECS::get().get<GUI>().finish();
#if 0
if (ImGui::Button("Enable/Disable item editor")) {
enableEditor ^= true;
if (enableEditor)
@@ -544,6 +584,8 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
enableEditor = false;
}
ImGui::Text("Text message...");
#endif
ImGui::Checkbox("Enable Map", &enableMapEditor);
ImGui::End();
}
void create_entity_node(const Ogre::String &name, int key)
@@ -573,6 +615,7 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
ECS::get().get<GUI>().finish();
}
#if 0
void buildings_editor()
{
int i;
@@ -602,6 +645,7 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
}
ImGui::End();
}
#endif
void position_editor(Ogre::SceneNode *node)
{
Ogre::Vector3 position = node->getPosition();
@@ -642,124 +686,561 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
ImGui::Text("Name: %s", pname.c_str());
}
}
#if 0
void map_editor()
{
}
void preview(const Ogre::RenderTargetViewportEvent &evt)
#endif
int pos_x = 0;
int pos_y = 0;
int top_x = 0;
int top_y = 0;
int selected_x = 0;
int selected_y = 0;
bool locationSelected = false;
float strength = 0.0f;
int size = 0;
void updateWorldTexture()
{
int i;
Ogre::ImGuiOverlay::NewFrame();
std::cout << "GUI enabled: " << ECS::get().get<GUI>().enabled
<< std::endl;
if (ECS::get().get<GUI>().enabled) {
buttons_panel();
buildings_editor();
map_editor();
ImVec2 size = ImGui::GetMainViewport()->Size;
float window_width = size.x * 0.2f;
if (window_width > panel_width)
window_width = panel_width;
float window_height = size.y * 0.5f - 20;
ImGui::SetNextWindowPos(ImVec2(size.x - window_width,
size.y * 0.5f + 20),
ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(window_width,
window_height),
ImGuiCond_Always);
// ImGui::Begin("Dumb and Stupid", &mKbd.gui_active);
ImGui::Begin("Panel...");
std::deque<Ogre::SceneNode *> tree_input_queue,
tree_output_queue;
std::vector<Ogre::SceneNode *> tree_list;
tree_input_queue.push_back(
ECS::get()
.get<EngineData>()
.mScnMgr->getRootSceneNode());
tree_input_queue.push_back(nullptr);
std::set<Ogre::SceneNode *> visited;
while (true) {
int new_nodes_count = 0;
while (!tree_input_queue.empty()) {
int child;
Ogre::SceneNode *item =
tree_input_queue.front();
tree_input_queue.pop_front();
if (item &&
visited.find(item) ==
visited.end()) { // new node
new_nodes_count++;
tree_output_queue.push_back(
item);
visited.insert(item);
const Ogre::Node::ChildNodeMap
&children =
item->getChildren();
for (child = 0;
child < children.size();
child++) {
tree_output_queue.push_back(
static_cast<
Ogre::SceneNode
*>(
children[child]));
tree_output_queue
.push_back(
nullptr);
}
} else
tree_output_queue.push_back(
item);
}
if (new_nodes_count == 0)
break;
tree_input_queue = tree_output_queue;
tree_output_queue.clear();
}
tree_list.insert(tree_list.begin(),
tree_output_queue.begin(),
tree_output_queue.end());
int count = 0;
int depth = 0;
std::vector<int> check_depth;
int max_depth = 0;
check_depth.push_back(0);
for (count = 0; count < tree_list.size(); count++) {
int t;
// Get the hardware pixel buffer
Ogre::HardwarePixelBufferSharedPtr pixelBuffer =
worldMap->getBuffer();
Ogre::SceneNode *node = tree_list[count];
if (node && max_depth >= depth) {
Ogre::String name = node->getName();
if (name.length() == 0) {
name = "Node #" +
Ogre::StringConverter::
toString(count);
}
if (ImGui::TreeNode(name.c_str())) {
check_depth.push_back(
max_depth);
max_depth++;
ImGui::Text("%s",
(name + "##caption")
.c_str());
position_editor(node);
ImGui::Separator();
orientation_editor(node);
ImGui::Separator();
ImGui::Text("Attachments");
attachments_editor(node);
}
} else if (!node && max_depth >= depth) {
max_depth = check_depth.back();
check_depth.pop_back();
ImGui::TreePop();
// Lock the buffer for writing, discarding previous contents for performance
pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD);
// Get information about the locked region (PixelBox)
const Ogre::PixelBox &pixelBox = pixelBuffer->getCurrentLock();
// Ensure the image format matches the texture format
OgreAssert(pixelBox.format == worldMapImage.getFormat(),
"bad format");
// Copy the image data to the pixel box's data pointer
memcpy(pixelBox.data, worldMapImage.getData(),
worldMapImage.getSize());
// Unlock the buffer to apply changes to the GPU
pixelBuffer->unlock();
}
void updateHeightmap()
{
Ogre::Vector3 worldPos =
ECS::get<Camera>().mCameraPivot->_getDerivedPosition();
TerrainModule::update_heightmap(worldMapImage);
long x, y;
ECS::get<Terrain>()
.mTerrainGroup->convertWorldPositionToTerrainSlot(
worldPos, &x, &y);
int i, j;
for (j = -1; j < 2; j++)
for (i = -1; i < 2; i++) {
Ogre::Terrain *terrain =
ECS::get<Terrain>()
.mTerrainGroup->getTerrain(
x + j, y + i);
if (terrain && terrain->isLoaded()) {
terrain->dirty();
terrain->updateDerivedData(true);
terrain->updateGeometry();
}
if (tree_list[count])
depth++;
else
depth--;
}
ImGui::Spacing();
ImGui::End();
ECS::get<Terrain>().mTerrainGroup->updateDerivedData(true);
ECS::get<Terrain>().mTerrainGroup->updateGeometry();
ECS::get<Terrain>().mTerrainGroup->update(true);
}
void setCameraPos()
{
Ogre::Vector3 worldPos =
ECS::get<Camera>().mCameraPivot->_getDerivedPosition();
worldPos.x = TerrainModule::get_world_x(selected_x);
worldPos.z = TerrainModule::get_world_y(selected_y);
Ogre::Vector3 cameraPos =
ECS::get<Camera>().mCameraPivot->_getDerivedPosition();
cameraPos.x = worldPos.x;
cameraPos.z = worldPos.z;
cameraPos.y =
TerrainModule::get_height(
ECS::get<Terrain>().mTerrainGroup, cameraPos) +
10.0f;
if (cameraPos.y < 0.0f)
cameraPos.y = 10.0f;
ECS::get<Camera>().mCameraPivot->_setDerivedPosition(cameraPos);
cameraPos =
ECS::get<Camera>().mCameraGoal->_getDerivedPosition();
ECS::get<Camera>().mCameraNode->_setDerivedPosition(cameraPos);
std::cout << cameraPos << std::endl;
std::cout << worldPos << std::endl;
std::cout << selected_x << " " << selected_y << std::endl;
ECS::get<Terrain>().mTerrainGroup->updateDerivedData(true);
ECS::get<Terrain>().mTerrainGroup->updateGeometry();
ECS::get<Terrain>().mTerrainGroup->update(true);
}
void worldMapView()
{
OgreAssert(TerrainModule::get_img_x(0) ==
worldMap->getWidth() / 2,
"get_img_x");
OgreAssert(TerrainModule::get_img_y(0) ==
worldMap->getHeight() / 2,
"get_img_x");
OgreAssert(TerrainModule::get_world_x(worldMap->getWidth() /
2) == 0.0f,
"get_world_x");
OgreAssert(TerrainModule::get_world_y(worldMap->getHeight() /
2) == 0.0f,
"get_world_y");
if (ECS::get<Camera>().mCameraPivot) {
Ogre::Vector3 worldPos =
ECS::get<Camera>()
.mCameraPivot->_getDerivedPosition();
selected_x = TerrainModule::get_img_x(worldPos.x);
selected_y = TerrainModule::get_img_y(worldPos.z);
locationSelected = true;
std::cout << worldPos << std::endl;
std::cout << selected_x << " " << selected_y
<< std::endl;
OgreAssert(selected_x >= 0 &&
selected_x < worldMap->getWidth(),
"mix width");
OgreAssert(selected_y >= 0 &&
selected_y < worldMap->getHeight(),
"mix height");
}
ImGui::SetNextWindowSizeConstraints(ImVec2(512 + 20, 512 + 20),
ImVec2(768, 768));
// ImGui::SetNextWindowScroll(
// ImVec2(worldMap->getWidth(), worldMap->getHeight()));
ImGui::Begin("WorldMap...");
ImGui::Spacing();
ImGui::BeginChild("WorldMap...", ImVec2(480, 480),
ImGuiChildFlags_None,
ImGuiWindowFlags_HorizontalScrollbar);
ImGui::Spacing();
Ogre::ResourceHandle hdl = worldMap->getHandle();
int w = worldMap->getWidth();
int h = worldMap->getHeight();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,
ImVec2((float)5, (float)5));
ImGui::ImageButton("WorldMapPress", (ImTextureID)hdl,
ImVec2(w, h));
ImVec2 mouse_absolute_pos = ImGui::GetMousePos();
ImVec2 item_absolute_pos = ImGui::GetItemRectMin();
top_x = item_absolute_pos.x + 5;
top_y = item_absolute_pos.y + 5;
bool hovered = false;
#if 0
pos_x = mouse_absolute_pos.x - item_absolute_pos.x - 5;
pos_y = mouse_absolute_pos.y - item_absolute_pos.y - 5;
#endif
if (ImGui::IsItemHovered()) {
ImVec2 mouse_absolute_pos = ImGui::GetMousePos();
ImVec2 item_absolute_pos = ImGui::GetItemRectMin();
pos_x = mouse_absolute_pos.x - item_absolute_pos.x - 5;
pos_y = mouse_absolute_pos.y - item_absolute_pos.y - 5;
hovered = true;
}
pos_x = Ogre::Math::Clamp(pos_x, 0,
(int)worldMap->getWidth() - 1);
pos_y = Ogre::Math::Clamp(pos_y, 0,
(int)worldMap->getHeight() - 1);
if (pos_x < 0)
pos_x = 0;
if (pos_x >= worldMap->getWidth())
pos_x = worldMap->getWidth() - 1;
if (pos_y < 0)
pos_y = 0;
if (pos_y >= worldMap->getHeight())
pos_y = worldMap->getHeight() - 1;
if (ImGui::IsItemActivated()) {
locationSelected = true;
selected_x = pos_x;
selected_y = pos_y;
OgreAssert(selected_x >= 0 &&
selected_x < worldMap->getWidth(),
"mix width");
OgreAssert(selected_y >= 0 &&
selected_y < worldMap->getHeight(),
"mix height");
setCameraPos();
std::cout << "worldClickPos: " << pos_x << " " << pos_y
<< std::endl;
}
ImDrawList *draw_list = ImGui::GetWindowDrawList();
draw_list->AddCircleFilled(ImVec2(top_x + pos_x, top_y + pos_y),
1.0f, IM_COL32(0, 255, 0, 255));
if (locationSelected)
draw_list->AddCircleFilled(
ImVec2(top_x + selected_x, top_y + selected_y),
4.0f, IM_COL32(64, 255, 64, 255));
ImGui::PopStyleVar();
ImGui::Spacing();
ImGui::EndChild();
ImGui::SameLine();
ImGui::BeginChild("WorldMap...", ImVec2(64, 480),
ImGuiChildFlags_None,
ImGuiWindowFlags_HorizontalScrollbar);
ImGui::EndChild();
ImGui::Spacing();
ImGui::BeginChild("WorldMap Bottom...", ImVec2(0, 0));
ImGui::Text("Position: %d %d", pos_x, pos_y);
ImGui::Text("Selected Position: %d %d", selected_x, selected_y);
ImGui::Text("Height: %f",
worldMapImage.getColourAt(pos_x, pos_y, 0).r);
ImGui::Text(
"Selected height: %f",
worldMapImage.getColourAt(selected_x, selected_y, 0).r);
if (ImGui::Button("Update terrain")) {
ECS::get<Terrain>().mTerrainGroup->update(true);
ECS::get<Terrain>().mTerrainGroup->updateDerivedData(
true);
ECS::get<Terrain>().mTerrainGroup->updateGeometry();
}
ImGui::SliderFloat("Strength...", &strength, 0.0f, 0.2f);
ImGui::SliderInt("Size", &size, 0, 8);
bool riseLower = false;
bool riseLower2 = false;
bool smooth = false;
bool setLevel = false;
float setLevelValue = 0.0f;
float riseLowerChange = 0.0f;
if (ImGui::Button("Elevate")) {
riseLower = true;
riseLowerChange = strength;
}
ImGui::SameLine();
if (ImGui::Button("Lower")) {
riseLower = true;
riseLowerChange = -strength;
}
ImGui::SameLine();
if (ImGui::Button("Smooth")) {
smooth = true;
}
ImGui::SameLine();
if (ImGui::Button("Elevate2")) {
riseLower2 = true;
riseLowerChange = strength;
}
if (ImGui::Button("Deepest")) {
setLevel = true;
setLevelValue = 0.0f;
}
ImGui::SameLine();
if (ImGui::Button("Highest")) {
setLevel = true;
setLevelValue = 1.0f;
}
ImGui::SameLine();
if (ImGui::Button("Beach")) {
setLevel = true;
setLevelValue = 0.516f;
}
if (ImGui::Button("Shore1")) {
setLevel = true;
setLevelValue = 0.536f;
}
ImGui::SameLine();
if (ImGui::Button("Shore2")) {
setLevel = true;
setLevelValue = 0.556f;
}
ImGui::SameLine();
if (ImGui::Button("Shore3")) {
setLevel = true;
setLevelValue = 0.586f;
}
ImGui::SameLine();
if (ImGui::Button("Shore4")) {
setLevel = true;
setLevelValue = 0.606f;
}
if (ImGui::Button("Shore5")) {
setLevel = true;
setLevelValue = 0.626f;
}
ImGui::SameLine();
if (ImGui::Button("Shore6")) {
setLevel = true;
setLevelValue = 0.646f;
}
if (riseLower) {
int actualSize = 1 + size * 2;
int i, j;
for (i = -actualSize; i < actualSize + 1; i++)
for (j = -actualSize; j < actualSize + 1; j++) {
if (i * i + j * j >
actualSize * actualSize)
continue;
if (selected_x + j < 0 ||
selected_x + j >=
worldMap->getWidth())
continue;
if (selected_y + i < 0 ||
selected_y + i >=
worldMap->getHeight())
continue;
Ogre::ColourValue cv =
worldMapImage.getColourAt(
selected_x + j,
selected_y + i, 0);
float original = cv.r;
original += riseLowerChange;
original = Ogre::Math::Clamp(
original, 0.0f, 1.0f);
cv.r = original;
worldMapImage.setColourAt(
cv, selected_x + j,
selected_y + i, 0);
}
updateWorldTexture();
updateHeightmap();
}
if (riseLower2) {
int actualSize = 1 + size * 2;
int i, j;
Ogre::ColourValue maxcv = worldMapImage.getColourAt(
selected_x, selected_y, 0);
for (i = -actualSize; i < actualSize + 1; i++)
for (j = -actualSize; j < actualSize + 1; j++) {
if (i * i + j * j >
actualSize * actualSize)
continue;
if (selected_x + j < 0 ||
selected_x + j >=
worldMap->getWidth())
continue;
if (selected_y + i < 0 ||
selected_y + i >=
worldMap->getHeight())
continue;
float actualStrength =
riseLowerChange /
(1.0f + (float)(i * i + j * j));
if (i * i + j * j ==
actualSize * actualSize) {
std::cout << actualStrength
<< std::endl;
// OgreAssert(false, "strength");
}
Ogre::ColourValue cv =
worldMapImage.getColourAt(
selected_x + j,
selected_y + i, 0);
float original =
maxcv.r + actualStrength;
original = Ogre::Math::Clamp(
original, 0.0f, 1.0f);
if (cv.r >= original)
continue;
cv.r = original;
worldMapImage.setColourAt(
cv, selected_x + j,
selected_y + i, 0);
}
updateWorldTexture();
updateHeightmap();
}
if (smooth) {
int actualSize = 1 + size * 2;
int i, j, k, l;
for (i = -actualSize; i < actualSize + 1; i++)
for (j = -actualSize; j < actualSize + 1; j++) {
if (i * i + j * j >
actualSize * actualSize)
continue;
if (selected_x + j < 0 ||
selected_x + j >=
worldMap->getWidth())
continue;
if (selected_y + i < 0 ||
selected_y + i >=
worldMap->getHeight())
continue;
int kernel = 3;
float original = 0.0f;
Ogre::ColourValue cv;
float count = 0.0f;
for (k = -kernel; k < kernel + 1; k++) {
if (selected_y + i + k < 0 ||
selected_y + i + k >=
worldMap->getHeight())
continue;
for (l = -kernel;
l < kernel + 1; l++) {
if (selected_x + j + l <
0 ||
selected_x + j +
l >=
worldMap->getWidth())
continue;
cv = worldMapImage.getColourAt(
selected_x + j,
selected_y + i,
0);
original += cv.r;
count += 1.0f;
}
}
original /= count;
cv = worldMapImage.getColourAt(
selected_x + j, selected_y + i,
0);
original = Ogre::Math::Clamp(
original, 0.0f, 1.0f);
cv.r = original;
worldMapImage.setColourAt(
cv, selected_x + j,
selected_y + i, 0);
}
updateWorldTexture();
updateHeightmap();
}
if (setLevel) {
int actualSize = 1 + size * 2;
int i, j;
float original = setLevelValue;
original = Ogre::Math::Clamp(original, 0.0f, 1.0f);
for (i = -actualSize; i < actualSize + 1; i++)
for (j = -actualSize; j < actualSize + 1; j++) {
if (i * i + j * j >
actualSize * actualSize)
continue;
if (selected_x + j < 0 ||
selected_x + j >=
worldMap->getWidth())
continue;
if (selected_y + i < 0 ||
selected_y + i >=
worldMap->getHeight())
continue;
Ogre::ColourValue cv =
worldMapImage.getColourAt(
selected_x + j,
selected_y + i, 0);
cv.r = original;
worldMapImage.setColourAt(
cv, selected_x + j,
selected_y + i, 0);
}
updateWorldTexture();
updateHeightmap();
}
if (ImGui::Button("Save heightmap")) {
updateWorldTexture();
updateHeightmap();
TerrainModule::save_heightmap();
}
ImGui::EndChild();
ImGui::Spacing();
ImGui::End();
}
void panel()
{
ImVec2 size = ImGui::GetMainViewport()->Size;
float window_width = size.x * 0.2f;
if (window_width > panel_width)
window_width = panel_width;
float window_height = size.y * 0.5f - 20;
ImGui::SetNextWindowPos(ImVec2(size.x - window_width, 20),
ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(window_width, window_height),
ImGuiCond_Always);
// ImGui::Begin("Dumb and Stupid", &mKbd.gui_active);
ImGui::Begin("Panel...");
std::deque<Ogre::SceneNode *> tree_input_queue,
tree_output_queue;
std::vector<Ogre::SceneNode *> tree_list;
tree_input_queue.push_back(
ECS::get()
.get<EngineData>()
.mScnMgr->getRootSceneNode());
tree_input_queue.push_back(nullptr);
std::set<Ogre::SceneNode *> visited;
while (true) {
int new_nodes_count = 0;
while (!tree_input_queue.empty()) {
int child;
Ogre::SceneNode *item =
tree_input_queue.front();
tree_input_queue.pop_front();
if (item && visited.find(item) ==
visited.end()) { // new node
new_nodes_count++;
tree_output_queue.push_back(item);
visited.insert(item);
const Ogre::Node::ChildNodeMap
&children = item->getChildren();
for (child = 0; child < children.size();
child++) {
tree_output_queue.push_back(
static_cast<Ogre::SceneNode
*>(
children[child]));
tree_output_queue.push_back(
nullptr);
}
} else
tree_output_queue.push_back(item);
}
if (new_nodes_count == 0)
break;
tree_input_queue = tree_output_queue;
tree_output_queue.clear();
}
tree_list.insert(tree_list.begin(), tree_output_queue.begin(),
tree_output_queue.end());
int count = 0;
int depth = 0;
std::vector<int> check_depth;
int max_depth = 0;
check_depth.push_back(0);
for (count = 0; count < tree_list.size(); count++) {
int t;
Ogre::SceneNode *node = tree_list[count];
if (node && max_depth >= depth) {
Ogre::String name = node->getName();
if (name.length() == 0) {
name = "Node #" +
Ogre::StringConverter::toString(
count);
}
if (ImGui::TreeNode(name.c_str())) {
check_depth.push_back(max_depth);
max_depth++;
ImGui::Text(
"%s",
(name + "##caption").c_str());
position_editor(node);
ImGui::Separator();
orientation_editor(node);
ImGui::Separator();
if (ImGui::Button("From Cursor"))
std::cout << name
<< " From Cursor"
<< std::endl;
if (ImGui::Button("To Cursor"))
std::cout << name
<< " To Cursor"
<< std::endl;
ImGui::Separator();
ImGui::Text("Attachments");
attachments_editor(node);
}
} else if (!node && max_depth >= depth) {
max_depth = check_depth.back();
check_depth.pop_back();
ImGui::TreePop();
}
if (tree_list[count])
depth++;
else
depth--;
}
ImGui::Spacing();
ImGui::End();
#if 0
if (ECS::get().get<GUI>().narrationBox) {
ImVec2 size = ImGui::GetMainViewport()->Size;
@@ -990,6 +1471,20 @@ struct EditorGUIListener : public Ogre::RenderTargetListener {
ImGui::End();
}
#endif
}
void preview(const Ogre::RenderTargetViewportEvent &evt)
{
int i;
Ogre::ImGuiOverlay::NewFrame();
if (ECS::get().get<GUI>().enabled) {
buttons_panel();
#if 0
buildings_editor();
map_editor();
#endif
panel();
if (enableMapEditor)
worldMapView();
}
}
};