00001 // Filename: cullTraverserData.h 00002 // Created by: drose (06Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef CULLTRAVERSERDATA_H 00020 #define CULLTRAVERSERDATA_H 00021 00022 #include "pandabase.h" 00023 00024 #include "workingNodePath.h" 00025 #include "renderState.h" 00026 #include "transformState.h" 00027 #include "geometricBoundingVolume.h" 00028 #include "pointerTo.h" 00029 #include "drawMask.h" 00030 00031 class PandaNode; 00032 class CullTraverser; 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : CullTraverserData 00036 // Description : This collects together the pieces of data that are 00037 // accumulated for each node while walking the scene 00038 // graph during the cull traversal. 00039 // 00040 // Having this as a separate object simplifies the 00041 // parameter list to CullTraverser::r_traverse(), as 00042 // well as to other functions like 00043 // PandaNode::cull_callback(). It also makes it easier 00044 // to add cull parameters, and provides a place to 00045 // abstract out some of the cull behavior (like 00046 // view-frustum culling). 00047 //////////////////////////////////////////////////////////////////// 00048 class EXPCL_PANDA CullTraverserData { 00049 public: 00050 INLINE CullTraverserData(const NodePath &start, 00051 const TransformState *render_transform, 00052 const TransformState *net_transform, 00053 const RenderState *state, 00054 GeometricBoundingVolume *view_frustum, 00055 GeometricBoundingVolume *guard_band); 00056 INLINE CullTraverserData(const CullTraverserData ©); 00057 INLINE void operator = (const CullTraverserData ©); 00058 INLINE CullTraverserData(const CullTraverserData &parent, 00059 PandaNode *child); 00060 INLINE ~CullTraverserData(); 00061 00062 INLINE PandaNode *node() const; 00063 00064 INLINE bool is_in_view(const DrawMask &camera_mask); 00065 INLINE void apply_transform_and_state(CullTraverser *trav); 00066 void apply_transform_and_state(CullTraverser *trav, 00067 CPT(TransformState) node_transform, 00068 CPT(RenderState) node_state, 00069 CPT(RenderEffects) node_effects); 00070 00071 WorkingNodePath _node_path; 00072 CPT(TransformState) _render_transform; 00073 CPT(TransformState) _net_transform; 00074 CPT(RenderState) _state; 00075 PT(GeometricBoundingVolume) _view_frustum; 00076 PT(GeometricBoundingVolume) _guard_band; 00077 00078 private: 00079 bool is_in_view_impl(); 00080 static CPT(RenderState) get_fake_view_frustum_cull_state(); 00081 }; 00082 00083 #include "cullTraverserData.I" 00084 00085 #endif