Blender Git Loki

Git Commits -> Revision c0bf881

Revision c0bf881 by Benoit Bolsee (master)
June 11, 2016, 20:24 (GMT)
BL_Shader.setUniformEyef(name)

defines a uniform that reflects the eye being rendered in stereo mode:
0.0 for the left eye, 0.5 for the right eye.
In non stereo mode, the value of the uniform is fixed to 0.0.
The typical use of this uniform is in stereo mode to sample stereo textures
containing the left and right eye images in a top-bottom order.

python:
shader = obj.meshes[0].materials[mat].getShader()
shader.setUniformEyef("eye")

shader:
uniform float eye;
uniform sampler2D tex;
void main(void)
{
vec4 color;
float ty, tx;
tx = gl_TexCoord[0].x;
ty = eye+gl_TexCoord[0].y*0.5;
// ty will be between 0 and 0.5 for the left eye render
// and 0.5 and 1.0 for the right eye render.
color = texture(tex, vec2(tx, ty));
...
}

Commit Details:

Full Hash: c0bf881ebfa93784946ee3d03ccf15122c1b74c3
Parent Commit: fa9bb2f
Lines Changed: +112, -58

3 Modified Paths:

/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst (+10, -0) (Diff)
/source/gameengine/Ketsji/BL_Shader.cpp (+99, -57) (Diff)
/source/gameengine/Ketsji/BL_Shader.h (+3, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021