My Project
Public Member Functions | Static Public Member Functions | List of all members
ParaEngine::IHeadOn3D Class Reference

Some 3d object may contain some head on display objects. More...

#include <IHeadOn3D.h>

Inheritance diagram for ParaEngine::IHeadOn3D:
ParaEngine::CBaseObject ParaEngine::C3DCanvas ParaEngine::CContainerObject ParaEngine::CDynamicObject ParaEngine::CGeosetObject ParaEngine::CManagedLoader ParaEngine::CRenderTarget ParaEngine::CSceneObject ParaEngine::CSphereObject ParaEngine::CTileObject ParaEngine::CWeatherEffect ParaEngine::CZoneNode ParaEngine::WeatherParticleSpawner

Public Member Functions

void SetHeadOnText (const char *sText, int nIndex=0)
 set the text to be displayed on head on display
 
const char * GetHeadOnText (int nIndex=0)
 Get the text to be displayed on head on display.
 
void SetHeadOnUITemplateName (const char *sUIName, int nIndex=0)
 set which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used. More...
 
const char * GetHeadOnUITemplateName (int nIndex=0)
 get which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used. More...
 
const std::string & GetHeadOnUITemplateNameS (int nIndex=0)
 
virtual CGUIBaseGetHeadOnUIObject (int nIndex=0)
 
void SetHeadOnTextColor (DWORD color, int nIndex=0)
 set the text to be displayed on head on display
 
DWORD GetHeadOnTextColor (int nIndex=0)
 Get the text to be displayed on head on display.
 
void SetHeadOnOffest (const Vector3 &vOffset, int nIndex=0)
 set the offset where head on display should be rendered relative to the origin or head of the host 3d object
 
void GetHeadOnOffset (Vector3 *pOut, int nIndex=0)
 Get the offset where head on display should be rendered relative to the origin or head of the host 3d object.
 
void ShowHeadOnDisplay (bool bShow, int nIndex=0)
 show or hide object's head on display
 
bool IsHeadOnDisplayShown (int nIndex=0)
 whether the object head on display shall be visible
 
bool IsHeadOnZEnabled (int nIndex=0)
 whether z buffer test is enabled for Head On display. More...
 
void SetHeadOnZEnabled (bool bZnabled, int nIndex=0)
 set if z buffer test is enabled for Head On display. More...
 
virtual bool HasHeadOnDisplay (int nIndex=0)
 whether the object contains head on display at given index
 
bool IsHeadOn3DScalingEnabled (int nIndex=0)
 Enable 3d scaling. More...
 
void SetHeadOn3DScalingEnabled (bool bZnabled, int nIndex=0)
 Enable 3d scaling.
 
bool IsHeadOnUseGlobal3DScaling (int nIndex=0)
 this is only used when m_bEnable3DScaling. More...
 
void SetHeadOnUseGlobal3DScaling (bool bZnabled, int nIndex=0)
 this is only used when m_bEnable3DScaling. More...
 
void SetHeadOnNearZoomDist (float fValue, int nIndex=0)
 
float GetHeadOnNearZoomDist (int nIndex=0)
 
void SetHeadOnFarZoomDist (float fValue, int nIndex=0)
 
float GetHeadOnFarZoomDist (int nIndex=0)
 
void SetHeadOnMinUIScaling (float fValue, int nIndex=0)
 
float GetHeadOnMinUIScaling (int nIndex=0)
 
void SetHeadOnMaxUIScaling (float fValue, int nIndex=0)
 
float GetHeadOnMaxUIScaling (int nIndex=0)
 
void SetHeadOnAlphaFadePercentage (float fValue, int nIndex=0)
 
float GetHeadOnAlphaFadePercentage (int nIndex=0)
 
void SetHeadOn3DFacing (float fValue, int nIndex=0)
 turn on 3d facing when this function is called
 
float GetHeadOn3DFacing (int nIndex=0)
 

Static Public Member Functions

static bool DrawHeadOnUI (CBaseObject *pObj, int &nCounter, SceneState *pSceneState=NULL, CGUIText **ppObjUITextDefault=NULL, bool bZEnablePass=true, bool b3DTextPass=false)
 draw the headon UI of a specified object. More...
 
static bool BeginPaint (SceneState *pSceneState, bool b3DTextPass, bool bZEnablePass)
 HeadOn UI needs to be drawn between BeginPaint and EndPaint, which is usually automatically when the first and last head on UI is called. More...
 
static void EndPaint (SceneState *pSceneState, bool b3DTextPass)
 

Detailed Description

Some 3d object may contain some head on display objects.

May it be text, icons, or 3D mark, this class provides common interface for such objects. The default implementation is very light-weighted. It only has a pointer and size member storage for object that does not have head on display. each object can have specify multiple head on UI at different index. by default it is index 0.

Member Function Documentation

§ BeginPaint()

bool ParaEngine::IHeadOn3D::BeginPaint ( SceneState pSceneState,
bool  b3DTextPass,
bool  bZEnablePass 
)
static

HeadOn UI needs to be drawn between BeginPaint and EndPaint, which is usually automatically when the first and last head on UI is called.

Hence, one usually do not need to call this method.

§ DrawHeadOnUI()

bool ParaEngine::IHeadOn3D::DrawHeadOnUI ( CBaseObject pObj,
int &  nCounter,
SceneState pSceneState = NULL,
CGUIText **  ppObjUITextDefault = NULL,
bool  bZEnablePass = true,
bool  b3DTextPass = false 
)
static

draw the headon UI of a specified object.

call this function in a loop like below { CGUIText* pObjUITextDefault = NULL; int nCounter = 0; for each obj in a render frame { if(IHeadOn3D::DrawHeadOnUI(&obj, nCounter, &sceneState, &pObjUITextDefault) == false) break; } IHeadOn3D::DrawHeadOnUI(NULL, nCounter); }

Parameters
pObj: if this is NULL, it means the last object. it will stop batch rendering by calling EndPaint()
nCounterboth in and out parameter. if this is 0, it means the start of the character and BeginPaint() is called automatically. this function will automatically increase this value if object is drawn
pSceneStatepointer to a scene state. it can be NULL.
pObjUITextDefaultsee the example above for how to use this. It is the default UI template to use if the object does not provide one.
bZEnablePassif true, we will only draw UI objects with z buffer test enabled. The pipeline will first draw z enabled pass and then non-Z-enabled pass.
b3DTextPasswhether to pass 3d text
Returns
: true if object is drawn.

§ GetHeadOnUITemplateName()

const char * ParaEngine::IHeadOn3D::GetHeadOnUITemplateName ( int  nIndex = 0)

get which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used.

The default UI template is an invisible CGUIText control called "_HeadOnDisplayText_" By default, "_HeadOnDisplayText_" uses horizontal text alignment and system font.

Returns
: it returns NULL if no UI head on display.

§ IsHeadOn3DScalingEnabled()

bool ParaEngine::IHeadOn3D::IsHeadOn3DScalingEnabled ( int  nIndex = 0)

Enable 3d scaling.

the text are scaled according to camera to object distance fScaling = g_fMaxUIScaling - (fDist - g_fNearZoomDist) / (g_fFarZoomDist - g_fNearZoomDist) * (g_fMaxUIScaling-g_fMinUIScaling);

§ IsHeadOnUseGlobal3DScaling()

bool ParaEngine::IHeadOn3D::IsHeadOnUseGlobal3DScaling ( int  nIndex = 0)

this is only used when m_bEnable3DScaling.

if true, we will use parent SceneObject's paramter for 3d scaling, otherwise the local settings are employed

§ IsHeadOnZEnabled()

bool ParaEngine::IHeadOn3D::IsHeadOnZEnabled ( int  nIndex = 0)

whether z buffer test is enabled for Head On display.

default to true.

§ SetHeadOnUITemplateName()

void ParaEngine::IHeadOn3D::SetHeadOnUITemplateName ( const char *  sUIName,
int  nIndex = 0 
)

set which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used.

The default UI template is an invisible CGUIText control called "_HeadOnDisplayText_" By default, "_HeadOnDisplayText_" uses horizontal text alignment and system font.

Parameters
nIndexthere can be several UI template at position 0,1,2,.. so that position 0 may be used for character name, index 1 for group name, index 2 for question mark icon,etc.

§ SetHeadOnUseGlobal3DScaling()

void ParaEngine::IHeadOn3D::SetHeadOnUseGlobal3DScaling ( bool  bZnabled,
int  nIndex = 0 
)

this is only used when m_bEnable3DScaling.

if true, we will use parent SceneObject's paramter for 3d scaling, otherwise the local settings are employed

§ SetHeadOnZEnabled()

void ParaEngine::IHeadOn3D::SetHeadOnZEnabled ( bool  bZnabled,
int  nIndex = 0 
)

set if z buffer test is enabled for Head On display.

default to true.


The documentation for this class was generated from the following files: