Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/pgraph/cullTraverser.h

Go to the documentation of this file.
00001 // Filename: cullTraverser.h
00002 // Created by:  drose (23Feb02)
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 CULLTRAVERSER_H
00020 #define CULLTRAVERSER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "geom.h"
00025 #include "sceneSetup.h"
00026 #include "renderState.h"
00027 #include "transformState.h"
00028 #include "geometricBoundingVolume.h"
00029 #include "pointerTo.h"
00030 #include "drawMask.h"
00031 #include "typedObject.h"
00032 
00033 class PandaNode;
00034 class CullHandler;
00035 class CullTraverserData;
00036 class CullableObject;
00037 class NodePath;
00038 
00039 ////////////////////////////////////////////////////////////////////
00040 //       Class : CullTraverser
00041 // Description : This object performs a depth-first traversal of the
00042 //               scene graph, with optional view-frustum culling,
00043 //               collecting CullState and searching for GeomNodes.
00044 //               Each renderable Geom encountered is passed along with
00045 //               its associated RenderState to the CullHandler object.
00046 ////////////////////////////////////////////////////////////////////
00047 class EXPCL_PANDA CullTraverser : public TypedObject {
00048 public:
00049   CullTraverser();
00050   CullTraverser(const CullTraverser &copy);
00051 
00052   INLINE void set_scene(SceneSetup *scene_setup);
00053   INLINE SceneSetup *get_scene() const;
00054 
00055   INLINE void set_camera_mask(const DrawMask &camera_mask);
00056   INLINE const DrawMask &get_camera_mask() const;
00057 
00058   INLINE const TransformState *get_camera_transform() const;
00059   INLINE const TransformState *get_render_transform() const;
00060 
00061   INLINE void set_initial_state(const RenderState *initial_state);
00062   INLINE const RenderState *get_initial_state() const;
00063 
00064   INLINE void set_depth_offset_decals(bool flag);
00065   INLINE bool get_depth_offset_decals() const;
00066 
00067   INLINE void set_view_frustum(GeometricBoundingVolume *view_frustum);
00068   INLINE GeometricBoundingVolume *get_view_frustum() const;
00069 
00070   INLINE void set_guard_band(GeometricBoundingVolume *guard_band);
00071   INLINE GeometricBoundingVolume *get_guard_band() const;
00072 
00073   INLINE void set_cull_handler(CullHandler *cull_handler);
00074   INLINE CullHandler *get_cull_handler() const;
00075 
00076   void traverse(const NodePath &root);
00077   void traverse(CullTraverserData &data);
00078   void traverse_below(CullTraverserData &data);
00079 
00080 private:
00081   void show_bounds(CullTraverserData &data);
00082   PT(Geom) make_bounds_viz(const BoundingVolume &vol);
00083   CPT(RenderState) get_bounds_outer_viz_state();
00084   CPT(RenderState) get_bounds_inner_viz_state();
00085   CPT(RenderState) get_depth_offset_state();
00086   void start_decal(const CullTraverserData &data);
00087   CullableObject *r_get_decals(CullTraverserData &data,
00088                                CullableObject *decals);
00089 
00090   PT(SceneSetup) _scene_setup;
00091   DrawMask _camera_mask;
00092   CPT(RenderState) _initial_state;
00093   bool _depth_offset_decals;
00094   PT(GeometricBoundingVolume) _view_frustum;
00095   PT(GeometricBoundingVolume) _guard_band;
00096   CullHandler *_cull_handler;
00097   
00098 public:
00099   static TypeHandle get_class_type() {
00100     return _type_handle;
00101   }
00102   static void init_type() {
00103     TypedObject::init_type();
00104     register_type(_type_handle, "CullTraverser",
00105                   TypedObject::get_class_type());
00106   }
00107   virtual TypeHandle get_type() const {
00108     return get_class_type();
00109   }
00110   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00111 
00112 private:
00113   static TypeHandle _type_handle;
00114 };
00115 
00116 #include "cullTraverser.I"
00117 
00118 #endif
00119 
00120 
00121   

Generated on Fri May 2 00:41:30 2003 for Panda by doxygen1.3