mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-02 00:00:26 +02:00
Reformat the code, using:
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
@ -12,115 +12,108 @@ namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class ITexture;
|
||||
class ITexture;
|
||||
|
||||
//! Enumeration of cube texture surfaces
|
||||
enum E_CUBE_SURFACE
|
||||
//! Enumeration of cube texture surfaces
|
||||
enum E_CUBE_SURFACE
|
||||
{
|
||||
ECS_POSX = 0,
|
||||
ECS_NEGX,
|
||||
ECS_POSY,
|
||||
ECS_NEGY,
|
||||
ECS_POSZ,
|
||||
ECS_NEGZ
|
||||
};
|
||||
|
||||
//! Interface of a Render Target.
|
||||
class IRenderTarget : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
//! constructor
|
||||
IRenderTarget() :
|
||||
DepthStencil(0), DriverType(EDT_NULL)
|
||||
{
|
||||
ECS_POSX = 0,
|
||||
ECS_NEGX,
|
||||
ECS_POSY,
|
||||
ECS_NEGY,
|
||||
ECS_POSZ,
|
||||
ECS_NEGZ
|
||||
};
|
||||
}
|
||||
|
||||
//! Interface of a Render Target.
|
||||
class IRenderTarget : public virtual IReferenceCounted
|
||||
//! Returns an array of previously set textures.
|
||||
const core::array<ITexture *> &getTexture() const
|
||||
{
|
||||
public:
|
||||
return Textures;
|
||||
}
|
||||
|
||||
//! constructor
|
||||
IRenderTarget() : DepthStencil(0), DriverType(EDT_NULL)
|
||||
{
|
||||
//! Returns a of previously set depth / depth-stencil texture.
|
||||
ITexture *getDepthStencil() const
|
||||
{
|
||||
return DepthStencil;
|
||||
}
|
||||
|
||||
//! Returns an array of active surface for cube textures
|
||||
const core::array<E_CUBE_SURFACE> &getCubeSurfaces() const
|
||||
{
|
||||
return CubeSurfaces;
|
||||
}
|
||||
|
||||
//! Set multiple textures.
|
||||
/** Set multiple textures for the render target.
|
||||
\param texture Array of texture objects. These textures are used for a color outputs.
|
||||
\param depthStencil Depth or packed depth-stencil texture. This texture is used as depth
|
||||
or depth-stencil buffer. You can pass getDepthStencil() if you don't want to change it.
|
||||
\param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.
|
||||
*/
|
||||
void setTexture(const core::array<ITexture *> &texture, ITexture *depthStencil, const core::array<E_CUBE_SURFACE> &cubeSurfaces = core::array<E_CUBE_SURFACE>())
|
||||
{
|
||||
setTextures(texture.const_pointer(), texture.size(), depthStencil, cubeSurfaces.const_pointer(), cubeSurfaces.size());
|
||||
}
|
||||
|
||||
//! Sets one texture + depthStencil
|
||||
//! You can pass getDepthStencil() for depthStencil if you don't want to change that one
|
||||
void setTexture(ITexture *texture, ITexture *depthStencil)
|
||||
{
|
||||
if (texture) {
|
||||
setTextures(&texture, 1, depthStencil);
|
||||
} else {
|
||||
setTextures(0, 0, depthStencil);
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns an array of previously set textures.
|
||||
const core::array<ITexture*>& getTexture() const
|
||||
{
|
||||
return Textures;
|
||||
//! Set one cube surface texture.
|
||||
void setTexture(ITexture *texture, ITexture *depthStencil, E_CUBE_SURFACE cubeSurface)
|
||||
{
|
||||
if (texture) {
|
||||
setTextures(&texture, 1, depthStencil, &cubeSurface, 1);
|
||||
} else {
|
||||
setTextures(0, 0, depthStencil, &cubeSurface, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns a of previously set depth / depth-stencil texture.
|
||||
ITexture* getDepthStencil() const
|
||||
{
|
||||
return DepthStencil;
|
||||
}
|
||||
//! Get driver type of render target.
|
||||
E_DRIVER_TYPE getDriverType() const
|
||||
{
|
||||
return DriverType;
|
||||
}
|
||||
|
||||
//! Returns an array of active surface for cube textures
|
||||
const core::array<E_CUBE_SURFACE>& getCubeSurfaces() const
|
||||
{
|
||||
return CubeSurfaces;
|
||||
}
|
||||
protected:
|
||||
//! Set multiple textures.
|
||||
// NOTE: working with pointers instead of arrays to avoid unnecessary memory allocations for the single textures case
|
||||
virtual void setTextures(ITexture *const *textures, u32 numTextures, ITexture *depthStencil, const E_CUBE_SURFACE *cubeSurfaces = 0, u32 numCubeSurfaces = 0) = 0;
|
||||
|
||||
//! Set multiple textures.
|
||||
/** Set multiple textures for the render target.
|
||||
\param texture Array of texture objects. These textures are used for a color outputs.
|
||||
\param depthStencil Depth or packed depth-stencil texture. This texture is used as depth
|
||||
or depth-stencil buffer. You can pass getDepthStencil() if you don't want to change it.
|
||||
\param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.
|
||||
*/
|
||||
void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>())
|
||||
{
|
||||
setTextures(texture.const_pointer(), texture.size(), depthStencil, cubeSurfaces.const_pointer(), cubeSurfaces.size());
|
||||
}
|
||||
//! Textures assigned to render target.
|
||||
core::array<ITexture *> Textures;
|
||||
|
||||
//! Sets one texture + depthStencil
|
||||
//! You can pass getDepthStencil() for depthStencil if you don't want to change that one
|
||||
void setTexture(ITexture* texture, ITexture* depthStencil)
|
||||
{
|
||||
if ( texture )
|
||||
{
|
||||
setTextures(&texture, 1, depthStencil);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTextures(0, 0, depthStencil);
|
||||
}
|
||||
}
|
||||
//! Depth or packed depth-stencil texture assigned to render target.
|
||||
ITexture *DepthStencil;
|
||||
|
||||
//! Set one cube surface texture.
|
||||
void setTexture(ITexture* texture, ITexture* depthStencil, E_CUBE_SURFACE cubeSurface)
|
||||
{
|
||||
if ( texture )
|
||||
{
|
||||
setTextures(&texture, 1, depthStencil, &cubeSurface, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
setTextures(0, 0, depthStencil, &cubeSurface, 1);
|
||||
}
|
||||
}
|
||||
//! Active surface of cube textures
|
||||
core::array<E_CUBE_SURFACE> CubeSurfaces;
|
||||
|
||||
//! Get driver type of render target.
|
||||
E_DRIVER_TYPE getDriverType() const
|
||||
{
|
||||
return DriverType;
|
||||
}
|
||||
//! Driver type of render target.
|
||||
E_DRIVER_TYPE DriverType;
|
||||
|
||||
protected:
|
||||
|
||||
//! Set multiple textures.
|
||||
// NOTE: working with pointers instead of arrays to avoid unnecessary memory allocations for the single textures case
|
||||
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces=0, u32 numCubeSurfaces=0) = 0;
|
||||
|
||||
//! Textures assigned to render target.
|
||||
core::array<ITexture*> Textures;
|
||||
|
||||
//! Depth or packed depth-stencil texture assigned to render target.
|
||||
ITexture* DepthStencil;
|
||||
|
||||
//! Active surface of cube textures
|
||||
core::array<E_CUBE_SURFACE> CubeSurfaces;
|
||||
|
||||
//! Driver type of render target.
|
||||
E_DRIVER_TYPE DriverType;
|
||||
|
||||
private:
|
||||
// no copying (IReferenceCounted still allows that for reasons which take some time to work around)
|
||||
IRenderTarget(const IRenderTarget&);
|
||||
IRenderTarget& operator=(const IRenderTarget&);
|
||||
};
|
||||
private:
|
||||
// no copying (IReferenceCounted still allows that for reasons which take some time to work around)
|
||||
IRenderTarget(const IRenderTarget &);
|
||||
IRenderTarget &operator=(const IRenderTarget &);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user