From daed41f05ed68ff3b976602fa9aeace4c36b254a Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 15 Jul 2011 00:13:54 +0000 Subject: [PATCH] add rootCamera --- direct/src/showbase/MirrorDemo.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/direct/src/showbase/MirrorDemo.py b/direct/src/showbase/MirrorDemo.py index 8199c05177..ac49ee307a 100755 --- a/direct/src/showbase/MirrorDemo.py +++ b/direct/src/showbase/MirrorDemo.py @@ -26,10 +26,12 @@ reflections, you will need to use a sphere map or a cube map.""" from pandac.PandaModules import * from direct.task import Task -def setupMirror(name, width, height): +def setupMirror(name, width, height, rootCamera = None): # The return value is a NodePath that contains a rectangle that # reflects render. You can reparent, reposition, and rotate it # anywhere you like. + if rootCamera is None: + rootCamera = base.camera root = render.attachNewNode(name) @@ -81,9 +83,9 @@ def setupMirror(name, width, height): # mirror. def moveCamera(task, cameraNP = cameraNP, plane = plane, planeNP = planeNP, card = card, lens = lens, - width = width, height = height): + width = width, height = height, rootCamera = rootCamera): # Set the camera to the mirror-image position of the main camera. - cameraNP.setMat(base.camera.getMat(planeNP) * plane.getReflectionMat()) + cameraNP.setMat(rootCamera.getMat(planeNP) * plane.getReflectionMat()) # And reset the frustum to exactly frame the mirror's corners. # This is a minor detail, but it helps to provide a realistic