Panda3D

cullBinFixed.h

00001 // Filename: cullBinFixed.h
00002 // Created by:  drose (29May02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef CULLBINFIXED_H
00016 #define CULLBINFIXED_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "cullBin.h"
00021 #include "geom.h"
00022 #include "transformState.h"
00023 #include "renderState.h"
00024 #include "pointerTo.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : CullBinFixed
00028 // Description : A specific kind of CullBin that sorts geometry in
00029 //               the order specified by the user-specified draw_order
00030 //               parameter.  This allows precise relative ordering of
00031 //               two objects.
00032 //
00033 //               When two or more objects are assigned the same
00034 //               draw_order, they are drawn in scene-graph order (as
00035 //               with CullBinUnsorted).
00036 ////////////////////////////////////////////////////////////////////
00037 class EXPCL_PANDA_CULL CullBinFixed : public CullBin {
00038 public:
00039   INLINE CullBinFixed(const string &name, 
00040                       GraphicsStateGuardianBase *gsg,
00041                       const PStatCollector &draw_region_pcollector);
00042   virtual ~CullBinFixed();
00043 
00044   static CullBin *make_bin(const string &name, 
00045                            GraphicsStateGuardianBase *gsg,
00046                            const PStatCollector &draw_region_pcollector);
00047 
00048   virtual void add_object(CullableObject *object, Thread *current_thread);
00049   virtual void finish_cull(SceneSetup *scene_setup, Thread *current_thread);
00050   virtual void draw(bool force, Thread *current_thread);
00051 
00052 protected:
00053   virtual void fill_result_graph(ResultGraphBuilder &builder);
00054 
00055 private:
00056   class ObjectData {
00057   public:
00058     INLINE ObjectData(CullableObject *object, int draw_order);
00059     INLINE bool operator < (const ObjectData &other) const;
00060     
00061     CullableObject *_object;
00062     int _draw_order;
00063   };
00064 
00065   typedef pvector<ObjectData> Objects;
00066   Objects _objects;
00067 
00068 public:
00069   static TypeHandle get_class_type() {
00070     return _type_handle;
00071   }
00072   static void init_type() {
00073     CullBin::init_type();
00074     register_type(_type_handle, "CullBinFixed",
00075                   CullBin::get_class_type());
00076   }
00077   virtual TypeHandle get_type() const {
00078     return get_class_type();
00079   }
00080   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00081 
00082 private:
00083   static TypeHandle _type_handle;
00084 };
00085 
00086 #include "cullBinFixed.I"
00087 
00088 #endif
00089 
00090 
00091   
 All Classes Functions Variables Enumerations