From 7e526eae818b3a1c94a1301617edbac98e40757f Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 13 Jan 2005 14:24:02 +0000 Subject: [PATCH] use implicit scene in camera --- panda/src/display/graphicsEngine.cxx | 6 ++++-- panda/src/framework/windowFramework.cxx | 2 -- panda/src/pgraph/camera.I | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index cbcfd695ce..0f089c9071 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/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; diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index a4d1d97664..b7c8149eec 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/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; diff --git a/panda/src/pgraph/camera.I b/panda/src/pgraph/camera.I index 7ddf39b70d..1a131b7dd6 100644 --- a/panda/src/pgraph/camera.I +++ b/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) {