Panda3D
displayRegionCullCallbackData.cxx
1 // Filename: displayRegionCullCallbackData.cxx
2 // Created by: drose (14Mar09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "displayRegionCullCallbackData.h"
16 #include "cullHandler.h"
17 #include "sceneSetup.h"
18 #include "graphicsEngine.h"
19 
20 TypeHandle DisplayRegionCullCallbackData::_type_handle;
21 
22 
23 ////////////////////////////////////////////////////////////////////
24 // Function: DisplayRegionCullCallbackData::Constructor
25 // Access: Public
26 // Description:
27 ////////////////////////////////////////////////////////////////////
28 DisplayRegionCullCallbackData::
29 DisplayRegionCullCallbackData(CullHandler *cull_handler, SceneSetup *scene_setup) :
30  _cull_handler(cull_handler),
31  _scene_setup(scene_setup)
32 {
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function: DisplayRegionCullCallbackData::output
37 // Access: Published, Virtual
38 // Description:
39 ////////////////////////////////////////////////////////////////////
40 void DisplayRegionCullCallbackData::
41 output(ostream &out) const {
42  out << get_type() << "(" << (void *)_cull_handler << ", "
43  << (void *)_scene_setup << ")";
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: DisplayRegionCullCallbackData::upcall
48 // Access: Published, Virtual
49 // Description: You should make this call during the callback if you
50 // want to continue the normal rendering function that
51 // would have been done in the absence of a callback.
52 //
53 // Specifically, this method will perform the cull
54 // traversal for the DisplayRegion's scene graph, and
55 // add all renderable objects to its CullResult.
56 ////////////////////////////////////////////////////////////////////
58 upcall() {
59  Thread *current_thread = Thread::get_current_thread();
60  DisplayRegion *dr = _scene_setup->get_display_region();
62 
63  dr->do_cull(_cull_handler, _scene_setup, gsg, current_thread);
64 }
virtual void upcall()
You should make this call during the callback if you want to continue the normal rendering function t...
GraphicsOutput * get_window() const
Returns the GraphicsOutput that this DisplayRegion is ultimately associated with, or NULL if no windo...
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
Definition: thread.I:145
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
Definition: cullHandler.h:31
GraphicsStateGuardian * get_gsg() const
Returns the GSG that is associated with this window.
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates all the communication with a particular instance of a given rendering backend...
A rectangular subregion within a window for rendering into.
Definition: displayRegion.h:61
DisplayRegion * get_display_region() const
Returns the display region for the scene.
Definition: sceneSetup.I:50
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition: sceneSetup.h:35