Parcourir la source

use implicit scene in camera

David Rose il y a 21 ans
Parent
commit
7e526eae81

+ 4 - 2
panda/src/display/graphicsEngine.cxx

@@ -1018,8 +1018,10 @@ setup_scene(GraphicsStateGuardian *gsg, DisplayRegion *dr) {
 
   NodePath scene_root = camera_node->get_scene();
   if (scene_root.is_empty()) {
-    // No scene, no draw.
-    return NULL;
+    // If there's no explicit scene specified, use whatever scene the
+    // camera is parented within.  This is the normal and preferred
+    // case; the use of an explicit scene is now deprecated.
+    scene_root = camera.get_top();
   }
 
   PT(SceneSetup) scene_setup = new SceneSetup;

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

@@ -285,7 +285,6 @@ get_render_2d() {
     lens->set_near_far(-1000, 1000);
 
     camera->set_lens(lens);
-    camera->set_scene(_render_2d);
     _display_region_2d->set_camera(camera_np);
   }
 
@@ -938,7 +937,6 @@ make_camera() {
   }
 
   camera->set_lens(lens);
-  camera->set_scene(get_render());
   _display_region_3d->set_camera(camera_np);
 
   return camera;

+ 6 - 0
panda/src/pgraph/camera.I

@@ -46,6 +46,12 @@ is_active() const {
 //               This is normally the root node of a scene graph,
 //               typically a node called 'render', although it could
 //               represent the root of any subgraph.
+//
+//               Note that the use of this method is now deprecated.
+//               In the absence of an explicit scene set on the
+//               camera, the camera will render whatever scene it is
+//               parented into.  This is the preferred way to specify
+//               the scene, since it is the more intuitive mechanism.
 ////////////////////////////////////////////////////////////////////
 INLINE void Camera::
 set_scene(const NodePath &scene) {