Moved GraphicsCostEstimator from osgUtil into core OSG library

This commit is contained in:
Robert Osfield
2011-02-03 12:22:09 +00:00
parent bcda8e4671
commit 88ce98b47d
7 changed files with 42 additions and 30 deletions

View File

@@ -11,18 +11,22 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGUTIL_GRAPHICSCOSTESTIMATOR
#define OSGUTIL_GRAPHICSCOSTESTIMATOR
#ifndef OSG_GRAPHICSCOSTESTIMATOR
#define OSG_GRAPHICSCOSTESTIMATOR
#include <osgUtil/Export>
#include <osg/Referenced>
#include <osg/ref_ptr>
#include <utility>
#include <osg/Geometry>
#include <osg/Texture>
#include <osg/Program>
namespace osgUtil
namespace osg
{
class Geometry;
class Texture;
class Program;
class Node;
class RenderInfo;
struct ClampedLinearCostFunction1D
{
ClampedLinearCostFunction1D(double cost0=0.0, double dcost_di=0.0, unsigned int min_input=0):
@@ -50,7 +54,7 @@ struct ClampedLinearCostFunction1D
typedef std::pair<double, double> CostPair;
class OSGUTIL_EXPORT GeometryCostEstimator : public osg::Referenced
class OSG_EXPORT GeometryCostEstimator : public osg::Referenced
{
public:
GeometryCostEstimator();
@@ -70,7 +74,7 @@ protected:
double _displayListCompileFactor;
};
class OSGUTIL_EXPORT TextureCostEstimator : public osg::Referenced
class OSG_EXPORT TextureCostEstimator : public osg::Referenced
{
public:
TextureCostEstimator();
@@ -85,7 +89,7 @@ protected:
};
class OSGUTIL_EXPORT ProgramCostEstimator : public osg::Referenced
class OSG_EXPORT ProgramCostEstimator : public osg::Referenced
{
public:
ProgramCostEstimator();
@@ -100,7 +104,7 @@ protected:
ClampedLinearCostFunction1D _drawCost;
};
class OSGUTIL_EXPORT GraphicsCostEstimator : public osg::Referenced
class OSG_EXPORT GraphicsCostEstimator : public osg::Referenced
{
public:
GraphicsCostEstimator();

View File

@@ -15,7 +15,8 @@
#define OSGUTIL_INCREMENTALCOMPILEOPERATOR
#include <osgUtil/GLObjectsVisitor>
#include <osgUtil/GraphicsCostEstimator>
#include <osg/GraphicsCostEstimator>
#include <osg/Geometry>
namespace osgUtil {
@@ -119,8 +120,8 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
osg::Geometry* getForceTextureDownloadGeometry() { return _forceTextureDownloadGeometry.get(); }
const osg::Geometry* getForceTextureDownloadGeometry() const { return _forceTextureDownloadGeometry.get(); }
GraphicsCostEstimator* getGraphicsCostEstimator() { return _graphicsCostEstimator.get(); }
const GraphicsCostEstimator* getGraphicsCostEstimator() const { return _graphicsCostEstimator.get(); }
osg::GraphicsCostEstimator* getGraphicsCostEstimator() { return _graphicsCostEstimator.get(); }
const osg::GraphicsCostEstimator* getGraphicsCostEstimator() const { return _graphicsCostEstimator.get(); }
typedef std::vector<osg::GraphicsContext*> Contexts;
@@ -147,6 +148,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
double availableTime() { return allocatedTime - timer.elapsedTime(); }
IncrementalCompileOperation* incrementalCompileOperation;
osg::GraphicsCostEstimator* graphicsCostEstimator;
unsigned int maxNumObjectsToCompile;
osg::ElapsedTime timer;
double allocatedTime;
@@ -278,7 +280,7 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
double _conservativeTimeRatio;
osg::ref_ptr<osg::Geometry> _forceTextureDownloadGeometry;
osg::ref_ptr<GraphicsCostEstimator> _graphicsCostEstimator;
osg::ref_ptr<osg::GraphicsCostEstimator> _graphicsCostEstimator;
OpenThreads::Mutex _toCompileMutex;
CompileSets _toCompile;