Carna
Version 3.0.1
|
Handles the displacement of a Spatial object in a drag-&-drop like manner. More...
#include <SpatialMovement.h>
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. | |
Spatial & | movedSpatial () const |
References the actually moved spatial. More... | |
Public Attributes | |
const Viewport & | viewport |
References the root viewport that the frame was rendered with. | |
const Camera & | cam |
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. | |
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.
Definition at line 52 of file SpatialMovement.h.
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.
movedSpatial | references the spatial object to move. |
frameX | is the first frame coordinate, where the spatial object has been picked up. |
frameY | is the second frame coordinate, where the spatial object has been picked up. |
vp | references the root viewport the frame was rendered with. |
cam | references the camera the frame was rendered with. |
Spatial& Carna::base::SpatialMovement::movedSpatial | ( | ) | const |
References the actually moved spatial.
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.
frameX | is the first frame coordinate, where the spatial object is to be moved to. |
frameY | is the second frame coordinate, where the spatial object is to be moved to. |
Documentation generated by Doxygen