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-------------------------------------------------------------------------------
10License
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
63{
64 return bufferViewId_;
65}
66
67
69{
70 return byteOffset_;
71}
72
73
75{
76 return componentType_;
77}
78
79
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
108}
109
110
112{
113 acc.write(os);
114
115 return os;
116}
117
118
119// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
virtual bool write()
Write the output fields.
label & componentType() noexcept
Return the component type.
label & count() noexcept
Return the data size.
accessor()
Default construct.
string & type() noexcept
Return the type.
void write(Ostream &os) const
Write.
label & byteOffset() noexcept
Return the byte offset.
label & bufferViewId() noexcept
Return the buffer view index.
Base class for glTF entities.
Definition: foamGltfBase.H:122
A class for handling character strings derived from std::string.
Definition: string.H:79
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:342
const direction noexcept
Definition: Scalar.H:223
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53