Fry3DX 0.4: an easy 3D modeller

Shapes with live settings, shape editing, knife and hole tools, drawing
shapes onto other objects, combining objects (add / subtract / overlap),
copies, thickness, painting with stickers and layers, a Layout tab, a
Print tab with checks, packed .fry files with autosave, export to GLB,
glTF, FBX, OBJ, 3MF, STL and PLY, folders in Layers, its own crash
screen, and a website for GitHub Pages in docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMSrd5oe1GpUD7E6d825KP
This commit is contained in:
Nexoniarz 2026-10-19 21:18:35 +02:00
commit f3e8eca87b
135 changed files with 23423 additions and 0 deletions

119
cmake/Dependencies.cmake Normal file
View file

@ -0,0 +1,119 @@
# Third-party code, pinned. Everything is fetched so Windows and Linux build the same way.
include(FetchContent)
set(FETCHCONTENT_QUIET ON)
set(KEEL_VK_SDK 1.4.363)
FetchContent_Declare(VulkanHeaders GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers.git
GIT_TAG vulkan-sdk-${KEEL_VK_SDK}.0 GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(volk GIT_REPOSITORY https://github.com/zeux/volk.git
GIT_TAG vulkan-sdk-${KEEL_VK_SDK}.0 GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(vkbootstrap GIT_REPOSITORY https://github.com/charles-lunarg/vk-bootstrap.git
GIT_TAG v${KEEL_VK_SDK} GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(VulkanMemoryAllocator GIT_REPOSITORY https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
GIT_TAG v3.3.0 GIT_SHALLOW ON SYSTEM)
# Uses an installed SDL3 if there is one (Nix shell), otherwise builds it.
FetchContent_Declare(SDL3 GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-3.4.18 GIT_SHALLOW ON SYSTEM FIND_PACKAGE_ARGS CONFIG)
FetchContent_Declare(imgui GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.92.9b-docking GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(glm GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG 1.0.3 GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(zstd GIT_REPOSITORY https://github.com/facebook/zstd.git
GIT_TAG v1.5.7 GIT_SHALLOW ON SYSTEM SOURCE_SUBDIR build/cmake)
FetchContent_Declare(cgltf GIT_REPOSITORY https://github.com/jkuhlmann/cgltf.git
GIT_TAG v1.15 GIT_SHALLOW ON SYSTEM SOURCE_SUBDIR no-cmake)
FetchContent_Declare(stb GIT_REPOSITORY https://github.com/nothings/stb.git
GIT_TAG 2c980bb59875b0d32144a71867fbdebb2f77cd20 SYSTEM SOURCE_SUBDIR no-cmake)
FetchContent_Declare(miniaudio GIT_REPOSITORY https://github.com/mackron/miniaudio.git
GIT_TAG 0.11.25 GIT_SHALLOW ON SYSTEM SOURCE_SUBDIR no-cmake)
FetchContent_Declare(ogg GIT_REPOSITORY https://github.com/xiph/ogg.git
GIT_TAG v1.3.6 GIT_SHALLOW ON SYSTEM SOURCE_SUBDIR no-cmake)
FetchContent_Declare(opus GIT_REPOSITORY https://github.com/xiph/opus.git
GIT_TAG v1.6.1 GIT_SHALLOW ON SYSTEM)
FetchContent_Declare(opusfile GIT_REPOSITORY https://github.com/xiph/opusfile.git
GIT_TAG v0.12 GIT_SHALLOW ON SYSTEM SOURCE_SUBDIR no-cmake)
# DejaVu Sans (Bitstream Vera licence): the UI font, close to Source's Verdana look.
FetchContent_Declare(dejavu URL https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.zip
URL_HASH SHA256=7576310b219e04159d35ff61dd4a4ec4cdba4f35c00e002a136f00e96a908b0a
DOWNLOAD_EXTRACT_TIMESTAMP ON SOURCE_SUBDIR no-cmake)
# KEEL_YAPF_DIR=/path/to/YAPF uses a local checkout instead.
FetchContent_Declare(yapf GIT_REPOSITORY https://github.com/Nexoniarz/yapf.git
GIT_TAG 06a4e7db9e7e6d90132473e5606f0e6f5b1d6001 SYSTEM) # YAPF 2 (+ yapf_tex_to_rgba8: any surface as RGBA8)
if(KEEL_YAPF_DIR)
set(FETCHCONTENT_SOURCE_DIR_YAPF ${KEEL_YAPF_DIR})
endif()
set(VOLK_PULL_IN_VULKAN OFF)
set(SDL_SHARED ON)
set(SDL_STATIC OFF)
set(GLM_BUILD_TESTS OFF)
set(ZSTD_BUILD_PROGRAMS OFF)
set(ZSTD_BUILD_SHARED OFF)
set(ZSTD_BUILD_TESTS OFF)
set(ZSTD_LEGACY_SUPPORT OFF)
if(ANDROID)
set(VK_BOOTSTRAP_POSITION_INDEPENDENT_CODE ON CACHE BOOL "" FORCE) # (it sets its own, off unless shared)
endif()
FetchContent_MakeAvailable(VulkanHeaders volk vkbootstrap VulkanMemoryAllocator SDL3 glm zstd cgltf stb)
# zstd's seekable format (contrib): a normal .zst that also allows random access. YMP packs use it.
add_library(zstd_seekable STATIC
${zstd_SOURCE_DIR}/contrib/seekable_format/zstdseek_compress.c
${zstd_SOURCE_DIR}/contrib/seekable_format/zstdseek_decompress.c)
target_include_directories(zstd_seekable SYSTEM PUBLIC ${zstd_SOURCE_DIR}/contrib/seekable_format ${zstd_SOURCE_DIR}/lib)
target_include_directories(zstd_seekable PRIVATE ${zstd_SOURCE_DIR}/lib/common)
target_link_libraries(zstd_seekable PUBLIC libzstd_static)
add_library(cgltf INTERFACE)
target_include_directories(cgltf SYSTEM INTERFACE ${cgltf_SOURCE_DIR})
add_library(stb INTERFACE)
target_include_directories(stb SYSTEM INTERFACE ${stb_SOURCE_DIR})
target_link_libraries(volk PUBLIC Vulkan::Headers)
# Dear ImGui and YAPF have no CMake of their own; build them here.
FetchContent_MakeAvailable(imgui yapf)
add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp ${imgui_SOURCE_DIR}/imgui_widgets.cpp
${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_vulkan.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_opengl3.cpp)
target_include_directories(imgui SYSTEM PUBLIC ${imgui_SOURCE_DIR} ${imgui_SOURCE_DIR}/backends)
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_VULKAN_USE_VOLK)
target_link_libraries(imgui PUBLIC volk SDL3::SDL3)
if(ANDROID) # its OpenGL backend calls GLES directly there
target_link_libraries(imgui PUBLIC GLESv3 EGL)
endif()
add_library(yapf STATIC ${yapf_SOURCE_DIR}/yapf.c)
target_include_directories(yapf SYSTEM PUBLIC ${yapf_SOURCE_DIR})
find_package(Threads REQUIRED)
target_link_libraries(yapf PRIVATE Threads::Threads $<$<NOT:$<PLATFORM_ID:Windows>>:m>)
if(NOT MSVC)
target_compile_options(yapf PRIVATE -O2) # its codecs and the BC7 encoder, even in debug builds
endif()
# Audio: miniaudio for output; Ogg Opus decoding (opusfile).
set(OPUS_BUILD_TESTING OFF)
set(OPUS_BUILD_PROGRAMS OFF)
set(OPUS_INSTALL_PKG_CONFIG_MODULE OFF)
set(OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF)
FetchContent_MakeAvailable(miniaudio ogg opus opusfile dejavu)
file(WRITE ${CMAKE_BINARY_DIR}/ogg-config/ogg/config_types.h
"#pragma once\n#include <stdint.h>\ntypedef int16_t ogg_int16_t;\ntypedef uint16_t ogg_uint16_t;\ntypedef int32_t ogg_int32_t;\ntypedef uint32_t ogg_uint32_t;\ntypedef int64_t ogg_int64_t;\ntypedef uint64_t ogg_uint64_t;\n")
add_library(ogg STATIC ${ogg_SOURCE_DIR}/src/bitwise.c ${ogg_SOURCE_DIR}/src/framing.c)
target_include_directories(ogg SYSTEM PUBLIC ${ogg_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/ogg-config)
add_library(opusfile STATIC ${opusfile_SOURCE_DIR}/src/info.c ${opusfile_SOURCE_DIR}/src/internal.c
${opusfile_SOURCE_DIR}/src/opusfile.c ${opusfile_SOURCE_DIR}/src/stream.c)
target_include_directories(opusfile SYSTEM PUBLIC ${opusfile_SOURCE_DIR}/include)
target_compile_definitions(opusfile PRIVATE OP_DISABLE_HTTP OP_DISABLE_DOCS)
target_link_libraries(opusfile PUBLIC ogg Opus::opus)
add_library(miniaudio STATIC ${miniaudio_SOURCE_DIR}/miniaudio.c)
target_include_directories(miniaudio SYSTEM PUBLIC ${miniaudio_SOURCE_DIR})
target_link_libraries(miniaudio PUBLIC ${CMAKE_DL_LIBS} Threads::Threads)
if(UNIX AND NOT APPLE)
target_link_libraries(miniaudio PUBLIC m)
endif()

22
cmake/EmbedText.cmake Normal file
View file

@ -0,0 +1,22 @@
# cmake -DOUT=file.inc -DFILES="a;b" -P EmbedText.cmake
# Writes { "name", "text" }, entries as C++ raw string literals, split into chunks so no single
# literal is too long for MSVC.
string(REPLACE "|" ";" FILES "${FILES}")
set(result "")
foreach(f ${FILES})
get_filename_component(name ${f} NAME)
file(READ ${f} text)
string(LENGTH "${text}" len)
set(literal "")
set(pos 0)
while(pos LESS len)
string(SUBSTRING "${text}" ${pos} 4000 chunk)
string(APPEND literal "R\"keel(${chunk})keel\"\n")
math(EXPR pos "${pos} + 4000")
endwhile()
if(literal STREQUAL "")
set(literal "\"\"")
endif()
string(APPEND result "{\"${name}\",\n${literal}},\n")
endforeach()
file(WRITE ${OUT} "${result}")

29
cmake/Shaders.cmake Normal file
View file

@ -0,0 +1,29 @@
# keel_add_shaders(target file...) compiles GLSL to SPIR-V with glslc (KEEL_VULKAN defined) and
# embeds it: `static const uint32_t kSpv[] =\n#include "name.vert.spv.inc"\n;`
# It also embeds every shader's source text (and the shared headers) for the OpenGL backend,
# which compiles them at runtime with KEEL_GL defined: shaders/gl_sources.inc, a list of
# { "name", "source" } entries.
find_program(GLSLC glslc HINTS $ENV{VULKAN_SDK}/bin REQUIRED)
function(keel_add_shaders target)
set(out_dir ${CMAKE_CURRENT_BINARY_DIR}/shaders)
file(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.glsl)
foreach(src ${ARGN})
get_filename_component(name ${src} NAME)
set(out ${out_dir}/${name}.spv.inc)
add_custom_command(OUTPUT ${out}
COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
COMMAND ${GLSLC} --target-env=vulkan1.3 -DKEEL_VULKAN -O -mfmt=c -I ${CMAKE_CURRENT_SOURCE_DIR}/shaders -o ${out} ${CMAKE_CURRENT_SOURCE_DIR}/${src}
DEPENDS ${src} ${headers} VERBATIM)
list(APPEND outs ${out})
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/${src})
endforeach()
set(gl_out ${out_dir}/gl_sources.inc)
string(REPLACE ";" "|" embed_list "${sources};${headers}") # a list can't pass through COMMAND as one argument
add_custom_command(OUTPUT ${gl_out}
COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
COMMAND ${CMAKE_COMMAND} -DOUT=${gl_out} -DFILES=${embed_list} -P ${PROJECT_SOURCE_DIR}/cmake/EmbedText.cmake
DEPENDS ${sources} ${headers} ${PROJECT_SOURCE_DIR}/cmake/EmbedText.cmake VERBATIM)
target_sources(${target} PRIVATE ${outs} ${gl_out})
target_include_directories(${target} PRIVATE ${out_dir})
endfunction()

20
cmake/Version.cmake Normal file
View file

@ -0,0 +1,20 @@
# Run at build time (cmake -P): writes keel_version.h from git — the commit, its date, and
# whether the tree had changes. Not __DATE__: Nix's build shell pins SOURCE_DATE_EPOCH to 1980
# (reproducible builds), and that's what the compiler's date said.
execute_process(COMMAND git -C ${SRC} log -1 --format=%h OUTPUT_VARIABLE commit OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND git -C ${SRC} log -1 --format=%cd --date=format:%Y-%m-%d\ %H:%M OUTPUT_VARIABLE date OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND git -C ${SRC} status --porcelain --untracked-files=no OUTPUT_VARIABLE dirty OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if(NOT commit)
set(commit "unknown")
set(date "unknown")
endif()
if(dirty)
set(commit "${commit}+changes")
endif()
set(text "#pragma once\n#define KEEL_COMMIT \"${commit}\"\n#define KEEL_COMMIT_DATE \"${date}\"\n")
if(EXISTS ${OUT})
file(READ ${OUT} old)
endif()
if(NOT "${old}" STREQUAL "${text}")
file(WRITE ${OUT} "${text}")
endif()