00001 // Filename: cullResult.h 00002 // Created by: drose (27Feb02) 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 CULLRESULT_H 00020 #define CULLRESULT_H 00021 00022 #include "pandabase.h" 00023 #include "cullBin.h" 00024 #include "renderState.h" 00025 #include "cullableObject.h" 00026 00027 #include "referenceCount.h" 00028 #include "pointerTo.h" 00029 #include "pvector.h" 00030 #include "pset.h" 00031 00032 class GraphicsStateGuardianBase; 00033 class TransformState; 00034 class RenderState; 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Class : CullResult 00038 // Description : This stores the result of a BinCullHandler traversal: 00039 // an ordered collection of CullBins, each of which 00040 // holds a number of Geoms and RenderStates to be 00041 // rendered in some defined order. 00042 // 00043 // This is also used to keep the results of last frame's 00044 // cull traversal around to make next frame's traversal 00045 // of the same scene a little easier. 00046 //////////////////////////////////////////////////////////////////// 00047 class EXPCL_PANDA CullResult : public ReferenceCount { 00048 public: 00049 INLINE CullResult(GraphicsStateGuardianBase *gsg); 00050 INLINE ~CullResult(); 00051 00052 PT(CullResult) make_next() const; 00053 00054 INLINE CullBin *get_bin(int bin_index); 00055 00056 void add_object(CullableObject *object); 00057 void finish_cull(); 00058 void draw(); 00059 00060 public: 00061 static void bin_removed(int bin_index); 00062 00063 private: 00064 CullBin *make_new_bin(int bin_index); 00065 00066 static CPT(RenderState) get_binary_state(); 00067 static CPT(RenderState) get_dual_transparent_state(); 00068 static CPT(RenderState) get_dual_transparent_state_decals(); 00069 static CPT(RenderState) get_dual_opaque_state(); 00070 00071 GraphicsStateGuardianBase *_gsg; 00072 00073 typedef pvector< PT(CullBin) > Bins; 00074 Bins _bins; 00075 00076 typedef pset<CullResult *> CullResults; 00077 static CullResults _cull_results; 00078 }; 00079 00080 #include "cullResult.I" 00081 00082 #endif 00083 00084 00085