Browse Source

Shaders: rename texture binding functions from set*() to bind*().

This better reflects that the functions modify a global state instead of
a shader-local state and so rebinding may be necessary (unlike with
uniforms, which get preserved).

The old set*() functions are now inline aliases to the bind*()
functions, are marked as deprecated and will be removed in some future
release.
pull/205/head
Vladimír Vondruš 8 years ago
parent
commit
7917741346
  1. 13
      doc/changelog.dox
  2. 4
      doc/generated/shaders.cpp
  3. 12
      doc/snippets/MagnumShaders.cpp
  4. 4
      doc/snippets/MagnumText.cpp
  5. 2
      src/Magnum/Shaders/AbstractVector.cpp
  6. 13
      src/Magnum/Shaders/AbstractVector.h
  7. 11
      src/Magnum/Shaders/DistanceFieldVector.h
  8. 2
      src/Magnum/Shaders/Flat.cpp
  9. 17
      src/Magnum/Shaders/Flat.h
  10. 8
      src/Magnum/Shaders/Phong.cpp
  11. 74
      src/Magnum/Shaders/Phong.h
  12. 11
      src/Magnum/Shaders/Vector.h

13
doc/changelog.dox

@ -51,6 +51,19 @@ See also:
@webgl_extension{WEBGL,color_buffer_float}, @webgl_extension{WEBGL,color_buffer_float},
@webgl_extension{EXT,color_buffer_float} @webgl_extension{EXT,color_buffer_float}
@subsection changelog-latest-deprecated Deprecated APIs
- @cpp Shaders::*Vector::setVectorTexture() @ce, @cpp Shaders::Flat::setTexture() @ce,
@cpp Shaders::Phong::setAmbientTexture() @ce, @cpp Shaders::Phong::setDiffuseTexture() @ce,
@cpp Shaders::Phong::setSpecularTexture() @ce and @cpp Shaders::Phong::setTextures() @ce
are deprecated because texture binding (a global state) is confused there
with uniform setup (a shader-local state). That can lead to accidental
state mismatches where a texture is forgotten to be rebound. Use
@ref Shaders::AbstractVector::bindVectorTexture() "Shaders::*Vector::bindVectorTexture()",
@ref Shaders::Flat::bindTexture(), @ref Shaders::Phong::bindAmbientTexture(),
@ref Shaders::Phong::bindDiffuseTexture(), @ref Shaders::Phong::bindSpecularTexture()
and @ref Shaders::Phong::bindTextures() instead.
@subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs @subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs
- Removed the @cpp Buffer::Usage @ce enum that was deprecated in 2014.01, use - Removed the @cpp Buffer::Usage @ce enum that was deprecated in 2014.01, use

4
doc/generated/shaders.cpp

@ -252,7 +252,7 @@ std::string ShaderVisualizer::vector() {
Shaders::Vector2D shader; Shaders::Vector2D shader;
shader.setColor(BaseColor) shader.setColor(BaseColor)
.setVectorTexture(texture) .bindVectorTexture(texture)
.setTransformationProjectionMatrix({}); .setTransformationProjectionMatrix({});
Renderer::enable(Renderer::Feature::Blending); Renderer::enable(Renderer::Feature::Blending);
@ -288,7 +288,7 @@ std::string ShaderVisualizer::distanceFieldVector() {
shader.setColor(BaseColor) shader.setColor(BaseColor)
.setOutlineColor(OutlineColor) .setOutlineColor(OutlineColor)
.setOutlineRange(0.6f, 0.4f) .setOutlineRange(0.6f, 0.4f)
.setVectorTexture(texture) .bindVectorTexture(texture)
.setTransformationProjectionMatrix({}); .setTransformationProjectionMatrix({});
Renderer::enable(Renderer::Feature::Blending); Renderer::enable(Renderer::Feature::Blending);

12
doc/snippets/MagnumShaders.cpp

@ -72,7 +72,7 @@ Matrix4 transformationMatrix, projectionMatrix;
Texture2D diffuseTexture, specularTexture; Texture2D diffuseTexture, specularTexture;
Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture}; Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture};
shader.setDiffuseTexture(diffuseTexture) shader.bindDiffuseTexture(diffuseTexture)
.setLightPosition({5.0f, 5.0f, 7.0f}) .setLightPosition({5.0f, 5.0f, 7.0f})
.setTransformationMatrix(transformationMatrix) .setTransformationMatrix(transformationMatrix)
.setNormalMatrix(transformationMatrix.rotation()) .setNormalMatrix(transformationMatrix.rotation())
@ -132,7 +132,7 @@ Shaders::DistanceFieldVector2D shader;
shader.setColor(0x2f83cc_rgbf) shader.setColor(0x2f83cc_rgbf)
.setOutlineColor(0xdcdcdc_rgbf) .setOutlineColor(0xdcdcdc_rgbf)
.setOutlineRange(0.6f, 0.4f) .setOutlineRange(0.6f, 0.4f)
.setVectorTexture(texture) .bindVectorTexture(texture)
.setTransformationProjectionMatrix(projectionMatrix*transformationMatrix); .setTransformationProjectionMatrix(projectionMatrix*transformationMatrix);
mesh.draw(shader); mesh.draw(shader);
@ -196,7 +196,7 @@ Texture2D texture;
Shaders::Flat3D shader{Shaders::Flat3D::Flag::Textured}; Shaders::Flat3D shader{Shaders::Flat3D::Flag::Textured};
shader.setTransformationProjectionMatrix(projectionMatrix*transformationMatrix) shader.setTransformationProjectionMatrix(projectionMatrix*transformationMatrix)
.setTexture(texture); .bindTexture(texture);
mesh.draw(shader); mesh.draw(shader);
/* [Flat-usage-textured2] */ /* [Flat-usage-textured2] */
@ -341,7 +341,7 @@ Texture2D diffuseTexture, specularTexture;
Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture| Shaders::Phong shader{Shaders::Phong::Flag::DiffuseTexture|
Shaders::Phong::Flag::SpecularTexture}; Shaders::Phong::Flag::SpecularTexture};
shader.setTextures(nullptr, &diffuseTexture, &specularTexture) shader.bindTextures(nullptr, &diffuseTexture, &specularTexture)
.setLightPosition({5.0f, 5.0f, 7.0f}) .setLightPosition({5.0f, 5.0f, 7.0f})
.setTransformationMatrix(transformationMatrix) .setTransformationMatrix(transformationMatrix)
.setNormalMatrix(transformationMatrix.rotation()) .setNormalMatrix(transformationMatrix.rotation())
@ -358,7 +358,7 @@ Color3 diffuseRgb, specularRgb;
/* [Phong-usage-alpha] */ /* [Phong-usage-alpha] */
Shaders::Phong shader{Shaders::Phong::Flag::AmbientTexture| Shaders::Phong shader{Shaders::Phong::Flag::AmbientTexture|
Shaders::Phong::Flag::DiffuseTexture}; Shaders::Phong::Flag::DiffuseTexture};
shader.setTextures(&ambientAlphaTexture, &diffuseAlphaTexture, nullptr) shader.bindTextures(&ambientAlphaTexture, &diffuseAlphaTexture, nullptr)
.setAmbientColor(0x000000ff_rgbf) .setAmbientColor(0x000000ff_rgbf)
.setDiffuseColor(Color4{diffuseRgb, 0.0f}) .setDiffuseColor(Color4{diffuseRgb, 0.0f})
.setSpecularColor(Color4{specularRgb, 0.0f}); .setSpecularColor(Color4{specularRgb, 0.0f});
@ -391,7 +391,7 @@ Texture2D texture;
Shaders::Vector2D shader; Shaders::Vector2D shader;
shader.setColor(0x2f83cc_rgbf) shader.setColor(0x2f83cc_rgbf)
.setVectorTexture(texture) .bindVectorTexture(texture)
.setTransformationProjectionMatrix(projectionMatrix*transformationMatrix); .setTransformationProjectionMatrix(projectionMatrix*transformationMatrix);
mesh.draw(shader); mesh.draw(shader);

4
doc/snippets/MagnumText.cpp

@ -77,7 +77,7 @@ std::tie(mesh, std::ignore) = Text::Renderer2D::render(*font, cache, 0.15f,
/* Draw the text on the screen */ /* Draw the text on the screen */
shader.setTransformationProjectionMatrix(projectionMatrix) shader.setTransformationProjectionMatrix(projectionMatrix)
.setColor(0xffffff_rgbf) .setColor(0xffffff_rgbf)
.setVectorTexture(cache.texture()); .bindVectorTexture(cache.texture());
mesh.draw(shader); mesh.draw(shader);
/* [Renderer-usage1] */ /* [Renderer-usage1] */
@ -92,7 +92,7 @@ renderer.render("Hello World Countdown: 10");
/* Draw the text on the screen */ /* Draw the text on the screen */
shader.setTransformationProjectionMatrix(projectionMatrix) shader.setTransformationProjectionMatrix(projectionMatrix)
.setColor(0xffffff_rgbf) .setColor(0xffffff_rgbf)
.setVectorTexture(cache.texture()); .bindVectorTexture(cache.texture());
renderer.mesh().draw(shader); renderer.mesh().draw(shader);
/* [Renderer-usage2] */ /* [Renderer-usage2] */
} }

2
src/Magnum/Shaders/AbstractVector.cpp

@ -30,7 +30,7 @@
namespace Magnum { namespace Shaders { namespace Magnum { namespace Shaders {
template<UnsignedInt dimensions> AbstractVector<dimensions>& AbstractVector<dimensions>::setVectorTexture(Texture2D& texture) { template<UnsignedInt dimensions> AbstractVector<dimensions>& AbstractVector<dimensions>::bindVectorTexture(Texture2D& texture) {
texture.bind(VectorTextureLayer); texture.bind(VectorTextureLayer);
return *this; return *this;
} }

13
src/Magnum/Shaders/AbstractVector.h

@ -58,10 +58,19 @@ template<UnsignedInt dimensions> class AbstractVector: public AbstractShaderProg
typedef typename Generic<dimensions>::TextureCoordinates TextureCoordinates; typedef typename Generic<dimensions>::TextureCoordinates TextureCoordinates;
/** /**
* @brief Set vector texture * @brief Bind vector texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
*/ */
AbstractVector<dimensions>& setVectorTexture(Texture2D& texture); AbstractVector<dimensions>& bindVectorTexture(Texture2D& texture);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindVectorTexture()
* @deprecated Use @ref bindVectorTexture() instead.
*/
CORRADE_DEPRECATED("use bindVectorTexture() instead") AbstractVector<dimensions>& setVectorTexture(Texture2D& texture) {
return bindVectorTexture(texture);
}
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
protected: protected:

11
src/Magnum/Shaders/DistanceFieldVector.h

@ -47,7 +47,7 @@ rendered outlook will greatly depend on radius of input distance field and
value passed to @ref setSmoothness(). You need to provide @ref Position and value passed to @ref setSmoothness(). You need to provide @ref Position and
@ref TextureCoordinates attributes in your triangle mesh and call at least @ref TextureCoordinates attributes in your triangle mesh and call at least
@ref setTransformationProjectionMatrix(), @ref setColor() and @ref setTransformationProjectionMatrix(), @ref setColor() and
@ref setVectorTexture(). @ref bindVectorTexture().
@image html shaders-distancefieldvector.png @image html shaders-distancefieldvector.png
@ -152,10 +152,15 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT DistanceFieldVector
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
/* Overloads to remove WTF-factor from method chaining order */ /* Overloads to remove WTF-factor from method chaining order */
DistanceFieldVector<dimensions>& setVectorTexture(Texture2D& texture) { DistanceFieldVector<dimensions>& bindVectorTexture(Texture2D& texture) {
AbstractVector<dimensions>::setVectorTexture(texture); AbstractVector<dimensions>::bindVectorTexture(texture);
return *this; return *this;
} }
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_DEPRECATED("use bindVectorTexture() instead") DistanceFieldVector<dimensions>& setVectorTexture(Texture2D& texture) {
return bindVectorTexture(texture);
}
#endif
#endif #endif
private: private:

2
src/Magnum/Shaders/Flat.cpp

@ -105,7 +105,7 @@ template<UnsignedInt dimensions> Flat<dimensions>::Flat(const Flags flags): _fla
#endif #endif
} }
template<UnsignedInt dimensions> Flat<dimensions>& Flat<dimensions>::setTexture(Texture2D& texture) { template<UnsignedInt dimensions> Flat<dimensions>& Flat<dimensions>::bindTexture(Texture2D& texture) {
if(_flags & Flag::Textured) texture.bind(TextureLayer); if(_flags & Flag::Textured) texture.bind(TextureLayer);
return *this; return *this;
} }

17
src/Magnum/Shaders/Flat.h

@ -53,7 +53,7 @@ need to provide @ref Position attribute in your triangle mesh and call at least
If you want to use texture, you need to provide also @ref TextureCoordinates If you want to use texture, you need to provide also @ref TextureCoordinates
attribute. Pass @ref Flag::Textured to constructor and then at render time attribute. Pass @ref Flag::Textured to constructor and then at render time
don't forget to set also the texture via @ref setTexture(). The texture is don't forget to set also the texture via @ref bindTexture(). The texture is
multipled by the color, which is by default set to fully opaque white if multipled by the color, which is by default set to fully opaque white if
texturing is enabled. texturing is enabled.
@ -161,7 +161,7 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Flat: public Abstra
* If @ref Flag::Textured is set, default value is * If @ref Flag::Textured is set, default value is
* @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with * @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with
* texture. * texture.
* @see @ref setTexture() * @see @ref bindTexture()
*/ */
Flat<dimensions>& setColor(const Color4& color){ Flat<dimensions>& setColor(const Color4& color){
setUniform(_colorUniform, color); setUniform(_colorUniform, color);
@ -169,13 +169,22 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Flat: public Abstra
} }
/** /**
* @brief Set texture * @brief Bind texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if @ref Flag::Textured is set. * Has effect only if @ref Flag::Textured is set.
* @see @ref setColor() * @see @ref setColor()
*/ */
Flat<dimensions>& setTexture(Texture2D& texture); Flat<dimensions>& bindTexture(Texture2D& texture);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindTexture()
* @deprecated Use @ref bindTexture() instead.
*/
CORRADE_DEPRECATED("use bindTexture() instead") Flat<dimensions>& setTexture(Texture2D& texture) {
return bindTexture(texture);
}
#endif
private: private:
Flags _flags; Flags _flags;

8
src/Magnum/Shaders/Phong.cpp

@ -124,22 +124,22 @@ Phong::Phong(const Flags flags): _flags(flags) {
#endif #endif
} }
Phong& Phong::setAmbientTexture(Texture2D& texture) { Phong& Phong::bindAmbientTexture(Texture2D& texture) {
if(_flags & Flag::AmbientTexture) texture.bind(AmbientTextureLayer); if(_flags & Flag::AmbientTexture) texture.bind(AmbientTextureLayer);
return *this; return *this;
} }
Phong& Phong::setDiffuseTexture(Texture2D& texture) { Phong& Phong::bindDiffuseTexture(Texture2D& texture) {
if(_flags & Flag::DiffuseTexture) texture.bind(DiffuseTextureLayer); if(_flags & Flag::DiffuseTexture) texture.bind(DiffuseTextureLayer);
return *this; return *this;
} }
Phong& Phong::setSpecularTexture(Texture2D& texture) { Phong& Phong::bindSpecularTexture(Texture2D& texture) {
if(_flags & Flag::SpecularTexture) texture.bind(SpecularTextureLayer); if(_flags & Flag::SpecularTexture) texture.bind(SpecularTextureLayer);
return *this; return *this;
} }
Phong& Phong::setTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular) { Phong& Phong::bindTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular) {
AbstractTexture::bind(AmbientTextureLayer, {ambient, diffuse, specular}); AbstractTexture::bind(AmbientTextureLayer, {ambient, diffuse, specular});
return *this; return *this;
} }

74
src/Magnum/Shaders/Phong.h

@ -47,10 +47,10 @@ call at least @ref setTransformationMatrix(), @ref setNormalMatrix(),
If you want to use textures, you need to provide also @ref TextureCoordinates If you want to use textures, you need to provide also @ref TextureCoordinates
attribute. Pass appropriate @ref Flags to constructor and then at render time attribute. Pass appropriate @ref Flags to constructor and then at render time
don't forget to also call appropriate subset of @ref setAmbientTexture(), don't forget to also call appropriate subset of @ref bindAmbientTexture(),
@ref setDiffuseTexture() and @ref setSpecularTexture(). The texture is @ref bindDiffuseTexture() and @ref bindSpecularTexture() (or the combined
multipled by the color, which is by default set to fully opaque white for @ref bindTextures()). The texture is multipled by the color, which is by
enabled textures. default set to fully opaque white for enabled textures.
@image html shaders-phong.png @image html shaders-phong.png
@ -159,7 +159,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* If @ref Flag::AmbientTexture is set, default value is * If @ref Flag::AmbientTexture is set, default value is
* @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with * @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with
* ambient texture, otherwise default value is @cpp 0x000000ff_rgbaf @ce. * ambient texture, otherwise default value is @cpp 0x000000ff_rgbaf @ce.
* @see @ref setAmbientTexture() * @see @ref bindAmbientTexture()
*/ */
Phong& setAmbientColor(const Color4& color) { Phong& setAmbientColor(const Color4& color) {
setUniform(_ambientColorUniform, color); setUniform(_ambientColorUniform, color);
@ -167,13 +167,22 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
} }
/** /**
* @brief Set ambient texture * @brief Bind ambient texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if @ref Flag::AmbientTexture is set. * Has effect only if @ref Flag::AmbientTexture is set.
* @see @ref setTextures(), @ref setAmbientColor() * @see @ref bindTextures(), @ref setAmbientColor()
*/ */
Phong& setAmbientTexture(Texture2D& texture); Phong& bindAmbientTexture(Texture2D& texture);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindAmbientTexture()
* @deprecated Use @ref bindAmbientTexture() instead.
*/
CORRADE_DEPRECATED("use bindAmbientTexture() instead") Phong& setAmbientTexture(Texture2D& texture) {
return bindAmbientTexture(texture);
}
#endif
/** /**
* @brief Set diffuse color * @brief Set diffuse color
@ -182,7 +191,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* If @ref Flag::DiffuseTexture is set, default value is * If @ref Flag::DiffuseTexture is set, default value is
* @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with * @cpp 0xffffffff_rgbaf @ce and the color will be multiplied with
* diffuse texture. * diffuse texture.
* @see @ref setDiffuseTexture() * @see @ref bindDiffuseTexture()
*/ */
Phong& setDiffuseColor(const Color4& color) { Phong& setDiffuseColor(const Color4& color) {
setUniform(_diffuseColorUniform, color); setUniform(_diffuseColorUniform, color);
@ -190,13 +199,22 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
} }
/** /**
* @brief Set diffuse texture * @brief Bind diffuse texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if @ref Flag::DiffuseTexture is set. * Has effect only if @ref Flag::DiffuseTexture is set.
* @see @ref setTextures(), @ref setDiffuseColor() * @see @ref bindTextures(), @ref setDiffuseColor()
*/ */
Phong& setDiffuseTexture(Texture2D& texture); Phong& bindDiffuseTexture(Texture2D& texture);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindDiffuseTexture()
* @deprecated Use @ref bindDiffuseTexture() instead.
*/
CORRADE_DEPRECATED("use bindDiffuseTexture() instead") Phong& setDiffuseTexture(Texture2D& texture) {
return bindDiffuseTexture(texture);
}
#endif
/** /**
* @brief Set specular color * @brief Set specular color
@ -204,7 +222,7 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
* *
* Default value is @cpp 0xffffffff_rgbaf @ce. Color will be multiplied * Default value is @cpp 0xffffffff_rgbaf @ce. Color will be multiplied
* with specular texture if @ref Flag::SpecularTexture is set. * with specular texture if @ref Flag::SpecularTexture is set.
* @see @ref setSpecularTexture() * @see @ref bindSpecularTexture()
*/ */
Phong& setSpecularColor(const Color4& color) { Phong& setSpecularColor(const Color4& color) {
setUniform(_specularColorUniform, color); setUniform(_specularColorUniform, color);
@ -212,25 +230,43 @@ class MAGNUM_SHADERS_EXPORT Phong: public AbstractShaderProgram {
} }
/** /**
* @brief Set specular texture * @brief Bind specular texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* Has effect only if @ref Flag::SpecularTexture is set. * Has effect only if @ref Flag::SpecularTexture is set.
* @see @ref setTextures(), @ref setSpecularColor() * @see @ref setTextures(), @ref setSpecularColor()
*/ */
Phong& setSpecularTexture(Texture2D& texture); Phong& bindSpecularTexture(Texture2D& texture);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindSpecularTexture()
* @deprecated Use @ref bindSpecularTexture() instead.
*/
CORRADE_DEPRECATED("use bindSpecularTexture() instead") Phong& setSpecularTexture(Texture2D& texture) {
return bindSpecularTexture(texture);
}
#endif
/** /**
* @brief Set textures * @brief Bind textures
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
* *
* A particular texture has effect only if particular texture flag from * A particular texture has effect only if particular texture flag from
* @ref Phong::Flag "Flag" is set, you can use `nullptr` for the rest. * @ref Phong::Flag "Flag" is set, you can use `nullptr` for the rest.
* More efficient than setting each texture separately. * More efficient than setting each texture separately.
* @see @ref setAmbientTexture(), @ref setDiffuseTexture(), * @see @ref bindAmbientTexture(), @ref bindDiffuseTexture(),
* @ref setSpecularTexture() * @ref bindSpecularTexture()
*/ */
Phong& setTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular); Phong& bindTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular);
#ifdef MAGNUM_BUILD_DEPRECATED
/** @brief @copybrief bindTextures()
* @deprecated Use @ref bindTextures() instead.
*/
CORRADE_DEPRECATED("use bindTextures() instead") Phong& setTextures(Texture2D* ambient, Texture2D* diffuse, Texture2D* specular) {
return bindTextures(ambient, diffuse, specular);
}
#endif
/** /**
* @brief Set shininess * @brief Set shininess

11
src/Magnum/Shaders/Vector.h

@ -46,7 +46,7 @@ for more advanced effects. For rendering unchanged texture you can use the
@ref Flat shader. You need to provide @ref Position and @ref TextureCoordinates @ref Flat shader. You need to provide @ref Position and @ref TextureCoordinates
attributes in your triangle mesh and call at least attributes in your triangle mesh and call at least
@ref setTransformationProjectionMatrix(), @ref setColor() and @ref setTransformationProjectionMatrix(), @ref setColor() and
@ref setVectorTexture(). @ref bindVectorTexture().
@image html shaders-vector.png @image html shaders-vector.png
@image latex shaders-vector.png @image latex shaders-vector.png
@ -118,10 +118,15 @@ template<UnsignedInt dimensions> class MAGNUM_SHADERS_EXPORT Vector: public Abst
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
/* Overloads to remove WTF-factor from method chaining order */ /* Overloads to remove WTF-factor from method chaining order */
Vector<dimensions>& setVectorTexture(Texture2D& texture) { Vector<dimensions>& bindVectorTexture(Texture2D& texture) {
AbstractVector<dimensions>::setVectorTexture(texture); AbstractVector<dimensions>::bindVectorTexture(texture);
return *this; return *this;
} }
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_DEPRECATED("use bindVectorTexture() instead") Vector<dimensions>& setVectorTexture(Texture2D& texture) {
return bindVectorTexture(texture);
}
#endif
#endif #endif
private: private:

Loading…
Cancel
Save