SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLAnimKeyframe.h
Go to the documentation of this file.
1 /**
2  * \file SLAnimKeyframe.h
3  * \authors Marcus Hudritsch
4  * \date July 2014
5  * \authors Marcus Hudritsch
6  * \copyright http://opensource.org/licenses/GPL-3.0
7  * \remarks Please use clangformat to format the code. See more code style on
8  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
9 */
10 
11 #ifndef SLKEYFRAME_H
12 #define SLKEYFRAME_H
13 
14 #include <SL.h>
15 #include <SLQuat4.h>
16 #include <SLVec3.h>
17 
18 class SLAnimTrack;
19 
20 //-----------------------------------------------------------------------------
21 //! Base class for all animation keyframes
23 {
24 public:
25  SLAnimKeyframe(const SLAnimTrack* parent,
26  SLfloat time);
27 
28  bool operator<(const SLAnimKeyframe& other) const;
29 
30  void time(SLfloat t) { _time = t; }
31  SLfloat time() const { return _time; }
32  SLbool isValid() const { return _isValid; }
33 
34 protected:
35  const SLAnimTrack* _parentTrack; //!< owning animation track for this keyframe
36  SLfloat _time; //!< temporal position in local time relative to the keyframes parent clip in seconds
37  SLbool _isValid; //!< is this keyframe in use inside its parent track
38 };
39 
40 //-----------------------------------------------------------------------------
41 //! SLTransformKeyframe is a specialized SLKeyframe for node transformations
42 /*!
43 Keeps track of translation, rotation and scale.
44 */
46 {
47 public:
48  SLTransformKeyframe(const SLAnimTrack* parent,
49  SLfloat time);
50 
51  // Setters
52  void translation(const SLVec3f& t) { _translation = t; }
53  void rotation(const SLQuat4f& r) { _rotation = r; }
54  void scale(const SLVec3f& s) { _scale = s; }
55 
56  // Getters
57  const SLVec3f& translation() const { return _translation; }
58  const SLQuat4f& rotation() const { return _rotation; }
59  const SLVec3f& scale() const { return _scale; }
60 
61 protected:
65 };
66 //-----------------------------------------------------------------------------
67 typedef vector<SLAnimKeyframe*> SLVKeyframe;
68 //-----------------------------------------------------------------------------
69 
70 #endif
float SLfloat
Definition: SL.h:173
bool SLbool
Definition: SL.h:175
vector< SLAnimKeyframe * > SLVKeyframe
SLScene * s
Definition: SLScene.h:31
Base class for all animation keyframes.
SLfloat time() const
bool operator<(const SLAnimKeyframe &other) const
const SLAnimTrack * _parentTrack
owning animation track for this keyframe
SLfloat _time
temporal position in local time relative to the keyframes parent clip in seconds
void time(SLfloat t)
SLbool _isValid
is this keyframe in use inside its parent track
SLbool isValid() const
SLAnimKeyframe(const SLAnimTrack *parent, SLfloat time)
Abstract base class for SLAnimationTracks providing time and keyframe functions.
Definition: SLAnimTrack.h:32
The SLScene class represents the top level instance holding the scene structure.
Definition: SLScene.h:47
SLTransformKeyframe is a specialized SLKeyframe for node transformations.
void translation(const SLVec3f &t)
void scale(const SLVec3f &s)
const SLVec3f & scale() const
void rotation(const SLQuat4f &r)
const SLQuat4f & rotation() const
const SLVec3f & translation() const
SLTransformKeyframe(const SLAnimTrack *parent, SLfloat time)