Impostor
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGSIM_IMPOSTOR
#define OSGSIM_IMPOSTOR 1
#include <osg/LOD>
#include <osg/buffered_value>
#include <osgUtil/CullVisitor>
#include <osgSim/ImpostorSprite>
namespace osgSim {
class OSGSIM_EXPORT Impostor : public osg::LOD
{
public :
Impostor();
Impostor(const Impostor& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
osg::LOD(es,copyop),
_impostorThreshold(es._impostorThreshold) {}
META_Node(osgSim, Impostor);
virtual void traverse(osg::NodeVisitor& nv);
typedef std::vector< osg::ref_ptr<ImpostorSprite> > ImpostorSpriteList;
inline void setImpostorThreshold(float distance) { _impostorThreshold = distance; }
/* Get the Impostor threshold distance. */
inline float getImpostorThreshold() const { return _impostorThreshold; }
inline void setImpostorThresholdToBound(float ratio=1.0f) { _impostorThreshold = getBound().radius()*ratio; }
ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const;
void addImpostorSprite(unsigned int contextID, ImpostorSprite* is);
inline ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) { return _impostorSpriteListBuffer[contexID]; }
inline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const { return _impostorSpriteListBuffer[contexID]; }
virtual osg::BoundingSphere computeBound() const;
protected :
virtual ~Impostor() {}
mutable osg::buffered_object<ImpostorSpriteList> _impostorSpriteListBuffer;
ImpostorSprite* createImpostorSprite(osgUtil::CullVisitor* cv);
float _impostorThreshold;
};
}
#endif
CullVisitor
ImpostorSprite
LOD
buffered_value
osgSim::ImpostorSprite
Definition ImpostorSprite:38
osgSim::Impostor::traverse
virtual void traverse(osg::NodeVisitor &nv)
osgSim::Impostor::_impostorSpriteListBuffer
osg::buffered_object< ImpostorSpriteList > _impostorSpriteListBuffer
Definition Impostor:111
osgSim::Impostor::Impostor
Impostor()
osgSim::Impostor::getImpostorSpriteList
const ImpostorSpriteList & getImpostorSpriteList(unsigned int contexID) const
Definition Impostor:103
osgSim::Impostor::findBestImpostorSprite
ImpostorSprite * findBestImpostorSprite(unsigned int contextID, const osg::Vec3 &currLocalEyePoint) const
osgSim::Impostor::~Impostor
virtual ~Impostor()
Definition Impostor:109
osgSim::Impostor::Impostor
Impostor(const Impostor &es, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition Impostor:69
osgSim::Impostor::createImpostorSprite
ImpostorSprite * createImpostorSprite(osgUtil::CullVisitor *cv)
osgSim::Impostor::getImpostorSpriteList
ImpostorSpriteList & getImpostorSpriteList(unsigned int contexID)
Definition Impostor:100
osgSim::Impostor::getImpostorThreshold
float getImpostorThreshold() const
Definition Impostor:86
osgSim::Impostor::setImpostorThreshold
void setImpostorThreshold(float distance)
Definition Impostor:83
osgSim::Impostor::setImpostorThresholdToBound
void setImpostorThresholdToBound(float ratio=1.0f)
Definition Impostor:91
osgSim::Impostor::ImpostorSpriteList
std::vector< osg::ref_ptr< ImpostorSprite > > ImpostorSpriteList
Definition Impostor:77
osgSim::Impostor::META_Node
META_Node(osgSim, Impostor)
osgSim::Impostor::_impostorThreshold
float _impostorThreshold
Definition Impostor:115
osgSim::Impostor::addImpostorSprite
void addImpostorSprite(unsigned int contextID, ImpostorSprite *is)
osgSim::Impostor::computeBound
virtual osg::BoundingSphere computeBound() const
osgUtil::CullVisitor
Definition CullVisitor:49
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::LOD
Definition LOD:36
osg::LOD::LOD
LOD()
osg::NodeVisitor
Definition NodeVisitor:82
osg::Node::getBound
const BoundingSphere & getBound() const
Definition Node:425
osg::buffered_object
Definition buffered_value:79
osgSim
Definition BlinkSequence:27
osg
Definition AlphaFunc:19
osg::Vec3
Vec3f Vec3
Definition Vec3:21
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
OSGSIM_EXPORT
#define OSGSIM_EXPORT
Definition osgSim/Export:38