Panda3D
cullBinFixed.h
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 cullBinFixed.h
10  * @author drose
11  * @date 2002-05-29
12  */
13 
14 #ifndef CULLBINFIXED_H
15 #define CULLBINFIXED_H
16 
17 #include "pandabase.h"
18 
19 #include "cullBin.h"
20 #include "geom.h"
21 #include "transformState.h"
22 #include "renderState.h"
23 #include "pointerTo.h"
24 
25 /**
26  * A specific kind of CullBin that sorts geometry in the order specified by
27  * the user-specified draw_order parameter. This allows precise relative
28  * ordering of two objects.
29  *
30  * When two or more objects are assigned the same draw_order, they are drawn
31  * in scene-graph order (as with CullBinUnsorted).
32  */
33 class EXPCL_PANDA_CULL CullBinFixed : public CullBin {
34 public:
35  INLINE CullBinFixed(const std::string &name,
37  const PStatCollector &draw_region_pcollector);
38  virtual ~CullBinFixed();
39 
40  static CullBin *make_bin(const std::string &name,
42  const PStatCollector &draw_region_pcollector);
43 
44  virtual void add_object(CullableObject *object, Thread *current_thread);
45  virtual void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
46  virtual void draw(bool force, Thread *current_thread);
47 
48 protected:
49  virtual void fill_result_graph(ResultGraphBuilder &builder);
50 
51 private:
52  class ObjectData {
53  public:
54  INLINE ObjectData(CullableObject *object, int draw_order);
55  INLINE bool operator < (const ObjectData &other) const;
56 
57  CullableObject *_object;
58  int _draw_order;
59  };
60 
62  Objects _objects;
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  CullBin::init_type();
70  register_type(_type_handle, "CullBinFixed",
71  CullBin::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #include "cullBinFixed.I"
83 
84 #endif
pvector< ObjectData >
CullableObject
The smallest atom of cull.
Definition: cullableObject.h:41
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
CullBinFixed
A specific kind of CullBin that sorts geometry in the order specified by the user-specified draw_orde...
Definition: cullBinFixed.h:33
renderState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
SceneSetup
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition: sceneSetup.h:32
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
transformState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PStatCollector
A lightweight class that represents a single element that may be timed and/or counted via stats.
Definition: pStatCollector.h:43
cullBinFixed.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
geom.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CullBin
A collection of Geoms and their associated state, for a particular scene.
Definition: cullBin.h:40
cullBin.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
GraphicsStateGuardianBase
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
Definition: graphicsStateGuardianBase.h:110
Thread
A thread; that is, a lightweight process.
Definition: thread.h:46
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.