OMReader.cc 16.9 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1
2
3
/*===========================================================================*\
 *                                                                           *
 *                               OpenMesh                                    *
Jan Möbius's avatar
Jan Möbius committed
4
 *      Copyright (C) 2001-2015 by Computer Graphics Group, RWTH Aachen      *
Jan Möbius's avatar
Jan Möbius committed
5
6
 *                           www.openmesh.org                                *
 *                                                                           *
7
 *---------------------------------------------------------------------------*
8
 *  This file is part of OpenMesh.                                           *
Jan Möbius's avatar
Jan Möbius committed
9
 *                                                                           *
10
 *  OpenMesh is free software: you can redistribute it and/or modify         *
11
12
13
14
 *  it under the terms of the GNU Lesser General Public License as           *
 *  published by the Free Software Foundation, either version 3 of           *
 *  the License, or (at your option) any later version with the              *
 *  following exceptions:                                                    *
Jan Möbius's avatar
Jan Möbius committed
15
 *                                                                           *
16
17
18
19
20
21
22
 *  If other files instantiate templates or use macros                       *
 *  or inline functions from this file, or you compile this file and         *
 *  link it with other files to produce an executable, this file does        *
 *  not by itself cause the resulting executable to be covered by the        *
 *  GNU Lesser General Public License. This exception does not however       *
 *  invalidate any other reasons why the executable file might be            *
 *  covered by the GNU Lesser General Public License.                        *
Jan Möbius's avatar
Jan Möbius committed
23
 *                                                                           *
24
25
26
27
 *  OpenMesh is distributed in the hope that it will be useful,              *
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
 *  GNU Lesser General Public License for more details.                      *
Jan Möbius's avatar
Jan Möbius committed
28
 *                                                                           *
29
30
31
32
 *  You should have received a copy of the GNU LesserGeneral Public          *
 *  License along with OpenMesh.  If not,                                    *
 *  see <http://www.gnu.org/licenses/>.                                      *
 *                                                                           *
33
\*===========================================================================*/
34
35

/*===========================================================================*\
36
 *                                                                           *
37
38
 *   $Revision$                                                         *
 *   $Date$                   *
Jan Möbius's avatar
Jan Möbius committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 *                                                                           *
\*===========================================================================*/


//== INCLUDES =================================================================


//STL
#include <fstream>

// OpenMesh
#include <OpenMesh/Core/System/config.h>
#include <OpenMesh/Core/System/omstream.hh>
#include <OpenMesh/Core/Utils/Endian.hh>
#include <OpenMesh/Core/IO/OMFormat.hh>
#include <OpenMesh/Core/IO/reader/OMReader.hh>


//=== NAMESPACES ==============================================================


namespace OpenMesh {
namespace IO {


//=== INSTANCIATE =============================================================


// register the OMReader singleton with MeshReader
_OMReader_  __OMReaderInstance;
_OMReader_&  OMReader() { return __OMReaderInstance; }



//=== IMPLEMENTATION ==========================================================


_OMReader_::_OMReader_()
{
78
  IOManager().register_module(this);
Jan Möbius's avatar
Jan Möbius committed
79
80
81
82
83
84
}


//-----------------------------------------------------------------------------


85
bool _OMReader_::read(const std::string& _filename, BaseImporter& _bi, Options& _opt)
Jan Möbius's avatar
Jan Möbius committed
86
87
{
  // check whether importer can give us an OpenMesh BaseKernel
88
89
  if (!_bi.kernel())
    return false;
Jan Möbius's avatar
Jan Möbius committed
90
91

  _opt += Options::Binary; // only binary format supported!
92
  fileOptions_ = Options::Binary;
Jan Möbius's avatar
Jan Möbius committed
93
94

  // Open file
95
  std::ifstream ifs(_filename.c_str(), std::ios::binary);
96
97
98
99
100
101
102

  /* Clear formatting flag skipws (Skip whitespaces). If set, operator>> will
   * skip bytes set to whitespace chars (e.g. 0x20 bytes) in
   * Property<bool>::restore.
   */
  ifs.unsetf(std::ios::skipws);

103
104
  if (!ifs.is_open() || !ifs.good()) {
    omerr() << "[OMReader] : cannot not open file " << _filename << std::endl;
Jan Möbius's avatar
Jan Möbius committed
105
106
    return false;
  }
107

Jan Möbius's avatar
Jan Möbius committed
108
109
  // Pass stream to read method, remember result
  bool result = read(ifs, _bi, _opt);
110

Jan Möbius's avatar
Jan Möbius committed
111
112
  // close input stream
  ifs.close();
113

114
115
  _opt = _opt & fileOptions_;

Jan Möbius's avatar
Jan Möbius committed
116
117
118
119
120
121
  return result;
}

//-----------------------------------------------------------------------------


122
bool _OMReader_::read(std::istream& _is, BaseImporter& _bi, Options& _opt)
Jan Möbius's avatar
Jan Möbius committed
123
{
124
  // check whether importer can give us an OpenMesh BaseKernel
125
126
  if (!_bi.kernel())
    return false;
127
128

  _opt += Options::Binary; // only binary format supported!
129
  fileOptions_ = Options::Binary;
130

131
132
  if (!_is.good()) {
    omerr() << "[OMReader] : cannot read from stream " << std::endl;
133
134
135
136
137
138
    return false;
  }

  // Pass stream to read method, remember result
  bool result = read_binary(_is, _bi, _opt);

139
140
  if (result)
    _opt += Options::Binary;
Jan Möbius's avatar
Jan Möbius committed
141

142
143
  _opt = _opt & fileOptions_;

144
  return result;
Jan Möbius's avatar
Jan Möbius committed
145
146
147
148
149
150
}



//-----------------------------------------------------------------------------

151
bool _OMReader_::read_ascii(std::istream& /* _is */, BaseImporter& /* _bi */, Options& /* _opt */) const
Jan Möbius's avatar
Jan Möbius committed
152
153
154
155
156
157
158
159
{
  // not supported yet!
  return false;
}


//-----------------------------------------------------------------------------

160
bool _OMReader_::read_binary(std::istream& _is, BaseImporter& _bi, Options& _opt) const
Jan Möbius's avatar
Jan Möbius committed
161
162
163
{
  bool swap = _opt.check(Options::Swap) || (Endian::local() == Endian::MSB);

164
  // Initialize byte counter
165
  bytes_ = 0;
Jan Möbius's avatar
Jan Möbius committed
166

167
  bytes_ += restore(_is, header_, swap);
Jan Möbius's avatar
Jan Möbius committed
168
169


170
171
  while (!_is.eof()) {
    bytes_ += restore(_is, chunk_header_, swap);
Jan Möbius's avatar
Jan Möbius committed
172

173
    if (_is.eof())
Jan Möbius's avatar
Jan Möbius committed
174
175
176
      break;

    // Is this a named property restore the name
177
    if (chunk_header_.name_) {
Jan Möbius's avatar
Jan Möbius committed
178
      OMFormat::Chunk::PropertyName pn;
179
      bytes_ += restore(_is, property_name_, swap);
Jan Möbius's avatar
Jan Möbius committed
180
181
182
183
    }

    // Read in the property data. If it is an anonymous or unknown named
    // property, then skip data.
184
    switch (chunk_header_.entity_) {
185
      case OMFormat::Chunk::Entity_Vertex:
186
187
188
        if (!read_binary_vertex_chunk(_is, _bi, _opt, swap))
          return false;
        break;
Jan Möbius's avatar
Jan Möbius committed
189
      case OMFormat::Chunk::Entity_Face:
190
191
192
        if (!read_binary_face_chunk(_is, _bi, _opt, swap))
          return false;
        break;
Jan Möbius's avatar
Jan Möbius committed
193
      case OMFormat::Chunk::Entity_Edge:
194
195
196
        if (!read_binary_edge_chunk(_is, _bi, _opt, swap))
          return false;
        break;
Jan Möbius's avatar
Jan Möbius committed
197
      case OMFormat::Chunk::Entity_Halfedge:
198
199
200
        if (!read_binary_halfedge_chunk(_is, _bi, _opt, swap))
          return false;
        break;
Jan Möbius's avatar
Jan Möbius committed
201
      case OMFormat::Chunk::Entity_Mesh:
202
203
204
        if (!read_binary_mesh_chunk(_is, _bi, _opt, swap))
          return false;
        break;
Jan Möbius's avatar
Jan Möbius committed
205
      default:
206
        return false;
Jan Möbius's avatar
Jan Möbius committed
207
    }
Jan Möbius's avatar
Jan Möbius committed
208

Jan Möbius's avatar
Jan Möbius committed
209
210
211
212
213
214
215
216
217
  }

  // File was successfully parsed.
  return true;
}


//-----------------------------------------------------------------------------

218
bool _OMReader_::can_u_read(const std::string& _filename) const
Jan Möbius's avatar
Jan Möbius committed
219
220
221
{
  // !!! Assuming BaseReader::can_u_parse( std::string& )
  // does not call BaseReader::read_magic()!!!
222
223
224
  if (this->BaseReader::can_u_read(_filename)) {
    std::ifstream ifile(_filename.c_str());
    if (ifile && can_u_read(ifile))
225
      return true;
Jan Möbius's avatar
Jan Möbius committed
226
227
228
229
230
  }
  return false;
}

//-----------------------------------------------------------------------------
231

232
bool _OMReader_::can_u_read(std::istream& _is) const
Jan Möbius's avatar
Jan Möbius committed
233
234
235
236
237
{
  std::vector<char> evt;
  evt.reserve(20);

  // read first 4 characters into a buffer
238
239
  while (evt.size() < 4)
    evt.push_back(static_cast<char>(_is.get()));
Jan Möbius's avatar
Jan Möbius committed
240

241
  // put back all read characters
Jan Möbius's avatar
Jan Möbius committed
242
  std::vector<char>::reverse_iterator it = evt.rbegin();
243
244
  while (it != evt.rend())
    _is.putback(*it++);
Jan Möbius's avatar
Jan Möbius committed
245
246

  // evaluate header information
247
  OMFormat::Header *hdr = (OMFormat::Header*) &evt[0];
Jan Möbius's avatar
Jan Möbius committed
248
249
250
251
252
253

  // first two characters must be 'OM'
  if (hdr->magic_[0] != 'O' || hdr->magic_[1] != 'M')
    return false;

  // 3rd characters defines the mesh type:
254
  switch (hdr->mesh_) {
Jan Möbius's avatar
Jan Möbius committed
255
256
257
258
259
260
261
    case 'T': // Triangle Mesh
    case 'Q': // Quad Mesh
    case 'P': // Polygonal Mesh
      break;
    default:  // ?
      return false;
  }
262

Jan Möbius's avatar
Jan Möbius committed
263
  // 4th characters encodes the version
264
  return supports(hdr->version_);
Jan Möbius's avatar
Jan Möbius committed
265
266
267
268
}

//-----------------------------------------------------------------------------

269
bool _OMReader_::supports(const OMFormat::uint8 /* version */) const
Jan Möbius's avatar
Jan Möbius committed
270
271
272
273
274
275
276
{
  return true;
}


//-----------------------------------------------------------------------------

277
bool _OMReader_::read_binary_vertex_chunk(std::istream &_is, BaseImporter &_bi, Options &_opt, bool _swap) const
Jan Möbius's avatar
Jan Möbius committed
278
279
280
{
  using OMFormat::Chunk;

281
  assert( chunk_header_.entity_ == Chunk::Entity_Vertex);
282

283
284
  OpenMesh::Vec3f v3f;
  OpenMesh::Vec2f v2f;
Jan Möbius's avatar
Jan Möbius committed
285
286
287
288
  OpenMesh::Vec3uc v3uc; // rgb

  OMFormat::Chunk::PropertyName custom_prop;

289
290
  size_t vidx = 0;
  switch (chunk_header_.type_) {
Jan Möbius's avatar
Jan Möbius committed
291
    case Chunk::Type_Pos:
292
      assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec3f::dim()));
Jan Möbius's avatar
Jan Möbius committed
293

294
295
296
      for (; vidx < header_.n_vertices_ && !_is.eof(); ++vidx) {
        bytes_ += vector_restore(_is, v3f, _swap);
        _bi.add_vertex(v3f);
Jan Möbius's avatar
Jan Möbius committed
297
298
299
300
      }
      break;

    case Chunk::Type_Normal:
301
      assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec3f::dim()));
Jan Möbius's avatar
Jan Möbius committed
302

303
      fileOptions_ += Options::VertexNormal;
304
305
      for (; vidx < header_.n_vertices_ && !_is.eof(); ++vidx) {
        bytes_ += vector_restore(_is, v3f, _swap);
306
        if (fileOptions_.vertex_has_normal() && _opt.vertex_has_normal())
307
          _bi.set_normal(VertexHandle(int(vidx)), v3f);
Jan Möbius's avatar
Jan Möbius committed
308
309
310
311
      }
      break;

    case Chunk::Type_Texcoord:
312
      assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec2f::dim()));
Jan Möbius's avatar
Jan Möbius committed
313

314
      fileOptions_ += Options::VertexTexCoord;
315
316
      for (; vidx < header_.n_vertices_ && !_is.eof(); ++vidx) {
        bytes_ += vector_restore(_is, v2f, _swap);
317
        if (fileOptions_.vertex_has_texcoord() && _opt.vertex_has_texcoord())
318
          _bi.set_texcoord(VertexHandle(int(vidx)), v2f);
Jan Möbius's avatar
Jan Möbius committed
319
      }
320
      break;
Jan Möbius's avatar
Jan Möbius committed
321
322
323

    case Chunk::Type_Color:

324
      assert( OMFormat::dimensions(chunk_header_) == 3);
Jan Möbius's avatar
Jan Möbius committed
325

326
      fileOptions_ += Options::VertexColor;
327

328
329
      for (; vidx < header_.n_vertices_ && !_is.eof(); ++vidx) {
        bytes_ += vector_restore(_is, v3uc, _swap);
330
        if (fileOptions_.vertex_has_color() && _opt.vertex_has_color())
331
          _bi.set_color(VertexHandle(int(vidx)), v3uc);
Jan Möbius's avatar
Jan Möbius committed
332
333
334
335
      }
      break;

    case Chunk::Type_Custom:
336

337
      bytes_ += restore_binary_custom_data(_is, _bi.kernel()->_get_vprop(property_name_), header_.n_vertices_, _swap);
Jan Möbius's avatar
Jan Möbius committed
338
339
340
341
342
343
344
345

      vidx = header_.n_vertices_;

      break;

    default: // skip unknown chunks
    {
      omerr() << "Unknown chunk type ignored!\n";
346
347
      size_t size_of = header_.n_vertices_ * OMFormat::vector_size(chunk_header_);
      _is.ignore(size_of);
Jan Möbius's avatar
Jan Möbius committed
348
349
350
351
352
353
354
355
356
357
358
      bytes_ += size_of;
    }
  }

  // all chunk data has been read..?!
  return vidx == header_.n_vertices_;
}


//-----------------------------------------------------------------------------

359
bool _OMReader_::read_binary_face_chunk(std::istream &_is, BaseImporter &_bi, Options &_opt, bool _swap) const
Jan Möbius's avatar
Jan Möbius committed
360
361
362
{
  using OMFormat::Chunk;

363
  assert( chunk_header_.entity_ == Chunk::Entity_Face);
Jan Möbius's avatar
Jan Möbius committed
364

365
366
  size_t fidx = 0;
  OpenMesh::Vec3f v3f;  // normal
Jan Möbius's avatar
Jan Möbius committed
367
368
  OpenMesh::Vec3uc v3uc; // rgb

369
370
371
372
373
374
375
376
377
378
379
380
381
  switch (chunk_header_.type_) {
    case Chunk::Type_Topology: {
      BaseImporter::VHandles vhandles;
      size_t nV = 0;
      size_t vidx = 0;

      switch (header_.mesh_) {
        case 'T':
          nV = 3;
          break;
        case 'Q':
          nV = 4;
          break;
Jan Möbius's avatar
Jan Möbius committed
382
      }
383

384
385
386
      for (; fidx < header_.n_faces_; ++fidx) {
        if (header_.mesh_ == 'P')
          bytes_ += restore(_is, nV, Chunk::Integer_16, _swap);
Jan Möbius's avatar
Jan Möbius committed
387

388
389
390
        vhandles.clear();
        for (size_t j = 0; j < nV; ++j) {
          bytes_ += restore(_is, vidx, Chunk::Integer_Size(chunk_header_.bits_), _swap);
Jan Möbius's avatar
Jan Möbius committed
391

392
          vhandles.push_back(VertexHandle(int(vidx)));
393
        }
Jan Möbius's avatar
Jan Möbius committed
394

395
        _bi.add_face(vhandles);
Jan Möbius's avatar
Jan Möbius committed
396
397
      }
    }
398
      break;
Jan Möbius's avatar
Jan Möbius committed
399
400

    case Chunk::Type_Normal:
401
      assert( OMFormat::dimensions(chunk_header_) == size_t(OpenMesh::Vec3f::dim()));
Jan Möbius's avatar
Jan Möbius committed
402

403
      fileOptions_ += Options::FaceNormal;
404
405
      for (; fidx < header_.n_faces_ && !_is.eof(); ++fidx) {
        bytes_ += vector_restore(_is, v3f, _swap);
406
        if( fileOptions_.face_has_normal() && _opt.face_has_normal())
407
          _bi.set_normal(FaceHandle(int(fidx)), v3f);
Jan Möbius's avatar
Jan Möbius committed
408
409
410
411
412
      }
      break;

    case Chunk::Type_Color:

413
      assert( OMFormat::dimensions(chunk_header_) == 3);
Jan Möbius's avatar
Jan Möbius committed
414

415
      fileOptions_ += Options::FaceColor;
416
417
      for (; fidx < header_.n_faces_ && !_is.eof(); ++fidx) {
        bytes_ += vector_restore(_is, v3uc, _swap);
418
        if( fileOptions_.face_has_color() && _opt.face_has_color())
419
          _bi.set_color(FaceHandle(int(fidx)), v3uc);
Jan Möbius's avatar
Jan Möbius committed
420
421
422
423
      }
      break;

    case Chunk::Type_Custom:
424

425
      bytes_ += restore_binary_custom_data(_is, _bi.kernel()->_get_fprop(property_name_), header_.n_faces_, _swap);
Jan Möbius's avatar
Jan Möbius committed
426
427
428
429

      fidx = header_.n_faces_;

      break;
430

Jan Möbius's avatar
Jan Möbius committed
431
432
433
434
    default: // skip unknown chunks
    {
      omerr() << "Unknown chunk type ignore!\n";
      size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
435
      _is.ignore(size_of);
436
      bytes_ += size_of;
Jan Möbius's avatar
Jan Möbius committed
437
438
439
440
441
442
443
444
    }
  }
  return fidx == header_.n_faces_;
}


//-----------------------------------------------------------------------------

445
bool _OMReader_::read_binary_edge_chunk(std::istream &_is, BaseImporter &_bi, Options &/*_opt */, bool _swap) const
Jan Möbius's avatar
Jan Möbius committed
446
447
448
{
  using OMFormat::Chunk;

449
  assert( chunk_header_.entity_ == Chunk::Entity_Edge);
Jan Möbius's avatar
Jan Möbius committed
450

451
  size_t b = bytes_;
Jan Möbius's avatar
Jan Möbius committed
452

453
  switch (chunk_header_.type_) {
454
    case Chunk::Type_Custom:
Jan Möbius's avatar
Jan Möbius committed
455

456
      bytes_ += restore_binary_custom_data(_is, _bi.kernel()->_get_eprop(property_name_), header_.n_edges_, _swap);
Jan Möbius's avatar
Jan Möbius committed
457
458
459
460
461
462

      break;

    default:
      // skip unknown type
      size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
463
      _is.ignore(size_of);
Jan Möbius's avatar
Jan Möbius committed
464
465
466
467
468
469
470
471
472
      bytes_ += size_of;
  }

  return b < bytes_;
}


//-----------------------------------------------------------------------------

473
bool _OMReader_::read_binary_halfedge_chunk(std::istream &_is, BaseImporter &_bi, Options &/* _opt */, bool _swap) const
Jan Möbius's avatar
Jan Möbius committed
474
475
476
{
  using OMFormat::Chunk;

477
  assert( chunk_header_.entity_ == Chunk::Entity_Halfedge);
Jan Möbius's avatar
Jan Möbius committed
478
479
480

  size_t b = bytes_;

481
  switch (chunk_header_.type_) {
Jan Möbius's avatar
Jan Möbius committed
482
483
    case Chunk::Type_Custom:

484
      bytes_ += restore_binary_custom_data(_is, _bi.kernel()->_get_hprop(property_name_), 2 * header_.n_edges_, _swap);
Jan Möbius's avatar
Jan Möbius committed
485
486
487
488
489
490
      break;

    default:
      // skip unknown chunk
      omerr() << "Unknown chunk type ignored!\n";
      size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
491
      _is.ignore(size_of);
Jan Möbius's avatar
Jan Möbius committed
492
493
494
495
496
497
498
499
500
      bytes_ += size_of;
  }

  return b < bytes_;
}


//-----------------------------------------------------------------------------

501
bool _OMReader_::read_binary_mesh_chunk(std::istream &_is, BaseImporter &_bi, Options & /* _opt */, bool _swap) const
Jan Möbius's avatar
Jan Möbius committed
502
503
504
{
  using OMFormat::Chunk;

505
  assert( chunk_header_.entity_ == Chunk::Entity_Mesh);
Jan Möbius's avatar
Jan Möbius committed
506
507
508

  size_t b = bytes_;

509
  switch (chunk_header_.type_) {
Jan Möbius's avatar
Jan Möbius committed
510
    case Chunk::Type_Custom:
511

512
      bytes_ += restore_binary_custom_data(_is, _bi.kernel()->_get_mprop(property_name_), 1, _swap);
513

Jan Möbius's avatar
Jan Möbius committed
514
515
516
517
518
      break;

    default:
      // skip unknown chunk
      size_t size_of = OMFormat::chunk_data_size(header_, chunk_header_);
519
      _is.ignore(size_of);
Jan Möbius's avatar
Jan Möbius committed
520
521
522
523
524
525
526
527
528
529
      bytes_ += size_of;
  }

  return b < bytes_;
}


//-----------------------------------------------------------------------------


530
size_t _OMReader_::restore_binary_custom_data(std::istream& _is, BaseProperty* _bp, size_t _n_elem, bool _swap) const
531
{
532
  assert( !_bp || (_bp->name() == property_name_));
Jan Möbius's avatar
Jan Möbius committed
533
534
535

  using OMFormat::Chunk;

536
537
  size_t bytes = 0;
  Chunk::esize_t block_size;
Jan Möbius's avatar
Jan Möbius committed
538
539
  Chunk::PropertyName custom_prop;

540
  bytes += restore(_is, block_size, OMFormat::Chunk::Integer_32, _swap);
Jan Möbius's avatar
Jan Möbius committed
541

542
543
  if (_bp) {
    size_t n_bytes = _bp->size_of(_n_elem);
Jan Möbius's avatar
Jan Möbius committed
544

545
546
    if (((n_bytes == BaseProperty::UnknownSize) || (n_bytes == block_size))
        && (_bp->element_size() == BaseProperty::UnknownSize || (_n_elem * _bp->element_size() == block_size))) {
Jan Möbius's avatar
Jan Möbius committed
547
#if defined(OM_DEBUG)
Jan Möbius's avatar
Jan Möbius committed
548
      size_t b;
Jan Möbius's avatar
Jan Möbius committed
549
550
      bytes += (b=_bp->restore( _is, _swap ));
#else
551
      bytes += _bp->restore(_is, _swap);
Jan Möbius's avatar
Jan Möbius committed
552
#endif
553

Jan Möbius's avatar
Jan Möbius committed
554
555
556
#if defined(OM_DEBUG)
      assert( block_size == b );
#endif
557
558

      assert( block_size == _bp->size_of());
Jan Möbius's avatar
Jan Möbius committed
559
560

      block_size = 0;
561
562
    } else {
      omerr() << "Warning! Property " << _bp->name() << " not loaded: " << "Mismatching data sizes!n";
Jan Möbius's avatar
Jan Möbius committed
563
564
565
    }
  }

566
567
568
  if (block_size) {
    _is.ignore(block_size);
    bytes += block_size;
Jan Möbius's avatar
Jan Möbius committed
569
570
571
572
573
574
575
576
577
578
579
580
  }

  return bytes;
}


//-----------------------------------------------------------------------------

//=============================================================================
} // namespace IO
} // namespace OpenMesh
//=============================================================================