Panda3D
|
00001 // Filename: displayRegionCullCallbackData.cxx 00002 // Created by: drose (14Mar09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "displayRegionCullCallbackData.h" 00016 #include "cullHandler.h" 00017 #include "sceneSetup.h" 00018 #include "graphicsEngine.h" 00019 00020 TypeHandle DisplayRegionCullCallbackData::_type_handle; 00021 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Function: DisplayRegionCullCallbackData::Constructor 00025 // Access: Public 00026 // Description: 00027 //////////////////////////////////////////////////////////////////// 00028 DisplayRegionCullCallbackData:: 00029 DisplayRegionCullCallbackData(CullHandler *cull_handler, SceneSetup *scene_setup) : 00030 _cull_handler(cull_handler), 00031 _scene_setup(scene_setup) 00032 { 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: DisplayRegionCullCallbackData::output 00037 // Access: Published, Virtual 00038 // Description: 00039 //////////////////////////////////////////////////////////////////// 00040 void DisplayRegionCullCallbackData:: 00041 output(ostream &out) const { 00042 out << get_type() << "(" << (void *)_cull_handler << ", " 00043 << (void *)_scene_setup << ")"; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: DisplayRegionCullCallbackData::upcall 00048 // Access: Published, Virtual 00049 // Description: You should make this call during the callback if you 00050 // want to continue the normal rendering function that 00051 // would have been done in the absence of a callback. 00052 // 00053 // Specifically, this method will perform the cull 00054 // traversal for the DisplayRegion's scene graph, and 00055 // add all renderable objects to its CullResult. 00056 //////////////////////////////////////////////////////////////////// 00057 void DisplayRegionCullCallbackData:: 00058 upcall() { 00059 Thread *current_thread = Thread::get_current_thread(); 00060 DisplayRegion *dr = _scene_setup->get_display_region(); 00061 GraphicsStateGuardian *gsg = dr->get_window()->get_gsg(); 00062 00063 dr->do_cull(_cull_handler, _scene_setup, gsg, current_thread); 00064 }