OpenSceneGraph 3.6.5
ProxyNode
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 OSG_ProxyNode
15#define OSG_ProxyNode 1
16
17#include <osg/Group>
18
19namespace osg {
20
24{
25 public :
26
28
31
33
36
37 virtual void traverse(NodeVisitor& nv);
38
40
41 virtual bool addChild(Node *child);
42
43 virtual bool addChild(Node *child, const std::string& filename);
44
45 template<class T> bool addChild( const ref_ptr<T>& child, const std::string& filename) { return addChild(child.get(), filename); }
46
47 virtual bool removeChildren(unsigned int pos,unsigned int numChildrenToRemove);
48
49
52
55
57 const osg::Referenced* getDatabaseOptions() const { return _databaseOptions.get(); }
58
59
61 void setDatabasePath(const std::string& path);
63 inline const std::string& getDatabasePath() const { return _databasePath; }
64
65 void setFileName(unsigned int childNo, const std::string& filename) { expandFileNameListTo(childNo); _filenameList[childNo].first=filename; }
66 const std::string& getFileName(unsigned int childNo) const { return _filenameList[childNo].first; }
67 unsigned int getNumFileNames() const { return _filenameList.size(); }
68
73 osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) { return _filenameList[childNo].second; }
74
76 const osg::ref_ptr<osg::Referenced>& getDatabaseRequest(unsigned int childNo) const { return _filenameList[childNo].second; }
77
78
86
89
92
100
103
106
110
113
114
117 inline void setRadius(value_type radius) { _radius = radius; }
118
120 inline value_type getRadius() const { return _radius; }
121
123
124 protected :
125
126 virtual ~ProxyNode() {}
127
128 void expandFileNameListTo(unsigned int pos);
129
130 typedef std::pair< std::string, osg::ref_ptr<osg::Referenced> > FileNameDatabaseRequestPair;
131 typedef std::vector<FileNameDatabaseRequestPair> FileNameDatabaseRequestList;
132
135 std::string _databasePath;
136
138
142
143};
144
145}
146
147#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
BoundingSphered BoundingSphere
Definition BoundingSphere:308
Vec3d vec_type
Definition BoundingSphere:37
Vec3d::value_type value_type
Definition BoundingSphere:38
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
virtual bool addChild(Node *child)
Add Node to Group.
Base class for all internal nodes in the scene graph.
Definition Node:72
const BoundingSphere & getBound() const
Definition Node:425
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
bool addChild(const ref_ptr< T > &child, const std::string &filename)
Definition ProxyNode:45
const std::string & getFileName(unsigned int childNo) const
Definition ProxyNode:66
vec_type _userDefinedCenter
Definition ProxyNode:140
LoadingExternalReferenceMode
Modes which control how the proxynode external reference are loaded.
Definition ProxyNode:95
@ DEFER_LOADING_TO_DATABASE_PAGER
Definition ProxyNode:97
@ LOAD_IMMEDIATELY
Definition ProxyNode:96
@ NO_AUTOMATIC_LOADING
Definition ProxyNode:98
virtual void traverse(NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
void setLoadingExternalReferenceMode(LoadingExternalReferenceMode mode)
Set how the child loading is done.
Definition ProxyNode:102
CenterMode _centerMode
Definition ProxyNode:139
const vec_type & getCenter() const
Return the ProxyNode center point.
Definition ProxyNode:112
unsigned int getNumFileNames() const
Definition ProxyNode:67
ProxyNode(const ProxyNode &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setCenter(const vec_type &center)
Sets the object-space point which defines the center of the osg::ProxyNode.
Definition ProxyNode:109
value_type _radius
Definition ProxyNode:141
virtual BoundingSphere computeBound() const
Compute the bounding sphere around Node's geometry or children.
void setDatabaseOptions(osg::Referenced *options)
Set the optional database osgDB::Options object to use when loading children.
Definition ProxyNode:51
void expandFileNameListTo(unsigned int pos)
void setDatabasePath(const std::string &path)
Set the database path to prepend to children's filenames.
osg::BoundingSphere::vec_type vec_type
Definition ProxyNode:34
CenterMode getCenterMode() const
Get how the center of object should be determined when computing which child is active.
Definition ProxyNode:91
const std::string & getDatabasePath() const
Get the database path used to prepend to children's filenames.
Definition ProxyNode:63
virtual ~ProxyNode()
Definition ProxyNode:126
virtual bool addChild(Node *child)
Add Node to Group.
LoadingExternalReferenceMode getLoadingExternalReferenceMode() const
Get the loading mode.
Definition ProxyNode:105
FileNameDatabaseRequestList _filenameList
Definition ProxyNode:133
ref_ptr< Referenced > _databaseOptions
Definition ProxyNode:134
osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo)
Return the DatabaseRequest object used by the DatabasePager to keep track of file load requests being...
Definition ProxyNode:73
virtual bool removeChildren(unsigned int pos, unsigned int numChildrenToRemove)
Remove children from Group.
virtual bool addChild(Node *child, const std::string &filename)
const osg::Referenced * getDatabaseOptions() const
Get the optional database osgDB::Options object used when loading children.
Definition ProxyNode:57
std::pair< std::string, osg::ref_ptr< osg::Referenced > > FileNameDatabaseRequestPair
Definition ProxyNode:130
CenterMode
Modes which control how the center of object should be determined when computing which child is activ...
Definition ProxyNode:81
@ USE_BOUNDING_SPHERE_CENTER
Definition ProxyNode:82
@ USER_DEFINED_CENTER
Definition ProxyNode:83
@ UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED
Definition ProxyNode:84
LoadingExternalReferenceMode _loadingExtReference
Definition ProxyNode:137
osg::Referenced * getDatabaseOptions()
Get the optional database osgDB::Options object used when loading children.
Definition ProxyNode:54
void setFileName(unsigned int childNo, const std::string &filename)
Definition ProxyNode:65
const osg::ref_ptr< osg::Referenced > & getDatabaseRequest(unsigned int childNo) const
Return the const DatabaseRequest object.
Definition ProxyNode:76
META_Node(osg, ProxyNode)
void setCenterMode(CenterMode mode)
Set how the center of object should be determined when computing which child is active.
Definition ProxyNode:88
value_type getRadius() const
Get the object-space radius of the volume enclosed by the ProxyNode.
Definition ProxyNode:120
std::string _databasePath
Definition ProxyNode:135
void setRadius(value_type radius)
Set the object-space reference radius of the volume enclosed by the ProxyNode.
Definition ProxyNode:117
osg::BoundingSphere::value_type value_type
Definition ProxyNode:35
std::vector< FileNameDatabaseRequestPair > FileNameDatabaseRequestList
Definition ProxyNode:131
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Base class for providing reference counted objects.
Definition Referenced:44
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.