25 #ifndef SFML_SHADER_HPP 26 #define SFML_SHADER_HPP 31 #include <SFML/Graphics/Export.hpp> 32 #include <SFML/Graphics/Glsl.hpp> 33 #include <SFML/Window/GlResource.hpp> 34 #include <SFML/System/NonCopyable.hpp> 35 #include <SFML/System/Vector2.hpp> 36 #include <SFML/System/Vector3.hpp> 119 bool loadFromFile(
const std::string& filename,
Type type);
140 bool loadFromFile(
const std::string& vertexShaderFilename,
const std::string& fragmentShaderFilename);
162 bool loadFromFile(
const std::string& vertexShaderFilename,
const std::string& geometryShaderFilename,
const std::string& fragmentShaderFilename);
182 bool loadFromMemory(
const std::string& shader,
Type type);
203 bool loadFromMemory(
const std::string& vertexShader,
const std::string& fragmentShader);
225 bool loadFromMemory(
const std::string& vertexShader,
const std::string& geometryShader,
const std::string& fragmentShader);
297 void setUniform(
const std::string& name,
float x);
306 void setUniform(
const std::string& name,
const Glsl::Vec2& vector);
315 void setUniform(
const std::string& name,
const Glsl::Vec3& vector);
333 void setUniform(
const std::string& name,
const Glsl::Vec4& vector);
342 void setUniform(
const std::string& name,
int x);
351 void setUniform(
const std::string& name,
const Glsl::Ivec2& vector);
360 void setUniform(
const std::string& name,
const Glsl::Ivec3& vector);
377 void setUniform(
const std::string& name,
const Glsl::Ivec4& vector);
386 void setUniform(
const std::string& name,
bool x);
395 void setUniform(
const std::string& name,
const Glsl::Bvec2& vector);
404 void setUniform(
const std::string& name,
const Glsl::Bvec3& vector);
413 void setUniform(
const std::string& name,
const Glsl::Bvec4& vector);
422 void setUniform(
const std::string& name,
const Glsl::Mat3& matrix);
431 void setUniform(
const std::string& name,
const Glsl::Mat4& matrix);
463 void setUniform(
const std::string& name,
const Texture& texture);
496 void setUniformArray(
const std::string& name,
const float* scalarArray, std::size_t length);
506 void setUniformArray(
const std::string& name,
const Glsl::Vec2* vectorArray, std::size_t length);
516 void setUniformArray(
const std::string& name,
const Glsl::Vec3* vectorArray, std::size_t length);
526 void setUniformArray(
const std::string& name,
const Glsl::Vec4* vectorArray, std::size_t length);
536 void setUniformArray(
const std::string& name,
const Glsl::Mat3* matrixArray, std::size_t length);
546 void setUniformArray(
const std::string& name,
const Glsl::Mat4* matrixArray, std::size_t length);
554 SFML_DEPRECATED
void setParameter(
const std::string& name,
float x);
562 SFML_DEPRECATED
void setParameter(
const std::string& name,
float x,
float y);
570 SFML_DEPRECATED
void setParameter(
const std::string& name,
float x,
float y,
float z);
578 SFML_DEPRECATED
void setParameter(
const std::string& name,
float x,
float y,
float z,
float w);
586 SFML_DEPRECATED
void setParameter(
const std::string& name,
const Vector2f& vector);
594 SFML_DEPRECATED
void setParameter(
const std::string& name,
const Vector3f& vector);
602 SFML_DEPRECATED
void setParameter(
const std::string& name,
const Color& color);
610 SFML_DEPRECATED
void setParameter(
const std::string& name,
const Transform& transform);
618 SFML_DEPRECATED
void setParameter(
const std::string& name,
const Texture& texture);
638 unsigned int getNativeHandle()
const;
661 static void bind(
const Shader* shader);
673 static bool isAvailable();
692 static bool isGeometryAvailable();
709 bool compile(
const char* vertexShaderCode,
const char* geometryShaderCode,
const char* fragmentShaderCode);
718 void bindTextures()
const;
728 int getUniformLocation(
const std::string& name);
737 struct UniformBinder;
742 typedef std::map<int, const Texture*> TextureTable;
743 typedef std::map<std::string, int> UniformTable;
748 unsigned int m_shaderProgram;
749 int m_currentTexture;
750 TextureTable m_textures;
751 UniformTable m_uniforms;
757 #endif // SFML_SHADER_HPP implementation defined Mat3
3x3 float matrix (mat3 in GLSL)
implementation defined Mat4
4x4 float matrix (mat4 in GLSL)
Special type that can be passed to setUniform(), and that represents the texture of the object being ...
Utility class for manipulating RGBA colors.
implementation defined Ivec4
4D int vector (ivec4 in GLSL)
Base class for classes that require an OpenGL context.
implementation defined Vec4
4D float vector (vec4 in GLSL)
static CurrentTextureType CurrentTexture
Represents the texture of the object being drawn.
Image living on the graphics card that can be used for drawing.
Shader class (vertex, geometry and fragment)
Utility template class for manipulating 3-dimensional vectors.
Utility class that makes any derived class non-copyable.
implementation defined Bvec4
4D bool vector (bvec4 in GLSL)