Browse Source

Renamed template in Texture to prevent underscores in parameters.

pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
03f15c714b
  1. 12
      src/CubeMapTexture.h
  2. 25
      src/Texture.h

12
src/CubeMapTexture.h

@ -64,18 +64,18 @@ class CubeMapTexture: public Texture2D {
*/ */
inline CubeMapTexture(GLint layer = 0): Texture(layer, Target::CubeMap) {} inline CubeMapTexture(GLint layer = 0): Texture(layer, Target::CubeMap) {}
template<class T> inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) = delete; template<class T> inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) = delete;
template<class T> void setData(GLint mipLevel, InternalFormat internalFormat, T* image) = delete; template<class T> void setData(GLint mipLevel, InternalFormat internalFormat, T* image) = delete;
template<class T> inline void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) = delete; template<class T> inline void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) = delete;
template<class T> void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, T* image) = delete; template<class T> void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, T* image) = delete;
/** /**
* @copydoc Texture::setData(GLint, InternalFormat, const Math::Vector<GLsizei, Dimensions>&, ColorFormat, const T*) * @copydoc Texture::setData(GLint, InternalFormat, const Math::Vector<GLsizei, Dimensions>&, ColorFormat, const T*)
* @param coordinate Coordinate * @param coordinate Coordinate
*/ */
template<class T> inline void setData(Coordinate coordinate, GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) { template<class T> inline void setData(Coordinate coordinate, GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) {
bind(); bind();
DataHelper<Dimensions>::set(static_cast<Target>(coordinate), mipLevel, internalFormat, _dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data); DataHelper<Dimensions>::set(static_cast<Target>(coordinate), mipLevel, internalFormat, dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data);
} }
/** /**
@ -91,9 +91,9 @@ class CubeMapTexture: public Texture2D {
* @copydoc Texture::setSubData(GLint, const Math::Vector<GLint, Dimensions>&, const Math::Vector<GLsizei, Dimensions>&, ColorFormat, const T*) * @copydoc Texture::setSubData(GLint, const Math::Vector<GLint, Dimensions>&, const Math::Vector<GLsizei, Dimensions>&, ColorFormat, const T*)
* @param coordinate Coordinate * @param coordinate Coordinate
*/ */
template<class T> inline void setSubData(Coordinate coordinate, GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) { template<class T> inline void setSubData(Coordinate coordinate, GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) {
bind(); bind();
DataHelper<Dimensions>::setSub(static_cast<Target>(coordinate), mipLevel, offset, _dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data); DataHelper<Dimensions>::setSub(static_cast<Target>(coordinate), mipLevel, offset, dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data);
} }
/** /**

25
src/Texture.h

@ -25,9 +25,6 @@ namespace Magnum {
/** /**
@brief %Texture @brief %Texture
@tparam dimensions %Texture dimension count
@tparam target %Target. If not set, target is based on dimension
count (`Target::Texture1D`, `Target::Texture2D` or `Target::Texture3D`).
Template class for one- to three-dimensional textures. Template class for one- to three-dimensional textures.
@ -51,15 +48,15 @@ don't support mipmapping and repeating wrapping modes, see @ref Texture::Filter
"Filter", @ref Texture::Mipmap "Mipmap" and generateMipmap() documentation "Filter", @ref Texture::Mipmap "Mipmap" and generateMipmap() documentation
for more information. for more information.
*/ */
template<size_t dimensions> class Texture: public AbstractTexture { template<size_t textureDimensions> class Texture: public AbstractTexture {
public: public:
static const size_t Dimensions = dimensions; /**< @brief %Texture dimension count */ static const size_t Dimensions = textureDimensions; /**< @brief %Texture dimension count */
typedef typename DataHelper<Dimensions>::Target Target; /**< @brief %Texture target */ typedef typename DataHelper<Dimensions>::Target Target; /**< @brief %Texture target */
/** /**
* @brief Constructor * @brief Constructor
* @param layer %Texture layer (number between 0 and 31) * @param layer %Texture layer (number between 0 and 31)
* @param target %Texture target * @param target %Texture target
* *
* Creates one OpenGL texture. * Creates one OpenGL texture.
*/ */
@ -70,7 +67,7 @@ template<size_t dimensions> class Texture: public AbstractTexture {
/** /**
* @brief Set wrapping * @brief Set wrapping
* @param wrapping Wrapping type for all texture dimensions * @param wrapping Wrapping type for all texture dimensions
* *
* Sets wrapping type for coordinates out of range (0, 1) for normal * Sets wrapping type for coordinates out of range (0, 1) for normal
* textures and (0, textureSizeInGivenDirection-1) for rectangle * textures and (0, textureSizeInGivenDirection-1) for rectangle
@ -85,16 +82,16 @@ template<size_t dimensions> class Texture: public AbstractTexture {
* @brief Set texture data * @brief Set texture data
* @param mipLevel Mip level * @param mipLevel Mip level
* @param internalFormat Internal texture format * @param internalFormat Internal texture format
* @param _dimensions %Texture dimensions * @param dimensions %Texture dimensions
* @param colorFormat Color format of passed data. Data size per * @param colorFormat Color format of passed data. Data size per
* color channel is detected from format of passed data array. * color channel is detected from format of passed data array.
* @param data %Texture data * @param data %Texture data
* *
* Sets texture from given data. The data are not deleted afterwards. * Sets texture from given data. The data are not deleted afterwards.
*/ */
template<class T> inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) { template<class T> inline void setData(GLint mipLevel, InternalFormat internalFormat, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) {
bind(); bind();
DataHelper<Dimensions>::set(_target, mipLevel, internalFormat, _dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data); DataHelper<Dimensions>::set(_target, mipLevel, internalFormat, dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data);
} }
/** /**
@ -116,7 +113,7 @@ template<size_t dimensions> class Texture: public AbstractTexture {
* @brief Set texture subdata * @brief Set texture subdata
* @param mipLevel Mip level * @param mipLevel Mip level
* @param offset Offset where to put data in the texture * @param offset Offset where to put data in the texture
* @param _dimensions %Texture dimensions * @param dimensions %Texture dimensions
* @param colorFormat Color format of passed data. Data size per * @param colorFormat Color format of passed data. Data size per
* color channel is detected from format of passed data array. * color channel is detected from format of passed data array.
* @param data %Texture data * @param data %Texture data
@ -124,9 +121,9 @@ template<size_t dimensions> class Texture: public AbstractTexture {
* Sets texture subdata from given data. The data are not deleted * Sets texture subdata from given data. The data are not deleted
* afterwards. * afterwards.
*/ */
template<class T> inline void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& _dimensions, ColorFormat colorFormat, const T* data) { template<class T> inline void setSubData(GLint mipLevel, const Math::Vector<GLint, Dimensions>& offset, const Math::Vector<GLsizei, Dimensions>& dimensions, ColorFormat colorFormat, const T* data) {
bind(); bind();
DataHelper<Dimensions>::setSub(_target, mipLevel, offset, _dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data); DataHelper<Dimensions>::setSub(_target, mipLevel, offset, dimensions, colorFormat, TypeTraits<typename TypeTraits<T>::TextureType>::glType(), data);
} }
/** /**

Loading…
Cancel
Save