foamGltfMesh.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::mesh
28 
29 Description
30  glTF mesh
31 
32 Note
33  Implements the glTF v2 specification
34 
35 SourceFiles
36  foamGltfMesh.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef foam_gltf_mesh_H
41 #define foam_gltf_mesh_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 mesh;
54 }
55 
56 Ostream& operator<<(Ostream& os, const glTF::mesh& mesh);
57 
58 namespace glTF
59 {
60 
61 /*---------------------------------------------------------------------------*\
62  Class glTF::mesh Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class mesh
66 :
67  public base
68 {
69  // Private Data
70 
71  //- List of fields (name, accessor ID)
73 
74  //- List of colours (name, accessor ID)
76 
77  //- Accessor ID
78  label accessorId_;
79 
80 
81 public:
82 
83  // Constructors
84 
85  //- Default construct
86  mesh();
87 
88  //- Construct from name
89  explicit mesh(const word& name);
90 
91 
92  //- Destructor
93  ~mesh() = default;
94 
95 
96  // Public Member Functions
97 
98  //- Return the accessor ID
99  label& accessorId() noexcept;
100 
101  //- Add a field to the mesh
102  void addField(const word& name, const label accessorId);
103 
104  //- Add a colour to the mesh
105  void addColour(const label accessorId);
106 
107  //- Write
108  void write(Ostream& os) const;
109 };
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 } // End namespace glTF
115 } // End namespace Foam
116 
117 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
118 
119 #endif
120 
121 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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::mesh::accessorId
label & accessorId() noexcept
Return the accessor ID.
Definition: foamGltfMesh.C:52
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
foamGltfBase.H
Foam::glTF::mesh::mesh
mesh()
Default construct.
Definition: foamGltfMesh.C:32
Foam::glTF::mesh::write
void write(Ostream &os) const
Write.
Definition: foamGltfMesh.C:77
os
OBJstream os(runTime.globalPath()/outputName)
Foam::glTF::mesh::addColour
void addColour(const label accessorId)
Add a colour to the mesh.
Definition: foamGltfMesh.C:64
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::glTF::mesh::addField
void addField(const word &name, const label accessorId)
Add a field to the mesh.
Definition: foamGltfMesh.C:58
Foam::glTF::mesh
glTF mesh
Definition: foamGltfMesh.H:64
DynamicList.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::glTF::mesh::~mesh
~mesh()=default
Destructor.