mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-28 01:56:24 +00:00
3D: Render target matrix context fix
This commit is contained in:
parent
0c6907c995
commit
318798eeef
5 changed files with 15 additions and 13 deletions
|
@ -251,7 +251,7 @@ public:
|
|||
virtual CRenderTargetManager &getRenderTargetManager() { return _RenderTargetManager; }
|
||||
|
||||
/// Set a texture the size of the window as render target
|
||||
virtual void beginDefaultRenderTarget();
|
||||
virtual void beginDefaultRenderTarget(uint32 width = 0, uint32 height = 0);
|
||||
|
||||
/// Draw the render target to the back buffer
|
||||
virtual void endDefaultRenderTarget(UScene *scene);
|
||||
|
|
|
@ -310,8 +310,8 @@ public:
|
|||
/// Get the render target manager
|
||||
virtual CRenderTargetManager &getRenderTargetManager() =0;
|
||||
|
||||
/// Set a texture the size of the window as render target
|
||||
virtual void beginDefaultRenderTarget() =0;
|
||||
/// Set a texture of specified size or of the size of the window as render target
|
||||
virtual void beginDefaultRenderTarget(uint32 width = 0, uint32 height = 0) =0;
|
||||
|
||||
/// Draw the render target to the back buffer
|
||||
virtual void endDefaultRenderTarget(UScene *scene) =0;
|
||||
|
|
|
@ -1077,7 +1077,7 @@ void CDriverGL::setupViewport (const class CViewport& viewport)
|
|||
|
||||
// Setup gl viewport
|
||||
uint32 clientWidth, clientHeight;
|
||||
getWindowSize(clientWidth, clientHeight);
|
||||
getRenderTargetSize(clientWidth, clientHeight);
|
||||
|
||||
// Backup the viewport
|
||||
_CurrViewport = viewport;
|
||||
|
@ -1132,7 +1132,7 @@ void CDriverGL::setupScissor (const class CScissor& scissor)
|
|||
|
||||
// Setup gl viewport
|
||||
uint32 clientWidth, clientHeight;
|
||||
getWindowSize(clientWidth, clientHeight);
|
||||
getRenderTargetSize(clientWidth, clientHeight);
|
||||
|
||||
// Backup the scissor
|
||||
_CurrScissor= scissor;
|
||||
|
|
|
@ -1948,9 +1948,7 @@ bool CDriverUser::setRenderTarget(class UTexture & uTex, uint32 x, uint32 y, uin
|
|||
|
||||
bool result = _Driver->setRenderTarget(tex, x, y, width, height, mipmapLevel, cubeFace);
|
||||
|
||||
CViewport currentViewport;
|
||||
_Driver->getViewport(currentViewport);
|
||||
setViewport(currentViewport);
|
||||
setupMatrixContext();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void CDriverUser::deleteScene(UScene *scene)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverUser::beginDefaultRenderTarget()
|
||||
void CDriverUser::beginDefaultRenderTarget(uint32 width, uint32 height)
|
||||
{
|
||||
if (_MatRenderTarget.empty())
|
||||
{
|
||||
|
@ -102,9 +102,9 @@ void CDriverUser::beginDefaultRenderTarget()
|
|||
}
|
||||
|
||||
nlassert(!_EffectRenderTarget);
|
||||
uint32 winw, winh;
|
||||
getWindowSize(winw, winh);
|
||||
_EffectRenderTarget = getRenderTargetManager().getRenderTarget(winw, winh);
|
||||
if (width == 0 || height == 0)
|
||||
getWindowSize(width, height);
|
||||
_EffectRenderTarget = getRenderTargetManager().getRenderTarget(width, height);
|
||||
setRenderTarget(*_EffectRenderTarget);
|
||||
}
|
||||
|
||||
|
@ -123,12 +123,16 @@ void CDriverUser::endDefaultRenderTarget(UScene *scene)
|
|||
if (scene)
|
||||
{
|
||||
pCam = scene->getCam();
|
||||
setMatrixMode2D11();
|
||||
}
|
||||
CViewport oldVp = getViewport();
|
||||
CViewport vp = CViewport();
|
||||
setViewport(vp);
|
||||
setMatrixMode2D11();
|
||||
bool fog = fogEnabled();
|
||||
enableFog(false);
|
||||
drawQuad(_RenderTargetQuad, _MatRenderTarget);
|
||||
enableFog(fog);
|
||||
setViewport(oldVp);
|
||||
if (scene)
|
||||
{
|
||||
setMatrixMode3D(pCam);
|
||||
|
|
Loading…
Reference in a new issue