├── .clang-format
├── .dockerignore
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.yml
│ └── config.yml
└── workflows
│ └── build.yaml
├── .gitignore
├── CMakeLists.txt
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── FindFBX.cmake
├── LICENSE
├── README.md
├── conanfile.py
├── src
├── FBX2glTF.cpp
├── FBX2glTF.h
├── fbx
│ ├── Fbx2Raw.cpp
│ ├── Fbx2Raw.hpp
│ ├── FbxBlendShapesAccess.cpp
│ ├── FbxBlendShapesAccess.hpp
│ ├── FbxLayerElementAccess.hpp
│ ├── FbxSkinningAccess.cpp
│ ├── FbxSkinningAccess.hpp
│ └── materials
│ │ ├── 3dsMaxPhysicalMaterial.cpp
│ │ ├── FbxMaterials.cpp
│ │ ├── FbxMaterials.hpp
│ │ ├── RoughnessMetallicMaterials.hpp
│ │ ├── StingrayPBSMaterial.cpp
│ │ ├── TraditionalMaterials.cpp
│ │ └── TraditionalMaterials.hpp
├── gltf
│ ├── GltfModel.cpp
│ ├── GltfModel.hpp
│ ├── Raw2Gltf.cpp
│ ├── Raw2Gltf.hpp
│ ├── TextureBuilder.cpp
│ ├── TextureBuilder.hpp
│ └── properties
│ │ ├── AccessorData.cpp
│ │ ├── AccessorData.hpp
│ │ ├── AnimationData.cpp
│ │ ├── AnimationData.hpp
│ │ ├── BufferData.cpp
│ │ ├── BufferData.hpp
│ │ ├── BufferViewData.cpp
│ │ ├── BufferViewData.hpp
│ │ ├── CameraData.cpp
│ │ ├── CameraData.hpp
│ │ ├── ImageData.cpp
│ │ ├── ImageData.hpp
│ │ ├── LightData.cpp
│ │ ├── LightData.hpp
│ │ ├── MaterialData.cpp
│ │ ├── MaterialData.hpp
│ │ ├── MeshData.cpp
│ │ ├── MeshData.hpp
│ │ ├── NodeData.cpp
│ │ ├── NodeData.hpp
│ │ ├── PrimitiveData.cpp
│ │ ├── PrimitiveData.hpp
│ │ ├── SamplerData.hpp
│ │ ├── SceneData.cpp
│ │ ├── SceneData.hpp
│ │ ├── SkinData.cpp
│ │ ├── SkinData.hpp
│ │ ├── TextureData.cpp
│ │ └── TextureData.hpp
├── mathfu.hpp
├── raw
│ ├── RawModel.cpp
│ └── RawModel.hpp
└── utils
│ ├── File_Utils.cpp
│ ├── File_Utils.hpp
│ ├── Image_Utils.cpp
│ ├── Image_Utils.hpp
│ └── String_Utils.hpp
└── third_party
├── CLI11
└── CLI11.hpp
├── json
└── json.hpp
└── stb
├── stb_image.h
└── stb_image_write.h
/.clang-format:
--------------------------------------------------------------------------------
1 | ---
2 | AccessModifierOffset: -1
3 | AlignAfterOpenBracket: AlwaysBreak
4 | AlignConsecutiveAssignments: false
5 | AlignConsecutiveDeclarations: false
6 | AlignEscapedNewlinesLeft: true
7 | AlignOperands: false
8 | AlignTrailingComments: false
9 | AllowAllParametersOfDeclarationOnNextLine: false
10 | AllowShortBlocksOnASingleLine: false
11 | AllowShortCaseLabelsOnASingleLine: false
12 | AllowShortFunctionsOnASingleLine: Empty
13 | AllowShortIfStatementsOnASingleLine: false
14 | AllowShortLoopsOnASingleLine: false
15 | AlwaysBreakAfterReturnType: None
16 | AlwaysBreakBeforeMultilineStrings: true
17 | AlwaysBreakTemplateDeclarations: true
18 | BinPackArguments: false
19 | BinPackParameters: false
20 | BraceWrapping:
21 | AfterClass: false
22 | AfterControlStatement: false
23 | AfterEnum: false
24 | AfterFunction: false
25 | AfterNamespace: false
26 | AfterObjCDeclaration: false
27 | AfterStruct: false
28 | AfterUnion: false
29 | BeforeCatch: false
30 | BeforeElse: false
31 | IndentBraces: false
32 | BreakBeforeBinaryOperators: None
33 | BreakBeforeBraces: Attach
34 | BreakBeforeTernaryOperators: true
35 | BreakConstructorInitializersBeforeComma: false
36 | BreakAfterJavaFieldAnnotations: false
37 | BreakStringLiterals: false
38 | ColumnLimit: 100
39 | CommentPragmas: '^ IWYU pragma:'
40 | ConstructorInitializerAllOnOneLineOrOnePerLine: true
41 | ConstructorInitializerIndentWidth: 4
42 | ContinuationIndentWidth: 4
43 | Cpp11BracedListStyle: true
44 | DerivePointerAlignment: false
45 | DisableFormat: false
46 | ForEachMacros: [ FOR_EACH, FOR_EACH_ENUMERATE, FOR_EACH_KV, FOR_EACH_R, FOR_EACH_RANGE, FOR_EACH_RANGE_R, ]
47 | IncludeCategories:
48 | - Regex: '^<.*\.h(pp)?>'
49 | Priority: 1
50 | - Regex: '^<.*'
51 | Priority: 2
52 | - Regex: '.*'
53 | Priority: 3
54 | IndentCaseLabels: true
55 | IndentWidth: 2
56 | IndentWrappedFunctionNames: false
57 | KeepEmptyLinesAtTheStartOfBlocks: false
58 | MacroBlockBegin: ''
59 | MacroBlockEnd: ''
60 | MaxEmptyLinesToKeep: 1
61 | NamespaceIndentation: None
62 | ObjCBlockIndentWidth: 2
63 | ObjCSpaceAfterProperty: false
64 | ObjCSpaceBeforeProtocolList: false
65 | PenaltyBreakBeforeFirstCallParameter: 1
66 | PenaltyBreakComment: 300
67 | PenaltyBreakFirstLessLess: 120
68 | PenaltyBreakString: 1000
69 | PenaltyExcessCharacter: 1000000
70 | PenaltyReturnTypeOnItsOwnLine: 200
71 | PointerAlignment: Left
72 | ReflowComments: true
73 | SortIncludes: true
74 | SpaceAfterCStyleCast: false
75 | SpaceBeforeAssignmentOperators: true
76 | SpaceBeforeParens: ControlStatements
77 | SpaceInEmptyParentheses: false
78 | SpacesBeforeTrailingComments: 1
79 | SpacesInAngles: false
80 | SpacesInContainerLiterals: true
81 | SpacesInCStyleCastParentheses: false
82 | SpacesInParentheses: false
83 | SpacesInSquareBrackets: false
84 | Standard: Cpp11
85 | TabWidth: 8
86 | UseTab: Never
87 | ...
88 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .dockerignore
2 | Dockerfile
3 | sdk
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug report
2 | description: Report a bug in Godot's FBX2glTF fork
3 | body:
4 |
5 | - type: markdown
6 | attributes:
7 | value: |
8 | - When reporting bugs, you'll make our life simpler (and the fix will come sooner) if you follow the guidelines in this template.
9 | - Write a descriptive issue title above.
10 | - The golden rule is to **always open *one* issue for *one* bug**. If you notice several bugs and want to report them, make sure to create one new issue for each of them.
11 | - Search [open](https://github.com/godotengine/FBX2glTF/issues) and [closed](https://github.com/godotengine/FBX2glTF/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported. If you don't find a relevant match or if you're unsure, don't hesitate to **open a new issue**. The bugsquad will handle it from there if it's a duplicate.
12 | - Verify that you are using a [supported Godot version](https://docs.godotengine.org/en/stable/about/release_policy.html).
13 |
14 | - type: input
15 | attributes:
16 | label: Godot version
17 | description: >
18 | Specify the Git commit hash if using a development or non-official build.
19 | If you use a custom build, please test if your issue is reproducible in official builds too.
20 | placeholder: 3.3.stable, 4.0.dev (3041becc6)
21 | validations:
22 | required: true
23 |
24 | - type: input
25 | attributes:
26 | label: System information
27 | description: |
28 | - Specify the OS version, and when relevant hardware information.
29 | - For issues that are likely OS-specific, please specify the CPU model and architecture.
30 | - **Bug reports not including the required information may be closed at the maintainers' discretion.** If in doubt, always include all the requested information; it's better to include too much information than not enough information.
31 | placeholder: Windows 10, Intel Core i5-7200U
32 | validations:
33 | required: true
34 |
35 | - type: textarea
36 | attributes:
37 | label: Issue description
38 | description: |
39 | Describe your issue briefly. What doesn't work, and how do you expect it to work instead?
40 | You can include images or videos with drag and drop, and format code blocks or logs with ```
tags.
41 | validations:
42 | required: true
43 |
44 | - type: textarea
45 | attributes:
46 | label: Steps to reproduce
47 | description: |
48 | List of steps or sample code that reproduces the issue. Having reproducible issues is a prerequisite for contributors to be able to solve them.
49 | If you include a minimal reproduction project below, you can detail how to use it here.
50 | validations:
51 | required: true
52 |
53 | - type: textarea
54 | attributes:
55 | label: Minimal reproduction project
56 | description: |
57 | - A small Godot project which reproduces the issue, with no unnecessary files included. Be sure to not include the `.godot` folder in the archive (but keep `project.godot`).
58 | - Required, unless the reproduction steps are trivial and don't require any project files to be followed. In this case, write "N/A" in the field.
59 | - Drag and drop a ZIP archive to upload it. **Do not select another field until the project is done uploading.**
60 | - **Note for C# users:** If your issue is *not* Mono-specific, please upload a minimal reproduction project written in GDScript or VisualScript. This will make it easier for contributors to reproduce the issue locally as not everyone has a Mono setup available.
61 | - **If you've been asked by a maintainer to upload a minimal reproduction project, you *must* do so within 7 days.** Otherwise, your bug report will be closed as it'll be considered too difficult to diagnose.
62 | validations:
63 | required: true
64 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 |
3 | contact_links:
4 | - name: Godot proposals
5 | url: https://github.com/godotengine/godot-proposals
6 | about: Please submit feature proposals on the Godot proposals repository, not here.
7 |
8 | - name: Godot documentation repository
9 | url: https://github.com/godotengine/godot-docs
10 | about: Please report issues with documentation on the Godot documentation repository, not here.
11 |
12 | - name: Godot community channels
13 | url: https://godotengine.org/community
14 | about: Please ask for technical support on one of the other community channels, not here.
15 |
--------------------------------------------------------------------------------
/.github/workflows/build.yaml:
--------------------------------------------------------------------------------
1 | name: "Build FBX2glTF"
2 | on:
3 | pull_request:
4 | branches:
5 | - master
6 | push:
7 | branches:
8 | - master
9 | tags:
10 | - "v*"
11 |
12 | concurrency:
13 | group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-build
14 | cancel-in-progress: true
15 |
16 | jobs:
17 | build-windows:
18 | runs-on: windows-2022
19 | steps:
20 | - name: Checkout
21 | uses: actions/checkout@v4
22 |
23 | - name: Install conan
24 | run: |
25 | pip install --upgrade conan==1.63.0
26 | shell: bash
27 |
28 | - name: Setup conan profile
29 | run: |
30 | conan profile new default --detect
31 | conan profile show default
32 | shell: bash
33 |
34 | - name: Setup filter.lfs.required
35 | run: |
36 | git config --global filter.lfs.required false
37 | shell: bash
38 |
39 | - name: Setup filter.lfs.smudge
40 | run: |
41 | git config --global filter.lfs.smudge "git-lfs smudge --skip %f"
42 | shell: bash
43 |
44 | - name: Setup filter.lfs.process
45 | run: |
46 | git config --global filter.lfs.process "git-lfs filter-process --skip"
47 | shell: bash
48 |
49 | - name: Fetch sdk
50 | run: |
51 | curl -O -L "https://github.com/V-Sekai/FBXSDK-Windows/archive/refs/tags/2020.2.zip"
52 | shell: cmd
53 |
54 | - name: install 7z extract
55 | run: |
56 | 7z x 2020.2.zip
57 | shell: cmd
58 |
59 | - name: move
60 | run: |
61 | mkdir -p sdk
62 | mv ./FBXSDK-Windows-2020.2/sdk .
63 | shell: bash
64 |
65 | - name: Decompress sdk
66 | run: |
67 | zstd -d -r --rm ./sdk || true
68 | shell: bash
69 |
70 | - name: Conan install
71 | run: |
72 | conan install . -i build -s build_type=Release -s compiler="Visual Studio" --build missing
73 | shell: cmd
74 |
75 | - name: Conan build
76 | run: |
77 | conan build -bf build .
78 | shell: cmd
79 |
80 | - name: Run FBX2glTF help
81 | run: |
82 | ./build/Release/FBX2glTF.exe --help
83 | shell: bash
84 |
85 | - name: Prepare artifacts
86 | run: |
87 | export TARGET=FBX2glTF-windows-x86_64
88 | mkdir $TARGET
89 | cp sdk/Windows/2020.2/License.rtf $TARGET/FBX-SDK-License.rtf
90 | cp LICENSE $TARGET/FBX2glTF-License.txt
91 | cp build/Release/FBX2glTF.exe $TARGET/FBX2glTF-windows-x86_64.exe
92 | 7z a -r $TARGET.zip $TARGET
93 | shell: bash
94 |
95 | - name: Release
96 | uses: softprops/action-gh-release@v1
97 | if: startsWith(github.ref, 'refs/tags/')
98 | with:
99 | files: |
100 | FBX2glTF-windows-x86_64.zip
101 | FBX2glTF-windows-x86_64/FBX2glTF-License.txt
102 | FBX2glTF-windows-x86_64/FBX-SDK-License.rtf
103 |
104 | - name: FBX2glTF-windows-x86_64
105 | uses: actions/upload-artifact@v4
106 | with:
107 | name: FBX2glTF-windows-x86_64
108 | path: FBX2glTF-windows-x86_64/*
109 |
110 | build-linux:
111 | runs-on: ubuntu-20.04
112 | steps:
113 | - name: Checkout
114 | uses: actions/checkout@v4
115 |
116 | - name: Install conan
117 | run: |
118 | pip install --upgrade conan==1.63.0
119 | shell: bash
120 |
121 | - name: Setup conan profile
122 | run: |
123 | conan profile new default --detect
124 | conan profile show default
125 | shell: bash
126 |
127 | - name: Setup filter.lfs.required
128 | run: |
129 | git config --global filter.lfs.required false
130 | shell: bash
131 |
132 | - name: Setup filter.lfs.smudge
133 | run: |
134 | git config --global filter.lfs.smudge "git-lfs smudge --skip %f"
135 | shell: bash
136 |
137 | - name: Setup filter.lfs.process
138 | run: |
139 | git config --global filter.lfs.process "git-lfs filter-process --skip"
140 | shell: bash
141 |
142 | - name: Fetch sdk
143 | run: |
144 | curl -O -L "https://github.com/V-Sekai/FBXSDK-Linux/archive/refs/tags/2020.2.zip"
145 | shell: bash
146 |
147 | - name: install 7z extract
148 | run: |
149 | 7z x 2020.2.zip
150 | shell: bash
151 |
152 | - name: move
153 | run: |
154 | mkdir -p sdk
155 | mv ./FBXSDK-Linux-2020.2/sdk .
156 | shell: bash
157 |
158 | - name: Decompress sdk
159 | run: |
160 | zstd -d -r --rm ./sdk || true
161 | shell: bash
162 |
163 | - name: Conan install
164 | run: |
165 | conan install . -i build -s build_type=Release --build fmt -s compiler.libcxx=libstdc++11 --build missing
166 | shell: bash
167 |
168 | - name: Conan build
169 | run: |
170 | conan build -bf build .
171 | shell: bash
172 |
173 | - name: Run FBX2glTF help
174 | run: |
175 | ./build/FBX2glTF --help
176 | shell: bash
177 |
178 | - name: Prepare artifacts
179 | run: |
180 | export TARGET=FBX2glTF-linux-x86_64
181 | mkdir $TARGET
182 | cp sdk/Linux/2020.2/License.txt $TARGET/FBX-SDK-License.txt
183 | cp LICENSE $TARGET/FBX2glTF-License.txt
184 | cp build/FBX2glTF $TARGET/FBX2glTF-linux-x86_64
185 | 7z a -r $TARGET.zip $TARGET
186 | shell: bash
187 |
188 | - name: Release
189 | uses: softprops/action-gh-release@v1
190 | if: startsWith(github.ref, 'refs/tags/')
191 | with:
192 | files: FBX2glTF-linux-x86_64.zip
193 |
194 | - name: FBX2glTF-linux-x86_64
195 | uses: actions/upload-artifact@v4
196 | with:
197 | name: FBX2glTF-linux-x86_64
198 | path: FBX2glTF-linux-x86_64/*
199 |
200 | build-macos:
201 | runs-on: macos-13
202 | steps:
203 | - name: Checkout
204 | uses: actions/checkout@v4
205 |
206 | - name: Install conan
207 | run: |
208 | pip install --upgrade conan==1.63.0
209 | shell: bash
210 |
211 | - name: Setup conan profile
212 | run: |
213 | conan profile new default --detect
214 | conan profile show default
215 | shell: bash
216 |
217 | - name: Setup filter.lfs.required
218 | run: |
219 | git config --global filter.lfs.required false
220 | shell: bash
221 |
222 | - name: Setup filter.lfs.smudge
223 | run: |
224 | git config --global filter.lfs.smudge "git-lfs smudge --skip %f"
225 | shell: bash
226 |
227 | - name: Setup filter.lfs.process
228 | run: |
229 | git config --global filter.lfs.process "git-lfs filter-process --skip"
230 | shell: bash
231 |
232 | - name: Fetch sdk
233 | run: |
234 | curl -O -L "https://github.com/V-Sekai/FBXSDK-Darwin/archive/refs/tags/2020.2.zip"
235 | shell: bash
236 |
237 | - name: install 7z extract
238 | run: |
239 | 7z x 2020.2.zip
240 | shell: bash
241 |
242 | - name: move
243 | run: |
244 | mkdir -p sdk
245 | mv ./FBXSDK-Darwin-2020.2/sdk .
246 | shell: bash
247 |
248 | - name: Decompress sdk
249 | run: |
250 | zstd -d -r --rm ./sdk || true
251 | shell: bash
252 |
253 | - name: Conan install
254 | run: |
255 | env CMAKE_OSX_ARCHITECTURES=x86_64 conan install . -i build -s build_type=Release --settings arch=x86_64 --build missing
256 | shell: bash
257 |
258 | - name: Conan build
259 | run: |
260 | env CMAKE_OSX_ARCHITECTURES=x86_64 conan build -bf build .
261 | shell: bash
262 |
263 | - name: Run FBX2glTF help
264 | run: |
265 | ./build/FBX2glTF --help
266 | shell: bash
267 |
268 | - name: Adhoc signature
269 | run: |
270 | codesign -s - --options=runtime build/FBX2glTF
271 | shell: bash
272 |
273 | - name: Prepare artifacts
274 | run: |
275 | export TARGET=FBX2glTF-macos-x86_64
276 | mkdir $TARGET
277 | cp sdk/Darwin/2020.2/License.rtf $TARGET/FBX-SDK-License.rtf
278 | cp LICENSE $TARGET/FBX2glTF-License.txt
279 | cp build/FBX2glTF $TARGET/FBX2glTF-macos-x86_64
280 | 7z a -r $TARGET.zip $TARGET
281 | shell: bash
282 |
283 | - name: Release
284 | uses: softprops/action-gh-release@v1
285 | if: startsWith(github.ref, 'refs/tags/')
286 | with:
287 | files: FBX2glTF-macos-x86_64.zip
288 |
289 | - name: FBX2glTF-macos-x86_64
290 | uses: actions/upload-artifact@v4
291 | with:
292 | name: FBX2glTF-macos-x86_64
293 | path: FBX2glTF-macos-x86_64/*
294 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | npm/fbx2gltf/bin/Darwin/FBX2glTF
2 | npm/fbx2gltf/bin/Linux/FBX2glTF
3 | npm/fbx2gltf/bin/Windows_NT/FBX2glTF.exe
4 | npm/fbx2gltf/node_modules/
5 | npm/tests/node_modules/
6 | npm/tests/test/*.js
7 | npm/tests/test/*.js.map
8 | build/
9 | .cache/
10 | sdk/
11 |
12 | demo/.godot/
13 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.5)
2 | project(FBX2glTF)
3 |
4 | set(typical_usage_str
5 | "Example usage:\n\
6 | > mkdir -p build_debug\n\
7 | > conan install . -i build_debug -s build_type=Debug -e FBXSDK_SDKS=/home/zell/FBXSDK\n\
8 | > conan build . -bf build_debug")
9 |
10 | if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
11 | message(FATAL_ERROR
12 | "Building from within the source tree is not supported! ${typical_usage_str}")
13 | endif ()
14 |
15 | set(CMAKE_CXX_STANDARD 11)
16 |
17 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
18 | include(ExternalProject)
19 |
20 | # FBX
21 | foreach (FBXSDK_VERSION "2020.2")
22 | find_package(FBX)
23 | if (FBXSDK_FOUND)
24 | break()
25 | endif()
26 | endforeach(FBXSDK_VERSION)
27 | if (NOT FBXSDK_FOUND)
28 | message(FATAL_ERROR
29 | "Can't find FBX SDK in either:\n"
30 | " - Mac OS X: ${FBXSDK_APPLE_ROOT}\n"
31 | " - Windows: ${FBXSDK_WINDOWS_ROOT}\n"
32 | " - Linux: ${FBXSDK_LINUX_ROOT}"
33 | )
34 | endif()
35 |
36 | if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan_paths.cmake")
37 | message(FATAL_ERROR
38 | "The Conan package manager must run ('install') first. ${typical_usage_str}")
39 | endif()
40 | include("${CMAKE_BINARY_DIR}/conan_paths.cmake")
41 |
42 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
43 | find_package(Threads REQUIRED)
44 |
45 | list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_BINARY_DIR}")
46 |
47 | # stuff we get from Conan
48 | find_package(Boost 1.76 COMPONENTS system filesystem program_options nowide REQUIRED )
49 | find_package(ZLIB MODULE REQUIRED)
50 | find_package(fmt MODULE REQUIRED)
51 | find_package(Iconv MODULE REQUIRED)
52 | find_package(LibXml2 MODULE REQUIRED)
53 |
54 | # create a compilation database for e.g. clang-tidy
55 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
56 |
57 | # DRACO
58 | ExternalProject_Add(Draco
59 | GIT_REPOSITORY https://github.com/google/draco
60 | GIT_TAG 8786740086a9f4d83f44aa83badfbea4dce7a1b5
61 | PREFIX draco
62 | INSTALL_DIR
63 | CMAKE_ARGS
64 | -DCMAKE_INSTALL_PREFIX=
65 | -DBUILD_FOR_GLTF=1
66 | )
67 | set(DRACO_INCLUDE_DIR "${CMAKE_BINARY_DIR}/draco/include")
68 | find_file(FEDORA_FOUND fedora-release
69 | PATHS /etc
70 | )
71 | if (WIN32)
72 | set(DRACO_LIB "${CMAKE_BINARY_DIR}/draco/lib/${CMAKE_SHARED_MODULE_PREFIX}draco.lib")
73 | elseif(FEDORA_FOUND)
74 | set(DRACO_LIB "${CMAKE_BINARY_DIR}/draco/lib64/${CMAKE_SHARED_MODULE_PREFIX}draco.a")
75 | else()
76 | set(DRACO_LIB "${CMAKE_BINARY_DIR}/draco/lib/${CMAKE_SHARED_MODULE_PREFIX}draco.a")
77 | endif()
78 |
79 | # MATHFU
80 | set(mathfu_build_benchmarks OFF CACHE BOOL "")
81 | set(mathfu_build_tests OFF CACHE BOOL "")
82 | ExternalProject_Add(MathFu
83 | PREFIX mathfu
84 | GIT_REPOSITORY https://github.com/google/mathfu
85 | GIT_TAG v1.1.0
86 | CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Skipping MathFu configure step."
87 | BUILD_COMMAND ${CMAKE_COMMAND} -E echo "Skipping MathFu build step."
88 | INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping MathFu install step."
89 | )
90 | set(MATHFU_INCLUDE_DIRS
91 | "${CMAKE_BINARY_DIR}/mathfu/src/MathFu/include/"
92 | "${CMAKE_BINARY_DIR}/mathfu/src/MathFu/dependencies/vectorial/include")
93 |
94 | # OrderedMap
95 | ExternalProject_Add(FiFoMap
96 | PREFIX fifo_map
97 | GIT_REPOSITORY https://github.com/nlohmann/fifo_map
98 | CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Skipping FiFoMap configure step."
99 | BUILD_COMMAND ${CMAKE_COMMAND} -E echo "Skipping FiFoMap build step."
100 | INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping FiFoMap install step."
101 | )
102 | set(FIFO_MAP_INCLUDE_DIR "${CMAKE_BINARY_DIR}/fifo_map/src/FiFoMap/src")
103 |
104 |
105 | # cppcodec
106 | ExternalProject_Add(CPPCodec
107 | PREFIX cppcodec
108 | GIT_REPOSITORY https://github.com/tplgy/cppcodec
109 | CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Skipping CPPCodec configure step."
110 | BUILD_COMMAND ${CMAKE_COMMAND} -E echo "Skipping CPPCodec build step."
111 | INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Skipping CPPCodec install step."
112 | )
113 | set(CPPCODEC_INCLUDE_DIR "${CMAKE_BINARY_DIR}/cppcodec/src/CPPCodec")
114 |
115 | if (APPLE)
116 | find_library(CF_FRAMEWORK CoreFoundation)
117 | message("CoreFoundation Framework: ${CF_FRAMEWORK}")
118 | set(FRAMEWORKS ${CF_FRAMEWORK})
119 | endif()
120 |
121 | set(LIB_SOURCE_FILES
122 | src/FBX2glTF.h
123 | src/fbx/materials/3dsMaxPhysicalMaterial.cpp
124 | src/fbx/materials/FbxMaterials.cpp
125 | src/fbx/materials/FbxMaterials.hpp
126 | src/fbx/materials/RoughnessMetallicMaterials.hpp
127 | src/fbx/materials/StingrayPBSMaterial.cpp
128 | src/fbx/materials/TraditionalMaterials.cpp
129 | src/fbx/materials/TraditionalMaterials.hpp
130 | src/fbx/Fbx2Raw.cpp
131 | src/fbx/Fbx2Raw.hpp
132 | src/fbx/FbxBlendShapesAccess.cpp
133 | src/fbx/FbxBlendShapesAccess.hpp
134 | src/fbx/FbxLayerElementAccess.hpp
135 | src/fbx/FbxSkinningAccess.cpp
136 | src/fbx/FbxSkinningAccess.hpp
137 | src/gltf/Raw2Gltf.cpp
138 | src/gltf/Raw2Gltf.hpp
139 | src/gltf/GltfModel.cpp
140 | src/gltf/GltfModel.hpp
141 | src/gltf/TextureBuilder.cpp
142 | src/gltf/TextureBuilder.hpp
143 | src/gltf/properties/AccessorData.cpp
144 | src/gltf/properties/AccessorData.hpp
145 | src/gltf/properties/AnimationData.cpp
146 | src/gltf/properties/AnimationData.hpp
147 | src/gltf/properties/BufferData.cpp
148 | src/gltf/properties/BufferData.hpp
149 | src/gltf/properties/BufferViewData.cpp
150 | src/gltf/properties/BufferViewData.hpp
151 | src/gltf/properties/CameraData.cpp
152 | src/gltf/properties/CameraData.hpp
153 | src/gltf/properties/ImageData.cpp
154 | src/gltf/properties/ImageData.hpp
155 | src/gltf/properties/LightData.cpp
156 | src/gltf/properties/LightData.hpp
157 | src/gltf/properties/MaterialData.cpp
158 | src/gltf/properties/MaterialData.hpp
159 | src/gltf/properties/MeshData.cpp
160 | src/gltf/properties/MeshData.hpp
161 | src/gltf/properties/NodeData.cpp
162 | src/gltf/properties/NodeData.hpp
163 | src/gltf/properties/PrimitiveData.cpp
164 | src/gltf/properties/PrimitiveData.hpp
165 | src/gltf/properties/SamplerData.hpp
166 | src/gltf/properties/SceneData.cpp
167 | src/gltf/properties/SceneData.hpp
168 | src/gltf/properties/SkinData.cpp
169 | src/gltf/properties/SkinData.hpp
170 | src/gltf/properties/TextureData.cpp
171 | src/gltf/properties/TextureData.hpp
172 | src/mathfu.hpp
173 | src/raw/RawModel.cpp
174 | src/raw/RawModel.hpp
175 | src/utils/File_Utils.cpp
176 | src/utils/File_Utils.hpp
177 | src/utils/Image_Utils.cpp
178 | src/utils/Image_Utils.hpp
179 | src/utils/String_Utils.hpp
180 | third_party/CLI11/CLI11.hpp
181 | )
182 |
183 | add_library(libFBX2glTF STATIC ${LIB_SOURCE_FILES})
184 | set_target_properties(libFBX2glTF PROPERTIES OUTPUT_NAME "libFBX2glTF")
185 | add_executable(FBX2glTF src/FBX2glTF.cpp)
186 | set_target_properties(FBX2glTF PROPERTIES OUTPUT_NAME "FBX2glTF")
187 |
188 | add_dependencies(libFBX2glTF
189 | Draco
190 | MathFu
191 | FiFoMap
192 | CPPCodec
193 | )
194 |
195 | if (NOT MSVC)
196 | # Disable annoying & spammy warning from FBX SDK header file
197 | target_compile_options(libFBX2glTF PRIVATE
198 | "-Wno-null-dereference"
199 | "-Wunused"
200 | )
201 | target_compile_options(FBX2glTF PRIVATE
202 | "-Wno-null-dereference"
203 | "-Wunused"
204 | )
205 | endif()
206 |
207 | target_link_libraries(libFBX2glTF
208 | ${FRAMEWORKS}
209 | ${DRACO_LIB}
210 | Boost::system
211 | Boost::filesystem
212 | Boost::nowide
213 | optimized ${FBXSDK_LIBRARY}
214 | debug ${FBXSDK_LIBRARY_DEBUG}
215 | fmt::fmt
216 | ZLIB::ZLIB
217 | LibXml2::LibXml2
218 | ${ICONV_MAC_LIB}
219 | ${CMAKE_DL_LIBS}
220 | ${CMAKE_THREAD_LIBS_INIT}
221 | )
222 |
223 | target_include_directories(libFBX2glTF PUBLIC
224 | ${CMAKE_CURRENT_SOURCE_DIR}/src
225 | )
226 |
227 | target_include_directories(libFBX2glTF SYSTEM PUBLIC
228 | "third_party/stb"
229 | "third_party/json"
230 | ${FBXSDK_INCLUDE_DIR}
231 | ${DRACO_INCLUDE_DIR}
232 | ${MATHFU_INCLUDE_DIRS}
233 | ${FIFO_MAP_INCLUDE_DIR}
234 | ${CPPCODEC_INCLUDE_DIR}
235 | )
236 |
237 | target_include_directories(FBX2glTF PUBLIC
238 | "third_party/CLI11"
239 | )
240 |
241 | if (APPLE)
242 | set(ICONV_MAC_LIB iconv)
243 | endif()
244 |
245 | target_link_libraries(FBX2glTF libFBX2glTF ${ICONV_MAC_LIB})
246 |
247 | install (TARGETS libFBX2glTF FBX2glTF
248 | RUNTIME DESTINATION bin
249 | ARCHIVE DESTINATION lib
250 | )
251 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | Godot Engine has adopted a Code of Conduct that we expect project participants to adhere to.
4 | Please read the [full text](https://godotengine.org/code-of-conduct)
5 | so that you can understand what actions will and will not be tolerated.
6 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to FBX2glTF
2 | We want to make contributing to this project as easy and transparent as
3 | possible.
4 |
5 | ## Pull Requests
6 | We actively welcome your pull requests.
7 |
8 | 1. Fork the repo and create your branch from `master`.
9 | 2. Ensure your code matches the style of existing source.
10 | 3. In case of behavioural changes, update this documentation.
11 |
12 | ## Issues
13 | We use GitHub issues to track public bugs. Please ensure your description is
14 | clear and has sufficient instructions to be able to reproduce the issue.
15 |
16 | ## License
17 | By contributing to FBX2glTF, you agree that your contributions will be licensed
18 | under the LICENSE file in the root directory of this source tree.
19 |
--------------------------------------------------------------------------------
/FindFBX.cmake:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present, Facebook, Inc.
2 | # All rights reserved.
3 | #
4 | # Helper function for finding the FBX SDK.
5 | # Cribbed & tweaked from https://github.com/floooh/fbxc/
6 | #
7 | # params: FBXSDK_VERSION
8 | # FBXSDK_SDKS
9 | #
10 | # sets: FBXSDK_FOUND
11 | # FBXSDK_DIR
12 | # FBXSDK_LIBRARY
13 | # FBXSDK_LIBRARY_DEBUG
14 | # FBXSDK_INCLUDE_DIR
15 | #
16 |
17 | # semi-hack to detect architecture
18 | if( CMAKE_SIZEOF_VOID_P MATCHES 8 )
19 | # void ptr = 8 byte --> x86_64
20 | set(ARCH_32 OFF)
21 | else()
22 | # void ptr != 8 byte --> x86
23 | set(ARCH_32 OFF)
24 | endif()
25 |
26 | if (NOT DEFINED FBXSDK_VERSION)
27 | set(FBXSDK_VERSION "2020.2")
28 | endif()
29 |
30 | set(_fbxsdk_vstudio_version "vs2019")
31 |
32 | message("Looking for FBX SDK version: ${FBXSDK_VERSION}")
33 |
34 | if (NOT DEFINED FBXSDK_SDKS)
35 | set(FBXSDK_SDKS "${CMAKE_CURRENT_SOURCE_DIR}/sdk")
36 | endif()
37 |
38 | get_filename_component(FBXSDK_SDKS_ABS ${FBXSDK_SDKS} ABSOLUTE)
39 |
40 | set(FBXSDK_APPLE_ROOT "${FBXSDK_SDKS_ABS}/Darwin/${FBXSDK_VERSION}")
41 | set(FBXSDK_LINUX_ROOT "${FBXSDK_SDKS_ABS}/Linux/${FBXSDK_VERSION}")
42 | set(FBXSDK_WINDOWS_ROOT "${FBXSDK_SDKS_ABS}/Windows/${FBXSDK_VERSION}")
43 |
44 | if (APPLE)
45 | set(_fbxsdk_root "${FBXSDK_APPLE_ROOT}")
46 | set(_fbxsdk_libdir_debug "lib/clang/debug")
47 | set(_fbxsdk_libdir_release "lib/clang/release")
48 | set(_fbxsdk_libname_debug "libfbxsdk.a")
49 | set(_fbxsdk_libname_release "libfbxsdk.a")
50 | elseif (WIN32)
51 | set(_fbxsdk_root "${FBXSDK_WINDOWS_ROOT}")
52 | if (ARCH_32)
53 | set(_fbxsdk_libdir_debug "lib/${_fbxsdk_vstudio_version}/x86/debug")
54 | set(_fbxsdk_libdir_release "lib/${_fbxsdk_vstudio_version}/x86/release")
55 | else()
56 | set(_fbxsdk_libdir_debug "lib/${_fbxsdk_vstudio_version}/x64/debug")
57 | set(_fbxsdk_libdir_release "lib/${_fbxsdk_vstudio_version}/x64/release")
58 | endif()
59 | set(_fbxsdk_libname_debug "libfbxsdk-md.lib")
60 | set(_fbxsdk_libname_release "libfbxsdk-md.lib")
61 | elseif (UNIX)
62 | set(_fbxsdk_root "${FBXSDK_LINUX_ROOT}")
63 | if (ARCH_32)
64 | set(_fbxsdk_libdir_debug "lib/gcc/x86/debug")
65 | set(_fbxsdk_libdir_release "lib/gcc/x86/release")
66 | else()
67 | set(_fbxsdk_libdir_debug "lib/gcc/x64/debug")
68 | set(_fbxsdk_libdir_release "lib/gcc/x64/release")
69 | endif()
70 | set(_fbxsdk_libname_debug "libfbxsdk.a")
71 | set(_fbxsdk_libname_release "libfbxsdk.a")
72 | else()
73 | message(FATAL_ERROR, "Unknown platform. Can't find FBX SDK.")
74 | endif()
75 |
76 | # should point the the FBX SDK installation dir
77 | set(FBXSDK_ROOT "${_fbxsdk_root}")
78 | message("FBXSDK_ROOT: ${FBXSDK_ROOT}")
79 |
80 | # find header dir and libs
81 | find_path(FBXSDK_INCLUDE_DIR "fbxsdk.h"
82 | NO_CMAKE_FIND_ROOT_PATH
83 | PATHS ${FBXSDK_ROOT}
84 | PATH_SUFFIXES "include")
85 | message("FBXSDK_INCLUDE_DIR: ${FBXSDK_INCLUDE_DIR}")
86 |
87 | find_library(FBXSDK_LIBRARY ${_fbxsdk_libname_release}
88 | NO_CMAKE_FIND_ROOT_PATH
89 | PATHS "${FBXSDK_ROOT}/${_fbxsdk_libdir_release}")
90 | message("FBXSDK_LIBRARY: ${FBXSDK_LIBRARY}")
91 |
92 | find_library(FBXSDK_LIBRARY_DEBUG ${_fbxsdk_libname_debug}
93 | NO_CMAKE_FIND_ROOT_PATH
94 | PATHS "${FBXSDK_ROOT}/${_fbxsdk_libdir_debug}")
95 | message("FBXSDK_LIBRARY_DEBUG: ${FBXSDK_LIBRARY_DEBUG}")
96 |
97 | if (FBXSDK_INCLUDE_DIR AND FBXSDK_LIBRARY AND FBXSDK_LIBRARY_DEBUG)
98 | set(FBXSDK_FOUND YES)
99 | else()
100 | set(FBXSDK_FOUND NO)
101 | endif()
102 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD License
2 |
3 | For FBX2glTF software
4 |
5 | Copyright (c) 2020-2022 V-Sekai contributors.
6 | Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without modification,
9 | are permitted provided that the following conditions are met:
10 |
11 | * Redistributions of source code must retain the above copyright notice, this
12 | list of conditions and the following disclaimer.
13 |
14 | * Redistributions in binary form must reproduce the above copyright notice,
15 | this list of conditions and the following disclaimer in the documentation
16 | and/or other materials provided with the distribution.
17 |
18 | * Neither the name Facebook nor the names of its contributors may be used to
19 | endorse or promote products derived from this software without specific
20 | prior written permission.
21 |
22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FBX2glTF
2 |
3 | > [!NOTE]
4 | >
5 | > As of Godot 4.3, FBX2glTF is no longer used. The engine now relies on
6 | > [ufbx](https://github.com/ufbx/ufbx) instead, which is a built-in library
7 | > instead of an external command-line tool.
8 | >
9 | > As such, **in Godot 4.3 or later, you no longer need to set up FBX2glTF**
10 | > to import FBX scenes.
11 | >
12 | > We no longer actively maintain this repository as we won't be needing it
13 | > going forward. If you want to build on top of it for your own use cases,
14 | > feel free to fork it.
15 |
16 | A command-line tool for the conversion of 3D model assets on the FBX file format
17 | to the glTF file format.
18 |
19 | This is a fork of [facebookincubator/FBX2glTF](https://github.com/facebookincubator/FBX2glTF)
20 | to fix issues for the needs of [Godot Engine](https://godotengine.org/).
21 |
22 | Change skinning-weights to 4 with `--skinning-weights 4`, if your engine does not support the 8 bone weights feature.
23 |
24 | Change the default import of the engine to be different from 30 fps if needed, with `--anim-framerate (bake24|bake30|bake60)`.
25 |
26 | ## License
27 |
28 | The FBX2glTF command line tool is distributed under the 3-clause BSD license.
29 |
30 | Precompiled binaries include **proprietary code** from the Autodesk FBX SDK 2020,
31 | which is distributed under the
32 | [Autodesk LICENSE AND SERVICES AGREEMENT](https://github.com/godotengine/FBX2glTF/releases/latest/download/FBX-SDK-License.rtf).
33 |
34 | **By downloading and using this tool, you agree to the terms of that Autodesk
35 | proprietary license.**
36 |
37 | ## Platform binaries
38 |
39 | Check the [latest release](https://github.com/godotengine/FBX2glTF/releases/latest/)
40 | for the last precompiled binaries for Linux, macOS, and Windows.
41 |
42 | - Linux x86_64: [`FBX2glTF-linux-x86_64.zip`](https://github.com/godotengine/FBX2glTF/releases/latest/download/FBX2glTF-linux-x86_64.zip)
43 | * It is built on Ubuntu 20.04 and requires glibc 2.31 or newer.
44 | - macOS x86_64: [`FBX2glTF-macos-x86_64.zip`](https://github.com/godotengine/FBX2glTF/releases/latest/download/FBX2glTF-macos-x86_64.zip)
45 | * It should work fine for macOS ARM64 too using Rosetta 2.
46 | - Windows x86_64: [`FBX2glTF-windows-x86_64.zip`](https://github.com/godotengine/FBX2glTF/releases/latest/download/FBX2glTF-windows-x86_64.zip)
47 | * [**Requires Microsot Visual C++ Redistributable.**](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist)
48 |
49 | There are also artifacts of the latest commit for Linux, macOS, and Windows
50 | in the [GitHub Actions](https://github.com/godotengine/FBX2glTF/actions) tab.
51 |
52 | ## Build instructions
53 |
54 | Reference the [GitHub workflow](https://github.com/godotengine/FBX2glTF/blob/master/.github/workflows/build.yaml).
55 |
--------------------------------------------------------------------------------
/conanfile.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
2 | #
3 |
4 | import os
5 |
6 | from conans import ConanFile, CMake
7 |
8 |
9 | class FBX2glTFConan(ConanFile):
10 | settings = "os", "compiler", "build_type", "arch"
11 | requires = (
12 | "boost/1.84.0",
13 | "libiconv/1.17",
14 | "zlib/1.3.1",
15 | "libxml2/2.12.5",
16 | "fmt/5.3.0",
17 | )
18 | generators = "cmake_find_package", "cmake_paths"
19 |
20 | def configure(self):
21 | if (
22 | self.settings.compiler == "gcc"
23 | and self.settings.compiler.libcxx == "libstdc++"
24 | ):
25 | raise Exception(
26 | "Rerun 'conan install' with argument: '-s compiler.libcxx=libstdc++11'"
27 | )
28 |
29 | def build(self):
30 | cmake = CMake(self)
31 | cmake.definitions["FBXSDK_SDKS"] = os.getenv("FBXSDK_SDKS", "sdk")
32 | cmake.configure()
33 | cmake.build()
34 |
--------------------------------------------------------------------------------
/src/FBX2glTF.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | */
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include