Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

VizKit::VisualAsset Class Reference

#include <VisualAsset.h>

Inherits VizKit::VisualObject.

Collaboration diagram for VizKit::VisualAsset:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 VisualAsset ()
 ~VisualAsset ()
 VisualAsset (const VisualAsset &other)
VisualAssetoperator= (const VisualAsset &other)
bool operator< (const VisualAsset &other) const
bool operator== (const VisualAsset &other) const
bool operator!= (const VisualAsset &other) const
virtual VisualAssetclone (void) const
VisualStageBoxgetBox (void) const
void setCamera (const VisualCamera &cameraRef)
VisualCameragetCamera (void) const
VisualStagePosition getPosition (void) const
void setPosition (const VisualStagePosition &aPosition)
void updateCoords (void)
void setImage (const VisualImage &anImage)
bool hasImage (void) const
VisualImagegetImage (void) const
void removeImage (void)
void draw (const VisualItemIdentifier &vertexChainName) const
void draw (void) const
void clear (void)
void setScaleFactor (double aScaleFactor)
double getScaleFactor (void) const
void setOpacityValue (double anOpacityValue)
double getOpacityValue (void) const
void setRotationAngle (double aRotationAngle)
double getRotationAngle (void) const
void setDebugMode (bool requestedDebugMode)
bool getDebugMode (void)
void addAnimation (VisualAnimationComponent &anAnimation)
void removeAnimations (AnimatedProperty anAnimatedProperty=kUndefinedAnimatedProperty)
const VisualAnimationComponent
*const 
getAnimation (const AnimatedProperty &anAnimatedProperty) const
double getCurrentAnimationValueOfProperty (const AnimatedProperty &anAnimatedProperty) const
double getCurrentAnimationValueForAnimatedLocation (const VisualStagePosition &startPosition, const VisualStagePosition &stopPosition) const
void updateLocation (double currPosition)
void setStartValueVisualStagePosition (const VisualStagePosition &position)
void setStopValueVisualStagePosition (const VisualStagePosition &position)

Static Public Member Functions

static void animateOpacity (double currentPosition, void *userData)
static void animateRotation (double currentPosition, void *userData)
static void animateScaleFactor (double currentPosition, void *userData)
static void animateLocation (double currentPosition, void *userData)

Private Member Functions

void init (void)
void copy (const VisualAsset &other)
void doDraw (const VertexChain &aVertexChain) const
void drawBoxOutline (void) const

Private Attributes

VisualImageimage
VisualCameracamera
VisualStageBoxstageBox
VisualItemIdentifierdefaultVertexChainIdentifier
double rotationAngle
double opacityValue
double scaleFactor
VisualStagePosition startValueVisualStagePosition
VisualStagePosition stopValueVisualStagePosition

Detailed Description

Dimensionless asset that contains texture, boxing information, and optional animations.


Constructor & Destructor Documentation

VisualAsset::VisualAsset (  ) 

The constructor.

VisualAsset::~VisualAsset (  ) 

The destructor.

VisualAsset::VisualAsset ( const VisualAsset other  ) 

Copy constructor.

Parameters:
other Reference to another VisualAsset.

Member Function Documentation

void VisualAsset::addAnimation ( VisualAnimationComponent anAnimation  ) 

Adds an animation to the asset.

Parameters:
anAnimation Reference to an animation.
Remarks:
It is ensured that only one animation animates a distinct property of the asset. When the asset is destructed, all animations of the asset are removed.
void VisualAsset::animateLocation ( double  currentPosition,
void *  userData 
) [static]

Callback function that is called during animation.

Parameters:
currentPosition The current position of the animation.
userData Pointer to VisualAsset instance.
void VisualAsset::animateOpacity ( double  currentPosition,
void *  userData 
) [static]

Callback function that is called during animation.

Parameters:
currentPosition The current position of the animation.
userData Pointer to VisualAsset instance.
void VisualAsset::animateRotation ( double  currentPosition,
void *  userData 
) [static]

Callback function that is called during animation.

Parameters:
currentPosition The current position of the animation.
userData Pointer to VisualAsset instance.
void VisualAsset::animateScaleFactor ( double  currentPosition,
void *  userData 
) [static]

Callback function that is called during animation.

Parameters:
currentPosition The current position of the animation.
userData Pointer to VisualAsset instance.
void VisualAsset::clear ( void   ) 

Clears the asset.

Remarks:
Resets position, removes image and animations.
VisualAsset * VisualAsset::clone ( void   )  const [virtual]

Copies the current VisualAsset and returns a pointer to a new VisualAsset.

Implements VizKit::VisualObject.

void VisualAsset::copy ( const VisualAsset other  )  [private]

Copy method for assignment operator and copy constructor.

Parameters:
other Another VisualAsset.
void VisualAsset::doDraw ( const VertexChain aVertexChain  )  const [private]

Draws a vertex chain (including texture data if available).

Parameters:
aVertexChain Vertex chain to draw.
void VisualAsset::draw ( const VisualItemIdentifier vertexChainName  )  const

Draws the asset.

Parameters:
vertexChainName The identifier of the VertexChain to draw.
void VisualAsset::draw ( void   )  const

Draws the asset.

Remarks:
All vertex chains are drawn.
void VisualAsset::drawBoxOutline ( void   )  const [private]

Draws the outline of the stage box.

Remarks:
Useful method for debugging or diagnostic purposes.
const VisualAnimationComponent *const VisualAsset::getAnimation ( const AnimatedProperty anAnimatedProperty  )  const

Returns the VisualAnimation where the animated property matches.

Parameters:
anAnimatedProperty Parameter that specifies the animated property of the animation.
Returns:
The VisualAnimation where the animated property matches.
Remarks:
Return value can be NULL.
VisualStageBox * VisualAsset::getBox ( void   )  const

Returns the stage box of the asset. The stage box is the bounding box.

Returns:
The stage box of the asset.
VisualCamera & VisualAsset::getCamera ( void   )  const

Returns the camera of the asset.

Returns:
The camera of the asset.
double VisualAsset::getCurrentAnimationValueForAnimatedLocation ( const VisualStagePosition startPosition,
const VisualStagePosition stopPosition 
) const

Returns the current animation value of an animated VisualStagePosition.

Parameters:
startPosition The start position.
stopPosition The stop position.
Returns:
The current animation value of the property.
Remarks:
The returned value can differ from the current actual value of the asset property (e\.g\. for rotation return values are clamped between 0\.0 and 1\.0 instead of 0\.0 and 360\.0).
double VisualAsset::getCurrentAnimationValueOfProperty ( const AnimatedProperty anAnimatedProperty  )  const

Returns the current animation value of a property which can be animated.

Parameters:
anAnimatedProperty Parameter that specifies the queried property of the animation.
Returns:
The current animation value of the property.
Remarks:
The returned value can differ from the current actual value of the asset property (e\.g\. for rotation return values are clamped between 0\.0 and 1\.0 instead of 0\.0 and 360\.0).
bool VisualAsset::getDebugMode ( void   ) 

Returns the current debug mode.

Returns:
The current debug mode. True means debug mode is on, false means it is turned off.
VisualImage * VisualAsset::getImage ( void   )  const

Returns the image data of the asset.

Returns:
The image data of the asset.
double VisualAsset::getOpacityValue ( void   )  const

Returns the current opacity value (alpha value).

Returns:
The current opacity value (alpha value).
VisualStagePosition VisualAsset::getPosition ( void   )  const

Returns the position of the asset's stage box.

Returns:
The position of the asset's stage box.
double VisualAsset::getRotationAngle ( void   )  const

Returns the current rotation angle value.

Returns:
The current rotation angle value.
double VisualAsset::getScaleFactor ( void   )  const

Returns the current scale factor.

Returns:
The current scale factor.
bool VisualAsset::hasImage ( void   )  const

Answers the question whether the asset has image data.

Returns:
True if asset has image data, false if not.
void VisualAsset::init ( void   )  [private]

Initializes the VisualAsset.

bool VisualAsset::operator!= ( const VisualAsset other  )  const

Inequality operator.

Parameters:
other Another VisualAsset.
bool VisualAsset::operator< ( const VisualAsset other  )  const

Less than operator.

Parameters:
other Another VisualAsset.
Remarks:
The less than operator is used by std::map for find() and sorting (if VisualAsset is used as key_type).
VisualAsset & VisualAsset::operator= ( const VisualAsset other  ) 

Assignment operator.

Parameters:
other Reference to another VisualAsset.
bool VisualAsset::operator== ( const VisualAsset other  )  const

Equality operator.

Parameters:
other Another VisualAsset.
void VisualAsset::removeAnimations ( AnimatedProperty  anAnimatedProperty = kUndefinedAnimatedProperty  ) 

Clears all currently running animations.

Parameters:
anAnimatedProperty Optional parameter that specifies the animated property of the animations. With default argument kUndefinedAnimatedProperty, all animations are removed.
void VisualAsset::removeImage ( void   ) 

Removes the image of the asset.

void VisualAsset::setCamera ( const VisualCamera cameraRef  ) 

Sets the dimensions and direction of the camera view.

Parameters:
cameraRef Camera whose dimensions and direction should be used by asset.
void VisualAsset::setDebugMode ( bool  requestedDebugMode  ) 

Sets the debug mode.

Parameters:
requestedDebugMode The debug mode. True turns debug mode on, false turns it off.
void VisualAsset::setImage ( const VisualImage anImage  ) 

Sets the image of the asset.

Parameters:
anImage Reference to the image.
Remarks:
The image is copied.
void VisualAsset::setOpacityValue ( double  anOpacityValue  ) 

Sets the opacity value (alpha value).

Parameters:
anOpacityValue The opacity value (alpha value).
void VisualAsset::setPosition ( const VisualStagePosition aPosition  ) 

Sets the position of the asset's stage box.

Parameters:
aPosition The requested position of the asset's stage box.
void VisualAsset::setRotationAngle ( double  aRotationAngle  ) 

Sets the rotation angle value.

Parameters:
aRotationAngle The requested rotation angle.
void VisualAsset::setScaleFactor ( double  aScaleFactor  ) 

Sets the scale value.

Parameters:
aScaleFactor The factor by which the size of the asset should be multiplied when rendered.
Remarks:
1.0 means no magnification/minification.
void VisualAsset::setStartValueVisualStagePosition ( const VisualStagePosition position  ) 

Sets the start position as it is used for an animation of the VisualStagePosition property of the asset's VisualStageBox.

Parameters:
position The start position.
void VisualAsset::setStopValueVisualStagePosition ( const VisualStagePosition position  ) 

Sets the start position as it is used for an animation of the VisualStagePosition property of the asset's VisualStageBox.

Parameters:
position The start position.
void VisualAsset::updateCoords ( void   ) 

Updates the coords of the assets.

Remarks:
Might be useful after a resize event of the enclosing canvas for instance.
void VisualAsset::updateLocation ( double  currPosition  ) 

Updates the location for an animation.

Parameters:
currPosition The current position of the animation.
Remarks:
Location animations are tweened between startValueVisualStagePosition and stopValueVisualStagePosition.

Member Data Documentation

The camera of the asset.

The identifier of the default vertex chain.

Remarks:
The default vertex chain is used in case no vertex chain has been initialized explicitely.

The image of the asset.

The current opacity value (alpha value).

The current rotation angle.

The current scale factor value.

The stage box of the asset.

The start value of an animation of the VisualStagePosition property.

The stop value of an animation of the VisualStagePosition property.


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

Generated on Sun Sep 26 2010 13:29:36 for VizKit by doxygen 1.7.1