Skip to content

Commit 64bc912

Browse files
committed
Merge remote-tracking branch 'upstream/master' for interpolation consistency
2 parents da88b09 + 998439e commit 64bc912

132 files changed

Lines changed: 13215 additions & 411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cppcheck.supp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ invalidPointerCast:plugins/draco/module/vtkF3DGLTFDocumentLoader.cxx
3939
unusedStructMember:plugins/native/module/vtkF3DQuakeMDLImporter.cxx
4040
unusedStructMember:plugins/native/module/vtkF3DSPZReader.cxx
4141
constParameterPointer:vtkext/private/module/vtkF3DMetaImporter.cxx
42+
constParameterPointer:plugins/assimp/module/vtkF3DAssimpImporter.cxx

.github/actions/generic-ci/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ runs:
215215
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW
216216
-DCMAKE_MODULE_PATH=${{ (runner.os != 'Windows' || matrix.vtk_version != 'v9.3.0') && inputs.optional_deps_label == 'optional-deps' && '$(pwd)/../dependencies/install/lib/cmake/OpenVDB/' || '' }}
217217
-DCMAKE_PREFIX_PATH:PATH=$(pwd)/../dependencies/install/
218+
-DF3D_BINDINGS_C=ON
218219
-DF3D_BINDINGS_JAVA=${{ (runner.os != 'macOS' || inputs.cpu == 'arm64') && inputs.optional_deps_label == 'optional-deps' && 'ON' || 'OFF' }}
219220
-DF3D_BINDINGS_PYTHON=${{ inputs.optional_deps_label == 'optional-deps' && 'ON' || 'OFF' }}
220221
-DF3D_BINDINGS_PYTHON_GENERATE_STUBS=${{ inputs.optional_deps_label == 'optional-deps' && 'ON' || 'OFF' }}
@@ -343,7 +344,7 @@ runs:
343344
cmake -Werror=dev -Werror=deprecated --warn-uninitialized -Df3d_DIR:PATH=$(pwd)/install/lib/cmake/f3d -DCMAKE_PREFIX_PATH:PATH=$(pwd)/dependencies/install/ -DBUILD_TESTING=ON -B build_python source/python
344345
cmake --build build_python --config Release
345346
346-
- name: Configure libf3d examples
347+
- name: Configure libf3d examples (C++, C, Java)
347348
if: inputs.static_label == 'no-static'
348349
shell: bash
349350
working-directory: ${{github.workspace}}
@@ -352,6 +353,8 @@ runs:
352353
-B build_examples -S source/examples/libf3d
353354
-Df3d_DIR:PATH=$(pwd)/install/lib/cmake/f3d
354355
-DBUILD_TESTING=ON
356+
-DF3D_ENABLE_C_EXAMPLES=ON
357+
-DF3D_ENABLE_JAVA_EXAMPLES=${{ (runner.os != 'macOS' || inputs.cpu == 'arm64') && inputs.optional_deps_label == 'optional-deps' && 'ON' || 'OFF' }}
355358
-DF3D_EXAMPLES_EXTERNAL_GLFW=${{ (runner.os == 'Linux' && inputs.rendering_backend == 'auto' && inputs.vtk_version != 'v9.3.0') && 'ON' || 'OFF' }}
356359
-DF3D_EXAMPLES_EXTERNAL_QT=${{ (runner.os == 'Linux' && inputs.rendering_backend == 'auto' && inputs.vtk_version != 'v9.3.0') && 'ON' || 'OFF' }}
357360
-DF3D_EXAMPLES_EXTERNAL_FLTK=${{ (runner.os == 'Linux' && inputs.rendering_backend == 'auto' && inputs.vtk_version != 'v9.3.0') && 'ON' || 'OFF' }}

.github/actions/sanitizer-ci/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ runs:
121121
-DF3D_TESTING_ENABLE_GLX_TESTS=ON
122122
-DF3D_TESTING_ENABLE_LONG_TIMEOUT_TESTS=ON
123123
-DF3D_TESTING_ENABLE_OSMESA_TESTS=ON
124+
${{ inputs.sanitizer_type == 'undefined' && '-DF3D_BINDINGS_C=OFF' || '' }}
124125
125126
- name: Build
126127
shell: bash

.github/workflows/public-api-warn.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
with:
1717
message: |
1818
You are modifying libf3d public API! :warning:Please update bindings accordingly:warning:!
19-
You can find them in their respective directories: `python`, `java`, `webassembly`.
19+
You can find them in their respective directories: `c`, `python`, `java`, `webassembly`.

.github/workflows/versions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"webp": "v1.2.4",
4545
"zlib": "v1.2.13"
4646
},
47-
"vtk_commit_sha": "f2897dc025ab604a8edeff3f04bd07936edbc4a8",
48-
"docker_timestamp": "20250203_1",
47+
"vtk_commit_sha": "89e81f44cfb990f214aae77f6081f935c169eb64",
48+
"docker_timestamp": "20251217_0",
4949
"global_cache_index": "1"
5050
}

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ if(F3D_WINDOWS_BUILD_SHELL_THUMBNAILS_EXTENSION)
266266
add_subdirectory(winshellext)
267267
endif()
268268

269+
# C bindings
270+
option(F3D_BINDINGS_C "Create C bindings" OFF)
271+
if(F3D_BINDINGS_C)
272+
add_subdirectory(c)
273+
endif()
274+
269275
# Python bindings
270276
option(F3D_BINDINGS_PYTHON "Create Python bindings" OFF)
271277
if(F3D_BINDINGS_PYTHON)
@@ -314,6 +320,7 @@ function(f3d_report_variable f3d_var)
314320
message(STATUS "${f3d_var}: ${${f3d_var}}")
315321
endfunction()
316322

323+
f3d_report_variable(F3D_BINDINGS_C)
317324
f3d_report_variable(F3D_BINDINGS_JAVA)
318325
f3d_report_variable(F3D_BINDINGS_PYTHON)
319326
f3d_report_variable(F3D_BUILD_APPLICATION)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ F3D (pronounced `/fɛd/`) is a fast and minimalist 3D viewer desktop application
1010

1111
It is fully controllable from the command line and support configuration files. It can provide thumbnails, support interactive hotkeys, drag&drop and integration into file managers.
1212

13-
F3D also contains the libf3d, a simple library to render meshes, with a C++17 API, Python and Javascript Bindings, and experimental Java bindings.
13+
F3D also contains the libf3d, a simple library to render meshes, with a C++17 API, C, Python and Javascript Bindings, and experimental Java bindings.
1414

1515
<img src="https://media.githubusercontent.com/media/f3d-app/f3d-website/refs/heads/main/static/images/typical.png" width="640" />
1616

application/F3DStarter.cxx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ class F3DStarter::F3DInternals
140140
cam.setViewAngle(camConf.CameraViewAngle);
141141
}
142142

143-
bool reset = false;
144-
double zoomFactor = 0.9;
145143
if (camConf.CameraPosition.size() != 3 && camConf.CameraDirection.has_value())
146144
{
147145
f3d::vector3_t dir = camConf.CameraDirection.value();
@@ -153,24 +151,16 @@ class F3DStarter::F3DInternals
153151
pos[i] = foc[i] - dir[i];
154152
}
155153
cam.setPosition(pos);
156-
reset = true;
157154
}
155+
156+
cam.azimuth(camConf.CameraAzimuthAngle).elevation(camConf.CameraElevationAngle);
157+
158158
if (camConf.CameraPosition.size() != 3)
159159
{
160-
if (camConf.CameraZoomFactor > 0)
161-
{
162-
zoomFactor = camConf.CameraZoomFactor;
163-
}
164-
reset = true;
165-
}
166-
if (reset)
167-
{
168-
cam.resetToBounds(zoomFactor);
160+
cam.resetToBounds(camConf.CameraZoomFactor > 0 ? camConf.CameraZoomFactor : 0.9);
169161
}
170162

171-
cam.azimuth(camConf.CameraAzimuthAngle)
172-
.elevation(camConf.CameraElevationAngle)
173-
.setCurrentAsDefault();
163+
cam.setCurrentAsDefault();
174164
}
175165

176166
static bool HasHDRIExtension(const std::string& file)

application/testing/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ f3d_test(NAME TestMetaData DATA pdiag.vtu ARGS -m UI)
545545
f3d_test(NAME TestEdges DATA suzanne.ply ARGS -e)
546546
f3d_test(NAME TestLineWidth DATA cow.vtk ARGS -e --line-width=5)
547547
f3d_test(NAME TestLineWidthFullScene DATA suzanne.obj ARGS -e --line-width=3 --up=-Y)
548-
f3d_test(NAME TestPointCloudFullScene DATA pointsCloud.gltf ARGS --point-size=20)
549548
f3d_test(NAME TestTextureMatCapWithEdges DATA suzanne.ply ARGS -e --texture-matcap=${F3D_SOURCE_DIR}/testing/data/skin.png)
550549

551550
# Test enabling all animations
@@ -587,6 +586,11 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.3.20240729)
587586
f3d_test(NAME TestInteractionNoModelScrollBar RESOLUTION 1000,600 NO_DATA_FORCE_RENDER LONG_TIMEOUT INTERACTION UI)
588587
endif()
589588

589+
# https://gitlab.kitware.com/vtk/vtk/-/merge_requests/12678
590+
if(VTK_VERSION VERSION_GREATER_EQUAL 9.5.20251206)
591+
f3d_test(NAME TestPointCloudFullScene DATA pointsCloud.gltf ARGS --point-size=20)
592+
endif()
593+
590594
# A verbose test that needs animation index support
591595
f3d_test(NAME TestVerboseAnimationWrongAnimationTimeHigh DATA BoxAnimated.gltf ARGS --animation-time=10 --verbose REGEXP "Animation time 10 is outside of range \\[0, 3\\.70833\\], using 3\\.70833" NO_BASELINE)
592596
f3d_test(NAME TestVerboseAnimationWrongAnimationTimeLow DATA BoxAnimated.gltf ARGS --animation-time=-5 --verbose REGEXP "Animation time -5 is outside of range \\[0, 3\\.70833\\], using 0" NO_BASELINE)

c/CMakeLists.txt

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
cmake_minimum_required(VERSION 3.21)
2+
3+
project(f3d_c_api)
4+
5+
include(GNUInstallDirs)
6+
7+
# List of source files
8+
set(F3D_C_SOURCE_FILES
9+
${CMAKE_CURRENT_SOURCE_DIR}/camera_c_api.cxx
10+
${CMAKE_CURRENT_SOURCE_DIR}/context_c_api.cxx
11+
${CMAKE_CURRENT_SOURCE_DIR}/engine_c_api.cxx
12+
${CMAKE_CURRENT_SOURCE_DIR}/image_c_api.cxx
13+
${CMAKE_CURRENT_SOURCE_DIR}/interactor_c_api.cxx
14+
${CMAKE_CURRENT_SOURCE_DIR}/log_c_api.cxx
15+
${CMAKE_CURRENT_SOURCE_DIR}/options_c_api.cxx
16+
${CMAKE_CURRENT_SOURCE_DIR}/scene_c_api.cxx
17+
${CMAKE_CURRENT_SOURCE_DIR}/types_c_api.cxx
18+
${CMAKE_CURRENT_SOURCE_DIR}/utils_c_api.cxx
19+
${CMAKE_CURRENT_SOURCE_DIR}/window_c_api.cxx
20+
)
21+
22+
# List of headers that will be installed
23+
set(F3D_C_PUBLIC_HEADERS
24+
${CMAKE_CURRENT_SOURCE_DIR}/camera_c_api.h
25+
${CMAKE_CURRENT_SOURCE_DIR}/context_c_api.h
26+
${CMAKE_CURRENT_SOURCE_DIR}/engine_c_api.h
27+
${CMAKE_CURRENT_SOURCE_DIR}/image_c_api.h
28+
${CMAKE_CURRENT_SOURCE_DIR}/interactor_c_api.h
29+
${CMAKE_CURRENT_SOURCE_DIR}/log_c_api.h
30+
${CMAKE_CURRENT_SOURCE_DIR}/options_c_api.h
31+
${CMAKE_CURRENT_SOURCE_DIR}/scene_c_api.h
32+
${CMAKE_CURRENT_SOURCE_DIR}/types_c_api.h
33+
${CMAKE_CURRENT_SOURCE_DIR}/utils_c_api.h
34+
${CMAKE_CURRENT_SOURCE_DIR}/window_c_api.h
35+
)
36+
37+
add_library(c_api ${F3D_C_SOURCE_FILES})
38+
set_target_properties(c_api PROPERTIES
39+
OUTPUT_NAME "f3d_c_api"
40+
CXX_VISIBILITY_PRESET hidden
41+
CXX_STANDARD 17
42+
CXX_STANDARD_REQUIRED ON
43+
POSITION_INDEPENDENT_CODE ON
44+
)
45+
46+
target_link_libraries(c_api PRIVATE libf3d)
47+
48+
target_include_directories(c_api
49+
PUBLIC
50+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
51+
$<BUILD_INTERFACE:${F3D_BINARY_DIR}/library/public>
52+
INTERFACE
53+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
54+
)
55+
56+
target_compile_options(c_api PUBLIC ${f3d_sanitizer_compile_options})
57+
target_link_options(c_api PUBLIC ${f3d_sanitizer_link_options})
58+
59+
if(APPLE)
60+
set_target_properties(c_api PROPERTIES INSTALL_RPATH "@loader_path")
61+
elseif(UNIX)
62+
set_target_properties(c_api PROPERTIES INSTALL_RPATH "$ORIGIN")
63+
endif()
64+
65+
# testing
66+
if(BUILD_TESTING)
67+
add_subdirectory(testing)
68+
endif()
69+
70+
# installing
71+
if (BUILD_SHARED_LIBS)
72+
73+
# lib
74+
install(TARGETS c_api
75+
EXPORT f3dCApiTargets
76+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT c_api
77+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT c_api
78+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT c_api
79+
)
80+
81+
# includes
82+
install(FILES ${F3D_C_PUBLIC_HEADERS}
83+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/f3d"
84+
COMPONENT c_api)
85+
86+
# cmake
87+
export(TARGETS c_api
88+
NAMESPACE f3d::
89+
APPEND
90+
FILE "${CMAKE_BINARY_DIR}/cmake/f3dCApiTargets.cmake")
91+
92+
install(EXPORT f3dCApiTargets
93+
NAMESPACE f3d::
94+
FILE f3dCApiTargets.cmake
95+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/f3d"
96+
COMPONENT sdk EXCLUDE_FROM_ALL
97+
)
98+
99+
file(COPY "${F3D_SOURCE_DIR}/cmake/c_api-config.cmake"
100+
DESTINATION "${CMAKE_BINARY_DIR}/cmake")
101+
102+
install(
103+
FILES
104+
"${F3D_SOURCE_DIR}/cmake/c_api-config.cmake"
105+
DESTINATION
106+
"${CMAKE_INSTALL_LIBDIR}/cmake/f3d"
107+
COMPONENT sdk EXCLUDE_FROM_ALL)
108+
endif ()

0 commit comments

Comments
 (0)