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

panda/src/pgraph/cullBinFixed.cxx

Go to the documentation of this file.
00001 // Filename: cullBinFixed.cxx
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 #include "cullBinFixed.h"
00020 #include "graphicsStateGuardianBase.h"
00021 #include "geometricBoundingVolume.h"
00022 #include "cullableObject.h"
00023 #include "cullHandler.h"
00024 
00025 #include <algorithm>
00026 
00027 
00028 TypeHandle CullBinFixed::_type_handle;
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: CullBinFixed::Destructor
00032 //       Access: Public, Virtual
00033 //  Description: 
00034 ////////////////////////////////////////////////////////////////////
00035 CullBinFixed::
00036 ~CullBinFixed() {
00037   Objects::iterator oi;
00038   for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
00039     CullableObject *object = (*oi)._object;
00040     delete object;
00041   }
00042 }
00043 
00044 ////////////////////////////////////////////////////////////////////
00045 //     Function: CullBinFixed::add_object
00046 //       Access: Public, Virtual
00047 //  Description: Adds a geom, along with its associated state, to
00048 //               the bin for rendering.
00049 ////////////////////////////////////////////////////////////////////
00050 void CullBinFixed::
00051 add_object(CullableObject *object) {
00052   int draw_order = object->_state->get_draw_order();
00053   _objects.push_back(ObjectData(object, draw_order));
00054 }
00055 
00056 ////////////////////////////////////////////////////////////////////
00057 //     Function: CullBinFixed::finish_cull
00058 //       Access: Public
00059 //  Description: Called after all the geoms have been added, this
00060 //               indicates that the cull process is finished for this
00061 //               frame and gives the bins a chance to do any
00062 //               post-processing (like sorting) before moving on to
00063 //               draw.
00064 ////////////////////////////////////////////////////////////////////
00065 void CullBinFixed::
00066 finish_cull() {
00067   stable_sort(_objects.begin(), _objects.end());
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: CullBinFixed::draw
00072 //       Access: Public
00073 //  Description: Draws all the geoms in the bin, in the appropriate
00074 //               order.
00075 ////////////////////////////////////////////////////////////////////
00076 void CullBinFixed::
00077 draw() {
00078   Objects::const_iterator oi;
00079   for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
00080     CullableObject *object = (*oi)._object;
00081     CullHandler::draw(object, _gsg);
00082   }
00083 }
00084 

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