CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 2.6.1

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
Shader.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 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
Color.h
sfBool
int sfBool
Definition Config.h:153
CSFML_DEPRECATED
#define CSFML_DEPRECATED
Definition Config.h:146
Glsl.h
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:43
Types.h
sfShader
struct sfShader sfShader
Definition Graphics/Types.h:33
sfTexture
struct sfTexture sfTexture
Definition Graphics/Types.h:40
InputStream.h
sfShader_setIvec4Uniform
void sfShader_setIvec4Uniform(sfShader *shader, const char *name, sfGlslIvec4 vector)
Specify value for ivec4 uniform.
sfShader_setTextureUniform
void sfShader_setTextureUniform(sfShader *shader, const char *name, const sfTexture *texture)
Specify a texture as sampler2D uniform.
sfShader_bind
void sfShader_bind(const sfShader *shader)
Bind a shader for rendering (activate it)
sfShader_setFloatUniform
void sfShader_setFloatUniform(sfShader *shader, const char *name, float x)
Specify value for float uniform.
sfShader_setVec3Uniform
void sfShader_setVec3Uniform(sfShader *shader, const char *name, sfGlslVec3 vector)
Specify value for vec3 uniform.
sfShader_setMat3UniformArray
void sfShader_setMat3UniformArray(sfShader *shader, const char *name, const sfGlslMat3 *matrixArray, size_t length)
Specify values for mat3[] array uniform.
sfShader_setCurrentTextureUniform
void sfShader_setCurrentTextureUniform(sfShader *shader, const char *name)
Specify current texture as sampler2D uniform.
sfShader_isGeometryAvailable
sfBool sfShader_isGeometryAvailable(void)
Tell whether or not the system supports geometry shaders.
sfShader_setIvec2Uniform
void sfShader_setIvec2Uniform(sfShader *shader, const char *name, sfGlslIvec2 vector)
Specify value for ivec2 uniform.
sfShader_setVector3Parameter
void sfShader_setVector3Parameter(sfShader *shader, const char *name, sfVector3f vector)
Change a 3-components vector parameter of a shader.
sfShader_setVec4UniformArray
void sfShader_setVec4UniformArray(sfShader *shader, const char *name, const sfGlslVec4 *vectorArray, size_t length)
Specify values for vec4[] array uniform.
sfShader_setTextureParameter
void sfShader_setTextureParameter(sfShader *shader, const char *name, const sfTexture *texture)
Change a texture parameter of a shader.
sfShader_getNativeHandle
unsigned int sfShader_getNativeHandle(const sfShader *shader)
Get the underlying OpenGL handle of the shader.
sfShader_setMat4Uniform
void sfShader_setMat4Uniform(sfShader *shader, const char *name, const sfGlslMat4 *matrix)
Specify value for mat4 matrix.
sfShader_isAvailable
sfBool sfShader_isAvailable(void)
Tell whether or not the system supports shaders.
sfShader_setBvec2Uniform
void sfShader_setBvec2Uniform(sfShader *shader, const char *name, sfGlslBvec2 vector)
Specify value for bvec2 uniform.
sfShader_setMat3Uniform
void sfShader_setMat3Uniform(sfShader *shader, const char *name, const sfGlslMat3 *matrix)
Specify value for mat3 matrix.
sfShader_createFromFile
sfShader * sfShader_createFromFile(const char *vertexShaderFilename, const char *geometryShaderFilename, const char *fragmentShaderFilename)
Load the vertex, geometry and fragment shaders from files.
sfShader_setVec4Uniform
void sfShader_setVec4Uniform(sfShader *shader, const char *name, sfGlslVec4 vector)
Specify value for vec4 uniform.
sfShader_setBvec3Uniform
void sfShader_setBvec3Uniform(sfShader *shader, const char *name, sfGlslBvec3 vector)
Specify value for Bvec3 uniform.
sfShader_setVec3UniformArray
void sfShader_setVec3UniformArray(sfShader *shader, const char *name, const sfGlslVec3 *vectorArray, size_t length)
Specify values for vec3[] array uniform.
sfShader_setMat4UniformArray
void sfShader_setMat4UniformArray(sfShader *shader, const char *name, const sfGlslMat4 *matrixArray, size_t length)
Specify values for mat4[] array uniform.
sfShader_setFloatParameter
void sfShader_setFloatParameter(sfShader *shader, const char *name, float x)
Change a float parameter of a shader.
sfShader_setVec2UniformArray
void sfShader_setVec2UniformArray(sfShader *shader, const char *name, const sfGlslVec2 *vectorArray, size_t length)
Specify values for vec2[] array uniform.
sfShader_destroy
void sfShader_destroy(sfShader *shader)
Destroy an existing shader.
sfShader_setFloatUniformArray
void sfShader_setFloatUniformArray(sfShader *shader, const char *name, const float *scalarArray, size_t length)
Specify values for float[] array uniform.
sfShader_setBvec4Uniform
void sfShader_setBvec4Uniform(sfShader *shader, const char *name, sfGlslBvec4 vector)
Specify value for bvec4 uniform.
sfShader_setVec2Uniform
void sfShader_setVec2Uniform(sfShader *shader, const char *name, sfGlslVec2 vector)
Specify value for vec2 uniform.
sfShader_createFromStream
sfShader * sfShader_createFromStream(sfInputStream *vertexShaderStream, sfInputStream *geometryShaderStream, sfInputStream *fragmentShaderStream)
Load the vertex, geometry and fragment shaders from custom streams.
sfShader_setVector2Parameter
void sfShader_setVector2Parameter(sfShader *shader, const char *name, sfVector2f vector)
Change a 2-components vector parameter of a shader.
sfShader_setTransformParameter
void sfShader_setTransformParameter(sfShader *shader, const char *name, sfTransform transform)
Change a matrix parameter of a shader.
sfShader_setIvec3Uniform
void sfShader_setIvec3Uniform(sfShader *shader, const char *name, sfGlslIvec3 vector)
Specify value for ivec3 uniform.
sfShader_setCurrentTextureParameter
void sfShader_setCurrentTextureParameter(sfShader *shader, const char *name)
Change a texture parameter of a shader.
sfShader_setIntColorUniform
void sfShader_setIntColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for ivec4 uniform.
sfShader_setFloat2Parameter
void sfShader_setFloat2Parameter(sfShader *shader, const char *name, float x, float y)
Change a 2-components vector parameter of a shader.
sfShader_setIntUniform
void sfShader_setIntUniform(sfShader *shader, const char *name, int x)
Specify value for int uniform.
sfShader_setFloat4Parameter
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_createFromMemory
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_setFloat3Parameter
void sfShader_setFloat3Parameter(sfShader *shader, const char *name, float x, float y, float z)
Change a 3-components vector parameter of a shader.
sfShader_setBoolUniform
void sfShader_setBoolUniform(sfShader *shader, const char *name, sfBool x)
Specify value for bool uniform.
sfShader_setColorUniform
void sfShader_setColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for vec4 uniform.
sfShader_setColorParameter
void sfShader_setColorParameter(sfShader *shader, const char *name, sfColor color)
Change a color parameter of a shader.
Transform.h
Vector2.h
Vector3.h
sfColor
Utility class for manpulating RGBA colors.
Definition Color.h:39
sfGlslBvec2
Definition Glsl.h:41
sfGlslBvec3
Definition Glsl.h:57
sfGlslBvec4
Definition Glsl.h:81
sfGlslIvec3
Definition Glsl.h:50
sfGlslIvec4
Definition Glsl.h:73
sfGlslMat3
Definition Glsl.h:90
sfGlslMat4
Definition Glsl.h:95
sfGlslVec4
Definition Glsl.h:65
sfInputStream
Set of callbacks that allow users to define custom file streams.
Definition InputStream.h:45
sfTransform
Encapsulate a 3x3 transform matrix.
Definition Transform.h:43
sfVector2f
2-component vector of floats
Definition Vector2.h:61
sfVector2i
2-component vector of integers
Definition Vector2.h:39
sfVector3f
3-component vector of floats
Definition Vector3.h:39