Panda3D
 All Classes Functions Variables Enumerations
cullBinFrontToBack.h
1 // Filename: cullBinFrontToBack.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 CULLBINFRONTTOBACK_H
16 #define CULLBINFRONTTOBACK_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 : CullBinFrontToBack
28 // Description : A specific kind of CullBin that sorts geometry in
29 // order from nearest to furthest based on the center of
30 // its bounding volume.
31 //
32 // This is useful for rendering opaque geometry, taking
33 // optimal advantage of a hierarchical Z-buffer.
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDA_CULL CullBinFrontToBack : public CullBin {
36 public:
37  INLINE CullBinFrontToBack(const string &name,
39  const PStatCollector &draw_region_pcollector);
40  virtual ~CullBinFrontToBack();
41 
42  static CullBin *make_bin(const string &name,
44  const PStatCollector &draw_region_pcollector);
45 
46  virtual void add_object(CullableObject *object, Thread *current_thread);
47  virtual void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
48  virtual void draw(bool force, Thread *current_thread);
49 
50 protected:
51  virtual void fill_result_graph(ResultGraphBuilder &builder);
52 
53 private:
54  class ObjectData {
55  public:
56  INLINE ObjectData(CullableObject *object, PN_stdfloat dist);
57  INLINE bool operator < (const ObjectData &other) const;
58 
59  CullableObject *_object;
60  PN_stdfloat _dist;
61  };
62 
64  Objects _objects;
65 
66 public:
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  CullBin::init_type();
72  register_type(_type_handle, "CullBinFrontToBack",
73  CullBin::get_class_type());
74  }
75  virtual TypeHandle get_type() const {
76  return get_class_type();
77  }
78  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
79 
80 private:
81  static TypeHandle _type_handle;
82 };
83 
84 #include "cullBinFrontToBack.I"
85 
86 #endif
87 
88 
89 
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...
A specific kind of CullBin that sorts geometry in order from nearest to furthest based on the center ...
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