VizKit  3.3.7
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
VizKit::VisualAsset Class Reference

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

#include <VisualAsset.h>

Inheritance diagram for VizKit::VisualAsset:
VizKit::VisualObject

List of all members.

Public Member Functions

 VisualAsset ()
 The constructor.
 ~VisualAsset ()
 The destructor.
 VisualAsset (const VisualAsset &other)
 Copy constructor.
VisualAssetoperator= (const VisualAsset &other)
 Assignment operator.
bool operator< (const VisualAsset &other) const
 Less than operator.
bool operator== (const VisualAsset &other) const
 Equality operator.
bool operator!= (const VisualAsset &other) const
 Inequality operator.
virtual VisualAssetclone (void) const
 Copies the current VisualAsset and returns a pointer to a new VisualAsset.
VisualStageBoxgetBox (void) const
 Returns the stage box of the asset.
void setCamera (const VisualCamera &cameraRef)
 Sets the dimensions and direction of the camera view.
VisualCameragetCamera (void) const
 Returns the camera of the asset.
VisualStagePosition getPosition (void) const
 Returns the position of the asset's stage box.
void setPosition (const VisualStagePosition &aPosition)
 Sets the position of the asset's stage box.
void updateCoords (void)
 Updates the coords of the assets.
void setImage (const VisualImage &anImage)
 Sets the image of the asset.
bool hasImage (void) const
 Answers the question whether the asset has image data.
VisualImagegetImage (void) const
 Returns the image data of the asset.
void removeImage (void)
 Removes the image of the asset.
void draw (const VisualItemIdentifier &vertexChainName) const
 Draws the asset.
void draw (void) const
 Draws the asset.
void clear (void)
 Clears the asset.
void setScaleFactor (double aScaleFactor)
 Sets the scale value.
double getScaleFactor (void) const
 Returns the current scale factor.
void setOpacityValue (double anOpacityValue)
 Sets the opacity value (alpha value).
double getOpacityValue (void) const
 Returns the current opacity value (alpha value).
void setRotationAngle (double aRotationAngle)
 Sets the rotation angle value.
double getRotationAngle (void) const
 Returns the current rotation angle value.
void setDebugMode (bool requestedDebugMode)
 Sets the debug mode.
bool getDebugMode (void)
 Returns the current debug mode.
void addAnimation (VisualAnimationComponent &anAnimation)
 Adds an animation to the asset.
void removeAnimations (AnimatedProperty anAnimatedProperty=kUndefinedAnimatedProperty)
 Clears all currently running animations.
const VisualAnimationComponent
*const 
getAnimation (const AnimatedProperty &anAnimatedProperty) const
 Returns the VisualAnimation where the animated property matches.
double getCurrentAnimationValueOfProperty (const AnimatedProperty &anAnimatedProperty) const
 Returns the current animation value of a property which can be animated.
double getCurrentAnimationValueForAnimatedLocation (const VisualStagePosition &startPosition, const VisualStagePosition &stopPosition) const
 Returns the current animation value of an animated VisualStagePosition.
void updateLocation (double currPosition)
 Updates the location for an animation.
void setStartValueVisualStagePosition (const VisualStagePosition &position)
 Sets the start position as it is used for an animation of the VisualStagePosition property of the asset's VisualStageBox.
void setStopValueVisualStagePosition (const VisualStagePosition &position)
 Sets the start position as it is used for an animation of the VisualStagePosition property of the asset's VisualStageBox.

Static Public Member Functions

static void animateOpacity (double currentPosition, void *userData)
 Callback function that is called during animation.
static void animateRotation (double currentPosition, void *userData)
 Callback function that is called during animation.
static void animateScaleFactor (double currentPosition, void *userData)
 Callback function that is called during animation.
static void animateLocation (double currentPosition, void *userData)
 Callback function that is called during animation.

Private Member Functions

void init (void)
 Initializes the VisualAsset.
void copy (const VisualAsset &other)
 Copy method for assignment operator and copy constructor.
void doDraw (const VertexChain &aVertexChain) const
 Draws a vertex chain (including texture data if available).
void drawBoxOutline (void) const
 Draws the outline of the stage box.

Private Attributes

VisualImageimage
 The image of the asset.
VisualCameracamera
 The camera of the asset.
VisualStageBoxstageBox
 The stage box of the asset.
VisualItemIdentifierdefaultVertexChainIdentifier
 The identifier of the default vertex chain.
double rotationAngle
 The current rotation angle.
double opacityValue
 The current opacity value (alpha value).
double scaleFactor
 The current scale factor value.
VisualStagePosition startValueVisualStagePosition
 The start value of an animation of the VisualStagePosition property.
VisualStagePosition stopValueVisualStagePosition
 The stop value of an animation of the VisualStagePosition property.

Detailed Description

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


Constructor & Destructor Documentation

The constructor.

The destructor.

Copy constructor.

Parameters:
otherReference to another VisualAsset.

Member Function Documentation

Adds an animation to the asset.

Parameters:
anAnimationReference 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:
currentPositionThe current position of the animation.
userDataPointer to VisualAsset instance.
void VisualAsset::animateOpacity ( double  currentPosition,
void *  userData 
) [static]

Callback function that is called during animation.

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

Callback function that is called during animation.

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

Callback function that is called during animation.

Parameters:
currentPositionThe current position of the animation.
userDataPointer 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:
otherAnother VisualAsset.
void VisualAsset::doDraw ( const VertexChain aVertexChain) const [private]

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

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

Draws the asset.

Parameters:
vertexChainNameThe 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:
anAnimatedPropertyParameter 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.

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:
startPositionThe start position.
stopPositionThe 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:
anAnimatedPropertyParameter 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).

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:
otherAnother VisualAsset.
bool VisualAsset::operator< ( const VisualAsset other) const

Less than operator.

Parameters:
otherAnother 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:
otherReference to another VisualAsset.
bool VisualAsset::operator== ( const VisualAsset other) const

Equality operator.

Parameters:
otherAnother VisualAsset.

Clears all currently running animations.

Parameters:
anAnimatedPropertyOptional 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:
cameraRefCamera whose dimensions and direction should be used by asset.
void VisualAsset::setDebugMode ( bool  requestedDebugMode)

Sets the debug mode.

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

Sets the image of the asset.

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

Sets the opacity value (alpha value).

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

Sets the position of the asset's stage box.

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

Sets the rotation angle value.

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

Sets the scale value.

Parameters:
aScaleFactorThe factor by which the size of the asset should be multiplied when rendered.
Remarks:
1.0 means no magnification/minification.

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

Parameters:
positionThe start position.

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

Parameters:
positionThe 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:
currPositionThe 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 May 3 2015 20:26:31 for VizKit by doxygen 1.8.0