Panda3D
|
00001 // Filename: cullResult.h 00002 // Created by: drose (27Feb02) 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 CULLRESULT_H 00016 #define CULLRESULT_H 00017 00018 #include "pandabase.h" 00019 #include "cullBin.h" 00020 #include "renderState.h" 00021 #include "cullableObject.h" 00022 #include "geomMunger.h" 00023 #include "referenceCount.h" 00024 #include "pointerTo.h" 00025 #include "pvector.h" 00026 #include "pset.h" 00027 #include "pmap.h" 00028 00029 00030 class GraphicsStateGuardianBase; 00031 class CullTraverser; 00032 class TransformState; 00033 class RenderState; 00034 class SceneSetup; 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_PGRAPH CullResult : public ReferenceCount { 00048 public: 00049 CullResult(GraphicsStateGuardianBase *gsg, 00050 const PStatCollector &draw_region_pcollector); 00051 INLINE ~CullResult(); 00052 00053 PUBLISHED: 00054 PT(CullResult) make_next() const; 00055 00056 INLINE CullBin *get_bin(int bin_index); 00057 00058 void add_object(CullableObject *object, const CullTraverser *traverser); 00059 void finish_cull(SceneSetup *scene_setup, Thread *current_thread); 00060 void draw(Thread *current_thread); 00061 00062 PT(PandaNode) make_result_graph(); 00063 00064 public: 00065 static void bin_removed(int bin_index); 00066 00067 private: 00068 CullBin *make_new_bin(int bin_index); 00069 void check_flash_bin(CPT(RenderState) &state, CullBin *bin); 00070 void check_flash_transparency(CPT(RenderState) &state, const LColor &color); 00071 00072 static CPT(RenderState) get_alpha_state(); 00073 static CPT(RenderState) get_binary_state(); 00074 static CPT(RenderState) get_dual_transparent_state(); 00075 static CPT(RenderState) get_dual_transparent_state_decals(); 00076 static CPT(RenderState) get_dual_opaque_state(); 00077 00078 GraphicsStateGuardianBase *_gsg; 00079 PStatCollector _draw_region_pcollector; 00080 00081 typedef pvector< PT(CullBin) > Bins; 00082 Bins _bins; 00083 00084 public: 00085 static TypeHandle get_class_type() { 00086 return _type_handle; 00087 } 00088 static void init_type() { 00089 ReferenceCount::init_type(); 00090 register_type(_type_handle, "CullResult", 00091 ReferenceCount::get_class_type()); 00092 } 00093 00094 private: 00095 static TypeHandle _type_handle; 00096 }; 00097 00098 #include "cullResult.I" 00099 00100 #endif 00101 00102 00103