Terrain: remove hard dependency on shiny - can now be compiled without it (fixed function)

actorid
scrawl 11 years ago
parent c9e349f60f
commit 64c9932597

@ -73,6 +73,7 @@ add_component_dir (translation
translation translation
) )
add_definitions(-DTERRAIN_USE_SHADER=1)
add_component_dir (terrain add_component_dir (terrain
quadtreenode chunk world storage material quadtreenode chunk world storage material
) )

@ -6,7 +6,9 @@
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#if TERRAIN_USE_SHADER
#include <extern/shiny/Main/Factory.hpp> #include <extern/shiny/Main/Factory.hpp>
#endif
namespace namespace
{ {
@ -64,7 +66,9 @@ namespace Terrain
assert(!renderCompositeMap || !displayCompositeMap); assert(!renderCompositeMap || !displayCompositeMap);
if (!mat.isNull()) if (!mat.isNull())
{ {
#if TERRAIN_USE_SHADER
sh::Factory::getInstance().destroyMaterialInstance(mat->getName()); sh::Factory::getInstance().destroyMaterialInstance(mat->getName());
#endif
Ogre::MaterialManager::getSingleton().remove(mat->getName()); Ogre::MaterialManager::getSingleton().remove(mat->getName());
} }
@ -144,6 +148,7 @@ namespace Terrain
return mat; return mat;
} }
#if TERRAIN_USE_SHADER
else else
{ {
sh::MaterialInstance* material = sh::Factory::getInstance().createMaterialInstance (name.str()); sh::MaterialInstance* material = sh::Factory::getInstance().createMaterialInstance (name.str());
@ -343,6 +348,7 @@ namespace Terrain
} }
} }
} }
#endif
return Ogre::MaterialManager::getSingleton().getByName(name.str()); return Ogre::MaterialManager::getSingleton().getByName(name.str());
} }

@ -65,6 +65,12 @@ namespace Terrain
, mMaxY(0) , mMaxY(0)
, mMinY(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); mCompositeMapSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
/// \todo make composite map size configurable /// \todo make composite map size configurable

Loading…
Cancel
Save