1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 13:36:42 +00:00

Code cleanup: Removed unneeded Ogre namespace

This commit is contained in:
Jacob Essex 2012-03-04 11:21:47 +00:00
parent 3c934e3e44
commit bcd2371baa

View file

@ -15,16 +15,16 @@ namespace MWRender
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
TerrainManager::TerrainManager(Ogre::SceneManager* mgr) TerrainManager::TerrainManager(SceneManager* mgr)
{ {
mTerrainGlobals = OGRE_NEW Ogre::TerrainGlobalOptions(); mTerrainGlobals = OGRE_NEW TerrainGlobalOptions();
Ogre::TerrainMaterialGeneratorPtr matGen; TerrainMaterialGeneratorPtr matGen;
TerrainMaterialGeneratorB* matGenP = new TerrainMaterialGeneratorB(); TerrainMaterialGeneratorB* matGenP = new TerrainMaterialGeneratorB();
matGen.bind(matGenP); matGen.bind(matGenP);
mTerrainGlobals->setDefaultMaterialGenerator(matGen); mTerrainGlobals->setDefaultMaterialGenerator(matGen);
Ogre::TerrainMaterialGenerator::Profile* const activeProfile = TerrainMaterialGenerator::Profile* const activeProfile =
mTerrainGlobals->getDefaultMaterialGenerator() mTerrainGlobals->getDefaultMaterialGenerator()
->getActiveProfile(); ->getActiveProfile();
TerrainMaterialGeneratorB::SM2Profile* matProfile = TerrainMaterialGeneratorB::SM2Profile* matProfile =
@ -54,16 +54,16 @@ namespace MWRender
matProfile->setReceiveDynamicShadowsEnabled(false); matProfile->setReceiveDynamicShadowsEnabled(false);
matProfile->setGlobalColourMapEnabled(true); matProfile->setGlobalColourMapEnabled(true);
mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(mgr, mTerrainGroup = OGRE_NEW TerrainGroup(mgr,
Ogre::Terrain::ALIGN_X_Z, Terrain::ALIGN_X_Z,
mLandSize, mLandSize,
mWorldSize); mWorldSize);
mTerrainGroup->setOrigin(Ogre::Vector3(mWorldSize/2, mTerrainGroup->setOrigin(Vector3(mWorldSize/2,
0, 0,
-mWorldSize/2)); -mWorldSize/2));
Ogre::Terrain::ImportData& importSettings = Terrain::ImportData& importSettings =
mTerrainGroup->getDefaultImportSettings(); mTerrainGroup->getDefaultImportSettings();
importSettings.inputBias = 0; importSettings.inputBias = 0;
@ -85,14 +85,14 @@ namespace MWRender
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
void TerrainManager::setDiffuse(const Ogre::ColourValue& diffuse) void TerrainManager::setDiffuse(const ColourValue& diffuse)
{ {
mTerrainGlobals->setCompositeMapDiffuse(diffuse); mTerrainGlobals->setCompositeMapDiffuse(diffuse);
} }
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
void TerrainManager::setAmbient(const Ogre::ColourValue& ambient) void TerrainManager::setAmbient(const ColourValue& ambient)
{ {
mTerrainGlobals->setCompositeMapAmbient(ambient); mTerrainGlobals->setCompositeMapAmbient(ambient);
} }
@ -112,7 +112,7 @@ namespace MWRender
{ {
for ( int y = 0; y < 2; y++ ) for ( int y = 0; y < 2; y++ )
{ {
Ogre::Terrain::ImportData terrainData = Terrain::ImportData terrainData =
mTerrainGroup->getDefaultImportSettings(); mTerrainGroup->getDefaultImportSettings();
const int terrainX = cellX * 2 + x; const int terrainX = cellX * 2 + x;
@ -120,10 +120,10 @@ namespace MWRender
//it makes far more sense to reallocate the memory here, //it makes far more sense to reallocate the memory here,
//and let Ogre deal with it due to the issues with deleting //and let Ogre deal with it due to the issues with deleting
//it at the wrong time if using threads (Which Ogre::Terrain does) //it at the wrong time if using threads (Which Terrain does)
terrainData.inputFloat = OGRE_ALLOC_T(float, terrainData.inputFloat = OGRE_ALLOC_T(float,
mLandSize*mLandSize, mLandSize*mLandSize,
Ogre::MEMCATEGORY_GEOMETRY); MEMCATEGORY_GEOMETRY);
//copy the height data row by row //copy the height data row by row
for ( int terrainCopyY = 0; terrainCopyY < mLandSize; terrainCopyY++ ) for ( int terrainCopyY = 0; terrainCopyY < mLandSize; terrainCopyY++ )
@ -150,7 +150,7 @@ namespace MWRender
mTerrainGroup->loadTerrain(terrainX, terrainY, true); mTerrainGroup->loadTerrain(terrainX, terrainY, true);
Ogre::Terrain* terrain = mTerrainGroup->getTerrain(terrainX, terrainY); Terrain* terrain = mTerrainGroup->getTerrain(terrainX, terrainY);
initTerrainBlendMaps(terrain, store, initTerrainBlendMaps(terrain, store,
x * numTextures, y * numTextures, x * numTextures, y * numTextures,
numTextures, numTextures,
@ -158,7 +158,7 @@ namespace MWRender
if ( store->land[1][1]->landData->usingColours ) if ( store->land[1][1]->landData->usingColours )
{ {
Ogre::TexturePtr vertex = getVertexColours(store, TexturePtr vertex = getVertexColours(store,
x*(mLandSize-1), x*(mLandSize-1),
y*(mLandSize-1), y*(mLandSize-1),
mLandSize); mLandSize);
@ -193,7 +193,7 @@ namespace MWRender
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
void TerrainManager::initTerrainTextures(Ogre::Terrain::ImportData* terrainData, void TerrainManager::initTerrainTextures(Terrain::ImportData* terrainData,
MWWorld::Ptr::CellStore* store, MWWorld::Ptr::CellStore* store,
int fromX, int fromY, int size, int fromX, int fromY, int size,
std::map<uint16_t, int>& indexes) std::map<uint16_t, int>& indexes)
@ -257,7 +257,7 @@ namespace MWRender
} }
const size_t position = terrainData->layerList.size(); const size_t position = terrainData->layerList.size();
terrainData->layerList.push_back(Ogre::Terrain::LayerInstance()); terrainData->layerList.push_back(Terrain::LayerInstance());
terrainData->layerList[position].worldSize = 256; terrainData->layerList[position].worldSize = 256;
terrainData->layerList[position].textureNames.push_back("textures\\" + texture); terrainData->layerList[position].textureNames.push_back("textures\\" + texture);
@ -276,7 +276,7 @@ namespace MWRender
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
void TerrainManager::initTerrainBlendMaps(Ogre::Terrain* terrain, void TerrainManager::initTerrainBlendMaps(Terrain* terrain,
MWWorld::Ptr::CellStore* store, MWWorld::Ptr::CellStore* store,
int fromX, int fromY, int size, int fromX, int fromY, int size,
const std::map<uint16_t, int>& indexes) const std::map<uint16_t, int>& indexes)
@ -361,7 +361,7 @@ namespace MWRender
for ( int i = 1; i < terrain->getLayerCount(); i++ ) for ( int i = 1; i < terrain->getLayerCount(); i++ )
{ {
Ogre::TerrainLayerBlendMap* blend = terrain->getLayerBlendMap(i); TerrainLayerBlendMap* blend = terrain->getLayerBlendMap(i);
blend->dirty(); blend->dirty();
blend->update(); blend->update();
} }
@ -418,10 +418,10 @@ namespace MWRender
//---------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------
Ogre::TexturePtr TerrainManager::getVertexColours(MWWorld::Ptr::CellStore* store, TexturePtr TerrainManager::getVertexColours(MWWorld::Ptr::CellStore* store,
int fromX, int fromY, int size) int fromX, int fromY, int size)
{ {
Ogre::TextureManager* const texMgr = Ogre::TextureManager::getSingletonPtr(); TextureManager* const texMgr = TextureManager::getSingletonPtr();
const std::string colourTextureName = "VtexColours_" + const std::string colourTextureName = "VtexColours_" +
boost::lexical_cast<std::string>(store->cell->getGridX()) + boost::lexical_cast<std::string>(store->cell->getGridX()) +
@ -432,22 +432,22 @@ namespace MWRender
"_" + "_" +
boost::lexical_cast<std::string>(fromY); boost::lexical_cast<std::string>(fromY);
Ogre::TexturePtr tex = texMgr->getByName(colourTextureName); TexturePtr tex = texMgr->getByName(colourTextureName);
if ( !tex.isNull() ) if ( !tex.isNull() )
{ {
return tex; return tex;
} }
tex = texMgr->createManual(colourTextureName, tex = texMgr->createManual(colourTextureName,
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, size, size, 0, Ogre::PF_BYTE_BGR); TEX_TYPE_2D, size, size, 0, PF_BYTE_BGR);
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = tex->getBuffer(); HardwarePixelBufferSharedPtr pixelBuffer = tex->getBuffer();
pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); pixelBuffer->lock(HardwareBuffer::HBL_DISCARD);
const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock(); const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data); uint8* pDest = static_cast<uint8*>(pixelBox.data);
const char* const colours = store->land[1][1]->landData->colours; const char* const colours = store->land[1][1]->landData->colours;
for ( int y = 0; y < size; y++ ) for ( int y = 0; y < size; y++ )