CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 3.0.0

- Main Page
- 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#pragma once
26
28// Headers
30#include <CSFML/Graphics/Export.h>
31
32#include <CSFML/Graphics/Color.h>
33#include <CSFML/Graphics/Glsl.h>
34#include <CSFML/Graphics/Transform.h>
35#include <CSFML/Graphics/Types.h>
36#include <CSFML/System/InputStream.h>
37#include <CSFML/System/Vector2.h>
38#include <CSFML/System/Vector3.h>
39
40#include <stddef.h>
41
42
61 CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename,
62 const char* geometryShaderFilename,
63 const char* fragmentShaderFilename);
64
83 CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader,
84 const char* geometryShader,
85 const char* fragmentShader);
86
105 CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream,
106 sfInputStream* geometryShaderStream,
107 sfInputStream* fragmentShaderStream);
108
115 CSFML_GRAPHICS_API void sfShader_destroy(const sfShader* shader);
116
125 CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x);
126
135 CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector);
136
145 CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector);
146
158 CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector);
159
168 CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color);
169
178 CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x);
179
188 CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector);
189
198 CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector);
199
211 CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector);
212
221 CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color);
222
231 CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, bool x);
232
241 CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector);
242
251 CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector);
252
264 CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector);
265
274 CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix);
275
284 CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix);
285
317 CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture);
318
340 CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name);
341
351 CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length);
352
362 CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length);
363
373 CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length);
374
384 CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length);
385
395 CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length);
396
406 CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length);
407
420 CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader);
421
443 CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
444
455 CSFML_GRAPHICS_API bool sfShader_isAvailable(void);
456
474 CSFML_GRAPHICS_API bool sfShader_isGeometryAvailable(void);
Color.h
Glsl.h
sfGlslIvec2
sfVector2i sfGlslIvec2
Definition Glsl.h:37
sfGlslVec2
sfVector2f sfGlslVec2
Definition Glsl.h:36
sfGlslVec3
sfVector3f sfGlslVec3
Definition Glsl.h:46
Export.h
CSFML_GRAPHICS_API
#define CSFML_GRAPHICS_API
Definition Graphics/Export.h:42
Types.h
sfShader
struct sfShader sfShader
Definition Graphics/Types.h:32
sfTexture
struct sfTexture sfTexture
Definition Graphics/Types.h:39
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_setIvec2Uniform
void sfShader_setIvec2Uniform(sfShader *shader, const char *name, sfGlslIvec2 vector)
Specify value for ivec2 uniform.
sfShader_setVec4UniformArray
void sfShader_setVec4UniformArray(sfShader *shader, const char *name, const sfGlslVec4 *vectorArray, size_t length)
Specify values for vec4[] array uniform.
sfShader_destroy
void sfShader_destroy(const sfShader *shader)
Destroy an existing 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_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_setVec2UniformArray
void sfShader_setVec2UniformArray(sfShader *shader, const char *name, const sfGlslVec2 *vectorArray, size_t length)
Specify values for vec2[] array uniform.
sfShader_setBoolUniform
void sfShader_setBoolUniform(sfShader *shader, const char *name, bool x)
Specify value for bool uniform.
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_setIvec3Uniform
void sfShader_setIvec3Uniform(sfShader *shader, const char *name, sfGlslIvec3 vector)
Specify value for ivec3 uniform.
sfShader_setIntColorUniform
void sfShader_setIntColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for ivec4 uniform.
sfShader_isAvailable
bool sfShader_isAvailable(void)
Tell whether or not the system supports shaders.
sfShader_setIntUniform
void sfShader_setIntUniform(sfShader *shader, const char *name, int x)
Specify value for int uniform.
sfShader_isGeometryAvailable
bool sfShader_isGeometryAvailable(void)
Tell whether or not the system supports geometry shaders.
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_setColorUniform
void sfShader_setColorUniform(sfShader *shader, const char *name, sfColor color)
Specify value for vec4 uniform.
Transform.h
Vector2.h
Vector3.h
sfColor
Utility class for manpulating RGBA colors.
Definition Color.h:38
sfGlslBvec2
Definition Glsl.h:40
sfGlslBvec3
Definition Glsl.h:56
sfGlslBvec4
Definition Glsl.h:80
sfGlslIvec3
Definition Glsl.h:49
sfGlslIvec4
Definition Glsl.h:72
sfGlslMat3
Definition Glsl.h:89
sfGlslMat4
Definition Glsl.h:94
sfGlslVec4
Definition Glsl.h:64
sfInputStream
Set of callbacks that allow users to define custom file streams.
Definition InputStream.h:46