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-01-04 17:43:57 +11:00
2015-03-23 21:43:42 +01:00
2014-05-04 15:39:15 -07:00
2014-05-07 20:32:50 -07:00
2015-01-21 11:57:11 +11:00
2015-02-02 14:26:05 +01:00
2013-08-18 14:15:51 +00:00
2015-02-21 12:16:20 +00:00
2014-03-19 23:57:49 -07:00
2014-10-07 15:47:32 -05:00
2013-05-28 01:15:59 +00:00
2015-03-16 16:18:37 +01:00
2012-10-09 13:36:42 +00:00
2014-10-07 15:47:32 -05:00
2013-03-18 11:44:56 +00:00
2012-10-09 13:36:42 +00:00
2014-10-07 15:47:32 -05:00
2013-11-04 19:21:32 +00:00
2015-04-10 20:20:52 +02:00
2015-04-10 20:20:52 +02:00
2013-03-23 03:04:02 +00:00
2012-10-09 13:36:42 +00:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2013-01-30 05:55:17 +00:00
2012-10-09 13:36:42 +00:00
2014-04-30 18:53:32 -07:00
2012-10-09 13:36:42 +00:00
2014-07-17 22:52:23 -07:00
2014-07-17 22:52:23 -07:00
2015-01-07 20:38:05 -08:00
2014-10-07 15:47:32 -05:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2015-03-15 10:50:59 +01:00
2015-03-16 18:46:40 +01:00
2011-10-23 17:52:20 +00:00
2012-07-18 23:03:27 +00:00
2015-04-19 20:33:08 +02:00
2015-04-19 01:04:22 +02:00
2012-09-16 04:58:18 +00:00
2013-11-04 19:22:47 +00:00
2012-10-09 13:36:42 +00:00
2012-10-22 08:15:51 +00:00
2012-10-09 13:36:42 +00:00
2015-03-23 21:43:42 +01:00
2015-03-23 21:43:42 +01:00
2012-10-29 02:11:40 +00:00
2012-09-16 04:58:18 +00:00
2015-02-21 12:16:20 +00:00
2012-06-25 09:14:37 +00:00
2015-04-21 17:41:23 -03:00
2015-03-23 22:49:38 +01:00
2015-04-17 18:12:51 +02:00
2015-04-17 18:12:51 +02:00
2014-03-27 22:32:06 -07:00
2014-04-12 20:12:07 +02:00
2013-07-02 09:47:22 +00:00
2012-10-09 13:36:42 +00:00
2014-04-23 19:39:57 -07:00
2013-03-29 06:21:28 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2015-03-13 00:50:25 +01: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
2014-08-10 00:40:15 +02:00
2012-10-09 13:36:42 +00:00
2014-02-22 13:57:12 +11:00
2012-10-09 13:36:42 +00:00
2013-02-23 01:17:01 +00:00
2012-10-09 13:36:42 +00:00
2015-04-05 10:13:04 +02:00
2013-01-30 05:55:17 +00:00
2013-08-04 17:20:03 +00:00
2012-09-16 04:58:18 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2012-09-16 04:58:18 +00:00
2012-10-09 13:36:42 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:10 +00:00
2013-08-03 23:58:17 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2015-04-16 01:12:22 +10:00
2015-02-03 15:32:54 +00:00
2015-01-04 17:43:57 +11:00
2012-10-09 13:36:42 +00:00
2015-04-08 06:28:05 +10:00
2015-02-03 15:32:55 +00:00
2015-03-24 00:23:40 +01:00
2015-02-09 20:56:38 +00:00
2012-10-23 11:47:23 +00:00
2013-11-18 18:13:23 +06:00
2013-11-17 15:09:57 +11:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2012-10-09 13:36:42 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2011-10-23 17:52:20 +00:00
2012-10-09 13:36:42 +00:00
2014-04-30 18:53:32 -07:00
2014-06-17 22:13:44 +10:00
2013-11-04 19:22:47 +00:00
2012-10-21 05:46:41 +00:00
2013-11-04 19:22:47 +00:00
2013-11-04 19:22:47 +00:00
2012-11-10 05:42:50 +00:00
2012-08-18 13:07:48 +00:00
2012-09-16 04:58:18 +00:00
2012-10-09 13:36:42 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2012-02-25 16:49:59 +00:00
2012-06-25 09:14:37 +00:00
2015-04-21 17:41:23 -03:00
2015-04-21 17:41:23 -03:00
2013-03-26 07:29:01 +00:00
2012-10-09 13:36:42 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2012-09-16 04:58:18 +00:00
2013-11-24 15:23:38 +11:00
2012-11-05 14:24:35 +00:00
2011-10-23 17:52:20 +00:00
2012-02-23 10:41:31 +00:00
2015-03-21 17:54:49 +01:00
2015-02-18 23:24:02 +01:00
2012-04-11 08:15:13 +00:00
2012-10-15 02:15:07 +00:00
2012-04-11 08:15:13 +00:00
2012-10-15 02:15:07 +00:00
2015-02-08 15:52:13 +01:00
2015-02-08 15:52:13 +01:00
2014-04-30 18:53:32 -07:00
2014-01-24 02:10:45 -02:00
2014-07-14 18:30:27 -07:00
2014-07-14 18:30:27 -07:00
2015-03-30 22:47:46 +02:00
2013-02-21 18:30:11 +00:00
2013-04-10 22:49:50 +00:00
2012-12-18 20:56:25 +00:00
2011-10-23 17:52:20 +00:00
2012-02-23 10:41:31 +00:00
2015-03-24 00:27:45 +01:00
2015-03-24 00:27:45 +01:00
2015-03-23 21:43:42 +01:00
2015-03-23 21:43:42 +01:00
2014-10-07 15:47:32 -05:00