reverted mapping of [minDepth;maxDepth + 100] interval onto [-1;1] interval because of non-linearity of Z-buffer on some devices.

This commit is contained in:
rachytski 2013-03-19 17:14:20 +03:00 committed by Alex Zolotarev
parent a7ee544657
commit d5eff151f7
5 changed files with 6 additions and 6 deletions

View file

@ -12,7 +12,7 @@ namespace graphics
{
m(0, 0) = 2 / (r - l); m(0, 1) = 0; m(0, 2) = 0; m(0, 3) = -(r + l) / (r - l);
m(1, 0) = 0; m(1, 1) = 2 / (t - b);m(1, 2) = 0; m(1, 3) = -(t + b) / (t - b);
m(2, 0) = 0; m(2, 1) = 0; m(2, 2) = 2 / (f - n); m(2, 3) = - (f + n) / (f - n);
m(2, 0) = 0; m(2, 1) = 0; m(2, 2) = -2 / (f - n); m(2, 3) = (f + n) / (f - n);
m(3, 0) = 0; m(3, 1) = 0; m(3, 2) = 0; m(3, 3) = 1;
}
}

View file

@ -85,7 +85,7 @@ namespace graphics
void enableClipRect(bool flag);
void setClipRect(m2::RectI const & rect);
void clear(Color const & c, bool clearRT = true, float depth = -1.0, bool clearDepth = true);
void clear(Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
/// @}
unsigned reservePipelines(vector<shared_ptr<ResourceCache> > const & caches,

View file

@ -466,7 +466,7 @@ namespace graphics
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
OGLCHECK(glEnable(GL_DEPTH_TEST));
OGLCHECK(glDepthFunc(GL_GEQUAL));
OGLCHECK(glDepthFunc(GL_LEQUAL));
OGLCHECK(glEnable(GL_BLEND));
OGLCHECK(glDepthMask(GL_TRUE));
@ -536,7 +536,7 @@ namespace graphics
OGLCHECK(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
OGLCHECK(glEnable(GL_DEPTH_TEST));
OGLCHECK(glDepthFunc(GL_GEQUAL));
OGLCHECK(glDepthFunc(GL_LEQUAL));
OGLCHECK(glEnable(GL_BLEND));
OGLCHECK(glDepthMask(GL_TRUE));

View file

@ -162,7 +162,7 @@ namespace graphics
/// @warning this function respects the clipping rect set and enabled(!)
/// by the setClipRect/enableClipRect. Whether the clipping is
/// not enabled - the entire currently bound render surface is used.
void clear(graphics::Color const & c, bool clearRT = true, float depth = -1.0, bool clearDepth = true);
void clear(graphics::Color const & c, bool clearRT = true, float depth = 1.0, bool clearDepth = true);
void onSize(unsigned width, unsigned height);

View file

@ -110,7 +110,7 @@ public:
void beginFrame();
void endFrame();
void clear(graphics::Color const & c = graphics::Color(187, 187, 187, 255), bool clearRT = true, float depth = -1.0f, bool clearDepth = true);
void clear(graphics::Color const & c = graphics::Color(187, 187, 187, 255), bool clearRT = true, float depth = 1.0f, bool clearDepth = true);
void onSize(int w, int h);