]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
plugins: chose Radiant IQM plugin, iqmmodel for macOS, picomodel for everything else illwieckz/iqm
authorThomas Debesse <dev@illwieckz.net>
Tue, 15 Aug 2023 22:42:01 +0000 (00:42 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 15 Aug 2023 22:42:01 +0000 (00:42 +0200)
The picomodel IQM code makes NetRadiant crash on macOS.
No one has found time to investigate this in month.

We need a working NetRadiant IQM plugin to load
Unvanquished game entity models on macOS, the
plugin from AAradiant (AlienArena project) is
known to work.

Q3map2 uses picomodel to load IQM on all platforms
because iqmmodel plugin is radiant-only, so there
may be a remaining bug when baking IQM models in BSP
with q3map2 on macOS (not tested), but editing a map
with IQM entity models and misc_animated_models will
not crash NetRadiant.

This patch makes possible to release a macOS NetRadiant
build that don't crash when rendering IQM models.

We should fix picomodel crash with IQM on macOS in any way,
because it is believed q3map2 may need it, but waiting for
a picomodel fix will not delay any NetRadiant release.

One can force NetRadiant to be built against a given IQM
plugin (for example to debug it) whatever the platform
by setting the RADIANT_IQM_PLUGIN CMake variable to
either `iqmmodel` or `picomodel`. Any other value,
including empty string, will set the default plugin for
the platform.

CMakeLists.txt
libs/picomodel/CMakeLists.txt
libs/picomodel/picomodules.c
plugins/CMakeLists.txt
radiant/console.cpp

index 839813ea8733e22f05b75fde4b96ec0b3486ed07..e5cd054448942698c89e7ba4d11ed583b486ebf2 100644 (file)
@@ -267,6 +267,22 @@ if (BUILD_RADIANT)
             add_definitions(-DWORKAROUND_MACOS_GTK2_LAGGYPOINTER=1)
         endif ()
     endif()
+
+    # Should be set here because the define is used in libs/
+    set(RADIANT_IQM_PLUGIN_HELP "IQM Plugin used by NetRadiant (iqmmodel, picomodel)")
+    set(RADIANT_IQM_PLUGIN "" CACHE STRING "${RADIANT_IQM_PLUGIN_HELP}")
+    if("${RADIANT_IQM_PLUGIN}" STREQUAL "iqmmodel")
+    elseif("${RADIANT_IQM_PLUGIN}" STREQUAL "picomodel")
+    else()
+        if(APPLE)
+            # The picomodel iqm library is buggy on recent macOS
+            set(RADIANT_IQM_PLUGIN "iqmmodel" CACHE STRING "${RADIANT_IQM_PLUGIN_HELP}" FORCE)
+        else()
+            set(RADIANT_IQM_PLUGIN "picomodel" CACHE STRING "${RADIANT_IQM_PLUGIN_HELP}" FORCE)
+        endif()
+    endif()
+    add_definitions(-DRADIANT_IQM_PLUGIN_${RADIANT_IQM_PLUGIN}=1)
+    add_definitions(-DRADIANT_IQM_PLUGIN="${RADIANT_IQM_PLUGIN}")
 endif ()
 
 #-----------------------------------------------------------------------
index 2e0b96779cff2b47297158596bb7c5b312680fc9..6e0ab120fea07f81762679c5d128abcc5585cc3b 100644 (file)
@@ -1,3 +1,7 @@
+if("${RADIANT_IQM_PLUGIN}" STREQUAL "picomodel")
+        set(PICO_IQM_FILE "pm_iqm.c")
+endif()
+
 add_library(picomodel STATIC
         lwo/clip.c
         lwo/envelope.c
@@ -16,7 +20,7 @@ add_library(picomodel STATIC
         pm_3ds.c
         pm_ase.c
         pm_fm.c pm_fm.h
-        pm_iqm.c
+        ${PICO_IQM_FILE}
         pm_lwo.c
         pm_md2.c
         pm_md3.c
index 406ee16f9ba1ef81d26cd98660defacd87d23aee..9a2278f2b812e9cd76e9829ee4fcb8b401e3f93b 100644 (file)
@@ -48,7 +48,9 @@ extern const picoModule_t picoModuleMD2;
 extern const picoModule_t picoModuleFM;
 extern const picoModule_t picoModuleLWO;
 extern const picoModule_t picoModuleTerrain;
+#if defined(RADIANT_IQM_PLUGIN_picomodel)
 extern const picoModule_t picoModuleIQM;
+#endif // defined(RADIANT_IQM_PLUGIN_picomodel)
 
 
 
@@ -65,7 +67,9 @@ const picoModule_t *picoModules[] =
        &picoModuleLWO,     /* lightwave object */
        &picoModuleTerrain, /* picoterrain object */
        &picoModuleOBJ,     /* wavefront object */
+#if defined(RADIANT_IQM_PLUGIN_picomodel)
        &picoModuleIQM,     /* interquake model */
+#endif // defined(RADIANT_IQM_PLUGIN_picomodel)
        NULL                /* arnold */
 };
 
index 8db4b7fa212ea1010dea0fea6eb11927da510765..db306aeb26a7238bcd501ffe2d549ca134b1d3cf 100644 (file)
@@ -26,10 +26,17 @@ add_subdirectory(imagehl)
 add_subdirectory(imagepng)
 add_subdirectory(imageq2)
 add_subdirectory(imagewebp)
-add_subdirectory(iqmmodel)
+
+if("${RADIANT_IQM_PLUGIN}" STREQUAL "iqmmodel")
+    add_subdirectory(iqmmodel)
+endif()
+
 add_subdirectory(mapq3)
 add_subdirectory(mapxml)
 add_subdirectory(md3model)
+
+# picomodel: md3, obj, ase, (optional) iqm
 add_subdirectory(model)
+
 add_subdirectory(shaders)
 add_subdirectory(vfspk3)
index 489f8d61f4773dcae99d991ffab2c7d6d7236ed8..214bbea771ebf0645b8c81f024c660bbb8422718 100644 (file)
@@ -72,6 +72,7 @@ void Sys_EnableLogFile( bool enable ){
                        time( &localtime );
                        globalOutputStream() << "Today is: " << ctime( &localtime )
                                                                 << "This is " RADIANT_NAME " " RADIANT_VERSION " compiled " __DATE__ "\n" RADIANT_ABOUTMSG "\n";
+                       globalOutputStream() << "IQM plugin: " RADIANT_IQM_PLUGIN "\n";
                }
                else{
                        ui::alert( ui::root, "Failed to create log file, check write permissions in " RADIANT_NAME " directory.\n",