This commit is contained in:
2025-09-05 22:56:48 +03:00
parent 25816c5658
commit 92ec3e9497
17 changed files with 1320 additions and 453 deletions

View File

@@ -1,6 +1,7 @@
#include <iostream>
#include <Ogre.h>
#include <OgreBullet.h>
#include <OgreApplicationContext.h>
#include <OgreOverlaySystem.h>
#include <OgreOverlayManager.h>
@@ -9,8 +10,8 @@
#include <OgreTrays.h>
#include <OgreTimer.h>
#include <OgreMeshLodGenerator.h>
#include <OgreTerrain.h>
#include "src/terrain/terrain.h"
#include "water/water.h"
class App;
class SkyRenderer : public Ogre::SceneManager::Listener {
@@ -250,10 +251,8 @@ class App : public OgreBites::ApplicationContext {
Ogre::Camera *mCamera;
Ogre::Real mPivotPitch;
Ogre::SceneManager *mScnMgr;
OgreBites::InputListenerChain mInput;
Ogre::Viewport *mViewport;
EditUI m_edit_ui;
TerrainSetup m_terrain;
Ogre::Light *mSun;
SkyBoxRenderer *sky;
Water m_water;
@@ -379,7 +378,6 @@ public:
, m_edit_ui(this)
, mDynWorld(new Ogre::Bullet::DynamicsWorld(
Ogre::Vector3(0, -9.8, 0)))
, m_terrain(mDynWorld->getBtWorld())
{
}
virtual ~App()
@@ -467,7 +465,6 @@ public:
std::cout << "Create content" << "\n";
createContent();
std::cout << "Setup terrain" << "\n";
setupTerrain();
m_water.init();
}
void setupCursor()
@@ -514,6 +511,7 @@ public:
}
void updateMotion(float delta)
{
#if 0
if (delta == 0.0f)
return;
Ogre::Vector3 move(mCameraNode->getOrientation().zAxis() *
@@ -536,6 +534,7 @@ public:
// mKbd.motion = Ogre::Vector3(0, 0, 0);
// if (move.squaredLength() > 0)
// std::cout << move << "\n";
#endif
}
void updateCamera(Ogre::Real delta)
{
@@ -582,10 +581,12 @@ public:
mCameraGoal->translate(0, 0, distChange,
Ogre::Node::TS_LOCAL);
Ogre::Vector3 mh = mCameraGoal->_getDerivedPosition();
#if 0
float h = m_terrain.get_height(mh);
if (h + 10 > mh.y)
mCameraGoal->translate(0, 10.0f * deltaZoom, distChange,
Ogre::Node::TS_LOCAL);
#endif
}
Ogre::SceneNode *mSunGoal;
Ogre::SceneNode *mSunNode;
@@ -659,9 +660,6 @@ public:
m_edit_ui.init_glb_list();
m_edit_ui.initGui();
createSun();
mInput = OgreBites::InputListenerChain(
{ getImGuiInputListener(), &mKbd });
addInputListener(&mInput);
getRoot()->addFrameListener(&mKbd);
// mTrayMgr->showCursor();
@@ -717,11 +715,6 @@ public:
{
return mCamera;
}
void setupTerrain()
{
m_terrain.setupTerrain(mCamera, mSun, mDynWorld.get(),
mDbgDraw.get());
}
};
void EditUI::buildings_editor()