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

panda/src/pgraph/cullBinBackToFront.h

Go to the documentation of this file.
00001 // Filename: cullBinBackToFront.h
00002 // Created by:  drose (28Feb02)
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 CULLBINBACKTOFRONT_H
00020 #define CULLBINBACKTOFRONT_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 : CullBinBackToFront
00032 // Description : A specific kind of CullBin that sorts geometry in
00033 //               order from furthest to nearest based on the center of
00034 //               its bounding volume.  This is primarily intended for
00035 //               rendering transparent and semi-transparent geometry
00036 //               that must be sorted from back to front.
00037 ////////////////////////////////////////////////////////////////////
00038 class EXPCL_PANDA CullBinBackToFront : public CullBin {
00039 public:
00040   INLINE CullBinBackToFront(GraphicsStateGuardianBase *gsg);
00041   virtual ~CullBinBackToFront();
00042 
00043   virtual void add_object(CullableObject *object);
00044   virtual void finish_cull();
00045   virtual void draw();
00046 
00047 private:
00048   class ObjectData {
00049   public:
00050     INLINE ObjectData(CullableObject *object, float dist);
00051     INLINE bool operator < (const ObjectData &other) const;
00052     
00053     CullableObject *_object;
00054     float _dist;
00055   };
00056 
00057   typedef pvector<ObjectData> Objects;
00058   Objects _objects;
00059 
00060 public:
00061   static TypeHandle get_class_type() {
00062     return _type_handle;
00063   }
00064   static void init_type() {
00065     CullBin::init_type();
00066     register_type(_type_handle, "CullBinBackToFront",
00067                   CullBin::get_class_type());
00068   }
00069   virtual TypeHandle get_type() const {
00070     return get_class_type();
00071   }
00072   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00073 
00074 private:
00075   static TypeHandle _type_handle;
00076 };
00077 
00078 #include "cullBinBackToFront.I"
00079 
00080 #endif
00081 
00082 
00083   

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