Shader

Shader class (vertex and fragment).

class Shader {
sfShader* sfPtr;
}

Constructors

this
this()

Default constructor.

Destructor

~this
~this()

Destructor.

Members

Enums

Type
enum Type

Types of shaders.

Functions

loadFromFile
bool loadFromFile(const(char)[] filename, Type type)

Load either the vertex or fragment shader from a file.

loadFromFile
bool loadFromFile(const(char)[] vertexShaderFilename, const(char)[] fragmentShaderFilename)

Load both the vertex and fragment shaders from files.

loadFromMemory
bool loadFromMemory(const(char)[] shader, Type type)

Load either the vertex or fragment shader from a source code in memory.

loadFromMemory
bool loadFromMemory(const(char)[] vertexShader, const(char)[] fragmentShader)

Load both the vertex and fragment shaders from source codes in memory.

loadFromStream
bool loadFromStream(InputStream stream, Type type)

Load either the vertex or fragment shader from a custom stream.

loadFromStream
bool loadFromStream(InputStream vertexShaderStream, InputStream fragmentShaderStream)

Load both the vertex and fragment shaders from custom streams.

opIndexAssign
void opIndexAssign(float x, const(char)[] name)

Specify value for float uniform.

opIndexAssign
void opIndexAssign(ref const(Vec2) vector, const(char)[] name)

Specify value for vec2 uniform.

opIndexAssign
void opIndexAssign(ref const(Vec3) vector, const(char)[] name)

Specify value for vec3 uniform.

opIndexAssign
void opIndexAssign(ref const(Vec4) vector, const(char)[] name)

Specify value for vec4 uniform.

opIndexAssign
void opIndexAssign(int x, const(char)[] name)

Specify value for int uniform.

opIndexAssign
void opIndexAssign(ref const(Ivec2) vector, const(char)[] name)

Specify value for ivec2 uniform.

opIndexAssign
void opIndexAssign(ref const(Ivec3) vector, const(char)[] name)

Specify value for ivec3 uniform.

opIndexAssign
void opIndexAssign(ref const(Ivec4) vector, const(char)[] name)

Specify value for ivec4 uniform.

opIndexAssign
void opIndexAssign(bool x, const(char)[] name)

Specify value for bool uniform.

opIndexAssign
void opIndexAssign(ref const(Bvec2) vector, const(char)[] name)

Specify value for bvec2 uniform.

opIndexAssign
void opIndexAssign(ref const(Bvec3) vector, const(char)[] name)

Specify value for bvec3 uniform.

opIndexAssign
void opIndexAssign(ref const(Bvec4) vector, const(char)[] name)

Specify value for bvec4 uniform.

opIndexAssign
void opIndexAssign(ref const(Mat3) matrix, const(char)[] name)

Specify value for mat3 matrix.

opIndexAssign
void opIndexAssign(ref const(Mat4) matrix, const(char)[] name)

Specify value for mat4 matrix.

opIndexAssign
void opIndexAssign(const(Texture) texture, const(char)[] name)

Specify a texture as sampler2D uniform.

opIndexAssign
void opIndexAssign(CurrentTextureType, const(char)[] name)

Specify current texture as sampler2D uniform.

opIndexAssign
void opIndexAssign(const(float)[] scalars, const(char)[] name)

Specify values for float[] array uniform.

opIndexAssign
void opIndexAssign(const(Vec2)[] vectors, const(char)[] name)

Specify values for vec2[] array uniform.

opIndexAssign
void opIndexAssign(const(Vec3)[] vectors, const(char)[] name)

Specify values for vec3[] array uniform.

opIndexAssign
void opIndexAssign(const(Vec4)[] vectors, const(char)[] name)

Specify values for vec4[] array uniform.

opIndexAssign
void opIndexAssign(const(Mat3)[] matrices, const(char)[] name)

Specify values for mat3[] array uniform.

opIndexAssign
void opIndexAssign(const(Mat4)[] matrices, const(char)[] name)

Specify values for mat4[] array uniform.

opIndexAssign
void opIndexAssign(Color color, const(char)[] name)

Change a color vector parameter of the shader.

opIndexAssign
void opIndexAssign(Transform transform, const(char)[] name)

Change a matrix parameter of the shader.

setParameter
void setParameter(const(char)[] name, float x)

Change a float parameter of the shader.

setParameter
void setParameter(const(char)[] name, float x, float y)

Change a 2-components vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, float x, float y, float z)

Change a 3-components vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, float x, float y, float z, float w)

Change a 4-components vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, Vector2f vector)

Change a 2-components vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, Vector3f vector)

Change a 3-components vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, Color color)

Change a color vector parameter of the shader.

setParameter
void setParameter(const(char)[] name, Transform transform)

Change a matrix parameter of the shader.

setParameter
void setParameter(const(char)[] name, const(Texture) texture)

Change a texture parameter of the shader.

setParameter
void setParameter(const(char)[] name, CurrentTextureType)

Change a texture parameter of the shader.

setUniform
void setUniform(const(char)[] name, float x)

Specify value for float uniform.

setUniform
void setUniform(const(char)[] name, ref const(Vec2) vector)

Specify value for vec2 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Vec3) vector)

Specify value for vec3 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Vec4) vector)

Specify value for vec4 uniform.

setUniform
void setUniform(const(char)[] name, int x)

Specify value for int uniform.

setUniform
void setUniform(const(char)[] name, ref const(Ivec2) vector)

Specify value for ivec2 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Ivec3) vector)

Specify value for ivec3 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Ivec4) vector)

Specify value for ivec4 uniform.

setUniform
void setUniform(const(char)[] name, bool x)

Specify value for bool uniform.

setUniform
void setUniform(const(char)[] name, ref const(Bvec2) vector)

Specify value for bvec2 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Bvec3) vector)

Specify value for bvec3 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Bvec4) vector)

Specify value for bvec4 uniform.

setUniform
void setUniform(const(char)[] name, ref const(Mat3) matrix)

Specify value for mat3 matrix.

setUniform
void setUniform(const(char)[] name, ref const(Mat4) matrix)

Specify value for mat4 matrix.

setUniform
void setUniform(const(char)[] name, const(Texture) texture)

Specify a texture as sampler2D uniform.

setUniform
void setUniform(const(char)[] name, CurrentTextureType)

Specify current texture as sampler2D uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(float)[] scalarArray)

Specify values for float[] array uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(Vec2)[] vectorArray)

Specify values for vec2[] array uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(Vec3)[] vectorArray)

Specify values for vec3[] array uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(Vec4)[] vectorArray)

Specify values for vec4[] array uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(Mat3)[] matrixArray)

Specify values for mat3[] array uniform.

setUniformArray
void setUniformArray(const(char)[] name, const(Mat4)[] matrixArray)

Specify values for mat4[] array uniform.

Static functions

bind
void bind(Shader shader)

Bind a shader for rendering.

isAvailable
bool isAvailable()

Tell whether or not the system supports shaders.

Static variables

CurrentTexture
CurrentTextureType CurrentTexture;

Special type/value that can be passed to setParameter, and that represents the texture of the object being drawn.

Structs

CurrentTextureType
struct CurrentTextureType

Special type/value that can be passed to setParameter, and that represents the texture of the object being drawn.

Meta