Files
blender/source/gameengine/Ketsji
Dalai Felinto 9425a8ff38 BGE: scene.pre_draw_setup[] callback
This callback allows the user to change the camera data right before the
rendering calculations.

scene.pre_draw[] is not enough here, because if you want to change the
camera matrices (projection/modelview) the culling test is done before
that (after pre_draw_setup[] though).

Reviewers: moguri, campbellbarton

Differential Revision: https://developer.blender.org/D1251

Python sample code using this. The sample scene would need a default
camera (not used for rendering), a dummy camera ('Camera.VR'), and two
cameras ('Camera.Left', 'Camera.Right') that will be used for the actual
rendering.

```
import bge

def callback():
    scene = bge.logic.getCurrentScene()
    objects = scene.objects

    vr_camera = objects.get('Camera.VR')

    if bge.render.getStereoEye() ==  bge.render.LEFT_EYE:
        camera = objects.get('Camera.Left')
    else:
        camera = objects.get('Camera.Right')

    vr_camera.worldOrientation = camera.worldOrientation
    vr_camera.worldPosition =  camera.worldPosition

def init():
    scene = bge.logic.getCurrentScene()
    main_camera = scene.active_camera
    main_camera.useViewport = True

   scene.pre_draw_setup.append(callback)

    objects = scene.objects
    vr_camera = objects.get('Camera.VR')
    vr_camera.useViewport = True
    vr_camera.setViewport(
            0,
            0,
            bge.render.getWindowWidth(),
            bge.render.getWindowHeight() )
```
2015-04-21 17:41:23 -03:00
..
2015-03-23 21:43:42 +01:00
2015-01-21 11:57:11 +11:00
2014-10-07 15:47:32 -05:00
2014-10-07 15:47:32 -05:00
2013-03-18 11:44:56 +00:00
2014-10-07 15:47:32 -05:00
2014-10-07 15:47:32 -05:00
2012-10-22 08:15:51 +00:00
2015-03-23 21:43:42 +01:00
2012-10-29 02:11:40 +00:00
2015-04-17 18:12:51 +02:00
2015-04-17 18:12:51 +02:00
2013-03-29 06:21:28 +00:00
2014-06-25 15:47:37 -07:00
2014-11-21 14:16:35 +01:00
2014-07-21 10:53:07 +10:00
2013-03-26 07:29:01 +00:00
2012-11-05 14:24:35 +00:00
2014-10-07 15:47:32 -05:00