Panda3D
drawCullHandler.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file drawCullHandler.cxx
10  * @author drose
11  * @date 2002-02-25
12  */
13 
14 #include "drawCullHandler.h"
15 #include "cullableObject.h"
16 #include "geom.h"
17 #include "transformState.h"
18 #include "renderState.h"
20 #include "config_pgraph.h"
21 #include "cullTraverser.h"
22 
23 /**
24  * This callback function is intended to be overridden by a derived class.
25  * This is called as each Geom is discovered by the CullTraverser.
26  */
28 record_object(CullableObject *object, const CullTraverser *traverser) {
29  // Munge vertices as needed for the GSG's requirements, and the object's
30  // current state.
31  bool force = !_gsg->get_effective_incomplete_render();
32  Thread *current_thread = traverser->get_current_thread();
33 
34  if (object->munge_geom(_gsg, _gsg->get_geom_munger(object->_state, current_thread), traverser, force)) {
35  // Now we can immediately draw the object.
36  draw(object, _gsg, force, current_thread);
37  }
38 
39  // Dispense with the object.
40  delete object;
41 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Thread * get_current_thread() const
Returns the currently-executing thread object, as passed to the CullTraverser constructor.
Definition: cullTraverser.I:27
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:20
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A thread; that is, a lightweight process.
Definition: thread.h:46
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition: cullTraverser.h:45
virtual void record_object(CullableObject *object, const CullTraverser *traverser)
This callback function is intended to be overridden by a derived class.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.