Panda3D
|
00001 // Filename: cullTraverserData.h 00002 // Created by: drose (06Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef CULLTRAVERSERDATA_H 00016 #define CULLTRAVERSERDATA_H 00017 00018 #include "pandabase.h" 00019 #include "cullPlanes.h" 00020 #include "workingNodePath.h" 00021 #include "renderState.h" 00022 #include "transformState.h" 00023 #include "geometricBoundingVolume.h" 00024 #include "pointerTo.h" 00025 #include "drawMask.h" 00026 #include "cullTraverser.h" 00027 #include "pvector.h" 00028 00029 class PandaNode; 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Class : CullTraverserData 00033 // Description : This collects together the pieces of data that are 00034 // accumulated for each node while walking the scene 00035 // graph during the cull traversal. 00036 // 00037 // Having this as a separate object simplifies the 00038 // parameter list to CullTraverser::r_traverse(), as 00039 // well as to other functions like 00040 // PandaNode::cull_callback(). It also makes it easier 00041 // to add cull parameters, and provides a place to 00042 // abstract out some of the cull behavior (like 00043 // view-frustum culling). 00044 //////////////////////////////////////////////////////////////////// 00045 class EXPCL_PANDA_PGRAPH CullTraverserData { 00046 public: 00047 INLINE CullTraverserData(const NodePath &start, 00048 const TransformState *net_transform, 00049 const RenderState *state, 00050 GeometricBoundingVolume *view_frustum, 00051 Thread *current_thread); 00052 INLINE CullTraverserData(const CullTraverserData ©); 00053 INLINE void operator = (const CullTraverserData ©); 00054 INLINE CullTraverserData(const CullTraverserData &parent, 00055 PandaNode *child); 00056 INLINE ~CullTraverserData(); 00057 00058 PUBLISHED: 00059 INLINE PandaNode *node() const; 00060 00061 public: 00062 INLINE PandaNodePipelineReader *node_reader(); 00063 INLINE const PandaNodePipelineReader *node_reader() const; 00064 00065 PUBLISHED: 00066 CPT(TransformState) get_modelview_transform(const CullTraverser *trav) const; 00067 INLINE const TransformState *get_net_transform(const CullTraverser *trav) const; 00068 00069 INLINE bool is_in_view(const DrawMask &camera_mask); 00070 INLINE bool is_this_node_hidden(const CullTraverser *trav) const; 00071 00072 void apply_transform_and_state(CullTraverser *trav); 00073 void apply_transform_and_state(CullTraverser *trav, 00074 CPT(TransformState) node_transform, 00075 CPT(RenderState) node_state, 00076 CPT(RenderEffects) node_effects, 00077 const RenderAttrib *off_clip_planes); 00078 00079 public: 00080 WorkingNodePath _node_path; 00081 PandaNodePipelineReader _node_reader; 00082 CPT(TransformState) _net_transform; 00083 CPT(RenderState) _state; 00084 PT(GeometricBoundingVolume) _view_frustum; 00085 CPT(CullPlanes) _cull_planes; 00086 DrawMask _draw_mask; 00087 int _portal_depth; 00088 00089 private: 00090 bool is_in_view_impl(); 00091 static CPT(RenderState) get_fake_view_frustum_cull_state(); 00092 }; 00093 00094 #include "cullTraverserData.I" 00095 00096 #endif