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