| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| |
|
| | #include <boost/core/ignore_unused.hpp> |
| | #include <Standard_Version.hxx> |
| | #include <TColStd_IndexedDataMapOfStringString.hxx> |
| | #include <Message_ProgressRange.hxx> |
| | #include <RWGltf_CafWriter.hxx> |
| |
|
| | #include "WriterGltf.h" |
| | #include <Base/Exception.h> |
| | #include <Mod/Part/App/encodeFilename.h> |
| |
|
| | using namespace Import; |
| |
|
| | WriterGltf::WriterGltf(const Base::FileInfo& file) |
| | : file {file} |
| | {} |
| |
|
| | void WriterGltf::write(Handle(TDocStd_Document) hDoc) const |
| | { |
| | std::string utf8Name = file.filePath(); |
| | std::string name8bit = Part::encodeFilename(utf8Name); |
| |
|
| | TColStd_IndexedDataMapOfStringString aMetadata; |
| | RWGltf_CafWriter aWriter(name8bit.c_str(), file.hasExtension("glb")); |
| | aWriter.SetTransformationFormat(RWGltf_WriterTrsfFormat_Compact); |
| | |
| | aWriter.ChangeCoordinateSystemConverter().SetInputLengthUnit(0.001); |
| | aWriter.ChangeCoordinateSystemConverter().SetInputCoordinateSystem(RWMesh_CoordinateSystem_Zup); |
| | #if OCC_VERSION_HEX >= 0x070700 |
| | aWriter.SetParallel(true); |
| | #endif |
| | Standard_Boolean ret = aWriter.Perform(hDoc, aMetadata, Message_ProgressRange()); |
| | if (!ret) { |
| | throw Base::FileException("Cannot save to file: ", file); |
| | } |
| | } |
| |
|