From d1127fd4cfb2654adae8bc9f84c4bb40d9538fcf Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 17:04:38 +0200 Subject: [PATCH 1/6] Fix correctness bugs found reviewing the Ogre 14.6 port ODSocketServer::mActualPort was declared but never initialised, so ODServer::getNetworkPort() read an indeterminate value whenever it ran before createServer() and could hand out a garbage port. ODFrameListener::renderQueueStarted() dereferenced CameraManager::getActiveCamera() unconditionally, but that pointer starts as nullptr and stays null until createCamera() runs. ReflMetal.material was deleted while Roundshield.mesh, Sabre.mesh and Wyvern.mesh still name the ReflMetal material, and shaders/ReflMetal.vert, shaders/ReflMetal.frag and materials/textures/EnvmapMetal.png were all left in the tree. Restore the script rather than leave those meshes falling back to the default material. Seven of the converted normal-map materials had their braces reflowed so that "normal_map }" closed the rtshader_system block on the same line and the pass lighting block lost its own closing brace line. It still parses, but the nesting no longer reads correctly. Restore the structure the other materials use and spell the mapping space explicitly as tangent_space, matching the pre-conversion default. Co-Authored-By: Claude Opus 5 --- materials/scripts/ReflMetal.material | 49 +++++++++++++++++++++++++ materials/scripts/T2HammerGood.material | 5 ++- materials/scripts/T2ShieldEvil.material | 5 ++- materials/scripts/T2ShieldGood.material | 5 ++- materials/scripts/T2SwordGood.material | 5 ++- materials/scripts/T3HammerGood.material | 5 ++- materials/scripts/T3ShieldEvil.material | 5 ++- materials/scripts/T3ShieldGood.material | 5 ++- source/network/ODSocketServer.cpp | 1 + source/render/ODFrameListener.cpp | 4 +- 10 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 materials/scripts/ReflMetal.material diff --git a/materials/scripts/ReflMetal.material b/materials/scripts/ReflMetal.material new file mode 100644 index 000000000..8646b37e5 --- /dev/null +++ b/materials/scripts/ReflMetal.material @@ -0,0 +1,49 @@ +vertex_program myReflMetalVertexShader glsl +{ + source ReflMetal.vert + default_params + { + param_named_auto worldviewproj_matrix worldviewproj_matrix + param_named_auto normal_matrix normal_matrix + param_named_auto worldview_matrix worldview_matrix + } + +} + +fragment_program myReflMetalFragmentShader glsl +{ + source ReflMetal.frag + default_params + { + } +} + + + + + +material ReflMetal +{ + technique + { + pass + { + + vertex_program_ref myReflMetalVertexShader + { + } + fragment_program_ref myReflMetalFragmentShader + { + param_named ambient float3 1.0 1.0 1.0 // This will be set from C++ code + } + + + texture_unit + { + texture EnvmapMetal.png + colour_op_ex blend_manual src_texture src_current 0.5 + env_map spherical + } + } + } +} diff --git a/materials/scripts/T2HammerGood.material b/materials/scripts/T2HammerGood.material index 354596b4b..fb207a1c8 100644 --- a/materials/scripts/T2HammerGood.material +++ b/materials/scripts/T2HammerGood.material @@ -15,9 +15,10 @@ material T2HammerGood : RTSS/NormalMapping_MultiPass texture T2HammerGoodNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T2HammerGood : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T2ShieldEvil.material b/materials/scripts/T2ShieldEvil.material index d2676a81f..f6a5d2b10 100644 --- a/materials/scripts/T2ShieldEvil.material +++ b/materials/scripts/T2ShieldEvil.material @@ -15,9 +15,10 @@ material T2ShieldEvil : RTSS/NormalMapping_MultiPass texture T2ShieldEvilNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T2ShieldEvil : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T2ShieldGood.material b/materials/scripts/T2ShieldGood.material index 1cef4e9a4..1551852b0 100644 --- a/materials/scripts/T2ShieldGood.material +++ b/materials/scripts/T2ShieldGood.material @@ -15,9 +15,10 @@ material T2ShieldGood : RTSS/NormalMapping_MultiPass texture T2ShieldGoodNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T2ShieldGood : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T2SwordGood.material b/materials/scripts/T2SwordGood.material index a96f8a66b..dc34da7cc 100644 --- a/materials/scripts/T2SwordGood.material +++ b/materials/scripts/T2SwordGood.material @@ -15,9 +15,10 @@ material T2SwordGood : RTSS/NormalMapping_MultiPass texture T2SwordGoodNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T2SwordGood : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T3HammerGood.material b/materials/scripts/T3HammerGood.material index 1b902e50f..a919970fa 100644 --- a/materials/scripts/T3HammerGood.material +++ b/materials/scripts/T3HammerGood.material @@ -15,9 +15,10 @@ material T3HammerGood : RTSS/NormalMapping_MultiPass texture T3HammerGoodNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T3HammerGood : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T3ShieldEvil.material b/materials/scripts/T3ShieldEvil.material index 7110f113e..19fdb87dc 100644 --- a/materials/scripts/T3ShieldEvil.material +++ b/materials/scripts/T3ShieldEvil.material @@ -15,9 +15,10 @@ material T3ShieldEvil : RTSS/NormalMapping_MultiPass texture T3ShieldEvilNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T3ShieldEvil : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/materials/scripts/T3ShieldGood.material b/materials/scripts/T3ShieldGood.material index b6a0ce4e6..0ea82fda7 100644 --- a/materials/scripts/T3ShieldGood.material +++ b/materials/scripts/T3ShieldGood.material @@ -15,9 +15,10 @@ material T3ShieldGood : RTSS/NormalMapping_MultiPass texture T3ShieldGoodNormal.png rtshader_system { - normal_map } + normal_map tangent_space } } + } pass decal { @@ -35,4 +36,4 @@ material T3ShieldGood : RTSS/NormalMapping_MultiPass } } } -} \ No newline at end of file +} diff --git a/source/network/ODSocketServer.cpp b/source/network/ODSocketServer.cpp index 318f437a5..e2d17f654 100755 --- a/source/network/ODSocketServer.cpp +++ b/source/network/ODSocketServer.cpp @@ -26,6 +26,7 @@ ODSocketServer::ODSocketServer(): mThread(nullptr), + mActualPort(0), mIsConnected(false) { } diff --git a/source/render/ODFrameListener.cpp b/source/render/ODFrameListener.cpp index 38a946e84..68fe95afc 100755 --- a/source/render/ODFrameListener.cpp +++ b/source/render/ODFrameListener.cpp @@ -284,7 +284,9 @@ bool ODFrameListener::frameStarted(const Ogre::FrameEvent& evt) void ODFrameListener::renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String& cameraName, bool&) { - if(queueGroupId == RenderManager::OD_RENDER_QUEUE_ID_GUI && cameraName == mCameraManager.getActiveCamera()->getName()) + const Ogre::Camera* activeCamera = mCameraManager.getActiveCamera(); + if(queueGroupId == RenderManager::OD_RENDER_QUEUE_ID_GUI && + activeCamera != nullptr && cameraName == activeCamera->getName()) { Ogre::Root::getSingleton().getRenderSystem()->clearFrameBuffer(Ogre::FBT_DEPTH); CEGUI::System::getSingleton().renderAllGUIContexts(); From 84e19500dd6bc95ce7296689fbe31b49bd649186 Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 17:04:38 +0200 Subject: [PATCH 2/6] Drop the leftover CEGUI layout debugging dumpWindowTree() walked the whole widget tree and wrote a line per widget straight to std::cerr every time the settings window was opened, and MenuModeMain::activate() logged the root window geometry on every entry to the main menu. Both look like instrumentation kept from tracking down the layout problems, not something to ship. Co-Authored-By: Claude Opus 5 --- source/modes/MenuModeMain.cpp | 6 ------ source/modes/SettingsWindow.cpp | 28 ---------------------------- 2 files changed, 34 deletions(-) diff --git a/source/modes/MenuModeMain.cpp b/source/modes/MenuModeMain.cpp index c3a6028da..f8366c206 100755 --- a/source/modes/MenuModeMain.cpp +++ b/source/modes/MenuModeMain.cpp @@ -141,10 +141,6 @@ void MenuModeMain::activate() CEGUI::Window* window = getModeManager().getGui().getGuiSheet(Gui::mainMenu); OD_ASSERT_TRUE(window != nullptr); - CEGUI::Sizef rootSize = window->getPixelSize(); - OD_LOG_INF("MenuModeMain root window size: " + std::to_string(rootSize.d_width) + "x" + std::to_string(rootSize.d_height)); - OD_LOG_INF("MenuModeMain root window area: '" + std::string(window->getProperty("Area").c_str()) + "'"); - window->getChild(WINDOW_SKIRMISH)->hide(); window->getChild(WINDOW_MULTIPLAYER)->hide(); window->getChild(WINDOW_EDITOR)->hide(); @@ -162,8 +158,6 @@ void MenuModeMain::activate() ODFrameListener::getSingleton().stopGameRenderer(); ODFrameListener::getSingleton().createMainMenuScene(); - - // Settings window is hidden by default; user opens it via Settings button. } void MenuModeMain::connectModeChangeEvent(const std::string& buttonName, AbstractModeManager::ModeType mode) diff --git a/source/modes/SettingsWindow.cpp b/source/modes/SettingsWindow.cpp index 318a4e338..7827d7f44 100755 --- a/source/modes/SettingsWindow.cpp +++ b/source/modes/SettingsWindow.cpp @@ -40,34 +40,8 @@ #include -#include - namespace { -void dumpWindowTree(CEGUI::Window* window, int depth = 0) -{ - if(window == nullptr) - return; - - CEGUI::Vector2f pos = window->getPixelPosition(); - CEGUI::Sizef size = window->getPixelSize(); - std::string indent(depth * 2, ' '); - CEGUI::Rectf inner = window->getUnclippedInnerRect().get(); - std::string msg = indent + "CEGUI window: " + std::string(window->getName().c_str()) + - " type: " + std::string(window->getType().c_str()) + - " visible: " + std::string(window->isVisible() ? "yes" : "no") + - " pos: [" + std::to_string(pos.d_x) + "," + std::to_string(pos.d_y) + - "] size: [" + std::to_string(size.d_width) + "," + std::to_string(size.d_height) + "]" + - " inner: [" + std::to_string(inner.left()) + "," + std::to_string(inner.top()) + - "," + std::to_string(inner.right()) + "," + std::to_string(inner.bottom()) + "]" + - " area: '" + std::string(window->getProperty("Area").c_str()) + "'" + - " text: '" + std::string(window->getText().c_str()) + "'"; - std::cerr << msg << std::endl; - - for(size_t i = 0; i < window->getChildCount(); ++i) - dumpWindowTree(window->getChildAtIdx(i), depth + 1); -} - float computeUiScale() { CEGUI::Sizef displaySize = CEGUI::System::getSingleton().getRenderer()->getDisplaySize(); @@ -657,8 +631,6 @@ void SettingsWindow::show() // Input only allowed on this window when visible. mSettingsWindow->setModalState(true); mSettingsWindow->show(); - OD_LOG_INF("SettingsWindow tree dump:"); - dumpWindowTree(mSettingsWindow); } } From e19f52c1ef841ebfb4ee45cdbfd2a0b2bc05e2db Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 17:04:38 +0200 Subject: [PATCH 3/6] Tidy up the mechanical parts of the port Move the newly added / includes below each file's own header so the headers stay self-contained, and drop the two that merely duplicated an include already present further down. Restore the indentation on the five statements that ended up in column 0 next to the new buildTangentVectorsIfNeeded() calls, take the MeshPtr by const reference instead of copying the shared pointer, and guard against a null mesh. Drop the redundant .get() calls and the three "#if OGRE_VERSION < 0x10A00 / #else" blocks whose branches are now identical. Let CMAKE_CXX_STANDARD drive the language standard on its own: the -std=c++11 flag the OD_CXX11_FLAGS probe injected into CMAKE_CXX_FLAGS contradicted the newly requested C++14, and nothing asked CMake to treat the standard as required. Fold the duplicated [Graphics] section in resources.cfg.in into one, and drop the hardcoded share/OGRE/Media/RTShaderLib paths now that @RTSHADER_DIR@ and @OGRE_MEDIA_DIR@ point at the same place. Co-Authored-By: Claude Opus 5 --- CMakeLists.txt | 16 ++------- cmake/config/resources.cfg.in | 8 ----- materials/RTShaderLib/GLSL/RTSLib_Colour.glsl | 2 +- .../RTShaderLib/GLSL/SGXLib_NormalMap.glsl | 2 +- source/creaturemood/CreatureMoodHunger.cpp | 3 +- .../creaturemood/CreatureMoodWakefulness.cpp | 3 +- source/network/ODPacket.cpp | 1 - source/render/RenderManager.cpp | 36 ++++++++----------- source/renderscene/RenderSceneAddEntity.cpp | 3 +- .../renderscene/RenderSceneAddPointLight.cpp | 3 +- .../renderscene/RenderSceneAnimationTime.cpp | 3 +- source/renderscene/RenderSceneCameraMove.cpp | 3 +- source/renderscene/RenderSceneMoveEntity.cpp | 3 +- source/renderscene/RenderScenePosEntity.cpp | 3 +- .../renderscene/RenderSceneResizeEntity.cpp | 3 +- source/renderscene/RenderSceneSyncPost.cpp | 3 +- source/renderscene/RenderSceneSyncWait.cpp | 3 +- .../RenderSceneSyncWaitAnimation.cpp | 3 +- source/renderscene/RenderSceneTurnEntity.cpp | 3 +- source/renderscene/RenderSceneWait.cpp | 3 +- source/utils/ConfigManager.cpp | 1 - 21 files changed, 48 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf2ddcaa5..900c9f4d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ if(NOT MSVC) endif() set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Set the data path depending on the platform if(WIN32) @@ -138,20 +139,9 @@ set(OD_OPT_FLAGS CACHE STRING "Optimization and optional compilation flags") set(OD_CXX11_FLAGS CACHE STRING "Compilation flags to enable C++11 support") if(MSVC) - # C++11 compilation flag is activated by default + # The language standard is driven by CMAKE_CXX_STANDARD above. # Optimisation flags can be added if deemed useful else() - include(CheckCXXCompilerFlag) - if(NOT OD_CXX11_FLAGS) - CHECK_CXX_COMPILER_FLAG("-std=c++11" OD_CXX11_FLAG_SUPPORTED) - CHECK_CXX_COMPILER_FLAG("-std=gnu++11" OD_CXXGNU11_FLAG_SUPPORTED) - # MinGW supports CXX11 flag but do not compile with it. However, it works with gnu++11 - if(OD_CXX11_FLAG_SUPPORTED AND NOT MINGW) - set(OD_CXX11_FLAGS "-std=c++11" CACHE STRING "Compilation flags to enable C++11 support" FORCE) - elseif(OD_CXX11_FLAG_SUPPORTED) - set(OD_CXX11_FLAGS "-std=gnu++11" CACHE STRING "Compilation flags to enable C++11 support" FORCE) - endif() - endif() if(OD_ENABLE_WARNINGS) # Help getting compilation warnings set(OD_OPT_FLAGS "${OD_OPT_FLAGS} -Wall -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wold-style-cast") @@ -210,7 +200,7 @@ if(OD_USE_SFML_WINDOW) add_definitions(-DOD_USE_SFML_WINDOW) endif() -set(CMAKE_CXX_FLAGS "${OD_CXX11_FLAGS} ${OD_OPT_FLAGS} ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "${OD_OPT_FLAGS} ${CMAKE_CXX_FLAGS}") message(STATUS "CMake CXX Flags: " ${CMAKE_CXX_FLAGS}) set(EXTRA_LIBRARIES "") diff --git a/cmake/config/resources.cfg.in b/cmake/config/resources.cfg.in index e4dd7b1bf..67e70d248 100644 --- a/cmake/config/resources.cfg.in +++ b/cmake/config/resources.cfg.in @@ -1,16 +1,8 @@ -[Graphics] -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib/GLSL -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib/HLSL -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib/HLSL_Cg -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib/materials -FileSystem=@CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib/../Main [OgreInternal] FileSystem=@OGRE_MEDIA_DIR@/Main [Graphics] FileSystem=@RTSHADER_DIR@ -FileSystem=@OGRE_MEDIA_DIR@/Main FileSystem=materials/scripts FileSystem=materials/scripts/Creatures FileSystem=materials/textures diff --git a/materials/RTShaderLib/GLSL/RTSLib_Colour.glsl b/materials/RTShaderLib/GLSL/RTSLib_Colour.glsl index 014e11e4b..f0ffb3495 100644 --- a/materials/RTShaderLib/GLSL/RTSLib_Colour.glsl +++ b/materials/RTShaderLib/GLSL/RTSLib_Colour.glsl @@ -13,4 +13,4 @@ #define COLOUR_TRANSFER(colour) colour.rgb = pow(colour.rgb, vec3_splat(1.0/2.2)) #else #define COLOUR_TRANSFER(colour) -#endif \ No newline at end of file +#endif diff --git a/materials/RTShaderLib/GLSL/SGXLib_NormalMap.glsl b/materials/RTShaderLib/GLSL/SGXLib_NormalMap.glsl index f8c9305e4..31f03b5a8 100644 --- a/materials/RTShaderLib/GLSL/SGXLib_NormalMap.glsl +++ b/materials/RTShaderLib/GLSL/SGXLib_NormalMap.glsl @@ -122,4 +122,4 @@ void SGX_Generate_Parallax_Texcoord(in sampler2D normalHeightMap, float weight = afterDepth / (afterDepth - beforeDepth); newTexCoord = mix(newTexCoord, prevTexCoords, weight); #endif -} \ No newline at end of file +} diff --git a/source/creaturemood/CreatureMoodHunger.cpp b/source/creaturemood/CreatureMoodHunger.cpp index 740aaa079..3f907ca7f 100755 --- a/source/creaturemood/CreatureMoodHunger.cpp +++ b/source/creaturemood/CreatureMoodHunger.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "creaturemood/CreatureMoodHunger.h" +#include + #include "creaturemood/CreatureMoodManager.h" #include "entities/Creature.h" diff --git a/source/creaturemood/CreatureMoodWakefulness.cpp b/source/creaturemood/CreatureMoodWakefulness.cpp index 116397b82..e4331af39 100755 --- a/source/creaturemood/CreatureMoodWakefulness.cpp +++ b/source/creaturemood/CreatureMoodWakefulness.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "creaturemood/CreatureMoodWakefulness.h" +#include + #include "creaturemood/CreatureMoodManager.h" #include "entities/Creature.h" diff --git a/source/network/ODPacket.cpp b/source/network/ODPacket.cpp index 51ab1c412..2adea6511 100755 --- a/source/network/ODPacket.cpp +++ b/source/network/ODPacket.cpp @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -#include #include "network/ODPacket.h" #include diff --git a/source/render/RenderManager.cpp b/source/render/RenderManager.cpp index 31a1963bb..9ba082bde 100755 --- a/source/render/RenderManager.cpp +++ b/source/render/RenderManager.cpp @@ -77,8 +77,14 @@ namespace { - void buildTangentVectorsIfNeeded(Ogre::MeshPtr meshPtr) + void buildTangentVectorsIfNeeded(const Ogre::MeshPtr& meshPtr) { + if (!meshPtr) + { + OD_LOG_ERR("Cannot build tangent vectors for a null mesh"); + return; + } + unsigned short src; if (!meshPtr->suggestTangentVectorBuildParams(src)) meshPtr->buildTangentVectors(src); @@ -598,7 +604,7 @@ Ogre::Entity* RenderManager::addEntityMenu(const std::string& meshName, const st Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(meshName,"Graphics"); buildTangentVectorsIfNeeded(meshPtr); -Ogre::Entity* ent = mSceneManager->createEntity(entityName, meshPtr); + Ogre::Entity* ent = mSceneManager->createEntity(entityName, meshPtr); Ogre::SceneNode* node = mMainMenuSceneNode->createChildSceneNode(ent->getName() + "_node"); node->attachObject(ent); @@ -987,7 +993,7 @@ void RenderManager::rrRefreshTile(Tile& tile, GameMap& draggableTileContainer, c Ogre::MeshManager::getSingleton().load(meshName,"Graphics"); Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(meshName,"Graphics"); buildTangentVectorsIfNeeded(meshPtr); -if((tileMeshEnt == nullptr) && !meshName.empty() ) + if((tileMeshEnt == nullptr) && !meshName.empty() ) { @@ -1118,7 +1124,7 @@ if((tileMeshEnt == nullptr) && !meshName.empty() ) Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(meshName,"Graphics"); buildTangentVectorsIfNeeded(meshPtr); -std::string customMeshNodeName = bridgeMeshName + (static_cast(nt) ? "" : "_dtc" ) + "_node"; + std::string customMeshNodeName = bridgeMeshName + (static_cast(nt) ? "" : "_dtc" ) + "_node"; Ogre::SceneNode* customMeshNode; if(!mSceneManager->hasSceneNode(customMeshNodeName)) customMeshNode = tile.getEntityNode()->createChildSceneNode(customMeshNodeName); @@ -1326,7 +1332,7 @@ void RenderManager::rrCreateRenderedMovableEntity(RenderedMovableEntity* rendere Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(meshName + ".mesh","Graphics"); buildTangentVectorsIfNeeded(meshPtr); -ent = mSceneManager->createEntity(tempString, meshPtr); + ent = mSceneManager->createEntity(tempString, meshPtr); node->attachObject(ent); } @@ -1433,7 +1439,7 @@ void RenderManager::rrCreateCreature(Creature* curCreature) Ogre::MeshPtr meshPtr = Ogre::MeshManager::getSingleton().getByName(meshName,"Graphics"); buildTangentVectorsIfNeeded(meshPtr); -std::string creatureName = curCreature->getOgreNamePrefix() + curCreature->getName(); + std::string creatureName = curCreature->getOgreNamePrefix() + curCreature->getName(); Ogre::Entity* ent = mSceneManager->createEntity(creatureName, meshPtr); @@ -1967,11 +1973,7 @@ std::string RenderManager::colourizeMaterial(const std::string& materialName, co // std::cout << "\nCloning material: " << tempSS.str(); // If this texture has been copied and colourized, we can return -#if defined(OGRE_VERSION) && OGRE_VERSION < 0x10A00 - if (requestedMaterial) -#else if (requestedMaterial) -#endif return tempSS.str(); // If not yet, then do so @@ -1985,7 +1987,7 @@ std::string RenderManager::colourizeMaterial(const std::string& materialName, co //std::cout << "\nMaterial does not exist, creating a new one."; Ogre::MaterialPtr newMaterial = oldMaterial->clone(tempSS.str()); - bool cloned = mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial.get(), *newMaterial.get()); + bool cloned = mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial, *newMaterial); if(!cloned) { @@ -2337,18 +2339,14 @@ std::string RenderManager::setMaterialOpacity(const std::string& materialName, f Ogre::MaterialPtr requestedMaterial = Ogre::MaterialManager::getSingleton().getByName(newMaterialName.str()); // If this texture has been copied and colourized, we can return -#if defined(OGRE_VERSION) && OGRE_VERSION < 0x10A00 - if (requestedMaterial) -#else if (requestedMaterial) -#endif return newMaterialName.str(); // If not yet, then do so Ogre::MaterialPtr oldMaterial = Ogre::MaterialManager::getSingleton().getByName(materialName); //std::cout << "\nMaterial does not exist, creating a new one."; Ogre::MaterialPtr newMaterial = oldMaterial->clone(newMaterialName.str()); - bool cloned = mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial.get(), *newMaterial.get()); + bool cloned = mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial, *newMaterial); if(!cloned) { OD_LOG_ERR("Failed to clone rtss for material: " + materialName); @@ -2444,17 +2442,13 @@ std::string RenderManager::rrBuildSkullFlagMaterial(const std::string& materialN Ogre::MaterialPtr requestedMaterial = Ogre::MaterialPtr(Ogre::MaterialManager::getSingleton().getByName(materialNameToUse)); // If this texture has been copied and colourized, we can return -#if defined(OGRE_VERSION) && OGRE_VERSION < 0x10A00 - if (requestedMaterial) -#else if (requestedMaterial) -#endif return materialNameToUse; Ogre::MaterialPtr oldMaterial = Ogre::MaterialManager::getSingleton().getByName(materialNameBase); Ogre::MaterialPtr newMaterial = oldMaterial->clone(materialNameToUse); - if(!mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial.get(), *newMaterial.get())) + if(!mShaderGenerator->cloneShaderBasedTechniques(*oldMaterial, *newMaterial)) { OD_LOG_ERR("Failed to clone rtss for material: " + materialNameBase); } diff --git a/source/renderscene/RenderSceneAddEntity.cpp b/source/renderscene/RenderSceneAddEntity.cpp index fe3405a73..3b4acf41e 100755 --- a/source/renderscene/RenderSceneAddEntity.cpp +++ b/source/renderscene/RenderSceneAddEntity.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneAddEntity.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneAddPointLight.cpp b/source/renderscene/RenderSceneAddPointLight.cpp index cb8b6b1bf..a2de5700c 100755 --- a/source/renderscene/RenderSceneAddPointLight.cpp +++ b/source/renderscene/RenderSceneAddPointLight.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneAddPointLight.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneAnimationTime.cpp b/source/renderscene/RenderSceneAnimationTime.cpp index fa46b9d7f..304ea0dea 100755 --- a/source/renderscene/RenderSceneAnimationTime.cpp +++ b/source/renderscene/RenderSceneAnimationTime.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneAnimationTime.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneCameraMove.cpp b/source/renderscene/RenderSceneCameraMove.cpp index 32fc1e378..f9716493c 100755 --- a/source/renderscene/RenderSceneCameraMove.cpp +++ b/source/renderscene/RenderSceneCameraMove.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneCameraMove.h" +#include + #include "camera/CameraManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneMoveEntity.cpp b/source/renderscene/RenderSceneMoveEntity.cpp index 9e8f84366..4ad2f7909 100755 --- a/source/renderscene/RenderSceneMoveEntity.cpp +++ b/source/renderscene/RenderSceneMoveEntity.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneMoveEntity.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderScenePosEntity.cpp b/source/renderscene/RenderScenePosEntity.cpp index 0f53b79ae..61d379ec0 100755 --- a/source/renderscene/RenderScenePosEntity.cpp +++ b/source/renderscene/RenderScenePosEntity.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderScenePosEntity.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneResizeEntity.cpp b/source/renderscene/RenderSceneResizeEntity.cpp index 2dd36510b..cba902979 100755 --- a/source/renderscene/RenderSceneResizeEntity.cpp +++ b/source/renderscene/RenderSceneResizeEntity.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneResizeEntity.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneSyncPost.cpp b/source/renderscene/RenderSceneSyncPost.cpp index 59943b94b..af492e9e8 100755 --- a/source/renderscene/RenderSceneSyncPost.cpp +++ b/source/renderscene/RenderSceneSyncPost.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneSyncPost.h" +#include + #include "camera/CameraManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneSyncWait.cpp b/source/renderscene/RenderSceneSyncWait.cpp index 3b0c4a1e6..e8204da11 100755 --- a/source/renderscene/RenderSceneSyncWait.cpp +++ b/source/renderscene/RenderSceneSyncWait.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneSyncWait.h" +#include + #include "camera/CameraManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneSyncWaitAnimation.cpp b/source/renderscene/RenderSceneSyncWaitAnimation.cpp index d28125eaf..bc8d73b02 100755 --- a/source/renderscene/RenderSceneSyncWaitAnimation.cpp +++ b/source/renderscene/RenderSceneSyncWaitAnimation.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneSyncWaitAnimation.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneTurnEntity.cpp b/source/renderscene/RenderSceneTurnEntity.cpp index ee580c050..bb8ad929d 100755 --- a/source/renderscene/RenderSceneTurnEntity.cpp +++ b/source/renderscene/RenderSceneTurnEntity.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneTurnEntity.h" +#include + #include "camera/CameraManager.h" #include "render/RenderManager.h" #include "renderscene/RenderSceneManager.h" diff --git a/source/renderscene/RenderSceneWait.cpp b/source/renderscene/RenderSceneWait.cpp index eff4f0569..aa93f9384 100755 --- a/source/renderscene/RenderSceneWait.cpp +++ b/source/renderscene/RenderSceneWait.cpp @@ -15,9 +15,10 @@ * along with this program. If not, see . */ -#include #include "renderscene/RenderSceneWait.h" +#include + #include "renderscene/RenderSceneManager.h" static const std::string RenderSceneWaitName = "Wait"; diff --git a/source/utils/ConfigManager.cpp b/source/utils/ConfigManager.cpp index a44468f5e..0e9e60e08 100755 --- a/source/utils/ConfigManager.cpp +++ b/source/utils/ConfigManager.cpp @@ -15,7 +15,6 @@ * along with this program. If not, see . */ -#include #include "utils/ConfigManager.h" #include "entities/CreatureDefinition.h" From cc02d00a02c4e032094bed6449d7bded10d21987 Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 17:21:34 +0200 Subject: [PATCH 4/6] Group the RTShaderLib path the way Ogre's own template does Ogre ships CMake/Templates/resources.cfg.in with both Main and RTShaderLib under [OgreInternal]; putting RTShaderLib under [Graphics] instead leaves the RTSS shader library in a different group from the Main headers it includes. Verified against OGRECave/ogre master: OGREConfig.cmake does set_and_check(OGRE_MEDIA_DIR ...), so @OGRE_MEDIA_DIR@ and @RTSHADER_DIR@ both expand for consumers using find_package(OGRE CONFIG) as we do. The share/OGRE/Media/RTShaderLib/{GLSL,HLSL,HLSL_Cg,materials} paths dropped in the previous commit no longer exist at all -- RTShaderLib is flat since the 1.x layout was collapsed. Co-Authored-By: Claude Opus 5 --- cmake/config/resources.cfg.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/config/resources.cfg.in b/cmake/config/resources.cfg.in index 67e70d248..728433032 100644 --- a/cmake/config/resources.cfg.in +++ b/cmake/config/resources.cfg.in @@ -1,8 +1,8 @@ [OgreInternal] FileSystem=@OGRE_MEDIA_DIR@/Main +FileSystem=@RTSHADER_DIR@ [Graphics] -FileSystem=@RTSHADER_DIR@ FileSystem=materials/scripts FileSystem=materials/scripts/Creatures FileSystem=materials/textures From a4356248a80c63740ced9130d14364e58c60725a Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 18:11:35 +0200 Subject: [PATCH 5/6] Correct two review findings that a real build disproved Built Ogre 14.6.0 and the CEGUI fork from source and ran the game; both of these were wrong and the runtime proved it. Restoring ReflMetal.material was a mistake. Its shaders do not compile against Ogre 14 at all: ReflMetal.vert/.frag include FFPLib_Texturing.glsl, which calls the ENABLE_LINEAR_COLOUR macro that only RTSLib_Colour.glsl defines, and adding that include just exposes the next layer -- FFP_Transform has a different signature and SGX_Light_Point_DiffuseSpecular no longer exists. Meanwhile Roundshield.material and Wyvern.material exist in their own right and Ogre logs nothing at all about the missing material. Deleting it was correct; restoring it traded a silent fallback for two hard shader compile errors. Reverted. (What remains is only the orphaned shaders/ReflMetal.* and materials/textures/EnvmapMetal.png.) The duplicated resources.cfg entries were load-bearing, not an accident. Our hand-written shaders live in the Graphics group and #include OgreUnifiedShader.h and the RTShaderLib sources; Ogre resolves those includes within the same resource group, so Media/Main genuinely has to appear under [Graphics] as well as [OgreInternal]. Removing it cost five shader programs. RTShaderLib, in contrast, must appear ONLY under [Graphics] -- listing it in both groups makes RTSSamplers.material parse twice and Ogre throws "Sampler 'Ogre/ShadowSampler' already exists" during startup, which killed the game before it reached the menu. Documented both constraints in the file so the next person does not tidy them away again. Dropping the six @CMAKE_INSTALL_PREFIX@/share/OGRE/Media/RTShaderLib* paths still stands: they point into OUR install prefix, not Ogre's, and the GLSL/HLSL/HLSL_Cg/materials subdirectories no longer exist now that RTShaderLib is flat. Verified: no new Ogre errors versus the PR head, and the seven T2*/T3* material errors this branch fixes are real ScriptCompiler failures. Co-Authored-By: Claude Opus 5 --- cmake/config/resources.cfg.in | 10 +++++- materials/scripts/ReflMetal.material | 49 ---------------------------- 2 files changed, 9 insertions(+), 50 deletions(-) delete mode 100644 materials/scripts/ReflMetal.material diff --git a/cmake/config/resources.cfg.in b/cmake/config/resources.cfg.in index 728433032..d3672eff6 100644 --- a/cmake/config/resources.cfg.in +++ b/cmake/config/resources.cfg.in @@ -1,8 +1,16 @@ [OgreInternal] FileSystem=@OGRE_MEDIA_DIR@/Main -FileSystem=@RTSHADER_DIR@ [Graphics] +# Our hand-written .vert/.frag live in the Graphics group and #include +# OgreUnifiedShader.h plus the RTShaderLib FFPLib_*/SGXLib_* sources. Ogre resolves +# those includes within the *same* resource group, so Main has to be repeated here +# even though [OgreInternal] already lists it. +# RTShaderLib is deliberately listed ONLY here: adding it to [OgreInternal] as well +# makes RTSSamplers.material parse twice and Ogre then throws +# "Sampler 'Ogre/ShadowSampler' already exists" during startup. +FileSystem=@RTSHADER_DIR@ +FileSystem=@OGRE_MEDIA_DIR@/Main FileSystem=materials/scripts FileSystem=materials/scripts/Creatures FileSystem=materials/textures diff --git a/materials/scripts/ReflMetal.material b/materials/scripts/ReflMetal.material deleted file mode 100644 index 8646b37e5..000000000 --- a/materials/scripts/ReflMetal.material +++ /dev/null @@ -1,49 +0,0 @@ -vertex_program myReflMetalVertexShader glsl -{ - source ReflMetal.vert - default_params - { - param_named_auto worldviewproj_matrix worldviewproj_matrix - param_named_auto normal_matrix normal_matrix - param_named_auto worldview_matrix worldview_matrix - } - -} - -fragment_program myReflMetalFragmentShader glsl -{ - source ReflMetal.frag - default_params - { - } -} - - - - - -material ReflMetal -{ - technique - { - pass - { - - vertex_program_ref myReflMetalVertexShader - { - } - fragment_program_ref myReflMetalFragmentShader - { - param_named ambient float3 1.0 1.0 1.0 // This will be set from C++ code - } - - - texture_unit - { - texture EnvmapMetal.png - colour_op_ex blend_manual src_texture src_current 0.5 - env_map spherical - } - } - } -} From 5fef2448ab038119142eefaa46cf94f21481ec79 Mon Sep 17 00:00:00 2001 From: Francesco Bonazzi Date: Fri, 31 Jul 2026 18:37:47 +0200 Subject: [PATCH 6/6] Make the Audio and Gameplay sliders visible again Both sliders carried AutoRenderingSurface="True", which asks CEGUI to render that widget subtree into its own RenderingSurface. The Ogre renderer in the CEGUI fork never composites those nested surfaces, so the slider drew nothing at all -- no track, no thumb -- while still reporting itself as visible and correctly positioned. The label above it ("Music: 100%", "Ambient Light: +184%") kept rendering, which is what makes it look like only the thumb went missing. The property is not part of the Ogre 14 port; it predates it and happened to work with the CEGUI and Ogre the game used before. Nothing else in gui/ sets it, so these two sliders were the only widgets affected -- which matches the report that only OPTIONS -> AUDIO and OPTIONS -> GAMEPLAY are broken. False is the CEGUI default, so the property is simply dropped rather than set. Verified by screenshotting both tabs with the property on and off, against Ogre 14.6.0 and the CEGUI fork built from source. Co-Authored-By: Claude Opus 5 --- gui/WindowSettings.layout | 2 -- 1 file changed, 2 deletions(-) diff --git a/gui/WindowSettings.layout b/gui/WindowSettings.layout index f2a71b0db..0bdcba3cb 100644 --- a/gui/WindowSettings.layout +++ b/gui/WindowSettings.layout @@ -85,7 +85,6 @@ - @@ -168,7 +167,6 @@ -