Merge branch 'master' into refactor-mesh-position-generic
This commit is contained in:
commit
9cc4f430c9
|
@ -117,8 +117,8 @@ enable_testing()
|
|||
# Keep in sync with: https://wiki.blender.org/wiki/Building_Blender
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "9.3.1")
|
||||
message(FATAL_ERROR "The minimum supported version of GCC is 9.3.1")
|
||||
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
||||
message(FATAL_ERROR "The minimum supported version of GCC is 11.0.0")
|
||||
endif()
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0"))
|
||||
|
@ -576,8 +576,8 @@ endif()
|
|||
|
||||
# OpenGL
|
||||
|
||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
|
||||
option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
|
||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
|
||||
option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF)
|
||||
|
||||
mark_as_advanced(
|
||||
WITH_OPENGL
|
||||
|
@ -749,11 +749,6 @@ if("${CMAKE_GENERATOR}" MATCHES "Ninja")
|
|||
mark_as_advanced(WITH_NINJA_POOL_JOBS)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
option(WITH_CXX11_ABI "Use native C++11 ABI of compiler" ON)
|
||||
mark_as_advanced(WITH_CXX11_ABI)
|
||||
endif()
|
||||
|
||||
# Installation process.
|
||||
set(POSTINSTALL_SCRIPT "" CACHE FILEPATH "Run given CMake script after installation process")
|
||||
mark_as_advanced(POSTINSTALL_SCRIPT)
|
||||
|
@ -1721,12 +1716,6 @@ if(
|
|||
string(APPEND CMAKE_C_FLAGS " -std=gnu11")
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(NOT WITH_CXX11_ABI)
|
||||
string(APPEND PLATFORM_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_COMPILER_SHORT_FILE_MACRO)
|
||||
# Use '-fmacro-prefix-map' for Clang and GCC (MSVC doesn't support this).
|
||||
add_check_c_compiler_flag(C_PREFIX_MAP_FLAGS C_MACRO_PREFIX_MAP -fmacro-prefix-map=foo=bar)
|
||||
|
@ -2018,6 +2007,24 @@ if(0)
|
|||
print_all_vars()
|
||||
endif()
|
||||
|
||||
set(LIBDIR_STALE)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# Only search for the path if it's found on the system.
|
||||
if(EXISTS "../lib/linux_centos7_x86_64")
|
||||
set(LIBDIR_STALE "/lib/linux_centos7_x86_64/")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LIBDIR_STALE)
|
||||
print_cached_vars_containing_value(
|
||||
"${LIBDIR_STALE}"
|
||||
"\nWARNING: found cached references to old library paths!\n"
|
||||
"\nIt is *strongly* recommended to reference updated library paths!\n"
|
||||
)
|
||||
endif()
|
||||
unset(LIBDIR_STALE)
|
||||
|
||||
# Should be the last step of configuration.
|
||||
if(POSTCONFIGURE_SCRIPT)
|
||||
include(${POSTCONFIGURE_SCRIPT})
|
||||
|
|
|
@ -211,7 +211,7 @@ endif
|
|||
# Set the LIBDIR, an empty string when not found.
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU})
|
||||
ifeq (, $(LIBDIR))
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_centos7_${CPU})
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE}_${CPU}_glibc_228)
|
||||
endif
|
||||
ifeq (, $(LIBDIR))
|
||||
LIBDIR:=$(wildcard ../lib/${OS_NCASE})
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
set(SBOMCONTENTS)
|
||||
get_cmake_property(_variableNames VARIABLES)
|
||||
foreach (_variableName ${_variableNames})
|
||||
foreach(_variableName ${_variableNames})
|
||||
if(_variableName MATCHES "CPE$")
|
||||
string(REPLACE ":" ";" CPE_LIST ${${_variableName}})
|
||||
string(REPLACE "_CPE" "_ID" CPE_DEPNAME ${_variableName})
|
||||
|
|
|
@ -10,22 +10,22 @@ function(download_source dep)
|
|||
if(PACKAGE_USE_UPSTREAM_SOURCES)
|
||||
set(TARGET_URI ${${dep}_URI})
|
||||
elseif(BLENDER_VERSION)
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/tags/blender-${BLENDER_VERSION}-release/lib/packages/${TARGET_FILE})
|
||||
else()
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||
set(TARGET_URI https://svn.blender.org/svnroot/bf-blender/trunk/lib/packages/${TARGET_FILE})
|
||||
endif()
|
||||
# Validate all required variables are set and give an explicit error message
|
||||
# rather than CMake erroring out later on with a more ambigious error.
|
||||
if (NOT DEFINED TARGET_FILE)
|
||||
if(NOT DEFINED TARGET_FILE)
|
||||
message(FATAL_ERROR "${dep}_FILE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH)
|
||||
if(NOT DEFINED TARGET_HASH)
|
||||
message(FATAL_ERROR "${dep}_HASH variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_HASH_TYPE)
|
||||
if(NOT DEFINED TARGET_HASH_TYPE)
|
||||
message(FATAL_ERROR "${dep}_HASH_TYPE variable not set")
|
||||
endif()
|
||||
if (NOT DEFINED TARGET_URI)
|
||||
if(NOT DEFINED TARGET_URI)
|
||||
message(FATAL_ERROR "${dep}_URI variable not set")
|
||||
endif()
|
||||
set(TARGET_FILE ${PACKAGE_DIR}/${TARGET_FILE})
|
||||
|
@ -43,11 +43,11 @@ function(download_source dep)
|
|||
if(EXISTS ${TARGET_FILE})
|
||||
# Sometimes the download fails, but that is not a
|
||||
# fail condition for "file(DOWNLOAD" it will warn about
|
||||
# a crc mismatch and just carry on, we need to explicitly
|
||||
# a CRC mismatch and just carry on, we need to explicitly
|
||||
# catch this and remove the bogus 0 byte file so we can
|
||||
# retry without having to go find the file and manually
|
||||
# delete it.
|
||||
file (SIZE ${TARGET_FILE} TARGET_SIZE)
|
||||
file(SIZE ${TARGET_FILE} TARGET_SIZE)
|
||||
if(${TARGET_SIZE} EQUAL 0)
|
||||
file(REMOVE ${TARGET_FILE})
|
||||
message(FATAL_ERROR "for ${TARGET_FILE} file size 0, download likely failed, deleted...")
|
||||
|
|
|
@ -15,10 +15,11 @@ set(EMBREE_EXTRA_ARGS
|
|||
-DTBB_ROOT=${LIBDIR}/tbb
|
||||
)
|
||||
|
||||
if (NOT BLENDER_PLATFORM_ARM)
|
||||
if(NOT BLENDER_PLATFORM_ARM)
|
||||
set(EMBREE_EXTRA_ARGS
|
||||
${EMBREE_EXTRA_ARGS}
|
||||
-DEMBREE_MAX_ISA=AVX2)
|
||||
-DEMBREE_MAX_ISA=AVX2
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TBB_STATIC_LIBRARY)
|
||||
|
@ -52,17 +53,17 @@ if(WIN32)
|
|||
)
|
||||
else()
|
||||
ExternalProject_Add_Step(external_embree after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree3.lib ${HARVEST_TARGET}/embree/lib/embree3_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx.lib ${HARVEST_TARGET}/embree/lib/embree_avx_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_avx2.lib ${HARVEST_TARGET}/embree/lib/embree_avx2_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/embree_sse42.lib ${HARVEST_TARGET}/embree/lib/embree_sse42_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/lexers.lib ${HARVEST_TARGET}/embree/lib/lexers_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/math.lib ${HARVEST_TARGET}/embree/lib/math_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/simd.lib ${HARVEST_TARGET}/embree/lib/simd_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/sys.lib ${HARVEST_TARGET}/embree/lib/sys_d.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/embree/lib/tasking.lib ${HARVEST_TARGET}/embree/lib/tasking_d.lib
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -40,10 +40,10 @@ endif()
|
|||
|
||||
if(BUILD_MODE STREQUAL Release AND WIN32)
|
||||
ExternalProject_Add_Step(external_gmp after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/gmp/bin/libgmp-10.dll ${HARVEST_TARGET}/gmp/lib/libgmp-10.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib ${HARVEST_TARGET}/gmp/lib/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/gmp/include ${HARVEST_TARGET}/gmp/include
|
||||
|
||||
DEPENDEES install
|
||||
|
@ -52,8 +52,8 @@ endif()
|
|||
|
||||
if(BUILD_MODE STREQUAL Debug AND WIN32)
|
||||
ExternalProject_Add_Step(external_gmp after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-3.dll.def ${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def
|
||||
COMMAND lib /def:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.def /machine:x64 /out:${BUILD_DIR}/gmp/src/external_gmp/.libs/libgmp-10.lib
|
||||
|
||||
DEPENDEES install
|
||||
)
|
||||
|
|
|
@ -11,276 +11,301 @@ message("HARVEST_TARGET = ${HARVEST_TARGET}")
|
|||
|
||||
if(WIN32)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # jpeg rename libfile + copy include
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # JPEG rename lib-file + copy include.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/jpeg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpeg/include/ ${HARVEST_TARGET}/jpeg/include/ &&
|
||||
# png
|
||||
# PNG.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ &&
|
||||
# freeglut-> opengl
|
||||
# FREEGLUT -> OPENGL.
|
||||
${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib &&
|
||||
${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ &&
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
|
||||
else(WIN32)
|
||||
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
PATTERN "meson*" EXCLUDE
|
||||
DEPENDS
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
|
||||
# lib folder, and remove any absolute paths.
|
||||
#
|
||||
# Ideally this would be done as part of the Blender build since it makes assumptions
|
||||
# about where the files will be installed. However it would add patchelf as a new
|
||||
# dependency for building.
|
||||
#
|
||||
# Also removes versioned symlinks, which give errors with macOS notarization.
|
||||
if(APPLE)
|
||||
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
|
||||
else()
|
||||
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
|
||||
endif()
|
||||
|
||||
function(harvest_rpath_lib from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
function(harvest from to)
|
||||
set(pattern "")
|
||||
foreach(f ${ARGN})
|
||||
set(pattern ${f})
|
||||
endforeach()
|
||||
|
||||
install(CODE "\
|
||||
cmake_policy(SET CMP0009 NEW)\n
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
if(pattern STREQUAL "")
|
||||
get_filename_component(dirpath ${to} DIRECTORY)
|
||||
get_filename_component(filename ${to} NAME)
|
||||
install(
|
||||
FILES ${LIBDIR}/${from}
|
||||
DESTINATION ${HARVEST_TARGET}/${dirpath}
|
||||
RENAME ${filename}
|
||||
)
|
||||
else()
|
||||
install(
|
||||
DIRECTORY ${LIBDIR}/${from}/
|
||||
DESTINATION ${HARVEST_TARGET}/${to}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
FILES_MATCHING PATTERN ${pattern}
|
||||
PATTERN "pkgconfig" EXCLUDE
|
||||
PATTERN "cmake" EXCLUDE
|
||||
PATTERN "__pycache__" EXCLUDE
|
||||
PATTERN "tests" EXCLUDE
|
||||
PATTERN "meson*" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Set rpath on shared libraries to $ORIGIN since all will be installed in the same
|
||||
# lib folder, and remove any absolute paths.
|
||||
#
|
||||
# Ideally this would be done as part of the Blender build since it makes assumptions
|
||||
# about where the files will be installed. However it would add patchelf as a new
|
||||
# dependency for building.
|
||||
#
|
||||
# Also removes versioned symlinks, which give errors with macOS notarization.
|
||||
if(APPLE)
|
||||
set(set_rpath_cmd python3 ${CMAKE_CURRENT_SOURCE_DIR}/darwin/set_rpath.py @loader_path)
|
||||
else()
|
||||
set(set_rpath_cmd patchelf --set-rpath $ORIGIN)
|
||||
endif()
|
||||
|
||||
function(harvest_rpath_lib from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
cmake_policy(SET CMP0009 NEW)\n
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
endif()\n
|
||||
else()\n
|
||||
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
|
||||
endif()\n
|
||||
else()\n
|
||||
execute_process(COMMAND ${set_rpath_cmd} \${f}) \n
|
||||
endif()\n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
# Set rpath on utility binaries assuming they are run from their install location.
|
||||
function(harvest_rpath_bin from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
# Set rpath on utility binaries assuming they are run from their install location.
|
||||
function(harvest_rpath_bin from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/../lib; \${f}) \n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
# Set rpath on Python module to point to the shared libraries folder in the Blender
|
||||
# installation.
|
||||
function(harvest_rpath_python from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
# Set rpath on Python module to point to the shared libraries folder in the Blender
|
||||
# installation.
|
||||
function(harvest_rpath_python from to pattern)
|
||||
harvest(${from} ${to} ${pattern})
|
||||
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
install(CODE "\
|
||||
file(GLOB_RECURSE shared_libs ${HARVEST_TARGET}/${to}/${pattern}\.so*) \n
|
||||
foreach(f \${shared_libs}) \n
|
||||
if(IS_SYMLINK \${f})\n
|
||||
if(APPLE)\n
|
||||
file(REMOVE_RECURSE \${f})
|
||||
endif()\n
|
||||
else()\n
|
||||
get_filename_component(f_dir \${f} DIRECTORY) \n
|
||||
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
|
||||
endif()\n
|
||||
else()\n
|
||||
get_filename_component(f_dir \${f} DIRECTORY) \n
|
||||
file(RELATIVE_PATH relative_dir \${f_dir} ${HARVEST_TARGET}) \n
|
||||
execute_process(COMMAND ${set_rpath_cmd}/\${relative_dir}../lib \${f}) \n
|
||||
endif()\n
|
||||
endforeach()")
|
||||
endfunction()
|
||||
endforeach()")
|
||||
endfunction()
|
||||
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest_rpath_bin(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(fribidi/include fribidi/include "*.h")
|
||||
harvest(fribidi/lib fribidi/lib "*.a")
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(harfbuzz/include harfbuzz/include "*.h")
|
||||
harvest(harfbuzz/lib harfbuzz/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "libomp.dylib")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
harvest(alembic/include alembic/include "*.h")
|
||||
harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a)
|
||||
harvest_rpath_bin(alembic/bin alembic/bin "*")
|
||||
harvest(brotli/include brotli/include "*.h")
|
||||
harvest(brotli/lib brotli/lib "*.a")
|
||||
harvest(boost/include boost/include "*")
|
||||
harvest_rpath_lib(boost/lib boost/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(imath/include imath/include "*.h")
|
||||
harvest_rpath_lib(imath/lib imath/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(ffmpeg/include ffmpeg/include "*.h")
|
||||
harvest(ffmpeg/lib ffmpeg/lib "*.a")
|
||||
harvest(fftw3/include fftw3/include "*.h")
|
||||
harvest(fftw3/lib fftw3/lib "*.a")
|
||||
harvest(flac/lib sndfile/lib "libFLAC.a")
|
||||
harvest(freetype/include freetype/include "*.h")
|
||||
harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a)
|
||||
harvest(fribidi/include fribidi/include "*.h")
|
||||
harvest(fribidi/lib fribidi/lib "*.a")
|
||||
harvest(epoxy/include epoxy/include "*.h")
|
||||
harvest(epoxy/lib epoxy/lib "*.a")
|
||||
harvest(gmp/include gmp/include "*.h")
|
||||
harvest(gmp/lib gmp/lib "*.a")
|
||||
harvest(harfbuzz/include harfbuzz/include "*.h")
|
||||
harvest(harfbuzz/lib harfbuzz/lib "*.a")
|
||||
harvest(jemalloc/include jemalloc/include "*.h")
|
||||
harvest(jemalloc/lib jemalloc/lib "*.a")
|
||||
harvest(jpeg/include jpeg/include "*.h")
|
||||
harvest(jpeg/lib jpeg/lib "libjpeg.a")
|
||||
harvest(lame/lib ffmpeg/lib "*.a")
|
||||
if(NOT APPLE)
|
||||
harvest(level-zero/include/level_zero level-zero/include/level_zero "*.h")
|
||||
harvest(level-zero/lib level-zero/lib "*${SHAREDLIBEXT}*")
|
||||
endif()
|
||||
harvest(llvm/bin llvm/bin "clang-format")
|
||||
if(BUILD_CLANG_TOOLS)
|
||||
harvest(llvm/bin llvm/bin "clang-tidy")
|
||||
harvest(llvm/share/clang llvm/share "run-clang-tidy.py")
|
||||
endif()
|
||||
harvest(llvm/include llvm/include "*")
|
||||
harvest(llvm/bin llvm/bin "llvm-config")
|
||||
harvest(llvm/lib llvm/lib "libLLVM*.a")
|
||||
harvest(llvm/lib llvm/lib "libclang*.a")
|
||||
harvest(llvm/lib/clang llvm/lib/clang "*.h")
|
||||
if(APPLE)
|
||||
harvest(openmp/lib openmp/lib "libomp.dylib")
|
||||
harvest(openmp/include openmp/include "*.h")
|
||||
endif()
|
||||
if(BLENDER_PLATFORM_ARM)
|
||||
harvest(sse2neon sse2neon "*.h")
|
||||
endif()
|
||||
harvest(ogg/lib ffmpeg/lib "*.a")
|
||||
harvest(openal/include openal/include "*.h")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(openal/lib openal/lib "*.a")
|
||||
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
harvest(zlib/include zlib/include "*.h")
|
||||
harvest(zlib/lib zlib/lib "*.a")
|
||||
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
harvest(xml2/include xml2/include "*.h")
|
||||
harvest(xml2/lib xml2/lib "*.a")
|
||||
|
||||
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||
harvest(
|
||||
wayland-protocols/share/wayland-protocols
|
||||
wayland-protocols/share/wayland-protocols/
|
||||
"*.xml"
|
||||
)
|
||||
harvest(wayland/bin wayland/bin "wayland-scanner")
|
||||
harvest(wayland/include wayland/include "*.h")
|
||||
harvest(wayland_libdecor/include wayland_libdecor/include "*.h")
|
||||
else()
|
||||
harvest(blosc/lib openvdb/lib "*.a")
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(opencolorio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(openimageio/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*")
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openpgl/include openpgl/include "*.h")
|
||||
harvest(openpgl/lib openpgl/lib "*.a")
|
||||
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(openvdb/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*pyopenvdb*")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest_rpath_bin(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest_rpath_python(usd/lib/python/pxr python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr "*")
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(materialx/include materialx/include "*.h")
|
||||
harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(materialx/libraries materialx/libraries "*")
|
||||
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
|
||||
harvest_rpath_python(materialx/python/MaterialX python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX "*")
|
||||
# We do not need anything from the resources folder, but the MaterialX config
|
||||
# file will complain if the folder does not exist, so just copy the readme.md
|
||||
# files to ensure the folder will exist.
|
||||
harvest(materialx/resources materialx/resources "README.md")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
harvest(shaderc shaderc "*")
|
||||
harvest(vulkan_headers vulkan "*")
|
||||
harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
|
||||
if(APPLE)
|
||||
harvest(vulkan_loader/loader vulkan/loader "*")
|
||||
endif()
|
||||
harvest(xml2/lib opencollada/lib "*.a")
|
||||
endif()
|
||||
harvest(opencollada/include/opencollada opencollada/include "*.h")
|
||||
harvest(opencollada/lib/opencollada opencollada/lib "*.a")
|
||||
harvest(opencolorio/include opencolorio/include "*.h")
|
||||
harvest_rpath_lib(opencolorio/lib opencolorio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
opencolorio/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*"
|
||||
)
|
||||
harvest(openexr/include openexr/include "*.h")
|
||||
harvest_rpath_lib(openexr/lib openexr/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "idiff")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "maketx")
|
||||
harvest_rpath_bin(openimageio/bin openimageio/bin "oiiotool")
|
||||
harvest(openimageio/include openimageio/include "*")
|
||||
harvest_rpath_lib(openimageio/lib openimageio/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
openimageio/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*"
|
||||
)
|
||||
harvest(openimagedenoise/include openimagedenoise/include "*")
|
||||
harvest(openimagedenoise/lib openimagedenoise/lib "*.a")
|
||||
harvest(embree/include embree/include "*.h")
|
||||
harvest(embree/lib embree/lib "*.a")
|
||||
harvest(openpgl/include openpgl/include "*.h")
|
||||
harvest(openpgl/lib openpgl/lib "*.a")
|
||||
harvest(openpgl/lib/cmake/openpgl-${OPENPGL_SHORT_VERSION} openpgl/lib/cmake/openpgl "*.cmake")
|
||||
harvest(openjpeg/include/openjpeg-${OPENJPEG_SHORT_VERSION} openjpeg/include "*.h")
|
||||
harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest_rpath_lib(opensubdiv/lib opensubdiv/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
harvest(openvdb/include/nanovdb openvdb/include/nanovdb "*.h")
|
||||
harvest_rpath_lib(openvdb/lib openvdb/lib "*${SHAREDLIBEXT}*")
|
||||
harvest_rpath_python(
|
||||
openvdb/lib/python${PYTHON_SHORT_VERSION}
|
||||
python/lib/python${PYTHON_SHORT_VERSION}
|
||||
"*pyopenvdb*"
|
||||
)
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
harvest_rpath_bin(osl/bin osl/bin "oslc")
|
||||
harvest(osl/include osl/include "*.h")
|
||||
harvest(osl/lib osl/lib "*.a")
|
||||
harvest(osl/share/OSL/shaders osl/share/OSL/shaders "*.h")
|
||||
harvest(png/include png/include "*.h")
|
||||
harvest(png/lib png/lib "*.a")
|
||||
harvest(pugixml/include pugixml/include "*.hpp")
|
||||
harvest(pugixml/lib pugixml/lib "*.a")
|
||||
harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}")
|
||||
harvest(python/include python/include "*h")
|
||||
harvest(python/lib python/lib "*")
|
||||
harvest(sdl/include/SDL2 sdl/include "*.h")
|
||||
harvest(sdl/lib sdl/lib "libSDL2.a")
|
||||
harvest(sndfile/include sndfile/include "*.h")
|
||||
harvest(sndfile/lib sndfile/lib "*.a")
|
||||
harvest(spnav/include spnav/include "*.h")
|
||||
harvest(spnav/lib spnav/lib "*.a")
|
||||
harvest(tbb/include tbb/include "*.h")
|
||||
harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}")
|
||||
harvest(theora/lib ffmpeg/lib "*.a")
|
||||
harvest(tiff/include tiff/include "*.h")
|
||||
harvest(tiff/lib tiff/lib "*.a")
|
||||
harvest(vorbis/lib ffmpeg/lib "*.a")
|
||||
harvest(opus/lib ffmpeg/lib "*.a")
|
||||
harvest(vpx/lib ffmpeg/lib "*.a")
|
||||
harvest(x264/lib ffmpeg/lib "*.a")
|
||||
harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(aom/lib ffmpeg/lib "*.a")
|
||||
harvest(webp/lib webp/lib "*.a")
|
||||
harvest(webp/include webp/include "*.h")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest_rpath_lib(usd/lib usd/lib "libusd_ms${SHAREDLIBEXT}")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest_rpath_python(
|
||||
usd/lib/python/pxr
|
||||
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/pxr
|
||||
"*"
|
||||
)
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(materialx/include materialx/include "*.h")
|
||||
harvest_rpath_lib(materialx/lib materialx/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(materialx/libraries materialx/libraries "*")
|
||||
harvest(materialx/lib/cmake/MaterialX materialx/lib/cmake/MaterialX "*.cmake")
|
||||
harvest_rpath_python(
|
||||
materialx/python/MaterialX
|
||||
python/lib/python${PYTHON_SHORT_VERSION}/site-packages/MaterialX
|
||||
"*"
|
||||
)
|
||||
# We do not need anything from the resources folder, but the MaterialX config
|
||||
# file will complain if the folder does not exist, so just copy the readme.md
|
||||
# files to ensure the folder will exist.
|
||||
harvest(materialx/resources materialx/resources "README.md")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
harvest(haru/include haru/include "*.h")
|
||||
harvest(haru/lib haru/lib "*.a")
|
||||
harvest(zstd/include zstd/include "*.h")
|
||||
harvest(zstd/lib zstd/lib "*.a")
|
||||
harvest(shaderc shaderc "*")
|
||||
harvest(vulkan_headers vulkan "*")
|
||||
harvest_rpath_lib(vulkan_loader/lib vulkan/lib "*${SHAREDLIBEXT}*")
|
||||
if(APPLE)
|
||||
harvest(vulkan_loader/loader vulkan/loader "*")
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*${SHAREDLIBEXT}*")
|
||||
harvest(mesa/lib64 mesa/lib "*${SHAREDLIBEXT}*")
|
||||
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
harvest(dpcpp dpcpp "*")
|
||||
harvest(igc dpcpp/lib/igc "*")
|
||||
harvest(ocloc dpcpp/lib/ocloc "*")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -26,9 +26,9 @@ else()
|
|||
-DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2
|
||||
)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2s.lib)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2s.lib)
|
||||
else()
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
|
||||
list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib)
|
||||
endif()
|
||||
set(PATCH_MAYBE_DOS2UNIX_CMD)
|
||||
endif()
|
||||
|
|
|
@ -1,20 +1,5 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(SHADERC_EXTRA_ARGS
|
||||
-DSHADERC_SKIP_TESTS=On
|
||||
-DSHADERC_SPIRV_TOOLS_DIR=${BUILD_DIR}/shaderc_spirv_tools/src/external_shaderc_spirv_tools
|
||||
|
@ -60,5 +45,3 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# These are build time requirements for shaderc. We only have to unpack these
|
||||
# shaderc will build them.
|
||||
|
@ -48,4 +32,3 @@ ExternalProject_Add(external_shaderc_spirv_tools
|
|||
BUILD_COMMAND echo .
|
||||
INSTALL_COMMAND echo .
|
||||
)
|
||||
|
||||
|
|
|
@ -17,19 +17,6 @@ else()
|
|||
set(SNDFILE_OPTIONS --enable-static --disable-shared )
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# NOTE(@campbellbarton): For some reason OPUS is alone in referencing the sub-directory,
|
||||
# manipulate the package-config file to prevent this from happening.
|
||||
# There is no problem with applying this change multiple times.
|
||||
#
|
||||
# Replace: Cflags: -I${includedir}/opus
|
||||
# With: Cflags: -I${includedir}
|
||||
set(SNDFILE_ENV
|
||||
sed -i s/{includedir}\\/opus/{includedir}/g ${LIBDIR}/opus/lib/pkgconfig/opus.pc &&
|
||||
${SNDFILE_ENV}
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_sndfile
|
||||
URL file://${PACKAGE_DIR}/${SNDFILE_FILE}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
|
|
|
@ -34,7 +34,8 @@ elseif(UNIX)
|
|||
if(APPLE)
|
||||
set(USD_SHARED_LINKER_FLAGS "-Xlinker -undefined -Xlinker dynamic_lookup")
|
||||
list(APPEND USD_PLATFORM_FLAGS
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS})
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=${USD_SHARED_LINKER_FLAGS}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -112,7 +113,7 @@ add_dependencies(
|
|||
# Since USD 21.11 the libraries are prefixed with "usd_", i.e. "libusd_m.a" became "libusd_usd_m.a".
|
||||
# See https://github.com/PixarAnimationStudios/USD/blob/release/CHANGELOG.md#2111---2021-11-01
|
||||
if(NOT WIN32)
|
||||
if (USD_VERSION VERSION_LESS 21.11)
|
||||
if(USD_VERSION VERSION_LESS 21.11)
|
||||
set(PXR_LIB_PREFIX "")
|
||||
else()
|
||||
set(PXR_LIB_PREFIX "usd_")
|
||||
|
|
|
@ -359,7 +359,7 @@ set(SNDFILE_VERSION 1.1.0)
|
|||
set(SNDFILE_URI https://github.com/libsndfile/libsndfile/releases/download/1.1.0/libsndfile-${SNDFILE_VERSION}.tar.xz)
|
||||
set(SNDFILE_HASH e63dead2b4f0aaf323687619d007ee6a)
|
||||
set(SNDFILE_HASH_TYPE MD5)
|
||||
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.gz)
|
||||
set(SNDFILE_FILE libsndfile-${SNDFILE_VERSION}.tar.xz)
|
||||
set(SNDFILE_CPE "cpe:2.3:a:libsndfile_project:libsndfile:${SNDFILE_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(WEBP_VERSION 1.2.2)
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
set(VULKAN_HEADERS_EXTRA_ARGS)
|
||||
|
||||
|
@ -68,4 +52,3 @@ elseif(WIN32)
|
|||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# macOS utility to remove all rpaths and add a new one.
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# macOS utility to remove all `rpaths` and add a new one.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_release.cmake")
|
||||
|
||||
message(STATUS "Building in CentOS 7 64bit environment")
|
||||
message(STATUS "Building in Rocky 8 Linux 64bit environment")
|
||||
|
||||
set(LIBDIR_NAME "linux_centos7_x86_64")
|
||||
set(WITH_CXX11_ABI OFF CACHE BOOL "" FORCE)
|
||||
set(LIBDIR_NAME "linux_x86_64_glibc_228")
|
||||
|
||||
# ######## Linux-specific build options ########
|
||||
# Options which are specific to Linux-only platforms
|
||||
|
@ -28,4 +27,4 @@ set(LIBDIR "${CMAKE_CURRENT_LIST_DIR}/../../../../lib/${LIBDIR_NAME}" CACHE STRI
|
|||
# Platform specific configuration, to ensure static linking against everything.
|
||||
|
||||
# Additional linking libraries
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lrt -no-pie" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lrt -no-pie" CACHE STRING "" FORCE)
|
||||
|
|
|
@ -172,7 +172,7 @@ ENDIF()
|
|||
# handle the QUIETLY and REQUIRED arguments and set OPENEXR_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenEXR DEFAULT_MSG
|
||||
_openexr_LIBRARIES OPENEXR_INCLUDE_DIR)
|
||||
|
||||
IF(OPENEXR_FOUND)
|
||||
|
|
|
@ -22,7 +22,7 @@ endif()
|
|||
|
||||
# Used for: `source/blender/blenlib/intern/system.c`.
|
||||
# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC),
|
||||
# so check the presence of the header before including it and using the it for back-trace.
|
||||
# so check the presence of the header before including it and using the it for back-trace.
|
||||
set(HAVE_EXECINFO_H OFF)
|
||||
if(NOT MSVC)
|
||||
include(CheckIncludeFiles)
|
||||
|
|
|
@ -326,8 +326,8 @@ function(blender_add_lib__impl
|
|||
# NOTE: If separated libraries for debug and release are needed every library is the list are
|
||||
# to be prefixed explicitly.
|
||||
#
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
if(NOT "${library_deps}" STREQUAL "")
|
||||
set(next_library_mode "")
|
||||
foreach(library ${library_deps})
|
||||
|
@ -535,7 +535,7 @@ function(setup_platform_linker_flags
|
|||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
|
||||
get_target_property(target_type ${target} TYPE)
|
||||
if (target_type STREQUAL "EXECUTABLE")
|
||||
if(target_type STREQUAL "EXECUTABLE")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS_EXECUTABLE}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -1209,6 +1209,43 @@ function(print_all_vars)
|
|||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# Print a list of all cached variables with values containing `contents`.
|
||||
function(print_cached_vars_containing_value
|
||||
contents
|
||||
msg_header
|
||||
msg_footer
|
||||
)
|
||||
set(_list_info)
|
||||
set(_found)
|
||||
get_cmake_property(_vars VARIABLES)
|
||||
foreach(_var ${_vars})
|
||||
if(DEFINED CACHE{${_var}})
|
||||
# Skip "_" prefixed variables, these are used for internal book-keeping,
|
||||
# not under user control.
|
||||
string(FIND "${_var}" "_" _found)
|
||||
if(NOT (_found EQUAL 0))
|
||||
string(FIND "${${_var}}" "${contents}" _found)
|
||||
if(NOT (_found EQUAL -1))
|
||||
if(_found)
|
||||
list(APPEND _list_info "${_var}=${${_var}}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_var)
|
||||
unset(_vars)
|
||||
unset(_found)
|
||||
if(_list_info)
|
||||
message(${msg_header})
|
||||
foreach(_var ${_list_info})
|
||||
message(" * ${_var}")
|
||||
endforeach()
|
||||
message(${msg_footer})
|
||||
endif()
|
||||
unset(_list_info)
|
||||
endfunction()
|
||||
|
||||
macro(openmp_delayload
|
||||
projectname
|
||||
)
|
||||
|
@ -1219,10 +1256,10 @@ macro(openmp_delayload
|
|||
else()
|
||||
set(OPENMP_DLL_NAME "vcomp140")
|
||||
endif()
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " /DELAYLOAD:${OPENMP_DLL_NAME}d.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
set_property(TARGET ${projectname} APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /DELAYLOAD:${OPENMP_DLL_NAME}.dll delayimp.lib")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
@ -1334,13 +1371,13 @@ macro(windows_generate_shared_manifest)
|
|||
NAME "blender.shared"
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
|
||||
DESTINATION "./blender.shared"
|
||||
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
|
||||
FILES ${CMAKE_BINARY_DIR}/Release/blender.shared.manifest
|
||||
DESTINATION "./blender.shared"
|
||||
CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
|
||||
)
|
||||
install(
|
||||
FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
|
||||
DESTINATION "./blender.shared"
|
||||
CONFIGURATIONS Debug
|
||||
FILES ${CMAKE_BINARY_DIR}/Debug/blender.shared.manifest
|
||||
DESTINATION "./blender.shared"
|
||||
CONFIGURATIONS Debug
|
||||
)
|
||||
endmacro()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
function(unset_cache_variables pattern)
|
||||
get_cmake_property(_cache_variables CACHE_VARIABLES)
|
||||
foreach (_cache_variable ${_cache_variables})
|
||||
foreach(_cache_variable ${_cache_variables})
|
||||
if("${_cache_variable}" MATCHES "${pattern}")
|
||||
unset(${_cache_variable} CACHE)
|
||||
endif()
|
||||
|
|
|
@ -10,16 +10,15 @@ if(NOT DEFINED LIBDIR)
|
|||
string(TOLOWER ${LIBDIR_NAME} LIBDIR_NAME)
|
||||
set(LIBDIR_NATIVE_ABI ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME})
|
||||
|
||||
# Path to precompiled libraries with known CentOS 7 ABI.
|
||||
set(LIBDIR_CENTOS7_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_centos7_x86_64)
|
||||
# Path to precompiled libraries with known glibc 2.28 ABI.
|
||||
set(LIBDIR_GLIBC228_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_x86_64_glibc_228)
|
||||
|
||||
# Choose the best suitable libraries.
|
||||
if(EXISTS ${LIBDIR_NATIVE_ABI})
|
||||
set(LIBDIR ${LIBDIR_NATIVE_ABI})
|
||||
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND True)
|
||||
elseif(EXISTS ${LIBDIR_CENTOS7_ABI})
|
||||
set(LIBDIR ${LIBDIR_CENTOS7_ABI})
|
||||
set(WITH_CXX11_ABI OFF)
|
||||
elseif(EXISTS ${LIBDIR_GLIBC228_ABI})
|
||||
set(LIBDIR ${LIBDIR_GLIBC228_ABI})
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
# jemalloc provides malloc hooks.
|
||||
set(WITH_LIBC_MALLOC_HOOK_WORKAROUND False)
|
||||
|
@ -30,7 +29,7 @@ if(NOT DEFINED LIBDIR)
|
|||
|
||||
# Avoid namespace pollustion.
|
||||
unset(LIBDIR_NATIVE_ABI)
|
||||
unset(LIBDIR_CENTOS7_ABI)
|
||||
unset(LIBDIR_GLIBC228_ABI)
|
||||
endif()
|
||||
|
||||
# Support restoring this value once pre-compiled libraries have been handled.
|
||||
|
@ -330,10 +329,8 @@ if(WITH_OPENVDB)
|
|||
find_package(OpenVDB)
|
||||
set_and_warn_library_found("OpenVDB" OPENVDB_FOUND WITH_OPENVDB)
|
||||
|
||||
if(OPENVDB_FOUND)
|
||||
add_bundled_libraries(openvdb/lib)
|
||||
find_package_wrapper(Blosc)
|
||||
set_and_warn_library_found("Blosc" BLOSC_FOUND WITH_OPENVDB_BLOSC)
|
||||
if(WITH_OPENVDB)
|
||||
add_bundled_libraries(openvdb/lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -354,9 +351,9 @@ endif()
|
|||
if(WITH_USD)
|
||||
find_package_wrapper(USD)
|
||||
set_and_warn_library_found("USD" USD_FOUND WITH_USD)
|
||||
if(WITH_USD)
|
||||
if(WITH_USD)
|
||||
add_bundled_libraries(usd/lib)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_MATERIALX)
|
||||
|
@ -667,8 +664,7 @@ if(WITH_GHOST_WAYLAND)
|
|||
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
||||
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||
else()
|
||||
# CentOS 7 packages have too old a version, a newer version exist in the
|
||||
# precompiled libraries.
|
||||
# Rocky8 packages have too old a version, a newer version exist in the pre-compiled libraries.
|
||||
find_path(WAYLAND_PROTOCOLS_DIR
|
||||
NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
|
||||
PATH_SUFFIXES share/wayland-protocols
|
||||
|
@ -793,7 +789,7 @@ if(WITH_GHOST_X11)
|
|||
endif()
|
||||
|
||||
if(WITH_X11_ALPHA)
|
||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||
find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH})
|
||||
mark_as_advanced(X11_Xrender_LIB)
|
||||
if(NOT X11_Xrender_LIB)
|
||||
message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
|
||||
|
@ -1017,6 +1013,18 @@ endfunction()
|
|||
|
||||
configure_atomic_lib_if_needed()
|
||||
|
||||
# Handle library inter-dependencies.
|
||||
# FIXME: find a better place to handle inter-library dependencies.
|
||||
# This is done near the end of the file to ensure bundled libraries are not added multiple times.
|
||||
if(WITH_USD)
|
||||
if(NOT WITH_OPENIMAGEIO)
|
||||
add_bundled_libraries(openimageio/lib)
|
||||
endif()
|
||||
if(NOT WITH_OPENVDB)
|
||||
add_bundled_libraries(openvdb/lib)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PLATFORM_BUNDLED_LIBRARIES)
|
||||
# For the installed Python module and installed Blender executable, we set the
|
||||
# rpath to the relative path where the install step will copy the shared libraries.
|
||||
|
|
|
@ -302,7 +302,7 @@ endif()
|
|||
file(GLOB children RELATIVE ${LIBDIR} ${LIBDIR}/*)
|
||||
foreach(child ${children})
|
||||
if(IS_DIRECTORY ${LIBDIR}/${child})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
|
||||
list(APPEND CMAKE_PREFIX_PATH ${LIBDIR}/${child})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
@ -555,7 +555,7 @@ if(WITH_BOOST)
|
|||
set(BOOST_PREFIX "")
|
||||
# This is file new in 3.4 if it does not exist, assume we are building against 3.3 libs
|
||||
set(BOOST_34_TRIGGER_FILE ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib)
|
||||
if (NOT EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(NOT EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
set(BOOST_DEBUG_POSTFIX "vc142-mt-gd-x64-${BOOST_VERSION}")
|
||||
set(BOOST_PREFIX "lib")
|
||||
endif()
|
||||
|
@ -573,7 +573,7 @@ if(WITH_BOOST)
|
|||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_thread-${BOOST_DEBUG_POSTFIX}.lib
|
||||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_chrono-${BOOST_DEBUG_POSTFIX}.lib
|
||||
)
|
||||
if (EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(WITH_USD)
|
||||
set(BOOST_PYTHON_LIBRARIES
|
||||
debug ${BOOST_LIBPATH}/${BOOST_PREFIX}boost_python310-${BOOST_DEBUG_POSTFIX}.lib
|
||||
|
@ -624,7 +624,7 @@ endif()
|
|||
|
||||
if(WITH_LLVM)
|
||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
|
||||
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/$<$<CONFIG:Debug>:Debug>/include CACHE PATH "Path to the LLVM include directory")
|
||||
set(LLVM_INCLUDE_DIRS ${LLVM_ROOT_DIR}/$<$<CONFIG:Debug>:Debug>/include CACHE PATH "Path to the LLVM include directory")
|
||||
file(GLOB LLVM_LIBRARY_OPTIMIZED ${LLVM_ROOT_DIR}/lib/*.lib)
|
||||
|
||||
if(EXISTS ${LLVM_ROOT_DIR}/debug/lib)
|
||||
|
@ -1030,7 +1030,7 @@ if(WITH_CYCLES AND WITH_CYCLES_DEVICE_ONEAPI)
|
|||
${SYCL_ROOT_DIR}/bin/pi_*.dll
|
||||
)
|
||||
list(REMOVE_ITEM _sycl_pi_runtime_libraries_glob "${SYCL_ROOT_DIR}/bin/pi_opencl.dll")
|
||||
list (APPEND _sycl_runtime_libraries ${_sycl_pi_runtime_libraries_glob})
|
||||
list(APPEND _sycl_runtime_libraries ${_sycl_pi_runtime_libraries_glob})
|
||||
unset(_sycl_pi_runtime_libraries_glob)
|
||||
|
||||
list(APPEND PLATFORM_BUNDLED_LIBRARIES ${_sycl_runtime_libraries})
|
||||
|
|
|
@ -30,7 +30,7 @@ update-code:
|
|||
linux-x86_64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
path: lib/linux_centos7_x86_64
|
||||
path: lib/linux_x86_64_glibc_228
|
||||
windows-amd64:
|
||||
branch: trunk
|
||||
commit_id: HEAD
|
||||
|
|
|
@ -41,7 +41,7 @@ def parse_arguments() -> argparse.Namespace:
|
|||
parser.add_argument("--svn-command", default="svn")
|
||||
parser.add_argument("--svn-branch", default=None)
|
||||
parser.add_argument("--git-command", default="git")
|
||||
parser.add_argument("--use-centos-libraries", action="store_true")
|
||||
parser.add_argument("--use-linux-libraries", action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
@ -71,8 +71,8 @@ def svn_update(args: argparse.Namespace, release_version: Optional[str]) -> None
|
|||
# this script is bundled as part of the precompiled libraries. However it
|
||||
# is used by the buildbot.
|
||||
lib_platform = "win64_vc15"
|
||||
elif args.use_centos_libraries:
|
||||
lib_platform = "linux_centos7_x86_64"
|
||||
elif args.use_linux_libraries:
|
||||
lib_platform = "linux_x86_64_glibc_228"
|
||||
else:
|
||||
# No precompiled libraries for Linux.
|
||||
lib_platform = None
|
||||
|
|
|
@ -298,7 +298,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
|||
add_definitions(-DWITH_METAL)
|
||||
endif()
|
||||
|
||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
add_definitions(-DWITH_ONEAPI)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ macro(cycles_add_library target library_deps)
|
|||
# NOTE: If separated libraries for debug and release ar eneeded every library is the list are
|
||||
# to be prefixed explicitly.
|
||||
#
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
# Use: "optimized libfoo optimized libbar debug libfoo_d debug libbar_d"
|
||||
# NOT: "optimized libfoo libbar debug libfoo_d libbar_d"
|
||||
#
|
||||
# TODO(sergey): This is the same as Blender's side CMake. Find a way to avoid duplication
|
||||
# somehow in a way which allows to have Cycles standalone.
|
||||
|
|
|
@ -162,7 +162,7 @@ if(WITH_CYCLES_DEVICE_METAL)
|
|||
)
|
||||
endif()
|
||||
|
||||
if (WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_DEVICE_ONEAPI)
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
set(cycles_kernel_oneapi_lib_suffix "_aot")
|
||||
else()
|
||||
|
|
|
@ -579,7 +579,11 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
|||
link_options.maxTraceDepth = 1;
|
||||
link_options.debugLevel = module_options.debugLevel;
|
||||
|
||||
if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE) && !use_osl) {
|
||||
if (use_osl) {
|
||||
/* Re-create OSL pipeline in case kernels are reloaded after it has been created before. */
|
||||
load_osl_kernels();
|
||||
}
|
||||
else if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE)) {
|
||||
/* Create shader raytracing and MNEE pipeline. */
|
||||
vector<OptixProgramGroup> pipeline_groups;
|
||||
pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
|
||||
|
@ -743,6 +747,11 @@ bool OptiXDevice::load_osl_kernels()
|
|||
}
|
||||
}
|
||||
|
||||
if (osl_kernels.empty()) {
|
||||
/* No OSL shader groups, so no need to create a pipeline. */
|
||||
return true;
|
||||
}
|
||||
|
||||
OptixProgramGroupOptions group_options = {}; /* There are no options currently. */
|
||||
OptixModuleCompileOptions module_options = {};
|
||||
module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
|
||||
|
@ -857,6 +866,11 @@ bool OptiXDevice::load_osl_kernels()
|
|||
optix_assert(optixSbtRecordPackHeader(osl_groups[i], &sbt_data[NUM_PROGRAM_GROUPS + i]));
|
||||
optix_assert(optixProgramGroupGetStackSize(osl_groups[i], &osl_stack_size[i]));
|
||||
}
|
||||
else {
|
||||
/* Default to "__direct_callable__dummy_services", so that OSL evaluation for empty
|
||||
* materials has direct callables to call and does not crash. */
|
||||
optix_assert(optixSbtRecordPackHeader(osl_groups.back(), &sbt_data[NUM_PROGRAM_GROUPS + i]));
|
||||
}
|
||||
}
|
||||
sbt_data.copy_to_device(); /* Upload updated SBT to device. */
|
||||
|
||||
|
|
|
@ -10,4 +10,4 @@ set(LICENSES
|
|||
Zlib-license.txt
|
||||
)
|
||||
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${LICENSES}" ${CYCLES_INSTALL_PATH}/license)
|
||||
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${LICENSES}" ${CYCLES_INSTALL_PATH}/license)
|
||||
|
|
|
@ -26,8 +26,7 @@ class HdCyclesVolumeLoader : public VDBImageLoader {
|
|||
HdCyclesVolumeLoader(const std::string &filePath, const std::string &gridName)
|
||||
: VDBImageLoader(gridName)
|
||||
{
|
||||
/* Disably delay loading and file copying, this has poor performance
|
||||
* on network drivers. */
|
||||
/* Disable delay loading and file copying, this has poor performance on network drivers. */
|
||||
const bool delay_load = false;
|
||||
openvdb::io::File file(filePath);
|
||||
file.setCopyMaxBytes(0);
|
||||
|
|
|
@ -728,8 +728,8 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
${SRC_UTIL_HEADERS}
|
||||
)
|
||||
|
||||
set (SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
||||
set(SYCL_OFFLINE_COMPILER_PARALLEL_JOBS 1 CACHE STRING "Number of parallel compiler instances to use for device binaries compilation (expect ~8GB peak memory usage per instance).")
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
message(STATUS "${SYCL_OFFLINE_COMPILER_PARALLEL_JOBS} instance(s) of oneAPI offline compiler will be used.")
|
||||
endif()
|
||||
# SYCL_CPP_FLAGS is a variable that the user can set to pass extra compiler options
|
||||
|
@ -753,25 +753,25 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
)
|
||||
|
||||
# Set defaults for spir64 and spir64_gen options
|
||||
if (NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64)
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64 "-options '-ze-opt-large-register-file -ze-opt-regular-grf-kernel integrator_intersect'")
|
||||
endif()
|
||||
if (NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
|
||||
SET (CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for spir64_gen target")
|
||||
if(NOT DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen)
|
||||
set(CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "${CYCLES_ONEAPI_SYCL_OPTIONS_spir64}" CACHE STRING "Extra build options for spir64_gen target")
|
||||
endif()
|
||||
# Enable zebin, a graphics binary format with improved compatibility.
|
||||
string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "--format zebin ")
|
||||
string(PREPEND CYCLES_ONEAPI_SYCL_OPTIONS_spir64_gen "-device ${CYCLES_ONEAPI_SPIR64_GEN_DEVICES} ")
|
||||
|
||||
if (WITH_CYCLES_ONEAPI_BINARIES)
|
||||
if(WITH_CYCLES_ONEAPI_BINARIES)
|
||||
# AoT binaries aren't currently reused when calling sycl::build.
|
||||
list (APPEND sycl_compiler_flags -DSYCL_SKIP_KERNELS_PRELOAD)
|
||||
list(APPEND sycl_compiler_flags -DSYCL_SKIP_KERNELS_PRELOAD)
|
||||
# Iterate over all targest and their options
|
||||
list (JOIN CYCLES_ONEAPI_SYCL_TARGETS "," targets_string)
|
||||
list (APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
||||
list(JOIN CYCLES_ONEAPI_SYCL_TARGETS "," targets_string)
|
||||
list(APPEND sycl_compiler_flags -fsycl-targets=${targets_string})
|
||||
foreach(target ${CYCLES_ONEAPI_SYCL_TARGETS})
|
||||
if(DEFINED CYCLES_ONEAPI_SYCL_OPTIONS_${target})
|
||||
list (APPEND sycl_compiler_flags -Xsycl-target-backend=${target} "${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}")
|
||||
list(APPEND sycl_compiler_flags -Xsycl-target-backend=${target} "${CYCLES_ONEAPI_SYCL_OPTIONS_${target}}")
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
|
@ -860,8 +860,9 @@ if(WITH_CYCLES_DEVICE_ONEAPI)
|
|||
else()
|
||||
list(APPEND sycl_compiler_flags -fPIC)
|
||||
|
||||
# We avoid getting __FAST_MATH__ to be defined when building on CentOS 7 until the compilation
|
||||
# We avoid getting __FAST_MATH__ to be defined when building on CentOS-7 until the compilation
|
||||
# crash it triggers at either AoT or JIT stages gets fixed.
|
||||
# TODO: check if this is still needed on Rocky-8.
|
||||
list(APPEND sycl_compiler_flags -fhonor-nans)
|
||||
|
||||
# add $ORIGIN to cycles_kernel_oneapi.so rpath so libsycl.so and
|
||||
|
|
|
@ -33,6 +33,12 @@ ccl_device_inline void film_write_data_passes(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Don't write data passes for paths that were split off for shadow catchers
|
||||
* to avoid double-counting. */
|
||||
if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
|
||||
return;
|
||||
}
|
||||
|
||||
const int flag = kernel_data.film.pass_flag;
|
||||
|
||||
if (!(flag & PASS_ANY)) {
|
||||
|
|
|
@ -16,7 +16,8 @@ ccl_device_forceinline void film_write_denoising_features_surface(KernelGlobals
|
|||
ccl_global float *ccl_restrict
|
||||
render_buffer)
|
||||
{
|
||||
if (!(INTEGRATOR_STATE(state, path, flag) & PATH_RAY_DENOISING_FEATURES)) {
|
||||
const uint32_t path_flag = INTEGRATOR_STATE(state, path, flag);
|
||||
if (!(path_flag & PATH_RAY_DENOISING_FEATURES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -25,6 +26,12 @@ ccl_device_forceinline void film_write_denoising_features_surface(KernelGlobals
|
|||
return;
|
||||
}
|
||||
|
||||
/* Don't write denoising passes for paths that were split off for shadow catchers
|
||||
* to avoid double-counting. */
|
||||
if (path_flag & PATH_RAY_SHADOW_CATCHER_PASS) {
|
||||
return;
|
||||
}
|
||||
|
||||
ccl_global float *buffer = film_pass_pixel_render_buffer(kg, state, render_buffer);
|
||||
|
||||
if (kernel_data.film.pass_denoising_depth != PASS_UNUSED) {
|
||||
|
|
|
@ -16,18 +16,40 @@
|
|||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* This helps with AA but it's not the real solution as it does not AA the geometry
|
||||
* but it's better than nothing, thus committed. */
|
||||
ccl_device_inline float bake_clamp_mirror_repeat(float u, float max)
|
||||
/* In order to perform anti-aliasing during baking, we jitter the input barycentric coordinates
|
||||
* (which are for the center of the texel) within the texel.
|
||||
* However, the baking code currently doesn't support going to neighboring triangle, so if the
|
||||
* jittered location falls outside of the input triangle, we need to bring it back in somehow.
|
||||
* Clamping is a bad choice here since it can produce noticeable artifacts at triangle edges,
|
||||
* but properly uniformly sampling the intersection of triangle and texel would be very
|
||||
* performance-heavy, so cheat by just trying different jittering until we end up inside the
|
||||
* triangle.
|
||||
* For triangles that are smaller than a texel, this might take too many attempts, so eventually
|
||||
* we just give up and don't jitter in that case.
|
||||
* This is not a particularly elegant solution, but it's probably the best we can do. */
|
||||
ccl_device_inline void bake_jitter_barycentric(float &u,
|
||||
float &v,
|
||||
float2 rand_filter,
|
||||
const float dudx,
|
||||
const float dudy,
|
||||
const float dvdx,
|
||||
const float dvdy)
|
||||
{
|
||||
/* use mirror repeat (like opengl texture) so that if the barycentric
|
||||
* coordinate goes past the end of the triangle it is not always clamped
|
||||
* to the same value, gives ugly patterns */
|
||||
u /= max;
|
||||
float fu = floorf(u);
|
||||
u = u - fu;
|
||||
|
||||
return ((((int)fu) & 1) ? 1.0f - u : u) * max;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
/* Offset UV according to differentials. */
|
||||
float jitterU = u + (rand_filter.x - 0.5f) * dudx + (rand_filter.y - 0.5f) * dudy;
|
||||
float jitterV = v + (rand_filter.x - 0.5f) * dvdx + (rand_filter.y - 0.5f) * dvdy;
|
||||
/* If this location is inside the triangle, return. */
|
||||
if (jitterU > 0.0f && jitterV > 0.0f && jitterU + jitterV < 1.0f) {
|
||||
u = jitterU;
|
||||
v = jitterV;
|
||||
return;
|
||||
}
|
||||
/* Retry with new jitter value. */
|
||||
rand_filter = hash_float2_to_float2(rand_filter);
|
||||
}
|
||||
/* Retries exceeded, give up and just use center value. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Offset towards center of triangle to avoid ray-tracing precision issues. */
|
||||
|
@ -144,12 +166,7 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg,
|
|||
}
|
||||
|
||||
/* Sub-pixel offset. */
|
||||
if (sample > 0) {
|
||||
u = bake_clamp_mirror_repeat(u + dudx * (rand_filter.x - 0.5f) + dudy * (rand_filter.y - 0.5f),
|
||||
1.0f);
|
||||
v = bake_clamp_mirror_repeat(v + dvdx * (rand_filter.x - 0.5f) + dvdy * (rand_filter.y - 0.5f),
|
||||
1.0f - u);
|
||||
}
|
||||
bake_jitter_barycentric(u, v, rand_filter, dudx, dudy, dvdx, dvdy);
|
||||
|
||||
/* Convert from Blender to Cycles/Embree/OptiX barycentric convention. */
|
||||
const float tmp = u;
|
||||
|
|
|
@ -1030,7 +1030,7 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
|
|||
const float3 initial_throughput = INTEGRATOR_STATE(state, path, throughput);
|
||||
/* The path throughput used to calculate the throughput for direct light. */
|
||||
float3 unlit_throughput = initial_throughput;
|
||||
/* If a new path segment is generated at the direct scatter position.*/
|
||||
/* If a new path segment is generated at the direct scatter position. */
|
||||
bool guiding_generated_new_segment = false;
|
||||
float rand_phase_guiding = 0.5f;
|
||||
# endif
|
||||
|
|
|
@ -135,7 +135,7 @@ foreach(_file ${SRC_OSL})
|
|||
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
|
||||
add_custom_command(
|
||||
OUTPUT ${_OSO_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E env ${PLATFORM_ENV_BUILD} ${OSL_COMPILER} -q -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" -I"${OSL_SHADER_DIR}" -o ${_OSO_FILE} ${_OSL_FILE}
|
||||
DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS} ${OSL_COMPILER}
|
||||
)
|
||||
list(APPEND SRC_OSO
|
||||
|
|
|
@ -73,6 +73,11 @@ color node_mix_diff(float t, color col1, color col2)
|
|||
return mix(col1, abs(col1 - col2), t);
|
||||
}
|
||||
|
||||
color node_mix_exclusion(float t, color col1, color col2)
|
||||
{
|
||||
return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
|
||||
}
|
||||
|
||||
color node_mix_dark(float t, color col1, color col2)
|
||||
{
|
||||
return mix(col1, min(col1, col2), t);
|
||||
|
|
|
@ -76,6 +76,11 @@ color node_mix_diff(float t, color col1, color col2)
|
|||
return mix(col1, abs(col1 - col2), t);
|
||||
}
|
||||
|
||||
color node_mix_exclusion(float t, color col1, color col2)
|
||||
{
|
||||
return max(mix(col1, col1 + col2 - 2.0 * col1 * col2, t), 0.0);
|
||||
}
|
||||
|
||||
color node_mix_dark(float t, color col1, color col2)
|
||||
{
|
||||
return mix(col1, min(col1, col2), t);
|
||||
|
@ -291,6 +296,8 @@ shader node_mix(string mix_type = "mix",
|
|||
Color = node_mix_div(t, Color1, Color2);
|
||||
if (mix_type == "difference")
|
||||
Color = node_mix_diff(t, Color1, Color2);
|
||||
if (mix_type == "exclusion")
|
||||
Color = node_mix_exclusion(t, Color1, Color2);
|
||||
if (mix_type == "darken")
|
||||
Color = node_mix_dark(t, Color1, Color2);
|
||||
if (mix_type == "lighten")
|
||||
|
|
|
@ -31,6 +31,8 @@ shader node_mix_color(string blend_type = "mix",
|
|||
Result = node_mix_div(t, A, B);
|
||||
if (blend_type == "difference")
|
||||
Result = node_mix_diff(t, A, B);
|
||||
if (blend_type == "exclusion")
|
||||
Result = node_mix_exclusion(t, A, B);
|
||||
if (blend_type == "darken")
|
||||
Result = node_mix_dark(t, A, B);
|
||||
if (blend_type == "lighten")
|
||||
|
|
|
@ -79,6 +79,11 @@ ccl_device float3 svm_mix_diff(float t, float3 col1, float3 col2)
|
|||
return interp(col1, fabs(col1 - col2), t);
|
||||
}
|
||||
|
||||
ccl_device float3 svm_mix_exclusion(float t, float3 col1, float3 col2)
|
||||
{
|
||||
return max(interp(col1, col1 + col2 - 2.0f * col1 * col2, t), zero_float3());
|
||||
}
|
||||
|
||||
ccl_device float3 svm_mix_dark(float t, float3 col1, float3 col2)
|
||||
{
|
||||
return interp(col1, min(col1, col2), t);
|
||||
|
@ -266,6 +271,8 @@ ccl_device_noinline_cpu float3 svm_mix(NodeMix type, float t, float3 c1, float3
|
|||
return svm_mix_div(t, c1, c2);
|
||||
case NODE_MIX_DIFF:
|
||||
return svm_mix_diff(t, c1, c2);
|
||||
case NODE_MIX_EXCLUSION:
|
||||
return svm_mix_exclusion(t, c1, c2);
|
||||
case NODE_MIX_DARK:
|
||||
return svm_mix_dark(t, c1, c2);
|
||||
case NODE_MIX_LIGHT:
|
||||
|
|
|
@ -136,6 +136,7 @@ typedef enum NodeMix {
|
|||
NODE_MIX_COL,
|
||||
NODE_MIX_SOFT,
|
||||
NODE_MIX_LINEAR,
|
||||
NODE_MIX_EXCLUSION,
|
||||
NODE_MIX_CLAMP /* used for the clamp UI option */
|
||||
} NodeMix;
|
||||
|
||||
|
|
|
@ -4948,6 +4948,7 @@ NODE_DEFINE(MixNode)
|
|||
type_enum.insert("color", NODE_MIX_COL);
|
||||
type_enum.insert("soft_light", NODE_MIX_SOFT);
|
||||
type_enum.insert("linear_light", NODE_MIX_LINEAR);
|
||||
type_enum.insert("exclusion", NODE_MIX_EXCLUSION);
|
||||
SOCKET_ENUM(mix_type, "Type", type_enum, NODE_MIX_BLEND);
|
||||
|
||||
SOCKET_BOOLEAN(use_clamp, "Use Clamp", false);
|
||||
|
@ -5026,6 +5027,7 @@ NODE_DEFINE(MixColorNode)
|
|||
type_enum.insert("color", NODE_MIX_COL);
|
||||
type_enum.insert("soft_light", NODE_MIX_SOFT);
|
||||
type_enum.insert("linear_light", NODE_MIX_LINEAR);
|
||||
type_enum.insert("exclusion", NODE_MIX_EXCLUSION);
|
||||
SOCKET_ENUM(blend_type, "Type", type_enum, NODE_MIX_BLEND);
|
||||
|
||||
SOCKET_IN_FLOAT(fac, "Factor", 0.5f);
|
||||
|
|
|
@ -129,7 +129,7 @@ list(APPEND SRC
|
|||
|
||||
if(WITH_HEADLESS)
|
||||
add_definitions(-DWITH_HEADLESS)
|
||||
elseif (WITH_GHOST_SDL)
|
||||
elseif(WITH_GHOST_SDL)
|
||||
list(APPEND SRC
|
||||
intern/GHOST_ContextSDL.cpp
|
||||
intern/GHOST_DisplayManagerSDL.cpp
|
||||
|
|
|
@ -1063,7 +1063,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
|||
if (window->getCursorGrabModeIsWarp()) {
|
||||
static uint64_t last_warp_time = 0;
|
||||
{
|
||||
/* WORKAROUND: Check the mouse event timestamp so we can ignore mousemove events that were
|
||||
/* WORKAROUND: Check the mouse event timestamp so we can ignore mouse-move events that were
|
||||
* already in the queue before we changed the cursor position. */
|
||||
MOUSEMOVEPOINT mp = {x_screen, y_screen};
|
||||
::GetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &mp, &mp, 1, GMMP_USE_DISPLAY_POINTS);
|
||||
|
@ -1075,20 +1075,49 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
|||
int32_t x_new = x_screen;
|
||||
int32_t y_new = y_screen;
|
||||
int32_t x_accum, y_accum;
|
||||
GHOST_Rect bounds;
|
||||
|
||||
/* Fallback to window bounds. */
|
||||
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
|
||||
window->getClientBounds(bounds);
|
||||
/* Warp within bounds. */
|
||||
{
|
||||
GHOST_Rect bounds;
|
||||
int32_t bounds_margin = 0;
|
||||
GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
|
||||
|
||||
if (window->getCursorGrabMode() == GHOST_kGrabHide) {
|
||||
window->getClientBounds(bounds);
|
||||
|
||||
/* WARNING(@campbellbarton): The current warping logic fails to warp on every event,
|
||||
* so the box needs to small enough not to let the cursor escape the window but large
|
||||
* enough that the cursor isn't being warped every time.
|
||||
* If this was not the case it would be less trouble to simply warp the cursor to the
|
||||
* center of the screen on every motion, see: D16558 (alternative fix for T102346). */
|
||||
const int32_t subregion_div = 4; /* One quarter of the region. */
|
||||
const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
|
||||
const int32_t center[2] = {(bounds.m_l + bounds.m_r) / 2, (bounds.m_t + bounds.m_b) / 2};
|
||||
/* Shrink the box to prevent the cursor escaping. */
|
||||
bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
|
||||
bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
|
||||
bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
|
||||
bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
|
||||
bounds_margin = 0;
|
||||
bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
|
||||
}
|
||||
else {
|
||||
/* Fallback to window bounds. */
|
||||
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
|
||||
window->getClientBounds(bounds);
|
||||
}
|
||||
bounds_margin = 2;
|
||||
bounds_axis = window->getCursorGrabAxis();
|
||||
}
|
||||
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will
|
||||
* fail at the moment. Use inset in case the window is at screen bounds. */
|
||||
bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
|
||||
}
|
||||
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will
|
||||
* fail at the moment. Use inset in case the window is at screen bounds. */
|
||||
bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
|
||||
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
if (x_new != x_screen || y_new != y_screen) {
|
||||
/* WORKAROUND: Store the current time so that we ignore outdated mousemove events. */
|
||||
/* WORKAROUND: Store the current time so that we ignore outdated mouse-move events. */
|
||||
last_warp_time = ::GetTickCount64();
|
||||
|
||||
/* For more control over which timestamp to store in the event, we use `SendInput` instead of
|
||||
|
|
|
@ -917,17 +917,48 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
|
|||
int32_t x_new = xme.x_root;
|
||||
int32_t y_new = xme.y_root;
|
||||
int32_t x_accum, y_accum;
|
||||
GHOST_Rect bounds;
|
||||
|
||||
/* fallback to window bounds */
|
||||
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
|
||||
window->getClientBounds(bounds);
|
||||
/* Warp within bounds. */
|
||||
{
|
||||
GHOST_Rect bounds;
|
||||
int32_t bounds_margin = 0;
|
||||
GHOST_TAxisFlag bounds_axis = GHOST_kAxisNone;
|
||||
|
||||
if (window->getCursorGrabMode() == GHOST_kGrabHide) {
|
||||
window->getClientBounds(bounds);
|
||||
|
||||
/* TODO(@campbellbarton): warp the cursor to `window->getCursorGrabInitPos`,
|
||||
* on every motion event, see: D16557 (alternative fix for T102346). */
|
||||
const int32_t subregion_div = 4; /* One quarter of the region. */
|
||||
const int32_t size[2] = {bounds.getWidth(), bounds.getHeight()};
|
||||
const int32_t center[2] = {
|
||||
(bounds.m_l + bounds.m_r) / 2,
|
||||
(bounds.m_t + bounds.m_b) / 2,
|
||||
};
|
||||
/* Shrink the box to prevent the cursor escaping. */
|
||||
bounds.m_l = center[0] - (size[0] / (subregion_div * 2));
|
||||
bounds.m_r = center[0] + (size[0] / (subregion_div * 2));
|
||||
bounds.m_t = center[1] - (size[1] / (subregion_div * 2));
|
||||
bounds.m_b = center[1] + (size[1] / (subregion_div * 2));
|
||||
bounds_margin = 0;
|
||||
bounds_axis = GHOST_TAxisFlag(GHOST_kAxisX | GHOST_kAxisY);
|
||||
}
|
||||
else {
|
||||
/* Fallback to window bounds. */
|
||||
if (window->getCursorGrabBounds(bounds) == GHOST_kFailure) {
|
||||
window->getClientBounds(bounds);
|
||||
}
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will
|
||||
* fail at the moment. Use offset of 8 in case the window is at screen bounds. */
|
||||
bounds_margin = 8;
|
||||
bounds_axis = window->getCursorGrabAxis();
|
||||
}
|
||||
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will
|
||||
* fail at the moment. Use inset in case the window is at screen bounds. */
|
||||
bounds.wrapPoint(x_new, y_new, bounds_margin, bounds_axis);
|
||||
}
|
||||
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will
|
||||
* fail at the moment. Use offset of 8 in case the window is at screen bounds. */
|
||||
bounds.wrapPoint(x_new, y_new, 8, window->getCursorGrabAxis());
|
||||
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
if (x_new != xme.x_root || y_new != xme.y_root) {
|
||||
|
|
|
@ -20,7 +20,7 @@ set(LIB
|
|||
if(WIN32)
|
||||
# This is set in platform_win32.cmake, will exist for 3.4+ library
|
||||
# folders which are dynamic, but not for 3.3 which will be static.
|
||||
if (EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
if(EXISTS ${BOOST_34_TRIGGER_FILE})
|
||||
add_definitions (-DBOOST_ALL_DYN_LINK=1)
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
@ -59,10 +59,8 @@ def url_prefill_from_blender(*, addon_info=None):
|
|||
"\n"
|
||||
)
|
||||
|
||||
fh.seek(0)
|
||||
|
||||
form_number = 2 if addon_info else 1
|
||||
return (
|
||||
"https://developer.blender.org/maniphest/task/edit/form/%i?description=" % form_number +
|
||||
urllib.parse.quote(fh.read())
|
||||
urllib.parse.quote(fh.getvalue())
|
||||
)
|
||||
|
|
|
@ -156,11 +156,8 @@ def execute(context, is_interactive):
|
|||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
stdout.seek(0)
|
||||
stderr.seek(0)
|
||||
|
||||
output = stdout.read()
|
||||
output_err = stderr.read()
|
||||
output = stdout.getvalue()
|
||||
output_err = stderr.getvalue()
|
||||
|
||||
# cleanup
|
||||
sys.last_traceback = None
|
||||
|
|
|
@ -138,15 +138,15 @@ void BKE_keyblock_convert_to_mesh(const struct KeyBlock *kb, float (*positions)[
|
|||
*
|
||||
* \param kb: the KeyBlock to use to compute normals.
|
||||
* \param mesh: the Mesh to apply key-block to.
|
||||
* \param r_vertnors: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_polynors: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loopnors: if non-NULL, an array of vectors, same length as number of loops.
|
||||
* \param r_vert_normals: if non-NULL, an array of vectors, same length as number of vertices.
|
||||
* \param r_poly_normals: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loop_normals: if non-NULL, an array of vectors, same length as number of loops.
|
||||
*/
|
||||
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
|
||||
const struct Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3]);
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3]);
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
|
@ -156,6 +156,7 @@ void BKE_keyblock_convert_from_vertcos(const struct Object *ob,
|
|||
const float (*vertCos)[3]);
|
||||
float (*BKE_keyblock_convert_to_vertcos(const struct Object *ob, const struct KeyBlock *kb))[3];
|
||||
|
||||
/** RAW coordinates offsets. */
|
||||
void BKE_keyblock_update_from_offset(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
const float (*ofs)[3]);
|
||||
|
|
|
@ -478,7 +478,7 @@ void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
|
|||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
float split_angle);
|
||||
|
||||
|
@ -600,10 +600,10 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
const struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
bool use_split_normals,
|
||||
float split_angle,
|
||||
|
@ -617,22 +617,22 @@ void BKE_mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const float (*positions)[3],
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
int numVerts,
|
||||
struct MEdge *medges,
|
||||
int numEdges,
|
||||
const struct MLoop *mloops,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
int numPolys,
|
||||
short (*r_clnors_data)[2]);
|
||||
|
||||
|
@ -669,18 +669,18 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
|
|||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_set().
|
||||
*
|
||||
* \param r_custom_loopnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_loop_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
|
||||
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loop_normals)[3]);
|
||||
/**
|
||||
* Higher level functions hiding most of the code needed around call to
|
||||
* #BKE_mesh_normals_loop_custom_from_verts_set().
|
||||
*
|
||||
* \param r_custom_vertnors: is not const, since code will replace zero_v3 normals there
|
||||
* \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there
|
||||
* with automatically computed vectors.
|
||||
*/
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
|
||||
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]);
|
||||
|
||||
/* *** mesh_evaluate.cc *** */
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ struct Scene;
|
|||
int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh);
|
||||
|
||||
/**
|
||||
* Return mesh triangulation data, calculated lazily when necessary necessary.
|
||||
* Return mesh triangulation data, calculated lazily when necessary.
|
||||
* See #MLoopTri for further description of mesh triangulation.
|
||||
*
|
||||
* \note Prefer #Mesh::looptris() in C++ code.
|
||||
|
|
|
@ -21,7 +21,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
|
|||
int numVerts,
|
||||
const struct MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const struct MLoopUV *loopuv,
|
||||
int numLoops,
|
||||
const struct MPoly *mpolys,
|
||||
|
|
|
@ -141,6 +141,8 @@ class bNodeTreeRuntime : NonCopyable, NonMovable {
|
|||
bool has_undefined_nodes_or_sockets = false;
|
||||
bNode *group_output_node = nullptr;
|
||||
Vector<bNode *> root_frames;
|
||||
Vector<bNodeSocket *> interface_inputs;
|
||||
Vector<bNodeSocket *> interface_outputs;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -426,6 +428,18 @@ inline blender::Span<const bNode *> bNodeTree::group_input_nodes() const
|
|||
return this->nodes_by_type("NodeGroupInput");
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::interface_inputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
return this->runtime->interface_inputs;
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::interface_outputs() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
return this->runtime->interface_outputs;
|
||||
}
|
||||
|
||||
inline blender::Span<const bNodeSocket *> bNodeTree::all_input_sockets() const
|
||||
{
|
||||
BLI_assert(blender::bke::node_tree_runtime::topology_cache_is_available(*this));
|
||||
|
|
|
@ -664,7 +664,7 @@ float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_
|
|||
/* psys_reset */
|
||||
#define PSYS_RESET_ALL 1
|
||||
#define PSYS_RESET_DEPSGRAPH 2
|
||||
/* #define PSYS_RESET_CHILDREN 3 */ /*UNUSED*/
|
||||
// #define PSYS_RESET_CHILDREN 3 /*UNUSED*/
|
||||
#define PSYS_RESET_CACHE_MISS 4
|
||||
|
||||
/* index_dmcache */
|
||||
|
|
|
@ -70,7 +70,7 @@ struct PBVHPublic {
|
|||
|
||||
/* A generic PBVH vertex.
|
||||
*
|
||||
* Note: in PBVH_GRIDS we consider the final grid points
|
||||
* NOTE: in PBVH_GRIDS we consider the final grid points
|
||||
* to be vertices. This is not true of edges or faces which are pulled from
|
||||
* the base mesh.
|
||||
*/
|
||||
|
@ -78,12 +78,12 @@ typedef struct PBVHVertRef {
|
|||
intptr_t i;
|
||||
} PBVHVertRef;
|
||||
|
||||
/* Note: edges in PBVH_GRIDS are always pulled from the base mesh.*/
|
||||
/* NOTE: edges in PBVH_GRIDS are always pulled from the base mesh. */
|
||||
typedef struct PBVHEdgeRef {
|
||||
intptr_t i;
|
||||
} PBVHEdgeRef;
|
||||
|
||||
/* Note: faces in PBVH_GRIDS are always puled from the base mesh.*/
|
||||
/* NOTE: faces in PBVH_GRIDS are always puled from the base mesh. */
|
||||
typedef struct PBVHFaceRef {
|
||||
intptr_t i;
|
||||
} PBVHFaceRef;
|
||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
|||
#define PTCACHE_RESET_DEPSGRAPH 0
|
||||
#define PTCACHE_RESET_BAKED 1
|
||||
#define PTCACHE_RESET_OUTDATED 2
|
||||
/* #define PTCACHE_RESET_FREE 3 */ /*UNUSED*/
|
||||
// #define PTCACHE_RESET_FREE 3 /*UNUSED*/
|
||||
|
||||
/* Add the blend-file name after `blendcache_`. */
|
||||
#define PTCACHE_EXT ".bphys"
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct ShrinkwrapTreeData {
|
|||
|
||||
const struct MPoly *polys;
|
||||
const float (*vert_normals)[3];
|
||||
const float (*pnors)[3];
|
||||
const float (*poly_normals)[3];
|
||||
const float (*clnors)[3];
|
||||
ShrinkwrapBoundaryData *boundary;
|
||||
} ShrinkwrapTreeData;
|
||||
|
|
|
@ -1,746 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_edgehash.h"
|
||||
#include "BLI_float3x3.hh"
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_math_vec_types.hh"
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_vector.hh"
|
||||
#include "BLI_vector_list.hh"
|
||||
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
namespace blender::bke::uv_islands {
|
||||
|
||||
struct MeshEdge;
|
||||
struct MeshPrimitive;
|
||||
struct UVBorder;
|
||||
struct UVEdge;
|
||||
struct UVIslands;
|
||||
struct UVIslandsMask;
|
||||
struct UVPrimitive;
|
||||
struct UVPrimitiveEdge;
|
||||
struct UVVertex;
|
||||
|
||||
struct MeshVertex {
|
||||
int64_t v;
|
||||
Vector<MeshEdge *> edges;
|
||||
};
|
||||
|
||||
struct MeshUVVert {
|
||||
MeshVertex *vertex;
|
||||
float2 uv;
|
||||
int64_t loop;
|
||||
};
|
||||
|
||||
struct MeshEdge {
|
||||
MeshVertex *vert1;
|
||||
MeshVertex *vert2;
|
||||
Vector<MeshPrimitive *> primitives;
|
||||
};
|
||||
|
||||
/** Represents a triangle in 3d space (MLoopTri) */
|
||||
struct MeshPrimitive {
|
||||
int64_t index;
|
||||
int64_t poly;
|
||||
Vector<MeshEdge *, 3> edges;
|
||||
Vector<MeshUVVert, 3> vertices;
|
||||
|
||||
/**
|
||||
* UV island this primitive belongs to. This is used to speed up the initial uv island
|
||||
* extraction, but should not be used when extending uv islands.
|
||||
*/
|
||||
int64_t uv_island_id;
|
||||
|
||||
MeshUVVert *get_other_uv_vertex(const MeshVertex *v1, const MeshVertex *v2)
|
||||
{
|
||||
BLI_assert(vertices[0].vertex == v1 || vertices[1].vertex == v1 || vertices[2].vertex == v1);
|
||||
BLI_assert(vertices[0].vertex == v2 || vertices[1].vertex == v2 || vertices[2].vertex == v2);
|
||||
for (MeshUVVert &uv_vertex : vertices) {
|
||||
if (uv_vertex.vertex != v1 && uv_vertex.vertex != v2) {
|
||||
return &uv_vertex;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rctf uv_bounds() const;
|
||||
|
||||
bool has_shared_uv_edge(const MeshPrimitive *other) const
|
||||
{
|
||||
int shared_uv_verts = 0;
|
||||
for (const MeshUVVert &vert : vertices) {
|
||||
for (const MeshUVVert &other_vert : other->vertices) {
|
||||
if (vert.uv == other_vert.uv) {
|
||||
shared_uv_verts += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return shared_uv_verts >= 2;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* MeshData contains input geometry data converted in a list of primitives, edges and vertices for
|
||||
* quick access for both local space and uv space.
|
||||
*/
|
||||
struct MeshData {
|
||||
public:
|
||||
const MLoopTri *looptri;
|
||||
const int64_t looptri_len;
|
||||
const int64_t vert_len;
|
||||
const MLoop *mloop;
|
||||
const MLoopUV *mloopuv;
|
||||
|
||||
public:
|
||||
Vector<MeshPrimitive> primitives;
|
||||
Vector<MeshEdge> edges;
|
||||
Vector<MeshVertex> vertices;
|
||||
/** Total number of uv islands detected. */
|
||||
int64_t uv_island_len;
|
||||
|
||||
explicit MeshData(const MLoopTri *looptri,
|
||||
const int64_t looptri_len,
|
||||
const int64_t vert_len,
|
||||
const MLoop *mloop,
|
||||
const MLoopUV *mloopuv)
|
||||
: looptri(looptri),
|
||||
looptri_len(looptri_len),
|
||||
vert_len(vert_len),
|
||||
mloop(mloop),
|
||||
mloopuv(mloopuv)
|
||||
{
|
||||
init_vertices();
|
||||
init_primitives();
|
||||
init_edges();
|
||||
init_primitive_uv_island_ids();
|
||||
}
|
||||
|
||||
void init_vertices()
|
||||
{
|
||||
vertices.reserve(vert_len);
|
||||
for (int64_t i = 0; i < vert_len; i++) {
|
||||
MeshVertex vert;
|
||||
vert.v = i;
|
||||
vertices.append(vert);
|
||||
}
|
||||
}
|
||||
|
||||
void init_primitives()
|
||||
{
|
||||
primitives.reserve(looptri_len);
|
||||
for (int64_t i = 0; i < looptri_len; i++) {
|
||||
const MLoopTri &tri = looptri[i];
|
||||
MeshPrimitive primitive;
|
||||
primitive.index = i;
|
||||
primitive.poly = tri.poly;
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
MeshUVVert uv_vert;
|
||||
uv_vert.loop = tri.tri[j];
|
||||
uv_vert.vertex = &vertices[mloop[uv_vert.loop].v];
|
||||
uv_vert.uv = mloopuv[uv_vert.loop].uv;
|
||||
primitive.vertices.append(uv_vert);
|
||||
}
|
||||
primitives.append(primitive);
|
||||
}
|
||||
}
|
||||
|
||||
void init_edges()
|
||||
{
|
||||
edges.reserve(looptri_len * 2);
|
||||
EdgeHash *eh = BLI_edgehash_new_ex(__func__, looptri_len * 3);
|
||||
for (int64_t i = 0; i < looptri_len; i++) {
|
||||
const MLoopTri &tri = looptri[i];
|
||||
MeshPrimitive &primitive = primitives[i];
|
||||
for (int j = 0; j < 3; j++) {
|
||||
int v1 = mloop[tri.tri[j]].v;
|
||||
int v2 = mloop[tri.tri[(j + 1) % 3]].v;
|
||||
/* TODO: Use lookup_ptr to be able to store edge 0. */
|
||||
void *v = BLI_edgehash_lookup(eh, v1, v2);
|
||||
int64_t edge_index;
|
||||
if (v == nullptr) {
|
||||
edge_index = edges.size();
|
||||
BLI_edgehash_insert(eh, v1, v2, POINTER_FROM_INT(edge_index + 1));
|
||||
MeshEdge edge;
|
||||
edge.vert1 = &vertices[v1];
|
||||
edge.vert2 = &vertices[v2];
|
||||
edges.append(edge);
|
||||
MeshEdge *edge_ptr = &edges.last();
|
||||
vertices[v1].edges.append(edge_ptr);
|
||||
vertices[v2].edges.append(edge_ptr);
|
||||
}
|
||||
else {
|
||||
edge_index = POINTER_AS_INT(v) - 1;
|
||||
}
|
||||
|
||||
MeshEdge *edge = &edges[edge_index];
|
||||
edge->primitives.append(&primitive);
|
||||
primitive.edges.append(edge);
|
||||
}
|
||||
}
|
||||
BLI_edgehash_free(eh, nullptr);
|
||||
}
|
||||
|
||||
static const int64_t INVALID_UV_ISLAND_ID = -1;
|
||||
/**
|
||||
* NOTE: doesn't support weird topology where unconnected mesh primitives share the same uv
|
||||
* island. For a accurate implementation we should use implement an uv_prim_lookup.
|
||||
*/
|
||||
static void extract_uv_neighbors(Vector<MeshPrimitive *> &prims_to_add, MeshPrimitive *primitive)
|
||||
{
|
||||
for (MeshEdge *edge : primitive->edges) {
|
||||
for (MeshPrimitive *other_primitive : edge->primitives) {
|
||||
if (primitive == other_primitive) {
|
||||
continue;
|
||||
}
|
||||
if (other_primitive->uv_island_id != MeshData::INVALID_UV_ISLAND_ID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (primitive->has_shared_uv_edge(other_primitive)) {
|
||||
prims_to_add.append(other_primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_primitive_uv_island_ids()
|
||||
{
|
||||
for (MeshPrimitive &primitive : primitives) {
|
||||
primitive.uv_island_id = INVALID_UV_ISLAND_ID;
|
||||
}
|
||||
|
||||
int64_t uv_island_id = 0;
|
||||
Vector<MeshPrimitive *> prims_to_add;
|
||||
for (MeshPrimitive &primitive : primitives) {
|
||||
/* Early exit when uv island id is already extracted during uv neighbor extractions. */
|
||||
if (primitive.uv_island_id != INVALID_UV_ISLAND_ID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prims_to_add.append(&primitive);
|
||||
while (!prims_to_add.is_empty()) {
|
||||
MeshPrimitive *primitive = prims_to_add.pop_last();
|
||||
primitive->uv_island_id = uv_island_id;
|
||||
extract_uv_neighbors(prims_to_add, primitive);
|
||||
}
|
||||
uv_island_id++;
|
||||
}
|
||||
uv_island_len = uv_island_id;
|
||||
}
|
||||
};
|
||||
|
||||
struct UVVertex {
|
||||
MeshVertex *vertex;
|
||||
/* Position in uv space. */
|
||||
float2 uv;
|
||||
|
||||
/* uv edges that share this UVVertex. */
|
||||
Vector<UVEdge *> uv_edges;
|
||||
|
||||
struct {
|
||||
bool is_border : 1;
|
||||
bool is_extended : 1;
|
||||
} flags;
|
||||
|
||||
explicit UVVertex()
|
||||
{
|
||||
flags.is_border = false;
|
||||
flags.is_extended = false;
|
||||
}
|
||||
|
||||
explicit UVVertex(const MeshUVVert &vert) : vertex(vert.vertex), uv(vert.uv)
|
||||
{
|
||||
flags.is_border = false;
|
||||
flags.is_extended = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct UVEdge {
|
||||
std::array<UVVertex *, 2> vertices;
|
||||
Vector<UVPrimitive *, 2> uv_primitives;
|
||||
|
||||
bool has_shared_edge(const MeshUVVert &v1, const MeshUVVert &v2) const
|
||||
{
|
||||
return (vertices[0]->uv == v1.uv && vertices[1]->uv == v2.uv) ||
|
||||
(vertices[0]->uv == v2.uv && vertices[1]->uv == v1.uv);
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVVertex &v1, const UVVertex &v2) const
|
||||
{
|
||||
return (vertices[0]->uv == v1.uv && vertices[1]->uv == v2.uv) ||
|
||||
(vertices[0]->uv == v2.uv && vertices[1]->uv == v1.uv);
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVEdge &other) const
|
||||
{
|
||||
return has_shared_edge(*other.vertices[0], *other.vertices[1]);
|
||||
}
|
||||
|
||||
bool has_same_vertices(const MeshVertex &vert1, const MeshVertex &vert2) const
|
||||
{
|
||||
return (vertices[0]->vertex == &vert1 && vertices[1]->vertex == &vert2) ||
|
||||
(vertices[0]->vertex == &vert2 && vertices[1]->vertex == &vert1);
|
||||
}
|
||||
|
||||
bool has_same_uv_vertices(const UVEdge &other) const
|
||||
{
|
||||
return has_shared_edge(other) &&
|
||||
has_same_vertices(*other.vertices[0]->vertex, *other.vertices[1]->vertex);
|
||||
;
|
||||
}
|
||||
|
||||
bool has_same_vertices(const MeshEdge &edge) const
|
||||
{
|
||||
return has_same_vertices(*edge.vert1, *edge.vert2);
|
||||
}
|
||||
|
||||
bool is_border_edge() const
|
||||
{
|
||||
return uv_primitives.size() == 1;
|
||||
}
|
||||
|
||||
void append_to_uv_vertices()
|
||||
{
|
||||
for (UVVertex *vertex : vertices) {
|
||||
vertex->uv_edges.append_non_duplicates(this);
|
||||
}
|
||||
}
|
||||
|
||||
UVVertex *get_other_uv_vertex(const MeshVertex *vertex)
|
||||
{
|
||||
if (vertices[0]->vertex == vertex) {
|
||||
return vertices[1];
|
||||
}
|
||||
return vertices[0];
|
||||
}
|
||||
};
|
||||
|
||||
struct UVPrimitive {
|
||||
/**
|
||||
* Index of the primitive in the original mesh.
|
||||
*/
|
||||
MeshPrimitive *primitive;
|
||||
Vector<UVEdge *, 3> edges;
|
||||
|
||||
explicit UVPrimitive(MeshPrimitive *primitive) : primitive(primitive)
|
||||
{
|
||||
}
|
||||
|
||||
void append_to_uv_edges()
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
uv_edge->uv_primitives.append_non_duplicates(this);
|
||||
}
|
||||
}
|
||||
void append_to_uv_vertices()
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
uv_edge->append_to_uv_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
Vector<std::pair<UVEdge *, UVEdge *>> shared_edges(UVPrimitive &other)
|
||||
{
|
||||
Vector<std::pair<UVEdge *, UVEdge *>> result;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (edges[i]->has_shared_edge(*other.edges[j])) {
|
||||
result.append(std::pair<UVEdge *, UVEdge *>(edges[i], other.edges[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const UVPrimitive &other) const
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
if (edges[i]->has_shared_edge(*other.edges[j])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const MeshPrimitive &primitive) const
|
||||
{
|
||||
for (const UVEdge *uv_edge : edges) {
|
||||
const MeshUVVert *v1 = &primitive.vertices.last();
|
||||
for (int i = 0; i < primitive.vertices.size(); i++) {
|
||||
const MeshUVVert *v2 = &primitive.vertices[i];
|
||||
if (uv_edge->has_shared_edge(*v1, *v2)) {
|
||||
return true;
|
||||
}
|
||||
v1 = v2;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UVVertex in the order that the verts are ordered in the MeshPrimitive.
|
||||
*/
|
||||
const UVVertex *get_uv_vertex(const uint8_t mesh_vert_index) const
|
||||
{
|
||||
const MeshVertex *mesh_vertex = primitive->vertices[mesh_vert_index].vertex;
|
||||
for (const UVEdge *uv_edge : edges) {
|
||||
for (const UVVertex *uv_vert : uv_edge->vertices) {
|
||||
if (uv_vert->vertex == mesh_vertex) {
|
||||
return uv_vert;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UVEdge that share the given uv coordinates.
|
||||
* Will assert when no UVEdge found.
|
||||
*/
|
||||
UVEdge *get_uv_edge(const float2 uv1, const float2 uv2) const
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
const float2 &e1 = uv_edge->vertices[0]->uv;
|
||||
const float2 &e2 = uv_edge->vertices[1]->uv;
|
||||
if ((e1 == uv1 && e2 == uv2) || (e1 == uv2 && e2 == uv1)) {
|
||||
return uv_edge;
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVEdge *get_uv_edge(const MeshVertex *v1, const MeshVertex *v2) const
|
||||
{
|
||||
for (UVEdge *uv_edge : edges) {
|
||||
const MeshVertex *e1 = uv_edge->vertices[0]->vertex;
|
||||
const MeshVertex *e2 = uv_edge->vertices[1]->vertex;
|
||||
if ((e1 == v1 && e2 == v2) || (e1 == v2 && e2 == v1)) {
|
||||
return uv_edge;
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const bool contains_uv_vertex(const UVVertex *uv_vertex) const
|
||||
{
|
||||
for (UVEdge *edge : edges) {
|
||||
if (std::find(edge->vertices.begin(), edge->vertices.end(), uv_vertex) !=
|
||||
edge->vertices.end()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const UVVertex *get_other_uv_vertex(const UVVertex *v1, const UVVertex *v2) const
|
||||
{
|
||||
BLI_assert(contains_uv_vertex(v1));
|
||||
BLI_assert(contains_uv_vertex(v2));
|
||||
|
||||
for (const UVEdge *edge : edges) {
|
||||
for (const UVVertex *uv_vertex : edge->vertices) {
|
||||
if (uv_vertex != v1 && uv_vertex != v2) {
|
||||
return uv_vertex;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_assert_unreachable();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVBorder extract_border() const;
|
||||
};
|
||||
|
||||
struct UVBorderEdge {
|
||||
UVEdge *edge;
|
||||
bool tag = false;
|
||||
UVPrimitive *uv_primitive;
|
||||
/* Should the vertices of the edge be evaluated in reverse order. */
|
||||
bool reverse_order = false;
|
||||
|
||||
int64_t index = -1;
|
||||
int64_t prev_index = -1;
|
||||
int64_t next_index = -1;
|
||||
int64_t border_index = -1;
|
||||
|
||||
explicit UVBorderEdge(UVEdge *edge, UVPrimitive *uv_primitive)
|
||||
: edge(edge), uv_primitive(uv_primitive)
|
||||
{
|
||||
}
|
||||
|
||||
UVVertex *get_uv_vertex(int index)
|
||||
{
|
||||
int actual_index = reverse_order ? 1 - index : index;
|
||||
return edge->vertices[actual_index];
|
||||
}
|
||||
|
||||
const UVVertex *get_uv_vertex(int index) const
|
||||
{
|
||||
int actual_index = reverse_order ? 1 - index : index;
|
||||
return edge->vertices[actual_index];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the uv vertex from the primitive that is not part of the edge.
|
||||
*/
|
||||
const UVVertex *get_other_uv_vertex() const
|
||||
{
|
||||
return uv_primitive->get_other_uv_vertex(edge->vertices[0], edge->vertices[1]);
|
||||
}
|
||||
|
||||
float length() const
|
||||
{
|
||||
return len_v2v2(edge->vertices[0]->uv, edge->vertices[1]->uv);
|
||||
}
|
||||
};
|
||||
|
||||
struct UVBorderCorner {
|
||||
UVBorderEdge *first;
|
||||
UVBorderEdge *second;
|
||||
float angle;
|
||||
|
||||
UVBorderCorner(UVBorderEdge *first, UVBorderEdge *second, float angle)
|
||||
: first(first), second(second), angle(angle)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate a uv coordinate between the edges of the corner.
|
||||
*
|
||||
* 'min_uv_distance' is the minimum distance between the corner and the
|
||||
* resulting uv coordinate. The distance is in uv space.
|
||||
*/
|
||||
float2 uv(float factor, float min_uv_distance);
|
||||
};
|
||||
|
||||
struct UVBorder {
|
||||
/** Ordered list of UV Verts of the border of this island. */
|
||||
// TODO: support multiple rings + order (CW, CCW)
|
||||
Vector<UVBorderEdge> edges;
|
||||
|
||||
/**
|
||||
* Check if the border is counter clock wise from its island.
|
||||
*/
|
||||
bool is_ccw() const;
|
||||
|
||||
/**
|
||||
* Flip the order of the verts, changing the order between CW and CCW.
|
||||
*/
|
||||
void flip();
|
||||
|
||||
/**
|
||||
* Calculate the outside angle of the given vert.
|
||||
*/
|
||||
float outside_angle(const UVBorderEdge &vert) const;
|
||||
|
||||
void update_indexes(uint64_t border_index);
|
||||
|
||||
static std::optional<UVBorder> extract_from_edges(Vector<UVBorderEdge> &edges);
|
||||
|
||||
/** Remove edge from the border. updates the indexes. */
|
||||
void remove(int64_t index)
|
||||
{
|
||||
/* Could read the border_index from any border edge as they are consistent. */
|
||||
uint64_t border_index = edges[0].border_index;
|
||||
edges.remove(index);
|
||||
update_indexes(border_index);
|
||||
}
|
||||
};
|
||||
|
||||
struct UVIsland {
|
||||
VectorList<UVVertex> uv_vertices;
|
||||
VectorList<UVEdge> uv_edges;
|
||||
VectorList<UVPrimitive> uv_primitives;
|
||||
/**
|
||||
* List of borders of this island. There can be multiple borders per island as a border could
|
||||
* be completely encapsulated by another one.
|
||||
*/
|
||||
Vector<UVBorder> borders;
|
||||
|
||||
/**
|
||||
* Key is mesh vert index, Value is list of UVVertices that refer to the mesh vertex with that
|
||||
* index. Map is used internally to quickly lookup similar UVVertices.
|
||||
*/
|
||||
Map<int64_t, Vector<UVVertex *>> uv_vertex_lookup;
|
||||
|
||||
UVVertex *lookup(const UVVertex &vertex)
|
||||
{
|
||||
int64_t vert_index = vertex.vertex->v;
|
||||
Vector<UVVertex *> &vertices = uv_vertex_lookup.lookup_or_add_default(vert_index);
|
||||
for (UVVertex *v : vertices) {
|
||||
if (v->uv == vertex.uv) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVVertex *lookup_or_create(const UVVertex &vertex)
|
||||
{
|
||||
UVVertex *found_vertex = lookup(vertex);
|
||||
if (found_vertex != nullptr) {
|
||||
return found_vertex;
|
||||
}
|
||||
|
||||
uv_vertices.append(vertex);
|
||||
UVVertex *result = &uv_vertices.last();
|
||||
result->uv_edges.clear();
|
||||
/* v is already a key. Ensured by UVIsland::lookup in this method. */
|
||||
uv_vertex_lookup.lookup(vertex.vertex->v).append(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
UVEdge *lookup(const UVEdge &edge)
|
||||
{
|
||||
UVVertex *found_vertex = lookup(*edge.vertices[0]);
|
||||
if (found_vertex == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
for (UVEdge *e : found_vertex->uv_edges) {
|
||||
UVVertex *other_vertex = e->get_other_uv_vertex(found_vertex->vertex);
|
||||
if (other_vertex->vertex == edge.vertices[1]->vertex &&
|
||||
other_vertex->uv == edge.vertices[1]->uv) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVEdge *lookup_or_create(const UVEdge &edge)
|
||||
{
|
||||
UVEdge *found_edge = lookup(edge);
|
||||
if (found_edge != nullptr) {
|
||||
return found_edge;
|
||||
}
|
||||
|
||||
uv_edges.append(edge);
|
||||
UVEdge *result = &uv_edges.last();
|
||||
result->uv_primitives.clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Initialize the border attribute. */
|
||||
void extract_borders();
|
||||
/** Iterative extend border to fit the mask. */
|
||||
void extend_border(const UVIslandsMask &mask, const short island_index);
|
||||
|
||||
private:
|
||||
void append(const UVPrimitive &primitive)
|
||||
{
|
||||
uv_primitives.append(primitive);
|
||||
UVPrimitive *new_prim_ptr = &uv_primitives.last();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
UVEdge *other_edge = primitive.edges[i];
|
||||
UVEdge uv_edge_template;
|
||||
uv_edge_template.vertices[0] = lookup_or_create(*other_edge->vertices[0]);
|
||||
uv_edge_template.vertices[1] = lookup_or_create(*other_edge->vertices[1]);
|
||||
new_prim_ptr->edges[i] = lookup_or_create(uv_edge_template);
|
||||
new_prim_ptr->edges[i]->append_to_uv_vertices();
|
||||
new_prim_ptr->edges[i]->uv_primitives.append(new_prim_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
bool has_shared_edge(const UVPrimitive &primitive) const
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &prims : uv_primitives) {
|
||||
for (const UVPrimitive &prim : prims) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool has_shared_edge(const MeshPrimitive &primitive) const
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &primitives : uv_primitives) {
|
||||
for (const UVPrimitive &prim : primitives) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const void extend_border(const UVPrimitive &primitive)
|
||||
{
|
||||
for (const VectorList<UVPrimitive>::UsedVector &primitives : uv_primitives) {
|
||||
for (const UVPrimitive &prim : primitives) {
|
||||
if (prim.has_shared_edge(primitive)) {
|
||||
append(primitive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct UVIslands {
|
||||
Vector<UVIsland> islands;
|
||||
|
||||
explicit UVIslands(MeshData &mesh_data);
|
||||
|
||||
void extract_borders();
|
||||
void extend_borders(const UVIslandsMask &islands_mask);
|
||||
};
|
||||
|
||||
/** Mask to find the index of the UVIsland for a given UV coordinate. */
|
||||
struct UVIslandsMask {
|
||||
|
||||
/** Mask for each udim tile. */
|
||||
struct Tile {
|
||||
float2 udim_offset;
|
||||
ushort2 tile_resolution;
|
||||
ushort2 mask_resolution;
|
||||
Array<uint16_t> mask;
|
||||
|
||||
Tile(float2 udim_offset, ushort2 tile_resolution);
|
||||
|
||||
bool is_masked(const uint16_t island_index, const float2 uv) const;
|
||||
bool contains(const float2 uv) const;
|
||||
float get_pixel_size_in_uv_space() const;
|
||||
};
|
||||
|
||||
Vector<Tile> tiles;
|
||||
|
||||
void add_tile(float2 udim_offset, ushort2 resolution);
|
||||
|
||||
/**
|
||||
* Find a tile containing the given uv coordinate.
|
||||
*/
|
||||
const Tile *find_tile(const float2 uv) const;
|
||||
|
||||
/**
|
||||
* Is the given uv coordinate part of the given island_index mask.
|
||||
*
|
||||
* true - part of the island mask.
|
||||
* false - not part of the island mask.
|
||||
*/
|
||||
bool is_masked(const uint16_t island_index, const float2 uv) const;
|
||||
|
||||
/**
|
||||
* Add the given UVIslands to the mask. Tiles should be added beforehand using the 'add_tile'
|
||||
* method.
|
||||
*/
|
||||
void add(const UVIslands &islands);
|
||||
|
||||
void dilate(int max_iterations);
|
||||
};
|
||||
|
||||
} // namespace blender::bke::uv_islands
|
|
@ -480,7 +480,6 @@ set(SRC
|
|||
BKE_type_conversions.hh
|
||||
BKE_undo_system.h
|
||||
BKE_unit.h
|
||||
BKE_uv_islands.hh
|
||||
BKE_vfont.h
|
||||
BKE_vfontdata.h
|
||||
BKE_viewer_path.h
|
||||
|
|
|
@ -203,7 +203,7 @@ IDTypeInfo IDType_ID_CV = {
|
|||
/* id_filter */ FILTER_ID_CV,
|
||||
/* main_listbase_index */ INDEX_ID_CV,
|
||||
/* struct_size */ sizeof(Curves),
|
||||
/* name*/ "Curves",
|
||||
/* name */ "Curves",
|
||||
/* name_plural */ "hair_curves",
|
||||
/* translation_context */ BLT_I18NCONTEXT_ID_CURVES,
|
||||
/* flags */ IDTYPE_FLAGS_APPEND_IS_REUSABLE,
|
||||
|
|
|
@ -3025,7 +3025,7 @@ int dynamicPaint_createUVSurface(Scene *scene,
|
|||
#if 0
|
||||
/* -----------------------------------------------------------------
|
||||
* For debug, write a dump of adjacency data to a file.
|
||||
* -----------------------------------------------------------------*/
|
||||
* ----------------------------------------------------------------- */
|
||||
FILE *dump_file = fopen("dynpaint-adj-data.txt", "w");
|
||||
int *tmp = MEM_callocN(sizeof(int) * active_points, "tmp");
|
||||
for (int ty = 0; ty < h; ty++) {
|
||||
|
@ -3136,7 +3136,7 @@ int dynamicPaint_createUVSurface(Scene *scene,
|
|||
#if 0
|
||||
/* -----------------------------------------------------------------
|
||||
* For debug, output pixel statuses to the color map
|
||||
* -----------------------------------------------------------------*/
|
||||
* ----------------------------------------------------------------- */
|
||||
for (index = 0; index < sData->total_points; index++) {
|
||||
ImgSeqFormatData *f_data = (ImgSeqFormatData *)sData->format_data;
|
||||
PaintUVPoint *uvPoint = &((PaintUVPoint *)f_data->uv_p)[index];
|
||||
|
|
|
@ -58,8 +58,6 @@ static size_t idp_size_table[] = {
|
|||
|
||||
#define GETPROP(prop, i) &(IDP_IDPArray(prop)[i])
|
||||
|
||||
/* --------- property array type -------------*/
|
||||
|
||||
IDProperty *IDP_NewIDPArray(const char *name)
|
||||
{
|
||||
IDProperty *prop = MEM_callocN(sizeof(IDProperty), "IDProperty prop array");
|
||||
|
|
|
@ -890,8 +890,8 @@ static void key_evaluate_relative(const int start,
|
|||
end = tot;
|
||||
}
|
||||
|
||||
/* in case of beztriple */
|
||||
elemstr[0] = 1; /* nr of ipofloats */
|
||||
/* In case of Bezier-triple. */
|
||||
elemstr[0] = 1; /* Number of IPO-floats. */
|
||||
elemstr[1] = IPO_BEZTRIPLE;
|
||||
elemstr[2] = 0;
|
||||
|
||||
|
@ -1132,8 +1132,8 @@ static void do_key(const int start,
|
|||
}
|
||||
}
|
||||
|
||||
/* in case of beztriple */
|
||||
elemstr[0] = 1; /* nr of ipofloats */
|
||||
/* In case of bezier-triples. */
|
||||
elemstr[0] = 1; /* Number of IPO-floats. */
|
||||
elemstr[1] = IPO_BEZTRIPLE;
|
||||
elemstr[2] = 0;
|
||||
|
||||
|
@ -2224,11 +2224,11 @@ void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, float (*positions)[3], con
|
|||
|
||||
void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
||||
const Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3])
|
||||
float (*r_vert_normals)[3],
|
||||
float (*r_poly_normals)[3],
|
||||
float (*r_loop_normals)[3])
|
||||
{
|
||||
if (r_vertnors == nullptr && r_polynors == nullptr && r_loopnors == nullptr) {
|
||||
if (r_vert_normals == nullptr && r_poly_normals == nullptr && r_loop_normals == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2238,21 +2238,21 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
const MPoly *polys = BKE_mesh_polys(mesh);
|
||||
const MLoop *loops = BKE_mesh_loops(mesh);
|
||||
|
||||
const bool loop_normals_needed = r_loopnors != nullptr;
|
||||
const bool vert_normals_needed = r_vertnors != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_polynors != nullptr || vert_normals_needed ||
|
||||
const bool loop_normals_needed = r_loop_normals != nullptr;
|
||||
const bool vert_normals_needed = r_vert_normals != nullptr || loop_normals_needed;
|
||||
const bool poly_normals_needed = r_poly_normals != nullptr || vert_normals_needed ||
|
||||
loop_normals_needed;
|
||||
|
||||
float(*vert_normals)[3] = r_vertnors;
|
||||
float(*poly_normals)[3] = r_polynors;
|
||||
float(*vert_normals)[3] = r_vert_normals;
|
||||
float(*poly_normals)[3] = r_poly_normals;
|
||||
bool free_vert_normals = false;
|
||||
bool free_poly_normals = false;
|
||||
if (vert_normals_needed && r_vertnors == nullptr) {
|
||||
if (vert_normals_needed && r_vert_normals == nullptr) {
|
||||
vert_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totvert, sizeof(float[3]), __func__));
|
||||
free_vert_normals = true;
|
||||
}
|
||||
if (poly_normals_needed && r_polynors == nullptr) {
|
||||
if (poly_normals_needed && r_poly_normals == nullptr) {
|
||||
poly_normals = static_cast<float(*)[3]>(
|
||||
MEM_malloc_arrayN(mesh->totpoly, sizeof(float[3]), __func__));
|
||||
free_poly_normals = true;
|
||||
|
@ -2281,7 +2281,7 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
|||
edges,
|
||||
mesh->totedge,
|
||||
loops,
|
||||
r_loopnors,
|
||||
r_loop_normals,
|
||||
mesh->totloop,
|
||||
polys,
|
||||
poly_normals,
|
||||
|
@ -2456,8 +2456,6 @@ float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3
|
|||
return vertCos;
|
||||
}
|
||||
|
||||
/************************* raw coord offsets ************************/
|
||||
|
||||
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3])
|
||||
{
|
||||
int a;
|
||||
|
@ -2493,8 +2491,6 @@ void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float
|
|||
}
|
||||
}
|
||||
|
||||
/* ==========================================================*/
|
||||
|
||||
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
|
||||
{
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
|
|
@ -1689,6 +1689,14 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
|
|||
r_col[1] = facm * (r_col[1]) + fac * fabsf(r_col[1] - col[1]);
|
||||
r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]);
|
||||
break;
|
||||
case MA_RAMP_EXCLUSION:
|
||||
r_col[0] = max_ff(facm * (r_col[0]) + fac * (r_col[0] + col[0] - 2.0f * r_col[0] * col[0]),
|
||||
0.0f);
|
||||
r_col[1] = max_ff(facm * (r_col[1]) + fac * (r_col[1] + col[1] - 2.0f * r_col[1] * col[1]),
|
||||
0.0f);
|
||||
r_col[2] = max_ff(facm * (r_col[2]) + fac * (r_col[2] + col[2] - 2.0f * r_col[2] * col[2]),
|
||||
0.0f);
|
||||
break;
|
||||
case MA_RAMP_DARK:
|
||||
r_col[0] = min_ff(r_col[0], col[0]) * fac + r_col[0] * facm;
|
||||
r_col[1] = min_ff(r_col[1], col[1]) * fac + r_col[1] * facm;
|
||||
|
|
|
@ -1772,17 +1772,17 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
|
|||
|
||||
static float (*ensure_corner_normal_layer(Mesh &mesh))[3]
|
||||
{
|
||||
float(*r_loopnors)[3];
|
||||
float(*r_loop_normals)[3];
|
||||
if (CustomData_has_layer(&mesh.ldata, CD_NORMAL)) {
|
||||
r_loopnors = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loopnors, 0, sizeof(float[3]) * mesh.totloop);
|
||||
r_loop_normals = (float(*)[3])CustomData_get_layer(&mesh.ldata, CD_NORMAL);
|
||||
memset(r_loop_normals, 0, sizeof(float[3]) * mesh.totloop);
|
||||
}
|
||||
else {
|
||||
r_loopnors = (float(*)[3])CustomData_add_layer(
|
||||
r_loop_normals = (float(*)[3])CustomData_add_layer(
|
||||
&mesh.ldata, CD_NORMAL, CD_SET_DEFAULT, nullptr, mesh.totloop);
|
||||
CustomData_set_layer_flag(&mesh.ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
}
|
||||
return r_loopnors;
|
||||
return r_loop_normals;
|
||||
}
|
||||
|
||||
void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "BLI_string.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_DerivedMesh.h"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_deform.h"
|
||||
|
@ -198,7 +200,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||
SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_only_span<int>(
|
||||
"material_index", ATTR_DOMAIN_FACE);
|
||||
MLoopUV *mloopuv = static_cast<MLoopUV *>(CustomData_add_layer_named(
|
||||
&mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, "UVMap"));
|
||||
&mesh->ldata, CD_MLOOPUV, CD_SET_DEFAULT, nullptr, mesh->totloop, DATA_("UVMap")));
|
||||
|
||||
/* verts and faces */
|
||||
vertcount = 0;
|
||||
|
|
|
@ -163,10 +163,10 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
const float(*vertexCos)[3] = mesh->runtime->edit_data->vertexCos;
|
||||
|
||||
/* XXX: investigate using EditMesh data. */
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
int f_idx;
|
||||
|
||||
|
@ -179,16 +179,16 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
do {
|
||||
const BMVert *eve = l_iter->v;
|
||||
const int v_idx = BM_elem_index_get(eve);
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, vertexCos ? vertexCos[v_idx] : eve->co, no);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
|
||||
static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
|
||||
nullptr;
|
||||
|
||||
const float(*positions)[3] = BKE_mesh_positions(mesh);
|
||||
const MLoop *ml = BKE_mesh_loops(mesh);
|
||||
|
@ -204,7 +204,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = v_index ? v_index[ml->v] : ml->v;
|
||||
const int f_idx = f_index ? f_index[p_idx] : p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
if (ELEM(ORIGINDEX_NONE, v_idx, f_idx)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
|
|||
for (i = 0; i < mp->totloop; i++, ml++) {
|
||||
const int v_idx = ml->v;
|
||||
const int f_idx = p_idx;
|
||||
const float *no = lnors ? *lnors++ : nullptr;
|
||||
const float *no = loop_normals ? *loop_normals++ : nullptr;
|
||||
func(userData, v_idx, f_idx, positions[ml->v], no);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -333,12 +333,13 @@ static void bm_corners_to_loops_ex(ID *id,
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(fdata, CD_TESSLOOPNORMAL)) {
|
||||
float(*lnors)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tlnors)[3] = (short(*)[3])CustomData_get(fdata, findex, CD_TESSLOOPNORMAL);
|
||||
float(*loop_normals)[3] = (float(*)[3])CustomData_get(ldata, loopstart, CD_NORMAL);
|
||||
const short(*tessloop_normals)[3] = (short(*)[3])CustomData_get(
|
||||
fdata, findex, CD_TESSLOOPNORMAL);
|
||||
const int max = mf->v4 ? 4 : 3;
|
||||
|
||||
for (int i = 0; i < max; i++, lnors++, tlnors++) {
|
||||
normal_short_to_float_v3(*lnors, *tlnors);
|
||||
for (int i = 0; i < max; i++, loop_normals++, tessloop_normals++) {
|
||||
normal_short_to_float_v3(*loop_normals, *tessloop_normals);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,11 +552,15 @@ static void update_active_fdata_layers(Mesh &mesh, CustomData *fdata, CustomData
|
|||
}
|
||||
|
||||
if (CustomData_has_layer(ldata, CD_PROP_BYTE_COLOR)) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
|
||||
CustomData_set_layer_active(fdata, CD_MCOL, act);
|
||||
if (mesh.active_color_attribute != NULL) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.active_color_attribute);
|
||||
CustomData_set_layer_active(fdata, CD_MCOL, act);
|
||||
}
|
||||
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
|
||||
CustomData_set_layer_render(fdata, CD_MCOL, act);
|
||||
if (mesh.default_color_attribute != NULL) {
|
||||
act = CustomData_get_named_layer(ldata, CD_PROP_BYTE_COLOR, mesh.default_color_attribute);
|
||||
CustomData_set_layer_render(fdata, CD_MCOL, act);
|
||||
}
|
||||
|
||||
act = CustomData_get_clone_layer(ldata, CD_PROP_BYTE_COLOR);
|
||||
CustomData_set_layer_clone(fdata, CD_MCOL, act);
|
||||
|
@ -845,12 +850,12 @@ static void mesh_loops_to_tessdata(CustomData *fdata,
|
|||
}
|
||||
|
||||
if (hasLoopNormal) {
|
||||
short(*fnors)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*lnors)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
short(*face_normals)[4][3] = (short(*)[4][3])CustomData_get_layer(fdata, CD_TESSLOOPNORMAL);
|
||||
const float(*loop_normals)[3] = (const float(*)[3])CustomData_get_layer(ldata, CD_NORMAL);
|
||||
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, fnors++) {
|
||||
for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, face_normals++) {
|
||||
for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
|
||||
normal_float_to_short_v3((*fnors)[j], lnors[(*lidx)[j]]);
|
||||
normal_float_to_short_v3((*face_normals)[j], loop_normals[(*lidx)[j]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -766,7 +766,7 @@ struct LoopSplitTaskDataCommon {
|
|||
* Note we do not need to protect it, though, since two different tasks will *always* affect
|
||||
* different elements in the arrays. */
|
||||
MLoopNorSpaceArray *lnors_spacearr;
|
||||
MutableSpan<float3> loopnors;
|
||||
MutableSpan<float3> loop_normals;
|
||||
MutableSpan<short2> clnors_data;
|
||||
|
||||
/* Read-only. */
|
||||
|
@ -776,7 +776,7 @@ struct LoopSplitTaskDataCommon {
|
|||
Span<MPoly> polys;
|
||||
Span<int2> edge_to_loops;
|
||||
Span<int> loop_to_poly;
|
||||
Span<float3> polynors;
|
||||
Span<float3> poly_normals;
|
||||
Span<float3> vert_normals;
|
||||
};
|
||||
|
||||
|
@ -858,7 +858,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const float split_angle)
|
||||
{
|
||||
|
@ -881,7 +881,7 @@ void BKE_edges_sharp_from_angle_set(MEdge *medges,
|
|||
{mpolys, numPolys},
|
||||
{mloops, numLoops},
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
true,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -948,8 +948,8 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
const Span<float3> positions = common_data->positions;
|
||||
const Span<MEdge> edges = common_data->edges;
|
||||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
MutableSpan<float3> loop_normals = common_data->loopnors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
const int ml_curr_index = data->ml_curr_index;
|
||||
|
@ -959,7 +959,7 @@ static void split_loop_nor_single_do(LoopSplitTaskDataCommon *common_data, LoopS
|
|||
/* Simple case (both edges around that vertex are sharp in current polygon),
|
||||
* this loop just takes its poly normal.
|
||||
*/
|
||||
loop_normals[ml_curr_index] = polynors[mp_index];
|
||||
loop_normals[ml_curr_index] = poly_normals[mp_index];
|
||||
|
||||
#if 0
|
||||
printf("BASIC: handling loop %d / edge %d / vert %d / poly %d\n",
|
||||
|
@ -1000,7 +1000,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
BLI_Stack *edge_vectors)
|
||||
{
|
||||
MLoopNorSpaceArray *lnors_spacearr = common_data->lnors_spacearr;
|
||||
MutableSpan<float3> loopnors = common_data->loopnors;
|
||||
MutableSpan<float3> loop_normals = common_data->loop_normals;
|
||||
MutableSpan<short2> clnors_data = common_data->clnors_data;
|
||||
|
||||
const Span<float3> positions = common_data->positions;
|
||||
|
@ -1009,7 +1009,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
const Span<MLoop> loops = common_data->loops;
|
||||
const Span<int2> edge_to_loops = common_data->edge_to_loops;
|
||||
const Span<int> loop_to_poly = common_data->loop_to_poly;
|
||||
const Span<float3> polynors = common_data->polynors;
|
||||
const Span<float3> poly_normals = common_data->poly_normals;
|
||||
|
||||
MLoopNorSpace *lnor_space = data->lnor_space;
|
||||
#if 0 /* Not needed for 'fan' loops. */
|
||||
|
@ -1092,7 +1092,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
/* Calculate angle between the two poly edges incident on this vertex. */
|
||||
const float fac = saacos(dot_v3v3(vec_curr, vec_prev));
|
||||
/* Accumulate */
|
||||
madd_v3_v3fl(lnor, polynors[mpfan_curr_index], fac);
|
||||
madd_v3_v3fl(lnor, poly_normals[mpfan_curr_index], fac);
|
||||
|
||||
if (!clnors_data.is_empty()) {
|
||||
/* Accumulate all clnors, if they are not all equal we have to fix that! */
|
||||
|
@ -1106,13 +1106,13 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
clnors_avg[0] += (*clnor)[0];
|
||||
clnors_avg[1] += (*clnor)[1];
|
||||
clnors_count++;
|
||||
/* We store here a pointer to all custom lnors processed. */
|
||||
/* We store here a pointer to all custom loop_normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(clnors, (short *)*clnor);
|
||||
}
|
||||
}
|
||||
|
||||
/* We store here a pointer to all loop-normals processed. */
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loopnors[mlfan_vert_index]));
|
||||
BLI_SMALLSTACK_PUSH(normal, (float *)(loop_normals[mlfan_vert_index]));
|
||||
|
||||
if (lnors_spacearr) {
|
||||
/* Assign current lnor space to current 'vertex' loop. */
|
||||
|
@ -1152,7 +1152,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data,
|
|||
if (lnors_spacearr) {
|
||||
if (UNLIKELY(lnor_len == 0.0f)) {
|
||||
/* Use vertex normal as fallback! */
|
||||
copy_v3_v3(lnor, loopnors[mlfan_vert_index]);
|
||||
copy_v3_v3(lnor, loop_normals[mlfan_vert_index]);
|
||||
lnor_len = 1.0f;
|
||||
}
|
||||
|
||||
|
@ -1446,10 +1446,10 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
const MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_loopnors)[3],
|
||||
float (*r_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
const bool use_split_normals,
|
||||
const float split_angle,
|
||||
|
@ -1464,11 +1464,11 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
BLI_assert(use_split_normals || !(r_lnors_spacearr));
|
||||
|
||||
if (!use_split_normals) {
|
||||
/* In this case, we simply fill lnors with vnors (or fnors for flat faces), quite simple!
|
||||
/* In this case, simply fill `r_loop_normals` with `vert_normals`
|
||||
* (or `poly_normals` for flat faces), quite simple!
|
||||
* Note this is done here to keep some logic and consistency in this quite complex code,
|
||||
* since we may want to use lnors even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code).
|
||||
* As usual, we could handle that on case-by-case basis,
|
||||
* since we may want to use loop_normals even when mesh's 'autosmooth' is disabled
|
||||
* (see e.g. mesh mapping code). As usual, we could handle that on case-by-case basis,
|
||||
* but simpler to keep it well confined here. */
|
||||
int mp_index;
|
||||
|
||||
|
@ -1480,10 +1480,10 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
|
||||
for (; ml_index < ml_index_end; ml_index++) {
|
||||
if (is_poly_flat) {
|
||||
copy_v3_v3(r_loopnors[ml_index], polynors[mp_index]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], poly_normals[mp_index]);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(r_loopnors[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
copy_v3_v3(r_loop_normals[ml_index], vert_normals[mloops[ml_index].v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1540,7 +1540,7 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
/* Init data common to all tasks. */
|
||||
LoopSplitTaskDataCommon common_data;
|
||||
common_data.lnors_spacearr = r_lnors_spacearr;
|
||||
common_data.loopnors = {reinterpret_cast<float3 *>(r_loopnors), numLoops};
|
||||
common_data.loop_normals = {reinterpret_cast<float3 *>(r_loop_normals), numLoops};
|
||||
common_data.clnors_data = {reinterpret_cast<short2 *>(clnors_data), clnors_data ? numLoops : 0};
|
||||
common_data.positions = {reinterpret_cast<const float3 *>(positions), numVerts};
|
||||
common_data.edges = {medges, numEdges};
|
||||
|
@ -1548,7 +1548,7 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
common_data.loops = loops;
|
||||
common_data.edge_to_loops = edge_to_loops;
|
||||
common_data.loop_to_poly = loop_to_poly;
|
||||
common_data.polynors = {reinterpret_cast<const float3 *>(polynors), numPolys};
|
||||
common_data.poly_normals = {reinterpret_cast<const float3 *>(poly_normals), numPolys};
|
||||
common_data.vert_normals = {reinterpret_cast<const float3 *>(vert_normals), numVerts};
|
||||
|
||||
/* Pre-populate all loop normals as if their verts were all smooth.
|
||||
|
@ -1557,7 +1557,7 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
for (const int poly_i : range) {
|
||||
const MPoly &poly = polys[poly_i];
|
||||
for (const int loop_i : IndexRange(poly.loopstart, poly.totloop)) {
|
||||
copy_v3_v3(r_loopnors[loop_i], vert_normals[loops[loop_i].v]);
|
||||
copy_v3_v3(r_loop_normals[loop_i], vert_normals[loops[loop_i].v]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1567,7 +1567,7 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
polys,
|
||||
loops,
|
||||
loop_to_poly,
|
||||
{reinterpret_cast<const float3 *>(polynors), numPolys},
|
||||
{reinterpret_cast<const float3 *>(poly_normals), numPolys},
|
||||
check_angle,
|
||||
split_angle,
|
||||
edge_to_loops,
|
||||
|
@ -1602,9 +1602,9 @@ void BKE_mesh_normals_loop_split(const float (*positions)[3],
|
|||
* Compute internal representation of given custom normals (as an array of float[2]).
|
||||
* It also makes sure the mesh matches those custom normals, by setting sharp edges flag as needed
|
||||
* to get a same custom lnor for all loops sharing a same smooth fan.
|
||||
* If use_vertices if true, r_custom_loopnors is assumed to be per-vertex, not per-loop
|
||||
* If use_vertices if true, r_custom_loop_normals is assumed to be per-vertex, not per-loop
|
||||
* (this allows to set whole vert's normals at once, useful in some cases).
|
||||
* r_custom_loopnors is expected to have normalized normals, or zero ones,
|
||||
* r_custom_loop_normals is expected to have normalized normals, or zero ones,
|
||||
* in which case they will be replaced by default loop/vertex normal.
|
||||
*/
|
||||
static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
||||
|
@ -1613,10 +1613,10 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2],
|
||||
const bool use_vertices)
|
||||
|
@ -1631,7 +1631,8 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
* So better to keep some simplicity here, and just call #BKE_mesh_normals_loop_split() twice! */
|
||||
MLoopNorSpaceArray lnors_spacearr = {nullptr};
|
||||
BitVector<> done_loops(numLoops, false);
|
||||
float(*lnors)[3] = (float(*)[3])MEM_calloc_arrayN(size_t(numLoops), sizeof(*lnors), __func__);
|
||||
float(*loop_normals)[3] = (float(*)[3])MEM_calloc_arrayN(
|
||||
size_t(numLoops), sizeof(*loop_normals), __func__);
|
||||
const Array<int> loop_to_poly = mesh_topology::build_loop_to_poly_map({mpolys, numPolys},
|
||||
numLoops);
|
||||
/* In this case we always consider split nors as ON,
|
||||
|
@ -1648,10 +1649,10 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1662,15 +1663,15 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
/* Set all given zero vectors to their default value. */
|
||||
if (use_vertices) {
|
||||
for (int i = 0; i < numVerts; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], vert_normals[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], vert_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < numLoops; i++) {
|
||||
if (is_zero_v3(r_custom_loopnors[i])) {
|
||||
copy_v3_v3(r_custom_loopnors[i], lnors[i]);
|
||||
if (is_zero_v3(r_custom_loop_normals[i])) {
|
||||
copy_v3_v3(r_custom_loop_normals[i], loop_normals[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1678,9 +1679,9 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
BLI_assert(lnors_spacearr.data_type == MLNOR_SPACEARR_LOOP_INDEX);
|
||||
|
||||
/* Now, check each current smooth fan (one lnor space per smooth fan!),
|
||||
* and if all its matching custom lnors are not (enough) equal, add sharp edges as needed.
|
||||
* and if all its matching custom loop_normals are not (enough) equal, add sharp edges as needed.
|
||||
* This way, next time we run BKE_mesh_normals_loop_split(), we'll get lnor spacearr/smooth fans
|
||||
* matching given custom lnors.
|
||||
* matching given custom loop_normals.
|
||||
* Note this code *will never* unsharp edges! And quite obviously,
|
||||
* when we set custom normals per vertices, running this is absolutely useless. */
|
||||
if (use_vertices) {
|
||||
|
@ -1724,7 +1725,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (!org_nor) {
|
||||
org_nor = nor;
|
||||
|
@ -1756,7 +1757,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const MLoop *ml = &mloops[lidx];
|
||||
const int nidx = lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
if (dot_v3v3(org_nor, nor) < LNOR_SPACE_TRIGO_THRESHOLD) {
|
||||
const MPoly *mp = &mpolys[loop_to_poly[lidx]];
|
||||
|
@ -1767,7 +1768,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
}
|
||||
}
|
||||
|
||||
/* And now, recompute our new auto lnors and lnor spacearr! */
|
||||
/* And now, recompute our new auto `loop_normals` and lnor spacearr! */
|
||||
BKE_lnor_spacearr_clear(&lnors_spacearr);
|
||||
BKE_mesh_normals_loop_split(positions,
|
||||
vert_normals,
|
||||
|
@ -1775,10 +1776,10 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
lnors,
|
||||
loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
use_split_normals,
|
||||
split_angle,
|
||||
|
@ -1807,7 +1808,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
if (lnors_spacearr.lspacearr[i]->flags & MLNOR_SPACE_IS_SINGLE) {
|
||||
BLI_assert(POINTER_AS_INT(loops) == i);
|
||||
const int nidx = use_vertices ? int(mloops[i].v) : i;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], nor, r_clnors_data[i]);
|
||||
done_loops[i].reset();
|
||||
|
@ -1821,7 +1822,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
while (loops) {
|
||||
const int lidx = POINTER_AS_INT(loops->link);
|
||||
const int nidx = use_vertices ? int(mloops[lidx].v) : lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
float *nor = r_custom_loop_normals[nidx];
|
||||
|
||||
avg_nor_count++;
|
||||
add_v3_v3(avg_nor, nor);
|
||||
|
@ -1842,7 +1843,7 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
}
|
||||
}
|
||||
|
||||
MEM_freeN(lnors);
|
||||
MEM_freeN(loop_normals);
|
||||
BKE_lnor_spacearr_free(&lnors_spacearr);
|
||||
}
|
||||
|
||||
|
@ -1852,10 +1853,10 @@ void BKE_mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
float (*r_custom_loopnors)[3],
|
||||
float (*r_custom_loop_normals)[3],
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1865,10 +1866,10 @@ void BKE_mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_loopnors,
|
||||
r_custom_loop_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
false);
|
||||
|
@ -1876,14 +1877,14 @@ void BKE_mesh_normals_loop_custom_set(const float (*positions)[3],
|
|||
|
||||
void BKE_mesh_normals_loop_custom_from_verts_set(const float (*positions)[3],
|
||||
const float (*vert_normals)[3],
|
||||
float (*r_custom_vertnors)[3],
|
||||
float (*r_custom_vert_normals)[3],
|
||||
const int numVerts,
|
||||
MEdge *medges,
|
||||
const int numEdges,
|
||||
const MLoop *mloops,
|
||||
const int numLoops,
|
||||
const MPoly *mpolys,
|
||||
const float (*polynors)[3],
|
||||
const float (*poly_normals)[3],
|
||||
const int numPolys,
|
||||
short (*r_clnors_data)[2])
|
||||
{
|
||||
|
@ -1893,10 +1894,10 @@ void BKE_mesh_normals_loop_custom_from_verts_set(const float (*positions)[3],
|
|||
medges,
|
||||
numEdges,
|
||||
mloops,
|
||||
r_custom_vertnors,
|
||||
r_custom_vert_normals,
|
||||
numLoops,
|
||||
mpolys,
|
||||
polynors,
|
||||
poly_normals,
|
||||
numPolys,
|
||||
r_clnors_data,
|
||||
true);
|
||||
|
@ -1935,14 +1936,14 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
|
|||
use_vertices);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
|
||||
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loop_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_loopnors, false);
|
||||
mesh_set_custom_normals(mesh, r_custom_loop_normals, false);
|
||||
}
|
||||
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vertnors)[3])
|
||||
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vert_normals)[3])
|
||||
{
|
||||
mesh_set_custom_normals(mesh, r_custom_vertnors, true);
|
||||
mesh_set_custom_normals(mesh, r_custom_vert_normals, true);
|
||||
}
|
||||
|
||||
void BKE_mesh_normals_loop_to_vertex(const int numVerts,
|
||||
|
|
|
@ -58,7 +58,7 @@ struct BKEMeshToTangent {
|
|||
|
||||
mikk::float3 GetNormal(const uint face_num, const uint vert_num)
|
||||
{
|
||||
return mikk::float3(lnors[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
return mikk::float3(loop_normals[uint(mpolys[face_num].loopstart) + vert_num]);
|
||||
}
|
||||
|
||||
void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
|
||||
|
@ -67,20 +67,20 @@ struct BKEMeshToTangent {
|
|||
copy_v4_fl4(p_res, T.x, T.y, T.z, orientation ? 1.0f : -1.0f);
|
||||
}
|
||||
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const float (*positions)[3]; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*lnors)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
const MPoly *mpolys; /* faces */
|
||||
const MLoop *mloops; /* faces vertices */
|
||||
const float (*positions)[3]; /* vertices */
|
||||
const MLoopUV *luvs; /* texture coordinates */
|
||||
const float (*loop_normals)[3]; /* loops' normals */
|
||||
float (*tangents)[4]; /* output tangents */
|
||||
int num_polys; /* number of polygons */
|
||||
};
|
||||
|
||||
void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
|
||||
const int /*numVerts*/,
|
||||
const MLoop *mloops,
|
||||
float (*r_looptangent)[4],
|
||||
const float (*loopnors)[3],
|
||||
const float (*loop_normals)[3],
|
||||
const MLoopUV *loopuvs,
|
||||
const int /*numLoops*/,
|
||||
const MPoly *mpolys,
|
||||
|
@ -93,7 +93,7 @@ void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
|
|||
mesh_to_tangent.mloops = mloops;
|
||||
mesh_to_tangent.positions = positions;
|
||||
mesh_to_tangent.luvs = loopuvs;
|
||||
mesh_to_tangent.lnors = loopnors;
|
||||
mesh_to_tangent.loop_normals = loop_normals;
|
||||
mesh_to_tangent.tangents = r_looptangent;
|
||||
mesh_to_tangent.num_polys = numPolys;
|
||||
|
||||
|
@ -133,9 +133,9 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
return;
|
||||
}
|
||||
|
||||
const float(*loopnors)[3] = static_cast<const float(*)[3]>(
|
||||
const float(*loop_normals)[3] = static_cast<const float(*)[3]>(
|
||||
CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
if (!loopnors) {
|
||||
if (!loop_normals) {
|
||||
BKE_report(
|
||||
reports, RPT_ERROR, "Tangent space computation needs loop normals, none found, aborting");
|
||||
return;
|
||||
|
@ -145,7 +145,7 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
|
|||
mesh->totvert,
|
||||
BKE_mesh_loops(mesh),
|
||||
r_looptangents,
|
||||
loopnors,
|
||||
loop_normals,
|
||||
loopuvs,
|
||||
mesh->totloop,
|
||||
BKE_mesh_polys(mesh),
|
||||
|
|
|
@ -670,7 +670,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
|
|||
|
||||
if (mdisps && levels > 0) {
|
||||
if (lvl > 0) {
|
||||
/* MLoop *ml = me->mloop; */ /*UNUSED*/
|
||||
// MLoop *ml = me->mloop; /*UNUSED*/
|
||||
int nsize = multires_side_tot[lvl];
|
||||
int hsize = multires_side_tot[mmd->totlvl];
|
||||
int i, j;
|
||||
|
|
|
@ -42,6 +42,13 @@ static void double_checked_lock_with_task_isolation(std::mutex &mutex,
|
|||
double_checked_lock(mutex, data_is_dirty, [&]() { threading::isolate_task(fn); });
|
||||
}
|
||||
|
||||
static void update_interface_sockets(const bNodeTree &ntree)
|
||||
{
|
||||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
tree_runtime.interface_inputs = ntree.inputs;
|
||||
tree_runtime.interface_outputs = ntree.outputs;
|
||||
}
|
||||
|
||||
static void update_node_vector(const bNodeTree &ntree)
|
||||
{
|
||||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
|
@ -429,6 +436,7 @@ static void ensure_topology_cache(const bNodeTree &ntree)
|
|||
bNodeTreeRuntime &tree_runtime = *ntree.runtime;
|
||||
double_checked_lock_with_task_isolation(
|
||||
tree_runtime.topology_cache_mutex, tree_runtime.topology_cache_is_dirty, [&]() {
|
||||
update_interface_sockets(ntree);
|
||||
update_node_vector(ntree);
|
||||
update_link_vector(ntree);
|
||||
update_socket_vectors_and_owner_node(ntree);
|
||||
|
|
|
@ -142,7 +142,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
|
|||
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
|
||||
/* Custom attributes should not be removed automatically. They might be used by the render
|
||||
* engine or scripts. They can still be removed explicitly using geometry nodes.
|
||||
* Crease can be be used in generic situations with geometry nodes as well. */
|
||||
* Crease can be used in generic situations with geometry nodes as well. */
|
||||
cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
|
||||
cddata_masks.emask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
|
||||
cddata_masks.fmask |= CD_MASK_PROP_ALL;
|
||||
|
|
|
@ -3331,7 +3331,8 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re
|
|||
PARTICLE_P;
|
||||
|
||||
float birthtime = 0.0, dietime = 0.0;
|
||||
float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/;
|
||||
float t, time = 0.0, dfra = 1.0;
|
||||
// float frs_sec = sim->scene->r.frs_sec; /*UNUSED*/
|
||||
float col[4] = {0.5f, 0.5f, 0.5f, 1.0f};
|
||||
float prev_tangent[3] = {0.0f, 0.0f, 0.0f}, hairmat[4][4];
|
||||
float rotmat[3][3];
|
||||
|
|
|
@ -1335,7 +1335,7 @@ typedef struct PBVHUpdateData {
|
|||
PBVHNode **nodes;
|
||||
int totnode;
|
||||
|
||||
float (*vnors)[3];
|
||||
float (*vert_normals)[3];
|
||||
int flag;
|
||||
bool show_sculpt_face_sets;
|
||||
PBVHAttrReq *attrs;
|
||||
|
@ -1349,7 +1349,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1357,7 +1357,7 @@ static void pbvh_update_normals_clear_task_cb(void *__restrict userdata,
|
|||
for (int i = 0; i < totvert; i++) {
|
||||
const int v = verts[i];
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
zero_v3(vnors[v]);
|
||||
zero_v3(vert_normals[v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1371,7 +1371,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
uint mpoly_prev = UINT_MAX;
|
||||
|
@ -1405,7 +1405,7 @@ static void pbvh_update_normals_accum_task_cb(void *__restrict userdata,
|
|||
* Not exact equivalent though, since atomicity is only ensured for one component
|
||||
* of the vector at a time, but here it shall not make any sensible difference. */
|
||||
for (int k = 3; k--;) {
|
||||
atomic_add_and_fetch_fl(&vnors[v][k], fn[k]);
|
||||
atomic_add_and_fetch_fl(&vert_normals[v][k], fn[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1420,7 +1420,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
PBVHUpdateData *data = userdata;
|
||||
PBVH *pbvh = data->pbvh;
|
||||
PBVHNode *node = data->nodes[n];
|
||||
float(*vnors)[3] = data->vnors;
|
||||
float(*vert_normals)[3] = data->vert_normals;
|
||||
|
||||
if (node->flag & PBVH_UpdateNormals) {
|
||||
const int *verts = node->vert_indices;
|
||||
|
@ -1432,7 +1432,7 @@ static void pbvh_update_normals_store_task_cb(void *__restrict userdata,
|
|||
/* No atomics necessary because we are iterating over uniq_verts only,
|
||||
* so we know only this thread will handle this vertex. */
|
||||
if (pbvh->vert_bitmap[v]) {
|
||||
normalize_v3(vnors[v]);
|
||||
normalize_v3(vert_normals[v]);
|
||||
pbvh->vert_bitmap[v] = false;
|
||||
}
|
||||
}
|
||||
|
@ -1456,7 +1456,7 @@ static void pbvh_faces_update_normals(PBVH *pbvh, PBVHNode **nodes, int totnode)
|
|||
PBVHUpdateData data = {
|
||||
.pbvh = pbvh,
|
||||
.nodes = nodes,
|
||||
.vnors = pbvh->vert_normals,
|
||||
.vert_normals = pbvh->vert_normals,
|
||||
};
|
||||
|
||||
TaskParallelSettings settings;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool BKE_shrinkwrap_init_tree(
|
|||
}
|
||||
|
||||
if (force_normals || BKE_shrinkwrap_needs_normals(shrinkType, shrinkMode)) {
|
||||
data->pnors = BKE_mesh_poly_normals_ensure(mesh);
|
||||
data->poly_normals = BKE_mesh_poly_normals_ensure(mesh);
|
||||
if ((mesh->flag & ME_AUTOSMOOTH) != 0) {
|
||||
data->clnors = static_cast<const float(*)[3]>(CustomData_get_layer(&mesh->ldata, CD_NORMAL));
|
||||
}
|
||||
|
@ -1217,8 +1217,8 @@ void BKE_shrinkwrap_compute_smooth_normal(const ShrinkwrapTreeData *tree,
|
|||
}
|
||||
}
|
||||
/* Use the polygon normal if flat. */
|
||||
else if (tree->pnors != nullptr) {
|
||||
copy_v3_v3(r_no, tree->pnors[tri->poly]);
|
||||
else if (tree->poly_normals != nullptr) {
|
||||
copy_v3_v3(r_no, tree->poly_normals[tri->poly]);
|
||||
}
|
||||
/* Finally fallback to the looptri normal. */
|
||||
else {
|
||||
|
|
|
@ -233,7 +233,7 @@ static float _final_mass(Object *ob, BodyPoint *bp)
|
|||
CLOG_ERROR(&LOG, "sb or bp == NULL");
|
||||
return 1.0f;
|
||||
}
|
||||
/* helper functions for everything is animateble jow_go_for2_5 ------*/
|
||||
/* Helper functions for everything is animateble jow_go_for2_5. */
|
||||
|
||||
/* +++ collider caching and dicing +++ */
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ template<typename T> class Span {
|
|||
|
||||
/**
|
||||
* Returns a contiguous part of the array. This invokes undefined behavior when the start or size
|
||||
* is negative. Clamps the size of the new new span so it fits in the current one.
|
||||
* is negative. Clamps the size of the new span so it fits in the current one.
|
||||
*/
|
||||
constexpr Span slice_safe(const int64_t start, const int64_t size) const
|
||||
{
|
||||
|
@ -608,7 +608,7 @@ template<typename T> class MutableSpan {
|
|||
|
||||
/**
|
||||
* Returns a contiguous part of the array. This invokes undefined behavior when the start or size
|
||||
* is negative. Clamps the size of the new new span so it fits in the current one.
|
||||
* is negative. Clamps the size of the new span so it fits in the current one.
|
||||
*/
|
||||
constexpr MutableSpan slice_safe(const int64_t start, const int64_t size) const
|
||||
{
|
||||
|
|
|
@ -267,7 +267,7 @@ size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, s
|
|||
|
||||
#undef BLI_STR_UTF8_CPY
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* wchar_t / utf8 functions */
|
||||
|
||||
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst,
|
||||
|
@ -359,7 +359,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w,
|
|||
}
|
||||
|
||||
/* end wchar_t / utf8 functions */
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int BLI_wcwidth(char32_t ucs)
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ int BLI_str_utf8_char_width_safe(const char *p)
|
|||
return (columns < 0) ? 1 : columns;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------*/
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/* copied from glib's gutf8.c, added 'Err' arg */
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ TEST(string, StrCursorStepNextUtf32AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf32Complex)
|
||||
{
|
||||
/* Combining character, "A", two combining characters, "B".*/
|
||||
/* Combining character, "A", two combining characters, "B". */
|
||||
const char32_t complex[] = U"\u0300\u0041\u0300\u0320\u0042";
|
||||
const size_t len = 5;
|
||||
int pos = 0;
|
||||
|
@ -486,7 +486,7 @@ TEST(string, StrCursorStepNextUtf32Complex)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf32Invalid)
|
||||
{
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters.*/
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters. */
|
||||
const char32_t invalid[] = U"\u00C0\u0300\u0009\u0300\u000D\u0300\u000A\u0300";
|
||||
const size_t len = 8;
|
||||
int pos = 0;
|
||||
|
@ -573,7 +573,7 @@ TEST(string, StrCursorStepPrevUtf32AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf32Complex)
|
||||
{
|
||||
/* Combining character, "A", two combining characters, "B".*/
|
||||
/* Combining character, "A", two combining characters, "B". */
|
||||
const char32_t complex[] = U"\u0300\u0041\u0300\u0320\u0042";
|
||||
const size_t len = 5;
|
||||
int pos = 5;
|
||||
|
@ -596,7 +596,7 @@ TEST(string, StrCursorStepPrevUtf32Complex)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf32Invalid)
|
||||
{
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters.*/
|
||||
/* Latin1 "À", tab, carriage return, linefeed, separated by combining characters. */
|
||||
const char32_t invalid[] = U"\u00C0\u0300\u0009\u0300\u000D\u0300\u000A\u0300";
|
||||
const size_t len = 8;
|
||||
int pos = 8;
|
||||
|
@ -690,7 +690,7 @@ TEST(string, StrCursorStepNextUtf8AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf8AllComplex)
|
||||
{
|
||||
/* Combining character, "A", "©", two combining characters, "B".*/
|
||||
/* Combining character, "A", "©", two combining characters, "B". */
|
||||
const char complex[] = "\xCC\x80\x41\xC2\xA9\xCC\x80\xCC\xA0\x42";
|
||||
const size_t len = 10;
|
||||
int pos = 0;
|
||||
|
@ -723,7 +723,7 @@ TEST(string, StrCursorStepNextUtf8AllComplex)
|
|||
|
||||
TEST(string, StrCursorStepNextUtf8Invalid)
|
||||
{
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining.*/
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining. */
|
||||
const char invalid[] = "\xC0\xCC\x80\x09\x0D\x0A\xCC\x80";
|
||||
const size_t len = 8;
|
||||
int pos = 0;
|
||||
|
@ -818,7 +818,7 @@ TEST(string, StrCursorStepPrevUtf8AllCombining)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf8Complex)
|
||||
{
|
||||
/* Combining character, "A", "©", two combining characters, "B".*/
|
||||
/* Combining character, "A", "©", two combining characters, "B". */
|
||||
const char complex[] = "\xCC\x80\x41\xC2\xA9\xCC\x80\xCC\xA0\x42";
|
||||
const size_t len = 10;
|
||||
int pos = 10;
|
||||
|
@ -851,7 +851,7 @@ TEST(string, StrCursorStepPrevUtf8Complex)
|
|||
|
||||
TEST(string, StrCursorStepPrevUtf8Invalid)
|
||||
{
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining.*/
|
||||
/* Latin1 "À", combining, tab, carriage return, linefeed, combining. */
|
||||
const char invalid[] = "\xC0\xCC\x80\x09\x0D\x0A\xCC\x80";
|
||||
const size_t len = 8;
|
||||
int pos = 8;
|
||||
|
|
|
@ -57,6 +57,9 @@ void MixNode::convert_to_operations(NodeConverter &converter,
|
|||
case MA_RAMP_DIFF:
|
||||
convert_prog = new MixDifferenceOperation();
|
||||
break;
|
||||
case MA_RAMP_EXCLUSION:
|
||||
convert_prog = new MixExclusionOperation();
|
||||
break;
|
||||
case MA_RAMP_SAT:
|
||||
convert_prog = new MixSaturationOperation();
|
||||
break;
|
||||
|
|
|
@ -494,7 +494,65 @@ void MixDifferenceOperation::update_memory_buffer_row(PixelCursor &p)
|
|||
}
|
||||
}
|
||||
|
||||
/* ******** Mix Difference Operation ******** */
|
||||
/* ******** Mix Exclusion Operation ******** */
|
||||
|
||||
void MixExclusionOperation::execute_pixel_sampled(float output[4],
|
||||
float x,
|
||||
float y,
|
||||
PixelSampler sampler)
|
||||
{
|
||||
float input_color1[4];
|
||||
float input_color2[4];
|
||||
float input_value[4];
|
||||
|
||||
input_value_operation_->read_sampled(input_value, x, y, sampler);
|
||||
input_color1_operation_->read_sampled(input_color1, x, y, sampler);
|
||||
input_color2_operation_->read_sampled(input_color2, x, y, sampler);
|
||||
|
||||
float value = input_value[0];
|
||||
if (this->use_value_alpha_multiply()) {
|
||||
value *= input_color2[3];
|
||||
}
|
||||
float valuem = 1.0f - value;
|
||||
output[0] = max_ff(valuem * input_color1[0] + value * (input_color1[0] + input_color2[0] -
|
||||
2.0f * input_color1[0] * input_color2[0]),
|
||||
0.0f);
|
||||
output[1] = max_ff(valuem * input_color1[1] + value * (input_color1[1] + input_color2[1] -
|
||||
2.0f * input_color1[1] * input_color2[1]),
|
||||
0.0f);
|
||||
output[2] = max_ff(valuem * input_color1[2] + value * (input_color1[2] + input_color2[2] -
|
||||
2.0f * input_color1[2] * input_color2[2]),
|
||||
0.0f);
|
||||
output[3] = input_color1[3];
|
||||
|
||||
clamp_if_needed(output);
|
||||
}
|
||||
|
||||
void MixExclusionOperation::update_memory_buffer_row(PixelCursor &p)
|
||||
{
|
||||
while (p.out < p.row_end) {
|
||||
float value = p.value[0];
|
||||
if (this->use_value_alpha_multiply()) {
|
||||
value *= p.color2[3];
|
||||
}
|
||||
const float value_m = 1.0f - value;
|
||||
p.out[0] = max_ff(value_m * p.color1[0] +
|
||||
value * (p.color1[0] + p.color2[0] - 2.0f * p.color1[0] * p.color2[0]),
|
||||
0.0f);
|
||||
p.out[1] = max_ff(value_m * p.color1[1] +
|
||||
value * (p.color1[1] + p.color2[1] - 2.0f * p.color1[1] * p.color2[1]),
|
||||
0.0f);
|
||||
p.out[2] = max_ff(value_m * p.color1[2] +
|
||||
value * (p.color1[2] + p.color2[2] - 2.0f * p.color1[2] * p.color2[2]),
|
||||
0.0f);
|
||||
p.out[3] = p.color1[3];
|
||||
|
||||
clamp_if_needed(p.out);
|
||||
p.next();
|
||||
}
|
||||
}
|
||||
|
||||
/* ******** Mix Divide Operation ******** */
|
||||
|
||||
void MixDivideOperation::execute_pixel_sampled(float output[4],
|
||||
float x,
|
||||
|
|
|
@ -143,6 +143,14 @@ class MixDifferenceOperation : public MixBaseOperation {
|
|||
void update_memory_buffer_row(PixelCursor &p) override;
|
||||
};
|
||||
|
||||
class MixExclusionOperation : public MixBaseOperation {
|
||||
public:
|
||||
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
||||
protected:
|
||||
void update_memory_buffer_row(PixelCursor &p) override;
|
||||
};
|
||||
|
||||
class MixDivideOperation : public MixBaseOperation {
|
||||
public:
|
||||
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
|
||||
|
|
|
@ -6,7 +6,7 @@ void main()
|
|||
ivec2 input_size = texture_size(input_ghost_tx);
|
||||
|
||||
/* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size
|
||||
* to get the coordinates into the sampler's expected [0, 1] range*/
|
||||
* to get the coordinates into the sampler's expected [0, 1] range. */
|
||||
vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size;
|
||||
|
||||
/* We accumulate four variants of the input ghost texture, each is scaled by some amount and
|
||||
|
|
|
@ -6,7 +6,7 @@ void main()
|
|||
ivec2 input_size = texture_size(small_ghost_tx);
|
||||
|
||||
/* Add 0.5 to evaluate the input sampler at the center of the pixel and divide by the image size
|
||||
* to get the coordinates into the sampler's expected [0, 1] range*/
|
||||
* to get the coordinates into the sampler's expected [0, 1] range. */
|
||||
vec2 coordinates = (vec2(texel) + vec2(0.5)) / input_size;
|
||||
|
||||
/* The small ghost is scaled down with the origin as the center of the image by a factor of 2.13,
|
||||
|
|
|
@ -162,7 +162,7 @@ typedef struct DEGObjectIterSettings {
|
|||
} DEGObjectIterSettings;
|
||||
|
||||
/**
|
||||
* Flags to to get objects for draw manager and final render.
|
||||
* Flags to get objects for draw manager and final render.
|
||||
*/
|
||||
#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS \
|
||||
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | \
|
||||
|
|
|
@ -139,9 +139,9 @@ struct OperationKey {
|
|||
int name_tag = -1;
|
||||
};
|
||||
|
||||
/* Similar to the the OperationKey but does not contain external references, which makes it
|
||||
/* Similar to the #OperationKey but does not contain external references, which makes it
|
||||
* suitable to identify operations even after the original database or graph was destroyed.
|
||||
* The downside of this key over the OperationKey is that it performs string allocation upon
|
||||
* The downside of this key over the #OperationKey is that it performs string allocation upon
|
||||
* the key construction. */
|
||||
struct PersistentOperationKey : public OperationKey {
|
||||
/* Create the key which identifies the given operation node. */
|
||||
|
@ -151,11 +151,11 @@ struct PersistentOperationKey : public OperationKey {
|
|||
const IDNode *id_node = component_node->owner;
|
||||
|
||||
/* Copy names over to our object, so that the key stays valid even after the `operation_node`
|
||||
* is destroyed.*/
|
||||
* is destroyed. */
|
||||
component_name_storage_ = component_node->name;
|
||||
name_storage_ = operation_node->name;
|
||||
|
||||
/* Assign fields used by the OperationKey API. */
|
||||
/* Assign fields used by the #OperationKey API. */
|
||||
id = id_node->id_orig;
|
||||
component_type = component_node->type;
|
||||
component_name = component_name_storage_.c_str();
|
||||
|
|
|
@ -31,7 +31,7 @@ GPU_SHADER_CREATE_INFO(basic_curves)
|
|||
.vertex_source("basic_depth_curves_vert.glsl")
|
||||
.additional_info("draw_hair");
|
||||
|
||||
/* Geometry-shader alterantive paths. */
|
||||
/* Geometry-shader alternative paths. */
|
||||
GPU_SHADER_CREATE_INFO(basic_mesh_conservative_no_geom)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_source("basic_depth_vert_conservative_no_geom.glsl")
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#ifndef GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
#define GPU_SHADER_EEVEE_LEGACY_DEFINES
|
||||
|
@ -20,11 +21,11 @@
|
|||
/* Motion Blur. */
|
||||
#define EEVEE_VELOCITY_TILE_SIZE 32
|
||||
|
||||
/* Depth of Field*/
|
||||
/* Depth of Field. */
|
||||
#define DOF_TILE_DIVISOR 16
|
||||
#define DOF_BOKEH_LUT_SIZE 32
|
||||
#define DOF_GATHER_RING_COUNT 5
|
||||
#define DOF_DILATE_RING_COUNT 3
|
||||
#define DOF_FAST_GATHER_COC_ERROR 0.05
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
@ -53,4 +54,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve)
|
|||
GPU_SHADER_CREATE_INFO(eevee_legacy_bloom_resolve_hq)
|
||||
.define("HIGH_QUALITY")
|
||||
.additional_info("eevee_legacy_bloom_resolve")
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
@ -199,7 +200,7 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_translucent_lib)
|
|||
.additional_info("eevee_legacy_closure_eval_lib")
|
||||
.additional_info("eevee_legacy_renderpass_lib");
|
||||
|
||||
/* eevee_legacy_closure_eval_surface_lib*/
|
||||
/* eevee_legacy_closure_eval_surface_lib */
|
||||
GPU_SHADER_CREATE_INFO(eevee_legacy_closure_eval_surface_lib)
|
||||
.additional_info("eevee_legacy_closure_eval_diffuse_lib")
|
||||
.additional_info("eevee_legacy_closure_eval_glossy_lib")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* DOF Lib */
|
||||
|
@ -286,4 +288,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_HQ_BOKEH)
|
|||
GPU_SHADER_CREATE_INFO(eevee_legacy_depth_of_field_resolve_LQ_BOKEH)
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_LQ")
|
||||
.additional_info("eevee_legacy_depth_of_field_resolve_bokeh")
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* effect_minmaxz_frag permutation inputs. */
|
||||
|
@ -349,4 +351,4 @@ GPU_SHADER_CREATE_INFO(eevee_legacy_cryptomatte_mesh)
|
|||
.additional_info("eevee_legacy_cryptomatte_common")
|
||||
.additional_info("eevee_legacy_material_surface_vert")
|
||||
.auto_resource_location(true)
|
||||
.do_static_compilation(true);
|
||||
.do_static_compilation(true);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "eevee_legacy_volume_info.hh"
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup draw
|
||||
|
@ -9,7 +10,7 @@ typedef struct CommonUniformBlock CommonUniformBlock;
|
|||
#endif
|
||||
|
||||
#ifdef GPU_SHADER
|
||||
/* Catch for non-create info cass. */
|
||||
/* Catch for non-create info case. */
|
||||
# ifndef BLI_STATIC_ASSERT_ALIGN
|
||||
# define BLI_STATIC_ASSERT_ALIGN(type, alignment)
|
||||
# endif
|
||||
|
|
|
@ -45,7 +45,7 @@ out ShaderStageInterface{SURFACE_INTERFACE} dataOut;
|
|||
dataOut.worldNormal = dataIn[vert].worldNormal; \
|
||||
dataOut.viewNormal = dataIn[vert].viewNormal;
|
||||
|
||||
# else /* GPU_VERTEX_SHADER || GPU_FRAGMENT_SHADER*/
|
||||
# else /* GPU_VERTEX_SHADER || GPU_FRAGMENT_SHADER */
|
||||
|
||||
IN_OUT ShaderStageInterface{SURFACE_INTERFACE};
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue