mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 08:09:39 +00:00
new u3d exporter
This commit is contained in:
parent
c5a4d16602
commit
47e194a493
20
src/external/u3d.cmake
vendored
20
src/external/u3d.cmake
vendored
@ -5,19 +5,18 @@
|
||||
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D "Allow download and use of u3d source" ON)
|
||||
|
||||
if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D)
|
||||
# todo - make release of u3d
|
||||
set(U3D_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/u3d-master")
|
||||
set(U3D_DIR "${MESHLAB_EXTERNAL_DOWNLOAD_DIR}/u3d-1.5.0")
|
||||
set(U3D_CHECK "${U3D_DIR}/CMakeLists.txt")
|
||||
|
||||
if (NOT EXISTS ${U3D_CHECK})
|
||||
set(U3D_LINK
|
||||
https://github.com/alemuntoni/u3d/archive/refs/heads/master.zip
|
||||
https://www.meshlab.net/data/libs/u3d-master.zip)
|
||||
#set(U3D_MD5 3b15b2f75206ea24b8991333562aa9ca)
|
||||
https://github.com/alemuntoni/u3d/archive/refs/tags/1.5.0.zip
|
||||
https://www.meshlab.net/data/libs/u3d-1.5.0.zip)
|
||||
set(U3D_MD5 9f940835cfc08d17169b8003fabec1c6)
|
||||
download_and_unzip(
|
||||
NAME "u3d"
|
||||
LINK ${U3D_LINK}
|
||||
#MD5 ${U3D_MD5}
|
||||
MD5 ${U3D_MD5}
|
||||
DIR ${MESHLAB_EXTERNAL_DOWNLOAD_DIR})
|
||||
if (NOT download_and_unzip_SUCCESS)
|
||||
message(STATUS "- u3d - download failed.")
|
||||
@ -25,17 +24,22 @@ if(MESHLAB_ALLOW_DOWNLOAD_SOURCE_U3D)
|
||||
endif()
|
||||
|
||||
if (EXISTS ${U3D_CHECK})
|
||||
message(STATUS "- u3d - using bundled source")
|
||||
message(STATUS "- u3d - using downloaded source")
|
||||
|
||||
set(U3D_BUILD_LIBIDTF_TEST OFF)
|
||||
set(U3D_BUILD_IDTF_TO_U3D_BIN OFF)
|
||||
set(U3D_BUILD_STATIC_IDTF_LIB OFF)
|
||||
set(MESSAGE_QUIET ON)
|
||||
add_subdirectory(${U3D_DIR})
|
||||
unset(MESSAGE_QUIET)
|
||||
unset(U3D_BUILD_LIBIDTF_TEST)
|
||||
unset(U3D_BUILD_IDTF_TO_U3D_BIN)
|
||||
install(
|
||||
TARGETS
|
||||
IDTF
|
||||
IFXCore
|
||||
IFXExporting
|
||||
IFXScheduling
|
||||
IDTF-to-U3D-converter
|
||||
DESTINATION
|
||||
${MESHLAB_LIB_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
@ -1,18 +1,27 @@
|
||||
# Copyright 2019-2020, Collabora, Ltd.
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
|
||||
# Only build if we have u3d
|
||||
if(TARGET IDTF-to-U3D-converter)
|
||||
if(TARGET IDTF)
|
||||
# IDTF to U3D converter loads some dll/so files at runtime, thar may be placed in different
|
||||
# places, depending on:
|
||||
# - build or deploy stage
|
||||
# - operative system
|
||||
# The default paths are set for deploy stage (OS is detected automatically).
|
||||
# If you are building (not deploying) MeshLab and you want to test the U3D exporter, enable this
|
||||
# option.
|
||||
# Without enabling this option, the U3D exporter WILL NOT WORK ON BUILD STAGE.
|
||||
option(MESHLAB_U3D_BUILD_MODE "If you need to test u3d exporter in build mode (not deploy), enable this" OFF)
|
||||
|
||||
set(SOURCES io_u3d.cpp)
|
||||
|
||||
set(HEADERS io_u3d.h)
|
||||
|
||||
add_meshlab_plugin(io_u3d ${SOURCES} ${HEADERS})
|
||||
target_link_libraries(io_u3d PUBLIC IDTF)
|
||||
|
||||
target_link_libraries(io_u3d PUBLIC IDTF-to-U3D-converter IFXCoreStatic ${CMAKE_DL_LIBS})
|
||||
|
||||
if(MESHLAB_U3D_BUILD_MODE)
|
||||
target_compile_definitions(io_u3d PRIVATE BUILD_MODE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Skipping io_u3d - missing u3d in external directory.")
|
||||
endif()
|
||||
|
||||
@ -33,11 +33,23 @@
|
||||
#include <wrap/io_trimesh/io_mask.h>
|
||||
|
||||
#include <QSettings>
|
||||
#include "Converter.h"
|
||||
#include <IDTF/Converter.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace vcg;
|
||||
|
||||
#ifdef BUILD_MODE
|
||||
const std::string LIB_IDTF_PATH = "../external/downloads/u3d-1.5.0";
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
const std::string LIB_IDTF_PATH = "../Frameworks";
|
||||
#elif __linux__
|
||||
const std::string LIB_IDTF_PATH = "../lib";
|
||||
#else
|
||||
const std::string LIB_IDTF_PATH = ".";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
U3DIOPlugin::U3DIOPlugin() :
|
||||
QObject(), IOPlugin()
|
||||
@ -94,7 +106,12 @@ void U3DIOPlugin::save(
|
||||
|
||||
//conversion from idtf to u3d
|
||||
int resCode = 0;
|
||||
bool result = IDTFConverter::IDTFToU3d(tmp.toStdString(), filename, resCode, _param.positionQuality);
|
||||
bool result = IDTFConverter::IDTFToU3d(
|
||||
tmp.toStdString(),
|
||||
filename,
|
||||
resCode,
|
||||
LIB_IDTF_PATH,
|
||||
_param.positionQuality);
|
||||
|
||||
if(result==false) {
|
||||
throw MLException("Error saving " + QString::fromStdString(filename) + ": \n" + vcg::tri::io::ExporterU3D<CMeshO>::ErrorMsg(resCode) + " (" + QString::number(resCode) + ")");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user