Browse Source

Moved ColorFormat enum back to AbstractTexture.

pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
3174570969
  1. 11
      src/AbstractTexture.h
  2. 19
      src/Image.h
  3. 2
      src/Texture.h

11
src/AbstractTexture.h

@ -21,7 +21,6 @@
#include "Magnum.h" #include "Magnum.h"
#include "TypeTraits.h" #include "TypeTraits.h"
#include "Image.h"
namespace Magnum { namespace Magnum {
@ -108,6 +107,16 @@ class AbstractTexture {
CompressedRGBA = GL_COMPRESSED_RGBA CompressedRGBA = GL_COMPRESSED_RGBA
}; };
/** @brief Color format */
enum class ColorFormat: GLenum {
Red = GL_RED,
RedGreen = GL_RG,
RGB = GL_RGB,
RGBA = GL_RGBA,
BGR = GL_BGR,
BGRA = GL_BGRA
};
/** /**
* @brief Constructor * @brief Constructor
* @param layer %Texture layer (number between 0 and 31) * @param layer %Texture layer (number between 0 and 31)

19
src/Image.h

@ -16,24 +16,15 @@
*/ */
/** @file /** @file
* @brief Enum Magnum::ColorFormat, class Magnum::Image * @brief Class Magnum::Image
*/ */
#include "Magnum.h" #include "Magnum.h"
#include "TypeTraits.h" #include "TypeTraits.h"
#include "AbstractTexture.h"
namespace Magnum { namespace Magnum {
/** @brief Color format */
enum class ColorFormat: GLenum {
Red = GL_RED,
RedGreen = GL_RG,
RGB = GL_RGB,
RGBA = GL_RGBA,
BGR = GL_BGR,
BGRA = GL_BGRA
};
/** /**
@brief %Image @brief %Image
@ -60,7 +51,7 @@ template<size_t imageDimensions> class Image {
* @attention Note that the image data are not copied on construction, * @attention Note that the image data are not copied on construction,
* but they are deleted on class destruction. * but they are deleted on class destruction.
*/ */
template<class T> Image(const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data): _dimensions(dimensions), _colorFormat(colorFormat), _type(TypeTraits<typename TypeTraits<T>::TextureType>::glType()), _data(reinterpret_cast<const char*>(data)) {} template<class T> Image(const Math::Vector<GLsizei, Dimensions>& dimensions, AbstractTexture::ColorFormat colorFormat, const T* data): _dimensions(dimensions), _colorFormat(colorFormat), _type(TypeTraits<typename TypeTraits<T>::TextureType>::glType()), _data(reinterpret_cast<const char*>(data)) {}
/** @brief Destructor */ /** @brief Destructor */
virtual ~Image() { delete[] _data; } virtual ~Image() { delete[] _data; }
@ -69,7 +60,7 @@ template<size_t imageDimensions> class Image {
inline const Math::Vector<GLsizei, Dimensions>& dimensions() const { return _dimensions; } inline const Math::Vector<GLsizei, Dimensions>& dimensions() const { return _dimensions; }
/** @brief Color format */ /** @brief Color format */
inline ColorFormat colorFormat() const { return _colorFormat; } inline AbstractTexture::ColorFormat colorFormat() const { return _colorFormat; }
/** @brief Data type */ /** @brief Data type */
GLenum type() const { return _type; } GLenum type() const { return _type; }
@ -79,7 +70,7 @@ template<size_t imageDimensions> class Image {
private: private:
Math::Vector<GLsizei, Dimensions> _dimensions; Math::Vector<GLsizei, Dimensions> _dimensions;
ColorFormat _colorFormat; AbstractTexture::ColorFormat _colorFormat;
GLenum _type; GLenum _type;
const char* _data; const char* _data;
}; };

2
src/Texture.h

@ -19,7 +19,7 @@
* @brief Class Magnum::Texture * @brief Class Magnum::Texture
*/ */
#include "AbstractTexture.h" #include "Image.h"
namespace Magnum { namespace Magnum {

Loading…
Cancel
Save