You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.1 KiB
C++
99 lines
2.1 KiB
C++
#ifndef HUDCAMERA_H
|
|
#define HUDCAMERA_H
|
|
|
|
#include <osg/Camera>
|
|
#include <osg/MatrixTransform>
|
|
#include <osgText/String>
|
|
#include <osgText/Text>
|
|
#include "ViewCommon.h"
|
|
using namespace osg;
|
|
|
|
//使用的是坐标系轴
|
|
class HUDAxis : public Camera
|
|
{
|
|
public:
|
|
HUDAxis();
|
|
HUDAxis(const HUDAxis& copy, const CopyOp& copyop = CopyOp::SHALLOW_COPY);
|
|
|
|
META_Node(osg, HUDAxis);
|
|
|
|
double GetAspectRatio();
|
|
|
|
inline void setMainCamera(Camera* camera){ _mainCamera = camera;}
|
|
virtual void traverse(NodeVisitor& nv);
|
|
|
|
protected:
|
|
virtual ~HUDAxis();
|
|
observer_ptr<Camera> _mainCamera;
|
|
};
|
|
|
|
|
|
//使用的是HUD Text(Head Up Display)
|
|
class HUDText : public Camera
|
|
{
|
|
public:
|
|
HUDText();
|
|
HUDText(osg::Camera* masterCamera);
|
|
HUDText(const HUDText& copy, const CopyOp& copyop = CopyOp::SHALLOW_COPY);
|
|
|
|
META_Node(osg, HUDText);
|
|
|
|
void InitText();
|
|
|
|
void setHUDText(wchar_t* str, HUDTextWinPos displayPos, TextAlignmentType alignmentType);
|
|
|
|
void setHUDTextProperties(float charactersize, osg::Vec4 textColor, std::string font);
|
|
|
|
inline void setMainCamera(Camera* camera){ _mainCamera = camera;}
|
|
|
|
protected:
|
|
virtual void traverse(NodeVisitor& nv);
|
|
|
|
osgText::Text::AlignmentType ConvertToOSGAlignment(TextAlignmentType _alignmentType);
|
|
|
|
public:
|
|
osg::ref_ptr<osg::Geode> _geode;
|
|
|
|
protected:
|
|
virtual ~HUDText();
|
|
observer_ptr<Camera> _mainCamera;
|
|
|
|
wchar_t _stringList[3][256];
|
|
std::vector<osgText::Text::AlignmentType> m_AlignmentList;
|
|
|
|
float m_characterSize;
|
|
osg::Vec4 m_textColor;
|
|
std::string m_font;
|
|
};
|
|
|
|
class HUDAnalysis : public Camera
|
|
{
|
|
public:
|
|
enum eAnalysisType{
|
|
OnlyPositive,
|
|
Positive_negative
|
|
};
|
|
HUDAnalysis();
|
|
HUDAnalysis(const HUDAnalysis& copy, const CopyOp& copyop = CopyOp::SHALLOW_COPY);
|
|
|
|
META_Node(osg, HUDAnalysis);
|
|
|
|
void initial();
|
|
|
|
void setData(float mean, float standard);
|
|
void setData(int num, float minVal, float maxVal, float meanVal, float standard);
|
|
|
|
void updatePos(int wid, int hei);
|
|
|
|
void showAnalysis(bool flag);
|
|
protected:
|
|
virtual ~HUDAnalysis();
|
|
osg::ref_ptr<osg::Switch> _switch;
|
|
osg::ref_ptr<osg::Geode> _geode;
|
|
eAnalysisType _type;
|
|
|
|
int _wid;
|
|
int _hei;
|
|
};
|
|
|
|
#endif |