一、osgText::Text文字类
1、void setFont (Font *font=0)
说明:设置字体,虽然说字体有单独的类,但是很少使用,但是字体贴图是在这个阶段形成的
2、void setFont (const std::string &fontfile)
const Font * getFont () const
说明:设置/得到字体,如setFont("fonts/SIMYOU.TTF");
3、void setFontResolution (unsigned int width, unsigned int height)
unsigned int getFontWidth () const
unsigned int getFontHeight () const
说明:设置/得到字体显示的宽高
4、void setText (const String &text)
void setText (const std::string &text)
void setText (const std::string &text, String::Encoding encoding)
void setText (const wchar_t *text)
String & getText ()
const String & getText () const
说明:设置/得到文字的具体内容
5、void update ()
说明:更新
6、void setCharacterSize (float height, float aspectRatio=1.0f)
float getCharacterHeight () const
说明:设置/得到字体的大小,以及比率,一般后一个参数不会使用,否则会失真(改变高宽比)
7、float getCharacterAspectRatio () const
说明:得到文字的高宽比
8、void setCharacterSizeMode (CharacterSizeMode mode)
CharacterSizeMode getCharacterSizeMode () const
说明:设置/设置字体大小模式,决定字体是否随着距离的改变大小形状是否会改变。
9、void setMaximumWidth (float maximumWidth)
float getMaximumWidth () const
void setMaximumHeight (float maximumHeight)
float getMaximumHeight () const
说明:设置/得到高宽,这将固字字体的显示范围
10、void setPosition (const osg::Vec3 &pos)
const osg::Vec3 & getPosition () const
说明:设置/得到字体的显示位置
11、void setAlignment (AlignmentType alignment)
AlignmentType getAlignment () const
说明:设置/得到摆放方式,从左到右LEFT_TO_RIGHT ,从右到左RIGHT_TO_LEFT ,垂直VERTICAL
12、void setAxisAlignment (AxisAlignment axis)
说明:设置依赖平面,XY_PLANE 表示XY平面,等等
13、void setRotation (const osg::Quat &quat)
const osg::Quat & getRotation () const
说明:设置/得到旋转
14、void setAutoRotateToScreen (bool autoRotateToScreen)
bool getAutoRotateToScreen () const
说明:设置/得到是否自动面朝屏幕,有Billboard的意思
15、void setLayout (Layout layout)
Layout getLayout () const
说明:设置/得到排列方式从左到右LEFT_TO_RIGHT ,从右到左RIGHT_TO_LEFT ,垂直VERTICAL
16、void setColor (const osg::Vec4 &color)
const osg::Vec4 & getColor () const
说明:设置/得到颜色
17、void setBackdropType (BackdropType type)
BackdropType getBackdropType () const
说明:设置/得到阴影类型
18、void setBackdropOffset (float offset=0.07f)
void setBackdropOffset (float horizontal, float vertical)
float getBackdropHorizontalOffet () const
float getBackdropVerticalOffset () const
说明:设置/得到阴影的离开程度与方向
19、void setBackdropColor (const osg::Vec4 &color)
const osg::Vec4 & getBackdropColor () const
说明:设置/得到阴影颜色
20、void setBackdropImplementation (BackdropImplementation implementation)
BackdropImplementation getBackdropImplementation () const
说明:设置阴影实现方式
21、void setColorGradientMode (ColorGradientMode mode)
ColorGradientMode getColorGradientMode () const
void setColorGradientCorners (const osg::Vec4 &topLeft, const osg::Vec4 &bottomLeft, const osg::Vec4 &bottomRight, const osg::Vec4 &topRight)
const osg::Vec4 & getColorGradientTopLeft () const
const osg::Vec4 & getColorGradientBottomLeft () const
const osg::Vec4 & getColorGradientBottomRight () const
const osg::Vec4 & getColorGradientTopRight () const
说明:设置/得到颜色映射方式,可以得到渐变效果
22、virtual osg::BoundingBox computeBound () const
说明:得到BoundingBox
23、Text ()
Text (const Text &text, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
说明:构造函数,第二个为从已知的text构造新的text.拷贝方式默认为浅拷贝。可以为深拷贝。DEEP_COPY_OBJECTS
24、virtual Object * cloneType () const
说明:从一个已有text来克隆一个新的object,并返回该object指针。
25、virtual Object * clone (const CopyOp ©op) const
说明:从一个已有的text来克隆一个新的object,并返回该object指针,参数为克隆类型。克隆类型,可以是SHALLOW_COPY[浅拷贝],也可以是DEEP_COPY_OBJECTS[深拷贝]。
26、virtual bool isSameKindAs (const Object *obj) const
说明:与参数中的类型是否为同一类型,若为同一类型则返回真,否则返回假。判断此obj类型是否与调用函数的this类为同一类型。
27、virtual const char * libraryName () const
说明:得到类的库名。返回库名的指针。
28、virtual const char * className () const
说明:返回类名称,得到类名称指针。
29、void setFont (Font *font=0)
void setFont (const std::string &fontfile)
说明:设置字体,如setFont("fonts/SIMYOU.TTF");fonts是data文件夹下的文件夹
30、const Font * getFont () const
说明:得到设置的字体
31、void setFontResolution (unsigned int width, unsigned int height)
说明:设置字体显示的宽高
32、unsigned int getFontWidth ()
const unsigned int getFontHeight () const
说明:得到字体显示的宽高
33、void setText (const String &text)
void setText (const std::string &text)
void setText (const std::string &text, Stri ng::Encoding encoding)
void setText (const wchar_t *text)
说明:设置文字的具体内容,text为设置字体内容的串。encoding为设置编码方式:
(1)ENCODING_UNDEFINED
(2)ENCODING_ASCII 表示不使用Unicode
(3)ENCODING_UTF8 表示使用UTF8编码
(4)ENCODING_UTF16 表示使用UTF16编码
(5)ENCODING_UTF16_BE
(6)ENCODING_UTF16_LE
(7)ENCODING_UTF32
(8)ENCODING_UTF32_BE
(9)ENCODING_UTF32_LE
(10)ENCODING_SIGNATURE
34、String & getText ()
const String & getText () const
说明:得到设置HUD的字符串。
35、void update ()
说明:更新
36、void setCharacterSize (float height, float aspectRatio=1.0f)
说明:设置字体的大小,以及比率,一般后一个参数不会使用,否则会失真(改变高宽比)
37、float getCharacterHeight () const
说明:得到字体的高度
38、float getCharacterAspectRatio () const
说明:得到文字的高宽比
39、void setCharacterSizeMode (CharacterSizeMode mode)
说明:设置字体大小模式,决定字体是否随着距离的改变大小形状是否会改变。字体大小模式OBJECT_COORDS,SCREEN_COORDS,OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT
40、CharacterSizeMode getCharacterSizeMode () const
说明:得到字体大小模式。
41、void setMaximumWidth (float maximumWidth)
说明:设置字体的宽度,这将固定字体的显示范围
42、float getMaximumWidth () const
说明:得到字体的宽度。
43、void setMaximumHeight (float maximumHeight)
说明:设置字体的高度。
44、float getMaximumHeight () const
说明:得到字体的高度。
45、void setPosition (const osg::Vec3 &pos)
说明:设置字体的显示位置。
46、const osg::Vec3 & getPosition () const
说明:得到字体的显示位置。
47、void setAlignment (AlignmentType alignment)
说明:设置摆放方式,从左到右LEFT_TO_RIGHT ,从右到左RIGHT_TO_LEFT ,垂直VERTICAL
48、AlignmentType getAlignment () const
说明:得到摆放方式
49、void setAxisAlignment (AxisAlignment axis)
说明:设置依赖平面,XY_PLANE 表示XY平面,等等,设置字体的依赖平面: XY_PLANE,REVERSED_XY_PLANE,XZ_PLANE,REVERSED_XZ_PLANE,YZ_PLANE,REVERSED_YZ_PLANE,SCREEN,USER_DEFINED_ROTATION
50、void setRotation (const osg::Quat &quat)
说明:设置旋转
51、const osg::Quat & getRotation () const
说明:得到旋转
52、void setAutoRotateToScreen (bool autoRotateToScreen)
说明:设置是否自动面朝屏幕,有Billboard的意思,如果为真则字体会始终面向屏幕。
53、bool getAutoRotateToScreen () const
说明:得到文字是否自动面朝屏幕
54、void setLayout (Layout layout)
说明:设置排列方式从左到右LEFT_TO_RIGHT ,从右到左RIGHT_TO_LEFT ,垂直VERTICAL
55、Layout getLayout () const
说明:得到字体的排列方式。从左到右LEFT_TO_RIGHT ,从右到左RIGHT_TO_LEFT ,垂直VERTICAL
56、void setColor (const osg::Vec4 &color)
说明:设置颜色
57、const osg::Vec4 & getColor () const
说明:得到文字颜色
58、void setBackdropType (BackdropType type)
说明:设置阴影类型。阴影类型:DROP_SHADOW_BOTTOM_RIGHT,DROP_SHADOW_CENTER_RIGHT,DROP_SHADOW_TOP_RIGHT, DROP_SHADOW_BOTTOM_CENTER,OUTLINE,NONE DROP_SHADOW_TOP_CENTER,DROP_SHADOW_BOTTOM_LEFT,DROP_SHADOW_CENTER_LEFT, DROP_SHADOW_TOP_LEFT
59、BackdropType getBackdropType () const
说明:得到阴影类型。
60、void setBackdropOffset (float offset=0.07f)
void setBackdropOffset (float horizontal, float vertical)
说明:设置阴影的离开程度与方向,offset为阴影的离开指数。默认为0.07。horizontal为水平方向。vertical为竖直方向。
61、float getBackdropHorizontalOffet ()
const float getBackdropVerticalOffset () const
说明:得到阴影的水平离开方向与竖直离开方向。
62、void setBackdropColor (const osg::Vec4 &color)
说明:设置阴影颜色
63、const osg::Vec4 & getBackdropColor () const
说明:得到阴影颜色。
64、void setBackdropImplementation (BackdropImplementation implementation)
说明:设置阴影实现方式,设置阴影实现方式,可以为以下值:POLYGON_OFFSET,NO_DEPTH_BUFFER,DEPTH_RANGE,STENCIL_BUFFER
65、BackdropImplementation getBackdropImplementation () const
说明:得到阴影的实现方式
66、void setColorGradientMode (ColorGradientMode mode)
说明:设置颜色映射方式,可以得到渐变效果,渐变效果实现方式:SOLID,PER_CHARACTER,OVERALL
67、ColorGradientMode getColorGradientMode () const
说明:得到渐变效果的模式。
68、void setColorGradientCorners (const osg::Vec4 &topLeft, const osg::Vec4 &bottomLeft, const osg::Vec4 &bottomRight, const osg::Vec4 &topRight)
说明:设置四角颜色渐变。topLeft左上角的颜色值,RGBA,bottomLeft左下角的颜色值, RGBA,bottomRight右下角的颜色值,RGBA,topRight右上角的颜色值,RGBA
69、const osg::Vec4 & getColorGradientTopLeft ()
const const osg::Vec4 & getColorGradientBottomLeft () const
const osg::Vec4 & getColorGradientBottomRight () const
const osg::Vec4 & getColorGradientTopRight () const
说明:得到四个角的颜色值。
70、virtual osg::BoundingBox computeBound () const
说明:得到BoundingBox