Commit 6d348769 authored by Janis Born's avatar Janis Born
Browse files

make ColorSpace an enum class

parent e5e22691
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
enum ColorSpace enum class ColorSpace
{ {
COLOR_SPACE_AUTO_DETECT, AUTO_DETECT,
COLOR_SPACE_LINEAR, LINEAR,
COLOR_SPACE_SRGB SRGB
}; };
//! Recommends an OpenGL internal format for a given pair of format and color spaces //! Recommends an OpenGL internal format for a given pair of format and color spaces
......
...@@ -37,7 +37,7 @@ public: ...@@ -37,7 +37,7 @@ public:
mFormat(GL_RGBA), mFormat(GL_RGBA),
mType(GL_UNSIGNED_BYTE), mType(GL_UNSIGNED_BYTE),
mPaddingBytesPerRow(0), mPaddingBytesPerRow(0),
mColorSpace(COLOR_SPACE_AUTO_DETECT) mColorSpace(ColorSpace::AUTO_DETECT)
{} {}
virtual ~TextureData(void) virtual ~TextureData(void)
{ {
......
...@@ -38,7 +38,7 @@ void registerTextureLoadFunction(std::vector<std::string> _endings, TextureLoadF ...@@ -38,7 +38,7 @@ void registerTextureLoadFunction(std::vector<std::string> _endings, TextureLoadF
void unregisterTextureLoadFunction(TextureLoadFuncPtr _function); void unregisterTextureLoadFunction(TextureLoadFuncPtr _function);
//! generic load function that will use one of the loading functions below based on the file ending //! generic load function that will use one of the loading functions below based on the file ending
SharedTextureData loadTextureData(const std::string &_filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureData(const std::string &_filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
//! generic save function that will use one of the saving functions below based on the file ending //! generic save function that will use one of the saving functions below based on the file ending
bool saveTextureData(const SharedTextureData &_textureData, const std::string &_filename); bool saveTextureData(const SharedTextureData &_textureData, const std::string &_filename);
...@@ -59,21 +59,21 @@ inline bool saveScreenshotWithDate( const std::string& _fileEnding = "png" ) { ...@@ -59,21 +59,21 @@ inline bool saveScreenshotWithDate( const std::string& _fileEnding = "png" ) {
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
//! loads from a PNG using the simple lodepng library //! loads from a PNG using the simple lodepng library
SharedTextureData loadTextureDataFromLodepng(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureDataFromLodepng(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
#ifdef ACGL_COMPILE_WITH_QT #ifdef ACGL_COMPILE_WITH_QT
//! loads various formats from the QT library //! loads various formats from the QT library
SharedTextureData loadTextureDataFromQT(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureDataFromQT(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
#endif #endif
//! loads RGBE aka Radiance files //! loads RGBE aka Radiance files
SharedTextureData loadTextureDataFromRGBE(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureDataFromRGBE(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
//! loads EXR / OpenEXR files iff the library is present AT RUNTIME (linux only) //! loads EXR / OpenEXR files iff the library is present AT RUNTIME (linux only)
SharedTextureData loadTextureDataFromEXR(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureDataFromEXR(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
//! loads PNM / PPM files: //! loads PNM / PPM files:
SharedTextureData loadTextureDataFromPNM(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureData loadTextureDataFromPNM(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// library specific save // library specific save
......
...@@ -21,13 +21,13 @@ namespace ACGL{ ...@@ -21,13 +21,13 @@ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
//! loads the texture and creates mip maps //! loads the texture and creates mip maps
SharedTexture2D loadTexture2D(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTexture2D loadTexture2D(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
//! loads the texture including mipmaps from a DDS file //! loads the texture including mipmaps from a DDS file
//! supports DXT1, DXT3 and DXT5 compression //! supports DXT1, DXT3 and DXT5 compression
SharedTexture2D loadTexture2DFromDDS (const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTexture2D loadTexture2DFromDDS (const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
SharedTexture3D loadTexture3DFromDDS (const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTexture3D loadTexture3DFromDDS (const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
SharedTextureCubeMap loadTextureCubeMapFromDDS(const std::string& _filename, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT); SharedTextureCubeMap loadTextureCubeMapFromDDS(const std::string& _filename, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT);
} }
} }
...@@ -46,7 +46,7 @@ GLenum recommendedInternalFormat(GLenum _format, ColorSpace _colorSpace) ...@@ -46,7 +46,7 @@ GLenum recommendedInternalFormat(GLenum _format, ColorSpace _colorSpace)
{ {
switch(_colorSpace) switch(_colorSpace)
{ {
case COLOR_SPACE_SRGB: return formatToSRGB(_format); case ColorSpace::SRGB: return formatToSRGB(_format);
default: return _format; default: return _format;
} }
} }
......
...@@ -18,7 +18,7 @@ using namespace nv_dds; ...@@ -18,7 +18,7 @@ using namespace nv_dds;
namespace { namespace {
GLenum getDDSInternalFormat(bool compressed, GLenum format, ColorSpace _colorSpace = COLOR_SPACE_AUTO_DETECT) GLenum getDDSInternalFormat(bool compressed, GLenum format, ColorSpace _colorSpace = ColorSpace::AUTO_DETECT)
{ {
GLenum internal_format = format; GLenum internal_format = format;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment