25 #include <boost/scope_exit.hpp> 35 BOOST_SCOPE_EXIT( (&sides) ) {
36 for (
size_t i = 0; i <
ARRAYSIZE(sides); i++)
38 } BOOST_SCOPE_EXIT_END
43 const size_t mipMapCount = sides[0] ? sides[0]->getMipMapCount() : 0;
50 _format = sides[0]->getFormat();
54 const int32 width = sides[0]->getMipMap(0).width;
55 const int32 height = sides[0]->getMipMap(0).height;
57 for (
size_t i = 0; i <
ARRAYSIZE(sides); i++) {
68 if ((width != sides[i]->
getMipMap(0).width) || (height != sides[i]->
getMipMap(0).height))
77 throw Common::Exception(
"CubeMapCombiner: Format mismatch (%u, %u, %u, %u, %u != %u, %u, %u, %u, %u)",
85 _txi = sides[0]->getTXI();
89 for (
size_t layer = 0; layer <
_layerCount; layer++) {
90 for (
size_t mipMap = 0; mipMap < mipMapCount; mipMap++) {
91 const size_t index = layer * mipMapCount + mipMap;
PixelFormat getFormat() const
Return the image data's general format.
bool _isCubeMap
Is this image a cube map? A cube map always needs to have 6 layers!
void resize(typename std::vector< T *>::size_type n, typename std::vector< T *>::value_type val=typename std::vector< T *>::value_type())
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
size_t getLayerCount() const
Return the number of layers contained in the image.
Basic exceptions to throw.
Utility templates and functions.
size_t _layerCount
Number of layers in this image.
A class creating a cube map by combining six images.
PixelFormatRaw getFormatRaw() const
Return the image data's raw format.
PixelFormatRaw _formatRaw
const MipMap & getMipMap(size_t mipMap, size_t layer=0) const
Return a mip map.
CubeMapCombiner(ImageDecoder *(&sides)[6])
Take over this six images and combine them into a single cube map.
PixelDataType getDataType() const
Return the image data pixel's type.
A generic interface for image decoders.
size_t getMipMapCount() const
Return the number of mip maps contained in the image.
bool hasAlpha() const
Does the image data have alpha? .
bool isCompressed() const
Is the image data compressed?