Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Class representing a shader written in GLSL. Warning: Visual Studio encoding must be set to Western European (Windows) Codepage 1252 when editing shaders! More details here: http://blog.pixelingene.com/2008/07/file-encodings-matter-when-writing-pixel-shaders/ More...
Public Member Functions | |
Shader (string vertexFile, string fragmentFile) | |
Creates a Shader using a file as the source for the vertex and fragment shader. More... | |
Shader (Stream vertexStream, Stream fragmentStream) | |
Create a Shader using a stream as the source of the vertex and fragment shader. More... | |
Shader (ShaderType shaderType, Stream source) | |
Create a shader using a stream as the source and a ShaderType parameter. More... | |
Shader (string source) | |
Creates a Shader using a file path source, and auto detects which type of shader it is. If the file path contains ".frag" or ".fs" it is assumed to be a fragment shader. More... | |
Shader (Shader copy) | |
Creates a shader using a copy of another shader. More... | |
Shader (ShaderType shaderType, string source) | |
Creates a shader using a file path and a ShaderType parameter. More... | |
void | SetParameter (string name, Color color) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Color color) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, float x) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, float x) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, float x, float y) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, float x, float y) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, Vector2 xy) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Vector2 xy) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, Vector3 xyz) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Vector3 xyz) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, Vector4 xyzw) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Vector4 xyzw) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, float x, float y, float z) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, float x, float y, float z) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, float x, float y, float z, float w) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, float x, float y, float z, float w) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, Texture texture) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Texture texture) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, string textureSource) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, string textureSource) |
Set a parameter on the shader. More... | |
void | SetParameter (string name, Matrix matrix) |
Set a parameter on the shader. More... | |
void | SetParameter (Enum name, Matrix matrix) |
Set a parameter on the shader. More... | |
Static Public Member Functions | |
static SFML.Graphics.Shader | FromString (string vertexShader, string fragmentShader) |
Load both the vertex and fragment shaders from source codes in memory More... | |
static Shader | FromString (ShaderType shaderType, string shader) |
Creates a Shader using source code in memory More... | |
static void | AddParameter (Enum name, string nameInShader) |
Store a shader parameter name by an Enum value. After storing a parameter this way you can use SetParameter on shader instances with the Enum value and it will retrieve the parameter name string. More... | |
static string | Parameter (Enum name) |
Get the parameter string stored with the Enum key. More... | |
Class representing a shader written in GLSL. Warning: Visual Studio encoding must be set to Western European (Windows) Codepage 1252 when editing shaders! More details here: http://blog.pixelingene.com/2008/07/file-encodings-matter-when-writing-pixel-shaders/
Otter.Shader.Shader | ( | string | vertexFile, |
string | fragmentFile | ||
) |
Creates a Shader using a file as the source for the vertex and fragment shader.
vertexFile | The file path to the vertex shader. |
fragmentFile | The file path to the fragment shader. |
Otter.Shader.Shader | ( | Stream | vertexStream, |
Stream | fragmentStream | ||
) |
Create a Shader using a stream as the source of the vertex and fragment shader.
vertexStream | The stream for the vertex shader. |
fragmentStream | The stream for the fragment shader. |
Otter.Shader.Shader | ( | ShaderType | shaderType, |
Stream | source | ||
) |
Create a shader using a stream as the source and a ShaderType parameter.
shaderType | The shader type (fragment or vertex) |
source | The stream for the shader. |
Otter.Shader.Shader | ( | string | source | ) |
Creates a Shader using a file path source, and auto detects which type of shader it is. If the file path contains ".frag" or ".fs" it is assumed to be a fragment shader.
source | The file path. |
Otter.Shader.Shader | ( | Shader | copy | ) |
Creates a shader using a copy of another shader.
copy | The shader to copy. |
Otter.Shader.Shader | ( | ShaderType | shaderType, |
string | source | ||
) |
Creates a shader using a file path and a ShaderType parameter.
shaderType | The shader type (fragment or vertex) |
source | The file path. |
|
static |
Store a shader parameter name by an Enum value. After storing a parameter this way you can use SetParameter on shader instances with the Enum value and it will retrieve the parameter name string.
If your shader has a parameter named "overlayColor" you can do this: Shader.SetParameter(ShaderParams.OverlayColor, "overlayColor"); And then on a shader instance you can do this: someImageWithAShader.Shader.SetParameter(ShaderParams.OverlayColor, Color.Red);
name | The Enum value to use as the key for the shader parameter name. |
nameInShader | The name of the parameter in the shader code. |
|
static |
Load both the vertex and fragment shaders from source codes in memory
This function can load both the vertex and the fragment shaders, or only one of them: pass NULL if you don't want to load either the vertex shader or the fragment shader. The sources must be valid shaders in GLSL language. GLSL is a C-like language dedicated to OpenGL shaders; you'll probably need to read a good documentation for it before writing your own shaders.
vertexShader | String containing the source code of the vertex shader |
fragmentShader | String containing the source code of the fragment shader |
|
static |
|
static |
Get the parameter string stored with the Enum key.
name | The Enum name that is the key for the string parameter. |
void Otter.Shader.SetParameter | ( | string | name, |
Color | color | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
color | The color to set it to. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Color | color | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
color | The color to set it to. |
void Otter.Shader.SetParameter | ( | string | name, |
float | x | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The value to set it to. |
void Otter.Shader.SetParameter | ( | Enum | name, |
float | x | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The value to set it to. |
void Otter.Shader.SetParameter | ( | string | name, |
float | x, | ||
float | y | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec2. |
y | The first value of a vec2. |
void Otter.Shader.SetParameter | ( | Enum | name, |
float | x, | ||
float | y | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec2. |
y | The first value of a vec2. |
void Otter.Shader.SetParameter | ( | string | name, |
Vector2 | xy | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xy | A Vector2 to set. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Vector2 | xy | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xy | A Vector2 to set. |
void Otter.Shader.SetParameter | ( | string | name, |
Vector3 | xyz | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xyz | A Vector3 to set. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Vector3 | xyz | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xyz | A Vector3 to set. |
void Otter.Shader.SetParameter | ( | string | name, |
Vector4 | xyzw | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xyzw | A Vector4 to set. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Vector4 | xyzw | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
xyzw | A Vector4 to set. |
void Otter.Shader.SetParameter | ( | string | name, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec3. |
y | The second value of a vec3. |
z | The third value of a vec3. |
void Otter.Shader.SetParameter | ( | Enum | name, |
float | x, | ||
float | y, | ||
float | z | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec3. |
y | The second value of a vec3. |
z | The third value of a vec3. |
void Otter.Shader.SetParameter | ( | string | name, |
float | x, | ||
float | y, | ||
float | z, | ||
float | w | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec4. |
y | The second value of a vec4. |
z | The third value of a vec4. |
w | The fourth value of a vec4. |
void Otter.Shader.SetParameter | ( | Enum | name, |
float | x, | ||
float | y, | ||
float | z, | ||
float | w | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
x | The first value of a vec4. |
y | The second value of a vec4. |
z | The third value of a vec4. |
w | The fourth value of a vec4. |
void Otter.Shader.SetParameter | ( | string | name, |
Texture | texture | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
texture | The texture to set it to. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Texture | texture | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
texture | The texture to set it to. |
void Otter.Shader.SetParameter | ( | string | name, |
string | textureSource | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
textureSource | The path to an image to load as a texture. |
void Otter.Shader.SetParameter | ( | Enum | name, |
string | textureSource | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
textureSource | The path to an image to load as a texture. |
void Otter.Shader.SetParameter | ( | string | name, |
Matrix | matrix | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
matrix | The matrix to use. SFML internally uses 3x3 matrices, but you need to use a mat4 in the shader. |
void Otter.Shader.SetParameter | ( | Enum | name, |
Matrix | matrix | ||
) |
Set a parameter on the shader.
name | The parameter in the shader to set. |
matrix | The matrix to use. SFML internally uses 3x3 matrices, but you need to use a mat4 in the shader. |