forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/v-sekai-godot/vsk-subdiv-4.4' i…
…nto groups-staging-4.4
- Loading branch information
Showing
287 changed files
with
103,935 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
BasedOnStyle: LLVM | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: DontAlign | ||
AlignOperands: DontAlign | ||
AlignTrailingComments: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
BreakConstructorInitializers: AfterColon | ||
ColumnLimit: 0 | ||
ConstructorInitializerIndentWidth: 8 | ||
ContinuationIndentWidth: 8 | ||
Cpp11BracedListStyle: false | ||
IndentCaseLabels: true | ||
IndentWidth: 4 | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
SpacesInLineCommentPrefix: | ||
Minimum: 0 | ||
Maximum: -1 | ||
TabWidth: 4 | ||
UseTab: Always | ||
|
||
Language: Cpp | ||
Standard: c++17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Normalize EOL for all files that Git considers text files. | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Binaries. | ||
*.so | ||
|
||
# Objects. | ||
.scons-cache/ | ||
*.os | ||
|
||
# SConstruct | ||
.sconf_temp | ||
.sconsign.dblite | ||
*.pyc | ||
|
||
# MacOS | ||
.DS_Store/ | ||
|
||
# Editors | ||
.vscode/ | ||
|
||
*.obj | ||
|
||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; DO NOT EDIT (unless you know what you are doing) | ||
; | ||
; This subdirectory is a git "subrepo", and this file is maintained by the | ||
; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme | ||
; | ||
[subrepo] | ||
remote = https://github.com/V-Sekai/godot-subdiv.git | ||
branch = main | ||
commit = 9b0c7e36c52ee931b95e406bb345009f073eed17 | ||
parent = e2d9f70a6e1ecaba5fa1a36a5c5c8689a0da10b0 | ||
method = merge | ||
cmdver = 0.4.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Godot Subdiv authors | ||
|
||
GitHub usernames are indicated in parentheses. | ||
|
||
## Initial Project | ||
|
||
This project is originally a port from a [Godot 3 module](https://github.com/godot-extended-libraries/godot-fire/tree/feature/3.2/opensubdiv-next) by | ||
|
||
K. S. Ernest (iFire) Lee (fire) | ||
|
||
who also contributed directly by testing, opening issues and helping with the Importer. | ||
\ | ||
\ | ||
The [proposal for adding opensubdiv](https://github.com/godotengine/godot-proposals/issues/784) to Godot, laying the groundwork for said module, was made by | ||
|
||
Camille Mohr-Daurat (pouleyKetchoupp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023-present K. S. Ernest (Lee) and contributors (cf. AUTHORS.md). | ||
Copyright (c) 2022 Marvin Falk and contributors (cf. AUTHORS.md). | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Godot Subdiv | ||
|
||
This is a modified version of tefusion/godot-subdiv to be a Godot Engine C++ module. | ||
|
||
| ![UV Subdivision](UVSubdivision.gif) | ![Skinning subdivision](SkinningSubdivision.gif) | | ||
| ------------------------------------ | ------------------------------------------------ | | ||
|
||
## Getting Started | ||
|
||
### Importing | ||
|
||
After installing the addon and enabling it in the settings, you can select the custom **Godot Subdiv Importer** in the import settings for any glb or gltf file. You can also use the **subdivision settings in any scene importer** to be able to make use of all the features of the 3d import pipeline from Godot. | ||
|
||
There you will see one option. | ||
|
||
SubdivMeshInstance3D | ||
|
||
Doesn't bake. Skinning and blend shape changes get processed by CPU and then directly thrown at the RenderingServer. This is useful if you have a changing mesh or changing subdivision level. | ||
|
||
Adjust the subdivision level, click reimport and you should see your mesh subdivided. | ||
|
||
### Modeling Tips | ||
|
||
OpenSubdiv has a great section on [modeling for subdivision](https://graphics.pixar.com/opensubdiv/docs/mod_notes.html). Not all of them apply for Godot Subdiv though: You can currently only import either quad only meshes to use the Catmull-Clark scheme or any other mesh which will default to the Loop subdivision scheme. | ||
|
||
### Building the project yourself | ||
|
||
To build this project you need to have SCons installed, otherwise everything is included in the project. | ||
|
||
For just building and trying out the project, do: | ||
|
||
```bash | ||
scons target=template_debug | ||
``` | ||
|
||
in the cloned folder. | ||
|
||
For running the tests, do: | ||
|
||
```bash | ||
scons -Q tests=1 target=template_debug | ||
``` | ||
|
||
which will run simple doctest tests when starting godot on the terminal: | ||
|
||
```bash | ||
path/to/godot --editor --path ${workspaceFolder}/project | ||
``` | ||
|
||
See more in the [SConstruct](SConstruct) file. | ||
|
||
## FAQ | ||
|
||
### How to create a mesh only containing Quads? | ||
|
||
In Blender, you can go in Edit Mode and go Select->Select All by Trait->Faces by Sides and set it to Not Equal To 4. After removing the then selected faces and replacing them with quads, Quad import will work. | ||
|
||
## Acknowledgments | ||
|
||
- [OpenSubdiv](https://github.com/PixarAnimationStudios/OpenSubdiv) files in [thirdparty/opensubdiv](thirdparty/opensubdiv) licensed under [Modified Apache 2.0](thirdparty/opensubdiv/LICENSE.txt) | ||
- [Godot3 module for opensubdiv](https://github.com/godot-extended-libraries/godot-fire/tree/feature/3.2/opensubdiv-next) by fire that was referenced for subdivision implementation | ||
- [Template used](https://github.com/nathanfranke/gdextension), includes the used GitHub workflow and was easy to set up | ||
|
||
## License | ||
|
||
[MIT](LICENSE) | ||
|
||
Third-party notices are in [THIRDPARTY.md](THIRDPARTY.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
|
||
Import("env") | ||
|
||
module_env = env.Clone() | ||
module_env.Append(CPPDEFINES=["_USE_MATH_DEFINES"]) | ||
module_env.add_source_files(env.modules_sources, "src/import/*.cpp") | ||
module_env.add_source_files(env.modules_sources, "src/nodes/*.cpp") | ||
module_env.add_source_files(env.modules_sources, "src/resources/*.cpp") | ||
module_env.add_source_files(env.modules_sources, "src/subdivision/*.cpp") | ||
|
||
thirdparty_dir = "thirdparty/opensubdiv/" | ||
thirdparty_sources = [ | ||
"far/error.cpp", | ||
"far/topologyDescriptor.cpp", | ||
"far/topologyRefiner.cpp", | ||
"far/topologyRefinerFactory.cpp", | ||
"sdc/crease.cpp", | ||
"sdc/typeTraits.cpp", | ||
"vtr/fvarLevel.cpp", | ||
"vtr/fvarRefinement.cpp", | ||
"vtr/level.cpp", | ||
"vtr/quadRefinement.cpp", | ||
"vtr/refinement.cpp", | ||
"vtr/sparseSelector.cpp", | ||
"vtr/triRefinement.cpp", | ||
] | ||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] | ||
|
||
env_thirdparty = module_env.Clone() | ||
env_thirdparty.disable_warnings() | ||
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources) | ||
|
||
module_env.add_source_files(env.modules_sources, "*.cpp") | ||
|
||
if env.editor_build: | ||
module_env.add_source_files(env.modules_sources, "editor/*.cpp") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.