Browse Source

files moved to cull

David Rose 20 years ago
parent
commit
a31f6e7894

+ 0 - 29
panda/src/pgraph/binCullHandler.I

@@ -1,29 +0,0 @@
-// Filename: binCullHandler.I
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: BinCullHandler::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE BinCullHandler::
-BinCullHandler(CullResult *cull_result) :
-  _cull_result(cull_result)
-{
-}

+ 0 - 32
panda/src/pgraph/binCullHandler.cxx

@@ -1,32 +0,0 @@
-// Filename: binCullHandler.cxx
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "binCullHandler.h"
-#include "pStatTimer.h"
-
-////////////////////////////////////////////////////////////////////
-//     Function: BinCullHandler::record_object
-//       Access: Public, Virtual
-//  Description: This callback function is intended to be overridden
-//               by a derived class.  This is called as each Geom is
-//               discovered by the CullTraverser.
-////////////////////////////////////////////////////////////////////
-void BinCullHandler::
-record_object(CullableObject *object, const CullTraverser *traverser) {
-  _cull_result->add_object(object, traverser);
-}

+ 0 - 50
panda/src/pgraph/binCullHandler.h

@@ -1,50 +0,0 @@
-// Filename: binCullHandler.h
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef BINCULLHANDLER_H
-#define BINCULLHANDLER_H
-
-#include "pandabase.h"
-#include "cullHandler.h"
-#include "cullResult.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : BinCullHandler
-// Description : This CullHandler sends all of the geoms it receives
-//               into a CullResult object, for binning (and later
-//               drawing).  This is the kind of CullHandler to use for
-//               most normal rendering needs.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA BinCullHandler : public CullHandler {
-public:
-  INLINE BinCullHandler(CullResult *cull_result);
-
-  virtual void record_object(CullableObject *object, 
-                             const CullTraverser *traverser);
-
-private:
-  PT(CullResult) _cull_result;
-};
-
-#include "binCullHandler.I"
-
-#endif
-
-
-  

+ 0 - 53
panda/src/pgraph/cullBinBackToFront.I

@@ -1,53 +0,0 @@
-// Filename: cullBinBackToFront.I
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::ObjectData::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinBackToFront::ObjectData::
-ObjectData(CullableObject *object, float dist) :
-  _object(object),
-  _dist(dist)
-{
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::ObjectData::operator <
-//       Access: Public
-//  Description: Specifies the correct sort ordering for these
-//               objects.
-////////////////////////////////////////////////////////////////////
-INLINE bool CullBinBackToFront::ObjectData::
-operator < (const ObjectData &other) const {
-  return _dist > other._dist;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinBackToFront::
-CullBinBackToFront(const string &name, GraphicsStateGuardianBase *gsg) :
-  CullBin(name, gsg)
-{
-}

+ 0 - 100
panda/src/pgraph/cullBinBackToFront.cxx

@@ -1,100 +0,0 @@
-// Filename: cullBinBackToFront.cxx
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "cullBinBackToFront.h"
-#include "graphicsStateGuardianBase.h"
-#include "geometricBoundingVolume.h"
-#include "cullableObject.h"
-#include "cullHandler.h"
-#include "pStatTimer.h"
-
-#include <algorithm>
-
-
-TypeHandle CullBinBackToFront::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::Destructor
-//       Access: Public, Virtual
-//  Description: 
-////////////////////////////////////////////////////////////////////
-CullBinBackToFront::
-~CullBinBackToFront() {
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    delete object;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::add_object
-//       Access: Public, Virtual
-//  Description: Adds a geom, along with its associated state, to
-//               the bin for rendering.
-////////////////////////////////////////////////////////////////////
-void CullBinBackToFront::
-add_object(CullableObject *object) {
-  // Determine the center of the bounding volume.
-  CPT(BoundingVolume) volume = object->_geom->get_bounds();
-
-  if (!volume->is_empty() &&
-      volume->is_of_type(GeometricBoundingVolume::get_class_type())) {
-    const GeometricBoundingVolume *gbv;
-    DCAST_INTO_V(gbv, volume);
-    
-    LPoint3f center = gbv->get_approx_center();
-    nassertv(object->_modelview_transform != (const TransformState *)NULL);
-    center = center * object->_modelview_transform->get_mat();
-    
-    float distance = _gsg->compute_distance_to(center);
-    _objects.push_back(ObjectData(object, distance));
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::finish_cull
-//       Access: Public
-//  Description: Called after all the geoms have been added, this
-//               indicates that the cull process is finished for this
-//               frame and gives the bins a chance to do any
-//               post-processing (like sorting) before moving on to
-//               draw.
-////////////////////////////////////////////////////////////////////
-void CullBinBackToFront::
-finish_cull() {
-  PStatTimer timer(_cull_this_pcollector);
-  sort(_objects.begin(), _objects.end());
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinBackToFront::draw
-//       Access: Public
-//  Description: Draws all the geoms in the bin, in the appropriate
-//               order.
-////////////////////////////////////////////////////////////////////
-void CullBinBackToFront::
-draw() {
-  PStatTimer timer(_draw_this_pcollector);
-  Objects::const_iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    CullHandler::draw(object, _gsg);
-  }
-}
-

+ 0 - 83
panda/src/pgraph/cullBinBackToFront.h

@@ -1,83 +0,0 @@
-// Filename: cullBinBackToFront.h
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CULLBINBACKTOFRONT_H
-#define CULLBINBACKTOFRONT_H
-
-#include "pandabase.h"
-
-#include "cullBin.h"
-#include "geom.h"
-#include "transformState.h"
-#include "renderState.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : CullBinBackToFront
-// Description : A specific kind of CullBin that sorts geometry in
-//               order from furthest to nearest based on the center of
-//               its bounding volume.  This is primarily intended for
-//               rendering transparent and semi-transparent geometry
-//               that must be sorted from back to front.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA CullBinBackToFront : public CullBin {
-public:
-  INLINE CullBinBackToFront(const string &name, GraphicsStateGuardianBase *gsg);
-  virtual ~CullBinBackToFront();
-
-  virtual void add_object(CullableObject *object);
-  virtual void finish_cull();
-  virtual void draw();
-
-private:
-  class ObjectData {
-  public:
-    INLINE ObjectData(CullableObject *object, float dist);
-    INLINE bool operator < (const ObjectData &other) const;
-    
-    CullableObject *_object;
-    float _dist;
-  };
-
-  typedef pvector<ObjectData> Objects;
-  Objects _objects;
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    CullBin::init_type();
-    register_type(_type_handle, "CullBinBackToFront",
-                  CullBin::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "cullBinBackToFront.I"
-
-#endif
-
-
-  

+ 0 - 53
panda/src/pgraph/cullBinFixed.I

@@ -1,53 +0,0 @@
-// Filename: cullBinFixed.I
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::ObjectData::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinFixed::ObjectData::
-ObjectData(CullableObject *object, int draw_order) :
-  _object(object),
-  _draw_order(draw_order)
-{
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::ObjectData::operator <
-//       Access: Public
-//  Description: Specifies the correct sort ordering for these
-//               objects.
-////////////////////////////////////////////////////////////////////
-INLINE bool CullBinFixed::ObjectData::
-operator < (const ObjectData &other) const {
-  return _draw_order < other._draw_order;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinFixed::
-CullBinFixed(const string &name, GraphicsStateGuardianBase *gsg) :
-  CullBin(name, gsg)
-{
-}

+ 0 - 87
panda/src/pgraph/cullBinFixed.cxx

@@ -1,87 +0,0 @@
-// Filename: cullBinFixed.cxx
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "cullBinFixed.h"
-#include "graphicsStateGuardianBase.h"
-#include "geometricBoundingVolume.h"
-#include "cullableObject.h"
-#include "cullHandler.h"
-#include "pStatTimer.h"
-
-#include <algorithm>
-
-
-TypeHandle CullBinFixed::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::Destructor
-//       Access: Public, Virtual
-//  Description: 
-////////////////////////////////////////////////////////////////////
-CullBinFixed::
-~CullBinFixed() {
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    delete object;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::add_object
-//       Access: Public, Virtual
-//  Description: Adds a geom, along with its associated state, to
-//               the bin for rendering.
-////////////////////////////////////////////////////////////////////
-void CullBinFixed::
-add_object(CullableObject *object) {
-  int draw_order = object->_state->get_draw_order();
-  _objects.push_back(ObjectData(object, draw_order));
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::finish_cull
-//       Access: Public
-//  Description: Called after all the geoms have been added, this
-//               indicates that the cull process is finished for this
-//               frame and gives the bins a chance to do any
-//               post-processing (like sorting) before moving on to
-//               draw.
-////////////////////////////////////////////////////////////////////
-void CullBinFixed::
-finish_cull() {
-  PStatTimer timer(_cull_this_pcollector);
-  stable_sort(_objects.begin(), _objects.end());
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFixed::draw
-//       Access: Public
-//  Description: Draws all the geoms in the bin, in the appropriate
-//               order.
-////////////////////////////////////////////////////////////////////
-void CullBinFixed::
-draw() {
-  PStatTimer timer(_draw_this_pcollector);
-  Objects::const_iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    CullHandler::draw(object, _gsg);
-  }
-}
-

+ 0 - 86
panda/src/pgraph/cullBinFixed.h

@@ -1,86 +0,0 @@
-// Filename: cullBinFixed.h
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CULLBINFIXED_H
-#define CULLBINFIXED_H
-
-#include "pandabase.h"
-
-#include "cullBin.h"
-#include "geom.h"
-#include "transformState.h"
-#include "renderState.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : CullBinFixed
-// Description : A specific kind of CullBin that sorts geometry in
-//               the order specified by the user-specified draw_order
-//               parameter.  This allows precise relative ordering of
-//               two objects.
-//
-//               When two or more objects are assigned the same
-//               draw_order, they are drawn in scene-graph order (as
-//               with CullBinUnsorted).
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA CullBinFixed : public CullBin {
-public:
-  INLINE CullBinFixed(const string &name, GraphicsStateGuardianBase *gsg);
-  virtual ~CullBinFixed();
-
-  virtual void add_object(CullableObject *object);
-  virtual void finish_cull();
-  virtual void draw();
-
-private:
-  class ObjectData {
-  public:
-    INLINE ObjectData(CullableObject *object, int draw_order);
-    INLINE bool operator < (const ObjectData &other) const;
-    
-    CullableObject *_object;
-    int _draw_order;
-  };
-
-  typedef pvector<ObjectData> Objects;
-  Objects _objects;
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    CullBin::init_type();
-    register_type(_type_handle, "CullBinFixed",
-                  CullBin::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "cullBinFixed.I"
-
-#endif
-
-
-  

+ 0 - 53
panda/src/pgraph/cullBinFrontToBack.I

@@ -1,53 +0,0 @@
-// Filename: cullBinFrontToBack.I
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::ObjectData::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinFrontToBack::ObjectData::
-ObjectData(CullableObject *object, float dist) :
-  _object(object),
-  _dist(dist)
-{
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::ObjectData::operator <
-//       Access: Public
-//  Description: Specifies the correct sort ordering for these
-//               objects.
-////////////////////////////////////////////////////////////////////
-INLINE bool CullBinFrontToBack::ObjectData::
-operator < (const ObjectData &other) const {
-  return _dist < other._dist;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinFrontToBack::
-CullBinFrontToBack(const string &name, GraphicsStateGuardianBase *gsg) :
-  CullBin(name, gsg)
-{
-}

+ 0 - 100
panda/src/pgraph/cullBinFrontToBack.cxx

@@ -1,100 +0,0 @@
-// Filename: cullBinFrontToBack.cxx
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "cullBinFrontToBack.h"
-#include "graphicsStateGuardianBase.h"
-#include "geometricBoundingVolume.h"
-#include "cullableObject.h"
-#include "cullHandler.h"
-#include "pStatTimer.h"
-
-#include <algorithm>
-
-
-TypeHandle CullBinFrontToBack::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::Destructor
-//       Access: Public, Virtual
-//  Description: 
-////////////////////////////////////////////////////////////////////
-CullBinFrontToBack::
-~CullBinFrontToBack() {
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    delete object;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::add_object
-//       Access: Public, Virtual
-//  Description: Adds a geom, along with its associated state, to
-//               the bin for rendering.
-////////////////////////////////////////////////////////////////////
-void CullBinFrontToBack::
-add_object(CullableObject *object) {
-  // Determine the center of the bounding volume.
-  CPT(BoundingVolume) volume = object->_geom->get_bounds();
-
-  if (!volume->is_empty() &&
-      volume->is_of_type(GeometricBoundingVolume::get_class_type())) {
-    const GeometricBoundingVolume *gbv;
-    DCAST_INTO_V(gbv, volume);
-    
-    LPoint3f center = gbv->get_approx_center();
-    nassertv(object->_modelview_transform != (const TransformState *)NULL);
-    center = center * object->_modelview_transform->get_mat();
-    
-    float distance = _gsg->compute_distance_to(center);
-    _objects.push_back(ObjectData(object, distance));
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::finish_cull
-//       Access: Public
-//  Description: Called after all the geoms have been added, this
-//               indicates that the cull process is finished for this
-//               frame and gives the bins a chance to do any
-//               post-processing (like sorting) before moving on to
-//               draw.
-////////////////////////////////////////////////////////////////////
-void CullBinFrontToBack::
-finish_cull() {
-  PStatTimer timer(_cull_this_pcollector);
-  sort(_objects.begin(), _objects.end());
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinFrontToBack::draw
-//       Access: Public
-//  Description: Draws all the geoms in the bin, in the appropriate
-//               order.
-////////////////////////////////////////////////////////////////////
-void CullBinFrontToBack::
-draw() {
-  PStatTimer timer(_draw_this_pcollector);
-  Objects::const_iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    CullHandler::draw(object, _gsg);
-  }
-}
-

+ 0 - 84
panda/src/pgraph/cullBinFrontToBack.h

@@ -1,84 +0,0 @@
-// Filename: cullBinFrontToBack.h
-// Created by:  drose (29May02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CULLBINFRONTTOBACK_H
-#define CULLBINFRONTTOBACK_H
-
-#include "pandabase.h"
-
-#include "cullBin.h"
-#include "geom.h"
-#include "transformState.h"
-#include "renderState.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : CullBinFrontToBack
-// Description : A specific kind of CullBin that sorts geometry in
-//               order from nearest to furthest based on the center of
-//               its bounding volume.
-//
-//               This is useful for rendering opaque geometry, taking
-//               optimal advantage of a hierarchical Z-buffer.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA CullBinFrontToBack : public CullBin {
-public:
-  INLINE CullBinFrontToBack(const string &name, GraphicsStateGuardianBase *gsg);
-  virtual ~CullBinFrontToBack();
-
-  virtual void add_object(CullableObject *object);
-  virtual void finish_cull();
-  virtual void draw();
-
-private:
-  class ObjectData {
-  public:
-    INLINE ObjectData(CullableObject *object, float dist);
-    INLINE bool operator < (const ObjectData &other) const;
-    
-    CullableObject *_object;
-    float _dist;
-  };
-
-  typedef pvector<ObjectData> Objects;
-  Objects _objects;
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    CullBin::init_type();
-    register_type(_type_handle, "CullBinFrontToBack",
-                  CullBin::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "cullBinFrontToBack.I"
-
-#endif
-
-
-  

+ 0 - 75
panda/src/pgraph/cullBinStateSorted.I

@@ -1,75 +0,0 @@
-// Filename: cullBinStateSorted.I
-// Created by:  drose (22Mar05)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::ObjectData::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinStateSorted::ObjectData::
-ObjectData(CullableObject *object) :
-  _object(object)
-{
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::ObjectData::operator <
-//       Access: Public
-//  Description: Specifies the correct sort ordering for these
-//               objects.
-////////////////////////////////////////////////////////////////////
-INLINE bool CullBinStateSorted::ObjectData::
-operator < (const ObjectData &other) const {
-  const RenderState *sa = _object->_state;
-  const RenderState *sb = other._object->_state;
-
-  if (sa != sb) {
-    // First, group objects by texture, since conventional wisdom is
-    // that texture changes are the most expensive state changes in a
-    // graphics context.
-    const TextureAttrib *ta = sa->get_texture();
-    const TextureAttrib *tb = sb->get_texture();
-    if (ta != tb) {
-      return ta < tb;
-    }
-  }
-
-  // Then group objects by transform, since these are supposed to be
-  // expensive too.
-  if (_object->_modelview_transform != other._object->_modelview_transform) {
-    return _object->_modelview_transform < other._object->_modelview_transform;
-  }
-      
-  // Then, sort by all the other states, in no particular order,
-  // just as long as objects with identical state are all grouped
-  // together.
-  return sa < sb;
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinStateSorted::
-CullBinStateSorted(const string &name, GraphicsStateGuardianBase *gsg) :
-  CullBin(name, gsg)
-{
-}

+ 0 - 87
panda/src/pgraph/cullBinStateSorted.cxx

@@ -1,87 +0,0 @@
-// Filename: cullBinStateSorted.cxx
-// Created by:  drose (22Mar05)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "cullBinStateSorted.h"
-#include "graphicsStateGuardianBase.h"
-#include "geometricBoundingVolume.h"
-#include "cullableObject.h"
-#include "cullHandler.h"
-#include "pStatTimer.h"
-
-#include <algorithm>
-
-
-TypeHandle CullBinStateSorted::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::Destructor
-//       Access: Public, Virtual
-//  Description: 
-////////////////////////////////////////////////////////////////////
-CullBinStateSorted::
-~CullBinStateSorted() {
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    delete object;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::add_object
-//       Access: Public, Virtual
-//  Description: Adds a geom, along with its associated state, to
-//               the bin for rendering.
-////////////////////////////////////////////////////////////////////
-void CullBinStateSorted::
-add_object(CullableObject *object) {
-  _objects.push_back(ObjectData(object));
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::finish_cull
-//       Access: Public
-//  Description: Called after all the geoms have been added, this
-//               indicates that the cull process is finished for this
-//               frame and gives the bins a chance to do any
-//               post-processing (like sorting) before moving on to
-//               draw.
-////////////////////////////////////////////////////////////////////
-void CullBinStateSorted::
-finish_cull() {
-  PStatTimer timer(_cull_this_pcollector);
-  sort(_objects.begin(), _objects.end());
-}
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinStateSorted::draw
-//       Access: Public
-//  Description: Draws all the geoms in the bin, in the appropriate
-//               order.
-////////////////////////////////////////////////////////////////////
-void CullBinStateSorted::
-draw() {
-  PStatTimer timer(_draw_this_pcollector);
-  Objects::const_iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi)._object;
-    CullHandler::draw(object, _gsg);
-  }
-}
-

+ 0 - 86
panda/src/pgraph/cullBinStateSorted.h

@@ -1,86 +0,0 @@
-// Filename: cullBinStateSorted.h
-// Created by:  drose (22Mar05)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CULLBINSTATESORTED_H
-#define CULLBINSTATESORTED_H
-
-#include "pandabase.h"
-
-#include "cullBin.h"
-#include "geom.h"
-#include "transformState.h"
-#include "renderState.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : CullBinStateSorted
-// Description : A specific kind of CullBin that sorts geometry to
-//               collect items of the same state together, so that
-//               minimal state changes are required on the GSG to
-//               render them.
-//
-//               This also sorts objects front-to-back within a
-//               particular state, to take advantage of hierarchical
-//               Z-buffer algorithms which can early-out when an
-//               object appears behind another one.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA CullBinStateSorted : public CullBin {
-public:
-  INLINE CullBinStateSorted(const string &name, GraphicsStateGuardianBase *gsg);
-  virtual ~CullBinStateSorted();
-
-  virtual void add_object(CullableObject *object);
-  virtual void finish_cull();
-  virtual void draw();
-
-private:
-  class ObjectData {
-  public:
-    INLINE ObjectData(CullableObject *object);
-    INLINE bool operator < (const ObjectData &other) const;
-    
-    CullableObject *_object;
-  };
-
-  typedef pvector<ObjectData> Objects;
-  Objects _objects;
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    CullBin::init_type();
-    register_type(_type_handle, "CullBinStateSorted",
-                  CullBin::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "cullBinStateSorted.I"
-
-#endif
-
-
-  

+ 0 - 29
panda/src/pgraph/cullBinUnsorted.I

@@ -1,29 +0,0 @@
-// Filename: cullBinUnsorted.I
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinUnsorted::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE CullBinUnsorted::
-CullBinUnsorted(const string &name, GraphicsStateGuardianBase *gsg) :
-  CullBin(name, gsg)
-{
-}

+ 0 - 67
panda/src/pgraph/cullBinUnsorted.cxx

@@ -1,67 +0,0 @@
-// Filename: cullBinUnsorted.cxx
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "cullBinUnsorted.h"
-#include "cullHandler.h"
-#include "graphicsStateGuardianBase.h"
-#include "pStatTimer.h"
-
-
-TypeHandle CullBinUnsorted::_type_handle;
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinUnsorted::Destructor
-//       Access: Public, Virtual
-//  Description: 
-////////////////////////////////////////////////////////////////////
-CullBinUnsorted::
-~CullBinUnsorted() {
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi);
-    delete object;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinUnsorted::add_object
-//       Access: Public, Virtual
-//  Description: Adds a geom, along with its associated state, to
-//               the bin for rendering.
-////////////////////////////////////////////////////////////////////
-void CullBinUnsorted::
-add_object(CullableObject *object) {
-  _objects.push_back(object);
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: CullBinUnsorted::draw
-//       Access: Public
-//  Description: Draws all the objects in the bin, in the appropriate
-//               order.
-////////////////////////////////////////////////////////////////////
-void CullBinUnsorted::
-draw() {
-  PStatTimer timer(_draw_this_pcollector);
-  Objects::iterator oi;
-  for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
-    CullableObject *object = (*oi);
-    CullHandler::draw(object, _gsg);
-  }
-}
-

+ 0 - 69
panda/src/pgraph/cullBinUnsorted.h

@@ -1,69 +0,0 @@
-// Filename: cullBinUnsorted.h
-// Created by:  drose (28Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef CULLBINUNSORTED_H
-#define CULLBINUNSORTED_H
-
-#include "pandabase.h"
-
-#include "cullBin.h"
-#include "pointerTo.h"
-
-////////////////////////////////////////////////////////////////////
-//       Class : CullBinUnsorted
-// Description : A specific kind of CullBin that does not reorder the
-//               geometry; it simply passes it through to the GSG in
-//               the same order it was encountered, which will be in
-//               scene-graph order.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA CullBinUnsorted : public CullBin {
-public:
-  INLINE CullBinUnsorted(const string &name, GraphicsStateGuardianBase *gsg);
-  ~CullBinUnsorted();
-
-  virtual void add_object(CullableObject *object);
-  virtual void draw();
-
-private:
-  typedef pvector<CullableObject *> Objects;
-  Objects _objects;
-
-public:
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    CullBin::init_type();
-    register_type(_type_handle, "CullBinUnsorted",
-                  CullBin::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "cullBinUnsorted.I"
-
-#endif
-
-
-  

+ 0 - 29
panda/src/pgraph/drawCullHandler.I

@@ -1,29 +0,0 @@
-// Filename: drawCullHandler.I
-// Created by:  drose (25Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: DrawCullHandler::Constructor
-//       Access: Public
-//  Description: 
-////////////////////////////////////////////////////////////////////
-INLINE DrawCullHandler::
-DrawCullHandler(GraphicsStateGuardianBase *gsg) :
-  _gsg(gsg)
-{
-}

+ 0 - 43
panda/src/pgraph/drawCullHandler.cxx

@@ -1,43 +0,0 @@
-// Filename: drawCullHandler.cxx
-// Created by:  drose (25Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "drawCullHandler.h"
-#include "cullableObject.h"
-#include "geom.h"
-#include "transformState.h"
-#include "renderState.h"
-#include "graphicsStateGuardianBase.h"
-
-
-////////////////////////////////////////////////////////////////////
-//     Function: DrawCullHandler::record_object
-//       Access: Public, Virtual
-//  Description: This callback function is intended to be overridden
-//               by a derived class.  This is called as each Geom is
-//               discovered by the CullTraverser.
-////////////////////////////////////////////////////////////////////
-void DrawCullHandler::
-record_object(CullableObject *object, const CullTraverser *traverser) {
-  // Munge vertices as needed for the GSG's requirements, and the
-  // object's current state.
-  object->munge_geom(_gsg, _gsg->get_geom_munger(object->_state), traverser);
-
-  // And draw the object, then dispense with it.
-  draw(object, _gsg);
-  delete object;
-}

+ 0 - 54
panda/src/pgraph/drawCullHandler.h

@@ -1,54 +0,0 @@
-// Filename: drawCullHandler.h
-// Created by:  drose (25Feb02)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001 - 2004, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://etc.cmu.edu/panda3d/docs/license/ .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef DRAWCULLHANDLER_H
-#define DRAWCULLHANDLER_H
-
-#include "pandabase.h"
-#include "cullHandler.h"
-
-class GraphicsStateGuardianBase;
-
-////////////////////////////////////////////////////////////////////
-//       Class : DrawCullHandler
-// Description : This special kind of CullHandler immediately draws
-//               its contents as soon as it receives them.  This draws
-//               geometry immediately as it is encountered in the
-//               scene graph by cull, mixing the draw and cull
-//               traversals into one traversal, and prohibiting state
-//               sorting.  However, it has somewhat lower overhead
-//               than separating out draw and cull, if state sorting
-//               and multiprocessing are not required.
-////////////////////////////////////////////////////////////////////
-class EXPCL_PANDA DrawCullHandler : public CullHandler {
-public:
-  INLINE DrawCullHandler(GraphicsStateGuardianBase *gsg);
-
-  virtual void record_object(CullableObject *object, 
-                             const CullTraverser *traverser);
-
-private:
-  GraphicsStateGuardianBase *_gsg;
-};
-
-#include "drawCullHandler.I"
-
-#endif
-
-
-