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 00028 class PandaNode; 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : CullTraverserData 00032 // Description : This collects together the pieces of data that are 00033 // accumulated for each node while walking the scene 00034 // graph during the cull traversal. 00035 // 00036 // Having this as a separate object simplifies the 00037 // parameter list to CullTraverser::r_traverse(), as 00038 // well as to other functions like 00039 // PandaNode::cull_callback(). It also makes it easier 00040 // to add cull parameters, and provides a place to 00041 // abstract out some of the cull behavior (like 00042 // view-frustum culling). 00043 //////////////////////////////////////////////////////////////////// 00044 class EXPCL_PANDA_PGRAPH CullTraverserData { 00045 public: 00046 INLINE CullTraverserData(const NodePath &start, 00047 const TransformState *net_transform, 00048 const RenderState *state, 00049 GeometricBoundingVolume *view_frustum, 00050 Thread *current_thread); 00051 INLINE CullTraverserData(const CullTraverserData ©); 00052 INLINE void operator = (const CullTraverserData ©); 00053 INLINE CullTraverserData(const CullTraverserData &parent, 00054 PandaNode *child); 00055 INLINE ~CullTraverserData(); 00056 00057 PUBLISHED: 00058 INLINE PandaNode *node() const; 00059 00060 public: 00061 INLINE PandaNodePipelineReader *node_reader(); 00062 INLINE const PandaNodePipelineReader *node_reader() const; 00063 00064 PUBLISHED: 00065 CPT(TransformState) get_modelview_transform(const CullTraverser *trav) const; 00066 INLINE const TransformState *get_net_transform(const CullTraverser *trav) const; 00067 00068 INLINE bool is_in_view(const DrawMask &camera_mask); 00069 INLINE bool is_this_node_hidden(const CullTraverser *trav) const; 00070 00071 void apply_transform_and_state(CullTraverser *trav); 00072 void apply_transform_and_state(CullTraverser *trav, 00073 CPT(TransformState) node_transform, 00074 CPT(RenderState) node_state, 00075 CPT(RenderEffects) node_effects, 00076 const RenderAttrib *off_clip_planes); 00077 00078 public: 00079 WorkingNodePath _node_path; 00080 PandaNodePipelineReader _node_reader; 00081 CPT(TransformState) _net_transform; 00082 CPT(RenderState) _state; 00083 PT(GeometricBoundingVolume) _view_frustum; 00084 CPT(CullPlanes) _cull_planes; 00085 DrawMask _draw_mask; 00086 int _portal_depth; 00087 00088 private: 00089 bool is_in_view_impl(); 00090 00091 static CPT(RenderState) get_fake_view_frustum_cull_state(); 00092 }; 00093 00094 #include "cullTraverserData.I" 00095 00096 #endif