HTCObjectRotate

class HTCObjectRotate

HTCObjectRotate is a reference implementation of a timer client. It is the first of what we hope will be a long list of objects to make use of the centralized timer service in MVO provided by the HTManager class. It is not necessarily meant to do anything useful except serve as an example of how it is possible to do animation in the context of MVO without completely

Inherits from: HBaseOperator, HTClient

Methods

HTCObjectRotate::HTCObjectRotate(HBaseView *view, int DoRepeat = 0, int DoCapture = 1)

constructor

HTCObjectRotate::HTCObjectRotate(HTCObjectRotate *mommy)

constructor that accepts pointer to a parent HTCObjectRotate object

HTCObjectRotate::~HTCObjectRotate()
int HTCObjectRotate::OnLButtonDown(HEventInfo &hevent)

virtual

Overrides HBaseOperator

bool HTCObjectRotate::Tick(float request_time, float actual_time)

virtual

Overrides HTClient.

void HTCObjectRotate::SetDeleteOnUnRegister()

Makes HTCObjectRotate clean up after itself, as opposed to having a delete call required after everything is finished

void HTCObjectRotate::UnRegister()

Kills the animation (and possibly deletes *this, depending on the status of m_delete_on_unregister, as described above).

bool HTCObjectRotate::OnSignal(int signal)

Handles signals delivered from other objects

void HTCObjectRotate::RotateSegmentLocally(HC_KEY key, HPoint *axis, HPoint *centroid, float theta)

private

Adds a modelling matrix to rotate the given segment about the given axis and centroid by an angle of theta

Parameters

key: must refer to a segment

axis: Pointer to an HPoint object denoting the axis about which to rotate

centroid: Pointer to an HPoint object denoting the centroid about which to rotate

theta: amount to rotate in degrees

bool HTCObjectRotate::GetSelection(HEventInfo &hevent, HC_KEY *key)

private

Given the screen location described as part of event, get the most relevant object in the HOOPS scene graph

Parameters

hevent: Reference to an HEventInfo object

key: is the most relevant scene graph object. Returned to user

Returns

true if a relevant selection has been found
void HTCObjectRotate::Animate(HC_KEY key)

private

Initiates the Animation. If the object described is geometry and has siblings in its current segment, it will be moved into a subsegment into which it is safe to append modelling matrices. In all other cases, however, segment structure is not changed.

Parameters

key: the segment to animate
bool HTCObjectRotate::SearchAndDestroyHTCOR(HC_KEY key)

private

Detects if the given key is currently undergoing an HTCObjectRotate animation. If it is, the managing operator is UnRegistered (causing the animation to stop).

Returns

true if a relevant animation was detected
static bool HTCObjectRotate::signal_callback(int hevent, void *signal_data, void *user_data)

private static

A static function that can be registered as a callback, with a void * suitable for dispatching to a particular object instance. Simply returns user_data->OnEvent

Parameters

hevent: the type of the event getting passed in.

user_data: a “this” pointer passed back through the callback so that we may find our way to the class instance whose callback has been hit.

Variables

int HTCObjectRotate::m_state

protected

int

An identifier to describe the current state of the animation. Legal values are HTCOR_Resting and HTCOR_Animating.

float HTCObjectRotate::m_angle

protected

float

The current rotation angle

float HTCObjectRotate::m_duration

protected

float

The length of the animation

float HTCObjectRotate::m_start_time

protected

float

The time at which the animation started, as reported by HC_Show_Time

HC_KEY HTCObjectRotate::m_key

protected

HC_KEY

The object getting rotated. Can be geometry or segment.

HC_KEY HTCObjectRotate::m_segkey

protected

HC_KEY

The key of the object’s owner segment, into which modelling matrices are put (or possibly the same as m_key, if m_key itself refers to a segment)

HPoint HTCObjectRotate::m_centroid

protected

Centroid of segment to be rotated in object space

bool HTCObjectRotate::m_delete_on_unregister

protected

bool

If true, object will delete(this) upon UnRegister

bool HTCObjectRotate::m_original_matrix_valid

protected

bool

If true, m_segkey contained a modelling matrix at the start that needs preserving

float HTCObjectRotate::m_original_matrix[16]

protected

float

The original modelling matrix in the m_segkey segment, if applicable. Left uninitialized if !m_original_matrix_valid

int HTCObjectRotate::m_cookie

protected

int

The key that needs to be passed to HBaseView::UnSetEventNotify()