Consistent startup

This commit is contained in:
2025-12-19 06:09:07 +03:00
parent 9bb9e2c09b
commit d3c93c5c18
16 changed files with 1884 additions and 860 deletions

View File

@@ -1,5 +1,7 @@
#include <iostream>
#include <Ogre.h>
#include <Jolt/Jolt.h>
#include <Jolt/Physics/Body/BodyID.h>
#include "Components.h"
#include "GameData.h"
#include "PhysicsModule.h"
@@ -35,8 +37,6 @@ EditorInputModule::EditorInputModule(flecs::world &ecs)
.kind(flecs::OnUpdate)
.each([this](const EngineData &eng, Input &input,
Camera &camera) {
if (ECS::player.is_valid())
return;
if (!camera.configured) {
// create a pivot at roughly the character's shoulder
camera.mCameraPivot =
@@ -147,10 +147,11 @@ EditorInputModule::EditorInputModule(flecs::world &ecs)
position =
ray.getPoint(ogreResult.second);
Ogre::Vector3 position2;
JPH::BodyID id;
bool hit = PhysicsModule::raycastQuery(
ray.getOrigin(),
ray.getPoint(2000.0f),
position2);
position2, id);
if (hit) {
float d1 =
ray.getOrigin()
@@ -169,10 +170,11 @@ EditorInputModule::EditorInputModule(flecs::world &ecs)
.sceneNode->_setDerivedPosition(
position);
} else {
JPH::BodyID id;
bool hit = PhysicsModule::raycastQuery(
ray.getOrigin(),
ray.getPoint(2000.0f),
position);
ray.getPoint(2000.0f), position,
id);
if (hit) {
std::cout
<< "HIT!: " << position
@@ -238,4 +240,4 @@ EditorInputModule::EditorInputModule(flecs::world &ecs)
ECS::get().modified<ECS::Input>();
});
}
}
}

View File

@@ -384,9 +384,11 @@ public:
}
void configure()
{
std::cout << "Startup" << "\n";
std::cout << "Startup"
<< "\n";
initApp();
std::cout << "Set up RTSS" << "\n";
std::cout << "Set up RTSS"
<< "\n";
Ogre::Root *root = getRoot();
Ogre::SceneManager *scnMgr = getSceneManager();
@@ -395,19 +397,25 @@ public:
Ogre::RTShader::ShaderGenerator::getSingletonPtr();
shadergen->addSceneManager(scnMgr);
setWindowGrab(false);
std::cout << "Init camera" << "\n";
std::cout << "Init camera"
<< "\n";
initCamera();
std::cout << "Set up water" << "\n";
std::cout << "Set up cursor" << "\n";
std::cout << "Set up water"
<< "\n";
std::cout << "Set up cursor"
<< "\n";
Ogre::ResourceGroupManager::getSingleton()
.initialiseAllResourceGroups();
// OgreBites::ApplicationContext::loadResources();
// setupCursor();
std::cout << "Setup input" << "\n";
std::cout << "Setup input"
<< "\n";
setupInput();
std::cout << "Create content" << "\n";
std::cout << "Create content"
<< "\n";
createContent();
std::cout << "Setup done" << "\n";
std::cout << "Setup done"
<< "\n";
#if 0
mDbgDraw->setDebugMode(mDbgDraw->getDebugMode() |
btIDebugDraw::DBG_DrawContactPoints);
@@ -721,9 +729,7 @@ public:
}
flecs::entity getPlayer() const
{
flecs::entity player =
ECS::get().lookup("ECS::CharacterModule::player");
return player;
return ECS::player;
}
void enableDbgDraw(bool enable)
{
@@ -789,7 +795,7 @@ int main()
{
App ctx;
ctx.configure();
ctx.enableDbgDraw(false);
// ctx.enableDbgDraw(false);
ctx.getRoot()->startRendering();
ctx.setWindowGrab(false);
ctx.closeApp();