From c0bf881ebfa93784946ee3d03ccf15122c1b74c3 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Fri, 10 Jun 2016 00:28:19 +0200 Subject: 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)); ... } --- doc/python_api/rst/bge_types/bge.types.BL_Shader.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc') diff --git a/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst index f4f5c0d62ba..a389f68ee04 100644 --- a/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst +++ b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst @@ -214,6 +214,16 @@ base class --- :class:`PyObjectPlus` :arg iList: a list (2, 3 or 4 elements) of integer values :type iList: list[integer] + .. method:: setUniformEyef(name) + + Set a uniform with a float value that reflects the eye being render 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. + + :arg name: the uniform name + :type name: string + .. method:: validate() Validate the shader object. -- cgit v1.2.3