diff --git a/examples/MaterialEdition/CMakeLists.txt b/examples/MaterialEdition/CMakeLists.txt index bbada6d7dd5..d072a4313bd 100644 --- a/examples/MaterialEdition/CMakeLists.txt +++ b/examples/MaterialEdition/CMakeLists.txt @@ -46,19 +46,10 @@ add_executable(${PROJECT_NAME} ${app_sources} ${app_headers} ${app_uis} ${app_re target_link_libraries(${PROJECT_NAME} PUBLIC Radium::Gui ${Qt_LIBRARIES}) # ------------------------------------------------------------------------------ -# RadiumGlTF is available here https://gitlab.irit.fr/storm/repos/radium/libgltf.git (branch -# Material_Edition_#950). Compile and install RadiumGlTF first, e.g. into -# "path/to/RadiumGlTFinstall/", then configure using cmake [your configure args] -# -DRadiumGlTF_DIR="path/to/RadiumGlTFinstall/lib/cmake" -DUSE_RADIUMGLTF=ON to use it for this -# example. -option(USE_RADIUMGLTF "Enable loading/saving files with RadiumGltf extension" OFF) -if(USE_RADIUMGLTF) - message(STATUS "${PROJECT_NAME} uses RadiumGltf extension") - # TODO : find why this find_package is needed (at least on MacOs whe ). - find_package(OpenMP QUIET) - find_package(RadiumGlTF REQUIRED) - target_compile_definitions(${PROJECT_NAME} PUBLIC USE_RADIUMGLTF) - target_link_libraries(${PROJECT_NAME} PUBLIC RadiumGlTF::RadiumGlTF) +get_target_property(HAS_GLTF_WRITER Radium::IO IO_HAS_GLTF_WRITER) +if(HAS_GLTF_WRITER) + message(STATUS "${PROJECT_NAME} uses RadiumGltf writer extension") + target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_GLTF_WRITER) endif() configure_radium_app(NAME ${PROJECT_NAME}) diff --git a/examples/MaterialEdition/main.cpp b/examples/MaterialEdition/main.cpp index 22315b33213..12097af07ba 100644 --- a/examples/MaterialEdition/main.cpp +++ b/examples/MaterialEdition/main.cpp @@ -35,11 +35,9 @@ #include #include -#ifdef USE_RADIUMGLTF +#ifdef HAS_GLTF_WRITER # include -# include # include -# include #endif using namespace Ra::Gui::Widgets; @@ -74,7 +72,7 @@ class DemoWindow : public Ra::Gui::SimpleWindow allexts.append( exts + " " ); filter.append( QString::fromStdString( loader->name() ) + " (" + exts + ");;" ); } - // add a filter concetenatting all the supported extensions + // add a filter concatenatting all the supported extensions filter.prepend( "Supported files (" + allexts + ");;" ); // remove the last ";;" of the string @@ -95,11 +93,7 @@ class DemoWindow : public Ra::Gui::SimpleWindow }; connect( fileOpenAction, &QAction::triggered, openFile ); -#ifdef USE_RADIUMGLTF - // register the gltf loader - std::shared_ptr loader = - std::make_shared(); - Ra::Engine::RadiumEngine::getInstance()->registerFileLoader( loader ); +#ifdef HAS_GLTF_WRITER // allow to save in gltf format auto fileSaveAction = new QAction( "&Save..." ); @@ -117,7 +111,7 @@ class DemoWindow : public Ra::Gui::SimpleWindow entities.begin(), entities.end(), std::back_inserter( toExport ), []( auto e ) { return e != Ra::Engine::Scene::SystemEntity::getInstance(); } ); - GLTF::glTFFileWriter writer { fileName.toStdString(), "textures/", false }; + Ra::IO::GLTF::glTFFileWriter writer { fileName.toStdString(), "textures/", false }; writer.write( toExport ); }; connect( fileSaveAction, &QAction::triggered, saveFile ); @@ -196,12 +190,6 @@ int main( int argc, char* argv[] ) { //! [Initializing the application] app.initialize( DemoWindowFactory() ); -#ifdef USE_RADIUMGLTF - app.m_mainWindow->getViewer()->makeCurrent(); - // initialize the use of GLTF library - GLTF::initializeGltf(); - app.m_mainWindow->getViewer()->doneCurrent(); -#endif app.setContinuousUpdate( false ); //! [Initializing the application]