Panda3D
 All Classes Functions Variables Enumerations
cullTraverserData.h
1 // Filename: cullTraverserData.h
2 // Created by: drose (06Mar02)
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 CULLTRAVERSERDATA_H
16 #define CULLTRAVERSERDATA_H
17 
18 #include "pandabase.h"
19 #include "cullPlanes.h"
20 #include "workingNodePath.h"
21 #include "renderState.h"
22 #include "transformState.h"
23 #include "geometricBoundingVolume.h"
24 #include "pointerTo.h"
25 #include "drawMask.h"
26 #include "pvector.h"
27 
28 class PandaNode;
29 class CullTraverser;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : CullTraverserData
33 // Description : This collects together the pieces of data that are
34 // accumulated for each node while walking the scene
35 // graph during the cull traversal.
36 //
37 // Having this as a separate object simplifies the
38 // parameter list to CullTraverser::r_traverse(), as
39 // well as to other functions like
40 // PandaNode::cull_callback(). It also makes it easier
41 // to add cull parameters, and provides a place to
42 // abstract out some of the cull behavior (like
43 // view-frustum culling).
44 ////////////////////////////////////////////////////////////////////
45 class EXPCL_PANDA_PGRAPH CullTraverserData {
46 public:
47  INLINE CullTraverserData(const NodePath &start,
48  const TransformState *net_transform,
49  const RenderState *state,
50  GeometricBoundingVolume *view_frustum,
51  Thread *current_thread);
52  INLINE CullTraverserData(const CullTraverserData &copy);
53  INLINE void operator = (const CullTraverserData &copy);
54  INLINE CullTraverserData(const CullTraverserData &parent,
55  PandaNode *child);
56  INLINE ~CullTraverserData();
57 
58 PUBLISHED:
59  INLINE PandaNode *node() const;
60 
61 public:
62  INLINE PandaNodePipelineReader *node_reader();
63  INLINE const PandaNodePipelineReader *node_reader() const;
64 
65 PUBLISHED:
66  INLINE CPT(TransformState) get_modelview_transform(const CullTraverser *trav) const;
67  INLINE CPT(TransformState) get_internal_transform(const CullTraverser *trav) const;
68  INLINE const TransformState *get_net_transform(const CullTraverser *trav) const;
69 
70  INLINE bool is_in_view(const DrawMask &camera_mask);
71  INLINE bool is_this_node_hidden(const DrawMask &camera_mask) const;
72 
73  void apply_transform_and_state(CullTraverser *trav);
74  void apply_transform_and_state(CullTraverser *trav,
75  CPT(TransformState) node_transform,
76  CPT(RenderState) node_state,
77  CPT(RenderEffects) node_effects,
78  const RenderAttrib *off_clip_planes);
79 
80 public:
81  WorkingNodePath _node_path;
82  PandaNodePipelineReader _node_reader;
83  CPT(TransformState) _net_transform;
84  CPT(RenderState) _state;
85  PT(GeometricBoundingVolume) _view_frustum;
86  CPT(CullPlanes) _cull_planes;
87  DrawMask _draw_mask;
88  int _portal_depth;
89 
90 private:
91  bool is_in_view_impl();
92  static CPT(RenderState) get_fake_view_frustum_cull_state();
93 };
94 
95 /* okcircular */
96 #include "cullTraverser.h"
97 
98 #include "cullTraverserData.I"
99 
100 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This is the base class for a number of render attributes (other than transform) that may be set on sc...
Definition: renderAttrib.h:60
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This is a class designed to support low-overhead traversals of the complete scene graph...
This represents the set of clip planes and/or occluders that are definitely in effect for the current...
Definition: cullPlanes.h:46
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:53
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates the data from a PandaNode, pre-fetched for one stage of the pipeline.
Definition: pandaNode.h:815
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
Definition: renderEffects.h:46
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
Definition: cullTraverser.h:48