Castor3D 0.16.0
Multiplatform 3D engine
|
#include <PixelBufferBase.hpp>
Public Types | |
using | PxArray = Vector< uint8_t > |
using | PixelData = PxArray::iterator |
using | ConstPixelData = PxArray::const_iterator |
Public Member Functions | |
CU_API | PxBufferBase (PxBufferConvertOptions const *options, std::atomic_bool const *interrupt, Size const &size, PixelFormat pixelFormat, uint32_t layers=1u, uint32_t levels=1u, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer from a source buffer, uninitialised data if no source is given. | |
CU_API | PxBufferBase (Size const &size, PixelFormat pixelFormat, uint32_t layers=1u, uint32_t levels=1u, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer from a source buffer, uninitialised data if no source is given. | |
CU_API | PxBufferBase (PxBufferBase const &pixelBuffer) |
Copy Constructor. | |
CU_API | PxBufferBase (PxBufferBase &&pixelBuffer) noexcept |
Move Constructor. | |
CU_API | ~PxBufferBase () noexcept=default |
Destructor. | |
CU_API PxBufferBase & | operator= (PxBufferBase const &pixelBuffer) |
Copy assignment operator. | |
CU_API PxBufferBase & | operator= (PxBufferBase &&pixelBuffer) noexcept |
Move assignment operator. | |
CU_API void | clear () |
Deletes the data buffer. | |
CU_API void | initialise (PxBufferConvertOptions const *options, std::atomic_bool const *interrupt, uint8_t const *buffer, PixelFormat bufferFormat, uint32_t bufferAlign=0u) |
Initialises the data buffer to the given one. | |
void | initialise (uint8_t const *buffer, PixelFormat bufferFormat, uint32_t bufferAlign=0u) |
Initialises the data buffer to the given one. | |
CU_API void | initialise (Size const &size) |
Initialises the data buffer at the given size. | |
CU_API void | flip () |
Makes a vertical swap of pixels. | |
CU_API void | swap (PxBufferBase &pixelBuffer) noexcept |
Swaps this buffer's data with the given one's. | |
CU_API void | update (uint32_t layers, uint32_t levels) |
Updates the buffer container, with given layers and miplevels counts. | |
CU_API void | generateMips () |
Generate mipmaps. | |
CU_API uint32_t | convertToTiles (uint32_t maxSize) |
Convert to tiles map (no effect if m_layers <= 1). | |
PxBufferBaseUPtr | clone () const |
CU_API PixelData | getAt (uint32_t x, uint32_t y, uint32_t index=0u, uint32_t level=0u) |
CU_API ConstPixelData | getAt (uint32_t x, uint32_t y, uint32_t index=0u, uint32_t level=0u) const |
uint64_t | getSize () const noexcept |
uint8_t const * | begin () const noexcept |
uint8_t const * | end () const noexcept |
uint8_t const * | cbegin () const noexcept |
uint8_t const * | cend () const noexcept |
uint8_t const * | getConstPtr () const noexcept |
uint8_t * | getPtr () noexcept |
bool | isFlipped () const noexcept |
PixelFormat | getFormat () const noexcept |
uint32_t | getWidth () const noexcept |
uint32_t | getHeight () const noexcept |
Point3ui | getTiles () const noexcept |
Size | getTileSize () const noexcept |
uint32_t | getTileWidth () const noexcept |
uint32_t | getTileHeight () const noexcept |
uint32_t | getLayers () const noexcept |
uint32_t | getLevels () const noexcept |
uint32_t | getAlign () const noexcept |
Size const & | getDimensions () const noexcept |
uint32_t | getCount () const noexcept |
PixelData | getAt (Position const &position) |
ConstPixelData | getAt (Position const &position) const |
Static Public Member Functions | |
static CU_API PxBufferBaseUPtr | create (PxBufferConvertOptions const *options, std::atomic_bool const *interrupt, Size const &size, uint32_t layers, uint32_t levels, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
static CU_API PxBufferBaseUPtr | create (PxBufferConvertOptions const *options, Size const &size, uint32_t layers, uint32_t levels, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
static CU_API PxBufferBaseUPtr | create (Size const &size, uint32_t layers, uint32_t levels, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
static CU_API PxBufferBaseUPtr | create (PxBufferConvertOptions const *options, std::atomic_bool const *interrupt, Size const &size, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
static CU_API PxBufferBaseUPtr | create (PxBufferConvertOptions const *options, Size const &size, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
static CU_API PxBufferBaseUPtr | create (Size const &size, PixelFormat wantedFormat, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM, uint32_t bufferAlign=0u) |
Creates a buffer with the given data. | |
Protected Member Functions | |
uint32_t | doConvert (uint32_t x, uint32_t y) const |
Protected Attributes | |
Size | m_size |
uint32_t | m_layers |
uint32_t | m_levels |
uint32_t | m_align |
Point3ui | m_tiles { 1u, 1u, 1u } |
PxArray | m_buffer |
using castor::PxBufferBase::ConstPixelData = PxArray::const_iterator |
using castor::PxBufferBase::PixelData = PxArray::iterator |
using castor::PxBufferBase::PxArray = Vector< uint8_t > |
CU_API castor::PxBufferBase::PxBufferBase | ( | PxBufferConvertOptions const * | options, |
std::atomic_bool const * | interrupt, | ||
Size const & | size, | ||
PixelFormat | pixelFormat, | ||
uint32_t | layers = 1u, | ||
uint32_t | levels = 1u, | ||
uint8_t const * | buffer = nullptr, | ||
PixelFormat | bufferFormat = PixelFormat::eR8G8B8A8_UNORM, | ||
uint32_t | bufferAlign = 0u ) |
Creates a buffer from a source buffer, uninitialised data if no source is given.
[in] | options | The convertion options. |
[in] | interrupt | Tells if the convertion is to be interrupted. |
[in] | size | Buffer dimensions. |
[in] | pixelFormat | Pixels format. |
[in] | layers | The number of layers stored in the buffer. |
[in] | levels | The number of miplevels stored in the buffer. |
[in] | buffer | The source buffer. |
[in] | bufferFormat | The pixels format of the source buffer. |
[in] | bufferAlign | The alignment of the source buffer. |
CU_API castor::PxBufferBase::PxBufferBase | ( | Size const & | size, |
PixelFormat | pixelFormat, | ||
uint32_t | layers = 1u, | ||
uint32_t | levels = 1u, | ||
uint8_t const * | buffer = nullptr, | ||
PixelFormat | bufferFormat = PixelFormat::eR8G8B8A8_UNORM, | ||
uint32_t | bufferAlign = 0u ) |
Creates a buffer from a source buffer, uninitialised data if no source is given.
[in] | size | Buffer dimensions. |
[in] | pixelFormat | Pixels format. |
[in] | layers | The number of layers stored in the buffer. |
[in] | levels | The number of miplevels stored in the buffer. |
[in] | buffer | The source buffer. |
[in] | bufferFormat | The pixels format of the source buffer. |
[in] | bufferAlign | The alignment of the source buffer. |
CU_API castor::PxBufferBase::PxBufferBase | ( | PxBufferBase const & | pixelBuffer | ) |
Copy Constructor.
[in] | pixelBuffer | The PxBufferBase object to copy |
|
noexcept |
Move Constructor.
[in] | pixelBuffer | The PxBufferBase object to move |
|
defaultnoexcept |
Destructor.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
CU_API void castor::PxBufferBase::clear | ( | ) |
Deletes the data buffer.
|
inline |
CU_API uint32_t castor::PxBufferBase::convertToTiles | ( | uint32_t | maxSize | ) |
Convert to tiles map (no effect if m_layers <= 1).
|
inlinestatic |
Creates a buffer with the given data.
[in] | options | The convertion options. |
[in] | size | Buffer dimensions. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
References create().
|
inlinestatic |
Creates a buffer with the given data.
[in] | options | The convertion options. |
[in] | size | Buffer dimensions. |
[in] | layers | Buffer layers (or slices). |
[in] | levels | Buffer mip levels. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
References create().
|
inlinestatic |
Creates a buffer with the given data.
[in] | options | The convertion options. |
[in] | interrupt | Tells if the convertion is to be interrupted. |
[in] | size | Buffer dimensions. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
References create().
|
static |
Creates a buffer with the given data.
[in] | options | The convertion options. |
[in] | interrupt | Tells if the convertion is to be interrupted. |
[in] | size | Buffer dimensions. |
[in] | layers | Buffer layers (or slices). |
[in] | levels | Buffer mip levels. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
Referenced by create(), create(), create(), create(), create(), and castor::WhiteNoise::generate().
|
inlinestatic |
Creates a buffer with the given data.
[in] | size | Buffer dimensions. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
References create().
|
inlinestatic |
Creates a buffer with the given data.
[in] | size | Buffer dimensions. |
[in] | layers | Buffer layers (or slices). |
[in] | levels | Buffer mip levels. |
[in] | wantedFormat | Pixels format. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | The alignment of the source buffer. |
References create().
|
inlineprotected |
|
inlinenoexcept |
CU_API void castor::PxBufferBase::flip | ( | ) |
Makes a vertical swap of pixels.
CU_API void castor::PxBufferBase::generateMips | ( | ) |
Generate mipmaps.
|
inlinenoexcept |
References m_align.
References getAt(), castor::Position::x(), and castor::Position::y().
|
inline |
References getAt(), castor::Position::x(), and castor::Position::y().
CU_API ConstPixelData castor::PxBufferBase::getAt | ( | uint32_t | x, |
uint32_t | y, | ||
uint32_t | index = 0u, | ||
uint32_t | level = 0u ) const |
|
inlinenoexcept |
References m_buffer.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
References castor::Size::getHeight(), and m_size.
Referenced by getCount().
|
inlinenoexcept |
References m_layers.
|
inlinenoexcept |
References m_levels.
|
inlinenoexcept |
References m_buffer.
|
inlinenoexcept |
|
inlinenoexcept |
References castor::Size::getHeight(), m_size, and m_tiles.
Referenced by getTileSize().
|
inlinenoexcept |
References m_tiles.
|
inlinenoexcept |
|
inlinenoexcept |
References castor::Size::getWidth(), m_size, and m_tiles.
Referenced by getTileSize().
|
inlinenoexcept |
References castor::Size::getWidth(), and m_size.
Referenced by doConvert(), and getCount().
CU_API void castor::PxBufferBase::initialise | ( | PxBufferConvertOptions const * | options, |
std::atomic_bool const * | interrupt, | ||
uint8_t const * | buffer, | ||
PixelFormat | bufferFormat, | ||
uint32_t | bufferAlign = 0u ) |
Initialises the data buffer to the given one.
[in] | options | The convertion options. |
[in] | interrupt | Tells if the convertion is to be interrupted. |
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | Buffer data's alignment. |
Referenced by initialise().
Initialises the data buffer at the given size.
[in] | size | Buffer dimensions |
|
inline |
Initialises the data buffer to the given one.
[in] | buffer | Data buffer. |
[in] | bufferFormat | Data buffer's pixels format. |
[in] | bufferAlign | Buffer data's alignment. |
References initialise().
|
inlinenoexcept |
|
noexcept |
Move assignment operator.
[in] | pixelBuffer | The PxBufferBase object to move |
CU_API PxBufferBase & castor::PxBufferBase::operator= | ( | PxBufferBase const & | pixelBuffer | ) |
Copy assignment operator.
[in] | pixelBuffer | The PxBufferBase object to copy |
|
noexcept |
Swaps this buffer's data with the given one's.
[in] | pixelBuffer | The buffer to swap |
CU_API void castor::PxBufferBase::update | ( | uint32_t | layers, |
uint32_t | levels ) |
Updates the buffer container, with given layers and miplevels counts.
[in] | layers | The number of layers stored in the buffer. |
[in] | levels | The number of miplevels stored in the buffer. |
|
protected |
Referenced by getAlign().
|
mutableprotected |
Referenced by begin(), cbegin(), getConstPtr(), getPtr(), getSize(), castor::PxBuffer< PF >::pixelsBegin(), and castor::PxBuffer< PF >::pixelsEnd().
|
protected |
Referenced by getLayers().
|
protected |
Referenced by getLevels().
|
protected |
Referenced by getDimensions(), getHeight(), getTileHeight(), getTileWidth(), and getWidth().
|
protected |
Referenced by getTileHeight(), getTiles(), and getTileWidth().