mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-28 11:50:53 +00:00
Render target format (for alpha)
This commit is contained in:
parent
74c4c09211
commit
655d709ceb
2 changed files with 10 additions and 4 deletions
|
@ -36,7 +36,7 @@
|
|||
#include <nel/misc/geom_ext.h>
|
||||
|
||||
// Project includes
|
||||
// ...
|
||||
#include <nel/3d/u_texture.h>
|
||||
|
||||
namespace NL3D {
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
CRenderTargetManager();
|
||||
~CRenderTargetManager();
|
||||
|
||||
NL3D::CTextureUser *getRenderTarget(uint width, uint height, bool mode2D = false);
|
||||
NL3D::CTextureUser *getRenderTarget(uint width, uint height, bool mode2D = false, UTexture::TUploadFormat format = UTexture::Auto);
|
||||
void recycleRenderTarget(NL3D::CTextureUser *renderTarget);
|
||||
|
||||
void cleanup();
|
||||
|
|
|
@ -51,9 +51,13 @@ namespace NL3D {
|
|||
struct CRenderTargetDescInt
|
||||
{
|
||||
public:
|
||||
// Options
|
||||
uint Width;
|
||||
uint Height;
|
||||
bool Mode2D;
|
||||
UTexture::TUploadFormat Format;
|
||||
|
||||
// Data
|
||||
NL3D::CTextureUser *TextureUser;
|
||||
NLMISC::CSmartPtr<NL3D::ITexture> TextureInterface;
|
||||
bool InUse;
|
||||
|
@ -72,13 +76,13 @@ CRenderTargetManager::~CRenderTargetManager()
|
|||
cleanup();
|
||||
}
|
||||
|
||||
NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint height, bool mode2D)
|
||||
NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint height, bool mode2D, UTexture::TUploadFormat format)
|
||||
{
|
||||
// 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 && desc->Mode2D == mode2D)
|
||||
if (!desc->InUse && desc->Width == width && desc->Height == height && desc->Mode2D == mode2D && desc->Format == format)
|
||||
{
|
||||
desc->InUse = true;
|
||||
desc->Used = true;
|
||||
|
@ -94,6 +98,7 @@ NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint heigh
|
|||
desc->TextureInterface = tex;
|
||||
desc->TextureInterface->setRenderTarget(true);
|
||||
desc->TextureInterface->setReleasable(false);
|
||||
desc->TextureInterface->setUploadFormat((ITexture::TUploadFormat)(uint32)format);
|
||||
desc->TextureInterface->resize(width, height);
|
||||
desc->TextureInterface->setFilterMode(ITexture::Linear, ITexture::LinearMipMapOff);
|
||||
desc->TextureInterface->setWrapS(ITexture::Clamp);
|
||||
|
@ -104,6 +109,7 @@ NL3D::CTextureUser *CRenderTargetManager::getRenderTarget(uint width, uint heigh
|
|||
desc->Width = width;
|
||||
desc->Height = height;
|
||||
desc->Mode2D = mode2D;
|
||||
desc->Format = format;
|
||||
desc->Used = true;
|
||||
desc->InUse = true;
|
||||
m_RenderTargets.push_back(desc);
|
||||
|
|
Loading…
Reference in a new issue