12 namespace Visualization
24 m_aryColor.Set(1, 1, 1, 1);
25 m_ptPosition.Set(10,10, 0);
26 m_strFont =
"fonts/arial.ttf";
29 m_lpDisplayData = NULL;
30 m_lpUpdateData = NULL;
31 m_fltUpdateInterval = 1;
48 OsgHudText::OsgHudText(
float *aryColor, CStdFPoint &ptPosition, std::string strFont,
int iCharSize, std::string strText, std::string strDisplayTargetID, std::string strDisplayDataType, std::string strUpdateTargetID, std::string strUpdateDataType,
float fltUpdateInterval)
50 m_aryColor.Set(aryColor[0], aryColor[1], aryColor[2], aryColor[3]);
51 m_ptPosition = ptPosition;
53 m_iCharSize = iCharSize;
55 m_lpDisplayData = NULL;
56 m_lpUpdateData = NULL;
57 m_strDisplayTargetID = strDisplayTargetID;
58 m_strDisplayDataType = strDisplayDataType;
59 m_strUpdateTargetID = strUpdateTargetID;
60 m_strUpdateDataType = strUpdateDataType;
61 m_fltUpdateInterval = fltUpdateInterval;
76 HudText::Initialize(lpVoidProjection);
79 osg::Projection *lpProjection = (osg::Projection *) (lpVoidProjection);
81 THROW_PARAM_ERROR(Osg_Err_lHudProjectionNotDefined, Osg_Err_strHudProjectionNotDefined,
"ID",
m_strID);
83 m_osgText =
new osgText::Text;
84 m_osgText->setDataVariance(osg::Object::DYNAMIC);
85 m_osgText->setColor(osg::Vec4(m_aryColor[0], m_aryColor[1], m_aryColor[2], m_aryColor[3]));
86 m_osgText->setPosition(osg::Vec3(m_ptPosition.x, m_ptPosition.y, m_ptPosition.z));
87 m_osgText->setFont(m_strFont.c_str());
88 m_osgText->setCharacterSize(m_iCharSize);
89 m_osgText->setText(
"");
91 m_osgGeode =
new osg::Geode;
92 m_osgGeode->addDrawable(m_osgText.get());
93 lpProjection->addChild(m_osgGeode.get());
101 void OsgHudText::Update()
105 if(m_osgText.valid() && m_lpDisplayData && m_lpUpdateData && (fabs(*m_lpUpdateData-m_fltPrevious) > 0.1) )
107 sprintf(str, m_strText.c_str(), *m_lpDisplayData);
108 m_osgText->setText(str);
109 m_fltPrevious = *m_lpUpdateData;
virtual ~OsgHudText()
Destructor.
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
virtual void Initialize()
Initializes this object.
std::string m_strID
The unique Id for this object.
virtual void ResetSimulation()
Resets the simulation back to time 0.
Declares the vortex heads-up display text class.
OsgHudText()
Default constructor.