My Project
IHeadOn3D.h
1 #pragma once
2 #include <string>
3 #include <vector>
4 namespace ParaEngine
5 {
6  struct SceneState;
7  class CGUIText;
8  class CBaseObject;
9  using namespace std;
13  struct HeadOn3DData
14  {
15  public:
16  HeadOn3DData();
17 
19  //
20  // UI text info that is displayed on head of character.
21  //
23 
25  string m_sText;
26 
33 
36 
39 
53  //
54  // UI object instance that is displayed on head: this feature is not used at the moment.
55  //
57 #ifdef HEADON_UI_OBJ
58 
60  int m_nUIObjID;
61 #endif
62 
64  bool m_bShow:1;
66  bool m_bZEnable:1;
70  bool m_bEnable3DScaling:1;
72  bool m_bUseGlobal3DScaling:1;
73 
75  bool m_bRender3DText:1;
76  };
77 
84  class IHeadOn3D
85  {
86  public:
87  IHeadOn3D(void);
88  virtual ~IHeadOn3D(void);
89 
90  public:
92  void SetHeadOnText(const char* sText, int nIndex = 0);
93 
95  const char* GetHeadOnText(int nIndex = 0);
96 
103  void SetHeadOnUITemplateName(const char* sUIName, int nIndex = 0);
104 
111  const char* GetHeadOnUITemplateName(int nIndex = 0);
112  const std::string& GetHeadOnUITemplateNameS(int nIndex = 0);
113  virtual CGUIBase* GetHeadOnUIObject(int nIndex = 0);
114 
116  void SetHeadOnTextColor(DWORD color, int nIndex = 0);
117 
119  DWORD GetHeadOnTextColor(int nIndex = 0);
120 
122  void SetHeadOnOffest(const Vector3& vOffset, int nIndex = 0);
123 
125  void GetHeadOnOffset(Vector3* pOut, int nIndex = 0);
126 
128  void ShowHeadOnDisplay(bool bShow, int nIndex = 0);
129 
131  bool IsHeadOnDisplayShown(int nIndex = 0);
132 
134  bool IsHeadOnZEnabled(int nIndex = 0);
135 
137  void SetHeadOnZEnabled(bool bZnabled, int nIndex = 0);
138 
140  virtual bool HasHeadOnDisplay(int nIndex=0);
141 
142 
146  bool IsHeadOn3DScalingEnabled(int nIndex = 0);
147 
149  void SetHeadOn3DScalingEnabled(bool bZnabled, int nIndex = 0);
150 
152  bool IsHeadOnUseGlobal3DScaling(int nIndex = 0);
153 
155  void SetHeadOnUseGlobal3DScaling(bool bZnabled, int nIndex = 0);
156 
157  void SetHeadOnNearZoomDist(float fValue, int nIndex = 0);
158  float GetHeadOnNearZoomDist(int nIndex = 0);
159 
160  void SetHeadOnFarZoomDist(float fValue, int nIndex = 0);
161  float GetHeadOnFarZoomDist(int nIndex = 0);
162 
163  void SetHeadOnMinUIScaling(float fValue, int nIndex = 0);
164  float GetHeadOnMinUIScaling(int nIndex = 0);
165 
166  void SetHeadOnMaxUIScaling(float fValue, int nIndex = 0);
167  float GetHeadOnMaxUIScaling(int nIndex = 0);
168 
169  void SetHeadOnAlphaFadePercentage(float fValue, int nIndex = 0);
170  float GetHeadOnAlphaFadePercentage(int nIndex = 0);
171 
173  void SetHeadOn3DFacing(float fValue, int nIndex = 0);
174  float GetHeadOn3DFacing(int nIndex = 0);
175 
176 #ifdef HEADON_UI_OBJ
177 
178  int GetHeadOnUIObjID(int nIndex);
179 
181  void SetHeadOnUIObjID(int nID, int nIndex);
182 
184  bool HasHeadOnUIObj(int nIndex);
185 #endif
186 
208  static bool DrawHeadOnUI(CBaseObject* pObj, int& nCounter, SceneState* pSceneState = NULL, CGUIText** ppObjUITextDefault = NULL, bool bZEnablePass = true, bool b3DTextPass = false);
209 
213  static bool BeginPaint(SceneState* pSceneState, bool b3DTextPass, bool bZEnablePass);
214  static void EndPaint(SceneState* pSceneState, bool b3DTextPass);
215 
216  private:
220  HeadOn3DData* GetHeadOn3DData(int nIndex=0);
222  inline bool HasDataAt(int nIndex=0) {return ((int)(m_data.size())>nIndex);}
223  private:
224  std::vector<HeadOn3DData> m_data;
225  };
226 
227 }
float m_fAlphaFadePercentage
within which the alpha will change from 1 to 0 at the far end.
Definition: IHeadOn3D.h:49
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
Definition: combase.h:159
different physics engine has different winding order.
Definition: EventBinding.h:32
float m_fMaxUIScaling
the max UI scaling factor.
Definition: IHeadOn3D.h:47
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
This class represents a string inside a rectangular box in the screen coordinates Multiple Type_GUITe...
Definition: GUIText.h:21
base object for all 2D GUI objects (1) 2D GUI object are not tested against view frustum, instead it is controlled by visibility tag automatically or through user input.
Definition: GUIBase.h:54
float m_fFarZoomDist
the camera to object distance where UI scaling is m_fMinUIScaling
Definition: IHeadOn3D.h:43
string m_sText
text to be displayed
Definition: IHeadOn3D.h:25
It is the data structure that holds description data about the head on display.
Definition: IHeadOn3D.h:13
float m_fNearZoomDist
the camera to object distance where UI scaling is m_fMaxUIScaling
Definition: IHeadOn3D.h:41
float m_fMinUIScaling
the min UI scaling factor.
Definition: IHeadOn3D.h:45
string m_sUITemplateName
which UI control the head on display will be used as a template for drawing the text it can be a sing...
Definition: IHeadOn3D.h:32
DWORD m_dwTextColor
the font color.
Definition: IHeadOn3D.h:35
float m_f3DTextFacing
only used when 3d text is used.
Definition: IHeadOn3D.h:51
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
Some 3d object may contain some head on display objects.
Definition: IHeadOn3D.h:84
Vector3 m_vOffset
offset from 3d object&#39;s head or origin.
Definition: IHeadOn3D.h:38