mirror of https://github.com/mosra/magnum.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
788 lines
32 KiB
788 lines
32 KiB
|
8 years ago
|
#ifndef Magnum_GL_CubeMapTextureArray_h
|
||
|
|
#define Magnum_GL_CubeMapTextureArray_h
|
||
|
14 years ago
|
/*
|
||
|
|
This file is part of Magnum.
|
||
|
|
|
||
|
8 years ago
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
|
||
|
12 years ago
|
Vladimír Vondruš <mosra@centrum.cz>
|
||
|
13 years ago
|
|
||
|
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||
|
|
copy of this software and associated documentation files (the "Software"),
|
||
|
|
to deal in the Software without restriction, including without limitation
|
||
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||
|
|
and/or sell copies of the Software, and to permit persons to whom the
|
||
|
|
Software is furnished to do so, subject to the following conditions:
|
||
|
|
|
||
|
|
The above copyright notice and this permission notice shall be included
|
||
|
|
in all copies or substantial portions of the Software.
|
||
|
|
|
||
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||
|
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||
|
|
DEALINGS IN THE SOFTWARE.
|
||
|
14 years ago
|
*/
|
||
|
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
14 years ago
|
/** @file
|
||
|
13 years ago
|
* @brief Class @ref Magnum::CubeMapTextureArray
|
||
|
14 years ago
|
*/
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
12 years ago
|
#include "Magnum/Array.h"
|
||
|
8 years ago
|
#include "Magnum/GL/AbstractTexture.h"
|
||
|
12 years ago
|
#include "Magnum/Math/Vector3.h"
|
||
|
14 years ago
|
|
||
|
11 years ago
|
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
|
||
|
14 years ago
|
namespace Magnum {
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
14 years ago
|
@brief Cube map texture array
|
||
|
|
|
||
|
13 years ago
|
See @ref CubeMapTexture documentation for introduction.
|
||
|
14 years ago
|
|
||
|
8 years ago
|
@section CubeMapTextureArray-usage Usage
|
||
|
14 years ago
|
|
||
|
12 years ago
|
See @ref Texture documentation for introduction.
|
||
|
|
|
||
|
13 years ago
|
Common usage is to specify each layer and face separately using @ref setSubImage().
|
||
|
13 years ago
|
You have to allocate the memory for all layers and faces first by calling
|
||
|
|
@ref setStorage(). Example: array with 4 layers of cube maps, each cube map
|
||
|
|
consisting of six 64x64 images, i.e. 24 layers total:
|
||
|
8 years ago
|
|
||
|
8 years ago
|
@snippet MagnumGL.cpp CubeMapTextureArray-usage
|
||
|
14 years ago
|
|
||
|
8 years ago
|
In shader, the texture is used via @glsl samplerCubeArray @ce,
|
||
|
|
@glsl samplerCubeArrayShadow @ce, @glsl isamplerCubeArray @ce or
|
||
|
|
@glsl usamplerCubeArray @ce. Unlike in classic textures, coordinates for cube
|
||
|
|
map texture arrays is signed four-part vector. First three parts define vector
|
||
|
|
from the center of the cube which intersects with one of the six sides of the
|
||
|
|
cube map, fourth part is layer in the array. See @ref AbstractShaderProgram for
|
||
|
|
more information about usage in shaders.
|
||
|
13 years ago
|
|
||
|
13 years ago
|
@see @ref Renderer::Feature::SeamlessCubeMapTexture, @ref CubeMapTexture,
|
||
|
12 years ago
|
@ref Texture, @ref TextureArray, @ref RectangleTexture, @ref BufferTexture,
|
||
|
|
@ref MultisampleTexture
|
||
|
8 years ago
|
@m_keywords{GL_TEXTURE_CUBE_MAP_ARRAY}
|
||
|
12 years ago
|
@requires_gl40 Extension @extension{ARB,texture_cube_map_array}
|
||
|
11 years ago
|
@requires_gles30 Not defined in OpenGL ES 2.0.
|
||
|
9 years ago
|
@requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
@extension{EXT,texture_cube_map_array}
|
||
|
11 years ago
|
@requires_gles Cube map texture arrays are not available in WebGL.
|
||
|
14 years ago
|
*/
|
||
|
8 years ago
|
class MAGNUM_GL_EXPORT CubeMapTextureArray: public AbstractTexture {
|
||
|
14 years ago
|
public:
|
||
|
12 years ago
|
/**
|
||
|
|
* @brief Max supported size of one side of cube map texture array
|
||
|
|
*
|
||
|
|
* The result is cached, repeated queries don't result in repeated
|
||
|
|
* OpenGL calls. If @extension{ARB,texture_cube_map_array} (part of
|
||
|
|
* OpenGL 4.0) is not available, returns zero vector.
|
||
|
8 years ago
|
* @see @fn_gl{Get} with @def_gl_keyword{MAX_CUBE_MAP_TEXTURE_SIZE} and
|
||
|
|
* @def_gl_keyword{MAX_ARRAY_TEXTURE_LAYERS}
|
||
|
12 years ago
|
*/
|
||
|
|
static Vector3i maxSize();
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedBlockSize()
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedBlockSize() for more information.
|
||
|
|
* @requires_gl43 Extension @extension{ARB,internalformat_query2}
|
||
|
|
* @requires_gl Compressed texture queries are not available in OpenGL
|
||
|
|
* ES.
|
||
|
|
*/
|
||
|
|
static Vector2i compressedBlockSize(TextureFormat format) {
|
||
|
|
return DataHelper<2>::compressedBlockSize(GL_TEXTURE_CUBE_MAP_ARRAY, format);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedBlockDataSize()
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedBlockDataSize() for more information.
|
||
|
|
* @requires_gl43 Extension @extension{ARB,internalformat_query2}
|
||
|
|
* @requires_gl Compressed texture queries are not available in OpenGL
|
||
|
|
* ES.
|
||
|
8 years ago
|
* @see @ref compressedBlockSize(), @fn_gl_keyword{GetInternalformat}
|
||
|
|
* with @def_gl_keyword{TEXTURE_COMPRESSED_BLOCK_SIZE}
|
||
|
11 years ago
|
*/
|
||
|
|
static Int compressedBlockDataSize(TextureFormat format) {
|
||
|
|
return AbstractTexture::compressedBlockDataSize(GL_TEXTURE_CUBE_MAP_ARRAY, format);
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
11 years ago
|
/**
|
||
|
|
* @brief Wrap existing OpenGL cube map array texture object
|
||
|
|
* @param id OpenGL cube map array texture ID
|
||
|
|
* @param flags Object creation flags
|
||
|
|
*
|
||
|
|
* The @p id is expected to be of an existing OpenGL texture object
|
||
|
|
* with target @def_gl{TEXTURE_CUBE_MAP_ARRAY}. Unlike texture created
|
||
|
|
* using constructor, the OpenGL object is by default not deleted on
|
||
|
|
* destruction, use @p flags for different behavior.
|
||
|
|
* @see @ref release()
|
||
|
|
*/
|
||
|
|
static CubeMapTextureArray wrap(GLuint id, ObjectFlags flags = {}) {
|
||
|
|
return CubeMapTextureArray{id, flags};
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
/**
|
||
|
|
* @brief Constructor
|
||
|
|
*
|
||
|
|
* Creates new OpenGL texture object. If @extension{ARB,direct_state_access}
|
||
|
|
* (part of OpenGL 4.5) is not available, the texture is created on
|
||
|
|
* first use.
|
||
|
11 years ago
|
* @see @ref CubeMapTextureArray(NoCreateT), @ref wrap(),
|
||
|
8 years ago
|
* @fn_gl_keyword{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP_ARRAY},
|
||
|
|
* eventually @fn_gl_keyword{GenTextures}
|
||
|
11 years ago
|
*/
|
||
|
9 years ago
|
explicit CubeMapTextureArray(): AbstractTexture{GL_TEXTURE_CUBE_MAP_ARRAY} {}
|
||
|
11 years ago
|
|
||
|
11 years ago
|
/**
|
||
|
|
* @brief Construct without creating the underlying OpenGL object
|
||
|
|
*
|
||
|
|
* The constructed instance is equivalent to moved-from state. Useful
|
||
|
|
* in cases where you will overwrite the instance later anyway. Move
|
||
|
|
* another object over it to make it useful.
|
||
|
9 years ago
|
*
|
||
|
|
* This function can be safely used for constructing (and later
|
||
|
|
* destructing) objects even without any OpenGL context being active.
|
||
|
11 years ago
|
* @see @ref CubeMapTextureArray(), @ref wrap()
|
||
|
|
*/
|
||
|
9 years ago
|
explicit CubeMapTextureArray(NoCreateT) noexcept: AbstractTexture{NoCreate, GL_TEXTURE_CUBE_MAP_ARRAY} {}
|
||
|
11 years ago
|
|
||
|
10 years ago
|
/**
|
||
|
|
* @brief Bind level of given texture layer to given image unit
|
||
|
|
* @param imageUnit Image unit
|
||
|
|
* @param level Texture level
|
||
|
|
* @param layer Texture layer
|
||
|
|
* @param access Image access
|
||
|
|
* @param format Image format
|
||
|
|
*
|
||
|
|
* Layer is equivalent to layer * 6 + number of texture face, i.e. +X
|
||
|
8 years ago
|
* is @cpp 0 @ce and so on, in order of (+X, -X, +Y, -Y, +Z, -Z).
|
||
|
10 years ago
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref bindImages(Int, std::initializer_list<AbstractTexture*>),
|
||
|
|
* @ref bindImageLayered(), @ref unbindImage(), @ref unbindImages(),
|
||
|
|
* @ref AbstractShaderProgram::maxImageUnits(),
|
||
|
|
* @fn_gl{BindImageTexture}
|
||
|
|
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
|
||
|
|
* @requires_gles31 Shader image load/store is not available in OpenGL
|
||
|
|
* ES 3.0 and older.
|
||
|
|
*/
|
||
|
|
void bindImage(Int imageUnit, Int level, Int layer, ImageAccess access, ImageFormat format) {
|
||
|
|
bindImageInternal(imageUnit, level, false, layer, access, format);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Bind level of layered texture to given image unit
|
||
|
|
* @param imageUnit Image unit
|
||
|
|
* @param level Texture level
|
||
|
|
* @param access Image access
|
||
|
|
* @param format Image format
|
||
|
|
*
|
||
|
|
* @note This function is meant to be used only internally from
|
||
|
|
* @ref AbstractShaderProgram subclasses. See its documentation
|
||
|
|
* for more information.
|
||
|
|
* @see @ref bindImages(Int, std::initializer_list<AbstractTexture*>),
|
||
|
|
* @ref bindImage(), @ref unbindImage(), @ref unbindImages(),
|
||
|
|
* @ref AbstractShaderProgram::maxImageUnits(),
|
||
|
|
* @fn_gl{BindImageTexture}
|
||
|
|
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
|
||
|
|
* @requires_gles31 Shader image load/store is not available in OpenGL
|
||
|
|
* ES 3.0 and older.
|
||
|
|
*/
|
||
|
|
void bindImageLayered(Int imageUnit, Int level, ImageAccess access, ImageFormat format) {
|
||
|
|
bindImageInternal(imageUnit, level, true, 0, access, format);
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setBaseLevel()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
12 years ago
|
* See @ref Texture::setBaseLevel() for more information.
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setBaseLevel(Int level) {
|
||
|
|
AbstractTexture::setBaseLevel(level);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMaxLevel()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
12 years ago
|
* See @ref Texture::setMaxLevel() for more information.
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setMaxLevel(Int level) {
|
||
|
|
AbstractTexture::setMaxLevel(level);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMinificationFilter()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setMinificationFilter() for more information.
|
||
|
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap = Sampler::Mipmap::Base) {
|
||
|
|
AbstractTexture::setMinificationFilter(filter, mipmap);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMagnificationFilter()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setMagnificationFilter() for more information.
|
||
|
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setMagnificationFilter(Sampler::Filter filter) {
|
||
|
|
AbstractTexture::setMagnificationFilter(filter);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMinLod()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setMinLod() for more information.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setMinLod(Float lod) {
|
||
|
|
AbstractTexture::setMinLod(lod);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMaxLod()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setMaxLod() for more information.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setMaxLod(Float lod) {
|
||
|
|
AbstractTexture::setMaxLod(lod);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setLodBias()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setLodBias() for more information.
|
||
|
11 years ago
|
* @requires_gl Texture LOD bias can be specified only directly in
|
||
|
|
* fragment shader in OpenGL ES.
|
||
|
12 years ago
|
*/
|
||
|
|
CubeMapTextureArray& setLodBias(Float bias) {
|
||
|
|
AbstractTexture::setLodBias(bias);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
11 years ago
|
#endif
|
||
|
12 years ago
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setWrapping()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setWrapping() for more information.
|
||
|
|
*/
|
||
|
11 years ago
|
CubeMapTextureArray& setWrapping(const Array2D<Sampler::Wrapping>& wrapping) {
|
||
|
|
DataHelper<2>::setWrapping(*this, wrapping);
|
||
|
13 years ago
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setBorderColor(const Color4&)
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setBorderColor(const Color4&) for more
|
||
|
|
* information.
|
||
|
9 years ago
|
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
* @extension{EXT,texture_border_clamp} or
|
||
|
|
* @extension{NV,texture_border_clamp}
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setBorderColor(const Color4& color) {
|
||
|
|
AbstractTexture::setBorderColor(color);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setBorderColor(const Vector4ui&)
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setBorderColor(const Vector4ui&) for more
|
||
|
|
* information.
|
||
|
12 years ago
|
* @requires_gl30 Extension @extension{EXT,texture_integer}
|
||
|
9 years ago
|
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
* @extension{EXT,texture_border_clamp}
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setBorderColor(const Vector4ui& color) {
|
||
|
|
AbstractTexture::setBorderColor(color);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/** @overload
|
||
|
|
* @requires_gl30 Extension @extension{EXT,texture_integer}
|
||
|
9 years ago
|
* @requires_gles32 Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
* @extension{EXT,texture_border_clamp}
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setBorderColor(const Vector4i& color) {
|
||
|
|
AbstractTexture::setBorderColor(color);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setMaxAnisotropy()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setMaxAnisotropy() for more information.
|
||
|
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setMaxAnisotropy(Float anisotropy) {
|
||
|
|
AbstractTexture::setMaxAnisotropy(anisotropy);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setSRGBDecode()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setSRGBDecode() for more information.
|
||
|
|
* @requires_extension Extension @extension{EXT,texture_sRGB_decode}
|
||
|
8 years ago
|
* @requires_es_extension Extension @extension{ANDROID,extension_pack_es31a} /
|
||
|
9 years ago
|
* @extension2{EXT,texture_sRGB_decode,texture_sRGB_decode}
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setSRGBDecode(bool decode) {
|
||
|
|
AbstractTexture::setSRGBDecode(decode);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setSwizzle()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setSwizzle() for more information.
|
||
|
12 years ago
|
* @requires_gl33 Extension @extension{ARB,texture_swizzle}
|
||
|
12 years ago
|
*/
|
||
|
|
template<char r, char g, char b, char a> CubeMapTextureArray& setSwizzle() {
|
||
|
|
AbstractTexture::setSwizzle<r, g, b, a>();
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setCompareMode()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setCompareMode() for more information.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompareMode(Sampler::CompareMode mode) {
|
||
|
|
AbstractTexture::setCompareMode(mode);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setCompareFunction()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setCompareFunction() for more information.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompareFunction(Sampler::CompareFunction function) {
|
||
|
|
AbstractTexture::setCompareFunction(function);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setDepthStencilMode()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::setDepthStencilMode() for more information.
|
||
|
12 years ago
|
* @requires_gl43 Extension @extension{ARB,stencil_texturing}
|
||
|
12 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setDepthStencilMode(Sampler::DepthStencilMode mode) {
|
||
|
|
AbstractTexture::setDepthStencilMode(mode);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
13 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setStorage()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
13 years ago
|
*
|
||
|
12 years ago
|
* Z coordinate of @p size must be multiple of 6.
|
||
|
|
*
|
||
|
|
* See @ref Texture::setStorage() for more information.
|
||
|
|
* @see @ref maxSize()
|
||
|
13 years ago
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& setStorage(Int levels, TextureFormat internalFormat, const Vector3i& size) {
|
||
|
|
DataHelper<3>::setStorage(*this, levels, internalFormat, size);
|
||
|
|
return *this;
|
||
|
13 years ago
|
}
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::imageSize()
|
||
|
14 years ago
|
*
|
||
|
12 years ago
|
* See @ref Texture::imageSize() for more information.
|
||
|
14 years ago
|
*/
|
||
|
12 years ago
|
Vector3i imageSize(Int level) {
|
||
|
10 years ago
|
return DataHelper<3>::imageSize(*this, level);
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
#ifndef MAGNUM_TARGET_GLES
|
||
|
13 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::image(Int, Image&)
|
||
|
13 years ago
|
*
|
||
|
13 years ago
|
* See @ref Texture::image(Int, Image&) for more information.
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
void image(Int level, Image3D& image) {
|
||
|
12 years ago
|
AbstractTexture::image<3>(level, image);
|
||
|
13 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-image1
|
||
|
11 years ago
|
*/
|
||
|
|
Image3D image(Int level, Image3D&& image);
|
||
|
|
|
||
|
13 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::image(Int, BufferImage&, BufferUsage)
|
||
|
13 years ago
|
*
|
||
|
13 years ago
|
* See @ref Texture::image(Int, BufferImage&, BufferUsage) for more
|
||
|
13 years ago
|
* information.
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
13 years ago
|
*/
|
||
|
13 years ago
|
void image(Int level, BufferImage3D& image, BufferUsage usage) {
|
||
|
12 years ago
|
AbstractTexture::image<3>(level, image, usage);
|
||
|
13 years ago
|
}
|
||
|
|
|
||
|
11 years ago
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-image2
|
||
|
11 years ago
|
*/
|
||
|
|
BufferImage3D image(Int level, BufferImage3D&& image, BufferUsage usage);
|
||
|
11 years ago
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedImage(Int, CompressedImage&)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedImage(Int, CompressedImage&) for more
|
||
|
|
* information.
|
||
|
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void compressedImage(Int level, CompressedImage3D& image) {
|
||
|
|
AbstractTexture::compressedImage<3>(level, image);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-compressedImage1
|
||
|
11 years ago
|
*/
|
||
|
|
CompressedImage3D compressedImage(Int level, CompressedImage3D&& image);
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedImage(Int, CompressedBufferImage&, BufferUsage)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedImage(Int, CompressedBufferImage&, BufferUsage)
|
||
|
|
* for more information.
|
||
|
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void compressedImage(Int level, CompressedBufferImage3D& image, BufferUsage usage) {
|
||
|
|
AbstractTexture::compressedImage<3>(level, image, usage);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-compressedImage2
|
||
|
11 years ago
|
*/
|
||
|
|
CompressedBufferImage3D compressedImage(Int level, CompressedBufferImage3D&& image, BufferUsage usage);
|
||
|
11 years ago
|
|
||
|
11 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
|
||
|
|
* for more information.
|
||
|
|
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void subImage(Int level, const Range3Di& range, Image3D& image) {
|
||
|
|
AbstractTexture::subImage<3>(level, range, image);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-subImage1
|
||
|
11 years ago
|
*/
|
||
|
|
Image3D subImage(Int level, const Range3Di& range, Image3D&& image);
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, BufferImage&, BufferUsage)
|
||
|
|
* for more information.
|
||
|
|
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage) {
|
||
|
|
AbstractTexture::subImage<3>(level, range, image, usage);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-subImage2
|
||
|
11 years ago
|
*/
|
||
|
|
BufferImage3D subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage);
|
||
|
11 years ago
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedImage&)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedImage&)
|
||
|
|
* for more information.
|
||
|
|
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
|
||
|
9 years ago
|
* @requires_gl43 Extension @extension{ARB,internalformat_query2} if
|
||
|
|
* @ref CompressedPixelStorage::compressedBlockSize() and
|
||
|
|
* @ref CompressedPixelStorage::compressedBlockDataSize() are not
|
||
|
|
* set to non-zero values
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void compressedSubImage(Int level, const Range3Di& range, CompressedImage3D& image) {
|
||
|
|
AbstractTexture::compressedSubImage<3>(level, range, image);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-compressedSubImage1
|
||
|
11 years ago
|
*/
|
||
|
|
CompressedImage3D compressedSubImage(Int level, const Range3Di& range, CompressedImage3D&& image);
|
||
|
|
|
||
|
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedBufferImage&, BufferUsage)
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::compressedSubImage(Int, const RangeTypeFor<dimensions, Int>&, CompressedBufferImage&, BufferUsage)
|
||
|
|
* for more information.
|
||
|
|
* @requires_gl45 Extension @extension{ARB,get_texture_sub_image}
|
||
|
9 years ago
|
* @requires_gl43 Extension @extension{ARB,internalformat_query2} if
|
||
|
|
* @ref CompressedPixelStorage::compressedBlockSize() and
|
||
|
|
* @ref CompressedPixelStorage::compressedBlockDataSize() are not
|
||
|
|
* set to non-zero values
|
||
|
11 years ago
|
* @requires_gl Texture image queries are not available in OpenGL ES.
|
||
|
8 years ago
|
* See @ref Framebuffer::read() or @ref DebugTools::textureSubImage()
|
||
|
|
* for possible workarounds.
|
||
|
11 years ago
|
*/
|
||
|
|
void compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D& image, BufferUsage usage) {
|
||
|
|
AbstractTexture::compressedSubImage<3>(level, range, image, usage);
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
*
|
||
|
|
* Convenience alternative to the above, example usage:
|
||
|
8 years ago
|
*
|
||
|
8 years ago
|
* @snippet MagnumGL.cpp CubeMapTextureArray-compressedSubImage2
|
||
|
11 years ago
|
*/
|
||
|
|
CompressedBufferImage3D compressedSubImage(Int level, const Range3Di& range, CompressedBufferImage3D&& image, BufferUsage usage);
|
||
|
11 years ago
|
#endif
|
||
|
11 years ago
|
|
||
|
14 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setImage()
|
||
|
13 years ago
|
* @return Reference to self (for method chaining)
|
||
|
14 years ago
|
*
|
||
|
14 years ago
|
* Sets texture image data from three-dimensional image for all cube
|
||
|
|
* faces for all layers. Each group of 6 2D images is one cube map
|
||
|
13 years ago
|
* layer, thus Z coordinate of @p image size must be multiple of 6. The
|
||
|
|
* images are in order of (+X, -X, +Y, -Y, +Z, -Z).
|
||
|
14 years ago
|
*
|
||
|
13 years ago
|
* See @ref Texture::setImage() for more information.
|
||
|
12 years ago
|
* @see @ref maxSize()
|
||
|
11 years ago
|
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
|
||
|
12 years ago
|
* instead.
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, const ImageView3D& image) {
|
||
|
12 years ago
|
DataHelper<3>::setImage(*this, level, internalFormat, image);
|
||
|
13 years ago
|
return *this;
|
||
|
13 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
/** @overload
|
||
|
11 years ago
|
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
|
||
|
12 years ago
|
* instead.
|
||
|
|
*/
|
||
|
13 years ago
|
CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, BufferImage3D& image) {
|
||
|
12 years ago
|
DataHelper<3>::setImage(*this, level, internalFormat, image);
|
||
|
13 years ago
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
12 years ago
|
/** @overload
|
||
|
11 years ago
|
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
|
||
|
12 years ago
|
* instead.
|
||
|
|
*/
|
||
|
13 years ago
|
CubeMapTextureArray& setImage(Int level, TextureFormat internalFormat, BufferImage3D&& image) {
|
||
|
|
return setImage(level, internalFormat, image);
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setCompressedImage()
|
||
|
11 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* Sets texture image data from three-dimensional image for all cube
|
||
|
|
* faces for all layers. Each group of 6 2D images is one cube map
|
||
|
|
* layer, thus Z coordinate of @p image size must be multiple of 6. The
|
||
|
|
* images are in order of (+X, -X, +Y, -Y, +Z, -Z).
|
||
|
|
*
|
||
|
|
* See @ref Texture::setCompressedImage() for more information.
|
||
|
|
* @see @ref maxSize()
|
||
|
|
* @deprecated_gl Prefer to use @ref setStorage() and
|
||
|
|
* @ref setCompressedSubImage() instead.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompressedImage(Int level, const CompressedImageView3D& image) {
|
||
|
|
DataHelper<3>::setCompressedImage(*this, level, image);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
* @deprecated_gl Prefer to use @ref setStorage() and
|
||
|
|
* @ref setCompressedSubImage() instead.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompressedImage(Int level, CompressedBufferImage3D& image) {
|
||
|
|
DataHelper<3>::setCompressedImage(*this, level, image);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload
|
||
|
|
* @deprecated_gl Prefer to use @ref setStorage() and
|
||
|
|
* @ref setCompressedSubImage() instead.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompressedImage(Int level, CompressedBufferImage3D&& image) {
|
||
|
|
return setCompressedImage(level, image);
|
||
|
|
}
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setSubImage()
|
||
|
13 years ago
|
* @return Reference to self (for method chaining)
|
||
|
14 years ago
|
*
|
||
|
13 years ago
|
* Z coordinate is equivalent to layer * 6 + number of texture face,
|
||
|
8 years ago
|
* i.e. +X is @cpp 0 @ce and so on, in order of (+X, -X, +Y, -Y, +Z,
|
||
|
|
* -Z).
|
||
|
14 years ago
|
*
|
||
|
13 years ago
|
* See @ref Texture::setSubImage() for more information.
|
||
|
14 years ago
|
*/
|
||
|
11 years ago
|
CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, const ImageView3D& image) {
|
||
|
12 years ago
|
DataHelper<3>::setSubImage(*this, level, offset, image);
|
||
|
13 years ago
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
13 years ago
|
/** @overload */
|
||
|
13 years ago
|
CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, BufferImage3D& image) {
|
||
|
12 years ago
|
DataHelper<3>::setSubImage(*this, level, offset, image);
|
||
|
13 years ago
|
return *this;
|
||
|
14 years ago
|
}
|
||
|
14 years ago
|
|
||
|
13 years ago
|
/** @overload */
|
||
|
|
CubeMapTextureArray& setSubImage(Int level, const Vector3i& offset, BufferImage3D&& image) {
|
||
|
|
return setSubImage(level, offset, image);
|
||
|
|
}
|
||
|
|
|
||
|
11 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::setCompressedSubImage()
|
||
|
11 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* Z coordinate is equivalent to layer * 6 + number of texture face,
|
||
|
8 years ago
|
* i.e. +X is @cpp 0 @ce and so on, in order of (+X, -X, +Y, -Y, +Z,
|
||
|
|
* -Z).
|
||
|
11 years ago
|
*
|
||
|
|
* See @ref Texture::setCompressedSubImage() for more information.
|
||
|
|
*/
|
||
|
|
CubeMapTextureArray& setCompressedSubImage(Int level, const Vector3i& offset, const CompressedImageView3D& image) {
|
||
|
|
DataHelper<3>::setCompressedSubImage(*this, level, offset, image);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload */
|
||
|
|
CubeMapTextureArray& setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D& image) {
|
||
|
|
DataHelper<3>::setCompressedSubImage(*this, level, offset, image);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** @overload */
|
||
|
|
CubeMapTextureArray& setCompressedSubImage(Int level, const Vector3i& offset, CompressedBufferImage3D&& image) {
|
||
|
|
return setCompressedSubImage(level, offset, image);
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::generateMipmap()
|
||
|
12 years ago
|
* @return Reference to self (for method chaining)
|
||
|
|
*
|
||
|
|
* See @ref Texture::generateMipmap() for more information.
|
||
|
|
* @requires_gl30 Extension @extension{ARB,framebuffer_object}
|
||
|
|
*/
|
||
|
12 years ago
|
CubeMapTextureArray& generateMipmap() {
|
||
|
|
AbstractTexture::generateMipmap();
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
|
|
||
|
12 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::invalidateImage()
|
||
|
12 years ago
|
*
|
||
|
|
* See @ref Texture::invalidateImage() for more information.
|
||
|
|
*/
|
||
|
12 years ago
|
void invalidateImage(Int level) { AbstractTexture::invalidateImage(level); }
|
||
|
|
|
||
|
14 years ago
|
/**
|
||
|
8 years ago
|
* @brief @copybrief Texture::invalidateSubImage()
|
||
|
14 years ago
|
*
|
||
|
|
* Z coordinate is equivalent to layer * 6 + number of texture face,
|
||
|
8 years ago
|
* i.e. +X is @cpp 0 @ce and so on, in order of (+X, -X, +Y, -Y, +Z,
|
||
|
|
* -Z).
|
||
|
14 years ago
|
*
|
||
|
13 years ago
|
* See @ref Texture::invalidateSubImage() for more information.
|
||
|
14 years ago
|
*/
|
||
|
13 years ago
|
void invalidateSubImage(Int level, const Vector3i& offset, const Vector3i& size) {
|
||
|
12 years ago
|
DataHelper<3>::invalidateSubImage(*this, level, offset, size);
|
||
|
14 years ago
|
}
|
||
|
|
|
||
|
14 years ago
|
/* Overloads to remove WTF-factor from method chaining order */
|
||
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT
|
||
|
13 years ago
|
CubeMapTextureArray& setLabel(const std::string& label) {
|
||
|
|
AbstractTexture::setLabel(label);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
12 years ago
|
template<std::size_t size> CubeMapTextureArray& setLabel(const char(&label)[size]) {
|
||
|
|
AbstractTexture::setLabel<size>(label);
|
||
|
|
return *this;
|
||
|
|
}
|
||
|
14 years ago
|
#endif
|
||
|
11 years ago
|
|
||
|
|
private:
|
||
|
9 years ago
|
explicit CubeMapTextureArray(GLuint id, ObjectFlags flags) noexcept: AbstractTexture{id, GL_TEXTURE_CUBE_MAP_ARRAY, flags} {}
|
||
|
14 years ago
|
};
|
||
|
|
|
||
|
|
}
|
||
|
13 years ago
|
#else
|
||
|
11 years ago
|
#error this header is not available in OpenGL ES 2.0 and WebGL build
|
||
|
14 years ago
|
#endif
|
||
|
14 years ago
|
|
||
|
|
#endif
|