forked from Mirrorlandia_minetest/irrlicht
Fix singular/plural in some variable names used in rendertargets.
Still can't decide on fixing/leaving function names... brr git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6241 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
ef85ff7fba
commit
a5f38804a3
@ -39,7 +39,7 @@ namespace video
|
||||
//! Returns an array of previously set textures.
|
||||
const core::array<ITexture*>& getTexture() const
|
||||
{
|
||||
return Texture;
|
||||
return Textures;
|
||||
}
|
||||
|
||||
//! Returns a of previously set depth / depth-stencil texture.
|
||||
@ -87,7 +87,7 @@ namespace video
|
||||
protected:
|
||||
|
||||
//! Textures assigned to render target.
|
||||
core::array<ITexture*> Texture;
|
||||
core::array<ITexture*> Textures;
|
||||
|
||||
//! Depth or packed depth-stencil texture assigned to render target.
|
||||
ITexture* DepthStencil;
|
||||
|
@ -30,36 +30,36 @@ namespace irr
|
||||
|
||||
CD3D9RenderTarget::~CD3D9RenderTarget()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
Surface[i]->Release();
|
||||
if (Surfaces[i])
|
||||
Surfaces[i]->Release();
|
||||
}
|
||||
|
||||
if (DepthStencilSurface)
|
||||
DepthStencilSurface->Release();
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
Texture[i]->drop();
|
||||
if (Textures[i])
|
||||
Textures[i]->drop();
|
||||
}
|
||||
|
||||
if (DepthStencil)
|
||||
DepthStencil->drop();
|
||||
}
|
||||
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
bool needSizeUpdate = false;
|
||||
|
||||
// Set color attachments.
|
||||
if ((Texture != texture) || (CubeSurfaces != cubeSurfaces))
|
||||
if ((Textures != textures) || (CubeSurfaces != cubeSurfaces))
|
||||
{
|
||||
needSizeUpdate = true;
|
||||
CubeSurfaces = cubeSurfaces; // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change.
|
||||
|
||||
if (texture.size() > Driver->ActiveRenderTarget.size())
|
||||
if (textures.size() > Driver->ActiveRenderTarget.size())
|
||||
{
|
||||
core::stringc message = "This GPU supports up to ";
|
||||
message += Driver->ActiveRenderTarget.size();
|
||||
@ -68,23 +68,23 @@ namespace irr
|
||||
os::Printer::log(message.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
const u32 size = core::min_(texture.size(), static_cast<u32>(Driver->ActiveRenderTarget.size()));
|
||||
const u32 size = core::min_(textures.size(), static_cast<u32>(Driver->ActiveRenderTarget.size()));
|
||||
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
Surface[i]->Release();
|
||||
if (Surfaces[i])
|
||||
Surfaces[i]->Release();
|
||||
}
|
||||
|
||||
Surface.set_used(size);
|
||||
Surfaces.set_used(size);
|
||||
|
||||
core::array<ITexture*> prevTextures(Texture);
|
||||
core::array<ITexture*> prevTextures(Textures);
|
||||
|
||||
Texture.set_used(size);
|
||||
Textures.set_used(size);
|
||||
|
||||
for (u32 i = 0; i < size; ++i)
|
||||
{
|
||||
CD3D9Texture* currentTexture = (texture[i] && texture[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(texture[i]) : 0;
|
||||
CD3D9Texture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(textures[i]) : 0;
|
||||
|
||||
IDirect3DTexture9* textureID = 0;
|
||||
IDirect3DCubeTexture9* cubeTextureId = 0;
|
||||
@ -100,29 +100,29 @@ namespace irr
|
||||
|
||||
if (textureID)
|
||||
{
|
||||
Texture[i] = texture[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
textureID->GetSurfaceLevel(level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
else if ( cubeTextureId )
|
||||
{
|
||||
Texture[i] = texture[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering
|
||||
cubeTextureId->GetCubeMapSurface(face, level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
Surface[i] = 0;
|
||||
Texture[i] = 0;
|
||||
Surfaces[i] = 0;
|
||||
Textures[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,11 +189,11 @@ namespace irr
|
||||
|
||||
bool sizeDetected = false;
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
if (Textures[i])
|
||||
{
|
||||
Size = Texture[i]->getSize();
|
||||
Size = Textures[i]->getSize();
|
||||
sizeDetected = true;
|
||||
|
||||
break;
|
||||
@ -217,12 +217,12 @@ namespace irr
|
||||
|
||||
IDirect3DSurface9* CD3D9RenderTarget::getSurface(u32 id) const
|
||||
{
|
||||
return (id < Surface.size()) ? Surface[id] : 0;
|
||||
return (id < Surfaces.size()) ? Surfaces[id] : 0;
|
||||
}
|
||||
|
||||
u32 CD3D9RenderTarget::getSurfaceCount() const
|
||||
{
|
||||
return Surface.size();
|
||||
return Surfaces.size();
|
||||
}
|
||||
|
||||
IDirect3DSurface9* CD3D9RenderTarget::getDepthStencilSurface() const
|
||||
@ -232,12 +232,12 @@ namespace irr
|
||||
|
||||
void CD3D9RenderTarget::releaseSurfaces()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (Surface[i])
|
||||
if (Surfaces[i])
|
||||
{
|
||||
Surface[i]->Release();
|
||||
Surface[i] = 0;
|
||||
Surfaces[i]->Release();
|
||||
Surfaces[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,16 +250,16 @@ namespace irr
|
||||
|
||||
void CD3D9RenderTarget::generateSurfaces()
|
||||
{
|
||||
for (u32 i = 0; i < Surface.size(); ++i)
|
||||
for (u32 i = 0; i < Surfaces.size(); ++i)
|
||||
{
|
||||
if (!Surface[i] && Texture[i])
|
||||
if (!Surfaces[i] && Textures[i])
|
||||
{
|
||||
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Texture[i])->getDX9Texture();
|
||||
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Textures[i])->getDX9Texture();
|
||||
if ( currentTexture )
|
||||
{
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
currentTexture->GetSurfaceLevel(0, ¤tSurface);
|
||||
Surface[i] = currentSurface;
|
||||
Surfaces[i] = currentSurface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ namespace irr
|
||||
protected:
|
||||
core::dimension2d<u32> Size;
|
||||
|
||||
core::array<IDirect3DSurface9*> Surface;
|
||||
core::array<IDirect3DSurface9*> Surfaces;
|
||||
|
||||
IDirect3DSurface9* DepthStencilSurface;
|
||||
|
||||
|
@ -37,10 +37,10 @@ public:
|
||||
if (ColorAttachment > 0)
|
||||
Driver->irrGlGenFramebuffers(1, &BufferID);
|
||||
|
||||
AssignedTexture.set_used(static_cast<u32>(ColorAttachment));
|
||||
AssignedTextures.set_used(static_cast<u32>(ColorAttachment));
|
||||
|
||||
for (u32 i = 0; i < AssignedTexture.size(); ++i)
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
for (u32 i = 0; i < AssignedTextures.size(); ++i)
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
}
|
||||
|
||||
virtual ~COpenGLCoreRenderTarget()
|
||||
@ -48,10 +48,10 @@ public:
|
||||
if (ColorAttachment > 0 && BufferID != 0)
|
||||
Driver->irrGlDeleteFramebuffers(1, &BufferID);
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
Texture[i]->drop();
|
||||
if (Textures[i])
|
||||
Textures[i]->drop();
|
||||
}
|
||||
|
||||
if (DepthStencil)
|
||||
@ -63,11 +63,11 @@ public:
|
||||
bool needSizeUpdate = false;
|
||||
|
||||
// Set color attachments.
|
||||
if ((Texture != textures) || (CubeSurfaces != cubeSurfaces))
|
||||
if ((Textures != textures) || (CubeSurfaces != cubeSurfaces))
|
||||
{
|
||||
needSizeUpdate = true;
|
||||
|
||||
core::array<ITexture*> prevTextures(Texture);
|
||||
core::array<ITexture*> prevTextures(Textures);
|
||||
|
||||
if (textures.size() > static_cast<u32>(ColorAttachment))
|
||||
{
|
||||
@ -78,9 +78,9 @@ public:
|
||||
os::Printer::log(message.c_str(), ELL_WARNING);
|
||||
}
|
||||
|
||||
Texture.set_used(core::min_(textures.size(), static_cast<u32>(ColorAttachment)));
|
||||
Textures.set_used(core::min_(textures.size(), static_cast<u32>(ColorAttachment)));
|
||||
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
TOpenGLTexture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(textures[i]) : 0;
|
||||
|
||||
@ -93,12 +93,12 @@ public:
|
||||
|
||||
if (textureID != 0)
|
||||
{
|
||||
Texture[i] = textures[i];
|
||||
Texture[i]->grab();
|
||||
Textures[i] = textures[i];
|
||||
Textures[i]->grab();
|
||||
}
|
||||
else
|
||||
{
|
||||
Texture[i] = 0;
|
||||
Textures[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,26 +183,26 @@ public:
|
||||
{
|
||||
// Set new color textures.
|
||||
|
||||
const u32 textureSize = core::min_(Texture.size(), AssignedTexture.size());
|
||||
const u32 textureSize = core::min_(Textures.size(), AssignedTextures.size());
|
||||
|
||||
for (u32 i = 0; i < textureSize; ++i)
|
||||
{
|
||||
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Texture[i]);
|
||||
TOpenGLTexture* currentTexture = static_cast<TOpenGLTexture*>(Textures[i]);
|
||||
GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;
|
||||
|
||||
if (textureID != 0)
|
||||
{
|
||||
AssignedTexture[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||
AssignedTextures[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||
GLenum textarget = currentTexture->getType() == ETT_2D ? GL_TEXTURE_2D : GL_TEXTURE_CUBE_MAP_POSITIVE_X + (int)CubeSurfaces[i];
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], textarget, textureID, 0);
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], textarget, textureID, 0);
|
||||
#ifdef _DEBUG
|
||||
Driver->testGLError(__LINE__);
|
||||
#endif
|
||||
}
|
||||
else if (AssignedTexture[i] != GL_NONE)
|
||||
else if (AssignedTextures[i] != GL_NONE)
|
||||
{
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
|
||||
|
||||
os::Printer::log("Error: Could not set render target.", ELL_ERROR);
|
||||
}
|
||||
@ -210,12 +210,12 @@ public:
|
||||
|
||||
// Reset other render target channels.
|
||||
|
||||
for (u32 i = textureSize; i < AssignedTexture.size(); ++i)
|
||||
for (u32 i = textureSize; i < AssignedTextures.size(); ++i)
|
||||
{
|
||||
if (AssignedTexture[i] != GL_NONE)
|
||||
if (AssignedTextures[i] != GL_NONE)
|
||||
{
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTexture[i] = GL_NONE;
|
||||
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
|
||||
AssignedTextures[i] = GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ public:
|
||||
|
||||
if (ColorAttachment > 0 && BufferID != 0)
|
||||
{
|
||||
const u32 textureSize = Texture.size();
|
||||
const u32 textureSize = Textures.size();
|
||||
|
||||
if (textureSize == 0)
|
||||
Driver->irrGlDrawBuffer(GL_NONE);
|
||||
@ -280,9 +280,9 @@ public:
|
||||
Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
else
|
||||
{
|
||||
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTexture.size()));
|
||||
const u32 bufferCount = core::min_(MultipleRenderTarget, core::min_(textureSize, AssignedTextures.size()));
|
||||
|
||||
Driver->irrGlDrawBuffers(bufferCount, AssignedTexture.pointer());
|
||||
Driver->irrGlDrawBuffers(bufferCount, AssignedTextures.pointer());
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -309,10 +309,10 @@ public:
|
||||
|
||||
ITexture* getTexture() const
|
||||
{
|
||||
for (u32 i = 0; i < Texture.size(); ++i)
|
||||
for (u32 i = 0; i < Textures.size(); ++i)
|
||||
{
|
||||
if (Texture[i])
|
||||
return Texture[i];
|
||||
if (Textures[i])
|
||||
return Textures[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -359,7 +359,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
core::array<GLenum> AssignedTexture;
|
||||
core::array<GLenum> AssignedTextures;
|
||||
bool AssignedDepth;
|
||||
bool AssignedStencil;
|
||||
|
||||
|
@ -119,30 +119,30 @@ CSoftwareRenderTarget::CSoftwareRenderTarget(CSoftwareDriver* driver) : Driver(d
|
||||
{
|
||||
DriverType = EDT_SOFTWARE;
|
||||
|
||||
Texture.set_used(1);
|
||||
Texture[0] = 0;
|
||||
Textures.set_used(1);
|
||||
Textures[0] = 0;
|
||||
}
|
||||
|
||||
CSoftwareRenderTarget::~CSoftwareRenderTarget()
|
||||
{
|
||||
if (Texture[0])
|
||||
Texture[0]->drop();
|
||||
if (Textures[0])
|
||||
Textures[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
if (Textures != textures)
|
||||
{
|
||||
ITexture* prevTexture = Texture[0];
|
||||
ITexture* prevTexture = Textures[0];
|
||||
|
||||
bool textureDetected = false;
|
||||
|
||||
for (u32 i = 0; i < texture.size(); ++i)
|
||||
for (u32 i = 0; i < textures.size(); ++i)
|
||||
{
|
||||
if (texture[i] && texture[i]->getDriverType() == EDT_SOFTWARE)
|
||||
if (textures[i] && textures[i]->getDriverType() == EDT_SOFTWARE)
|
||||
{
|
||||
Texture[0] = texture[i];
|
||||
Texture[0]->grab();
|
||||
Textures[0] = textures[i];
|
||||
Textures[0]->grab();
|
||||
textureDetected = true;
|
||||
|
||||
break;
|
||||
@ -153,13 +153,13 @@ void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, IT
|
||||
prevTexture->drop();
|
||||
|
||||
if (!textureDetected)
|
||||
Texture[0] = 0;
|
||||
Textures[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ITexture* CSoftwareRenderTarget::getTexture() const
|
||||
{
|
||||
return Texture[0];
|
||||
return Textures[0];
|
||||
}
|
||||
|
||||
|
||||
|
@ -385,30 +385,30 @@ CSoftwareRenderTarget2::CSoftwareRenderTarget2(CBurningVideoDriver* driver) : Dr
|
||||
{
|
||||
DriverType = EDT_BURNINGSVIDEO;
|
||||
|
||||
Texture.set_used(1);
|
||||
Texture[0] = 0;
|
||||
Textures.set_used(1);
|
||||
Textures[0] = 0;
|
||||
}
|
||||
|
||||
CSoftwareRenderTarget2::~CSoftwareRenderTarget2()
|
||||
{
|
||||
if (Texture[0])
|
||||
Texture[0]->drop();
|
||||
if (Textures[0])
|
||||
Textures[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& textures, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
if (Textures != textures)
|
||||
{
|
||||
ITexture* prevTexture = Texture[0];
|
||||
ITexture* prevTexture = Textures[0];
|
||||
|
||||
bool textureDetected = false;
|
||||
|
||||
for (u32 i = 0; i < texture.size(); ++i)
|
||||
for (u32 i = 0; i < textures.size(); ++i)
|
||||
{
|
||||
if (texture[i] && texture[i]->getDriverType() == EDT_BURNINGSVIDEO)
|
||||
if (textures[i] && textures[i]->getDriverType() == EDT_BURNINGSVIDEO)
|
||||
{
|
||||
Texture[0] = texture[i];
|
||||
Texture[0]->grab();
|
||||
Textures[0] = textures[i];
|
||||
Textures[0]->grab();
|
||||
textureDetected = true;
|
||||
|
||||
break;
|
||||
@ -419,7 +419,7 @@ void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, I
|
||||
prevTexture->drop();
|
||||
|
||||
if (!textureDetected)
|
||||
Texture[0] = 0;
|
||||
Textures[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user