Panda3D
cullTraverserData.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 cullTraverserData.h
10  * @author drose
11  * @date 2002-03-06
12  */
13 
14 #ifndef CULLTRAVERSERDATA_H
15 #define CULLTRAVERSERDATA_H
16 
17 #include "pandabase.h"
18 #include "cullPlanes.h"
19 #include "workingNodePath.h"
20 #include "renderState.h"
21 #include "transformState.h"
23 #include "pointerTo.h"
24 #include "drawMask.h"
25 #include "pvector.h"
26 
27 class PandaNode;
28 class CullTraverser;
29 
30 /**
31  * This collects together the pieces of data that are accumulated for each
32  * node while walking the scene graph during the cull traversal.
33  *
34  * Having this as a separate object simplifies the parameter list to
35  * CullTraverser::r_traverse(), as well as to other functions like
36  * PandaNode::cull_callback(). It also makes it easier to add cull
37  * parameters, and provides a place to abstract out some of the cull behavior
38  * (like view-frustum culling).
39  */
40 class EXPCL_PANDA_PGRAPH CullTraverserData {
41 public:
42  INLINE CullTraverserData(const NodePath &start,
43  const TransformState *net_transform,
44  const RenderState *state,
45  GeometricBoundingVolume *view_frustum,
46  Thread *current_thread);
47  INLINE CullTraverserData(const CullTraverserData &parent,
48  PandaNode *child);
49 
50 PUBLISHED:
51  INLINE PandaNode *node() const;
52 
53 public:
54  INLINE PandaNodePipelineReader *node_reader();
55  INLINE const PandaNodePipelineReader *node_reader() const;
56 
57  INLINE NodePath get_node_path() const;
58 
59 PUBLISHED:
60  INLINE CPT(TransformState) get_modelview_transform(const CullTraverser *trav) const;
61  INLINE CPT(TransformState) get_internal_transform(const CullTraverser *trav) const;
62  INLINE const TransformState *get_net_transform(const CullTraverser *trav) const;
63 
64  INLINE bool is_in_view(const DrawMask &camera_mask);
65  INLINE bool is_this_node_hidden(const DrawMask &camera_mask) const;
66 
67  void apply_transform_and_state(CullTraverser *trav);
68  void apply_transform(const TransformState *node_transform);
69 
70  MAKE_PROPERTY(node_path, get_node_path);
71 
72 private:
73  // We store a chain leading all the way to the root, so that we can compose
74  // a NodePath. We may be able to eliminate this requirement in the future.
75  const CullTraverserData *_next;
76  NodePathComponent *_start;
77 
78 public:
79  PandaNodePipelineReader _node_reader;
80  CPT(TransformState) _net_transform;
81  CPT(RenderState) _state;
82  PT(GeometricBoundingVolume) _view_frustum;
83  CPT(CullPlanes) _cull_planes;
84  DrawMask _draw_mask;
85  int _portal_depth;
86 
87 private:
88  PT(NodePathComponent) r_get_node_path() const;
89 
90  bool is_in_view_impl();
91  static const RenderState *get_fake_view_frustum_cull_state();
92 };
93 
94 /* okcircular */
95 #include "cullTraverser.h"
96 
97 #include "cullTraverserData.I"
98 
99 #endif
This represents the set of clip planes and/or occluders that are definitely in effect for the current...
Definition: cullPlanes.h:42
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
Definition: cullTraverser.h:45
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
This is one component of a NodePath.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
Encapsulates the data from a PandaNode, pre-fetched for one stage of the pipeline.
Definition: pandaNode.h:840
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition: renderState.h:47
A thread; that is, a lightweight process.
Definition: thread.h:46
Indicates a coordinate-system transform on vertices.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.