1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00

Attempt (and fail) to make the local map show without unwanted shadow

This commit is contained in:
AnyOldName3 2017-11-08 01:20:52 +00:00
parent c3616ca78b
commit aa31cbba4f
2 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include "../mwworld/cellstore.hpp"
#include "vismask.hpp"
#include "shadow.hpp"
namespace
{
@ -201,6 +202,13 @@ osg::ref_ptr<osg::Camera> LocalMap::createOrthographicCamera(float x, float y, f
lightSource->setStateSetModes(*stateset, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
osg::ref_ptr<osg::Image> fakeShadowMapImage = new osg::Image();
fakeShadowMapImage->allocateImage(1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT);
*(float*)fakeShadowMapImage->data() = -std::numeric_limits<float>::infinity(); // this has been tried both positive and negative
osg::ref_ptr<osg::Texture> fakeShadowMapTexture = new osg::Texture2D(fakeShadowMapImage);
for (int i = MWShadow::baseShadowTextureUnit; i < MWShadow::baseShadowTextureUnit + MWShadow::numberOfShadowMapsPerLight; ++i)
stateset->setTextureAttributeAndModes(i, fakeShadowMapTexture, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED);
camera->addChild(lightSource);
camera->setStateSet(stateset);
camera->setViewport(0, 0, mMapResolution, mMapResolution);

View File

@ -11,6 +11,8 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string.hpp>
#include "apps/openmw/mwrender/shadow.hpp"
namespace Shader
{
@ -106,7 +108,7 @@ namespace Shader
// set up shadows in the shader
// get these values from settings manager
bool shadows = true & !disableShadows;
int numShadowMaps = 2;
int numShadowMaps = MWRender::MWShadow::numberOfShadowMapsPerLight;
DefineMap definesWithShadows;
if (shadows)
{