Merge remote branch 'scrawl/graphics'

actorid
Marc Zinnschlag 13 years ago
commit f36c8733fa

@ -240,6 +240,7 @@ Ogre::Entity* NpcAnimation::insertBoundedPart(const std::string &mesh, std::stri
NIFLoader::load(mesh);
Entity* ent = mRend.getScene()->createEntity(mesh);
ent->setVisibilityFlags(RV_Actors);
base->attachObjectToBone(bonename, ent);
return ent;
@ -249,9 +250,7 @@ void NpcAnimation::insertFreePart(const std::string &mesh, const std::string suf
NIFLoader::load(meshNumbered);
Ogre::Entity* ent = mRend.getScene()->createEntity(meshNumbered);
ent->setVisibilityFlags(RV_Actors);
insert->attachObject(ent);
entityparts.push_back(ent);

@ -56,6 +56,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
const RenderSystemCapabilities* caps = Root::getSingleton().getRenderSystem()->getCapabilities();
if (caps->getNumMultiRenderTargets() < 2)
Settings::Manager::setBool("shader", "Water", false);
if (!caps->isShaderProfileSupported("fp40") && !caps->isShaderProfileSupported("ps_4_0"))
Settings::Manager::setBool("enabled", "Shadows", false);
// note that the order is important here
if (useMRT())
@ -108,7 +110,6 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
RenderingManager::~RenderingManager ()
{
//TODO: destroy mSun?
delete mPlayer;
delete mSkyManager;
delete mDebugging;
@ -481,11 +482,13 @@ void RenderingManager::preCellChange(MWWorld::Ptr::CellStore* cell)
void RenderingManager::disableLights()
{
mObjects.disableLights();
sunDisable();
}
void RenderingManager::enableLights()
{
mObjects.enableLights();
sunEnable();
}
const bool RenderingManager::useMRT()

@ -540,7 +540,6 @@ namespace Ogre
params->setNamedAutoConstant("viewProjMatrix", GpuProgramParameters::ACT_VIEWPROJ_MATRIX);
params->setNamedAutoConstant("lodMorph", GpuProgramParameters::ACT_CUSTOM,
Terrain::LOD_MORPH_CUSTOM_PARAM);
params->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS);
if (prof->isShadowingEnabled(tt, terrain))
{
@ -576,7 +575,7 @@ namespace Ogre
{
params->setNamedAutoConstant("lightPosObjSpace"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE, i);
params->setNamedAutoConstant("lightDiffuseColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_DIFFUSE_COLOUR, i);
if (prof->getNumberOfLightsSupported() > 1)
if (i > 0)
params->setNamedAutoConstant("lightAttenuation"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_ATTENUATION, i);
//params->setNamedAutoConstant("lightSpecularColour"+StringConverter::toString(i), GpuProgramParameters::ACT_LIGHT_SPECULAR_COLOUR, i);
}
@ -586,6 +585,7 @@ namespace Ogre
params->setNamedAutoConstant("eyePosObjSpace", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE);
params->setNamedAutoConstant("fogColour", GpuProgramParameters::ACT_FOG_COLOUR);
params->setNamedAutoConstant("fogParams", GpuProgramParameters::ACT_FOG_PARAMS);
if (prof->isShadowingEnabled(tt, terrain))
{
@ -813,11 +813,11 @@ namespace Ogre
outStream <<
"out float4 oPos : POSITION,\n"
"out float4 oPosObj : COLOR \n";
"out float4 oPosObj : TEXCOORD0 \n";
uint texCoordSet = 0;
uint texCoordSet = 1;
outStream <<
", out float4 oUVMisc : TEXCOORD" << texCoordSet++ <<" // xy = uv, z = camDepth\n";
", out float4 oUVMisc : COLOR0 // xy = uv, z = camDepth\n";
// layer UV's premultiplied, packed as xy/zw
uint numUVSets = numLayers / 2;
@ -837,14 +837,6 @@ namespace Ogre
outStream << ", out float2 lodInfo : TEXCOORD" << texCoordSet++ << "\n";
}
bool fog = terrain->getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP;
if (fog)
{
outStream <<
", uniform float4 fogParams\n";
//", out float fogVal : COLOR\n";
}
if (prof->isShadowingEnabled(tt, terrain))
{
texCoordSet = generateVpDynamicShadowsParams(texCoordSet, prof, terrain, tt, outStream);
@ -940,11 +932,11 @@ namespace Ogre
outStream <<
"void main_fp(\n"
"float4 position : COLOR,\n";
"float4 position : TEXCOORD0,\n";
uint texCoordSet = 0;
uint texCoordSet = 1;
outStream <<
"float4 uvMisc : TEXCOORD" << texCoordSet++ << ",\n";
"float4 uvMisc : COLOR0,\n";
// UV's premultiplied, packed as xy/zw
uint maxLayers = prof->getMaxLayers(terrain);
@ -971,8 +963,8 @@ namespace Ogre
if (fog)
{
outStream <<
"uniform float4 fogParams, \n"
"uniform float3 fogColour, \n";
//"float fogVal : COLOR,\n";
}
uint currentSamplerIdx = 0;
@ -991,7 +983,7 @@ namespace Ogre
//"uniform float3 lightSpecularColour"<<i<<",\n"
;
if (prof->getNumberOfLightsSupported() > 1)
if (i > 0)
outStream <<
"uniform float4 lightAttenuation"<<i<<",\n";
@ -1069,7 +1061,6 @@ namespace Ogre
" float4 outputCol;\n"
" float shadow = 1.0;\n"
" float2 uv = uvMisc.xy;\n"
" float fogVal = position.w; \n"
// base colour
" outputCol = float4(0,0,0,1);\n";
@ -1161,7 +1152,7 @@ namespace Ogre
outStream << " float3 halfAngle"<<i<<" = normalize(lightDir"<<i<<" + eyeDir);\n"
" float4 litRes"<<i<<" = lit(dot(normalize(lightDir"<<i<<"), normal), dot(halfAngle"<<i<<", normal), scaleBiasSpecular.z);\n";
if (prof->getNumberOfLightsSupported() > 1)
if (i > 0)
outStream <<
// pre-multiply light color with attenuation factor
"d = length( lightDir"<<i<<" ); \n"
@ -1273,24 +1264,7 @@ namespace Ogre
outStream <<
" // pass cam depth\n"
" oUVMisc.z = oPos.z;\n";
bool fog = terrain->getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP;
if (fog)
{
if (terrain->getSceneManager()->getFogMode() == FOG_LINEAR)
{
outStream <<
" float fogVal = saturate((oPos.z - fogParams.y) * fogParams.w);\n";
}
else
{
outStream <<
" float fogVal = saturate(1 / (exp(oPos.z * fogParams.x)));\n";
}
outStream <<
" oPosObj.w = fogVal; \n";
}
" oPosObj.w = oPos.z;\n";
if (prof->isShadowingEnabled(tt, terrain))
generateVpDynamicShadows(prof, terrain, tt, outStream);
@ -1341,7 +1315,13 @@ namespace Ogre
// diffuse lighting
for (int i=0; i<prof->getNumberOfLightsSupported(); ++i)
{
// shadows only for first light (directional)
if (i==0)
outStream << " outputCol.rgb += litRes"<<i<<".y * lightDiffuseColour"<<i<<" * diffuse * shadow;\n";
else
outStream << " outputCol.rgb += litRes"<<i<<".y * lightDiffuseColour"<<i<<" * diffuse;\n";
}
// specular default
if (!prof->isLayerSpecularMappingEnabled())
@ -1369,6 +1349,16 @@ namespace Ogre
bool fog = terrain->getSceneManager()->getFogMode() != FOG_NONE && tt != RENDER_COMPOSITE_MAP;
if (fog)
{
if (terrain->getSceneManager()->getFogMode() == FOG_LINEAR)
{
outStream <<
" float fogVal = saturate((position.w - fogParams.y) * fogParams.w);\n";
}
else
{
outStream <<
" float fogVal = saturate(1 / (exp(position.w * fogParams.x)));\n";
}
outStream << " outputCol.rgb = lerp(outputCol.rgb, fogColour, fogVal);\n";
}
@ -1376,7 +1366,7 @@ namespace Ogre
outStream << " oColor = outputCol;\n";
if (MWRender::RenderingManager::useMRT()) outStream <<
" oColor1 = float4(uvMisc.z / far, 0, 0, 1); \n";
" oColor1 = float4(position.w / far, 0, 0, 1); \n";
outStream
<< "}\n";
@ -1585,7 +1575,7 @@ namespace Ogre
{
uint numTextures = prof->getReceiveDynamicShadowsPSSM()->getSplitCount();
outStream <<
" float camDepth = uvMisc.z;\n";
" float camDepth = position.w;\n";
if (prof->getReceiveDynamicShadowsDepth())
{
@ -1629,8 +1619,8 @@ namespace Ogre
outStream <<
" float fadeRange = shadowFar_fadeStart.x - shadowFar_fadeStart.y; \n"
" float fade = 1-((uvMisc.z - shadowFar_fadeStart.y) / fadeRange); \n"
" rtshadow = (uvMisc.z > shadowFar_fadeStart.x) ? 1 : ((uvMisc.z > shadowFar_fadeStart.y) ? 1-((1-rtshadow)*fade) : rtshadow); \n"
" float fade = 1-((position.w - shadowFar_fadeStart.y) / fadeRange); \n"
" rtshadow = (position.w > shadowFar_fadeStart.x) ? 1 : ((position.w > shadowFar_fadeStart.y) ? 1-((1-rtshadow)*fade) : rtshadow); \n"
" rtshadow = (1-(1-rtshadow)*0.6); \n" // make the shadow a little less intensive
" shadow = min(shadow, rtshadow);\n";

@ -93,7 +93,7 @@ rtt size = 512
reflect terrain = true
reflect statics = false
reflect small statics = false
reflect actors = true
reflect actors = false
reflect misc = false
# Enable underwater effect. It is not resource intensive, so only disable it if you have problems.

Loading…
Cancel
Save