mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
Attempt (and fail) to make the local map show without unwanted shadow
This commit is contained in:
parent
c3616ca78b
commit
aa31cbba4f
@ -23,6 +23,7 @@
|
|||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
|
||||||
#include "vismask.hpp"
|
#include "vismask.hpp"
|
||||||
|
#include "shadow.hpp"
|
||||||
|
|
||||||
namespace
|
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);
|
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->addChild(lightSource);
|
||||||
camera->setStateSet(stateset);
|
camera->setStateSet(stateset);
|
||||||
camera->setViewport(0, 0, mMapResolution, mMapResolution);
|
camera->setViewport(0, 0, mMapResolution, mMapResolution);
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
#include "apps/openmw/mwrender/shadow.hpp"
|
||||||
|
|
||||||
namespace Shader
|
namespace Shader
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -106,7 +108,7 @@ namespace Shader
|
|||||||
// set up shadows in the shader
|
// set up shadows in the shader
|
||||||
// get these values from settings manager
|
// get these values from settings manager
|
||||||
bool shadows = true & !disableShadows;
|
bool shadows = true & !disableShadows;
|
||||||
int numShadowMaps = 2;
|
int numShadowMaps = MWRender::MWShadow::numberOfShadowMapsPerLight;
|
||||||
DefineMap definesWithShadows;
|
DefineMap definesWithShadows;
|
||||||
if (shadows)
|
if (shadows)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user