foamGltfAnimation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::glTF::animation
28 
29 Description
30  glTF animation
31 
32 Note
33  Implements the glTF v2 specification
34 
35 SourceFiles
36  foamGltfAnimation.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef foam_gltf_animation_H
41 #define foam_gltf_animation_H
42 
43 #include "foamGltfBase.H"
44 #include "DynamicList.H"
45 #include "Tuple2.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace glTF
52 {
53  class animation;
54 }
55 
56 Ostream& operator<<(Ostream& os, const glTF::animation& animation);
57 
58 namespace glTF
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class glTF::animation Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 
66 class animation
67 :
68  public base
69 {
70 protected:
71 
72  // Local Helpers
73 
74  // Sampler
75  struct glTFSampler
76  {
77  label input;
78  string interpolation;
79  label output;
80  };
81 
82  // Channel target
83  struct glTFTarget
84  {
85  label node;
86  string path;
87  };
88 
89  // Channel
90  struct glTFChannel
91  {
92  label samplerId;
94  };
95 
96 
97 
98  // Protected Member Data
99 
100  //- Samplers
102 
103  //- Channels
105 
106 
107 public:
108 
109  // Constructors
110 
111  //- Default construct
112  animation();
113 
114  //- Construct with name
115  explicit animation(const word& name);
116 
117 
118  //- Destructor
119  ~animation() = default;
120 
121 
122  // Public Member Functions
123 
124  //- Add translation
125  void addTranslation
126  (
127  const label inputId,
128  const label outputId,
129  const label nodeId,
130  const string& interpolation
131  );
132 
133  //- Write
134  void write(Ostream& os) const;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace glTF
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
Foam::glTF::animation::glTFSampler::output
label output
Definition: foamGltfAnimation.H:78
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::glTF::animation::glTFChannel::target
glTFTarget target
Definition: foamGltfAnimation.H:92
Foam::glTF::animation::channels_
DynamicList< glTFChannel > channels_
Channels.
Definition: foamGltfAnimation.H:103
Tuple2.H
Foam::DynamicList
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:55
Foam::glTF::animation::samplers_
DynamicList< glTFSampler > samplers_
Samplers.
Definition: foamGltfAnimation.H:100
Foam::glTF::animation::glTFSampler
Definition: foamGltfAnimation.H:74
Foam::glTF::animation::glTFTarget::path
string path
Definition: foamGltfAnimation.H:85
Foam::glTF::animation::write
void write(Ostream &os) const
Write.
Definition: foamGltfAnimation.C:72
Foam::glTF::base::name
const word & name() const noexcept
Return const access to the name.
Definition: foamGltfBase.H:165
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::glTF::base
Base class for glTF entities.
Definition: foamGltfBase.H:121
Foam::glTF::animation::glTFSampler::input
label input
Definition: foamGltfAnimation.H:76
foamGltfBase.H
Foam::glTF::animation::glTFTarget
Definition: foamGltfAnimation.H:82
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:96
Foam::glTF::animation
glTF animation
Definition: foamGltfAnimation.H:65
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::glTF::animation::~animation
~animation()=default
Destructor.
Foam::glTF::animation::glTFSampler::interpolation
string interpolation
Definition: foamGltfAnimation.H:77
Foam::glTF::animation::glTFChannel
Definition: foamGltfAnimation.H:89
Foam::glTF::animation::glTFChannel::samplerId
label samplerId
Definition: foamGltfAnimation.H:91
DynamicList.H
Foam::glTF::animation::addTranslation
void addTranslation(const label inputId, const label outputId, const label nodeId, const string &interpolation)
Add translation.
Definition: foamGltfAnimation.C:51
Foam::glTF::animation::glTFTarget::node
label node
Definition: foamGltfAnimation.H:84
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::glTF::animation::animation
animation()
Default construct.
Definition: foamGltfAnimation.C:32