From 64c99325974deec0fbe0839df488a71e40f4ceac Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 16 Feb 2014 19:04:12 +0100 Subject: [PATCH] Terrain: remove hard dependency on shiny - can now be compiled without it (fixed function) --- components/CMakeLists.txt | 1 + components/terrain/material.cpp | 6 ++++++ components/terrain/world.cpp | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 831b14057..938ef2e4d 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -73,6 +73,7 @@ add_component_dir (translation translation ) +add_definitions(-DTERRAIN_USE_SHADER=1) add_component_dir (terrain quadtreenode chunk world storage material ) diff --git a/components/terrain/material.cpp b/components/terrain/material.cpp index 31874af51..78b17909a 100644 --- a/components/terrain/material.cpp +++ b/components/terrain/material.cpp @@ -6,7 +6,9 @@ #include +#if TERRAIN_USE_SHADER #include +#endif namespace { @@ -64,7 +66,9 @@ namespace Terrain assert(!renderCompositeMap || !displayCompositeMap); if (!mat.isNull()) { +#if TERRAIN_USE_SHADER sh::Factory::getInstance().destroyMaterialInstance(mat->getName()); +#endif Ogre::MaterialManager::getSingleton().remove(mat->getName()); } @@ -144,6 +148,7 @@ namespace Terrain return mat; } +#if TERRAIN_USE_SHADER else { sh::MaterialInstance* material = sh::Factory::getInstance().createMaterialInstance (name.str()); @@ -343,6 +348,7 @@ namespace Terrain } } } +#endif return Ogre::MaterialManager::getSingleton().getByName(name.str()); } diff --git a/components/terrain/world.cpp b/components/terrain/world.cpp index 49a561c0e..e633c1a00 100644 --- a/components/terrain/world.cpp +++ b/components/terrain/world.cpp @@ -65,6 +65,12 @@ namespace Terrain , mMaxY(0) , mMinY(0) { +#if TERRAIN_USE_SHADER == 0 + if (mShaders) + std::cerr << "Compiled Terrain without shader support, disabling..." << std::endl; + mShaders = false; +#endif + mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC); /// \todo make composite map size configurable