openscenegraph
Cursor
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 OSGPRESENTATION_CURSOR
15#define OSGPRESENTATION_CURSOR 1
16
17#include <osg/AutoTransform>
18#include <osg/Camera>
19#include <osgPresentation/Export>
20
21namespace osgPresentation {
22
23class OSGPRESENTATION_EXPORT Cursor : public osg::Group
24{
25 public:
26
27 Cursor();
28
29 Cursor(const std::string& filename, float size);
30
31 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
32 Cursor(const Cursor& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
33
34 META_Node(osgPresentation, Cursor)
35
36 void setFilename(const std::string& filename) { _filename = filename; _cursorDirty=true; }
37 const std::string& getFilename() const { return _filename; }
38
39 void setSize(float size) { _size = size; _cursorDirty=true; }
40 float getSize() const { return _size; }
41
42 virtual void traverse(osg::NodeVisitor& nv);
43
44 protected:
45
46 virtual ~Cursor();
47
48 void initializeCursor();
49 void updatePosition();
50
51 std::string _filename;
52 float _size;
53
54 bool _cursorDirty;
55
56 osg::ref_ptr<osg::AutoTransform> _transform;
57
58 osg::Vec2 _cursorXY;
59 osg::observer_ptr<osg::Camera> _camera;
60
61};
62
63}
64
65#endif