Image Formats NG
Public Types | Public Member Functions | Friends | List of all members
CubeTexture Class Reference

CubeTexture class represents a 6 sided cubic texture. More...

Public Types

enum  Side {
  Side::PositiveX, Side::NegativeX, Side::PositiveY, Side::NegativeY,
  Side::PositiveZ, Side::NegativeZ
}
 This enum describes possible sides of the cube. More...
 
enum  Projection { Projection::HorizonalCross, Projection::VerticalCross }
 This enum describes possible projections. More...
 

Public Member Functions

 CubeTexture () Q_DECL_NOEXCEPT
 Constructs a null texture. More...
 
 CubeTexture (const CubeTexture &other)
 Constructs a shallow copy of the given other texture.
 
 CubeTexture (CubeTexture &&other)
 Move-constructs a CubeTexture instance, making it point at the same object that other was pointing to.
 
 CubeTexture (int extent, QImage::Format format=QImage::Format_ARGB32)
 Constructs a texture with the given extent and format. More...
 
 ~CubeTexture ()
 Destroys the texture.
 
CubeTextureoperator= (const CubeTexture &other)
 Assigns a shallow copy of the given other texture to this texture and returns a reference to this texture.
 
CubeTextureoperator= (CubeTexture &&other)
 Move-assigns other to this texture.
 
bool isNull () const Q_DECL_NOEXCEPT
 Returns true if it is a null texture, otherwise returns false. More...
 
int width () const Q_DECL_NOEXCEPT
 Returns the width of the texture.
 
int height () const Q_DECL_NOEXCEPT
 Returns the height of the texture.
 
int depth () const Q_DECL_NOEXCEPT
 Returns the depth of the texture.
 
QImage::Format format () const Q_DECL_NOEXCEPT
 Returns the format of the texture.
 
QImage side (Side side) const
 Returns the image containing data of the given side of the cube.
 
void setSide (Side side, const QImage &image)
 Fills the data of the given side of the cube from the image. More...
 
CubeTexture scaled (int width)
 Returns a copy of the texture scaled to a given extent.
 
QImage toProjection (Projection projection) const
 Converts this texture to a plain image with all sides placed on it. More...
 

Friends

bool IMAGEFORMATSNG_EXPORT operator== (const CubeTexture &lhs, const CubeTexture &rhs)
 Returns true if the lhs texture and the rhs texture have the same contents; otherwise returns false.
 
bool IMAGEFORMATSNG_EXPORT operator!= (const CubeTexture &lhs, const CubeTexture &rhs)
 Returns true if the lhs texture and the rhs texture have different contents; otherwise returns false.
 

Detailed Description

CubeTexture class represents a 6 sided cubic texture.

Member Enumeration Documentation

◆ Projection

This enum describes possible projections.

Enumerator
HorizonalCross 

Horizonal cross projection.

VerticalCross 

Vertical cross projection.

◆ Side

enum CubeTexture::Side
strong

This enum describes possible sides of the cube.

Enumerator
PositiveX 

Positive x side.

NegativeX 

Negative x side.

PositiveY 

Positive y side.

NegativeY 

Negative y side.

PositiveZ 

Positive z side.

NegativeZ 

Negative z side.

Constructor & Destructor Documentation

◆ CubeTexture() [1/2]

CubeTexture::CubeTexture ( )

Constructs a null texture.

See also
CubeTexture::isNull()

◆ CubeTexture() [2/2]

CubeTexture::CubeTexture ( int  extent,
QImage::Format  format = QImage::Format_ARGB32 
)

Constructs a texture with the given extent and format.

Extent is the legth of the side of the cube, i.e. is width = height = depth = extent. A null texture is created if parameters are not valid.

Member Function Documentation

◆ isNull()

bool CubeTexture::isNull ( ) const

Returns true if it is a null texture, otherwise returns false.

A null texture has all parameters set to zero and no allocated data.

◆ setSide()

void CubeTexture::setSide ( CubeTexture::Side  side,
const QImage &  image 
)

Fills the data of the given side of the cube from the image.

Image must have same format, width and heigth as this texture.

◆ toProjection()

QImage CubeTexture::toProjection ( CubeTexture::Projection  projection) const

Converts this texture to a plain image with all sides placed on it.

How side are placed is determined by projection parameter.

See also
CubeTexture::Projection