Carna  Version 3.0.1
Public Member Functions | Public Attributes | List of all members
Carna::base::SpatialMovement Class Reference

Handles the displacement of a Spatial object in a drag-&-drop like manner. More...

#include <SpatialMovement.h>

+ Collaboration diagram for Carna::base::SpatialMovement:

Public Member Functions

 SpatialMovement (Spatial &movedSpatial, unsigned int frameX, unsigned int frameY, const Viewport &vp, const Camera &cam)
 Starts the spatial movement. This corresponds to "picking up" the spatial. More...
 
 ~SpatialMovement ()
 Deletes.
 
bool update (unsigned int frameX, unsigned int frameY)
 Updates the moved spatial object's location. Returns true if and only if the object's location changed. More...
 
bool hasMovedSpatial () const
 Tells true if the spatial given to the constructor is movable. Tells also true if it is not movable, but another movable object exists on it's path to the root. Tells false otherwise.
 
SpatialmovedSpatial () const
 References the actually moved spatial. More...
 

Public Attributes

const Viewportviewport
 References the root viewport that the frame was rendered with.
 
const Cameracam
 References the camera that the frame was rendered with.
 
const math::Matrix4f inverseProjection
 Holds the inverse of the projection matrix that the frame was rendered with.
 

Detailed Description

Handles the displacement of a Spatial object in a drag-&-drop like manner.

If the object that is to be handled by an instance of this class is not movable, than instead it's first movable parent will be moved. If no movable parent exists on the path from the object to the scene root, nothing will be moved. Objects are always moved within the plane that is parallel to the projection plane and intersects the object's origin.

Attention
The class expects that neither the camera object, nor the projection, nor the frame viewport do change for the duration of the movement.
Author
Leonid Kostrykin
Date
22.2.15 - 16.3.15

Definition at line 52 of file SpatialMovement.h.

Constructor & Destructor Documentation

Carna::base::SpatialMovement::SpatialMovement ( Spatial movedSpatial,
unsigned int  frameX,
unsigned int  frameY,
const Viewport vp,
const Camera cam 
)

Starts the spatial movement. This corresponds to "picking up" the spatial.

Parameters
movedSpatialreferences the spatial object to move.
frameXis the first frame coordinate, where the spatial object has been picked up.
frameYis the second frame coordinate, where the spatial object has been picked up.
vpreferences the root viewport the frame was rendered with.
camreferences the camera the frame was rendered with.

Member Function Documentation

Spatial& Carna::base::SpatialMovement::movedSpatial ( ) const

References the actually moved spatial.

Precondition
hasMovedSpatial() == true
bool Carna::base::SpatialMovement::update ( unsigned int  frameX,
unsigned int  frameY 
)

Updates the moved spatial object's location. Returns true if and only if the object's location changed.

Invalidates the subtrees the moved spatial is within.

Parameters
frameXis the first frame coordinate, where the spatial object is to be moved to.
frameYis the second frame coordinate, where the spatial object is to be moved to.

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