From 10a782b871488d30b632dfab2e9cf01b7487cba9 Mon Sep 17 00:00:00 2001 From: laurentgom Date: Mon, 21 Mar 2011 17:34:26 +0000 Subject: [PATCH] Updated CSFML git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1813 4e206d99-4929-0410-ac5d-dfc041789085 --- bindings/c/include/SFML/Graphics/Shader.h | 11 ++++++++++- bindings/c/src/SFML/Graphics/Shader.cpp | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/bindings/c/include/SFML/Graphics/Shader.h b/bindings/c/include/SFML/Graphics/Shader.h index ab02d4332..8d6ab360c 100644 --- a/bindings/c/include/SFML/Graphics/Shader.h +++ b/bindings/c/include/SFML/Graphics/Shader.h @@ -115,11 +115,20 @@ CSFML_API void sfShader_SetParameter4(sfShader* shader, const char* name, float /// /// \param shader : Shader to modify /// \param name : Texture name in the effect -/// \param texture : Image to set (pass NULL to use the texture of the object being drawn) +/// \param texture : Image to set /// //////////////////////////////////////////////////////////// CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture); +//////////////////////////////////////////////////////////// +/// Set the current texture parameter in a shader +/// +/// \param shader : Shader to modify +/// \param name : Texture name in the effect +/// +//////////////////////////////////////////////////////////// +CSFML_API void sfShader_SetCurrentTexture(sfShader* shader, const char* name); + //////////////////////////////////////////////////////////// /// Bind a shader for rendering /// diff --git a/bindings/c/src/SFML/Graphics/Shader.cpp b/bindings/c/src/SFML/Graphics/Shader.cpp index 3756d106d..acc93e940 100644 --- a/bindings/c/src/SFML/Graphics/Shader.cpp +++ b/bindings/c/src/SFML/Graphics/Shader.cpp @@ -126,7 +126,17 @@ void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y //////////////////////////////////////////////////////////// void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture) { - CSFML_CALL(shader, SetTexture(name, texture && texture->This ? *texture->This : sf::Shader::CurrentTexture)) + CSFML_CHECK(texture); + CSFML_CALL(shader, SetTexture(name, *texture->This)) +} + + +//////////////////////////////////////////////////////////// +/// Set the current texture parameter in a shader +//////////////////////////////////////////////////////////// +void sfShader_SetCurrentTexture(sfShader* shader, const char* name) +{ + CSFML_CALL(shader, SetCurrentTexture(name)) }