foamGltfAccessor.C
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 \*---------------------------------------------------------------------------*/
27 
28 #include "foamGltfAccessor.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 :
34  base(),
35  bufferViewId_(-1),
36  byteOffset_(0),
37  componentType_(-1),
38  count_(-1),
39  type_(""),
40  max_(""),
41  min_(""),
42  minMax_(false)
43 {}
44 
45 
47 :
48  base("Accessor:"+name),
49  bufferViewId_(-1),
50  byteOffset_(0),
51  componentType_(-1),
52  count_(-1),
53  type_(""),
54  max_(""),
55  min_(""),
56  minMax_(false)
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 
62 Foam::label& Foam::glTF::accessor::bufferViewId() noexcept
63 {
64  return bufferViewId_;
65 }
66 
67 
68 Foam::label& Foam::glTF::accessor::byteOffset() noexcept
69 {
70  return byteOffset_;
71 }
72 
73 
74 Foam::label& Foam::glTF::accessor::componentType() noexcept
75 {
76  return componentType_;
77 }
78 
79 
80 Foam::label& Foam::glTF::accessor::count() noexcept
81 {
82  return count_;
83 }
84 
85 
87 {
88  return type_;
89 }
90 
91 
93 {
94  os << indent << "\"bufferView\" : " << bufferViewId_ << ',' << nl
95  << indent << "\"byteOffset\" : " << byteOffset_ << ',' << nl
96  << indent << "\"componentType\" : " << componentType_ << ',' << nl
97  << indent << "\"count\" : " << count_ << ',' << nl
98  << indent << "\"type\" : " << type_;
99 
100  if (minMax_)
101  {
102  os << ',' << nl
103  << indent << "\"max\" : " << max_.c_str() << ',' << nl
104  << indent << "\"min\" : " << min_.c_str();
105  }
106 
107  base::write(os);
108 }
109 
110 
112 {
113  acc.write(os);
114 
115  return os;
116 }
117 
118 
119 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::glTF::accessor::componentType
label & componentType() noexcept
Return the component type.
Definition: foamGltfAccessor.C:74
Foam::string
A class for handling character strings derived from std::string.
Definition: string.H:76
Foam::glTF::accessor::count
label & count() noexcept
Return the data size.
Definition: foamGltfAccessor.C:80
Foam::glTF::accessor::bufferViewId
label & bufferViewId() noexcept
Return the buffer view index.
Definition: foamGltfAccessor.C:62
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
foamGltfAccessor.H
Foam::glTF::accessor::byteOffset
label & byteOffset() noexcept
Return the byte offset.
Definition: foamGltfAccessor.C:68
Foam::glTF::accessor::type
string & type() noexcept
Return the type.
Definition: foamGltfAccessor.C:86
Foam::glTF::accessor
glTF accessor
Definition: foamGltfAccessor.H:66
Foam::glTF::base::write
void write(Ostream &os) const
Write.
Definition: foamGltfBase.H:171
os
OBJstream os(runTime.globalPath()/outputName)
Foam::indent
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:339
Foam::glTF::accessor::write
void write(Ostream &os) const
Write.
Definition: foamGltfAccessor.C:92
Foam::nl
constexpr char nl
Definition: Ostream.H:404
Foam::glTF::accessor::accessor
accessor()
Default construct.
Definition: foamGltfAccessor.C:32
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56