Panda3D
 All Classes Functions Variables Enumerations
cullResult.h
1 // Filename: cullResult.h
2 // Created by: drose (27Feb02)
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 CULLRESULT_H
16 #define CULLRESULT_H
17 
18 #include "pandabase.h"
19 #include "cullBin.h"
20 #include "cullBinManager.h"
21 #include "renderState.h"
22 #include "cullableObject.h"
23 #include "geomMunger.h"
24 #include "referenceCount.h"
25 #include "pointerTo.h"
26 #include "pvector.h"
27 #include "pset.h"
28 #include "pmap.h"
29 
30 class CullTraverser;
32 class RenderState;
33 class SceneSetup;
34 class TransformState;
35 
36 ////////////////////////////////////////////////////////////////////
37 // Class : CullResult
38 // Description : This stores the result of a BinCullHandler traversal:
39 // an ordered collection of CullBins, each of which
40 // holds a number of Geoms and RenderStates to be
41 // rendered in some defined order.
42 //
43 // This is also used to keep the results of last frame's
44 // cull traversal around to make next frame's traversal
45 // of the same scene a little easier.
46 ////////////////////////////////////////////////////////////////////
47 class EXPCL_PANDA_PGRAPH CullResult : public ReferenceCount {
48 public:
50  const PStatCollector &draw_region_pcollector);
51  INLINE ~CullResult();
52 
53 PUBLISHED:
54  PT(CullResult) make_next() const;
55 
56  INLINE CullBin *get_bin(int bin_index);
57 
58  void add_object(CullableObject *object, const CullTraverser *traverser);
59  void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
60  void draw(Thread *current_thread);
61 
62  PT(PandaNode) make_result_graph();
63 
64 public:
65  static void bin_removed(int bin_index);
66 
67 private:
68  CullBin *make_new_bin(int bin_index);
69 
70  INLINE void check_flash_bin(CPT(RenderState) &state, CullBinManager *bin_manager, int bin_index);
71  INLINE void check_flash_transparency(CPT(RenderState) &state, const LColor &color);
72 
73 #ifndef NDEBUG
74  void apply_flash_color(CPT(RenderState) &state, const LColor &flash_color);
75 #endif
76 
77  static CPT(RenderState) get_alpha_state();
78  static CPT(RenderState) get_binary_state();
79  static CPT(RenderState) get_dual_transparent_state();
80  static CPT(RenderState) get_dual_opaque_state();
81  static CPT(RenderState) get_wireframe_overlay_state(const RenderModeAttrib *rmode);
82 
84  PStatCollector _draw_region_pcollector;
85 
87  Bins _bins;
88 
89 #ifndef NDEBUG
90  bool _show_transparency;
91 #endif
92 
93 public:
94  static TypeHandle get_class_type() {
95  return _type_handle;
96  }
97  static void init_type() {
98  ReferenceCount::init_type();
99  register_type(_type_handle, "CullResult",
100  ReferenceCount::get_class_type());
101  }
102 
103 private:
104  static TypeHandle _type_handle;
105 };
106 
107 #include "cullResult.I"
108 
109 #endif
110 
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
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 represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This stores the result of a BinCullHandler traversal: an ordered collection of CullBins, each of which holds a number of Geoms and RenderStates to be rendered in some defined order.
Definition: cullResult.h:47
A base class for all things that want to be reference-counted.
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
Specifies how polygons are to be drawn.
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
This is a global object that maintains the collection of named CullBins in the world.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48