vsg: include/vsg/animation/AnimationManager.h Source File

vsg 1.1.10 VulkanSceneGraph library |

Loading...
Searching...
No Matches
AnimationManager.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/AnimationGroup.h>
16#include <vsg/ui/FrameStamp.h>
17#include <vsg/utils/Instrumentation.h>
18
19namespace vsg
20{
21
23 class VSG_DECLSPEC AnimationManager : public vsg::Inherit<Object, AnimationManager>
24 {
25 public:
26 AnimationManager();
27
29 std::list<ref_ptr<Animation>> animations;
30
31 ref_ptr<Instrumentation> instrumentation;
32
34 virtual void assignInstrumentation(ref_ptr<Instrumentation> in_instrumentation);
35
37 virtual bool play(vsg::ref_ptr<vsg::Animation> animation, double startTime = 0.0);
38
40 virtual bool stop(vsg::ref_ptr<vsg::Animation> animation);
41
43 virtual bool stop();
44
46 virtual bool update(vsg::Animation& animation);
47
49 virtual void run(vsg::ref_ptr<vsg::FrameStamp> frameStamp);
50
51 protected:
52 double _simulationTime = 0.0;
53 };
54 VSG_type_name(vsg::AnimationManager);
55
56} // namespace vsg
vsg::Animation
Animation class that controls a single animation made up of one more samplers.
Definition Animation.h:44
vsg::AnimationManager
AnimationManager provides a mechanism for playing/updating animations as part of the Viewer::update()
Definition AnimationManager.h:24
vsg::AnimationManager::stop
virtual bool stop()
stop all running animations
vsg::AnimationManager::animations
std::list< ref_ptr< Animation > > animations
list of animations that are currently being played
Definition AnimationManager.h:29
vsg::AnimationManager::update
virtual bool update(vsg::Animation &animation)
update animation, called automatically by AnimationManager::run()
vsg::AnimationManager::stop
virtual bool stop(vsg::ref_ptr< vsg::Animation > animation)
stop animation
vsg::AnimationManager::assignInstrumentation
virtual void assignInstrumentation(ref_ptr< Instrumentation > in_instrumentation)
assign instrumentation if required
vsg::AnimationManager::play
virtual bool play(vsg::ref_ptr< vsg::Animation > animation, double startTime=0.0)
play animation
vsg::AnimationManager::run
virtual void run(vsg::ref_ptr< vsg::FrameStamp > frameStamp)
update all the animations being played, called automatically by Viewer::update()
vsg::Inherit
Definition Inherit.h:28
vsg::ref_ptr
Definition ref_ptr.h:22