Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 0341676

Browse files
committed
Displacement-MicroMap-Toolkit init
commit 577544a618037e49997c259b5d672b0ae1166b6d
1 parent 55a795e commit 0341676

File tree

362 files changed

+79462
-1
lines changed

Some content is hidden

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

362 files changed

+79462
-1
lines changed

.clang-format

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
BasedOnStyle: LLVM
2+
AccessModifierOffset: '-2'
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveAssignments: 'true'
5+
AlignConsecutiveDeclarations: 'true'
6+
AlignOperands: 'true'
7+
AlignTrailingComments: 'true'
8+
AllowAllParametersOfDeclarationOnNextLine: 'false'
9+
AllowShortBlocksOnASingleLine: 'false'
10+
AllowShortCaseLabelsOnASingleLine: 'false'
11+
AllowShortFunctionsOnASingleLine: Inline
12+
AllowShortIfStatementsOnASingleLine: 'false'
13+
AllowShortLoopsOnASingleLine: 'false'
14+
AlwaysBreakAfterReturnType: None
15+
AlwaysBreakBeforeMultilineStrings: 'true'
16+
AlwaysBreakTemplateDeclarations: 'true'
17+
BinPackArguments: 'true'
18+
BinPackParameters: 'false'
19+
ExperimentalAutoDetectBinPacking: 'false'
20+
BreakBeforeBinaryOperators: NonAssignment
21+
BreakBeforeBraces: Custom
22+
BreakBeforeTernaryOperators: 'false'
23+
BreakConstructorInitializersBeforeComma: 'true'
24+
ColumnLimit: '120'
25+
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
26+
Cpp11BracedListStyle: 'true'
27+
IndentCaseLabels: 'true'
28+
IndentWidth: '2'
29+
KeepEmptyLinesAtTheStartOfBlocks: 'true'
30+
Language: Cpp
31+
MaxEmptyLinesToKeep: '2'
32+
NamespaceIndentation: None
33+
ObjCSpaceBeforeProtocolList: 'true'
34+
PointerAlignment: Left
35+
SpaceAfterCStyleCast: 'false'
36+
SpaceBeforeAssignmentOperators: 'true'
37+
SpaceBeforeParens: Never
38+
SpaceInEmptyParentheses: 'false'
39+
SpacesBeforeTrailingComments: '2'
40+
SpacesInAngles: 'false'
41+
SpacesInCStyleCastParentheses: 'false'
42+
SpacesInParentheses: 'false'
43+
SpacesInSquareBrackets: 'false'
44+
Standard: Cpp11
45+
TabWidth: '2'
46+
UseTab: Never
47+
SortIncludes: 'false'
48+
ReflowComments: 'false'
49+
BraceWrapping: {
50+
AfterClass: 'true',
51+
AfterControlStatement: 'true',
52+
AfterEnum: 'true',
53+
AfterFunction: 'true',
54+
AfterNamespace: 'false',
55+
AfterStruct: 'true',
56+
AfterUnion: 'true',
57+
BeforeCatch: 'true',
58+
BeforeElse: 'true',
59+
IndentBraces: 'false'
60+
}
61+
PenaltyExcessCharacter: 1
62+
PenaltyBreakBeforeFirstCallParameter: 40
63+
PenaltyBreakFirstLessLess: 1
64+
PenaltyBreakComment: 30
65+
PenaltyBreakString: 30
66+
PenaltyReturnTypeOnItsOwnLine: 9999

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Any folder starting with an `_`
2+
**/_*/*
3+
/external/bin_x64/*
4+
build/
5+
cmake_build/
6+
7+
external/downloaded_resources/
8+
9+
./log_micromesh_viewer.txt
10+
./micromesh_viewer.ini
11+
./testing/
12+
13+
.cache/
14+
.vs/
15+
.vscode/
16+
17+
18+
mini_samples/mm_raytrace/.obsidian/
19+
testmesh/
20+
remesher/docs/crop.bat
21+
22+
remesher/docs/convert.bat
23+
24+
micromesh_python/notebook/.fuse_hidden000037a800000004
25+
26+
micromesh_python/notebook/assets/simplewall/.fuse_hidden000037a600000005

.gitmodules

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Submodules that require authentication are listed with relative paths.
2+
# This makes it so that if a developer can clone partner_tools, they can also
3+
# clone the submodules, even if they only have one of HTTPS or SSH
4+
# authentication set up. Since libpng's Git does not require authentication,
5+
# it does not use a relative path.
6+
[submodule "external/nvpro_core"]
7+
path = external/nvpro_core
8+
url = https://github.com/nvpro-samples/nvpro_core.git
9+
[submodule "external/libpng"]
10+
path = external/libpng
11+
url = https://git.code.sf.net/p/libpng/code
12+
shallow = true
13+
[submodule "external/Displacement-MicroMap-SDK"]
14+
path = external/Displacement-MicroMap-SDK
15+
url = ../Displacement-MicroMap-SDK.git
16+
[submodule "external/Displacement-MicroMap-BaryFile"]
17+
path = external/Displacement-MicroMap-BaryFile
18+
url = ../Displacement-MicroMap-BaryFile.git

CMakeLists.txt

+190
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
# CMakeLists
2+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
3+
cmake_policy(SET CMP0079 NEW) # Allow linking with targets in other directories
4+
project(
5+
micromesh_toolkit
6+
VERSION 1.0
7+
DESCRIPTION "Micromesh Tools"
8+
LANGUAGES C CXX)
9+
10+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
11+
12+
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/_install" CACHE PATH "folder in which INSTALL will put everything needed to run the binaries" FORCE)
13+
14+
# Enable bounds and other error checking for gcc debug builds in std::vector
15+
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
16+
17+
# Look for nvpro_core 1) as a sub-folder 2) at some other locations
18+
if(NOT BASE_DIRECTORY)
19+
find_path(BASE_DIRECTORY
20+
NAMES nvpro_core/cmake/setup.cmake
21+
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/..
22+
REQUIRED
23+
DOC "Directory containing nvpro_core"
24+
)
25+
endif()
26+
27+
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
28+
set(OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin_x64)
29+
include(${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
30+
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
31+
else()
32+
message(FATAL_ERROR "could not find base directory, please set BASE_DIRECTORY to folder containing nvpro_core")
33+
endif()
34+
35+
set(NVPRO_CORE_DIR ${BASE_DIRECTORY}/nvpro_core)
36+
37+
if(MSVC)
38+
add_definitions(/wd26812) # 'enum class' over 'enum'
39+
add_definitions(/wd26451) # Arithmetic overflow, casting 4 byte value to 8 byte value
40+
endif()
41+
42+
#--------------------------------------------------------------------------------------------------
43+
# Package shared by all projects
44+
45+
# set(SUPPORT_AFTERMATH on)
46+
# _add_package_NsightAftermath()
47+
_add_package_ZLIB()
48+
_add_package_VulkanSDK()
49+
_add_package_ShaderC()
50+
_add_package_ImGUI()
51+
_add_nvpro_core_lib()
52+
53+
_add_package_Glm()
54+
# nvpro_core hides GLM_INCLUDE_DIR, but it's commonly missing if not included with the vulkan SDK
55+
mark_as_advanced(CLEAR GLM_INCLUDE_DIR)
56+
if(NOT GLM_FOUND)
57+
message(FATAL_ERROR "GLM not found. Aborting. Set `GLM_INCLUDE_DIR` or include `GLM` with the Vulkan SDK install")
58+
endif()
59+
60+
set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
61+
62+
# Override BARY_CORE_BUILD_UTILS. bary_utils is needed by meshops_core
63+
set(BARY_CORE_BUILD_UTILS "ON" CACHE INTERNAL "meshops_core requires bary_utils")
64+
65+
function(find_first RESULT NAME)
66+
foreach(DIR ${ARGN})
67+
if(EXISTS ${DIR})
68+
message(STATUS "Dependency ${NAME} found at ${DIR}")
69+
set(${RESULT} ${DIR} PARENT_SCOPE)
70+
return()
71+
else()
72+
message(STATUS "Dependency ${NAME} not found at ${DIR}")
73+
endif()
74+
endforeach()
75+
message(FATAL_ERROR "${NAME} not found")
76+
endfunction()
77+
78+
find_first(PATH_BARY_CORE Displacement-MicroMap-BaryFile
79+
${CMAKE_CURRENT_SOURCE_DIR}/external/Displacement-MicroMap-BaryFile
80+
${CMAKE_CURRENT_SOURCE_DIR}/external/bary_core
81+
${CMAKE_CURRENT_SOURCE_DIR}/../bary_core
82+
${CMAKE_CURRENT_SOURCE_DIR}/../sdk/bary_core
83+
)
84+
add_subdirectory(${PATH_BARY_CORE} ${CMAKE_BINARY_DIR}/bary_core)
85+
86+
find_first(PATH_MICROMESH_CORE Displacement-MicroMap-SDK/micromesh_core
87+
${CMAKE_CURRENT_SOURCE_DIR}/external/Displacement-MicroMap-SDK/micromesh_core
88+
${CMAKE_CURRENT_SOURCE_DIR}/external/micromesh_core
89+
${CMAKE_CURRENT_SOURCE_DIR}/../micromesh_core
90+
${CMAKE_CURRENT_SOURCE_DIR}/../sdk/micromesh_core
91+
)
92+
add_subdirectory(${PATH_MICROMESH_CORE} ${CMAKE_BINARY_DIR}/micromesh_core)
93+
94+
find_first(PATH_SDK_COMPRESSION Displacement-MicroMap-SDK/micromesh_displacement_compression
95+
${CMAKE_CURRENT_SOURCE_DIR}/external/Displacement-MicroMap-SDK/micromesh_displacement_compression
96+
${CMAKE_CURRENT_SOURCE_DIR}/external/micromesh_displacement_compression
97+
${CMAKE_CURRENT_SOURCE_DIR}/../micromesh_displacement_compression
98+
${CMAKE_CURRENT_SOURCE_DIR}/../sdk/micromesh_displacement_compression
99+
)
100+
add_subdirectory(${PATH_SDK_COMPRESSION} ${CMAKE_BINARY_DIR}/micromesh_displacement_compression)
101+
102+
find_first(PATH_SDK_REMESHING Displacement-MicroMap-SDK/micromesh_displacement_remeshing
103+
${CMAKE_CURRENT_SOURCE_DIR}/external/Displacement-MicroMap-SDK/micromesh_displacement_remeshing
104+
${CMAKE_CURRENT_SOURCE_DIR}/external/micromesh_displacement_remeshing
105+
${CMAKE_CURRENT_SOURCE_DIR}/../micromesh_displacement_remeshing
106+
${CMAKE_CURRENT_SOURCE_DIR}/../sdk/micromesh_displacement_remeshing
107+
)
108+
add_subdirectory(${PATH_SDK_REMESHING} ${CMAKE_BINARY_DIR}/micromesh_displacement_remeshing)
109+
110+
###
111+
# Custom build modifications for libpng.
112+
option(PNG_BUILD_ZLIB "Custom zlib Location, else find_package is used" ON)
113+
option(PNG_EXECUTABLES "Build libpng executables" OFF)
114+
option(PNG_SHARED "Build shared PNG lib" OFF)
115+
option(PNG_TESTS "Build libpng tests" OFF)
116+
set(SKIP_INSTALL_ALL ON) # Skip all libpng install targets
117+
# This is a bit of a hack: we must include zlibstatic from nvpro_core, so we
118+
# must also turn off libpng's build configuration (since this configuration
119+
# fails on WSL, and since it produces a compile-time error if the detected zlib
120+
# version doesn't match nvpro_core's zlib version). To do this, we set IOS
121+
# around libpng's CMake files.
122+
set(IOS ON)
123+
add_subdirectory(external/libpng)
124+
unset(IOS)
125+
target_link_libraries(png_static zlibstatic)
126+
target_include_directories(png_static PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/external/libpng> ${CMAKE_CURRENT_LIST_DIR}/external/libpng)
127+
###
128+
add_subdirectory(external/tinyexr)
129+
add_subdirectory(meshops_core)
130+
add_subdirectory(meshops_bake)
131+
add_subdirectory(meshops_remesher)
132+
add_subdirectory(mini_samples)
133+
add_subdirectory(micromesh_tool)
134+
add_subdirectory(micromesh_python)
135+
add_subdirectory(micromesh_toolbox)
136+
137+
# Enable some additional warnings for micromesh toolkit projects Attempt to
138+
# match warnings between different compilers
139+
if(WIN32) # Windows
140+
set(MICROMESH_COMPILE_WARNINGS
141+
)
142+
else() # Linux
143+
set(MICROMESH_COMPILE_WARNINGS
144+
-Wsign-compare
145+
-Wconversion
146+
)
147+
endif()
148+
149+
# Add per-source file compile options because many third party dependencies
150+
# are not compatible with more strict warnings.
151+
foreach(TARGET
152+
meshops_core
153+
meshops_bake
154+
meshops_remesher
155+
dmm_displacement
156+
micromesh_tool_lib
157+
micromesh_tool
158+
micromesh_python
159+
micromesh_toolbox
160+
)
161+
if (TARGET ${TARGET})
162+
set_property(TARGET ${TARGET} APPEND PROPERTY COMPILE_OPTIONS ${MICROMESH_COMPILE_WARNINGS})
163+
endif()
164+
endforeach()
165+
166+
set_target_properties(bary_core PROPERTIES FOLDER "bary_libs")
167+
set_target_properties(bary_utils PROPERTIES FOLDER "bary_libs")
168+
169+
set_target_properties(meshops_core PROPERTIES FOLDER "meshops_libs")
170+
set_target_properties(meshops_bake PROPERTIES FOLDER "meshops_libs")
171+
set_target_properties(meshops_remesher PROPERTIES FOLDER "meshops_libs")
172+
173+
set_target_properties(micromesh_core PROPERTIES FOLDER "micromesh_libs")
174+
set_target_properties(micromesh_displacement_compression PROPERTIES FOLDER "micromesh_libs")
175+
set_target_properties(micromesh_displacement_remeshing PROPERTIES FOLDER "micromesh_libs")
176+
177+
set_target_properties(micromesh_tool_lib PROPERTIES FOLDER "tool_libs")
178+
if (TARGET micromesh_python)
179+
set_target_properties(micromesh_python PROPERTIES FOLDER "tool_libs")
180+
endif()
181+
182+
set_target_properties(micromesh_tool PROPERTIES FOLDER "tools")
183+
set_target_properties(micromesh_toolbox PROPERTIES FOLDER "tools")
184+
185+
set_target_properties(nvpro_core PROPERTIES FOLDER "ThirdParty")
186+
set_target_properties(tinyexr PROPERTIES FOLDER "ThirdParty")
187+
set_target_properties(png_static PROPERTIES FOLDER "ThirdParty")
188+
set_target_properties(genfiles PROPERTIES FOLDER "ThirdParty") # From libpng
189+
190+
install(DIRECTORY "media" DESTINATION ${CMAKE_INSTALL_BINDIR})

0 commit comments

Comments
 (0)