OpenSceneGraph 3.6.5
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
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
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec3f Vec3
Definition Vec3:21
BoundingSphered BoundingSphere
Definition BoundingSphere:308
The osgSim library is a NodeKit that extends the core scene graph to support nodes and drawables that...
Definition BlinkSequence:27
Definition buffered_value:79
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
LOD - Level Of Detail group node which allows switching between children depending on distance from e...
Definition LOD:36
LOD()
Default constructor The default constructor sets.
const BoundingSphere & getBound() const
Definition Node:425
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
virtual void traverse(osg::NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
osg::buffered_object< ImpostorSpriteList > _impostorSpriteListBuffer
Definition Impostor:111
const ImpostorSpriteList & getImpostorSpriteList(unsigned int contexID) const
Get a const list of ImpostorSprites attached to this const Impostor.
Definition Impostor:103
ImpostorSprite * findBestImpostorSprite(unsigned int contextID, const osg::Vec3 &currLocalEyePoint) const
Find the ImposterSprite which fits the current eye point best.
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)
Get the list of ImpostorSprites attached to this Impostor.
Definition Impostor:100
float getImpostorThreshold() const
Definition Impostor:86
void setImpostorThreshold(float distance)
Set the Impostor threshold distance.
Definition Impostor:83
void setImpostorThresholdToBound(float ratio=1.0f)
Set the Impostor threshold distance relative to the node's bounding sphere's radius.
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)
Add an ImpostorSprite to the Impostor.
virtual osg::BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
An ImposterSprite is a textured quad which is rendered in place of 3D geometry.
Definition ImpostorSprite:38
Basic NodeVisitor implementation for rendering a scene.
Definition CullVisitor:49
#define OSGSIM_EXPORT
Definition Export:38

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.