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

panda/src/pgraph/cullBinFrontToBack.h

Go to the documentation of this file.
00001 // Filename: cullBinFrontToBack.h
00002 // Created by:  drose (29May02)
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 CULLBINFRONTTOBACK_H
00020 #define CULLBINFRONTTOBACK_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "cullBin.h"
00025 #include "geom.h"
00026 #include "transformState.h"
00027 #include "renderState.h"
00028 #include "pointerTo.h"
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //       Class : CullBinFrontToBack
00032 // Description : A specific kind of CullBin that sorts geometry in
00033 //               order from nearest to furthest based on the center of
00034 //               its bounding volume.
00035 //
00036 //               This is useful for rendering opaque geometry, taking
00037 //               optimal advantage of a hierarchical Z-buffer.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA CullBinFrontToBack : public CullBin {
00040 public:
00041   INLINE CullBinFrontToBack(GraphicsStateGuardianBase *gsg);
00042   virtual ~CullBinFrontToBack();
00043 
00044   virtual void add_object(CullableObject *object);
00045   virtual void finish_cull();
00046   virtual void draw();
00047 
00048 private:
00049   class ObjectData {
00050   public:
00051     INLINE ObjectData(CullableObject *object, float dist);
00052     INLINE bool operator < (const ObjectData &other) const;
00053     
00054     CullableObject *_object;
00055     float _dist;
00056   };
00057 
00058   typedef pvector<ObjectData> Objects;
00059   Objects _objects;
00060 
00061 public:
00062   static TypeHandle get_class_type() {
00063     return _type_handle;
00064   }
00065   static void init_type() {
00066     CullBin::init_type();
00067     register_type(_type_handle, "CullBinFrontToBack",
00068                   CullBin::get_class_type());
00069   }
00070   virtual TypeHandle get_type() const {
00071     return get_class_type();
00072   }
00073   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00074 
00075 private:
00076   static TypeHandle _type_handle;
00077 };
00078 
00079 #include "cullBinFrontToBack.I"
00080 
00081 #endif
00082 
00083 
00084   

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