瀏覽代碼

use implicit scene in camera

David Rose 21 年之前
父節點
當前提交
7e526eae81
共有 3 個文件被更改,包括 10 次插入4 次删除
  1. 4 2
      panda/src/display/graphicsEngine.cxx
  2. 0 2
      panda/src/framework/windowFramework.cxx
  3. 6 0
      panda/src/pgraph/camera.I

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

@@ -1018,8 +1018,10 @@ setup_scene(GraphicsStateGuardian *gsg, DisplayRegion *dr) {
 
 
   NodePath scene_root = camera_node->get_scene();
   NodePath scene_root = camera_node->get_scene();
   if (scene_root.is_empty()) {
   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;
   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);
     lens->set_near_far(-1000, 1000);
 
 
     camera->set_lens(lens);
     camera->set_lens(lens);
-    camera->set_scene(_render_2d);
     _display_region_2d->set_camera(camera_np);
     _display_region_2d->set_camera(camera_np);
   }
   }
 
 
@@ -938,7 +937,6 @@ make_camera() {
   }
   }
 
 
   camera->set_lens(lens);
   camera->set_lens(lens);
-  camera->set_scene(get_render());
   _display_region_3d->set_camera(camera_np);
   _display_region_3d->set_camera(camera_np);
 
 
   return camera;
   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,
 //               This is normally the root node of a scene graph,
 //               typically a node called 'render', although it could
 //               typically a node called 'render', although it could
 //               represent the root of any subgraph.
 //               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::
 INLINE void Camera::
 set_scene(const NodePath &scene) {
 set_scene(const NodePath &scene) {