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:
cutealien 2021-08-26 14:09:35 +00:00
parent ef85ff7fba
commit a5f38804a3
6 changed files with 97 additions and 97 deletions

@ -39,7 +39,7 @@ namespace video
//! Returns an array of previously set textures. //! Returns an array of previously set textures.
const core::array<ITexture*>& getTexture() const const core::array<ITexture*>& getTexture() const
{ {
return Texture; return Textures;
} }
//! Returns a of previously set depth / depth-stencil texture. //! Returns a of previously set depth / depth-stencil texture.
@ -87,7 +87,7 @@ namespace video
protected: protected:
//! Textures assigned to render target. //! Textures assigned to render target.
core::array<ITexture*> Texture; core::array<ITexture*> Textures;
//! Depth or packed depth-stencil texture assigned to render target. //! Depth or packed depth-stencil texture assigned to render target.
ITexture* DepthStencil; ITexture* DepthStencil;

@ -30,36 +30,36 @@ namespace irr
CD3D9RenderTarget::~CD3D9RenderTarget() CD3D9RenderTarget::~CD3D9RenderTarget()
{ {
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(); Surfaces[i]->Release();
} }
if (DepthStencilSurface) if (DepthStencilSurface)
DepthStencilSurface->Release(); DepthStencilSurface->Release();
for (u32 i = 0; i < Texture.size(); ++i) for (u32 i = 0; i < Textures.size(); ++i)
{ {
if (Texture[i]) if (Textures[i])
Texture[i]->drop(); Textures[i]->drop();
} }
if (DepthStencil) if (DepthStencil)
DepthStencil->drop(); 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; bool needSizeUpdate = false;
// Set color attachments. // Set color attachments.
if ((Texture != texture) || (CubeSurfaces != cubeSurfaces)) if ((Textures != textures) || (CubeSurfaces != cubeSurfaces))
{ {
needSizeUpdate = true; needSizeUpdate = true;
CubeSurfaces = cubeSurfaces; // TODO: we can probably avoid some memory allocating/de-allocating if _only_ CubeSurfaces change. 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 "; core::stringc message = "This GPU supports up to ";
message += Driver->ActiveRenderTarget.size(); message += Driver->ActiveRenderTarget.size();
@ -68,23 +68,23 @@ namespace irr
os::Printer::log(message.c_str(), ELL_WARNING); 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]) if (Surfaces[i])
Surface[i]->Release(); 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) 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; IDirect3DTexture9* textureID = 0;
IDirect3DCubeTexture9* cubeTextureId = 0; IDirect3DCubeTexture9* cubeTextureId = 0;
@ -100,29 +100,29 @@ namespace irr
if (textureID) if (textureID)
{ {
Texture[i] = texture[i]; Textures[i] = textures[i];
Texture[i]->grab(); Textures[i]->grab();
IDirect3DSurface9* currentSurface = 0; IDirect3DSurface9* currentSurface = 0;
textureID->GetSurfaceLevel(level, &currentSurface); textureID->GetSurfaceLevel(level, &currentSurface);
Surface[i] = currentSurface; Surfaces[i] = currentSurface;
} }
else if ( cubeTextureId ) else if ( cubeTextureId )
{ {
Texture[i] = texture[i]; Textures[i] = textures[i];
Texture[i]->grab(); Textures[i]->grab();
IDirect3DSurface9* currentSurface = 0; IDirect3DSurface9* currentSurface = 0;
D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering
cubeTextureId->GetCubeMapSurface(face, level, &currentSurface); cubeTextureId->GetCubeMapSurface(face, level, &currentSurface);
Surface[i] = currentSurface; Surfaces[i] = currentSurface;
} }
else else
{ {
Surface[i] = 0; Surfaces[i] = 0;
Texture[i] = 0; Textures[i] = 0;
} }
} }
@ -189,11 +189,11 @@ namespace irr
bool sizeDetected = false; 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; sizeDetected = true;
break; break;
@ -217,12 +217,12 @@ namespace irr
IDirect3DSurface9* CD3D9RenderTarget::getSurface(u32 id) const IDirect3DSurface9* CD3D9RenderTarget::getSurface(u32 id) const
{ {
return (id < Surface.size()) ? Surface[id] : 0; return (id < Surfaces.size()) ? Surfaces[id] : 0;
} }
u32 CD3D9RenderTarget::getSurfaceCount() const u32 CD3D9RenderTarget::getSurfaceCount() const
{ {
return Surface.size(); return Surfaces.size();
} }
IDirect3DSurface9* CD3D9RenderTarget::getDepthStencilSurface() const IDirect3DSurface9* CD3D9RenderTarget::getDepthStencilSurface() const
@ -232,12 +232,12 @@ namespace irr
void CD3D9RenderTarget::releaseSurfaces() 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(); Surfaces[i]->Release();
Surface[i] = 0; Surfaces[i] = 0;
} }
} }
@ -250,16 +250,16 @@ namespace irr
void CD3D9RenderTarget::generateSurfaces() 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 ) if ( currentTexture )
{ {
IDirect3DSurface9* currentSurface = 0; IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface); currentTexture->GetSurfaceLevel(0, &currentSurface);
Surface[i] = currentSurface; Surfaces[i] = currentSurface;
} }
} }
} }

@ -46,7 +46,7 @@ namespace irr
protected: protected:
core::dimension2d<u32> Size; core::dimension2d<u32> Size;
core::array<IDirect3DSurface9*> Surface; core::array<IDirect3DSurface9*> Surfaces;
IDirect3DSurface9* DepthStencilSurface; IDirect3DSurface9* DepthStencilSurface;

@ -37,10 +37,10 @@ public:
if (ColorAttachment > 0) if (ColorAttachment > 0)
Driver->irrGlGenFramebuffers(1, &BufferID); 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) for (u32 i = 0; i < AssignedTextures.size(); ++i)
AssignedTexture[i] = GL_NONE; AssignedTextures[i] = GL_NONE;
} }
virtual ~COpenGLCoreRenderTarget() virtual ~COpenGLCoreRenderTarget()
@ -48,10 +48,10 @@ public:
if (ColorAttachment > 0 && BufferID != 0) if (ColorAttachment > 0 && BufferID != 0)
Driver->irrGlDeleteFramebuffers(1, &BufferID); Driver->irrGlDeleteFramebuffers(1, &BufferID);
for (u32 i = 0; i < Texture.size(); ++i) for (u32 i = 0; i < Textures.size(); ++i)
{ {
if (Texture[i]) if (Textures[i])
Texture[i]->drop(); Textures[i]->drop();
} }
if (DepthStencil) if (DepthStencil)
@ -63,11 +63,11 @@ public:
bool needSizeUpdate = false; bool needSizeUpdate = false;
// Set color attachments. // Set color attachments.
if ((Texture != textures) || (CubeSurfaces != cubeSurfaces)) if ((Textures != textures) || (CubeSurfaces != cubeSurfaces))
{ {
needSizeUpdate = true; needSizeUpdate = true;
core::array<ITexture*> prevTextures(Texture); core::array<ITexture*> prevTextures(Textures);
if (textures.size() > static_cast<u32>(ColorAttachment)) if (textures.size() > static_cast<u32>(ColorAttachment))
{ {
@ -78,9 +78,9 @@ public:
os::Printer::log(message.c_str(), ELL_WARNING); 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; TOpenGLTexture* currentTexture = (textures[i] && textures[i]->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(textures[i]) : 0;
@ -93,12 +93,12 @@ public:
if (textureID != 0) if (textureID != 0)
{ {
Texture[i] = textures[i]; Textures[i] = textures[i];
Texture[i]->grab(); Textures[i]->grab();
} }
else else
{ {
Texture[i] = 0; Textures[i] = 0;
} }
} }
@ -183,26 +183,26 @@ public:
{ {
// Set new color textures. // 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) 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; GLuint textureID = currentTexture ? currentTexture->getOpenGLTextureName() : 0;
if (textureID != 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]; 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 #ifdef _DEBUG
Driver->testGLError(__LINE__); Driver->testGLError(__LINE__);
#endif #endif
} }
else if (AssignedTexture[i] != GL_NONE) else if (AssignedTextures[i] != GL_NONE)
{ {
AssignedTexture[i] = GL_NONE; AssignedTextures[i] = GL_NONE;
Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTexture[i], GL_TEXTURE_2D, 0, 0); Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
os::Printer::log("Error: Could not set render target.", ELL_ERROR); os::Printer::log("Error: Could not set render target.", ELL_ERROR);
} }
@ -210,12 +210,12 @@ public:
// Reset other render target channels. // 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); Driver->irrGlFramebufferTexture2D(GL_FRAMEBUFFER, AssignedTextures[i], GL_TEXTURE_2D, 0, 0);
AssignedTexture[i] = GL_NONE; AssignedTextures[i] = GL_NONE;
} }
} }
@ -272,7 +272,7 @@ public:
if (ColorAttachment > 0 && BufferID != 0) if (ColorAttachment > 0 && BufferID != 0)
{ {
const u32 textureSize = Texture.size(); const u32 textureSize = Textures.size();
if (textureSize == 0) if (textureSize == 0)
Driver->irrGlDrawBuffer(GL_NONE); Driver->irrGlDrawBuffer(GL_NONE);
@ -280,9 +280,9 @@ public:
Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0); Driver->irrGlDrawBuffer(GL_COLOR_ATTACHMENT0);
else 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 #ifdef _DEBUG
@ -309,10 +309,10 @@ public:
ITexture* getTexture() const ITexture* getTexture() const
{ {
for (u32 i = 0; i < Texture.size(); ++i) for (u32 i = 0; i < Textures.size(); ++i)
{ {
if (Texture[i]) if (Textures[i])
return Texture[i]; return Textures[i];
} }
return 0; return 0;
@ -359,7 +359,7 @@ protected:
return false; return false;
} }
core::array<GLenum> AssignedTexture; core::array<GLenum> AssignedTextures;
bool AssignedDepth; bool AssignedDepth;
bool AssignedStencil; bool AssignedStencil;

@ -119,30 +119,30 @@ CSoftwareRenderTarget::CSoftwareRenderTarget(CSoftwareDriver* driver) : Driver(d
{ {
DriverType = EDT_SOFTWARE; DriverType = EDT_SOFTWARE;
Texture.set_used(1); Textures.set_used(1);
Texture[0] = 0; Textures[0] = 0;
} }
CSoftwareRenderTarget::~CSoftwareRenderTarget() CSoftwareRenderTarget::~CSoftwareRenderTarget()
{ {
if (Texture[0]) if (Textures[0])
Texture[0]->drop(); 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; 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]; Textures[0] = textures[i];
Texture[0]->grab(); Textures[0]->grab();
textureDetected = true; textureDetected = true;
break; break;
@ -153,13 +153,13 @@ void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, IT
prevTexture->drop(); prevTexture->drop();
if (!textureDetected) if (!textureDetected)
Texture[0] = 0; Textures[0] = 0;
} }
} }
ITexture* CSoftwareRenderTarget::getTexture() const ITexture* CSoftwareRenderTarget::getTexture() const
{ {
return Texture[0]; return Textures[0];
} }

@ -385,30 +385,30 @@ CSoftwareRenderTarget2::CSoftwareRenderTarget2(CBurningVideoDriver* driver) : Dr
{ {
DriverType = EDT_BURNINGSVIDEO; DriverType = EDT_BURNINGSVIDEO;
Texture.set_used(1); Textures.set_used(1);
Texture[0] = 0; Textures[0] = 0;
} }
CSoftwareRenderTarget2::~CSoftwareRenderTarget2() CSoftwareRenderTarget2::~CSoftwareRenderTarget2()
{ {
if (Texture[0]) if (Textures[0])
Texture[0]->drop(); 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; 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]; Textures[0] = textures[i];
Texture[0]->grab(); Textures[0]->grab();
textureDetected = true; textureDetected = true;
break; break;
@ -419,7 +419,7 @@ void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, I
prevTexture->drop(); prevTexture->drop();
if (!textureDetected) if (!textureDetected)
Texture[0] = 0; Textures[0] = 0;
} }
} }