2015-04-28 11:54:17 +00:00
|
|
|
/* ========================================================================= *
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
|
|
|
|
* OpenMesh *
|
2022-01-18 09:50:04 +01:00
|
|
|
* Copyright (c) 2001-2022, RWTH-Aachen University *
|
2015-04-28 13:07:46 +00:00
|
|
|
* Department of Computer Graphics and Multimedia *
|
2015-04-28 11:33:32 +00:00
|
|
|
* All rights reserved. *
|
|
|
|
|
* www.openmesh.org *
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
2012-09-27 10:18:43 +00:00
|
|
|
*---------------------------------------------------------------------------*
|
2015-04-28 11:33:32 +00:00
|
|
|
* This file is part of OpenMesh. *
|
|
|
|
|
*---------------------------------------------------------------------------*
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
2015-04-28 11:33:32 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without *
|
|
|
|
|
* modification, are permitted provided that the following conditions *
|
|
|
|
|
* are met: *
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
2015-04-28 11:33:32 +00:00
|
|
|
* 1. Redistributions of source code must retain the above copyright notice, *
|
|
|
|
|
* this list of conditions and the following disclaimer. *
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
2015-04-28 11:33:32 +00:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright *
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the *
|
|
|
|
|
* documentation and/or other materials provided with the distribution. *
|
2009-02-06 13:37:46 +00:00
|
|
|
* *
|
2015-04-28 11:33:32 +00:00
|
|
|
* 3. Neither the name of the copyright holder nor the names of its *
|
|
|
|
|
* contributors may be used to endorse or promote products derived from *
|
|
|
|
|
* this software without specific prior written permission. *
|
2009-06-04 08:46:29 +00:00
|
|
|
* *
|
2015-04-28 11:33:32 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
|
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
|
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
|
|
|
|
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
|
|
|
|
|
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
|
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
|
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
|
|
|
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
|
|
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
|
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
|
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
|
2015-04-28 11:54:17 +00:00
|
|
|
* *
|
|
|
|
|
* ========================================================================= */
|
2009-06-04 08:46:29 +00:00
|
|
|
|
2019-01-15 11:21:12 +01:00
|
|
|
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
//== INCLUDES =================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//STL
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
|
|
// OpenMesh
|
|
|
|
|
#include <OpenMesh/Core/System/omstream.hh>
|
|
|
|
|
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
|
|
|
|
#include <OpenMesh/Core/IO/BinaryHelper.hh>
|
|
|
|
|
#include <OpenMesh/Core/IO/IOManager.hh>
|
|
|
|
|
#include <OpenMesh/Core/IO/writer/STLWriter.hh>
|
|
|
|
|
|
|
|
|
|
//=== NAMESPACES ==============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace OpenMesh {
|
|
|
|
|
namespace IO {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=== INSTANCIATE =============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_STLWriter_ __STLWriterInstance;
|
|
|
|
|
_STLWriter_& STLWriter() { return __STLWriterInstance; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=== IMPLEMENTATION ==========================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_STLWriter_::_STLWriter_() { IOManager().register_module(this); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
2023-02-28 12:20:22 +01:00
|
|
|
write(const std::string& _filename, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const
|
2009-02-06 13:37:46 +00:00
|
|
|
{
|
2023-02-28 12:20:22 +01:00
|
|
|
Options tmpOptions = _writeOptions;
|
|
|
|
|
|
2009-02-06 13:37:46 +00:00
|
|
|
// binary or ascii ?
|
|
|
|
|
if (_filename.rfind(".stla") != std::string::npos)
|
|
|
|
|
{
|
2023-02-28 12:20:22 +01:00
|
|
|
tmpOptions -= Options::Binary;
|
2009-02-06 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
else if (_filename.rfind(".stlb") != std::string::npos)
|
|
|
|
|
{
|
2023-02-28 12:20:22 +01:00
|
|
|
tmpOptions += Options::Binary;
|
2009-02-06 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-15 14:46:52 +00:00
|
|
|
// open file
|
2023-02-28 12:20:22 +01:00
|
|
|
std::fstream out(_filename.c_str(), (tmpOptions.check(Options::Binary) ? std::ios_base::binary | std::ios_base::out
|
|
|
|
|
: std::ios_base::out) );
|
2012-10-15 14:46:52 +00:00
|
|
|
|
2023-02-28 12:20:22 +01:00
|
|
|
bool result = write(out, _be, tmpOptions, _precision);
|
2012-10-15 14:46:52 +00:00
|
|
|
|
|
|
|
|
out.close();
|
|
|
|
|
|
|
|
|
|
return result;
|
2009-02-06 13:37:46 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-17 13:54:16 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
2023-02-28 12:20:22 +01:00
|
|
|
write(std::ostream& _os, BaseExporter& _be, const Options& _writeOptions, std::streamsize _precision) const
|
2009-11-17 13:54:16 +00:00
|
|
|
{
|
2012-09-27 10:18:43 +00:00
|
|
|
// check exporter features
|
2023-02-28 12:20:22 +01:00
|
|
|
if (!check(_be, _writeOptions)) return false;
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
// check writer features
|
2023-02-28 12:20:22 +01:00
|
|
|
if (_writeOptions.check(Options::VertexNormal) ||
|
|
|
|
|
_writeOptions.check(Options::VertexTexCoord) ||
|
|
|
|
|
_writeOptions.check(Options::FaceColor))
|
2012-09-27 10:18:43 +00:00
|
|
|
return false;
|
|
|
|
|
|
2023-02-28 12:20:22 +01:00
|
|
|
if (!_writeOptions.check(Options::Binary))
|
2012-10-15 14:46:52 +00:00
|
|
|
_os.precision(_precision);
|
2012-10-15 10:28:14 +00:00
|
|
|
|
2023-02-28 12:20:22 +01:00
|
|
|
if (_writeOptions & Options::Binary)
|
|
|
|
|
return write_stlb(_os, _be, _writeOptions);
|
2012-09-27 10:18:43 +00:00
|
|
|
else
|
2023-02-28 12:20:22 +01:00
|
|
|
return write_stla(_os, _be, _writeOptions);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
2009-11-18 15:39:22 +00:00
|
|
|
return false;
|
2009-11-17 13:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
|
|
|
|
write_stla(const std::string& _filename, BaseExporter& _be, Options /* _opt */) const
|
|
|
|
|
{
|
|
|
|
|
omlog() << "[STLWriter] : write ascii file\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// open file
|
|
|
|
|
FILE* out = fopen(_filename.c_str(), "w");
|
|
|
|
|
if (!out)
|
|
|
|
|
{
|
|
|
|
|
omerr() << "[STLWriter] : cannot open file " << _filename << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-05 09:08:44 +02:00
|
|
|
int i, nF(int(_be.n_faces()));
|
2009-02-06 13:37:46 +00:00
|
|
|
Vec3f a, b, c, n;
|
|
|
|
|
std::vector<VertexHandle> vhandles;
|
|
|
|
|
FaceHandle fh;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// header
|
2015-07-02 14:52:32 +00:00
|
|
|
fprintf(out, "solid \n");
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// write face set
|
|
|
|
|
for (i=0; i<nF; ++i)
|
|
|
|
|
{
|
|
|
|
|
fh = FaceHandle(i);
|
2018-04-05 09:08:44 +02:00
|
|
|
const int nV = _be.get_vhandles(fh, vhandles);
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
if (nV == 3)
|
|
|
|
|
{
|
|
|
|
|
a = _be.point(vhandles[0]);
|
|
|
|
|
b = _be.point(vhandles[1]);
|
|
|
|
|
c = _be.point(vhandles[2]);
|
|
|
|
|
n = (_be.has_face_normals() ?
|
|
|
|
|
_be.normal(fh) :
|
|
|
|
|
((c-b) % (a-b)).normalize());
|
|
|
|
|
|
|
|
|
|
fprintf(out, "facet normal %f %f %f\nouter loop\n", n[0], n[1], n[2]);
|
|
|
|
|
fprintf(out, "vertex %.10f %.10f %.10f\n", a[0], a[1], a[2]);
|
|
|
|
|
fprintf(out, "vertex %.10f %.10f %.10f\n", b[0], b[1], b[2]);
|
|
|
|
|
fprintf(out, "vertex %.10f %.10f %.10f", c[0], c[1], c[2]);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
omerr() << "[STLWriter] : Warning non-triangle data!\n";
|
|
|
|
|
|
|
|
|
|
fprintf(out, "\nendloop\nendfacet\n");
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-07 10:15:53 +00:00
|
|
|
fprintf(out, "endsolid\n");
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
fclose(out);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2012-09-27 10:18:43 +00:00
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
2012-10-15 10:28:14 +00:00
|
|
|
write_stla(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
|
2012-09-27 10:18:43 +00:00
|
|
|
{
|
|
|
|
|
omlog() << "[STLWriter] : write ascii file\n";
|
|
|
|
|
|
2018-04-05 09:08:44 +02:00
|
|
|
int i, nF(int(_be.n_faces()));
|
2012-09-27 10:18:43 +00:00
|
|
|
Vec3f a, b, c, n;
|
|
|
|
|
std::vector<VertexHandle> vhandles;
|
|
|
|
|
FaceHandle fh;
|
2012-10-15 10:28:14 +00:00
|
|
|
_out.precision(_precision);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// header
|
2015-07-02 14:52:32 +00:00
|
|
|
_out << "solid \n";
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// write face set
|
|
|
|
|
for (i=0; i<nF; ++i)
|
|
|
|
|
{
|
|
|
|
|
fh = FaceHandle(i);
|
2018-04-05 09:08:44 +02:00
|
|
|
const int nV = _be.get_vhandles(fh, vhandles);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
if (nV == 3)
|
|
|
|
|
{
|
|
|
|
|
a = _be.point(vhandles[0]);
|
|
|
|
|
b = _be.point(vhandles[1]);
|
|
|
|
|
c = _be.point(vhandles[2]);
|
|
|
|
|
n = (_be.has_face_normals() ?
|
|
|
|
|
_be.normal(fh) :
|
|
|
|
|
((c-b) % (a-b)).normalize());
|
|
|
|
|
|
|
|
|
|
_out << "facet normal " << n[0] << " " << n[1] << " " << n[2] << "\nouter loop\n";
|
|
|
|
|
_out.precision(10);
|
|
|
|
|
_out << "vertex " << a[0] << " " << a[1] << " " << a[2] << "\n";
|
|
|
|
|
_out << "vertex " << b[0] << " " << b[1] << " " << b[2] << "\n";
|
|
|
|
|
_out << "vertex " << c[0] << " " << c[1] << " " << c[2] << "\n";
|
|
|
|
|
} else {
|
|
|
|
|
omerr() << "[STLWriter] : Warning non-triangle data!\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_out << "\nendloop\nendfacet\n";
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-07 10:15:53 +00:00
|
|
|
_out << "endsolid\n";
|
|
|
|
|
|
2012-09-27 10:18:43 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2009-02-06 13:37:46 +00:00
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
|
|
|
|
write_stlb(const std::string& _filename, BaseExporter& _be, Options /* _opt */) const
|
|
|
|
|
{
|
|
|
|
|
omlog() << "[STLWriter] : write binary file\n";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// open file
|
|
|
|
|
FILE* out = fopen(_filename.c_str(), "wb");
|
|
|
|
|
if (!out)
|
|
|
|
|
{
|
|
|
|
|
omerr() << "[STLWriter] : cannot open file " << _filename << std::endl;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-05 09:08:44 +02:00
|
|
|
int i, nF(int(_be.n_faces()));
|
2009-02-06 13:37:46 +00:00
|
|
|
Vec3f a, b, c, n;
|
|
|
|
|
std::vector<VertexHandle> vhandles;
|
|
|
|
|
FaceHandle fh;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// write header
|
|
|
|
|
const char header[80] =
|
|
|
|
|
"binary stl file"
|
|
|
|
|
" ";
|
|
|
|
|
fwrite(header, 1, 80, out);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// number of faces
|
2013-07-24 06:37:27 +00:00
|
|
|
write_int( int(_be.n_faces()), out);
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// write face set
|
|
|
|
|
for (i=0; i<nF; ++i)
|
|
|
|
|
{
|
|
|
|
|
fh = FaceHandle(i);
|
2018-04-05 09:08:44 +02:00
|
|
|
const int nV = _be.get_vhandles(fh, vhandles);
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
if (nV == 3)
|
|
|
|
|
{
|
|
|
|
|
a = _be.point(vhandles[0]);
|
|
|
|
|
b = _be.point(vhandles[1]);
|
|
|
|
|
c = _be.point(vhandles[2]);
|
|
|
|
|
n = (_be.has_face_normals() ?
|
|
|
|
|
_be.normal(fh) :
|
|
|
|
|
((c-b) % (a-b)).normalize());
|
|
|
|
|
|
|
|
|
|
// face normal
|
|
|
|
|
write_float(n[0], out);
|
|
|
|
|
write_float(n[1], out);
|
|
|
|
|
write_float(n[2], out);
|
|
|
|
|
|
|
|
|
|
// face vertices
|
|
|
|
|
write_float(a[0], out);
|
|
|
|
|
write_float(a[1], out);
|
|
|
|
|
write_float(a[2], out);
|
|
|
|
|
|
|
|
|
|
write_float(b[0], out);
|
|
|
|
|
write_float(b[1], out);
|
|
|
|
|
write_float(b[2], out);
|
|
|
|
|
|
|
|
|
|
write_float(c[0], out);
|
|
|
|
|
write_float(c[1], out);
|
|
|
|
|
write_float(c[2], out);
|
|
|
|
|
|
|
|
|
|
// space filler
|
|
|
|
|
write_short(0, out);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
omerr() << "[STLWriter] : Warning: Skipped non-triangle data!\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(out);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-27 10:18:43 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
_STLWriter_::
|
2012-10-15 10:28:14 +00:00
|
|
|
write_stlb(std::ostream& _out, BaseExporter& _be, Options /* _opt */, std::streamsize _precision) const
|
2012-09-27 10:18:43 +00:00
|
|
|
{
|
|
|
|
|
omlog() << "[STLWriter] : write binary file\n";
|
|
|
|
|
|
|
|
|
|
|
2018-04-05 09:08:44 +02:00
|
|
|
int i, nF(int(_be.n_faces()));
|
2012-09-27 10:18:43 +00:00
|
|
|
Vec3f a, b, c, n;
|
|
|
|
|
std::vector<VertexHandle> vhandles;
|
|
|
|
|
FaceHandle fh;
|
2012-10-15 10:28:14 +00:00
|
|
|
_out.precision(_precision);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// write header
|
|
|
|
|
const char header[80] =
|
|
|
|
|
"binary stl file"
|
|
|
|
|
" ";
|
|
|
|
|
_out.write(header, 80);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// number of faces
|
2013-07-23 14:03:45 +00:00
|
|
|
write_int(int(_be.n_faces()), _out);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// write face set
|
|
|
|
|
for (i=0; i<nF; ++i)
|
|
|
|
|
{
|
|
|
|
|
fh = FaceHandle(i);
|
2018-04-05 09:08:44 +02:00
|
|
|
const int nV = _be.get_vhandles(fh, vhandles);
|
2012-09-27 10:18:43 +00:00
|
|
|
|
|
|
|
|
if (nV == 3)
|
|
|
|
|
{
|
|
|
|
|
a = _be.point(vhandles[0]);
|
|
|
|
|
b = _be.point(vhandles[1]);
|
|
|
|
|
c = _be.point(vhandles[2]);
|
|
|
|
|
n = (_be.has_face_normals() ?
|
|
|
|
|
_be.normal(fh) :
|
|
|
|
|
((c-b) % (a-b)).normalize());
|
|
|
|
|
|
|
|
|
|
// face normal
|
|
|
|
|
write_float(n[0], _out);
|
|
|
|
|
write_float(n[1], _out);
|
|
|
|
|
write_float(n[2], _out);
|
|
|
|
|
|
|
|
|
|
// face vertices
|
|
|
|
|
write_float(a[0], _out);
|
|
|
|
|
write_float(a[1], _out);
|
|
|
|
|
write_float(a[2], _out);
|
|
|
|
|
|
|
|
|
|
write_float(b[0], _out);
|
|
|
|
|
write_float(b[1], _out);
|
|
|
|
|
write_float(b[2], _out);
|
|
|
|
|
|
|
|
|
|
write_float(c[0], _out);
|
|
|
|
|
write_float(c[1], _out);
|
|
|
|
|
write_float(c[2], _out);
|
|
|
|
|
|
|
|
|
|
// space filler
|
|
|
|
|
write_short(0, _out);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
omerr() << "[STLWriter] : Warning: Skipped non-triangle data!\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-06 13:37:46 +00:00
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t
|
|
|
|
|
_STLWriter_::
|
|
|
|
|
binary_size(BaseExporter& _be, Options /* _opt */) const
|
|
|
|
|
{
|
|
|
|
|
size_t bytes(0);
|
|
|
|
|
size_t _12floats(12*sizeof(float));
|
|
|
|
|
|
|
|
|
|
bytes += 80; // header
|
|
|
|
|
bytes += 4; // #faces
|
|
|
|
|
|
|
|
|
|
|
2013-07-23 14:03:45 +00:00
|
|
|
int i, nF(int(_be.n_faces()));
|
2009-02-06 13:37:46 +00:00
|
|
|
std::vector<VertexHandle> vhandles;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<nF; ++i)
|
|
|
|
|
if (_be.get_vhandles(FaceHandle(i), vhandles) == 3)
|
|
|
|
|
bytes += _12floats + sizeof(short);
|
|
|
|
|
else
|
|
|
|
|
omerr() << "[STLWriter] : Warning: Skipped non-triangle data!\n";
|
|
|
|
|
|
|
|
|
|
return bytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
} // namespace IO
|
|
|
|
|
} // namespace OpenMesh
|
|
|
|
|
//=============================================================================
|