Mesh: [skip ci] support compressed X3D output
This commit is contained in:
@@ -1772,6 +1772,7 @@ std::vector<std::string> MeshOutput::supportedMeshFormats()
|
||||
fmt.emplace_back("off");
|
||||
fmt.emplace_back("smf");
|
||||
fmt.emplace_back("x3d");
|
||||
fmt.emplace_back("x3dz");
|
||||
fmt.emplace_back("xhtml");
|
||||
fmt.emplace_back("wrl");
|
||||
fmt.emplace_back("wrz");
|
||||
@@ -1813,6 +1814,9 @@ MeshIO::Format MeshOutput::GetFormat(const char* FileName)
|
||||
else if (file.hasExtension("x3d")) {
|
||||
return MeshIO::X3D;
|
||||
}
|
||||
else if (file.hasExtension("x3dz")) {
|
||||
return MeshIO::X3DZ;
|
||||
}
|
||||
else if (file.hasExtension("xhtml")) {
|
||||
return MeshIO::X3DOM;
|
||||
}
|
||||
@@ -1928,6 +1932,13 @@ bool MeshOutput::SaveAny(const char* FileName, MeshIO::Format format) const
|
||||
if (!SaveX3D(str))
|
||||
throw Base::FileException("Export of X3D failed",FileName);
|
||||
}
|
||||
else if (fileformat == MeshIO::X3DZ) {
|
||||
// Compressed X3D is nothing else than a GZIP'ped X3D ascii file
|
||||
zipios::GZIPOutputStream gzip(str);
|
||||
// write file
|
||||
if (!SaveX3D(gzip))
|
||||
throw Base::FileException("Export of compressed X3D mesh failed",FileName);
|
||||
}
|
||||
else if (fileformat == MeshIO::X3DOM) {
|
||||
// write file
|
||||
if (!SaveX3DOM(str))
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace MeshIO {
|
||||
MGL,
|
||||
IV,
|
||||
X3D,
|
||||
X3DZ,
|
||||
X3DOM,
|
||||
VRML,
|
||||
WRZ,
|
||||
|
||||
@@ -169,6 +169,7 @@ PyObject* MeshPy::read(PyObject *args, PyObject *kwds)
|
||||
ext["OFF" ] = MeshCore::MeshIO::OFF;
|
||||
ext["IV" ] = MeshCore::MeshIO::IV;
|
||||
ext["X3D" ] = MeshCore::MeshIO::X3D;
|
||||
ext["X3DZ"] = MeshCore::MeshIO::X3DZ;
|
||||
ext["VRML"] = MeshCore::MeshIO::VRML;
|
||||
ext["WRL" ] = MeshCore::MeshIO::VRML;
|
||||
ext["WRZ" ] = MeshCore::MeshIO::WRZ;
|
||||
@@ -220,6 +221,7 @@ PyObject* MeshPy::write(PyObject *args, PyObject *kwds)
|
||||
ext["MGL" ] = MeshCore::MeshIO::MGL;
|
||||
ext["IV" ] = MeshCore::MeshIO::IV;
|
||||
ext["X3D" ] = MeshCore::MeshIO::X3D;
|
||||
ext["X3DZ" ] = MeshCore::MeshIO::X3DZ;
|
||||
ext["X3DOM"] = MeshCore::MeshIO::X3DOM;
|
||||
ext["VRML" ] = MeshCore::MeshIO::VRML;
|
||||
ext["WRL" ] = MeshCore::MeshIO::VRML;
|
||||
|
||||
@@ -516,6 +516,7 @@ void CmdMeshExport::activated(int)
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.off)").arg(QObject::tr("Object File Format")), "OFF");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.iv)").arg(QObject::tr("Inventor V2.1 ascii")), "IV");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.x3d)").arg(QObject::tr("X3D Extensible 3D")), "X3D");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.x3dz)").arg(QObject::tr("Compressed X3D")), "X3DZ");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.xhtml)").arg(QObject::tr("WebGL/X3D")), "X3DOM");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.ply)").arg(QObject::tr("Stanford Polygon")), "PLY");
|
||||
ext << qMakePair<QString, QByteArray>(QString::fromLatin1("%1 (*.wrl *.vrml)").arg(QObject::tr("VRML V2.0")), "VRML");
|
||||
|
||||
Reference in New Issue
Block a user