OpenCOVER
coVRLabel.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef CO_VR_LABEL
9#define CO_VR_LABEL
10
24// label always faces viewer
25// line is z axis
26//
27// | TEXT
28// |
29// |
30
31#include <osg/Vec3>
32#include <osg/Vec4>
33#include <osg/Array>
34
35namespace osg
36{
37class MatrixTransform;
38class Geode;
39class Geometry;
40};
41
42namespace osgText
43{
44class Text;
45};
46
47#include "coBillboard.h"
48#include <util/coExport.h>
49namespace opencover
50{
51class COVEREXPORT coVRLabel
52{
53
54private:
55 osg::MatrixTransform *posTransform;
56 osg::ref_ptr<coBillboard> billboard;
57 osg::Geode *geode;
58 osgText::Text *text;
59 float offset;
60 osg::Vec3Array *lc, *qc;
61 osg::Geometry *lineGeoset, *quadGeoset;
62 osg::Geode *label;
63 osg::Vec3 position;
64 bool keepPositionInScene;
65 float distanceFromCamera;
66 bool moveToCam;
67 bool depthScale;
68
69 osg::Vec3f moveToCamera(const osg::Vec3f &point, float distance);
70
71public:
72 // creates scene graph
73 //
74 // scene
75 // |
76 // posTransform
77 // |
78 // coBillboard
79 // | |
80 // coText lineGeode
81 // | |
82 // lineGeoset quadGeoset
83 coVRLabel(const char *name, float fontsize, float lineLen, osg::Vec4 fgcolor, osg::Vec4 bgcolor);
85
86 // after construction you may decide to attach posTransform to
87 // a given osg::Group *anchor instead of cover->getScene()
88 // but manipulate the position of the label as if
89 // it were attached to the scene
90
92 // Does not work correctly!!!!!
94
95 void reAttachTo(osg::Group *anchor);
96
97 // position in world coordinates
98 void setPosition(const osg::Vec3 &pos);
99 void setPositionInScene(const osg::Vec3 &pos);
100
101 // move label towards camera to keep above geometry
102 void keepDistanceFromCamera(bool enable, float distanceFromCamera = 50.0f);
103
104 // rotation mode
105 /* enum RotationMode
106 {
107 STOP_ROT = 0,
108 AXIAL_ROT,
109 POINT_ROT_EYE,
110 POINT_ROT_WORLD
111 };*/
112
114 //RotationMode getMode() const;
115
116 // update the linelen
117 void setLineLen(float lineLen);
118
119 // update the label string
120 void setString(const char *name);
121
122 void setFGColor(osg::Vec4 fgc);
123
124 // show label
125 void show();
126
127 // hide label
128 void hide();
129
130 // show line
131 void showLine();
132
133 // hide line
134 void hideLine();
135 // RotationMode _mode;
136
137 void update();
138
139 void setDepthScale(bool s) { depthScale = s; }
140};
141}
142#endif
osg billboard group node
Definition: ARToolKit.h:33
Definition: coClusterStat.h:29
Definition: coVRFileManager.h:44
RotationMode
Definition: coBillboard.h:108
Definition: coVRLabel.h:52
void setLineLen(float lineLen)
void setPositionInScene(const osg::Vec3 &pos)
void setRotMode(coBillboard::RotationMode mode)
void setFGColor(osg::Vec4 fgc)
void keepDistanceFromCamera(bool enable, float distanceFromCamera=50.0f)
void setString(const char *name)
coVRLabel(const char *name, float fontsize, float lineLen, osg::Vec4 fgcolor, osg::Vec4 bgcolor)
void reAttachTo(osg::Group *anchor)
!!!!!!!!!!!
void setPosition(const osg::Vec3 &pos)
void setDepthScale(bool s)
Definition: coVRLabel.h:139