Panda3D
 All Classes Functions Variables Enumerations
drawCullHandler.cxx
1 // Filename: drawCullHandler.cxx
2 // Created by: drose (25Feb02)
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 "drawCullHandler.h"
16 #include "cullableObject.h"
17 #include "geom.h"
18 #include "transformState.h"
19 #include "renderState.h"
20 #include "graphicsStateGuardianBase.h"
21 #include "config_pgraph.h"
22 #include "cullTraverser.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: DrawCullHandler::record_object
26 // Access: Public, Virtual
27 // Description: This callback function is intended to be overridden
28 // by a derived class. This is called as each Geom is
29 // discovered by the CullTraverser.
30 ////////////////////////////////////////////////////////////////////
32 record_object(CullableObject *object, const CullTraverser *traverser) {
33  // Munge vertices as needed for the GSG's requirements, and the
34  // object's current state.
35  bool force = !_gsg->get_effective_incomplete_render();
36  Thread *current_thread = traverser->get_current_thread();
37 
38  if (object->munge_geom(_gsg, _gsg->get_geom_munger(object->_state, current_thread), traverser, force)) {
39  // Now we can immediately draw the object.
40  draw(object, _gsg, force, current_thread);
41  }
42 
43  // Dispense with the object.
44  delete object;
45 }
static void draw(CullableObject *object, GraphicsStateGuardianBase *gsg, bool force, Thread *current_thread)
Draws the indicated CullableObject, with full support for decals if they are attached to the object...
Definition: cullHandler.I:24
The smallest atom of cull.
bool munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger, const CullTraverser *traverser, bool force)
Uses the indicated GeomMunger to transform the geom and/or its vertices.
Thread * get_current_thread() const
Returns the currently-executing thread object, as passed to the CullTraverser constructor.
Definition: cullTraverser.I:33
A thread; that is, a lightweight process.
Definition: thread.h:51
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.