No edit summary |
(Added uniforms) |
||
Line 26: | Line 26: | ||
==== '''float displayWidth''' ==== |
==== '''float displayWidth''' ==== |
||
+ | |||
The width of the display. |
The width of the display. |
||
==== '''float displayHeight''' ==== |
==== '''float displayHeight''' ==== |
||
+ | |||
The height of the display. |
The height of the display. |
||
==== '''float aspectRatio''' ==== |
==== '''float aspectRatio''' ==== |
||
+ | |||
The aspect ratio of the display (displayWidth / displayHeight). |
The aspect ratio of the display (displayWidth / displayHeight). |
||
+ | |||
+ | ==== '''float near''' ==== |
||
+ | |||
+ | The near viewing plane. |
||
+ | |||
+ | ==== '''float far''' ==== |
||
+ | |||
+ | The far viewing plane. |
||
+ | |||
+ | ==== '''int fogMode''' ==== |
||
+ | |||
+ | The current fog mode. The possible values are as follows: |
||
+ | |||
+ | const int GL_LINEAR = 9729; |
||
+ | const int GL_EXP = 2048; |
||
=== Base Uniforms === |
=== Base Uniforms === |
||
==== '''sampler2D sampler0''' ==== |
==== '''sampler2D sampler0''' ==== |
||
+ | |||
The texture of the current element. |
The texture of the current element. |
||
Line 51: | Line 70: | ||
=== Final Uniforms === |
=== Final Uniforms === |
||
+ | |||
+ | ==== '''sampler2D sampler0''' ==== |
||
+ | |||
+ | The rendered scene. |
||
+ | |||
+ | ==== '''sampler2D sampler1''' ==== |
||
+ | |||
+ | The depth of the rendered scene, excluding the player's arm. |
||
+ | |||
+ | ==== '''sampler2D sampler2''' ==== |
||
+ | |||
+ | The depth of the player's arm. |
||
[[Category:Shaders]] |
[[Category:Shaders]] |
Revision as of 03:21, 4 February 2011
Shaders
The active shaders should be located in the contents/files/shaders folder. There are four shaders that can be used. The outputs of the base shaders are sent to the final shaders in the form of textures.
base.vsh
This shader is the basic vertex shader.
base.fsh
This shader is the basic fragment shader.
final.vsh
This shader is a vertex shader for a quad that will display the final scene.
final.fsh
This shader is a fragment shader for a quad that will display the final scene.
Uniforms
There are several uniforms available to the shaders.
Global Uniforms
float displayWidth
The width of the display.
float displayHeight
The height of the display.
float aspectRatio
The aspect ratio of the display (displayWidth / displayHeight).
float near
The near viewing plane.
float far
The far viewing plane.
int fogMode
The current fog mode. The possible values are as follows:
const int GL_LINEAR = 9729; const int GL_EXP = 2048;
Base Uniforms
sampler2D sampler0
The texture of the current element.
sampler2D sampler1
The normals and height-map for the current texture (loaded from XXXXX_nh.png). At the moment this is only accurate when renderType is equal to RENDER_TYPE_TERRAIN.
int renderType
The type of element being rendered. The possible values are as follows:
const int RENDER_TYPE_UNKNOWN = 0; const int RENDER_TYPE_TERRAIN = 1;
Final Uniforms
sampler2D sampler0
The rendered scene.
sampler2D sampler1
The depth of the rendered scene, excluding the player's arm.
sampler2D sampler2
The depth of the player's arm.