foamGltfBufferView.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 "foamGltfBufferView.H"
29
30// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31
33:
34 base(),
35 buffer_(0),
36 byteOffset_(-1),
37 byteLength_(-1),
38 target_(-1)
39{}
40
41
43:
44 base("BufferView:"+name),
45 buffer_(0),
46 byteOffset_(-1),
47 byteLength_(-1),
48 target_(-1)
49{}
50
51
52// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
53
55{
56 return buffer_;
57}
58
59
61{
62 return byteOffset_;
63}
64
65
67{
68 return byteLength_;
69}
70
71
73{
74 return target_;
75}
76
77
79{
80 os << indent << "\"buffer\" : " << buffer_ << "," << nl
81 << indent << "\"byteOffset\" : " << byteOffset_ << "," << nl
82 << indent << "\"byteLength\" : " << byteLength_;
83
84 if (target_ != -1)
85 {
86 os << "," << nl
87 << indent << "\"target\" : " << target_;
88 }
89
91}
92
93
95{
97
98 buffer_ = bv.buffer_;
99 byteOffset_ = bv.byteOffset_;
100 byteLength_ = bv.byteLength_;
101 target_ = bv.target_;
102}
103
104
106{
107 bv.write(os);
108
109 return os;
110}
111
112
113// ************************************************************************* //
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.
Base class for glTF entities.
Definition: foamGltfBase.H:122
void operator=(const base &gltf)
Definition: foamGltfBase.H:180
glTF buffer view - provides a view/slice of the glTF buffer
label & byteLength() noexcept
Return the byte length.
label & buffer() noexcept
Return the buffer index.
label buffer_
Buffer index.
label byteLength_
Byte length.
void write(Ostream &os) const
Write.
label & byteOffset() noexcept
Return the byte offset.
bufferView()
Default construct.
label & target() noexcept
Return the target.
void operator=(const bufferView &bv)
label byteOffset_
Byte offset.
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