The HBhvTargetObject class encapsulates various target types for animations and sensors. More...

#include <HBhvBehaviorManager.h>

Public Member Functions

void FlagForCollision ()
 
HBhvCameraType GetCameraType ()
 
bool GetCollision ()
 
const char * GetName ()
 
const char * GetPath ()
 
void GetPivot (HPoint &pv)
 
HPointGetPivot ()
 
const char * GetResolvedPath ()
 
HC_KEY GetTargetKey ()
 
const char * GetType ()
 
bool HasMoved ()
 
 HBhvTargetObject (HBhvBehaviorManager *behaviourmanager, const char *name, const char *path, HPoint *pivot=0)
 
bool IsEqual (const char *target)
 
void ResetForCollision ()
 
void Serialize (HUtilityXMLGenerator *xmlgen)
 
void SetCollision (bool collision)
 
void SetPivot (HPoint pv)
 
void SetPivot (float x, float y, float z)
 
void SetSerializeFromKey (bool sfk)
 
void SetTargetKey (HC_KEY key)
 

Static Public Member Functions

static void CreateTargetString (const char *type, const char *path, char *result, bool addquotes=false)
 
static void ResolveTarget (const char *in, char *result, char *targettype, HBaseModel *model, HBhvCameraType &ctype)
 
static void * XMLCallback (HUtilityXMLTag *xt, bool open, void *m_pExtraData)
 

Static Protected Member Functions

static void CollapseTarget (const char *target, char *collapsedtarget)
 

Protected Attributes

bool m_bCollision
 
bool m_bHasMoved
 
bool m_bSerializeFromKey
 
HBhvCameraType m_CameraType
 
HC_KEY m_key
 
char m_Name [MVO_SMALL_BUFFER_SIZE]
 
char m_Path [MVO_SEGMENT_PATHNAME_BUFFER]
 
HBhvBehaviorManagerm_pBehaviorManager
 
HPoint m_Pivot
 
char m_ResolvedPath [MVO_SEGMENT_PATHNAME_BUFFER]
 
char m_Type [MVO_SMALL_BUFFER_SIZE]
 

Detailed Description

The HBhvTargetObject class encapsulates various target types for animations and sensors.

HBhvTargetObject is mainly used in conjunction with animations and sensors to describe a segment path in the HOOPS database but it can also point to a named animation or sensor. The target string consists of the target type followed by the target descriptor.

"HKEY: " : A unique key identifying the object
Example: Target = "HKEY: 123"

"SPATH:" : A segment path corresponding to the HSF segment structure. SCENE and MODEL are reserved keywords (they refer to the model segment and scene segment as defined in MVO). Specifying SCENE as the segment name can be useful to make global color changes or to do camera movement. "CAMERAPOS" and "CAMERATARGET" are reserved keywords that refer to the camera of the scene. Translation and quaternion rotation will be applied to the camera position/orientation. Camera manipulation will usually require separate animations performed in conjunction. One for the camera movement (using the POS interpolator), one for the camera orientation (using QUAT or EULER) and one for zooming in/out (using the scale interpolator). For "orbit" types of camera animation it is usually preferable to animate the cameratarget, while for walkthroughs the camera position should be used. The camera keywords can appear at the end of a target statement.This is useful if multiple cameras in the scene need to be manipulated.
Examples:
Target = "SPATH: MODEL/car/wheel1"
Target = "SPATH: SCENE/CAMERATARGET"

"ANIM:" The name of an animation tag
Example: Target = "ANIM: a1"

"SSR:" The name of a Sensor tag
Example: Target = "SSR: s1"

Constructor & Destructor Documentation

◆ HBhvTargetObject()

HBhvTargetObject::HBhvTargetObject ( HBhvBehaviorManager behaviourmanager,
const char *  name,
const char *  path,
HPoint pivot = 0 
)

Constructs an HBhvTargetObject object.

Parameters
behaviourmanagerA pointer to HBhvBehaviorManager object that is associated with this target object.
nameThe name of target object.
pathThe target description. You can use CreateTargetString to generate the path for this target object.
pivotSets the center of rotation if the target object is a segment in the HOOPS segment hierachy

Member Function Documentation

◆ CollapseTarget()

static void HBhvTargetObject::CollapseTarget ( const char *  target,
char *  collapsedtarget 
)
staticprotected

This method is for internal use only.

◆ CreateTargetString()

static void HBhvTargetObject::CreateTargetString ( const char *  type,
const char *  path,
char *  result,
bool  addquotes = false 
)
static

This utitlity method combines a target type and path to one target into one string. The generated name can be used as an identifier to pass to the method IsEqual() and the methods HBhvBehaviorManager::AddAnimation and HBhvBehaviorManager::FindAnimation to identify a target by a string.

Parameters
typeThe type of the target such as HKEY, SPATH, ANIM or SSR(sensor).
pathIf the type is SPATH, path is the path to the segment. If the type is HKEY, then path is the unique HKEY identifier. If type is ANIM or SSR, then pass a the name.
resultReturns a pointer to the combined target string.
addquotesPass true if target string should be enclosed by quotation marks or false if you don't want quotes.

◆ FlagForCollision()

void HBhvTargetObject::FlagForCollision ( )
inline

Call this method to indicate that this object has moved and should be checked for collision with other objects.

◆ GetCameraType()

HBhvCameraType HBhvTargetObject::GetCameraType ( )
inline
Returns
The camera type for this target object.

◆ GetCollision()

bool HBhvTargetObject::GetCollision ( )
inline
Returns
Returns true if the target should be evaluated for collisions.

◆ GetName()

const char* HBhvTargetObject::GetName ( )
inline
Returns
The name of this target object.

◆ GetPath()

const char* HBhvTargetObject::GetPath ( )
inline
Returns
The path associated with this target object. Aliases are not expanded.

◆ GetPivot() [1/2]

void HBhvTargetObject::GetPivot ( HPoint pv)
inline

Returns the center of rotation for the target object.

◆ GetPivot() [2/2]

HPoint* HBhvTargetObject::GetPivot ( )
inline
Returns
Center of rotation for target object.

◆ GetResolvedPath()

const char* HBhvTargetObject::GetResolvedPath ( )
inline
Returns
The path of target object with aliases fully expanded and no type descriptor.

◆ GetTargetKey()

HC_KEY HBhvTargetObject::GetTargetKey ( )
Returns
The key of target object if applicable.

◆ GetType()

const char* HBhvTargetObject::GetType ( )
inline
Returns
Type of target object. This can be HKEY, ANIM for animation, SPATH for segment and SSR for sensor.

◆ HasMoved()

bool HBhvTargetObject::HasMoved ( )
inline
Returns
True if the object has moved during a particular animation slice or false if it has not.

◆ IsEqual()

bool HBhvTargetObject::IsEqual ( const char *  target)

Compares this target object with another one to determine equality.

Parameters
targetPass a target descriptor string. You can generate this string using the CreateTargetString method.
Returns
False if they are not equal or true if they are equal.

◆ ResetForCollision()

void HBhvTargetObject::ResetForCollision ( )
inline

Call this method indicates this object has not moved and does not need to be checked for collisions with other objects.

◆ ResolveTarget()

static void HBhvTargetObject::ResolveTarget ( const char *  in,
char *  result,
char *  targettype,
HBaseModel model,
HBhvCameraType ctype 
)
static

Given an unexpanded target descriptor, this method returns the corresponding HOOPS segment path, target type and camera type for this target object.

Parameters
inThe target string to evaluate.
resultReturns the expanded target string.
targettypeReturns the type of target.
modelPointer to HBaseModel object.
ctypeReturns the camera type.

◆ Serialize()

void HBhvTargetObject::Serialize ( HUtilityXMLGenerator *  xmlgen)

Writes the XML data for this target object.

Parameters
xmlgenA pointer to the xml generator that creates correct xml blocks

◆ SetCollision()

void HBhvTargetObject::SetCollision ( bool  collision)
inline

This method allows you to indicate if you want this object to be evaluated for collisions. Any collision between this object and the environment will trigger a HAnimationListener::ObjectCollisionEvent event, which can in turn be received by any class deriving from HAnimationListener. This allows an application to be aware of inter-object collisions during an animation and provide visual feedback on the (typically by highlighting the collided objects).

Parameters
collisionPass true if you want this object to be evaluated for collision.

◆ SetPivot() [1/2]

void HBhvTargetObject::SetPivot ( HPoint  pv)
inline

Sets the center of rotation for this target object.

Parameters
pvThe pivot point.

◆ SetPivot() [2/2]

void HBhvTargetObject::SetPivot ( float  x,
float  y,
float  z 
)
inline

Sets the center of rotation for the target object.

Parameters
xThe x coordinate position of the pivot point.
yThe y coordinate position of the pivot point.
zThe z coordinate position of the pivot point.

◆ XMLCallback()

static void* HBhvTargetObject::XMLCallback ( HUtilityXMLTag *  xt,
bool  open,
void *  m_pExtraData 
)
static

This is XML read callback which parses XML data and then populates the member variables with the associated values.

Member Data Documentation

◆ m_bCollision

bool HBhvTargetObject::m_bCollision
protected

A flag indicating if this object should be evaluated for collisions.

◆ m_bHasMoved

bool HBhvTargetObject::m_bHasMoved
protected

A flag indicating if object has moved during one animation slice.

◆ m_CameraType

HBhvCameraType HBhvTargetObject::m_CameraType
protected

The type of camera.

◆ m_key

HC_KEY HBhvTargetObject::m_key
protected

The key of target object.

◆ m_Name

char HBhvTargetObject::m_Name[MVO_SMALL_BUFFER_SIZE]
protected

The name of this target object.

◆ m_Path

char HBhvTargetObject::m_Path[MVO_SEGMENT_PATHNAME_BUFFER]
protected

The unresolved path.

◆ m_pBehaviorManager

HBhvBehaviorManager* HBhvTargetObject::m_pBehaviorManager
protected

A pointer to BehaviorManager object that this animation belongs to.

◆ m_Pivot

HPoint HBhvTargetObject::m_Pivot
protected

The center of rotation.

◆ m_ResolvedPath

char HBhvTargetObject::m_ResolvedPath[MVO_SEGMENT_PATHNAME_BUFFER]
protected

The resolved path.

◆ m_Type

char HBhvTargetObject::m_Type[MVO_SMALL_BUFFER_SIZE]
protected

The target type.


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