version 3.3

VRS::CameraPathEditor Class Reference

The camera path editor allows for quick creation of simple camera paths based on key frames. More...

#include <vrs/sg/camerapatheditor.h>

Inheritance diagram for VRS::CameraPathEditor:

VRS::InteractionTechnique VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 CameraPathEditor (SO< CameraPathRecorder > recorder, const std::string &cameraPathFileName="cameraPath.txt", const std::string &imageSequenceDirectory="video/", unsigned int imageSequenceWidth=768, unsigned int imageSequenceHeight=576, unsigned int imageSequenceFramesPerSecond=25)
 The camera path recorder is used to store the generated camera path and to create the final image sequence.
void appendKeyFrame (const Vector &from, const Vector &dirOrTo, bool isLookTo=false)
 Per default, this method appends a new key frame at the end of the camera path.
int keyFrames () const
 Returns the number of currently stored key frames.
int keyFrameCursor () const
 The key frame cursor is an index that points to a certain stored key frame.
void setKeyFrameCursor (int pos)
void gotoKeyFrame ()
 Sets the current viewing parameters to the current key frame, which is indicated by the key frame cursor.
void overwriteKeyFrame (const Vector &from, const Vector &dirOrTo, bool isLookTo=false)
 Overwrites the current key frame. If activated by key, 'from' and 'to' are taken from the view parameters.
void deleteKeyFrame ()
 Deletes the current or all key frames.
void clear ()
void renameKeyFrame (const std::string &name)
 Renames the current key frame. If activated by key, the name is specified via console.
std::string getKeyFrameName ()
 Returns the Name of the current KeyFrame.
void setKeyFrameFile (const std::string &name)
 All currently stored key frames can be stored and loaded in/from a ASCII file of a given name.
std::string getKeyFrameFile () const
void loadKeyFrames ()
void saveKeyFrames () const
void setImageSequenceDirectory (const std::string &name)
 image sequence handling
std::string getImageSequenceDirectory () const
void setImageSequenceSize (unsigned int width, unsigned int height)
unsigned int getImageSequenceWidth () const
unsigned int getImageSequenceHeight () const
void setImageSequenceFramerate (unsigned int fps)
 frames per second!
unsigned int getImageSequenceFramerate () const
void markAsCircleKeyFrame (const Vector &target, int minimumRotations=0)
 Specifying the current key frame as a circle entry point has the following effect:
  • The camera rotates around 'target' while keeping its height.

void unmarkCircleKeyFrame ()
void playFromCursor ()
 Plays the so-far specified camera path starting from the current key frame Note: Since playing is always performed via the registered CameraPathRecorder, the path stored in the CameraPathRecorder will be rebuilt for each call according to the current start key frame.
void stopPlaying ()
 Stops the current camera path playing.
bool isActive ()
 returns true if the camera path is currently played
void setDefaultSpeed (double speed)
 Get/Set the default speed time in units per seconds that corresponds to the speed factor 1.0.
double getDefaultSpeed () const
void setSpeedMark (double speedFactor, bool startSpeedChange, double relativeAcceleration)
 KeyFrames can be marked with a desired relative speed (relative to the default speed).
void removeSpeedMark ()
virtual void onKey (SO< VRS::KeyEvent > event, KeyFunctionID id)
 see interactiontechnique.h
void printKeyAssignments () const
 prints an overview of all assigned keys on the console
virtual void onTimer (SO< TimeEvent > event, double secondsSinceLastTimeEvent)
 see interactiontechnique.h
virtual void onEventPassive (SO< Event > e, bool modeActive)
 The aforementioned event handling methods are only called if the technique is active.
void createCameraPath () const
 creates a camera path from the current key frames and send it to the camera path recorder.
double getPathLength () const
 Returns the length of the currently specified path.
double getPathDuration () const
 Returns the time length of the current camera path.
void recordCameraPath ()
void recordVideo (const std::string &filename, unsigned int sizeX, unsigned int sizeY, int framesPerSecond, bool highQuality=false, VRS::VideoCompressor *compressor=NULL)
void recordVideo (const std::string &targetFilename, const std::string &targetDirectory, const std::string &targetFormat, unsigned int sizeX, unsigned int sizeY, int framesPerSecond, VRS::VideoCompressor *compressor=NULL)
void setPathDuration (double targetTime)
 set the duration of the camerapath
int getCircleTurns (unsigned int index)
 returns CircleTurns of the Keyframe given by the index

Static Public Attributes

static const Vector UpVector
 The up-vector is currently always assumed to be (0,1,0).
static const KeyFunctionID AppendKeyFrame
 See corresponding methods for function key documentation.
static const KeyFunctionID AppendKeyFrameAbsolute
static const KeyFunctionID AppendKeyFrameAtEnd
static const KeyFunctionID NextKeyFrame
static const KeyFunctionID PrevKeyFrame
static const KeyFunctionID ClearAll
static const KeyFunctionID CursorToStartKeyFrame
static const KeyFunctionID CursorToEndStartKeyFrame
static const KeyFunctionID GotoKeyFrame
static const KeyFunctionID OverwriteKeyFrame
static const KeyFunctionID OverwriteKeyFrameAbsolute
static const KeyFunctionID DeleteKeyFrame
static const KeyFunctionID RenameKeyFrame
static const KeyFunctionID LoadKeyFrames
static const KeyFunctionID SaveKeyFrames
static const KeyFunctionID MarkAsCircleKeyFrame
static const KeyFunctionID PlayFromCursor
static const KeyFunctionID StopPlaying
static const KeyFunctionID SetPathTime
static const KeyFunctionID SetDefaultSpeed
static const KeyFunctionID SetSpeedMark
static const KeyFunctionID ExportCameraPathRecorderFile
static const KeyFunctionID ExportImageSequence
static const KeyFunctionID PrintKeyAssignments
static const KeyFunctionID PrintLookAt

Classes

struct  CameraPoint
struct  KeyFrame


Detailed Description

The camera path editor allows for quick creation of simple camera paths based on key frames.

Currently, it supports bezier segments and circle paths around objects. The result is a camera path that can be loaded and played with the camerapathrecorder or directly recorded as an image sequence. Usage: The CameraPathEditor uses an console-based user interface. Thus, it requires a console to be useable. Commands are recognized, when the application window has the focus. When input is necessary, the user has to switch from application window to the console window to provide that input. Afterwards, she has to switch back to being able to issue subsequent commands.


Constructor & Destructor Documentation

VRS::CameraPathEditor::CameraPathEditor ( SO< CameraPathRecorder recorder,
const std::string &  cameraPathFileName = "cameraPath.txt",
const std::string &  imageSequenceDirectory = "video/",
unsigned int  imageSequenceWidth = 768,
unsigned int  imageSequenceHeight = 576,
unsigned int  imageSequenceFramesPerSecond = 25 
)

The camera path recorder is used to store the generated camera path and to create the final image sequence.

The key assignments of the camerapath recorder should be disabled because any recorded paths will be overwritten by the camerapath editor. The editor does not work without a camerapath recorder. The camerapathrecorder must not be inserted in the canvas! Use recorder->setPBufferEnabled(yesNo) to control pbuffer usage. 'cameraPathFileName' specifies the name under which a camerapath recorder file will be exported. 'imageSequenceDirectory' specifies the directory (trailing slash!) for the generated images 'imageSequenceWidth', 'imageSequenceHeight', and 'imageSequenceFramerate' specify sequence parameters. Framerate is given in frames per second.


Member Function Documentation

void VRS::CameraPathEditor::appendKeyFrame ( const Vector from,
const Vector dirOrTo,
bool  isLookTo = false 
)

Per default, this method appends a new key frame at the end of the camera path.

More generally, the new key frame is inserted behind the current key frame cursor and the key frame cursor is moved to the new key frame. If activated by key, 'from' and 'to' are taken from the current view parameters

int VRS::CameraPathEditor::keyFrames (  )  const

Returns the number of currently stored key frames.

int VRS::CameraPathEditor::keyFrameCursor (  )  const

The key frame cursor is an index that points to a certain stored key frame.

The cursor determines the currently edited position of a camera path. E.g., deleteKeyFrame removes the key frame indicated by the key frame cursor. 'pos' must be in {-1,...,keyFrames()-1} and is cropped otherwise. Note: If the key frame cursor is at -1, any operations except from append() will not work.

void VRS::CameraPathEditor::setKeyFrameCursor ( int  pos  ) 

void VRS::CameraPathEditor::gotoKeyFrame (  ) 

Sets the current viewing parameters to the current key frame, which is indicated by the key frame cursor.

void VRS::CameraPathEditor::overwriteKeyFrame ( const Vector from,
const Vector dirOrTo,
bool  isLookTo = false 
)

Overwrites the current key frame. If activated by key, 'from' and 'to' are taken from the view parameters.

void VRS::CameraPathEditor::deleteKeyFrame (  ) 

Deletes the current or all key frames.

void VRS::CameraPathEditor::clear (  ) 

void VRS::CameraPathEditor::renameKeyFrame ( const std::string &  name  ) 

Renames the current key frame. If activated by key, the name is specified via console.

std::string VRS::CameraPathEditor::getKeyFrameName (  ) 

Returns the Name of the current KeyFrame.

void VRS::CameraPathEditor::setKeyFrameFile ( const std::string &  name  ) 

All currently stored key frames can be stored and loaded in/from a ASCII file of a given name.

The default filename is 'keyFrames.txt'.

std::string VRS::CameraPathEditor::getKeyFrameFile (  )  const

void VRS::CameraPathEditor::loadKeyFrames (  ) 

void VRS::CameraPathEditor::saveKeyFrames (  )  const

void VRS::CameraPathEditor::setImageSequenceDirectory ( const std::string &  name  ) 

image sequence handling

std::string VRS::CameraPathEditor::getImageSequenceDirectory (  )  const

void VRS::CameraPathEditor::setImageSequenceSize ( unsigned int  width,
unsigned int  height 
)

unsigned int VRS::CameraPathEditor::getImageSequenceWidth (  )  const

unsigned int VRS::CameraPathEditor::getImageSequenceHeight (  )  const

void VRS::CameraPathEditor::setImageSequenceFramerate ( unsigned int  fps  ) 

frames per second!

unsigned int VRS::CameraPathEditor::getImageSequenceFramerate (  )  const

void VRS::CameraPathEditor::markAsCircleKeyFrame ( const Vector target,
int  minimumRotations = 0 
)

Specifying the current key frame as a circle entry point has the following effect:

  • The camera rotates around 'target' while keeping its height.

  • The rotation begins at the 'from' position of the selected key frame.
  • The viewing direction of the current key frame is ignored because the camera looks at the target.
  • The exiting position of the camera from the circle path is determined from the subsequent key frame. Optionally, the camera can make a fixed number of full rotations around the target. unmarkCircleKeyFrame() undos a previous markAsCircleKeyFrame() call.

void VRS::CameraPathEditor::unmarkCircleKeyFrame (  ) 

void VRS::CameraPathEditor::playFromCursor (  ) 

Plays the so-far specified camera path starting from the current key frame Note: Since playing is always performed via the registered CameraPathRecorder, the path stored in the CameraPathRecorder will be rebuilt for each call according to the current start key frame.

void VRS::CameraPathEditor::stopPlaying (  ) 

Stops the current camera path playing.

bool VRS::CameraPathEditor::isActive (  ) 

returns true if the camera path is currently played

void VRS::CameraPathEditor::setDefaultSpeed ( double  speed  ) 

Get/Set the default speed time in units per seconds that corresponds to the speed factor 1.0.

As long as the default speed is not initialized, the speed is automatically set in a way that the complete camera path has a duration of 3 seconds.

double VRS::CameraPathEditor::getDefaultSpeed (  )  const

void VRS::CameraPathEditor::setSpeedMark ( double  speedFactor,
bool  startSpeedChange,
double  relativeAcceleration 
)

KeyFrames can be marked with a desired relative speed (relative to the default speed).

'relativeSpeed': Desired speed 'startSpeedChange': If 'true', the speed begins to change towards the desired new speed at the key frame. Otherwise, the camera already reaches the desired speed there. 'relativeAcceleration': Specifies the relative acceleration/deceleration in units per second^2. A relative acc. of 1.0 corresponds to accelerating from 0 to the default speed in 1 second.

removeSpeedMark() removes the speed mark from the current key frame. Via keys, a mark can be removed by pressing the "setSpeedMark" key again if a speed mark is currently set.

void VRS::CameraPathEditor::removeSpeedMark (  ) 

virtual void VRS::CameraPathEditor::onKey ( SO< VRS::KeyEvent event,
KeyFunctionID  id 
) [virtual]

void VRS::CameraPathEditor::printKeyAssignments (  )  const

prints an overview of all assigned keys on the console

virtual void VRS::CameraPathEditor::onTimer ( SO< TimeEvent event,
double  secondsSinceLastTimeEvent 
) [virtual]

virtual void VRS::CameraPathEditor::onEventPassive ( SO< Event e,
bool  modeActive 
) [virtual]

The aforementioned event handling methods are only called if the technique is active.

onEventPassive() is called for all techniques of the current InteractionConcept. The parameter modeActive says if the mode of the technique is currently selected. Note: For a controlled access of the view, onEventPassive must not change the view parameters. It can be used to update internal states, e.g., to observe the current viewing position.

Reimplemented from VRS::InteractionTechnique.

void VRS::CameraPathEditor::createCameraPath (  )  const

creates a camera path from the current key frames and send it to the camera path recorder.

This method is automatically called if the camera path needs to be created, e.g., if playFromCursor() is called or the exportCameraPath key is pressed.

double VRS::CameraPathEditor::getPathLength (  )  const

Returns the length of the currently specified path.

Note that createCameraPath() is called to ensure the validity of the path length.

double VRS::CameraPathEditor::getPathDuration (  )  const

Returns the time length of the current camera path.

void VRS::CameraPathEditor::recordCameraPath (  ) 

void VRS::CameraPathEditor::recordVideo ( const std::string &  filename,
unsigned int  sizeX,
unsigned int  sizeY,
int  framesPerSecond,
bool  highQuality = false,
VRS::VideoCompressor compressor = NULL 
)

void VRS::CameraPathEditor::recordVideo ( const std::string &  targetFilename,
const std::string &  targetDirectory,
const std::string &  targetFormat,
unsigned int  sizeX,
unsigned int  sizeY,
int  framesPerSecond,
VRS::VideoCompressor compressor = NULL 
)

void VRS::CameraPathEditor::setPathDuration ( double  targetTime  ) 

set the duration of the camerapath

int VRS::CameraPathEditor::getCircleTurns ( unsigned int  index  ) 

returns CircleTurns of the Keyframe given by the index


Member Data Documentation

The up-vector is currently always assumed to be (0,1,0).

See corresponding methods for function key documentation.


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

Generated on Fri May 18 06:00:26 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact