Add scissor test for CD3D9Driver

This commit is contained in:
Benau
2021-04-21 16:39:45 +08:00
parent b9b5ac2fec
commit 18690fad3a
2 changed files with 22 additions and 0 deletions

View File

@@ -3591,6 +3591,25 @@ core::dimension2du CD3D9Driver::getMaxTextureSize() const
return core::dimension2du(Caps.MaxTextureWidth, Caps.MaxTextureHeight);
}
void CD3D9Driver::enableScissorTest(const core::rect<s32>& r)
{
pID3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
RECT rect;
rect.left = r.UpperLeftCorner.X;
rect.top = r.UpperLeftCorner.Y;
rect.right = r.LowerRightCorner.X;
rect.bottom = r.LowerRightCorner.Y;
pID3DDevice->SetScissorRect(&rect);
}
void CD3D9Driver::disableScissorTest()
{
pID3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
}
#ifdef _IRR_COMPILE_WITH_CG_
const CGcontext& CD3D9Driver::getCgContext()
{

View File

@@ -337,6 +337,9 @@ namespace video
const CGcontext& getCgContext();
#endif
virtual void enableScissorTest(const core::rect<s32>& r);
virtual void disableScissorTest();
private:
//! enumeration for rendering modes such as 2d and 3d for minizing the switching of renderStates.