From a31f6e78943f195e929f2ae36a3aa53cd228a216 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 24 Mar 2006 21:46:45 +0000 Subject: [PATCH] files moved to cull --- panda/src/pgraph/binCullHandler.I | 29 ------- panda/src/pgraph/binCullHandler.cxx | 32 -------- panda/src/pgraph/binCullHandler.h | 50 ------------ panda/src/pgraph/cullBinBackToFront.I | 53 ------------- panda/src/pgraph/cullBinBackToFront.cxx | 100 ------------------------ panda/src/pgraph/cullBinBackToFront.h | 83 -------------------- panda/src/pgraph/cullBinFixed.I | 53 ------------- panda/src/pgraph/cullBinFixed.cxx | 87 --------------------- panda/src/pgraph/cullBinFixed.h | 86 -------------------- panda/src/pgraph/cullBinFrontToBack.I | 53 ------------- panda/src/pgraph/cullBinFrontToBack.cxx | 100 ------------------------ panda/src/pgraph/cullBinFrontToBack.h | 84 -------------------- panda/src/pgraph/cullBinStateSorted.I | 75 ------------------ panda/src/pgraph/cullBinStateSorted.cxx | 87 --------------------- panda/src/pgraph/cullBinStateSorted.h | 86 -------------------- panda/src/pgraph/cullBinUnsorted.I | 29 ------- panda/src/pgraph/cullBinUnsorted.cxx | 67 ---------------- panda/src/pgraph/cullBinUnsorted.h | 69 ---------------- panda/src/pgraph/drawCullHandler.I | 29 ------- panda/src/pgraph/drawCullHandler.cxx | 43 ---------- panda/src/pgraph/drawCullHandler.h | 54 ------------- 21 files changed, 1349 deletions(-) delete mode 100644 panda/src/pgraph/binCullHandler.I delete mode 100644 panda/src/pgraph/binCullHandler.cxx delete mode 100644 panda/src/pgraph/binCullHandler.h delete mode 100644 panda/src/pgraph/cullBinBackToFront.I delete mode 100644 panda/src/pgraph/cullBinBackToFront.cxx delete mode 100644 panda/src/pgraph/cullBinBackToFront.h delete mode 100644 panda/src/pgraph/cullBinFixed.I delete mode 100644 panda/src/pgraph/cullBinFixed.cxx delete mode 100644 panda/src/pgraph/cullBinFixed.h delete mode 100644 panda/src/pgraph/cullBinFrontToBack.I delete mode 100644 panda/src/pgraph/cullBinFrontToBack.cxx delete mode 100644 panda/src/pgraph/cullBinFrontToBack.h delete mode 100644 panda/src/pgraph/cullBinStateSorted.I delete mode 100644 panda/src/pgraph/cullBinStateSorted.cxx delete mode 100644 panda/src/pgraph/cullBinStateSorted.h delete mode 100644 panda/src/pgraph/cullBinUnsorted.I delete mode 100644 panda/src/pgraph/cullBinUnsorted.cxx delete mode 100644 panda/src/pgraph/cullBinUnsorted.h delete mode 100644 panda/src/pgraph/drawCullHandler.I delete mode 100644 panda/src/pgraph/drawCullHandler.cxx delete mode 100644 panda/src/pgraph/drawCullHandler.h diff --git a/panda/src/pgraph/binCullHandler.I b/panda/src/pgraph/binCullHandler.I deleted file mode 100644 index 8d41d32d3b..0000000000 --- a/panda/src/pgraph/binCullHandler.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: BinCullHandler::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE BinCullHandler:: -BinCullHandler(CullResult *cull_result) : - _cull_result(cull_result) -{ -} diff --git a/panda/src/pgraph/binCullHandler.cxx b/panda/src/pgraph/binCullHandler.cxx deleted file mode 100644 index 6c89bdf9d1..0000000000 --- a/panda/src/pgraph/binCullHandler.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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); -} diff --git a/panda/src/pgraph/binCullHandler.h b/panda/src/pgraph/binCullHandler.h deleted file mode 100644 index 89458f5a71..0000000000 --- a/panda/src/pgraph/binCullHandler.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 - - - diff --git a/panda/src/pgraph/cullBinBackToFront.I b/panda/src/pgraph/cullBinBackToFront.I deleted file mode 100644 index e48eb0f4a2..0000000000 --- a/panda/src/pgraph/cullBinBackToFront.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// 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) -{ -} diff --git a/panda/src/pgraph/cullBinBackToFront.cxx b/panda/src/pgraph/cullBinBackToFront.cxx deleted file mode 100644 index 89985341e1..0000000000 --- a/panda/src/pgraph/cullBinBackToFront.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "cullBinBackToFront.h" -#include "graphicsStateGuardianBase.h" -#include "geometricBoundingVolume.h" -#include "cullableObject.h" -#include "cullHandler.h" -#include "pStatTimer.h" - -#include - - -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); - } -} - diff --git a/panda/src/pgraph/cullBinBackToFront.h b/panda/src/pgraph/cullBinBackToFront.h deleted file mode 100644 index 553fe9c5f8..0000000000 --- a/panda/src/pgraph/cullBinBackToFront.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 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 - - - diff --git a/panda/src/pgraph/cullBinFixed.I b/panda/src/pgraph/cullBinFixed.I deleted file mode 100644 index f11dea1771..0000000000 --- a/panda/src/pgraph/cullBinFixed.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// 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) -{ -} diff --git a/panda/src/pgraph/cullBinFixed.cxx b/panda/src/pgraph/cullBinFixed.cxx deleted file mode 100644 index 043d98eec1..0000000000 --- a/panda/src/pgraph/cullBinFixed.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "cullBinFixed.h" -#include "graphicsStateGuardianBase.h" -#include "geometricBoundingVolume.h" -#include "cullableObject.h" -#include "cullHandler.h" -#include "pStatTimer.h" - -#include - - -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); - } -} - diff --git a/panda/src/pgraph/cullBinFixed.h b/panda/src/pgraph/cullBinFixed.h deleted file mode 100644 index 8116722574..0000000000 --- a/panda/src/pgraph/cullBinFixed.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 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 - - - diff --git a/panda/src/pgraph/cullBinFrontToBack.I b/panda/src/pgraph/cullBinFrontToBack.I deleted file mode 100644 index c8049bdde6..0000000000 --- a/panda/src/pgraph/cullBinFrontToBack.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// 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) -{ -} diff --git a/panda/src/pgraph/cullBinFrontToBack.cxx b/panda/src/pgraph/cullBinFrontToBack.cxx deleted file mode 100644 index d3673381b1..0000000000 --- a/panda/src/pgraph/cullBinFrontToBack.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "cullBinFrontToBack.h" -#include "graphicsStateGuardianBase.h" -#include "geometricBoundingVolume.h" -#include "cullableObject.h" -#include "cullHandler.h" -#include "pStatTimer.h" - -#include - - -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); - } -} - diff --git a/panda/src/pgraph/cullBinFrontToBack.h b/panda/src/pgraph/cullBinFrontToBack.h deleted file mode 100644 index 3795d433f3..0000000000 --- a/panda/src/pgraph/cullBinFrontToBack.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 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 - - - diff --git a/panda/src/pgraph/cullBinStateSorted.I b/panda/src/pgraph/cullBinStateSorted.I deleted file mode 100644 index 614b600f0f..0000000000 --- a/panda/src/pgraph/cullBinStateSorted.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// 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) -{ -} diff --git a/panda/src/pgraph/cullBinStateSorted.cxx b/panda/src/pgraph/cullBinStateSorted.cxx deleted file mode 100644 index 1f27f10f56..0000000000 --- a/panda/src/pgraph/cullBinStateSorted.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#include "cullBinStateSorted.h" -#include "graphicsStateGuardianBase.h" -#include "geometricBoundingVolume.h" -#include "cullableObject.h" -#include "cullHandler.h" -#include "pStatTimer.h" - -#include - - -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); - } -} - diff --git a/panda/src/pgraph/cullBinStateSorted.h b/panda/src/pgraph/cullBinStateSorted.h deleted file mode 100644 index bea8d52693..0000000000 --- a/panda/src/pgraph/cullBinStateSorted.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 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 - - - diff --git a/panda/src/pgraph/cullBinUnsorted.I b/panda/src/pgraph/cullBinUnsorted.I deleted file mode 100644 index 472f1708d8..0000000000 --- a/panda/src/pgraph/cullBinUnsorted.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: CullBinUnsorted::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE CullBinUnsorted:: -CullBinUnsorted(const string &name, GraphicsStateGuardianBase *gsg) : - CullBin(name, gsg) -{ -} diff --git a/panda/src/pgraph/cullBinUnsorted.cxx b/panda/src/pgraph/cullBinUnsorted.cxx deleted file mode 100644 index 452fa9fc87..0000000000 --- a/panda/src/pgraph/cullBinUnsorted.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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); - } -} - diff --git a/panda/src/pgraph/cullBinUnsorted.h b/panda/src/pgraph/cullBinUnsorted.h deleted file mode 100644 index d50d43d6f9..0000000000 --- a/panda/src/pgraph/cullBinUnsorted.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 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 - - - diff --git a/panda/src/pgraph/drawCullHandler.I b/panda/src/pgraph/drawCullHandler.I deleted file mode 100644 index 639528105b..0000000000 --- a/panda/src/pgraph/drawCullHandler.I +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////////// -// Function: DrawCullHandler::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -INLINE DrawCullHandler:: -DrawCullHandler(GraphicsStateGuardianBase *gsg) : - _gsg(gsg) -{ -} diff --git a/panda/src/pgraph/drawCullHandler.cxx b/panda/src/pgraph/drawCullHandler.cxx deleted file mode 100644 index 49e872e21b..0000000000 --- a/panda/src/pgraph/drawCullHandler.cxx +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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; -} diff --git a/panda/src/pgraph/drawCullHandler.h b/panda/src/pgraph/drawCullHandler.h deleted file mode 100644 index 233901d107..0000000000 --- a/panda/src/pgraph/drawCullHandler.h +++ /dev/null @@ -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 -// panda3d-general@lists.sourceforge.net . -// -//////////////////////////////////////////////////////////////////// - -#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 - - -