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