mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-18 21:26:12 +00:00
Mode2D selection
This commit is contained in:
parent
5d5674e1fa
commit
ac4c9b7fc4
3 changed files with 12 additions and 7 deletions
|
@ -64,7 +64,7 @@ public:
|
|||
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 cleanup();
|
||||
|
|
|
@ -2401,10 +2401,11 @@ bool CDriverGL::copyTargetToTexture (ITexture *tex,
|
|||
bool CDriverGL::getRenderTargetSize (uint32 &width, uint32 &height)
|
||||
{
|
||||
H_AUTO_OGL(CDriverGL_getRenderTargetSize)
|
||||
if (_TextureTarget)
|
||||
NLMISC::CSmartPtr<ITexture> tex = _TextureTarget ? _TextureTarget : (_RenderTargetFBO ? _RenderTargetFBO : NULL);
|
||||
if (tex)
|
||||
{
|
||||
width = _TextureTarget->getWidth();
|
||||
height = _TextureTarget->getHeight();
|
||||
width = tex->getWidth();
|
||||
height = tex->getHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@ struct CRenderTargetDescInt
|
|||
public:
|
||||
uint Width;
|
||||
uint Height;
|
||||
bool Mode2D;
|
||||
NL3D::CTextureUser *TextureUser;
|
||||
NLMISC::CSmartPtr<NL3D::ITexture> TextureInterface;
|
||||
bool InUse;
|
||||
|
@ -71,13 +72,13 @@ CRenderTargetManager::~CRenderTargetManager()
|
|||
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
|
||||
for (std::vector<CRenderTargetDescInt *>::iterator it(m_RenderTargets.begin()), end(m_RenderTargets.end()); it != end; ++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->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);
|
||||
NL3D::IDriver *drvInternal = (static_cast<CDriverUser *>(m_Driver))->getDriver();
|
||||
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->setReleasable(false);
|
||||
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.
|
||||
desc->Width = width;
|
||||
desc->Height = height;
|
||||
desc->Mode2D = mode2D;
|
||||
desc->Used = true;
|
||||
desc->InUse = true;
|
||||
m_RenderTargets.push_back(desc);
|
||||
|
|
Loading…
Reference in a new issue