Building interior walls created with editor

This commit is contained in:
2026-01-02 01:41:58 +03:00
parent d6d61229f8
commit 49fc547295
8 changed files with 1733 additions and 205 deletions

View File

@@ -360,7 +360,7 @@ class App : public OgreBites::ApplicationContext {
SkyBoxRenderer *sky;
bool mGrab;
KeyboardListener mKbd;
SceneData mEditorNormalScene, mEditorAltScene;
SceneData mEditorNormalScene;
public:
App()
@@ -377,7 +377,6 @@ public:
OgreBites::ApplicationContext::setup();
Ogre::Root *root = getRoot();
mEditorNormalScene.setup(root, getOverlaySystem());
mEditorAltScene.setup(root, getOverlaySystem());
}
bool isWindowGrab()
{
@@ -407,7 +406,6 @@ public:
{
// and tell it to render into the main window
mEditorNormalScene.initCamera("fps_camera");
mEditorNormalScene.initCamera("alt_camera");
mViewport = getRenderWindow()->addViewport(
mEditorNormalScene.mCamera);
}
@@ -420,7 +418,6 @@ public:
<< "\n";
Ogre::Root *root = getRoot();
mEditorNormalScene.setupRTSS();
mEditorAltScene.setupRTSS();
setWindowGrab(false);
std::cout << "Init camera"
<< "\n";
@@ -455,26 +452,6 @@ public:
ECS::get().modified<ECS::GUI>();
}
ECS::update(delta);
#if 0
if (switchWindow) {
int scene = ECS::get<ECS::EditorSceneSwitch>().scene;
mEditorNormalScene.mScnMgr->removeRenderQueueListener(
getOverlaySystem());
mEditorAltScene.mScnMgr->removeRenderQueueListener(
getOverlaySystem());
mViewport->setOverlaysEnabled(false);
if (scene == 0)
mViewport->setCamera(
mEditorNormalScene.mCamera);
else if (scene == 1)
mViewport->setCamera(mEditorAltScene.mCamera);
mViewport->setOverlaysEnabled(true);
mEditorNormalScene.mScnMgr->addRenderQueueListener(
getOverlaySystem());
mEditorAltScene.mScnMgr->addRenderQueueListener(
getOverlaySystem());
}
#endif
}
class InputListenerChainFlexible : public OgreBites::InputListener {
protected:
@@ -632,10 +609,6 @@ public:
mEditorNormalScene.mScnMgr,
/*mDynWorld.get(), */ mEditorNormalScene.mCameraNode,
mEditorNormalScene.mCamera, getRenderWindow());
ECS::setupEditorAlt(
mEditorAltScene.mScnMgr,
/*mDynWorld.get(), */ mEditorAltScene.mCameraNode,
mEditorAltScene.mCamera, getRenderWindow());
ECS::get().import <ECS::EditorGizmoModule>();
ECS::get().import <ECS::EditorInputModule>();
ECS::get().set<ECS::RenderWindow>(
@@ -667,14 +640,6 @@ public:
nullptr,
{ getImGuiInputListener(), &mKbd } });
ECS::get().add<ECS::EditorDebugMaterial>();
#if 0
ECS::get()
.observer<ECS::EditorSceneSwitch>("UpdateEditorScene")
.event(flecs::OnSet)
.each([&](ECS::EditorSceneSwitch &sw) {
switchWindow = true;
});
#endif
std::shared_ptr<Ogre::ManualObject> manualObj(
mEditorNormalScene.mScnMgr->createManualObject(
"EditorGizmo"));
@@ -684,79 +649,6 @@ public:
gizmoNode->attachObject(manualObj.get());
manualObj->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY);
ECS::get().set<ECS::EditorGizmo>({ manualObj, gizmoNode });
#if 0
ECS::get()
.system<const ECS::EngineData, ECS::Camera,
const ECS::Input>("UpdateEditorCamera")
.kind(flecs::OnUpdate)
.each([&](const ECS::EngineData &eng,
ECS::Camera &camera,
const ECS::Input &input) {
if (!camera.configured) {
// create a pivot at roughly the character's shoulder
camera.mCameraPivot =
eng.mScnMgr->getRootSceneNode()
->createChildSceneNode();
camera.mCameraGoal =
camera.mCameraPivot
->createChildSceneNode(
Ogre::Vector3(
0, 2,
0));
camera.mCameraNode->setPosition(
camera.mCameraPivot
->getPosition() +
camera.mCameraGoal
->getPosition());
camera.mCameraGoal->lookAt(
Ogre::Vector3(0, 0, -10),
Ogre::Node::TS_PARENT);
camera.mCameraPivot->setFixedYawAxis(
true);
camera.mCameraGoal->setFixedYawAxis(
true);
camera.mCameraNode->setFixedYawAxis(
true);
// our model is quite small, so reduce the clipping planes
camera.mCamera->setNearClipDistance(
0.1f);
camera.mCamera->setFarClipDistance(700);
camera.mPivotPitch = 0;
camera.configured = true;
} else {
// place the camera pivot roughly at the character's shoulder
#if 0
camera.mCameraPivot->setPosition(
ch.mBodyNode->getPosition() +
Ogre::Vector3::UNIT_Y * CAM_HEIGHT);
#endif
// move the camera smoothly to the goal
Ogre::Vector3 goalOffset =
camera.mCameraGoal
->_getDerivedPosition() -
camera.mCameraNode
->getPosition();
camera.mCameraNode->translate(
goalOffset * eng.delta * 9.0f);
// always look at the pivot
#if 0
camera.mCameraNode->lookAt(
camera.mCameraPivot
->_getDerivedPosition(),
Ogre::Node::TS_PARENT);
#endif
camera.mCameraNode->_setDerivedOrientation(
camera.mCameraGoal
->_getDerivedOrientation());
}
if (input.control & 512 && input.mouse_moved) {
mCameraPivot->yaw(
Ogre::Radian(-input.mouse.x *
3.0f * eng.delta));
}
});
#endif
}
bool get_gui_active()
{