Browse Source

default-stereo-camera

David Rose 20 years ago
parent
commit
37b172d3d3

+ 6 - 4
direct/src/showbase/ShowBase.py

@@ -371,8 +371,8 @@ class ShowBase(DirectObject.DirectObject):
                         pipeType.getName()))
                         pipeType.getName()))
 
 
     def openWindow(self, props = None, pipe = None, gsg = None,
     def openWindow(self, props = None, pipe = None, gsg = None,
-                   type = None, name = None, scene = None,
-                   size = None, aspectRatio = None):
+                   type = None, name = None, size = None, aspectRatio = None,
+                   makeCamera = 1, scene = None, stereo = None):
         """
         """
         Creates a window and adds it to the list of windows that are
         Creates a window and adds it to the list of windows that are
         to be updated every frame.
         to be updated every frame.
@@ -433,7 +433,9 @@ class ShowBase(DirectObject.DirectObject):
         self.winList.append(win)
         self.winList.append(win)
 
 
         # Set up a 3-d camera for the window by default.
         # Set up a 3-d camera for the window by default.
-        self.makeCamera(win, scene = scene, aspectRatio = aspectRatio)
+        if makeCamera:
+            self.makeCamera(win, scene = scene, aspectRatio = aspectRatio,
+                            stereo = stereo)
 
 
         return win
         return win
 
 
@@ -803,7 +805,7 @@ class ShowBase(DirectObject.DirectObject):
         dr.setCamera(cam)
         dr.setCamera(cam)
 
 
         if stereo == None:
         if stereo == None:
-            stereo = win.isStereo()
+            stereo = (win.isStereo() and self.config.GetBool('default-stereo-camera', 1))
         if stereo:
         if stereo:
             # A stereo camera!  The first DisplayRegion becomes the
             # A stereo camera!  The first DisplayRegion becomes the
             # left channel.
             # left channel.

+ 2 - 0
panda/src/framework/config_framework.cxx

@@ -34,6 +34,8 @@ ConfigVariableDouble aspect_ratio
 ("aspect-ratio", 0.0);
 ("aspect-ratio", 0.0);
 ConfigVariableBool show_frame_rate_meter
 ConfigVariableBool show_frame_rate_meter
 ("show-frame-rate-meter", false);
 ("show-frame-rate-meter", false);
+ConfigVariableBool default_stereo_camera
+("default-stereo-camera", true);
 
 
 ConfigVariableString record_session
 ConfigVariableString record_session
 ("record-session", "");
 ("record-session", "");

+ 1 - 0
panda/src/framework/config_framework.h

@@ -31,6 +31,7 @@ NotifyCategoryDecl(framework, EXPCL_FRAMEWORK, EXPTP_FRAMEWORK);
 // Configure variables for framework package.
 // Configure variables for framework package.
 extern ConfigVariableDouble aspect_ratio;
 extern ConfigVariableDouble aspect_ratio;
 extern ConfigVariableBool show_frame_rate_meter;
 extern ConfigVariableBool show_frame_rate_meter;
+extern ConfigVariableBool default_stereo_camera;
 
 
 extern ConfigVariableString record_session;
 extern ConfigVariableString record_session;
 extern ConfigVariableString playback_session;
 extern ConfigVariableString playback_session;

+ 1 - 1
panda/src/framework/windowFramework.cxx

@@ -186,7 +186,7 @@ open_window(const WindowProperties &props, GraphicsEngine *engine,
     NodePath camera_np = make_camera();
     NodePath camera_np = make_camera();
     _display_region_3d->set_camera(camera_np);
     _display_region_3d->set_camera(camera_np);
 
 
-    if (_window->is_stereo()) {
+    if (_window->is_stereo() && default_stereo_camera) {
       // Actually, let's make a stereo camera.  That means the
       // Actually, let's make a stereo camera.  That means the
       // _display_region_3d will be the left channel, and we need to
       // _display_region_3d will be the left channel, and we need to
       // make another one to be the right channel.
       // make another one to be the right channel.