抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

FBX SDK

FBX是一种主流的三维模型格式,格式闭源,但可以通过免费的FBX SDK编辑模型

开发环境

  • Visual Studio 2022
  • Cmake
  • 安装FBX SDK,我根据环境安装的是2020 VS2022

cmake构建

在FBX SDK安装位置,能看到include、lib等,这里使用动态库构建

cmake_minimum_required(VERSION 3.21)
project(FBXStudy)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_executable(${PROJECT_NAME} FbxLoader.h FbxLoader.cpp Main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/FBXSDK/include")
target_link_libraries(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/FBXSDK/lib/libfbxsdk.lib")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/FBXSDK/bin/libfbxsdk.dll"
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
target_compile_definitions(${PROJECT_NAME} PRIVATE FBXSDK_SHARED)

值得注意的是,当你使用动态库链接FBX SDK时,需要添加编译选项FBXSDK_SHARED,不然会报符号重定义的错误

FBX样例

资料

FBX SDK 2020 文档

评论