vsg 1.1.3
VulkanSceneGraph library
Loading...
Searching...
No Matches
CameraAnimation.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2024 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/animation/TransformSampler.h>
16#include <vsg/core/Inherit.h>
17#include <vsg/maths/quat.h>
18#include <vsg/ui/KeyEvent.h>
19
20namespace vsg
21{
22
24 class VSG_DECLSPEC CameraAnimation : public Inherit<Visitor, CameraAnimation>
25 {
26 public:
27 explicit CameraAnimation(ref_ptr<Object> in_object, const Path& in_filename = "saved_animation.vsgt", ref_ptr<Options> in_options = {});
28 CameraAnimation(ref_ptr<Object> in_object, ref_ptr<Animation> in_animation, const Path& in_filename = "saved_animation.vsgt", ref_ptr<Options> in_options = {});
29
32
35 ref_ptr<Options> options;
36
37 // animation to play/record to
38 ref_ptr<Animation> animation;
39
40 // transformSampler to play/record to
41 ref_ptr<TransformSampler> transformSampler;
42
43 KeySymbol toggleRecordingKey = KEY_r;
44 KeySymbol togglePlaybackKey = KEY_p;
45
46 bool recording = false;
47 bool playing = false;
48 double simulationTime = 0.0;
49 double startTime = 0.0;
50
51 void play();
52 void record();
53 void stop();
54
55 public:
56 void apply(Camera& camera) override;
57 void apply(MatrixTransform& transform) override;
58
59 void apply(KeyPressEvent& keyPress) override;
60 void apply(FrameEvent& frame) override;
61
62 protected:
63 };
64 VSG_type_name(vsg::CameraAnimation);
65
66} // namespace vsg
event handler for controlling the playing and recording of camera animation paths
Definition CameraAnimation.h:25
ref_ptr< Object > object
object to track/modify
Definition CameraAnimation.h:31
Path filename
file to read/write to
Definition CameraAnimation.h:34
Definition Camera.h:27
Definition ApplicationEvent.h:37
Definition Inherit.h:28
KeyPressEvent represents a key press event.
Definition KeyEvent.h:309
Definition MatrixTransform.h:24
Definition Path.h:34
Definition ref_ptr.h:22