mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 07:16:15 +00:00
Mode2D selection
This commit is contained in:
parent
a6812f5844
commit
029d9bddfe
3 changed files with 12 additions and 7 deletions
|
@ -64,7 +64,7 @@ public:
|
||||||
CRenderTargetManager();
|
CRenderTargetManager();
|
||||||
~CRenderTargetManager();
|
~CRenderTargetManager();
|
||||||
|
|
||||||
NL3D::CTextureUser *getRenderTarget(uint width, uint height);
|
NL3D::CTextureUser *getRenderTarget(uint width, uint height, bool mode2D = false);
|
||||||
void recycleRenderTarget(NL3D::CTextureUser *renderTarget);
|
void recycleRenderTarget(NL3D::CTextureUser *renderTarget);
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
|
@ -2401,10 +2401,11 @@ bool CDriverGL::copyTargetToTexture (ITexture *tex,
|
||||||
bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height)
|
bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height)
|
||||||
{
|
{
|
||||||
H_AUTO_OGL(CDriverGL_getRenderTargetSize)
|
H_AUTO_OGL(CDriverGL_getRenderTargetSize)
|
||||||
if (_TextureTarget)
|
NLMISC::CSmartPtr<ITexture> tex = _TextureTarget ? _TextureTarget : (_RenderTargetFBO ? _RenderTargetFBO : NULL);
|
||||||
|
if (tex)
|
||||||
{
|
{
|
||||||
width = _TextureTarget->getWidth();
|
width = tex->getWidth();
|
||||||
height = _TextureTarget->getHeight();
|
height = tex->getHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,6 +53,7 @@ struct CRenderTargetDescInt
|
||||||
public:
|
public:
|
||||||
uint Width;
|
uint Width;
|
||||||
uint Height;
|
uint Height;
|
||||||
|
bool Mode2D;
|
||||||
NL3D::CTextureUser *TextureUser;
|
NL3D::CTextureUser *TextureUser;
|
||||||
NLMISC::CSmartPtr<NL3D::ITexture> TextureInterface;
|
NLMISC::CSmartPtr<NL3D::ITexture> TextureInterface;
|
||||||
bool InUse;
|
bool InUse;
|
||||||
|
@ -71,13 +72,13 @@ CRenderTargetManager::~CRenderTargetManager()
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint height)
|
NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint height, bool mode2D)
|
||||||
{
|
{
|
||||||
// Find or create a render target, short loop so no real optimization
|
// Find or create a render target, short loop so no real optimization
|
||||||
for (std::vector<CRenderTargetDescInt *>::iterator it(m_RenderTargets.begin()), end(m_RenderTargets.end()); it != end; ++it)
|
for (std::vector<CRenderTargetDescInt *>::iterator it(m_RenderTargets.begin()), end(m_RenderTargets.end()); it != end; ++it)
|
||||||
{
|
{
|
||||||
CRenderTargetDescInt *desc = *it;
|
CRenderTargetDescInt *desc = *it;
|
||||||
if (!desc->InUse && desc->Width == width && desc->Height == height)
|
if (!desc->InUse && desc->Width == width && desc->Height == height && desc->Mode2D == mode2D)
|
||||||
{
|
{
|
||||||
desc->InUse = true;
|
desc->InUse = true;
|
||||||
desc->Used = true;
|
desc->Used = true;
|
||||||
|
@ -88,7 +89,9 @@ NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint heigh
|
||||||
nldebug("3D: Create new render target (%u x %u)", width, height);
|
nldebug("3D: Create new render target (%u x %u)", width, height);
|
||||||
NL3D::IDriver *drvInternal = (static_cast<CDriverUser *>(m_Driver))->getDriver();
|
NL3D::IDriver *drvInternal = (static_cast<CDriverUser *>(m_Driver))->getDriver();
|
||||||
CRenderTargetDescInt *desc = new CRenderTargetDescInt();
|
CRenderTargetDescInt *desc = new CRenderTargetDescInt();
|
||||||
desc->TextureInterface = new CTextureBloom(); // LOL
|
CTextureBloom *tex = new CTextureBloom(); // LOL
|
||||||
|
tex->mode2D(mode2D);
|
||||||
|
desc->TextureInterface = tex;
|
||||||
desc->TextureInterface->setRenderTarget(true);
|
desc->TextureInterface->setRenderTarget(true);
|
||||||
desc->TextureInterface->setReleasable(false);
|
desc->TextureInterface->setReleasable(false);
|
||||||
desc->TextureInterface->resize(width, height);
|
desc->TextureInterface->resize(width, height);
|
||||||
|
@ -100,6 +103,7 @@ NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint heigh
|
||||||
nlassert(!drvInternal->isTextureRectangle(desc->TextureInterface)); // Not allowed, we only support NPOT for render targets now.
|
nlassert(!drvInternal->isTextureRectangle(desc->TextureInterface)); // Not allowed, we only support NPOT for render targets now.
|
||||||
desc->Width = width;
|
desc->Width = width;
|
||||||
desc->Height = height;
|
desc->Height = height;
|
||||||
|
desc->Mode2D = mode2D;
|
||||||
desc->Used = true;
|
desc->Used = true;
|
||||||
desc->InUse = true;
|
desc->InUse = true;
|
||||||
m_RenderTargets.push_back(desc);
|
m_RenderTargets.push_back(desc);
|
||||||
|
|
Loading…
Reference in a new issue