openscenegraph
Impostor
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGSIM_IMPOSTOR
15#define OSGSIM_IMPOSTOR 1
16
17#include <osg/LOD>
18#include <osg/buffered_value>
19
20#include <osgUtil/CullVisitor>
21
22#include <osgSim/ImpostorSprite>
23
24namespace osgSim {
25
65{
66 public :
68
70 osg::LOD(es,copyop),
71 _impostorThreshold(es._impostorThreshold) {}
72
74
75 virtual void traverse(osg::NodeVisitor& nv);
76
77 typedef std::vector< osg::ref_ptr<ImpostorSprite> > ImpostorSpriteList;
78
83 inline void setImpostorThreshold(float distance) { _impostorThreshold = distance; }
84
85 /* Get the Impostor threshold distance. */
86 inline float getImpostorThreshold() const { return _impostorThreshold; }
87
91 inline void setImpostorThresholdToBound(float ratio=1.0f) { _impostorThreshold = getBound().radius()*ratio; }
92
94 ImpostorSprite* findBestImpostorSprite(unsigned int contextID, const osg::Vec3& currLocalEyePoint) const;
95
97 void addImpostorSprite(unsigned int contextID, ImpostorSprite* is);
98
100 inline ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) { return _impostorSpriteListBuffer[contexID]; }
101
103 inline const ImpostorSpriteList& getImpostorSpriteList(unsigned int contexID) const { return _impostorSpriteListBuffer[contexID]; }
104
106
107 protected :
108
109 virtual ~Impostor() {}
110
112
114
116
117};
118
119}
120
121#endif
Definition ImpostorSprite:38
Definition Impostor:65
virtual void traverse(osg::NodeVisitor &nv)
osg::buffered_object< ImpostorSpriteList > _impostorSpriteListBuffer
Definition Impostor:111
const ImpostorSpriteList & getImpostorSpriteList(unsigned int contexID) const
Definition Impostor:103
ImpostorSprite * findBestImpostorSprite(unsigned int contextID, const osg::Vec3 &currLocalEyePoint) const
virtual ~Impostor()
Definition Impostor:109
Impostor(const Impostor &es, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition Impostor:69
ImpostorSprite * createImpostorSprite(osgUtil::CullVisitor *cv)
ImpostorSpriteList & getImpostorSpriteList(unsigned int contexID)
Definition Impostor:100
float getImpostorThreshold() const
Definition Impostor:86
void setImpostorThreshold(float distance)
Definition Impostor:83
void setImpostorThresholdToBound(float ratio=1.0f)
Definition Impostor:91
std::vector< osg::ref_ptr< ImpostorSprite > > ImpostorSpriteList
Definition Impostor:77
META_Node(osgSim, Impostor)
float _impostorThreshold
Definition Impostor:115
void addImpostorSprite(unsigned int contextID, ImpostorSprite *is)
virtual osg::BoundingSphere computeBound() const
Definition CullVisitor:49
Definition BoundingSphere:35
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition LOD:36
Definition NodeVisitor:82
Definition Vec3f:29
Definition buffered_value:79
Definition BlinkSequence:27
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSGSIM_EXPORT
Definition osgSim/Export:38