CSFML
Shader.h
Go to the documentation of this file.
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
5 //
6 // This software is provided 'as-is', without any express or implied warranty.
7 // In no event will the authors be held liable for any damages arising from the use of this software.
8 //
9 // Permission is granted to anyone to use this software for any purpose,
10 // including commercial applications, and to alter it and redistribute it freely,
11 // subject to the following restrictions:
12 //
13 // 1. The origin of this software must not be misrepresented;
14 // you must not claim that you wrote the original software.
15 // If you use this software in a product, an acknowledgment
16 // in the product documentation would be appreciated but is not required.
17 //
18 // 2. Altered source versions must be plainly marked as such,
19 // and must not be misrepresented as being the original software.
20 //
21 // 3. This notice may not be removed or altered from any source distribution.
22 //
24
25 #ifndef SFML_SHADER_H
26 #define SFML_SHADER_H
27
29 // Headers
31 #include <SFML/Graphics/Export.h>
32 #include <SFML/Graphics/Color.h>
33 #include <SFML/Graphics/Glsl.h>
34 #include <SFML/Graphics/Transform.h>
35 #include <SFML/Graphics/Types.h>
36 #include <SFML/System/InputStream.h>
37 #include <SFML/System/Vector2.h>
38 #include <SFML/System/Vector3.h>
39 #include <stddef.h>
40
41
60 CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename);
61
80 CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader);
81
100 CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream);
101
108 CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
109
118 CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x);
119
128 CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector);
129
138 CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector);
139
151 CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector);
152
161 CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color);
162
171 CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x);
172
181 CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector);
182
191 CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector);
192
204 CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector);
205
214 CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color);
215
224 CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x);
225
234 CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector);
235
244 CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector);
245
257 CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector);
258
267 CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix);
268
277 CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix);
278
310 CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture);
311
333 CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name);
334
344 CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length);
345
355 CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length);
356
366 CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length);
367
377 CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length);
378
388 CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length);
389
399 CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length);
400
421 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
422
444 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
445
468 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
469
493 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
494
516 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
517
539 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
540
567 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
568
590 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
591
623 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
624
646 CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
647
660 CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
661
683 CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
684
695 CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void);
696
714 CSFML_GRAPHICS_API sfBool sfShader_isGeometryAvailable(void);
715
716 #endif // SFML_SHADER_H
sfVector3f
3-component vector of floats
Definition: Vector3.h:38
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition: Graphics/Export.h:43
sfShader_bind
CSFML_GRAPHICS_API void sfShader_bind(const sfShader *shader)
Bind a shader for rendering (activate it)
sfShader_createFromStream
CSFML_GRAPHICS_API sfShader * sfShader_createFromStream(sfInputStream *vertexShaderStream, sfInputStream *geometryShaderStream, sfInputStream *fragmentShaderStream)
Load the vertex, geometry and fragment shaders from custom streams.
sfGlslMat4
Definition: Glsl.h:94
sfShader_setColorUniform
CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for vec4 uniform.
sfShader_destroy
CSFML_GRAPHICS_API void sfShader_destroy(sfShader *shader)
Destroy an existing shader.
sfShader_setFloat2Parameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat2Parameter(sfShader *shader, const char *name, float x, float y)
Change a 2-components vector parameter of a shader.
sfShader
struct sfShader sfShader
Definition: Graphics/Types.h:33
sfShader_setMat4UniformArray
CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader *shader, const char *name, const sfGlslMat4 *matrixArray, size_t length)
Specify values for mat4[] array uniform.
sfShader_setFloat3Parameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat3Parameter(sfShader *shader, const char *name, float x, float y, float z)
Change a 3-components vector parameter of a shader.
sfGlslBvec4
Definition: Glsl.h:80
sfShader_setVec2Uniform
CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader *shader, const char *name, sfGlslVec2 vector)
Specify value for vec2 uniform.
sfShader_setVec3UniformArray
CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader *shader, const char *name, const sfGlslVec3 *vectorArray, size_t length)
Specify values for vec3[] array uniform.
Export.h
sfShader_setIvec2Uniform
CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader *shader, const char *name, sfGlslIvec2 vector)
Specify value for ivec2 uniform.
CSFML_DEPRECATED
Mouse wheel events parameters.
Definition: Event.h:126
sfShader_setFloatParameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloatParameter(sfShader *shader, const char *name, float x)
Change a float parameter of a shader.
sfShader_setFloatUniform
CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader *shader, const char *name, float x)
Specify value for float uniform.
sfShader_setBoolUniform
CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader *shader, const char *name, sfBool x)
Specify value for bool uniform.
sfShader_setBvec2Uniform
CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader *shader, const char *name, sfGlslBvec2 vector)
Specify value for bvec2 uniform.
sfShader_setMat4Uniform
CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader *shader, const char *name, const sfGlslMat4 *matrix)
Specify value for mat4 matrix.
sfInputStream
Set of callbacks that allow users to define custom file streams.
Definition: InputStream.h:44
sfShader_setMat3UniformArray
CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader *shader, const char *name, const sfGlslMat3 *matrixArray, size_t length)
Specify values for mat3[] array uniform.
Transform.h
InputStream.h
sfShader_createFromFile
CSFML_GRAPHICS_API sfShader * sfShader_createFromFile(const char *vertexShaderFilename, const char *geometryShaderFilename, const char *fragmentShaderFilename)
Load the vertex, geometry and fragment shaders from files.
sfGlslIvec3
Definition: Glsl.h:49
sfShader_setVec2UniformArray
CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader *shader, const char *name, const sfGlslVec2 *vectorArray, size_t length)
Specify values for vec2[] array uniform.
sfGlslVec4
Definition: Glsl.h:64
sfShader_setVector2Parameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector2Parameter(sfShader *shader, const char *name, sfVector2f vector)
Change a 2-components vector parameter of a shader.
sfBool
int sfBool
Definition: Config.h:153
sfShader_setVector3Parameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader *shader, const char *name, sfVector3f vector)
Change a 3-components vector parameter of a shader.
sfVector2i
2-component vector of integers
Definition: Vector2.h:38
sfShader_setCurrentTextureUniform
CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader *shader, const char *name)
Specify current texture as sampler2D uniform.
sfShader_setVec4Uniform
CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader *shader, const char *name, sfGlslVec4 vector)
Specify value for vec4 uniform.
sfShader_setIntColorUniform
CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for ivec4 uniform.
sfColor
Utility class for manpulating RGBA colors.
Definition: Color.h:38
sfGlslMat3
Definition: Glsl.h:89
Vector2.h
Vector3.h
sfShader_setVec4UniformArray
CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader *shader, const char *name, const sfGlslVec4 *vectorArray, size_t length)
Specify values for vec4[] array uniform.
sfShader_setBvec3Uniform
CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader *shader, const char *name, sfGlslBvec3 vector)
Specify value for Bvec3 uniform.
sfShader_setIvec3Uniform
CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader *shader, const char *name, sfGlslIvec3 vector)
Specify value for ivec3 uniform.
sfGlslBvec3
Definition: Glsl.h:56
sfGlslBvec2
Definition: Glsl.h:40
sfShader_isGeometryAvailable
CSFML_GRAPHICS_API sfBool sfShader_isGeometryAvailable(void)
Tell whether or not the system supports geometry shaders.
sfShader_setIvec4Uniform
CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader *shader, const char *name, sfGlslIvec4 vector)
Specify value for ivec4 uniform.
Types.h
Color.h
Glsl.h
sfShader_createFromMemory
CSFML_GRAPHICS_API sfShader * sfShader_createFromMemory(const char *vertexShader, const char *geometryShader, const char *fragmentShader)
Load the vertex, geometry and fragment shaders from source code in memory.
sfShader_getNativeHandle
CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader *shader)
Get the underlying OpenGL handle of the shader.
sfShader_isAvailable
CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void)
Tell whether or not the system supports shaders.
sfTransform
Encapsulate a 3x3 transform matrix.
Definition: Transform.h:42
sfVector2f
2-component vector of floats
Definition: Vector2.h:60
sfShader_setTextureUniform
CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader *shader, const char *name, const sfTexture *texture)
Specify a texture as sampler2D uniform.
sfShader_setFloatUniformArray
CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader *shader, const char *name, const float *scalarArray, size_t length)
Specify values for float[] array uniform.
sfShader_setBvec4Uniform
CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader *shader, const char *name, sfGlslBvec4 vector)
Specify value for bvec4 uniform.
sfShader_setFloat4Parameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat4Parameter(sfShader *shader, const char *name, float x, float y, float z, float w)
Change a 4-components vector parameter of a shader.
sfShader_setColorParameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader *shader, const char *name, sfColor color)
Change a color parameter of a shader.
sfShader_setCurrentTextureParameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setCurrentTextureParameter(sfShader *shader, const char *name)
Change a texture parameter of a shader.
sfTexture
struct sfTexture sfTexture
Definition: Graphics/Types.h:40
sfShader_setMat3Uniform
CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader *shader, const char *name, const sfGlslMat3 *matrix)
Specify value for mat3 matrix.
sfShader_setTransformParameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader *shader, const char *name, sfTransform transform)
Change a matrix parameter of a shader.
sfGlslIvec4
Definition: Glsl.h:72
sfShader_setTextureParameter
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader *shader, const char *name, const sfTexture *texture)
Change a texture parameter of a shader.
sfShader_setVec3Uniform
CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader *shader, const char *name, sfGlslVec3 vector)
Specify value for vec3 uniform.
sfShader_setIntUniform
CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader *shader, const char *name, int x)
Specify value for int uniform.