Dax's Wiki
(Added uniforms)
Line 51: Line 51:
 
const int GL_LINEAR = 9729;
 
const int GL_LINEAR = 9729;
 
const int GL_EXP = 2048;
 
const int GL_EXP = 2048;
  +
  +
==== '''float sunVector''' ====
  +
  +
The position of the sun in eye coordinates.
  +
  +
==== '''float moonVector''' ====
  +
  +
The position of the moon in eye coordinates.
  +
  +
==== '''int worldTime''' ====
  +
  +
The world time of day (ranges from 0 to 23999).
   
 
=== Base Uniforms ===
 
=== Base Uniforms ===

Revision as of 06:23, 8 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;

float sunVector

The position of the sun in eye coordinates.

float moonVector

The position of the moon in eye coordinates.

int worldTime

The world time of day (ranges from 0 to 23999).

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.