Browse Source

Shaders: add GenericGL::TextureArrayCoordinates.

pull/674/head
Vladimír Vondruš 1 year ago
parent
commit
99358c4c41
  1. 2
      doc/changelog.dox
  2. 28
      src/Magnum/Shaders/GenericGL.h
  3. 4
      src/Magnum/Shaders/Test/GenericGL_Test.cpp

2
doc/changelog.dox

@ -422,6 +422,8 @@ See also:
@ref Shaders::Generic::SecondaryJointIds, @ref Shaders::Generic::Weights @ref Shaders::Generic::SecondaryJointIds, @ref Shaders::Generic::Weights
and @ref Shaders::Generic::SecondaryWeights attributes for GPU skinning and @ref Shaders::Generic::SecondaryWeights attributes for GPU skinning
support (see also [mosra/magnum#441](https://github.com/mosra/magnum/pull/441)) support (see also [mosra/magnum#441](https://github.com/mosra/magnum/pull/441))
- New @ref Shaders::GenericGL::TextureArrayCoordinates attribute for shaders
accepting three-component texture array coordinates
- GPU skinning support in @ref Shaders::FlatGL, @ref Shaders::PhongGL and - GPU skinning support in @ref Shaders::FlatGL, @ref Shaders::PhongGL and
@ref Shaders::MeshVisualizerGL2D / @ref Shaders::MeshVisualizerGL3D (see @ref Shaders::MeshVisualizerGL2D / @ref Shaders::MeshVisualizerGL3D (see
also [mosra/magnum#444](https://github.com/mosra/magnum/pull/444) and also [mosra/magnum#444](https://github.com/mosra/magnum/pull/444) and

28
src/Magnum/Shaders/GenericGL.h

@ -74,9 +74,7 @@ future use, with no attribute definition implemented yet.
<tr> <tr>
<td>1</td> <td>1</td>
<td colspan="3"> <td colspan="3">
@ref TextureCoordinates @ref TextureCoordinates / @ref TextureArrayCoordinates
* *Reserved* --- third component for a layer
</td> </td>
</tr> </tr>
<tr> <tr>
@ -290,11 +288,30 @@ template<UnsignedInt dimensions> struct GenericGL {
/** /**
* @brief 2D texture coordinates * @brief 2D texture coordinates
* *
* @ref Magnum::Vector2 "Vector2". Corresponds to * @ref Magnum::Vector2 "Vector2". Use either this or the
* @ref TextureArrayCoordinates attribute. Corresponds to
* @ref Trade::MeshAttribute::TextureCoordinates. * @ref Trade::MeshAttribute::TextureCoordinates.
*/ */
typedef GL::Attribute<1, Vector2> TextureCoordinates; typedef GL::Attribute<1, Vector2> TextureCoordinates;
#ifndef MAGNUM_TARGET_GLES2
/**
* @brief 2D array texture coordinates
* @m_since_latest
*
* @ref Magnum::Vector3 "Vector3". Use either this or the
* @ref TextureCoordinates attribute. Currently doesn't have a
* corresponding @ref Trade::MeshAttribute.
* @requires_gl30 Extension @gl_extension{EXT,texture_array}
* @requires_gles30 Texture arrays are not available in OpenGL ES 2.0.
* @requires_webgl20 Texture arrays are not available in WebGL 1.0.
*/
/* Not naming this TextureCoordinates3D as that's semantically something
else, plus texture arrays are not on ES2 while 3D textures are. The name
for 3D coords would then be TextureVolumeCoordinates I think. */
typedef GL::Attribute<1, Vector3> TextureArrayCoordinates;
#endif
/** /**
* @brief Three-component vertex color * @brief Three-component vertex color
* *
@ -541,6 +558,9 @@ struct BaseGenericGL {
}; };
typedef GL::Attribute<1, Vector2> TextureCoordinates; typedef GL::Attribute<1, Vector2> TextureCoordinates;
#ifndef MAGNUM_TARGET_GLES2
typedef GL::Attribute<1, Vector3> TextureArrayCoordinates;
#endif
typedef GL::Attribute<2, Magnum::Color3> Color3; typedef GL::Attribute<2, Magnum::Color3> Color3;
typedef GL::Attribute<2, Magnum::Color4> Color4; typedef GL::Attribute<2, Magnum::Color4> Color4;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2

4
src/Magnum/Shaders/Test/GenericGL_Test.cpp

@ -60,6 +60,10 @@ void GenericGL_Test::glslMatch() {
CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL2D::TextureCoordinates::Location); CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL2D::TextureCoordinates::Location);
CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL3D::TextureCoordinates::Location); CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL3D::TextureCoordinates::Location);
#ifndef MAGNUM_TARGET_GLES2
CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL2D::TextureArrayCoordinates::Location);
CORRADE_COMPARE(TEXTURECOORDINATES_ATTRIBUTE_LOCATION, GenericGL3D::TextureArrayCoordinates::Location);
#endif
CORRADE_COMPARE(COLOR_ATTRIBUTE_LOCATION, GenericGL2D::Color3::Location); CORRADE_COMPARE(COLOR_ATTRIBUTE_LOCATION, GenericGL2D::Color3::Location);
CORRADE_COMPARE(COLOR_ATTRIBUTE_LOCATION, GenericGL3D::Color3::Location); CORRADE_COMPARE(COLOR_ATTRIBUTE_LOCATION, GenericGL3D::Color3::Location);

Loading…
Cancel
Save