Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | List of all members
castor::PxBuffer< PF > Class Template Reference

Pixel buffer class, with pixel format as a template param. More...

#include <PixelBuffer.hpp>

Inheritance diagram for castor::PxBuffer< PF >:
Inheritance graph
[legend]
Collaboration diagram for castor::PxBuffer< PF >:
Collaboration graph
[legend]

Public Types

using MyPixel = Pixel< PF >
 
using iterator = PixelIterator< PF >
 
using const_iterator = ConstPixelIterator< PF >
 
- Public Types inherited from castor::PxBufferBase
using PxArray = Vector< uint8_t >
 
using PixelData = PxArray::iterator
 
using ConstPixelData = PxArray::const_iterator
 

Public Member Functions

 PxBuffer (Size const &size, uint32_t layers, uint32_t levels, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM)
 Constructor.
 
 PxBuffer (Size const &size, uint8_t const *buffer=nullptr, PixelFormat bufferFormat=PixelFormat::eR8G8B8A8_UNORM)
 Constructor.
 
MyPixel at (uint32_t x, uint32_t y) const
 
iterator pixelsBegin () const noexcept
 
iterator pixelsEnd () const noexcept
 
- Public Member Functions inherited from castor::PxBufferBase
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 PxBufferBaseoperator= (PxBufferBase const &pixelBuffer)
 Copy assignment operator.
 
CU_API PxBufferBaseoperator= (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
 

Additional Inherited Members

- Static Public Member Functions inherited from castor::PxBufferBase
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 inherited from castor::PxBufferBase
uint32_t doConvert (uint32_t x, uint32_t y) const
 
- Protected Attributes inherited from castor::PxBufferBase
Size m_size
 
uint32_t m_layers
 
uint32_t m_levels
 
uint32_t m_align
 
Point3ui m_tiles { 1u, 1u, 1u }
 
PxArray m_buffer
 

Detailed Description

template<PixelFormat PF>
class castor::PxBuffer< PF >

Pixel buffer class, with pixel format as a template param.

Member Typedef Documentation

◆ const_iterator

template<PixelFormat PF>
using castor::PxBuffer< PF >::const_iterator = ConstPixelIterator< PF >

◆ iterator

template<PixelFormat PF>
using castor::PxBuffer< PF >::iterator = PixelIterator< PF >

◆ MyPixel

template<PixelFormat PF>
using castor::PxBuffer< PF >::MyPixel = Pixel< PF >

Constructor & Destructor Documentation

◆ PxBuffer() [1/2]

template<PixelFormat PF>
castor::PxBuffer< PF >::PxBuffer ( Size const & size,
uint32_t layers,
uint32_t levels,
uint8_t const * buffer = nullptr,
PixelFormat bufferFormat = PixelFormat::eR8G8B8A8_UNORM )

Constructor.

Parameters
[in]sizeBuffer wanted dimensions
[in]layersBuffer layers (or slices)
[in]levelsBuffer mip levels
[in]bufferData buffer
[in]bufferFormatData buffer's pixels format

◆ PxBuffer() [2/2]

template<PixelFormat PF>
castor::PxBuffer< PF >::PxBuffer ( Size const & size,
uint8_t const * buffer = nullptr,
PixelFormat bufferFormat = PixelFormat::eR8G8B8A8_UNORM )
inlineexplicit

Constructor.

Parameters
[in]sizeBuffer wanted dimensions
[in]bufferData buffer
[in]bufferFormatData buffer's pixels format

Member Function Documentation

◆ at()

template<PixelFormat PF>
MyPixel castor::PxBuffer< PF >::at ( uint32_t x,
uint32_t y ) const

name Getters.

◆ pixelsBegin()

template<PixelFormat PF>
iterator castor::PxBuffer< PF >::pixelsBegin ( ) const
inlinenoexcept

◆ pixelsEnd()

template<PixelFormat PF>
iterator castor::PxBuffer< PF >::pixelsEnd ( ) const
inlinenoexcept

The documentation for this class was generated from the following files: