vsg 1.1.3
VulkanSceneGraph library
Loading...
Searching...
No Matches
MorphSampler.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/Animation.h>
16
17namespace vsg
18{
19
20 struct MorphKey
21 {
22 double time;
23 std::vector<unsigned int> values;
24 std::vector<double> weights;
25
26 bool operator<(const MorphKey& rhs) const { return time < rhs.time; }
27 };
28 VSG_type_name(vsg::MorphKey);
29
30 class VSG_DECLSPEC MorphKeyframes : public Inherit<Object, MorphKeyframes>
31 {
32 public:
34
36 std::string name;
37
39 std::vector<MorphKey> keyframes;
40
41 void read(Input& input) override;
42 void write(Output& output) const override;
43 };
44 VSG_type_name(vsg::MorphKeyframes);
45
47 class VSG_DECLSPEC MorphSampler : public Inherit<AnimationSampler, MorphSampler>
48 {
49 public:
51 MorphSampler(const MorphSampler& rhs, const CopyOp& copyop = {});
52
54 ref_ptr<Object> object;
55
56 void update(double time) override;
57 double maxTime() const override;
58
59 public:
60 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return MorphSampler::create(*this, copyop); }
61 int compare(const Object& rhs) const override;
62
63 void read(Input& input) override;
64 void write(Output& output) const override;
65 };
66 VSG_type_name(vsg::MorphSampler);
67
68} // namespace vsg
Definition Object.h:42
Definition Inherit.h:28
Definition Input.h:44
Definition MorphSampler.h:31
std::vector< MorphKey > keyframes
key frames
Definition MorphSampler.h:39
std::string name
name of animation
Definition MorphSampler.h:36
Animation sampler for morphing geometry, implementation not yet completed.
Definition MorphSampler.h:48
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition MorphSampler.h:60
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
Definition Object.h:60
Definition Output.h:41
Definition ref_ptr.h:22
Definition MorphSampler.h:21