2013-03-24 10:48:39 +00:00
|
|
|
/********************************************************************************
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of IfcOpenShell. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell 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 *
|
|
|
|
|
* Lesser GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef WAVEFRONTOBJSERIALIZER_H
|
|
|
|
|
#define WAVEFRONTOBJSERIALIZER_H
|
|
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
|
2022-05-03 11:38:12 +02:00
|
|
|
#include "../serializers/serializers_api.h"
|
2023-03-21 20:15:01 +01:00
|
|
|
#include "../ifcgeom/GeometrySerializer.h"
|
2013-03-24 10:48:39 +00:00
|
|
|
|
2016-03-17 23:25:53 +02:00
|
|
|
// http://people.sc.fsu.edu/~jburkardt/txt/obj_format.txt
|
2022-05-03 11:38:12 +02:00
|
|
|
class SERIALIZERS_API WaveFrontOBJSerializer : public WriteOnlyGeometrySerializer {
|
2013-03-24 10:48:39 +00:00
|
|
|
private:
|
2021-07-11 15:01:31 +02:00
|
|
|
stream_or_filename obj_stream;
|
|
|
|
|
stream_or_filename mtl_stream;
|
2013-03-24 10:48:39 +00:00
|
|
|
unsigned int vcount_total;
|
|
|
|
|
std::set<std::string> materials;
|
|
|
|
|
public:
|
2023-11-15 10:32:20 +01:00
|
|
|
WaveFrontOBJSerializer(const stream_or_filename& obj_filename, const stream_or_filename& mtl_filename, const ifcopenshell::geometry::Settings& geometry_settings, const ifcopenshell::geometry::SerializerSettings& settings);
|
2013-03-24 10:48:39 +00:00
|
|
|
virtual ~WaveFrontOBJSerializer() {}
|
|
|
|
|
bool ready();
|
|
|
|
|
void writeHeader();
|
2024-06-10 20:11:24 +02:00
|
|
|
void writeMaterial(const ifcopenshell::geometry::taxonomy::style::ptr style);
|
2021-07-11 15:00:59 +02:00
|
|
|
void write(const IfcGeom::TriangulationElement* o);
|
|
|
|
|
void write(const IfcGeom::BRepElement* /*o*/) {}
|
2013-03-24 10:48:39 +00:00
|
|
|
void finalize() {}
|
|
|
|
|
bool isTesselated() const { return true; }
|
2015-11-23 15:52:12 +02:00
|
|
|
void setUnitNameAndMagnitude(const std::string& /*name*/, float /*magnitude*/) {}
|
2015-02-06 13:07:50 +00:00
|
|
|
void setFile(IfcParse::IfcFile*) {}
|
2013-03-24 10:48:39 +00:00
|
|
|
};
|
|
|
|
|
|
2016-03-10 11:35:32 +02:00
|
|
|
#endif
|