Move scissor test to IVideoDriver
This commit is contained in:
parent
2c3922f64f
commit
af7d6cf391
@ -1479,6 +1479,8 @@ namespace video
|
|||||||
virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
virtual void convertColor(const void* sP, ECOLOR_FORMAT sF, s32 sN,
|
||||||
void* dP, ECOLOR_FORMAT dF) const =0;
|
void* dP, ECOLOR_FORMAT dF) const =0;
|
||||||
virtual u32 getDefaultFramebuffer() const =0;
|
virtual u32 getDefaultFramebuffer() const =0;
|
||||||
|
virtual void enableScissorTest(const core::rect<s32>& r) {}
|
||||||
|
virtual void disableScissorTest() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace video
|
} // end namespace video
|
||||||
|
@ -2703,6 +2703,18 @@ namespace video
|
|||||||
return Material;
|
return Material;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COGLES2Driver::enableScissorTest(const core::rect<s32>& r)
|
||||||
|
{
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y,
|
||||||
|
r.getWidth(), r.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
void COGLES2Driver::disableScissorTest()
|
||||||
|
{
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
COGLES2CallBridge* COGLES2Driver::getBridgeCalls() const
|
COGLES2CallBridge* COGLES2Driver::getBridgeCalls() const
|
||||||
{
|
{
|
||||||
return BridgeCalls;
|
return BridgeCalls;
|
||||||
|
@ -68,6 +68,8 @@ namespace video
|
|||||||
friend class COGLES2Texture;
|
friend class COGLES2Texture;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual void enableScissorTest(const core::rect<s32>& r);
|
||||||
|
virtual void disableScissorTest();
|
||||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||||
const SExposedVideoData& data,
|
const SExposedVideoData& data,
|
||||||
|
@ -4939,6 +4939,17 @@ GLenum COpenGLDriver::getZBufferBits() const
|
|||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COpenGLDriver::enableScissorTest(const core::rect<s32>& r)
|
||||||
|
{
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
glScissor(r.UpperLeftCorner.X, r.UpperLeftCorner.Y,
|
||||||
|
r.getWidth(), r.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
void COpenGLDriver::disableScissorTest()
|
||||||
|
{
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
@ -38,6 +38,9 @@ namespace video
|
|||||||
friend class COpenGLTexture;
|
friend class COpenGLTexture;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual void enableScissorTest(const core::rect<s32>& r);
|
||||||
|
virtual void disableScissorTest();
|
||||||
|
|
||||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceWin32* device);
|
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceWin32* device);
|
||||||
//! inits the windows specific parts of the open gl driver
|
//! inits the windows specific parts of the open gl driver
|
||||||
|
@ -165,15 +165,16 @@ void FontDrawer::draw()
|
|||||||
|
|
||||||
if (g_clip)
|
if (g_clip)
|
||||||
{
|
{
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
const core::dimension2d<u32>& render_target_size =
|
const core::dimension2d<u32>& render_target_size =
|
||||||
irr_driver->getActualScreenSize();
|
irr_driver->getActualScreenSize();
|
||||||
glScissor(g_clip->UpperLeftCorner.X,
|
s32 y = (s32)render_target_size.Height - g_clip->LowerRightCorner.Y;
|
||||||
(s32)render_target_size.Height - g_clip->LowerRightCorner.Y,
|
core::rect<s32> r(g_clip->UpperLeftCorner.X, y,
|
||||||
g_clip->getWidth(), g_clip->getHeight());
|
g_clip->UpperLeftCorner.X + g_clip->getWidth(),
|
||||||
|
y + g_clip->getHeight());
|
||||||
|
irr_driver->getVideoDriver()->enableScissorTest(r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
glDisable(GL_SCISSOR_TEST);
|
irr_driver->getVideoDriver()->disableScissorTest();
|
||||||
|
|
||||||
for (auto& glyph : g_glyphs)
|
for (auto& glyph : g_glyphs)
|
||||||
{
|
{
|
||||||
@ -258,7 +259,7 @@ void FontDrawer::draw()
|
|||||||
|
|
||||||
if (g_clip)
|
if (g_clip)
|
||||||
{
|
{
|
||||||
glDisable(GL_SCISSOR_TEST);
|
irr_driver->getVideoDriver()->disableScissorTest();
|
||||||
g_clip.reset();
|
g_clip.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user