mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 12:49:56 +00:00
Merge branch 'terrain_next' of git://github.com/scrawl/openmw into terrain_next
Conflicts: apps/openmw/mwrender/terrain.cpp
This commit is contained in:
commit
941a22034f
3 changed files with 27 additions and 19 deletions
|
@ -27,13 +27,12 @@ namespace MWRender
|
|||
TerrainMaterialGenerator::Profile* const activeProfile =
|
||||
mTerrainGlobals->getDefaultMaterialGenerator()
|
||||
->getActiveProfile();
|
||||
TerrainMaterialGeneratorB::SM2Profile* matProfile =
|
||||
mActiveProfile =
|
||||
static_cast<TerrainMaterialGeneratorB::SM2Profile*>(activeProfile);
|
||||
|
||||
//The pixel error should be as high as possible without it being noticed
|
||||
//as it governs how fast mesh quality decreases. 16 was just about Ok
|
||||
//when tested at the small swamp pond in Seyda Neen
|
||||
mTerrainGlobals->setMaxPixelError(16);
|
||||
//as it governs how fast mesh quality decreases.
|
||||
mTerrainGlobals->setMaxPixelError(8);
|
||||
|
||||
mTerrainGlobals->setLayerBlendMapSize(32);
|
||||
mTerrainGlobals->setLightMapSize(256);
|
||||
|
@ -47,12 +46,12 @@ namespace MWRender
|
|||
//this seemed the distance where it wasn't too noticeable
|
||||
mTerrainGlobals->setCompositeMapDistance(mWorldSize*2);
|
||||
|
||||
matProfile->setLightmapEnabled(false);
|
||||
matProfile->setLayerSpecularMappingEnabled(false);
|
||||
matProfile->setLayerNormalMappingEnabled(false);
|
||||
matProfile->setLayerParallaxMappingEnabled(false);
|
||||
matProfile->setReceiveDynamicShadowsEnabled(false);
|
||||
matProfile->setGlobalColourMapEnabled(true);
|
||||
mActiveProfile->setLightmapEnabled(false);
|
||||
mActiveProfile->setLayerSpecularMappingEnabled(false);
|
||||
mActiveProfile->setLayerNormalMappingEnabled(false);
|
||||
mActiveProfile->setLayerParallaxMappingEnabled(false);
|
||||
mActiveProfile->setReceiveDynamicShadowsEnabled(false);
|
||||
mActiveProfile->setCompositeMapEnabled(false);
|
||||
|
||||
mTerrainGroup = OGRE_NEW TerrainGroup(mgr,
|
||||
Terrain::ALIGN_X_Z,
|
||||
|
@ -156,19 +155,25 @@ namespace MWRender
|
|||
numTextures,
|
||||
indexes);
|
||||
|
||||
// disable or enable global colour map (depends on available vertex colours)
|
||||
if ( store->land[1][1]->landData->usingColours )
|
||||
{
|
||||
mActiveProfile->setGlobalColourMapEnabled(true);
|
||||
else
|
||||
mActiveProfile->setGlobalColourMapEnabled(false);
|
||||
|
||||
if ( store->land[1][1]->landData->usingColours )
|
||||
{
|
||||
TexturePtr vertex = getVertexColours(store,
|
||||
x*(mLandSize-1),
|
||||
y*(mLandSize-1),
|
||||
mLandSize);
|
||||
|
||||
//this is a hack to get around the fact that Ogre seems to
|
||||
//corrupt the composite map leading to rendering errors
|
||||
MaterialPtr mat = terrain->_getMaterial();
|
||||
mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName( vertex->getName() );
|
||||
mat = terrain->_getCompositeMapMaterial();
|
||||
//corrupt the global colour map leading to rendering errors
|
||||
MaterialPtr mat = terrain->getMaterial();
|
||||
mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName( vertex->getName() );
|
||||
//mat = terrain->_getCompositeMapMaterial();
|
||||
//mat->getTechnique(0)->getPass(0)->getTextureUnitState(1)->setTextureName( vertex->getName() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define _GAME_RENDER_TERRAIN_H
|
||||
|
||||
#include <OgreTerrain.h>
|
||||
#include "terrainmaterial.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
|
@ -34,6 +35,8 @@ namespace MWRender{
|
|||
Ogre::TerrainGlobalOptions* mTerrainGlobals;
|
||||
Ogre::TerrainGroup* mTerrainGroup;
|
||||
|
||||
Ogre::TerrainMaterialGeneratorB::SM2Profile* mActiveProfile;
|
||||
|
||||
/**
|
||||
* The length in verticies of a single terrain block.
|
||||
*/
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace Ogre
|
|||
if (enabled != mGlobalColourMapEnabled)
|
||||
{
|
||||
mGlobalColourMapEnabled = enabled;
|
||||
mParent->_markChanged();
|
||||
//mParent->_markChanged();
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------
|
||||
|
@ -359,7 +359,7 @@ namespace Ogre
|
|||
tu->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
|
||||
|
||||
// global colour map
|
||||
//if (terrain->getGlobalColourMapEnabled() && isGlobalColourMapEnabled())
|
||||
if (isGlobalColourMapEnabled())
|
||||
{
|
||||
tu = pass->createTextureUnitState("");
|
||||
tu->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
|
||||
|
@ -1004,7 +1004,7 @@ namespace Ogre
|
|||
"uniform sampler2D globalNormal : register(s" << currentSamplerIdx++ << ")\n";
|
||||
|
||||
|
||||
//if (terrain->getGlobalColourMapEnabled() && prof->isGlobalColourMapEnabled())
|
||||
if (prof->isGlobalColourMapEnabled())
|
||||
{
|
||||
outStream << ", uniform sampler2D globalColourMap : register(s"
|
||||
<< currentSamplerIdx++ << ")\n";
|
||||
|
@ -1299,7 +1299,7 @@ namespace Ogre
|
|||
}
|
||||
else
|
||||
{
|
||||
//if (terrain->getGlobalColourMapEnabled() && prof->isGlobalColourMapEnabled())
|
||||
if (prof->isGlobalColourMapEnabled())
|
||||
{
|
||||
// sample colour map and apply to diffuse
|
||||
outStream << " diffuse *= tex2D(globalColourMap, uv).rgb;\n";
|
||||
|
|
Loading…
Reference in a new issue