Skip to content

Instantly share code, notes, and snippets.

Created August 27, 2013 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6353417 to your computer and use it in GitHub Desktop.
Save anonymous/6353417 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h2>Uniforms</h2>
jME automatically defines and transmits the following uniforms for use in
shaders.<br>
Current versions of GLSL predefine equivalent uniforms, but these should not
be used since they are deprecated in GLSL 3.0, and are scheduled for
elimination in GLSL 4.0.
<table border="1" cellpadding="4" style="border-collapse: collapse">
<tr>
<th>Type</th>
<th>Uniform</th>
<th>GLSL equivalent</th>
<th>Value</th>
</tr>
<tr>
<td>mat4</td>
<td>g_WorldMatrix</td>
<td>gl_WorldMatrix</td>
<td>Converts Model space to World space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ViewMatrix</td>
<td>?</td>
<td>Converts World space to View space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ProjectionMatrix</td>
<td>?</td>
<td>Converts View space to Clip/Projection space.</td>
</tr><tr>
<td>mat4</td>
<td>g_WorldViewMatrix</td>
<td>?</td>
<td>Converts Model space to View space.</td>
</tr><tr>
<td>mat3</td>
<td>g_NormalMatrix</td>
<td>?</td>
<td>The inverse transpose of the worldview matrix. Converts normals from model space to view space.</td>
</tr><tr>
<td>mat4</td>
<td>g_WorldViewProjectionMatrix</td>
<td>?</td>
<td>Converts Model space to Clip/Projection space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ViewProjectionMatrix</td>
<td>?</td>
<td>Converts World space to Clip/Projection space.</td>
</tr><tr>
<td>mat3</td>
<td>g_WorldMatrixInverseTranspose</td>
<td>?</td>
<td>Converts a normals from Model space to world space.</td>
</tr><tr>
<td>mat4</td>
<td>g_WorldMatrixInverse</td>
<td>?</td>
<td>Converts World space to Model space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ViewMatrixInverse</td>
<td>?</td>
<td>Converts View space to World space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ProjectionMatrixInverse</td>
<td>?</td>
<td>Converts Clip/Projection space to View space.</td>
</tr><tr>
<td>mat4</td>
<td>g_ViewProjectionMatrixInverse</td>
<td>?</td>
<td>Converts Clip/Projection space to World space.</td>
</tr><tr>
<td>mat4</td>
<td>g_WorldViewMatrixInverse</td>
<td>?</td>
<td>Converts View space to Model space.</td>
</tr><tr>
<td>mat3</td>
<td>g_NormalMatrixInverse</td>
<td>?</td>
<td>Converts normals from view space to model space.</td>
</tr><tr>
<td>mat4</td>
<td>g_WorldViewProjectionMatrixInverse</td>
<td>?</td>
<td>Converts Clip/Projection space to Model space</td>
</tr><tr>
<td>vec4</td>
<td>g_ViewPort</td>
<td>?</td>
<td>Contains the four viewport parameters in this order: X = Left, Y = Top, Z = Right, W = Bottom.</td>
</tr><tr>
<td>vec2</td>
<td>g_FrustumNearFar</td>
<td>?</td>
<td>The near and far values for the camera frustum. X = Near, Y = Far.</td>
</tr><tr>
<td>vec2</td>
<td>g_Resolution</td>
<td>?</td>
<td>The width and height of the camera.</td>
</tr><tr>
<td>vec2</td>
<td>g_ResolutionInverse</td>
<td>?</td>
<td>The inverse of the resolution, 1/width and 1/height.</td>
</tr><tr>
<td>float</td>
<td>g_Aspect</td>
<td>?</td>
<td>Aspect ratio of the resolution currently set. Width/Height.</td>
</tr><tr>
<td>vec3</td>
<td>g_CameraPosition</td>
<td>?</td>
<td>Camera position in world space.</td>
</tr><tr>
<td>vec3</td>
<td>g_CameraDirection</td>
<td>?</td>
<td>Direction of the camera.</td>
</tr><tr>
<td>vec3</td>
<td>g_CameraLeft</td>
<td>?</td>
<td>Left vector of the camera.</td>
</tr><tr>
<td>vec3</td>
<td>g_CameraUp</td>
<td>?</td>
<td>Up vector of the camera.</td>
</tr><tr>
<td>float</td>
<td>g_Time</td>
<td>?</td>
<td>Time in seconds since the application was started.</td>
</tr><tr>
<td>float</td>
<td>g_Tpf</td>
<td>?</td>
<td>Time in seconds that the last frame took.</td>
</tr><tr>
<td>float</td>
<td>g_FrameRate</td>
<td>(no equivalent)</td>
<td>Frames per second.</td>
</tr>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment