From dcebf1a7b9de7afe251d0309b116bf1ca8b40d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2013 00:30:52 +0200 Subject: [PATCH] Trade: added TextureData parameters. Not adding border color (yet), as it is not supported in ES. --- src/Trade/TextureData.h | 59 +++++++++++++++++++++++++++++++++++++++++ src/Trade/Trade.h | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/Trade/TextureData.h b/src/Trade/TextureData.h index 996198c42..faa98a31a 100644 --- a/src/Trade/TextureData.h +++ b/src/Trade/TextureData.h @@ -28,6 +28,9 @@ * @brief Class Magnum::Trade::TextureData */ +#include "Array.h" +#include "Sampler.h" + namespace Magnum { namespace Trade { /** @@ -35,6 +38,29 @@ namespace Magnum { namespace Trade { */ class TextureData { public: + /** + * @brief Texture type + * + * @see type() + */ + enum class Type: UnsignedByte { + Texture1D, /**< One-dimensional texture */ + Texture2D, /**< Two-dimensional texture */ + Texture3D, /**< Three-dimensional texture */ + Cube, /**< Cube map texture */ + }; + + /** + * @brief Constructor + * @param type Texture type + * @param minificationFilter Minification filter + * @param magnificationFilter Magnification filter + * @param mipmapFilter Mipmap filter + * @param wrapping Wrapping + * @param image Texture image ID + */ + TextureData(Type type, Sampler::Filter minificationFilter, Sampler::Filter magnificationFilter, Sampler::Mipmap mipmapFilter, Array3D wrapping, UnsignedInt image): _type(type), _minificationFilter(minificationFilter), _magnificationFilter(magnificationFilter), _mipmapFilter(mipmapFilter), _wrapping(wrapping), _image(image) {} + /** @brief Copying is not allowed */ TextureData(const TextureData&) = delete; @@ -46,6 +72,39 @@ class TextureData { /** @brief Move assignment */ TextureData& operator=(TextureData&&) = default; + + /** @brief Texture type */ + Type type() const { return _type; } + + /** @brief Minification filter */ + Sampler::Filter minificationFilter() const { return _minificationFilter; } + + /** @brief Magnification filter */ + Sampler::Filter magnificationFilter() const { return _magnificationFilter; } + + /** @brief Mipmap filter */ + Sampler::Mipmap mipmapFilter() const { return _mipmapFilter; } + + /** @brief Wrapping */ + Array3D wrapping() const { return _wrapping; } + + /** + * @brief Image ID + * + * ID of 1D, 2D or 3D image based on texture type. If type is + * @ref Type "Type::Cube" the function returns first of six consecutive + * IDs of cube map sides, ordered +X, -X, +Y, -Y, +Z, -Z. + * @see @ref type(), @ref AbstractImporter::image1D(), + * @ref AbstractImporter::image2D(), @ref AbstractImporter::image3D() + */ + UnsignedInt image() const { return _image; } + + private: + Type _type; + Sampler::Filter _minificationFilter, _magnificationFilter; + Sampler::Mipmap _mipmapFilter; + Array3D _wrapping; + UnsignedInt _image; }; }} diff --git a/src/Trade/Trade.h b/src/Trade/Trade.h index a12b47f79..ba82c7a97 100644 --- a/src/Trade/Trade.h +++ b/src/Trade/Trade.h @@ -52,8 +52,8 @@ class MeshObjectData3D; class ObjectData2D; class ObjectData3D; class PhongMaterialData; -class SceneData; class TextureData; +class SceneData; #endif }}