Panda3D
cullBinFixed.h
1 // Filename: cullBinFixed.h
2 // Created by: drose (29May02)
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 #ifndef CULLBINFIXED_H
16 #define CULLBINFIXED_H
17 
18 #include "pandabase.h"
19 
20 #include "cullBin.h"
21 #include "geom.h"
22 #include "transformState.h"
23 #include "renderState.h"
24 #include "pointerTo.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : CullBinFixed
28 // Description : A specific kind of CullBin that sorts geometry in
29 // the order specified by the user-specified draw_order
30 // parameter. This allows precise relative ordering of
31 // two objects.
32 //
33 // When two or more objects are assigned the same
34 // draw_order, they are drawn in scene-graph order (as
35 // with CullBinUnsorted).
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDA_CULL CullBinFixed : public CullBin {
38 public:
39  INLINE CullBinFixed(const string &name,
41  const PStatCollector &draw_region_pcollector);
42  virtual ~CullBinFixed();
43 
44  static CullBin *make_bin(const string &name,
46  const PStatCollector &draw_region_pcollector);
47 
48  virtual void add_object(CullableObject *object, Thread *current_thread);
49  virtual void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
50  virtual void draw(bool force, Thread *current_thread);
51 
52 protected:
53  virtual void fill_result_graph(ResultGraphBuilder &builder);
54 
55 private:
56  class ObjectData {
57  public:
58  INLINE ObjectData(CullableObject *object, int draw_order);
59  INLINE bool operator < (const ObjectData &other) const;
60 
61  CullableObject *_object;
62  int _draw_order;
63  };
64 
66  Objects _objects;
67 
68 public:
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  CullBin::init_type();
74  register_type(_type_handle, "CullBinFixed",
75  CullBin::get_class_type());
76  }
77  virtual TypeHandle get_type() const {
78  return get_class_type();
79  }
80  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
81 
82 private:
83  static TypeHandle _type_handle;
84 };
85 
86 #include "cullBinFixed.I"
87 
88 #endif
89 
90 
91 
A specific kind of CullBin that sorts geometry in the order specified by the user-specified draw_orde...
Definition: cullBinFixed.h:37
A collection of Geoms and their associated state, for a particular scene.
Definition: cullBin.h:44
A lightweight class that represents a single element that may be timed and/or counted via stats...
The smallest atom of cull.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
Definition: thread.h:51
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