00001 // Filename: cullBinFixed.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 CULLBINFIXED_H 00020 #define CULLBINFIXED_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 : CullBinFixed 00032 // Description : A specific kind of CullBin that sorts geometry in 00033 // the order specified by the user-specified draw_order 00034 // parameter. This allows precise relative ordering of 00035 // two objects. 00036 // 00037 // When two or more objects are assigned the same 00038 // draw_order, they are drawn in scene-graph order (as 00039 // with CullBinUnsorted). 00040 //////////////////////////////////////////////////////////////////// 00041 class EXPCL_PANDA CullBinFixed : public CullBin { 00042 public: 00043 INLINE CullBinFixed(GraphicsStateGuardianBase *gsg); 00044 virtual ~CullBinFixed(); 00045 00046 virtual void add_object(CullableObject *object); 00047 virtual void finish_cull(); 00048 virtual void draw(); 00049 00050 private: 00051 class ObjectData { 00052 public: 00053 INLINE ObjectData(CullableObject *object, int draw_order); 00054 INLINE bool operator < (const ObjectData &other) const; 00055 00056 CullableObject *_object; 00057 int _draw_order; 00058 }; 00059 00060 typedef pvector<ObjectData> Objects; 00061 Objects _objects; 00062 00063 public: 00064 static TypeHandle get_class_type() { 00065 return _type_handle; 00066 } 00067 static void init_type() { 00068 CullBin::init_type(); 00069 register_type(_type_handle, "CullBinFixed", 00070 CullBin::get_class_type()); 00071 } 00072 virtual TypeHandle get_type() const { 00073 return get_class_type(); 00074 } 00075 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00076 00077 private: 00078 static TypeHandle _type_handle; 00079 }; 00080 00081 #include "cullBinFixed.I" 00082 00083 #endif 00084 00085 00086