The HBhvTargetObject class encapsulates various target types for animations and sensors.
More...
#include <HBhvBehaviorManager.h>
|
static void | CollapseTarget (const char *target, char *collapsedtarget) |
|
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"
◆ HBhvTargetObject()
HBhvTargetObject::HBhvTargetObject |
( |
HBhvBehaviorManager * |
behaviourmanager, |
|
|
const char * |
name, |
|
|
const char * |
path, |
|
|
HPoint * |
pivot = 0 |
|
) |
| |
Constructs an HBhvTargetObject object.
- Parameters
-
behaviourmanager | A pointer to HBhvBehaviorManager object that is associated with this target object. |
name | The name of target object. |
path | The target description. You can use CreateTargetString to generate the path for this target object. |
pivot | Sets the center of rotation if the target object is a segment in the HOOPS segment hierachy |
◆ 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
-
type | The type of the target such as HKEY, SPATH, ANIM or SSR(sensor). |
path | If 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. |
result | Returns a pointer to the combined target string. |
addquotes | Pass 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()
- 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
-
target | Pass 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
-
in | The target string to evaluate. |
result | Returns the expanded target string. |
targettype | Returns the type of target. |
model | Pointer to HBaseModel object. |
ctype | Returns the camera type. |
◆ Serialize()
void HBhvTargetObject::Serialize |
( |
HUtilityXMLGenerator * |
xmlgen | ) |
|
Writes the XML data for this target object.
- Parameters
-
xmlgen | A 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
-
collision | Pass 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
-
◆ SetPivot() [2/2]
void HBhvTargetObject::SetPivot |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
|
inline |
Sets the center of rotation for the target object.
- Parameters
-
x | The x coordinate position of the pivot point. |
y | The y coordinate position of the pivot point. |
z | The 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.
◆ 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
◆ 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 |
◆ m_pBehaviorManager
A pointer to BehaviorManager object that this animation belongs to.
◆ m_Pivot
HPoint HBhvTargetObject::m_Pivot |
|
protected |
◆ m_ResolvedPath
char HBhvTargetObject::m_ResolvedPath[MVO_SEGMENT_PATHNAME_BUFFER] |
|
protected |
◆ m_Type
char HBhvTargetObject::m_Type[MVO_SMALL_BUFFER_SIZE] |
|
protected |
The documentation for this class was generated from the following file: