Compare commits
47 Commits
temp-fcurv
...
soc-2020-c
Author | SHA1 | Date | |
---|---|---|---|
![]() |
11aa61274d | ||
![]() |
1b8bc74b1f | ||
![]() |
705acb423b | ||
![]() |
114987ee42 | ||
![]() |
f8ebfd0e88 | ||
![]() |
0dfe6a6a37 | ||
![]() |
fd2d7e7a48 | ||
81aeb7ab08 | |||
![]() |
2772910b32 | ||
![]() |
79d256a06d | ||
![]() |
278b753088 | ||
![]() |
0137777137 | ||
a7e8e509a7 | |||
8da4917156 | |||
![]() |
4279181f10 | ||
![]() |
b1269effa9 | ||
![]() |
ca64458b61 | ||
04ef339f74 | |||
![]() |
1e68909800 | ||
![]() |
0de94b2b62 | ||
![]() |
d225ddec4a | ||
![]() |
8d0a3b5c1c | ||
![]() |
9ca8bf13d5 | ||
![]() |
2ae9183f4b | ||
a1dcb2aa70 | |||
9f60b06c8b | |||
![]() |
48b5c90975 | ||
![]() |
1cd405850c | ||
![]() |
cd610269dc | ||
![]() |
9fe9eb5240 | ||
![]() |
3c9ba5e994 | ||
![]() |
b83e559956 | ||
![]() |
fe0e9900d5 | ||
![]() |
3a519e00c5 | ||
![]() |
2eba146a88 | ||
9c530388ca | |||
![]() |
bf3c22ec55 | ||
![]() |
7f7a7efc62 | ||
52b2901156 | |||
![]() |
8344c0acc5 | ||
![]() |
3229939eae | ||
![]() |
d1921a46ca | ||
![]() |
b997a7cb51 | ||
![]() |
8a661f5dd1 | ||
![]() |
717dfa198c | ||
![]() |
935b518ec7 | ||
![]() |
4e04c9b874 |
11
.clang-tidy
11
.clang-tidy
@@ -1,6 +1,3 @@
|
||||
# The warnings below are disabled because they are too pedantic and not worth fixing.
|
||||
# Some of them will be enabled as part of the Clang-Tidy task, see T78535.
|
||||
|
||||
Checks: >
|
||||
-*,
|
||||
readability-*,
|
||||
@@ -15,7 +12,13 @@ Checks: >
|
||||
|
||||
-readability-misleading-indentation,
|
||||
|
||||
-readability-inconsistent-declaration-parameter-name,
|
||||
-readability-redundant-preprocessor,
|
||||
-readability-redundant-member-init,
|
||||
-readability-const-return-type,
|
||||
-readability-static-accessed-through-instance,
|
||||
-readability-redundant-declaration,
|
||||
-readability-qualified-auto,
|
||||
-readability-use-anyofallof,
|
||||
|
||||
bugprone-*,
|
||||
@@ -27,5 +30,7 @@ Checks: >
|
||||
|
||||
-bugprone-sizeof-expression,
|
||||
-bugprone-integer-division,
|
||||
-bugprone-incorrect-roundings,
|
||||
-bugprone-copy-constructor-init,
|
||||
|
||||
WarningsAsErrors: '*'
|
||||
|
@@ -128,9 +128,7 @@ enable_testing()
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE)
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE)
|
||||
|
||||
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(GENERATOR_IS_MULTI_CONFIG)
|
||||
if(MSVC)
|
||||
set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/$<CONFIG>/ CACHE INTERNAL "" FORCE)
|
||||
else()
|
||||
set(TESTS_OUTPUT_DIR ${EXECUTABLE_OUTPUT_PATH}/tests/ CACHE INTERNAL "" FORCE)
|
||||
@@ -198,12 +196,10 @@ option(WITH_OPENIMAGEDENOISE "Enable the OpenImageDenoise compositing node" ON
|
||||
|
||||
option(WITH_OPENSUBDIV "Enable OpenSubdiv for surface subdivision" ON)
|
||||
|
||||
option(WITH_POTRACE "Enable features relying on potrace" ON)
|
||||
option(WITH_OPENVDB "Enable features relying on OpenVDB" ON)
|
||||
option(WITH_OPENVDB_BLOSC "Enable blosc compression for OpenVDB, only enable if OpenVDB was built with blosc support" ON)
|
||||
option(WITH_OPENVDB_3_ABI_COMPATIBLE "Assume OpenVDB library has been compiled with version 3 ABI compatibility" OFF)
|
||||
mark_as_advanced(WITH_OPENVDB_3_ABI_COMPATIBLE)
|
||||
option(WITH_NANOVDB "Enable usage of NanoVDB data structure for accelerated rendering on the GPU" OFF)
|
||||
|
||||
# GHOST Windowing Library Options
|
||||
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
|
||||
@@ -224,6 +220,8 @@ if(WITH_GHOST_X11)
|
||||
option(WITH_GHOST_XDND "Enable drag'n'drop support on X11 using XDND protocol" ON)
|
||||
endif()
|
||||
|
||||
option(WITH_GMP "Use the gmp library for more accurate booleans" OFF)
|
||||
|
||||
# Misc...
|
||||
option(WITH_HEADLESS "Build without graphical support (renderfarm, server mode only)" OFF)
|
||||
mark_as_advanced(WITH_HEADLESS)
|
||||
@@ -439,12 +437,8 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# This should be turned off when Blender enter beta/rc/release
|
||||
if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
|
||||
"${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
|
||||
set(WITH_EXPERIMENTAL_FEATURES OFF)
|
||||
else()
|
||||
set(WITH_EXPERIMENTAL_FEATURES ON)
|
||||
endif()
|
||||
option(WITH_EXPERIMENTAL_FEATURES "Enable experimental features (still need to enable them in the user preferences)" ON)
|
||||
mark_as_advanced(WITH_EXPERIMENTAL_FEATURES)
|
||||
|
||||
# Unit testsing
|
||||
option(WITH_GTESTS "Enable GTest unit testing" OFF)
|
||||
@@ -516,22 +510,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
-fno-sanitize=alignment \
|
||||
")
|
||||
|
||||
if(MSVC)
|
||||
# clang-cl doesn't support all sanitizers, but leak and object-size give errors/warnings.
|
||||
set(_asan_defaults "${_asan_defaults}")
|
||||
elseif(APPLE)
|
||||
# AppleClang doesn't support all sanitizers, but leak gives error.
|
||||
# Build type is not known for multi-config generator, so don't add object-size sanitizer.
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug" OR GENERATOR_IS_MULTI_CONFIG)
|
||||
# Silence the warning that object-size is not effective in -O0.
|
||||
set(_asan_defaults "${_asan_defaults}")
|
||||
else()
|
||||
set(_asan_defaults "${_asan_defaults} -fsanitize=object-size")
|
||||
endif()
|
||||
else()
|
||||
if(NOT MSVC) # not all sanitizers are supported with clang-cl, these two however are very vocal about it
|
||||
set(_asan_defaults "${_asan_defaults} -fsanitize=leak -fsanitize=object-size" )
|
||||
endif()
|
||||
|
||||
set(COMPILER_ASAN_CFLAGS "${_asan_defaults}" CACHE STRING "C flags for address sanitizer")
|
||||
mark_as_advanced(COMPILER_ASAN_CFLAGS)
|
||||
set(COMPILER_ASAN_CXXFLAGS "${_asan_defaults}" CACHE STRING "C++ flags for address sanitizer")
|
||||
@@ -539,33 +520,16 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
|
||||
unset(_asan_defaults)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT MSVC)
|
||||
find_library(COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
|
||||
else()
|
||||
find_library(
|
||||
COMPILER_ASAN_LIBRARY NAMES clang_rt.asan-x86_64
|
||||
PATHS
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/7.0.0/lib/windows
|
||||
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\LLVM\\LLVM;]/lib/clang/6.0.0/lib/windows
|
||||
)
|
||||
elseif(APPLE)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
||||
-print-file-name=lib
|
||||
OUTPUT_VARIABLE CLANG_LIB_DIR
|
||||
)
|
||||
string(STRIP "${CLANG_LIB_DIR}" CLANG_LIB_DIR)
|
||||
find_library(
|
||||
COMPILER_ASAN_LIBRARY
|
||||
NAMES
|
||||
libclang_rt.asan_osx_dynamic.dylib
|
||||
PATHS
|
||||
"${CLANG_LIB_DIR}/darwin/"
|
||||
)
|
||||
unset(CLANG_LIB_DIR)
|
||||
else()
|
||||
find_library(
|
||||
COMPILER_ASAN_LIBRARY asan ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(COMPILER_ASAN_LIBRARY)
|
||||
endif()
|
||||
endif()
|
||||
@@ -705,9 +669,6 @@ set_and_warn_dependency(WITH_TBB WITH_OPENIMAGEDENOISE OFF)
|
||||
set_and_warn_dependency(WITH_TBB WITH_OPENVDB OFF)
|
||||
set_and_warn_dependency(WITH_TBB WITH_MOD_FLUID OFF)
|
||||
|
||||
# NanoVDB requires OpenVDB to convert the data structure
|
||||
set_and_warn_dependency(WITH_OPENVDB WITH_NANOVDB OFF)
|
||||
|
||||
# OpenVDB uses 'half' type from OpenEXR & fails to link without OpenEXR enabled.
|
||||
set_and_warn_dependency(WITH_IMAGE_OPENEXR WITH_OPENVDB OFF)
|
||||
|
||||
@@ -842,10 +803,11 @@ set(CXX_WARNINGS)
|
||||
set(C_REMOVE_STRICT_FLAGS)
|
||||
set(CXX_REMOVE_STRICT_FLAGS)
|
||||
|
||||
# Libraries to link to targets in setup_platform_linker_libs
|
||||
# libraries to link the binary with passed to target_link_libraries()
|
||||
# known as LLIBS to scons
|
||||
set(PLATFORM_LINKLIBS "")
|
||||
|
||||
# Added to target linker flags in setup_platform_linker_flags
|
||||
# Added to linker flags in setup_liblinks
|
||||
# - CMAKE_EXE_LINKER_FLAGS
|
||||
# - CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
set(PLATFORM_LINKFLAGS "")
|
||||
@@ -861,13 +823,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
if(MSVC)
|
||||
set(COMPILER_ASAN_LINKER_FLAGS "/FUNCTIONPADMIN:6")
|
||||
endif()
|
||||
|
||||
if(APPLE AND COMPILER_ASAN_LIBRARY)
|
||||
string(REPLACE " " ";" _list_COMPILER_ASAN_CFLAGS ${COMPILER_ASAN_CFLAGS})
|
||||
add_compile_options("$<$<NOT:$<CONFIG:Release>>:${_list_COMPILER_ASAN_CFLAGS}>")
|
||||
add_link_options("$<$<NOT:$<CONFIG:Release>>:-fno-omit-frame-pointer;-fsanitize=address>")
|
||||
unset(_list_COMPILER_ASAN_CFLAGS)
|
||||
elseif(COMPILER_ASAN_LIBRARY)
|
||||
if(COMPILER_ASAN_LIBRARY)
|
||||
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS};${COMPILER_ASAN_LIBRARY}")
|
||||
set(PLATFORM_LINKFLAGS "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||
set(PLATFORM_LINKFLAGS_DEBUG "${COMPILER_ASAN_LIBRARY} ${COMPILER_ASAN_LINKER_FLAGS}")
|
||||
|
29
GNUmakefile
29
GNUmakefile
@@ -81,19 +81,11 @@ Static Source Code Checking
|
||||
* check_splint: Run blenders source through splint (C only).
|
||||
* check_sparse: Run blenders source through sparse (C only).
|
||||
* check_smatch: Run blenders source through smatch (C only).
|
||||
* check_descriptions: Check for duplicate/invalid descriptions.
|
||||
|
||||
Spell Checkers
|
||||
|
||||
* check_spelling_c: Check for spelling errors (C/C++ only),
|
||||
* check_spelling_c: Check for spelling errors (C/C++ only).
|
||||
* check_spelling_c_qtc: Same as check_spelling_c but outputs QtCreator tasks format.
|
||||
* check_spelling_osl: Check for spelling errors (OSL only).
|
||||
* check_spelling_py: Check for spelling errors (Python only).
|
||||
|
||||
Note that spell checkers can tak a 'CHECK_SPELLING_CACHE' filepath argument,
|
||||
so re-running does not need to re-check unchanged files.
|
||||
|
||||
Example:
|
||||
make check_spelling_c CHECK_SPELLING_CACHE=../spelling_cache.data
|
||||
* check_descriptions: Check for duplicate/invalid descriptions.
|
||||
|
||||
Utilities
|
||||
Not associated with building Blender.
|
||||
@@ -465,17 +457,26 @@ check_spelling_c: .FORCE
|
||||
cd "$(BUILD_DIR)" ; \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
--cache-file=$(CHECK_SPELLING_CACHE) \
|
||||
"$(BLENDER_DIR)/source" \
|
||||
"$(BLENDER_DIR)/intern/cycles" \
|
||||
"$(BLENDER_DIR)/intern/guardedalloc" \
|
||||
"$(BLENDER_DIR)/intern/ghost" \
|
||||
|
||||
check_spelling_c_qtc: .FORCE
|
||||
cd "$(BUILD_DIR)" ; USE_QTC_TASK=1 \
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
"$(BLENDER_DIR)/source" \
|
||||
"$(BLENDER_DIR)/intern/cycles" \
|
||||
"$(BLENDER_DIR)/intern/guardedalloc" \
|
||||
"$(BLENDER_DIR)/intern/ghost" \
|
||||
> \
|
||||
"$(BLENDER_DIR)/check_spelling_c.tasks"
|
||||
|
||||
check_spelling_osl: .FORCE
|
||||
cd "$(BUILD_DIR)" ;\
|
||||
PYTHONIOENCODING=utf_8 $(PYTHON) \
|
||||
"$(BLENDER_DIR)/source/tools/check_source/check_spelling.py" \
|
||||
--cache-file=$(CHECK_SPELLING_CACHE) \
|
||||
"$(BLENDER_DIR)/intern/cycles/kernel/shaders"
|
||||
|
||||
check_descriptions: .FORCE
|
||||
@@ -517,7 +518,7 @@ doc_py: .FORCE
|
||||
ASAN_OPTIONS=halt_on_error=0 \
|
||||
$(BLENDER_BIN) --background -noaudio --factory-startup \
|
||||
--python doc/python_api/sphinx_doc_gen.py
|
||||
sphinx-build -b html -j $(NPROCS) doc/python_api/sphinx-in doc/python_api/sphinx-out
|
||||
cd doc/python_api ; sphinx-build -b html sphinx-in sphinx-out
|
||||
@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/index.html'"
|
||||
|
||||
doc_doxy: .FORCE
|
||||
|
@@ -30,11 +30,11 @@
|
||||
# build_deps 2015 x64 / build_deps 2015 x86
|
||||
#
|
||||
# MAC OS X USAGE:
|
||||
# Install with homebrew: brew install autoconf automake bison cmake libtool pkg-config yasm
|
||||
# Install with homebrew: brew install cmake autoconf automake libtool yasm nasm bison
|
||||
# Run "make deps" from main Blender directory
|
||||
#
|
||||
# LINUX USAGE:
|
||||
# Install compiler cmake autoconf automake libtool yasm tcl
|
||||
# Install compiler cmake autoconf automake libtool yasm nasm tcl
|
||||
# Run "make deps" from main Blender directory
|
||||
#
|
||||
####################################################################################################
|
||||
@@ -75,8 +75,6 @@ include(cmake/llvm.cmake)
|
||||
include(cmake/clang.cmake)
|
||||
if(APPLE)
|
||||
include(cmake/openmp.cmake)
|
||||
endif()
|
||||
if(UNIX)
|
||||
include(cmake/nasm.cmake)
|
||||
endif()
|
||||
include(cmake/openimageio.cmake)
|
||||
@@ -90,7 +88,6 @@ include(cmake/python_site_packages.cmake)
|
||||
include(cmake/package_python.cmake)
|
||||
include(cmake/numpy.cmake)
|
||||
include(cmake/usd.cmake)
|
||||
include(cmake/potrace.cmake)
|
||||
# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
|
||||
include(cmake/boost.cmake)
|
||||
if(UNIX)
|
||||
@@ -117,6 +114,7 @@ if(WIN32)
|
||||
include(cmake/yamlcpp.cmake)
|
||||
# LCMS is an OCIO dep, but only if you build the apps, leaving it here for convenience
|
||||
# include(cmake/lcms.cmake)
|
||||
|
||||
endif()
|
||||
|
||||
if(NOT WIN32 OR ENABLE_MINGW64)
|
||||
|
@@ -26,11 +26,11 @@ if(UNIX)
|
||||
set(_required_software
|
||||
autoconf
|
||||
automake
|
||||
bison
|
||||
${_libtoolize_name}
|
||||
pkg-config
|
||||
tclsh
|
||||
nasm
|
||||
yasm
|
||||
tclsh
|
||||
bison
|
||||
)
|
||||
|
||||
foreach(_software ${_required_software})
|
||||
@@ -54,10 +54,10 @@ if(UNIX)
|
||||
" ${_software_missing}\n"
|
||||
"\n"
|
||||
"On Debian and Ubuntu:\n"
|
||||
" apt install autoconf automake libtool yasm tcl\n"
|
||||
" apt install autoconf automake libtool yasm nasm tcl\n"
|
||||
"\n"
|
||||
"On macOS (with homebrew):\n"
|
||||
" brew install autoconf automake bison libtool pkg-config yasm\n"
|
||||
" brew install cmake autoconf automake libtool yasm nasm bison\n"
|
||||
"\n"
|
||||
"Other platforms:\n"
|
||||
" Install equivalent packages.\n")
|
||||
|
@@ -64,11 +64,3 @@ add_dependencies(
|
||||
external_clang
|
||||
ll
|
||||
)
|
||||
|
||||
# We currently do not build libxml2 on Windows.
|
||||
if(NOT WIN32)
|
||||
add_dependencies(
|
||||
external_clang
|
||||
external_xml2
|
||||
)
|
||||
endif()
|
||||
|
@@ -52,11 +52,6 @@ if(APPLE)
|
||||
--target-os=darwin
|
||||
--x86asmexe=${LIBDIR}/nasm/bin/nasm
|
||||
)
|
||||
elseif(UNIX)
|
||||
set(FFMPEG_EXTRA_FLAGS
|
||||
${FFMPEG_EXTRA_FLAGS}
|
||||
--x86asmexe=${LIBDIR}/nasm/bin/nasm
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_ffmpeg
|
||||
@@ -147,7 +142,7 @@ if(WIN32)
|
||||
external_zlib_mingw
|
||||
)
|
||||
endif()
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
add_dependencies(
|
||||
external_ffmpeg
|
||||
external_nasm
|
||||
|
@@ -25,25 +25,6 @@ else()
|
||||
set(GMP_OPTIONS --enable-static --disable-shared )
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
set(GMP_OPTIONS
|
||||
${GMP_OPTIONS}
|
||||
--disable-assembly
|
||||
)
|
||||
else()
|
||||
set(GMP_OPTIONS
|
||||
${GMP_OPTIONS}
|
||||
--with-pic
|
||||
)
|
||||
endif()
|
||||
elseif(UNIX)
|
||||
set(GMP_OPTIONS
|
||||
${GMP_OPTIONS}
|
||||
--with-pic
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_gmp
|
||||
URL ${GMP_URI}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
|
@@ -26,7 +26,6 @@ endif()
|
||||
message("HARVEST_TARGET = ${HARVEST_TARGET}")
|
||||
|
||||
if(WIN32)
|
||||
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
add_custom_target(Harvest_Release_Results
|
||||
COMMAND # jpeg rename libfile + copy include
|
||||
@@ -146,9 +145,6 @@ harvest(openjpeg/lib openjpeg/lib "*.a")
|
||||
harvest(opensubdiv/include opensubdiv/include "*.h")
|
||||
harvest(opensubdiv/lib opensubdiv/lib "*.a")
|
||||
harvest(openvdb/include/openvdb openvdb/include/openvdb "*.h")
|
||||
if(WITH_NANOVDB)
|
||||
harvest(openvdb/nanovdb nanovdb/include/nanovdb "*.h")
|
||||
endif()
|
||||
harvest(openvdb/lib openvdb/lib "*.a")
|
||||
harvest(xr_openxr_sdk/include/openxr xr_openxr_sdk/include/openxr "*.h")
|
||||
harvest(xr_openxr_sdk/lib xr_openxr_sdk/lib "*.a")
|
||||
@@ -181,8 +177,6 @@ harvest(xvidcore/lib ffmpeg/lib "*.a")
|
||||
harvest(usd/include usd/include "*.h")
|
||||
harvest(usd/lib/usd usd/lib/usd "*")
|
||||
harvest(usd/plugin usd/plugin "*")
|
||||
harvest(potrace/include potrace/include "*.h")
|
||||
harvest(potrace/lib potrace/lib "*.a")
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
harvest(libglu/lib mesa/lib "*.so*")
|
||||
|
@@ -43,7 +43,6 @@ set(ISPC_EXTRA_ARGS
|
||||
-DLLVM_ROOT=${LIBDIR}/llvm/lib/cmake/llvm
|
||||
-DLLVM_LIBRARY_DIR=${LIBDIR}/llvm/lib
|
||||
-DCLANG_EXECUTABLE=${LIBDIR}/clang/bin/clang
|
||||
-DCLANGPP_EXECUTABLE=${LIBDIR}/clang/bin/clang++
|
||||
-DISPC_INCLUDE_TESTS=Off
|
||||
-DCLANG_LIBRARY_DIR=${LIBDIR}/clang/lib
|
||||
-DCLANG_INCLUDE_DIRS=${LIBDIR}/clang/include
|
||||
|
@@ -59,4 +59,4 @@ else(WIN32)
|
||||
)
|
||||
|
||||
set(JPEG_LIBRARY libjpeg${LIBEXT})
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
@@ -54,20 +54,6 @@ set(OPENVDB_EXTRA_ARGS
|
||||
-DOPENVDB_CORE_STATIC=${OPENVDB_STATIC}
|
||||
-DOPENVDB_BUILD_BINARIES=Off
|
||||
-DCMAKE_DEBUG_POSTFIX=_d
|
||||
# NanoVDB is header-only, so only need the install target
|
||||
-DNANOVDB_BUILD_UNITTESTS=OFF
|
||||
-DNANOVDB_BUILD_EXAMPLES=OFF
|
||||
-DNANOVDB_BUILD_BENCHMARK=OFF
|
||||
-DNANOVDB_BUILD_DOCS=OFF
|
||||
-DNANOVDB_BUILD_TOOLS=OFF
|
||||
-DNANOVDB_CUDA_KEEP_PTX=OFF
|
||||
-DNANOVDB_USE_OPENGL=OFF
|
||||
-DNANOVDB_USE_OPENGL=OFF
|
||||
-DNANOVDB_USE_CUDA=OFF
|
||||
-DNANOVDB_USE_TBB=OFF
|
||||
-DNANOVDB_USE_OPTIX=OFF
|
||||
-DNANOVDB_USE_OPENVDB=OFF
|
||||
-DNANOVDB_ALLOW_FETCHCONTENT=OFF
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
@@ -88,18 +74,12 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
set(OPENVDB_PATCH_FILE openvdb_nanovdb.diff)
|
||||
else()
|
||||
set(OPENVDB_PATCH_FILE openvdb.diff)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(openvdb
|
||||
URL ${OPENVDB_URI}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH MD5=${OPENVDB_HASH}
|
||||
PREFIX ${BUILD_DIR}/openvdb
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/${OPENVDB_PATCH_FILE}
|
||||
PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb.diff
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/openvdb
|
||||
)
|
||||
@@ -116,17 +96,11 @@ add_dependencies(
|
||||
if(WIN32)
|
||||
if(BUILD_MODE STREQUAL Release)
|
||||
ExternalProject_Add_Step(openvdb after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include/openvdb ${HARVEST_TARGET}/openvdb/include/openvdb
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/include ${HARVEST_TARGET}/openvdb/include
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/bin/openvdb.dll ${HARVEST_TARGET}/openvdb/bin/openvdb.dll
|
||||
DEPENDEES install
|
||||
)
|
||||
if(WITH_NANOVDB)
|
||||
ExternalProject_Add_Step(openvdb nanovdb_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openvdb/nanovdb ${HARVEST_TARGET}/nanovdb/include/nanovdb
|
||||
DEPENDEES after_install
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_MODE STREQUAL Debug)
|
||||
ExternalProject_Add_Step(openvdb after_install
|
||||
|
@@ -21,7 +21,6 @@ if(WIN32)
|
||||
endif()
|
||||
option(WITH_WEBP "Enable building of oiio with webp support" OFF)
|
||||
option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF)
|
||||
option(WITH_NANOVDB "Enable building of OpenVDB with NanoVDB included" OFF)
|
||||
set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with")
|
||||
|
||||
if(NOT BUILD_MODE)
|
||||
|
@@ -1,38 +0,0 @@
|
||||
# ***** 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 *****
|
||||
|
||||
set(POTRACE_EXTRA_ARGS
|
||||
)
|
||||
|
||||
if((WIN32 AND BUILD_MODE STREQUAL Release) OR UNIX)
|
||||
ExternalProject_Add(external_potrace
|
||||
URL ${POTRACE_URI}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
URL_HASH MD5=${POTRACE_HASH}
|
||||
PREFIX ${BUILD_DIR}/potrace
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_potrace.txt ${BUILD_DIR}/potrace/src/external_potrace/CMakeLists.txt
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/potrace ${DEFAULT_CMAKE_FLAGS} ${POTRACE_EXTRA_ARGS}
|
||||
INSTALL_DIR ${LIBDIR}/potrace
|
||||
)
|
||||
if(WIN32)
|
||||
ExternalProject_Add_Step(external_potrace after_install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/potrace ${HARVEST_TARGET}/potrace
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
endif()
|
@@ -145,15 +145,9 @@ set(TBB_VERSION 2019_U9)
|
||||
set(TBB_URI https://github.com/oneapi-src/oneTBB/archive/${TBB_VERSION}.tar.gz)
|
||||
set(TBB_HASH 26263622e9187212ec240dcf01b66207)
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
set(OPENVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
|
||||
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${OPENVDB_GIT_UID}.tar.gz)
|
||||
set(OPENVDB_HASH 90919510bc6ccd630fedc56f748cb199)
|
||||
else()
|
||||
set(OPENVDB_VERSION 7.0.0)
|
||||
set(OPENVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
|
||||
set(OPENVDB_URI https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz)
|
||||
set(OPENVDB_HASH fd6c4f168282f7e0e494d290cd531fa8)
|
||||
endif()
|
||||
|
||||
set(IDNA_VERSION 2.9)
|
||||
set(CHARDET_VERSION 3.0.4)
|
||||
@@ -299,9 +293,9 @@ set(USD_VERSION 20.05)
|
||||
set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
|
||||
set(USD_HASH 6d679e739e7f65725d9c029e37dda9fc)
|
||||
|
||||
set(OIDN_VERSION 1.2.3)
|
||||
set(OIDN_VERSION 1.2.1)
|
||||
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
|
||||
set(OIDN_HASH 1f11466c2c3efc27faba5ec7078d12b2)
|
||||
set(OIDN_HASH cbebc1a25eb6de62af3a59e943063608)
|
||||
|
||||
set(LIBGLU_VERSION 9.0.1)
|
||||
set(LIBGLU_URI ftp://ftp.freedesktop.org/pub/mesa/glu/glu-${LIBGLU_VERSION}.tar.xz)
|
||||
@@ -319,14 +313,10 @@ set(XR_OPENXR_SDK_VERSION 1.0.8)
|
||||
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||
set(XR_OPENXR_SDK_HASH c6de63d2e0f9029aa58dfa97cad8ce07)
|
||||
|
||||
set(ISPC_VERSION v1.14.1)
|
||||
set(ISPC_VERSION v1.13.0)
|
||||
set(ISPC_URI https://github.com/ispc/ispc/archive/${ISPC_VERSION}.tar.gz)
|
||||
set(ISPC_HASH 968fbc8dfd16a60ba4e32d2e0e03ea7a)
|
||||
set(ISPC_HASH 4bf5e8d0020c4b9980faa702c1a6f25f)
|
||||
|
||||
set(GMP_VERSION 6.2.0)
|
||||
set(GMP_URI https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz)
|
||||
set(GMP_HASH a325e3f09e6d91e62101e59f9bda3ec1)
|
||||
|
||||
set(POTRACE_VERSION 1.16)
|
||||
set(POTRACE_URI http://potrace.sourceforge.net/download/${POTRACE_VERSION}/potrace-${POTRACE_VERSION}.tar.gz)
|
||||
set(POTRACE_HASH 5f0bd87ddd9a620b0c4e65652ef93d69)
|
||||
|
@@ -34,12 +34,6 @@ else()
|
||||
set(X264_CONFIGURE_ENV echo .)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
set(X264_CONFIGURE_ENV
|
||||
export AS=${LIBDIR}/nasm/bin/nasm
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(external_x264
|
||||
URL ${X264_URI}
|
||||
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||
@@ -60,7 +54,7 @@ if(MSVC)
|
||||
set_target_properties(external_x264 PROPERTIES FOLDER Mingw)
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
if(APPLE)
|
||||
add_dependencies(
|
||||
external_x264
|
||||
external_nasm
|
||||
|
@@ -474,7 +474,7 @@ OPENVDB_BLOSC_VERSION="1.5.0"
|
||||
OPENVDB_VERSION="7.0.0"
|
||||
OPENVDB_VERSION_SHORT="7.0"
|
||||
OPENVDB_VERSION_MIN="7.0"
|
||||
OPENVDB_VERSION_MAX="7.1"
|
||||
OPENVDB_VERSION_MAX="8.0"
|
||||
OPENVDB_FORCE_BUILD=false
|
||||
OPENVDB_FORCE_REBUILD=false
|
||||
OPENVDB_SKIP=false
|
||||
@@ -512,7 +512,7 @@ EMBREE_FORCE_BUILD=false
|
||||
EMBREE_FORCE_REBUILD=false
|
||||
EMBREE_SKIP=false
|
||||
|
||||
OIDN_VERSION="1.2.3"
|
||||
OIDN_VERSION="1.2.1"
|
||||
OIDN_VERSION_SHORT="1.2"
|
||||
OIDN_VERSION_MIN="1.2.0"
|
||||
OIDN_VERSION_MAX="1.3"
|
||||
@@ -1087,7 +1087,7 @@ Those libraries should be available as packages in all recent distributions (opt
|
||||
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
||||
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
||||
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
|
||||
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig.\""
|
||||
* libsdl2, libglew, [libgmp], [libglewmx], fontconfig.\""
|
||||
|
||||
DEPS_SPECIFIC_INFO="\"BUILDABLE DEPENDENCIES:
|
||||
|
||||
@@ -3659,7 +3659,7 @@ install_DEB() {
|
||||
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
||||
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
|
||||
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
||||
libgmp-dev libpugixml-dev libpotrace-dev"
|
||||
libgmp-dev"
|
||||
# libglewmx-dev (broken in deb testing currently...)
|
||||
|
||||
VORBIS_USE=true
|
||||
@@ -4325,8 +4325,7 @@ install_RPM() {
|
||||
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
||||
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
||||
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
||||
gmp-devel pugixml-devel potrace-devel"
|
||||
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel gmp-devel"
|
||||
|
||||
OPENJPEG_USE=true
|
||||
VORBIS_USE=true
|
||||
@@ -4902,7 +4901,7 @@ install_ARCH() {
|
||||
_packages="$BASE_DEVEL git cmake fontconfig \
|
||||
libxi libxcursor libxrandr libxinerama glew libpng libtiff wget openal \
|
||||
$OPENJPEG_DEV $VORBIS_DEV $OGG_DEV $THEORA_DEV yasm sdl2 fftw \
|
||||
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp potrace pugixml"
|
||||
libxml2 yaml-cpp tinyxml python-requests jemalloc gmp"
|
||||
|
||||
OPENJPEG_USE=true
|
||||
VORBIS_USE=true
|
||||
|
@@ -1,54 +0,0 @@
|
||||
project(potrace)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
include_directories(src/include)
|
||||
|
||||
set(SOURCES
|
||||
src/backend_dxf.c
|
||||
src/backend_eps.c
|
||||
src/backend_geojson.c
|
||||
src/backend_pdf.c
|
||||
src/backend_pgm.c
|
||||
src/backend_svg.c
|
||||
src/backend_xfig.c
|
||||
src/bbox.c
|
||||
src/bitmap_io.c
|
||||
src/curve.c
|
||||
src/decompose.c
|
||||
src/flate.c
|
||||
src/greymap.c
|
||||
src/lzw.c
|
||||
src/potracelib.c
|
||||
src/progress_bar.c
|
||||
src/render.c
|
||||
src/trace.c
|
||||
src/trans.c
|
||||
)
|
||||
|
||||
set(HEADERS
|
||||
src/potracelib.h
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(/D_USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
||||
add_definitions(/DPOTRACE="POTrace")
|
||||
add_definitions(/DVERSION="Blender")
|
||||
add_definitions(/DHAVE_INTTYPES_H)
|
||||
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${HEADERS} ${SOURCES})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
LIBRARY_OUTPUT_NAME "${PROJECT_NAME}"
|
||||
PUBLIC_HEADER "${HEADERS}"
|
||||
)
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
)
|
||||
|
@@ -19,16 +19,16 @@ diff -Naur orig/CMakeLists.txt external_ispc/CMakeLists.txt
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||
- ${LLVM_INCLUDE_DIRS}
|
||||
+ ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS}
|
||||
${GENX_DEPS_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
|
||||
# Compile options
|
||||
diff -Naur orig/cmake/GenerateBuiltins.cmake.txt external_ispc/cmake/GenerateBuiltins.cmake.txt
|
||||
+++ orig/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
|
||||
+++ external_ispc/cmake/GenerateBuiltins.cmake 2020-05-25 13:32:40.830803821 +0200
|
||||
@@ -97,6 +97,8 @@
|
||||
|
||||
if ("${bit}" STREQUAL "32" AND ${arch} STREQUAL "x86")
|
||||
set(target_arch "i686")
|
||||
set(target_arch "i386")
|
||||
+ # Blender: disable 32bit due to build issues on Linux and being unnecessary.
|
||||
+ set(SKIP ON)
|
||||
elseif ("${bit}" STREQUAL "64" AND ${arch} STREQUAL "x86")
|
||||
|
@@ -1,135 +0,0 @@
|
||||
diff -Naur orig/cmake/FindIlmBase.cmake openvdb/cmake/FindIlmBase.cmake
|
||||
--- orig/cmake/FindIlmBase.cmake 2019-12-06 12:11:33 -0700
|
||||
+++ openvdb/cmake/FindIlmBase.cmake 2020-08-12 12:48:44 -0600
|
||||
@@ -217,6 +217,8 @@
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
|
||||
endif()
|
||||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_IlmBase_Version_Suffix}.lib")
|
||||
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
|
||||
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
|
||||
else()
|
||||
if(ILMBASE_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
diff -Naur orig/cmake/FindOpenEXR.cmake openvdb/cmake/FindOpenEXR.cmake
|
||||
--- orig/cmake/FindOpenEXR.cmake 2019-12-06 12:11:33 -0700
|
||||
+++ openvdb/cmake/FindOpenEXR.cmake 2020-08-12 12:48:44 -0600
|
||||
@@ -210,6 +210,8 @@
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
|
||||
endif()
|
||||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "${_OpenEXR_Version_Suffix}.lib")
|
||||
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s.lib")
|
||||
+ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES "_s_d.lib")
|
||||
else()
|
||||
if(OPENEXR_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||
diff -Naur orig/openvdb/openvdb/CMakeLists.txt openvdb/openvdb/openvdb/CMakeLists.txt
|
||||
--- orig/openvdb/openvdb/CMakeLists.txt 2019-12-06 12:11:33 -0700
|
||||
+++ openvdb/openvdb/openvdb/CMakeLists.txt 2020-08-12 14:12:26 -0600
|
||||
@@ -105,7 +105,9 @@
|
||||
# http://boost.2283326.n4.nabble.com/CMake-config-scripts-broken-in-1-70-td4708957.html
|
||||
# https://github.com/boostorg/boost_install/commit/160c7cb2b2c720e74463865ef0454d4c4cd9ae7c
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
- set(Boost_USE_STATIC_LIBS OFF)
|
||||
+ if(NOT WIN32) # blender links boost statically on windows
|
||||
+ set(Boost_USE_STATIC_LIBS OFF)
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS iostreams system)
|
||||
@@ -193,6 +195,7 @@
|
||||
if(OPENVDB_DISABLE_BOOST_IMPLICIT_LINKING)
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
endif()
|
||||
+ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_OPENEXR_STATICLIB)
|
||||
endif()
|
||||
|
||||
# @todo Should be target definitions
|
||||
@@ -383,7 +386,12 @@
|
||||
# imported targets.
|
||||
|
||||
if(OPENVDB_CORE_SHARED)
|
||||
- add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
|
||||
+ if(WIN32)
|
||||
+ configure_file(version.rc.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc @ONLY)
|
||||
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
||||
+ else()
|
||||
+ add_library(openvdb_shared SHARED ${OPENVDB_LIBRARY_SOURCE_FILES})
|
||||
+ endif()
|
||||
endif()
|
||||
|
||||
if(OPENVDB_CORE_STATIC)
|
||||
diff -Naur orig/openvdb/openvdb/version.rc.in openvdb/openvdb/openvdb/version.rc.in
|
||||
--- orig/openvdb/openvdb/version.rc.in 1969-12-31 17:00:00 -0700
|
||||
+++ openvdb/openvdb/openvdb/version.rc.in 2020-08-12 14:15:01 -0600
|
||||
@@ -0,0 +1,48 @@
|
||||
+#include <winver.h>
|
||||
+
|
||||
+#define VER_FILEVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
|
||||
+#define VER_FILEVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@.@OpenVDB_PATCH_VERSION@.0\0"
|
||||
+
|
||||
+#define VER_PRODUCTVERSION @OpenVDB_MAJOR_VERSION@,@OpenVDB_MINOR_VERSION@,@OpenVDB_PATCH_VERSION@,0
|
||||
+#define VER_PRODUCTVERSION_STR "@OpenVDB_MAJOR_VERSION@.@OpenVDB_MINOR_VERSION@\0"
|
||||
+
|
||||
+#ifndef DEBUG
|
||||
+#define VER_DEBUG 0
|
||||
+#else
|
||||
+#define VER_DEBUG VS_FF_DEBUG
|
||||
+#endif
|
||||
+
|
||||
+VS_VERSION_INFO VERSIONINFO
|
||||
+FILEVERSION VER_FILEVERSION
|
||||
+PRODUCTVERSION VER_PRODUCTVERSION
|
||||
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
+FILEFLAGS (VER_DEBUG)
|
||||
+FILEOS VOS__WINDOWS32
|
||||
+FILETYPE VFT_DLL
|
||||
+FILESUBTYPE VFT2_UNKNOWN
|
||||
+BEGIN
|
||||
+ BLOCK "StringFileInfo"
|
||||
+ BEGIN
|
||||
+ BLOCK "040904E4"
|
||||
+ BEGIN
|
||||
+ VALUE "FileDescription", "OpenVDB"
|
||||
+ VALUE "FileVersion", VER_FILEVERSION_STR
|
||||
+ VALUE "InternalName", "OpenVDB"
|
||||
+ VALUE "ProductName", "OpenVDB"
|
||||
+ VALUE "ProductVersion", VER_PRODUCTVERSION_STR
|
||||
+ END
|
||||
+ END
|
||||
+
|
||||
+ BLOCK "VarFileInfo"
|
||||
+ BEGIN
|
||||
+ /* The following line should only be modified for localized versions. */
|
||||
+ /* It consists of any number of WORD,WORD pairs, with each pair */
|
||||
+ /* describing a language,codepage combination supported by the file. */
|
||||
+ /* */
|
||||
+ /* For example, a file might have values "0x409,1252" indicating that it */
|
||||
+ /* supports English language (0x409) in the Windows ANSI codepage (1252). */
|
||||
+
|
||||
+ VALUE "Translation", 0x409, 1252
|
||||
+
|
||||
+ END
|
||||
+END
|
||||
diff -Naur openvdb-original/CMakeLists.txt openvdb/CMakeLists.txt
|
||||
--- openvdb-original/CMakeLists.txt 2020-08-27 03:34:02.000000000 +0200
|
||||
+++ openvdb/CMakeLists.txt 2020-09-02 10:56:21.665735244 +0200
|
||||
@@ -68,6 +68,7 @@
|
||||
option(OPENVDB_INSTALL_HOUDINI_PYTHONRC [=[Install a Houdini startup script that sets
|
||||
the visibilty of OpenVDB nodes and their native equivalents.]=] OFF)
|
||||
option(OPENVDB_BUILD_MAYA_PLUGIN "Build the Maya plugin" OFF)
|
||||
+option(OPENVDB_BUILD_NANOVDB "Build nanovdb" ON)
|
||||
option(OPENVDB_ENABLE_RPATH "Build with RPATH information" ON)
|
||||
option(OPENVDB_CXX_STRICT "Enable or disable pre-defined compiler warnings" OFF)
|
||||
option(OPENVDB_CODE_COVERAGE "Enable code coverage. This also overrides CMAKE_BUILD_TYPE to Debug" OFF)
|
||||
@@ -740,6 +741,10 @@
|
||||
add_subdirectory(openvdb_maya)
|
||||
endif()
|
||||
|
||||
+if(OPENVDB_BUILD_NANOVDB)
|
||||
+ add_subdirectory(nanovdb)
|
||||
+endif()
|
||||
+
|
||||
##########################################################################
|
||||
|
||||
add_custom_target(uninstall
|
||||
|
@@ -24,7 +24,6 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def is_tool(name):
|
||||
"""Check whether `name` is on PATH and marked as executable."""
|
||||
|
||||
@@ -33,7 +32,6 @@ def is_tool(name):
|
||||
|
||||
return which(name) is not None
|
||||
|
||||
|
||||
class Builder:
|
||||
def __init__(self, name, branch, codesign):
|
||||
self.name = name
|
||||
@@ -66,7 +64,6 @@ class Builder:
|
||||
# Always 64 bit now
|
||||
self.bits = 64
|
||||
|
||||
|
||||
def create_builder_from_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('builder_name')
|
||||
@@ -107,7 +104,7 @@ class VersionInfo:
|
||||
|
||||
def _parse_header_file(self, filename, define):
|
||||
import re
|
||||
regex = re.compile(r"^#\s*define\s+%s\s+(.*)" % define)
|
||||
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
|
||||
with open(filename, "r") as file:
|
||||
for l in file:
|
||||
match = regex.match(l)
|
||||
|
@@ -23,7 +23,6 @@ import shutil
|
||||
|
||||
import buildbot_utils
|
||||
|
||||
|
||||
def get_cmake_options(builder):
|
||||
codesign_script = os.path.join(
|
||||
builder.blender_dir, 'build_files', 'buildbot', 'worker_codesign.cmake')
|
||||
@@ -50,7 +49,6 @@ def get_cmake_options(builder):
|
||||
|
||||
return options
|
||||
|
||||
|
||||
def update_git(builder):
|
||||
# Do extra git fetch because not all platform/git/buildbot combinations
|
||||
# update the origin remote, causing buildinfo to detect local changes.
|
||||
@@ -60,7 +58,6 @@ def update_git(builder):
|
||||
command = ['git', 'fetch', '--all']
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
|
||||
|
||||
def clean_directories(builder):
|
||||
# Make sure no garbage remained from the previous run
|
||||
if os.path.isdir(builder.install_dir):
|
||||
@@ -76,7 +73,6 @@ def clean_directories(builder):
|
||||
print("Removing {}" . format(buildinfo))
|
||||
os.remove(full_path)
|
||||
|
||||
|
||||
def cmake_configure(builder):
|
||||
# CMake configuration
|
||||
os.chdir(builder.build_dir)
|
||||
@@ -91,7 +87,6 @@ def cmake_configure(builder):
|
||||
command = ['cmake', builder.blender_dir] + cmake_options
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
|
||||
|
||||
def cmake_build(builder):
|
||||
# CMake build
|
||||
os.chdir(builder.build_dir)
|
||||
@@ -114,7 +109,6 @@ def cmake_build(builder):
|
||||
print("CMake build:")
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
builder = buildbot_utils.create_builder_from_arguments()
|
||||
update_git(builder)
|
||||
|
@@ -29,7 +29,6 @@ from pathlib import Path
|
||||
|
||||
import buildbot_utils
|
||||
|
||||
|
||||
def get_package_name(builder, platform=None):
|
||||
info = buildbot_utils.VersionInfo(builder)
|
||||
|
||||
@@ -42,7 +41,6 @@ def get_package_name(builder, platform=None):
|
||||
|
||||
return package_name
|
||||
|
||||
|
||||
def sign_file_or_directory(path):
|
||||
from codesign.simple_code_signer import SimpleCodeSigner
|
||||
code_signer = SimpleCodeSigner()
|
||||
@@ -66,7 +64,6 @@ def create_buildbot_upload_zip(builder, package_files):
|
||||
sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n')
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def create_tar_xz(src, dest, package_name):
|
||||
# One extra to remove leading os.sep when cleaning root for package_root
|
||||
ln = len(src) + 1
|
||||
@@ -94,7 +91,6 @@ def create_tar_xz(src, dest, package_name):
|
||||
package.add(entry[0], entry[1], recursive=False, filter=_fakeroot)
|
||||
package.close()
|
||||
|
||||
|
||||
def cleanup_files(dirpath, extension):
|
||||
for f in os.listdir(dirpath):
|
||||
filepath = os.path.join(dirpath, f)
|
||||
@@ -175,11 +171,7 @@ def pack_linux(builder):
|
||||
|
||||
print("Stripping python...")
|
||||
py_target = os.path.join(builder.install_dir, info.short_version)
|
||||
buildbot_utils.call(
|
||||
builder.command_prefix + [
|
||||
'find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';',
|
||||
],
|
||||
)
|
||||
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
|
||||
|
||||
# Construct package name
|
||||
platform_name = 'linux64'
|
||||
|
@@ -22,21 +22,18 @@ import buildbot_utils
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def get_ctest_arguments(builder):
|
||||
args = ['--output-on-failure']
|
||||
if builder.platform == 'win':
|
||||
args += ['-C', 'Release']
|
||||
return args
|
||||
|
||||
|
||||
def test(builder):
|
||||
os.chdir(builder.build_dir)
|
||||
|
||||
command = builder.command_prefix + ['ctest'] + get_ctest_arguments(builder)
|
||||
buildbot_utils.call(command)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
builder = buildbot_utils.create_builder_from_arguments()
|
||||
test(builder)
|
||||
|
@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Alembic DEFAULT_MSG ALEMBIC_LIBRARY ALEMBIC_IN
|
||||
IF(ALEMBIC_FOUND)
|
||||
SET(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARY})
|
||||
SET(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(ALEMBIC_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ALEMBIC_INCLUDE_DIR
|
||||
|
@@ -30,7 +30,7 @@ SET(_audaspace_SEARCH_DIRS
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
PKG_CHECK_MODULES(AUDASPACE_PKGCONF audaspace)
|
||||
ENDIF()
|
||||
ENDIF(PKG_CONFIG_FOUND)
|
||||
|
||||
# Include dir
|
||||
FIND_PATH(AUDASPACE_INCLUDE_DIR
|
||||
@@ -88,17 +88,17 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Audaspace_Py DEFAULT_MSG AUDASPACE_PY_LIBRAR
|
||||
IF(AUDASPACE_FOUND)
|
||||
SET(AUDASPACE_LIBRARIES ${AUDASPACE_LIBRARY})
|
||||
SET(AUDASPACE_INCLUDE_DIRS ${AUDASPACE_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(AUDASPACE_FOUND)
|
||||
|
||||
IF(AUDASPACE_C_FOUND)
|
||||
SET(AUDASPACE_C_LIBRARIES ${AUDASPACE_C_LIBRARY})
|
||||
SET(AUDASPACE_C_INCLUDE_DIRS ${AUDASPACE_C_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(AUDASPACE_C_FOUND)
|
||||
|
||||
IF(AUDASPACE_PY_FOUND)
|
||||
SET(AUDASPACE_PY_LIBRARIES ${AUDASPACE_PY_LIBRARY})
|
||||
SET(AUDASPACE_PY_INCLUDE_DIRS ${AUDASPACE_PY_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(AUDASPACE_PY_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
AUDASPACE_LIBRARY
|
||||
|
@@ -41,7 +41,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Eigen3 DEFAULT_MSG
|
||||
|
||||
IF(EIGEN3_FOUND)
|
||||
SET(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(EIGEN3_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
EIGEN3_INCLUDE_DIR
|
||||
|
@@ -37,9 +37,9 @@ FIND_PATH(EMBREE_INCLUDE_DIR
|
||||
|
||||
SET(_embree_FIND_COMPONENTS
|
||||
embree3
|
||||
embree_sse42
|
||||
embree_avx
|
||||
embree_avx2
|
||||
embree_sse42
|
||||
lexers
|
||||
math
|
||||
simd
|
||||
@@ -80,7 +80,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Embree DEFAULT_MSG
|
||||
IF(EMBREE_FOUND)
|
||||
SET(EMBREE_LIBRARIES ${_embree_LIBRARIES})
|
||||
SET(EMBREE_INCLUDE_DIRS ${EMBREE_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(EMBREE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
EMBREE_INCLUDE_DIR
|
||||
|
@@ -1,83 +0,0 @@
|
||||
# - Find FFmpeg library and includes.
|
||||
# Set FFMPEG_FIND_COMPONENTS to the canonical names of the libraries
|
||||
# before using the module.
|
||||
# This module defines
|
||||
# FFMPEG_INCLUDE_DIRS, where to find libavcodec/ac3_parser.h.
|
||||
# FFMPEG_LIBRARIES, libraries to link against to use FFmpeg.
|
||||
# FFMPEG_ROOT_DIR, The base directory to search for FFmpeg.
|
||||
# This can also be an environment variable.
|
||||
# FFMPEG_FOUND, If false, do not try to use FFmpeg.
|
||||
# FFMPEG_<COMPONENT>_LIBRARY, the given individual component libraries.
|
||||
#=============================================================================
|
||||
# Copyright 2020 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD 3-Clause License,
|
||||
# see accompanying file BSD-3-Clause-license.txt for details.
|
||||
#=============================================================================
|
||||
|
||||
# If FFMPEG_ROOT_DIR was defined in the environment, use it.
|
||||
if(NOT FFMPEG_ROOT_DIR AND NOT $ENV{FFMPEG_ROOT_DIR} STREQUAL "")
|
||||
set(FFMPEG_ROOT_DIR $ENV{FFMPEG_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
set(_ffmpeg_SEARCH_DIRS
|
||||
${FFMPEG_ROOT_DIR}
|
||||
/opt/lib/ffmpeg
|
||||
)
|
||||
|
||||
if(NOT FFMPEG_FIND_COMPONENTS)
|
||||
set(FFMPEG_FIND_COMPONENTS
|
||||
# List taken from http://ffmpeg.org/download.html#build-mac
|
||||
avcodec
|
||||
avdevice
|
||||
avfilter
|
||||
avformat
|
||||
avutil
|
||||
)
|
||||
endif()
|
||||
|
||||
find_path(_ffmpeg_INCLUDE_DIR
|
||||
NAMES
|
||||
libavcodec/ac3_parser.h
|
||||
HINTS
|
||||
${_ffmpeg_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
set(_ffmpeg_LIBRARIES)
|
||||
foreach(_component ${FFMPEG_FIND_COMPONENTS})
|
||||
string(TOUPPER ${_component} _upper_COMPONENT)
|
||||
find_library(FFMPEG_${_upper_COMPONENT}_LIBRARY
|
||||
NAMES
|
||||
${_upper_COMPONENT}
|
||||
HINTS
|
||||
${LIBDIR}/ffmpeg
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
if(NOT FFMPEG_${_upper_COMPONENT}_LIBRARY)
|
||||
message(WARNING "Could NOT find FFmpeg ${_upper_COMPONENT}.")
|
||||
endif()
|
||||
list(APPEND _ffmpeg_LIBRARIES ${FFMPEG_${_upper_COMPONENT}_LIBRARY})
|
||||
mark_as_advanced(FFMPEG_${_upper_COMPONENT}_LIBRARY)
|
||||
endforeach()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG
|
||||
_ffmpeg_LIBRARIES _ffmpeg_INCLUDE_DIR)
|
||||
|
||||
IF(FFMPEG_FOUND)
|
||||
set(FFMPEG_LIBRARIES ${_ffmpeg_LIBRARIES})
|
||||
set(FFMPEG_INCLUDE_DIRS ${_ffmpeg_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(
|
||||
FFMPEG_INCLUDE_DIR
|
||||
)
|
||||
|
||||
unset(_ffmpeg_SEARCH_DIRS)
|
||||
unset(_ffmpeg_LIBRARIES)
|
||||
unset(_ffmpeg_INCLUDE_DIR)
|
@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fftw3 DEFAULT_MSG
|
||||
IF(FFTW3_FOUND)
|
||||
SET(FFTW3_LIBRARIES ${FFTW3_LIBRARY})
|
||||
SET(FFTW3_INCLUDE_DIRS ${FFTW3_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(FFTW3_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
FFTW3_INCLUDE_DIR
|
||||
|
@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG
|
||||
|
||||
IF(GLEW_FOUND)
|
||||
SET(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(GLEW_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
GLEW_INCLUDE_DIR
|
||||
|
@@ -82,7 +82,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG
|
||||
IF(GMP_FOUND)
|
||||
SET(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY})
|
||||
SET(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR} ${GMPXX_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(GMP_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
GMP_INCLUDE_DIR
|
||||
|
@@ -124,7 +124,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Icu DEFAULT_MSG
|
||||
IF(ICU_FOUND)
|
||||
SET(ICU_LIBRARIES ${ICU_LIBRARY_DATA} ${ICU_LIBRARY_I18N} ${ICU_LIBRARY_IO} ${ICU_LIBRARY_LE} ${ICU_LIBRARY_LX} ${ICU_LIBRARY_TU} ${ICU_LIBRARY_UC})
|
||||
SET(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(ICU_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ICU_INCLUDE_DIR
|
||||
|
@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jack DEFAULT_MSG
|
||||
IF(JACK_FOUND)
|
||||
SET(JACK_LIBRARIES ${JACK_LIBRARY})
|
||||
SET(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(JACK_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
JACK_INCLUDE_DIR
|
||||
|
@@ -64,7 +64,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(JeMalloc DEFAULT_MSG
|
||||
IF(JEMALLOC_FOUND)
|
||||
SET(JEMALLOC_LIBRARIES ${JEMALLOC_LIBRARY})
|
||||
SET(JEMALLOC_INCLUDE_DIRS ${JEMALLOC_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(JEMALLOC_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
JEMALLOC_INCLUDE_DIR
|
||||
|
@@ -34,10 +34,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --includedir
|
||||
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(NOT DEFINED LLVM_VERSION)
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --version
|
||||
OUTPUT_VARIABLE LLVM_VERSION
|
||||
@@ -84,7 +80,7 @@ if(LLVM_LIBRARY AND LLVM_ROOT_DIR AND LLVM_LIBPATH)
|
||||
endif()
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LLVM_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set SDL2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
|
||||
|
@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO DEFAULT_MSG
|
||||
IF(LZO_FOUND)
|
||||
SET(LZO_LIBRARIES ${LZO_LIBRARY})
|
||||
SET(LZO_INCLUDE_DIRS ${LZO_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(LZO_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LZO_INCLUDE_DIR
|
||||
|
@@ -1,49 +0,0 @@
|
||||
# - Find NanoVDB library
|
||||
# Find the native NanoVDB includes and library
|
||||
# This module defines
|
||||
# NANOVDB_INCLUDE_DIRS, where to find nanovdb.h, Set when
|
||||
# NANOVDB_INCLUDE_DIR is found.
|
||||
# NANOVDB_ROOT_DIR, The base directory to search for NanoVDB.
|
||||
# This can also be an environment variable.
|
||||
# NANOVDB_FOUND, If false, do not try to use NanoVDB.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2020 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD 3-Clause License,
|
||||
# see accompanying file BSD-3-Clause-license.txt for details.
|
||||
#=============================================================================
|
||||
|
||||
# If NANOVDB_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT NANOVDB_ROOT_DIR AND NOT $ENV{NANOVDB_ROOT_DIR} STREQUAL "")
|
||||
SET(NANOVDB_ROOT_DIR $ENV{NANOVDB_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_nanovdb_SEARCH_DIRS
|
||||
${NANOVDB_ROOT_DIR}
|
||||
)
|
||||
|
||||
FIND_PATH(NANOVDB_INCLUDE_DIR
|
||||
NAMES
|
||||
nanovdb/NanoVDB.h
|
||||
HINTS
|
||||
${_nanovdb_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set NANOVDB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NanoVDB DEFAULT_MSG
|
||||
NANOVDB_INCLUDE_DIR)
|
||||
|
||||
IF(NANOVDB_FOUND)
|
||||
SET(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
|
||||
ENDIF(NANOVDB_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
NANOVDB_INCLUDE_DIR
|
||||
)
|
||||
|
||||
UNSET(_nanovdb_SEARCH_DIRS)
|
@@ -95,7 +95,7 @@ IF(OSL_FOUND)
|
||||
"\\1" OSL_LIBRARY_VERSION_MAJOR ${OSL_LIBRARY_VERSION_MAJOR})
|
||||
STRING(REGEX REPLACE ".*#define[ \t]+OSL_LIBRARY_VERSION_MINOR[ \t]+([.0-9]+).*"
|
||||
"\\1" OSL_LIBRARY_VERSION_MINOR ${OSL_LIBRARY_VERSION_MINOR})
|
||||
ENDIF()
|
||||
ENDIF(OSL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OSL_INCLUDE_DIR
|
||||
|
@@ -129,7 +129,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenCOLLADA DEFAULT_MSG
|
||||
IF(OPENCOLLADA_FOUND)
|
||||
SET(OPENCOLLADA_LIBRARIES ${_opencollada_LIBRARIES})
|
||||
SET(OPENCOLLADA_INCLUDE_DIRS ${_opencollada_INCLUDES})
|
||||
ENDIF()
|
||||
ENDIF(OPENCOLLADA_FOUND)
|
||||
|
||||
UNSET(COMPONENT)
|
||||
UNSET(UPPERCOMPONENT)
|
||||
|
@@ -70,7 +70,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
|
||||
IF(OPENCOLORIO_FOUND)
|
||||
SET(OPENCOLORIO_LIBRARIES ${_opencolorio_LIBRARIES})
|
||||
SET(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(OPENCOLORIO_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENCOLORIO_INCLUDE_DIR
|
||||
|
@@ -65,7 +65,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenJPEG DEFAULT_MSG
|
||||
IF(OPENJPEG_FOUND)
|
||||
SET(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY})
|
||||
SET(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(OPENJPEG_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENJPEG_INCLUDE_DIR
|
||||
|
@@ -90,7 +90,7 @@ IF(OPENSUBDIV_FOUND)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("cudaEvaluator.h" OPENSUBDIV_HAS_CUDA)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("glXFBEvaluator.h" OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
|
||||
OPENSUBDIV_CHECK_CONTROLLER("glComputeEvaluator.h" OPENSUBDIV_HAS_GLSL_COMPUTE)
|
||||
ENDIF()
|
||||
ENDIF(OPENSUBDIV_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENSUBDIV_INCLUDE_DIR
|
||||
|
@@ -55,7 +55,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenVDB DEFAULT_MSG
|
||||
IF(OPENVDB_FOUND)
|
||||
SET(OPENVDB_LIBRARIES ${OPENVDB_LIBRARY})
|
||||
SET(OPENVDB_INCLUDE_DIRS ${OPENVDB_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(OPENVDB_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPENVDB_INCLUDE_DIR
|
||||
|
@@ -41,7 +41,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OptiX DEFAULT_MSG
|
||||
|
||||
IF(OPTIX_FOUND)
|
||||
SET(OPTIX_INCLUDE_DIRS ${OPTIX_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(OPTIX_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
OPTIX_INCLUDE_DIR
|
||||
|
@@ -57,7 +57,7 @@ SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
|
||||
|
||||
IF(PCRE_FOUND)
|
||||
SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(PCRE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
PCRE_INCLUDE_DIR
|
||||
|
@@ -1,65 +0,0 @@
|
||||
# - Find potrace library
|
||||
# Find the potrace include and library
|
||||
# This module defines
|
||||
# POTRACE_INCLUDE_DIRS, where to find potracelib.h, Set when
|
||||
# POTRACE is found.
|
||||
# POTRACE_LIBRARIES, libraries to link against to use POTRACE.
|
||||
# POTRACE_ROOT_DIR, The base directory to search for POTRACE.
|
||||
# This can also be an environment variable.
|
||||
# POTRACE_FOUND, If false, do not try to use POTRACE.
|
||||
#
|
||||
# also defined, but not for general use are
|
||||
# POTRACE_LIBRARY, where to find the POTRACE library.
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2020 Blender Foundation.
|
||||
#
|
||||
# Distributed under the OSI-approved BSD 3-Clause License,
|
||||
# see accompanying file BSD-3-Clause-license.txt for details.
|
||||
#=============================================================================
|
||||
|
||||
# If POTRACE_ROOT_DIR was defined in the environment, use it.
|
||||
IF(NOT POTRACE_ROOT_DIR AND NOT $ENV{POTRACE_ROOT_DIR} STREQUAL "")
|
||||
SET(POTRACE_ROOT_DIR $ENV{POTRACE_ROOT_DIR})
|
||||
ENDIF()
|
||||
|
||||
SET(_potrace_SEARCH_DIRS
|
||||
${POTRACE_ROOT_DIR}
|
||||
/opt/lib/potrace
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
FIND_PATH(POTRACE_INCLUDE_DIR
|
||||
NAMES
|
||||
potracelib.h
|
||||
HINTS
|
||||
${_potrace_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(POTRACE_LIBRARY
|
||||
NAMES
|
||||
potrace
|
||||
HINTS
|
||||
${_potrace_SEARCH_DIRS}
|
||||
PATH_SUFFIXES
|
||||
lib64 lib
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set POTRACE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Potrace DEFAULT_MSG
|
||||
POTRACE_LIBRARY POTRACE_INCLUDE_DIR)
|
||||
|
||||
IF(POTRACE_FOUND)
|
||||
SET(POTRACE_LIBRARIES ${POTRACE_LIBRARY})
|
||||
SET(POTRACE_INCLUDE_DIRS ${POTRACE_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
POTRACE_INCLUDE_DIR
|
||||
POTRACE_LIBRARY
|
||||
)
|
@@ -53,7 +53,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 DEFAULT_MSG
|
||||
IF(SDL2_FOUND)
|
||||
SET(SDL2_LIBRARIES ${SDL2_LIBRARY})
|
||||
SET(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(SDL2_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
SDL2_INCLUDE_DIR
|
||||
|
@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SndFile DEFAULT_MSG
|
||||
IF(SNDFILE_FOUND)
|
||||
SET(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY})
|
||||
SET(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(SNDFILE_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
LIBSNDFILE_INCLUDE_DIR
|
||||
|
@@ -54,7 +54,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spacenav DEFAULT_MSG
|
||||
IF(SPACENAV_FOUND)
|
||||
SET(SPACENAV_LIBRARIES ${SPACENAV_LIBRARY})
|
||||
SET(SPACENAV_INCLUDE_DIRS ${SPACENAV_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(SPACENAV_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
SPACENAV_INCLUDE_DIR
|
||||
|
@@ -59,7 +59,7 @@ ELSE()
|
||||
get_filename_component(USD_LIBRARY_DIR ${USD_LIBRARY} DIRECTORY)
|
||||
SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
|
||||
set(USD_LIBRARIES ${USD_LIBRARY})
|
||||
ENDIF()
|
||||
ENDIF(USD_FOUND)
|
||||
ENDIF()
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
|
@@ -52,7 +52,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG
|
||||
IF(XML2_FOUND)
|
||||
SET(XML2_LIBRARIES ${XML2_LIBRARY})
|
||||
SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(XML2_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
XML2_INCLUDE_DIR
|
||||
|
@@ -61,7 +61,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XR_OpenXR_SDK DEFAULT_MSG
|
||||
IF(XR_OPENXR_SDK_FOUND)
|
||||
SET(XR_OPENXR_SDK_LIBRARIES ${XR_OPENXR_SDK_LOADER_LIBRARY})
|
||||
SET(XR_OPENXR_SDK_INCLUDE_DIRS ${XR_OPENXR_SDK_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(XR_OPENXR_SDK_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
XR_OPENXR_SDK_INCLUDE_DIR
|
||||
|
@@ -39,7 +39,6 @@ macro(BLENDER_SRC_GTEST_EX)
|
||||
add_definitions(${GLOG_DEFINES})
|
||||
|
||||
add_executable(${TARGET_NAME} ${ARG_SRC} ${MANIFEST})
|
||||
setup_platform_linker_flags(${TARGET_NAME})
|
||||
target_include_directories(${TARGET_NAME} PUBLIC "${TEST_INC}")
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${TEST_INC_SYS}")
|
||||
target_link_libraries(${TARGET_NAME} ${ARG_EXTRA_LIBS} ${PLATFORM_LINKLIBS})
|
||||
|
@@ -355,8 +355,6 @@ def recursive_arg_sizes(node, ):
|
||||
# print("adding", node.spelling)
|
||||
for c in node.get_children():
|
||||
recursive_arg_sizes(c)
|
||||
|
||||
|
||||
# cache function sizes
|
||||
recursive_arg_sizes(tu.cursor)
|
||||
_defs.update(defs_precalc)
|
||||
|
@@ -21,7 +21,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
import sys
|
||||
if sys.version_info.major < 3:
|
||||
if not sys.version.startswith("3"):
|
||||
print("\nPython3.x needed, found %s.\nAborting!\n" %
|
||||
sys.version.partition(" ")[0])
|
||||
sys.exit(1)
|
||||
|
@@ -182,7 +182,7 @@ def create_nb_project_main():
|
||||
f.write(' </logicalFolder>\n')
|
||||
# default, but this dir is infact not in blender dir so we can ignore it
|
||||
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
|
||||
f.write(r' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
|
||||
f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
|
||||
|
||||
f.write(' <sourceRootList>\n')
|
||||
f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel
|
||||
|
@@ -8,7 +8,6 @@ import sys
|
||||
|
||||
cmakelists_file = sys.argv[-1]
|
||||
|
||||
|
||||
def main():
|
||||
options = []
|
||||
for l in open(cmakelists_file, 'r').readlines():
|
||||
|
@@ -5,22 +5,24 @@
|
||||
#
|
||||
|
||||
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_BULLET ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_CINEON ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_DDS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_HDR ON CACHE BOOL "" FORCE)
|
||||
@@ -29,13 +31,12 @@ set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZMA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
|
||||
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
|
||||
@@ -44,7 +45,6 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
|
||||
set(WITH_SDL ON CACHE BOOL "" FORCE)
|
||||
|
@@ -7,7 +7,6 @@
|
||||
|
||||
set(WITH_INSTALL_PORTABLE ON CACHE BOOL "" FORCE)
|
||||
|
||||
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BOOST OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO OFF CACHE BOOL "" FORCE)
|
||||
@@ -15,17 +14,20 @@ set(WITH_BULLET OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_FFMPEG OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_EMBREE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_DEVICE_OPTIX OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_SOLVER OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_ITASC OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_CINEON OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_DDS OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_HDR OFF CACHE BOOL "" FORCE)
|
||||
@@ -35,13 +37,12 @@ set(WITH_IMAGE_TIFF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_JACK OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LLVM OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LZMA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_LZO OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_FLUID OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_OCEANSIM OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_AUDASPACE OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -4,7 +4,6 @@
|
||||
# cmake -C../blender/build_files/cmake/config/blender_release.cmake ../blender
|
||||
#
|
||||
|
||||
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_ALEMBIC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_ASSERT_ABORT OFF CACHE BOOL "" FORCE)
|
||||
set(WITH_BUILDINFO ON CACHE BOOL "" FORCE)
|
||||
@@ -12,12 +11,15 @@ set(WITH_BULLET ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_AVI ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_FFMPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CODEC_SNDFILE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_EMBREE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_CYCLES_OSL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_DRACO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FFTW3 ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_COMPOSITOR ON CACHE BOOL "" FORCE)
|
||||
set(WITH_FREESTYLE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_GMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IK_SOLVER ON CACHE BOOL "" FORCE)
|
||||
@@ -30,13 +32,12 @@ set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
||||
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
||||
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZMA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_LZO ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_FLUID ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_OCEANSIM ON CACHE BOOL "" FORCE)
|
||||
set(WITH_MOD_REMESH ON CACHE BOOL "" FORCE)
|
||||
set(WITH_AUDASPACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENAL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLLADA ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENCOLORIO ON CACHE BOOL "" FORCE)
|
||||
@@ -45,7 +46,6 @@ set(WITH_OPENMP ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB ON CACHE BOOL "" FORCE)
|
||||
set(WITH_OPENVDB_BLOSC ON CACHE BOOL "" FORCE)
|
||||
set(WITH_POTRACE ON CACHE BOOL "" FORCE)
|
||||
set(WITH_PYTHON_INSTALL ON CACHE BOOL "" FORCE)
|
||||
set(WITH_QUADRIFLOW ON CACHE BOOL "" FORCE)
|
||||
set(WITH_SDL ON CACHE BOOL "" FORCE)
|
||||
|
@@ -33,9 +33,18 @@ set(WITH_ALEMBIC OFF CACHE BOOL "" FORCE)
|
||||
# Depends on Python install, do this to quiet warning.
|
||||
set(WITH_DRACO OFF CACHE BOOL "" FORCE)
|
||||
|
||||
# Jemalloc does not work with dlopen() of Python modules:
|
||||
# https://github.com/jemalloc/jemalloc/issues/1237
|
||||
# Note, if linking errors can be resolved, lines below can be removed.
|
||||
# Until then, disable configurations known to fail.
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# jemalloc causes linking error on import, disable.
|
||||
set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
# OpenMP causes linking error on build, disable.
|
||||
set(WITH_MEM_JEMALLOC OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(WITH_WINDOWS_BUNDLE_CRT OFF CACHE BOOL "" FORCE)
|
||||
|
@@ -114,6 +114,5 @@ def main():
|
||||
import subprocess
|
||||
subprocess.call(cmd)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -375,8 +375,9 @@ function(blender_add_lib
|
||||
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
||||
endfunction()
|
||||
|
||||
# Add tests for a Blender library, to be called in tandem with blender_add_lib().
|
||||
# The tests will be part of the blender_test executable (see tests/gtests/runner).
|
||||
# blender_add_test_lib() is used to define a test library. It is intended to be
|
||||
# called in tandem with blender_add_lib(). The test library will be linked into
|
||||
# the bf_gtest_runner_test executable (see tests/gtests/CMakeLists.txt).
|
||||
function(blender_add_test_lib
|
||||
name
|
||||
sources
|
||||
@@ -410,48 +411,6 @@ function(blender_add_test_lib
|
||||
set_property(GLOBAL APPEND PROPERTY BLENDER_TEST_LIBS ${name})
|
||||
endfunction()
|
||||
|
||||
|
||||
# Add tests for a Blender library, to be called in tandem with blender_add_lib().
|
||||
# Test will be compiled into a ${name}_test executable.
|
||||
#
|
||||
# To be used for smaller isolated libraries, that do not have many dependencies.
|
||||
# For libraries that do drag in many other Blender libraries and would create a
|
||||
# very large executable, blender_add_test_lib() should be used instead.
|
||||
function(blender_add_test_executable
|
||||
name
|
||||
sources
|
||||
includes
|
||||
includes_sys
|
||||
library_deps
|
||||
)
|
||||
|
||||
add_cc_flags_custom_test(${name} PARENT_SCOPE)
|
||||
|
||||
## Otherwise external projects will produce warnings that we cannot fix.
|
||||
remove_strict_flags()
|
||||
|
||||
include_directories(${includes})
|
||||
include_directories(${includes_sys})
|
||||
setup_libdirs()
|
||||
|
||||
BLENDER_SRC_GTEST_EX(
|
||||
NAME ${name}
|
||||
SRC "${sources}"
|
||||
EXTRA_LIBS "${library_deps}"
|
||||
SKIP_ADD_TEST
|
||||
)
|
||||
|
||||
include(GTest)
|
||||
set(_GOOGLETEST_DISCOVER_TESTS_SCRIPT
|
||||
${CMAKE_SOURCE_DIR}/build_files/cmake/Modules/GTestAddTests.cmake
|
||||
)
|
||||
|
||||
gtest_discover_tests(${name}_test
|
||||
DISCOVERY_MODE PRE_TEST
|
||||
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# Ninja only: assign 'heavy pool' to some targets that are especially RAM-consuming to build.
|
||||
function(setup_heavy_lib_pool)
|
||||
if(WITH_NINJA_POOL_JOBS AND NINJA_MAX_NUM_PARALLEL_COMPILE_HEAVY_JOBS)
|
||||
@@ -555,18 +514,33 @@ function(SETUP_LIBDIRS)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Platform specific linker flags for targets.
|
||||
function(setup_platform_linker_flags
|
||||
target)
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${PLATFORM_LINKFLAGS}")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_RELEASE " ${PLATFORM_LINKFLAGS_RELEASE}")
|
||||
set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS_DEBUG " ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
endfunction()
|
||||
macro(setup_platform_linker_flags)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
||||
endmacro()
|
||||
|
||||
# Platform specific libraries for targets.
|
||||
function(setup_platform_linker_libs
|
||||
function(setup_liblinks
|
||||
target
|
||||
)
|
||||
|
||||
# NOTE: This might look like it affects global scope, accumulating linker flags on every call
|
||||
# to setup_liblinks, but this isn't how CMake works. These flags will only affect current
|
||||
# directory from where the function is called.
|
||||
# This means that setup_liblinks() called for ffmpeg_test will not affect blender, and each
|
||||
# of thsoe targets will have single set of linker flags.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
|
||||
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}" PARENT_SCOPE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}" PARENT_SCOPE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${PLATFORM_LINKFLAGS_RELEASE}" PARENT_SCOPE)
|
||||
|
||||
# jemalloc must be early in the list, to be before pthread (see T57998)
|
||||
if(WITH_MEM_JEMALLOC)
|
||||
target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
|
||||
|
@@ -86,7 +86,7 @@ if(WIN32)
|
||||
set(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
|
||||
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
|
||||
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/release/license/GPL-3.0.txt)
|
||||
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/release/text/GPL3-license.txt)
|
||||
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.ico)
|
||||
|
||||
set(BLENDER_NAMESPACE_GUID "507F933F-5898-404A-9A05-18282FD491A6")
|
||||
|
@@ -190,7 +190,7 @@ if(SYSTEMSTUBS_LIBRARY)
|
||||
list(APPEND PLATFORM_LINKLIBS SystemStubs)
|
||||
endif()
|
||||
|
||||
set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -pipe -funsigned-char")
|
||||
set(PLATFORM_CFLAGS "-pipe -funsigned-char")
|
||||
set(PLATFORM_LINKFLAGS
|
||||
"-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework Metal -framework QuartzCore"
|
||||
)
|
||||
@@ -323,11 +323,6 @@ if(WITH_OPENVDB)
|
||||
set(OPENVDB_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
set(NANOVDB ${LIBDIR}/nanovdb)
|
||||
set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
|
||||
endif()
|
||||
|
||||
if(WITH_LLVM)
|
||||
set(LLVM_ROOT_DIR ${LIBDIR}/llvm)
|
||||
if(EXISTS "${LLVM_ROOT_DIR}/bin/llvm-config")
|
||||
@@ -397,16 +392,6 @@ endif()
|
||||
if(WITH_CYCLES_EMBREE)
|
||||
find_package(Embree 3.8.0 REQUIRED)
|
||||
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Xlinker -stack_size -Xlinker 0x100000")
|
||||
|
||||
# Embree static library linking can mix up SSE and AVX symbols, causing
|
||||
# crashes on macOS systems with older CPUs that don't have AVX. Using
|
||||
# force load avoids that. The Embree shared library does not suffer from
|
||||
# this problem, precisely because linking a shared library uses force load.
|
||||
set(_embree_libraries_force_load)
|
||||
foreach(_embree_library ${EMBREE_LIBRARIES})
|
||||
list(APPEND _embree_libraries_force_load "-Wl,-force_load,${_embree_library}")
|
||||
endforeach()
|
||||
set(EMBREE_LIBRARIES ${_embree_libraries_force_load})
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
@@ -422,11 +407,12 @@ if(WITH_TBB)
|
||||
find_package(TBB)
|
||||
endif()
|
||||
|
||||
if(WITH_POTRACE)
|
||||
find_package(Potrace)
|
||||
if(NOT POTRACE_FOUND)
|
||||
message(WARNING "potrace not found, disabling WITH_POTRACE")
|
||||
set(WITH_POTRACE OFF)
|
||||
if(WITH_GMP)
|
||||
find_package(GMP)
|
||||
|
||||
if(NOT GMP_FOUND)
|
||||
set(WITH_GMP OFF)
|
||||
message(STATUS "GMP not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -52,19 +52,12 @@ if(EXISTS ${LIBDIR})
|
||||
message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
|
||||
|
||||
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
|
||||
# Ignore Mesa software OpenGL libraries, they are not intended to be
|
||||
# linked against but to optionally override at runtime.
|
||||
list(REMOVE_ITEM LIB_SUBDIRS ${LIBDIR}/mesa)
|
||||
# NOTE: Make sure "proper" compiled zlib comes first before the one
|
||||
# which is a part of OpenCollada. They have different ABI, and we
|
||||
# do need to use the official one.
|
||||
set(CMAKE_PREFIX_PATH ${LIBDIR}/zlib ${LIB_SUBDIRS})
|
||||
set(WITH_STATIC_LIBS ON)
|
||||
# OpenMP usually can't be statically linked into shared libraries,
|
||||
# due to not being compiled with position independent code.
|
||||
if(NOT WITH_PYTHON_MODULE)
|
||||
set(WITH_OPENMP_STATIC ON)
|
||||
endif()
|
||||
set(Boost_NO_BOOST_CMAKE ON)
|
||||
set(BOOST_ROOT ${LIBDIR}/boost)
|
||||
set(BOOST_LIBRARYDIR ${LIBDIR}/boost/lib)
|
||||
@@ -264,7 +257,6 @@ endif()
|
||||
if(WITH_OPENVDB)
|
||||
find_package_wrapper(OpenVDB)
|
||||
find_package_wrapper(Blosc)
|
||||
|
||||
if(NOT OPENVDB_FOUND)
|
||||
set(WITH_OPENVDB OFF)
|
||||
set(WITH_OPENVDB_BLOSC OFF)
|
||||
@@ -275,15 +267,6 @@ if(WITH_OPENVDB)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
find_package_wrapper(NanoVDB)
|
||||
|
||||
if(NOT NANOVDB_FOUND)
|
||||
set(WITH_NANOVDB OFF)
|
||||
message(STATUS "NanoVDB not found, disabling it")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_ALEMBIC)
|
||||
find_package_wrapper(Alembic)
|
||||
|
||||
@@ -444,6 +427,15 @@ if(WITH_TBB)
|
||||
find_package_wrapper(TBB)
|
||||
endif()
|
||||
|
||||
if(WITH_GMP)
|
||||
find_package(GMP)
|
||||
|
||||
if(NOT GMP_FOUND)
|
||||
set(WITH_GMP OFF)
|
||||
message(STATUS "GMP not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_XR_OPENXR)
|
||||
find_package(XR_OpenXR_SDK)
|
||||
if(NOT XR_OPENXR_SDK_FOUND)
|
||||
@@ -460,14 +452,6 @@ if(WITH_GMP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_POTRACE)
|
||||
find_package_wrapper(Potrace)
|
||||
if(NOT POTRACE_FOUND)
|
||||
message(WARNING "potrace not found, disabling WITH_POTRACE")
|
||||
set(WITH_POTRACE OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS ${LIBDIR})
|
||||
without_system_libs_end()
|
||||
endif()
|
||||
|
@@ -535,11 +535,6 @@ if(WITH_OPENVDB)
|
||||
set(OPENVDB_DEFINITIONS -DNOMINMAX -D_USE_MATH_DEFINES)
|
||||
endif()
|
||||
|
||||
if(WITH_NANOVDB)
|
||||
set(NANOVDB ${LIBDIR}/nanoVDB)
|
||||
set(NANOVDB_INCLUDE_DIR ${NANOVDB}/include)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENIMAGEDENOISE)
|
||||
set(OPENIMAGEDENOISE ${LIBDIR}/OpenImageDenoise)
|
||||
set(OPENIMAGEDENOISE_LIBPATH ${LIBDIR}/OpenImageDenoise/lib)
|
||||
@@ -570,7 +565,7 @@ if(WITH_IMAGE_OPENJPEG)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENSUBDIV)
|
||||
set(OPENSUBDIV_INCLUDE_DIRS ${LIBDIR}/opensubdiv/include)
|
||||
set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
|
||||
set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
|
||||
set(OPENSUBDIV_LIBRARIES
|
||||
optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
|
||||
@@ -765,9 +760,3 @@ if(WITH_GMP)
|
||||
set(GMP_ROOT_DIR ${LIBDIR}/gmp)
|
||||
set(GMP_FOUND On)
|
||||
endif()
|
||||
|
||||
if(WITH_POTRACE)
|
||||
set(POTRACE_INCLUDE_DIRS ${LIBDIR}/potrace/include)
|
||||
set(POTRACE_LIBRARIES ${LIBDIR}/potrace/lib/potrace.lib)
|
||||
set(POTRACE_FOUND On)
|
||||
endif()
|
||||
|
@@ -5,14 +5,6 @@ if(WITH_WINDOWS_BUNDLE_CRT)
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
||||
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
|
||||
set(CMAKE_INSTALL_OPENMP_LIBRARIES ${WITH_OPENMP})
|
||||
|
||||
# This sometimes can change when updates are installed and the compiler version
|
||||
# changes, so test if it exists and if not, give InstallRequiredSystemLibraries
|
||||
# another chance to figure out the path.
|
||||
if(MSVC_REDIST_DIR AND NOT EXISTS "${MSVC_REDIST_DIR}")
|
||||
unset(MSVC_REDIST_DIR CACHE)
|
||||
endif()
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
# Install the CRT to the blender.crt Sub folder.
|
||||
|
@@ -25,8 +25,8 @@ __all__ = (
|
||||
|
||||
|
||||
import sys
|
||||
if sys.version_info.major < 3:
|
||||
print("\nPython3.x or newer needed, found %s.\nAborting!\n" %
|
||||
if not sys.version.startswith("3"):
|
||||
print("\nPython3.x needed, found %s.\nAborting!\n" %
|
||||
sys.version.partition(" ")[0])
|
||||
sys.exit(1)
|
||||
|
||||
@@ -242,6 +242,5 @@ def main():
|
||||
for s in build_info():
|
||||
print(s)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@@ -12,7 +12,6 @@ from make_utils import call
|
||||
|
||||
# Parse arguments
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--ctest-command", default="ctest")
|
||||
@@ -23,7 +22,6 @@ def parse_arguments():
|
||||
parser.add_argument("build_directory")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
args = parse_arguments()
|
||||
git_command = args.git_command
|
||||
svn_command = args.svn_command
|
||||
|
@@ -14,15 +14,12 @@ import sys
|
||||
import make_utils
|
||||
from make_utils import call, check_output
|
||||
|
||||
|
||||
def print_stage(text):
|
||||
print("")
|
||||
print(text)
|
||||
print("")
|
||||
|
||||
# Parse arguments
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--no-libraries", action="store_true")
|
||||
@@ -34,13 +31,10 @@ def parse_arguments():
|
||||
parser.add_argument("--use-centos-libraries", action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_blender_git_root():
|
||||
return check_output([args.git_command, "rev-parse", "--show-toplevel"])
|
||||
|
||||
# Setup for precompiled libraries and tests from svn.
|
||||
|
||||
|
||||
def svn_update(args, release_version):
|
||||
svn_non_interactive = [args.svn_command, '--non-interactive']
|
||||
|
||||
@@ -104,10 +98,8 @@ def svn_update(args, release_version):
|
||||
svn_dirpath = os.path.join(dirpath, ".svn")
|
||||
svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
|
||||
|
||||
if (
|
||||
os.path.isdir(dirpath) and
|
||||
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath))
|
||||
):
|
||||
if os.path.isdir(dirpath) and \
|
||||
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)):
|
||||
if make_utils.command_missing(args.svn_command):
|
||||
sys.stderr.write("svn not found, can't update libraries\n")
|
||||
sys.exit(1)
|
||||
@@ -129,11 +121,9 @@ def git_update_skip(args, check_remote_exists=True):
|
||||
rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False)
|
||||
rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False)
|
||||
merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False)
|
||||
if (
|
||||
os.path.exists(rebase_merge) or
|
||||
os.path.exists(rebase_apply) or
|
||||
os.path.exists(merge_head)
|
||||
):
|
||||
if os.path.exists(rebase_merge) or \
|
||||
os.path.exists(rebase_apply) or \
|
||||
os.path.exists(merge_head):
|
||||
return "rebase or merge in progress, complete it first"
|
||||
|
||||
# Abort if uncommitted changes.
|
||||
@@ -150,7 +140,6 @@ def git_update_skip(args, check_remote_exists=True):
|
||||
|
||||
return ""
|
||||
|
||||
|
||||
# Update blender repository.
|
||||
def blender_update(args):
|
||||
print_stage("Updating Blender Git Repository")
|
||||
|
@@ -7,7 +7,6 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def call(cmd, exit_on_error=True):
|
||||
print(" ".join(cmd))
|
||||
|
||||
@@ -20,7 +19,6 @@ def call(cmd, exit_on_error=True):
|
||||
sys.exit(retcode)
|
||||
return retcode
|
||||
|
||||
|
||||
def check_output(cmd, exit_on_error=True):
|
||||
# Flush to ensure correct order output on Windows.
|
||||
sys.stdout.flush()
|
||||
@@ -37,7 +35,6 @@ def check_output(cmd, exit_on_error=True):
|
||||
|
||||
return output.strip()
|
||||
|
||||
|
||||
def git_branch(git_command):
|
||||
# Get current branch name.
|
||||
try:
|
||||
@@ -48,7 +45,6 @@ def git_branch(git_command):
|
||||
|
||||
return branch.strip().decode('utf8')
|
||||
|
||||
|
||||
def git_tag(git_command):
|
||||
# Get current tag name.
|
||||
try:
|
||||
@@ -58,18 +54,16 @@ def git_tag(git_command):
|
||||
|
||||
return tag.strip().decode('utf8')
|
||||
|
||||
|
||||
def git_branch_release_version(branch, tag):
|
||||
release_version = re.search("^blender-v(.*)-release$", branch)
|
||||
if release_version:
|
||||
release_version = release_version.group(1)
|
||||
elif tag:
|
||||
release_version = re.search(r"^v([0-9]*\.[0-9]*).*", tag)
|
||||
release_version = re.search("^v([0-9]*\.[0-9]*).*", tag)
|
||||
if release_version:
|
||||
release_version = release_version.group(1)
|
||||
return release_version
|
||||
|
||||
|
||||
def svn_libraries_base_url(release_version):
|
||||
if release_version:
|
||||
svn_branch = "tags/blender-" + release_version + "-release"
|
||||
@@ -77,7 +71,6 @@ def svn_libraries_base_url(release_version):
|
||||
svn_branch = "trunk"
|
||||
return "https://svn.blender.org/svnroot/bf-blender/" + svn_branch + "/lib/"
|
||||
|
||||
|
||||
def command_missing(command):
|
||||
# Support running with Python 2 for macOS
|
||||
if sys.version_info >= (3, 0):
|
||||
|
@@ -1,6 +1,6 @@
|
||||
"""
|
||||
Introduction
|
||||
------------
|
||||
Intro
|
||||
-----
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -9,8 +9,9 @@ Introduction
|
||||
and the :func:`register`/:func:`unregister` functions! The :func:`pgettext` family of functions
|
||||
should only be used in rare, specific cases (like e.g. complex "composited" UI strings...).
|
||||
|
||||
To add translations to your python script, you must define a dictionary formatted like that:
|
||||
``{locale: {msg_key: msg_translation, ...}, ...}`` where:
|
||||
| To add translations to your python script, you must define a dictionary formatted like that:
|
||||
| ``{locale: {msg_key: msg_translation, ...}, ...}``
|
||||
| where:
|
||||
|
||||
- locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),
|
||||
a lang+variant code (e.g. ``sr@latin``), or a full code (e.g. ``uz_UZ@cyrilic``).
|
||||
|
@@ -677,8 +677,7 @@ Here are some general hints to avoid running into these problems:
|
||||
Undo/Redo
|
||||
---------
|
||||
|
||||
For safety, you should assume that undo and redo always invalidates all :class:`bpy.types.ID`
|
||||
instances (Object, Scene, Mesh, Light, etc.), as weel obviously as all of their sub-data.
|
||||
Undo invalidates all :class:`bpy.types.ID` instances (Object, Scene, Mesh, Light, etc.).
|
||||
|
||||
This example shows how you can tell undo changes the memory locations:
|
||||
|
||||
@@ -687,7 +686,7 @@ This example shows how you can tell undo changes the memory locations:
|
||||
>>> hash(bpy.context.object)
|
||||
-9223372036849950810
|
||||
|
||||
Delete the active object, then undo:
|
||||
Move the active object, then undo:
|
||||
|
||||
>>> hash(bpy.context.object)
|
||||
-9223372036849951740
|
||||
@@ -696,16 +695,6 @@ As suggested above, simply not holding references to data when Blender is used
|
||||
interactively by the user is the only way to make sure that the script doesn't become unstable.
|
||||
|
||||
|
||||
.. note::
|
||||
|
||||
Modern undo/redo system does not systematically invalidate all pointers anymore.
|
||||
Some data (in fact, most data, in typical cases), which were detected as unchanged for a
|
||||
particular history step, may remain unchanged and hence their pointers may remain valid.
|
||||
|
||||
Be aware that if you want to take advantage of this behavior for some reason, there is no
|
||||
guarantee of any kind that it will be safe and consistent. Use it at your own risk.
|
||||
|
||||
|
||||
Undo & Library Data
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -723,17 +712,6 @@ So it's best to consider modifying library data an advanced usage of the API
|
||||
and only to use it when you know what you're doing.
|
||||
|
||||
|
||||
Abusing RNA property callbacks
|
||||
------------------------------
|
||||
|
||||
Python-defined RNA properties can have custom callbacks. Trying to perform complex operations
|
||||
from there, like calling an operator, may work, but is not officialy recommended nor supported.
|
||||
|
||||
Main reason is that those callback should be very fast, but additionally, it may for example
|
||||
create issues with undo/redo system (most operators store an history step, and editing an RNA
|
||||
property does so as well), trigger infinite update loops, and so on.
|
||||
|
||||
|
||||
Edit-Mode / Memory Access
|
||||
-------------------------
|
||||
|
||||
|
@@ -41,7 +41,8 @@ Sphinx: HTML generation
|
||||
After you have built doc/python_api/sphinx-in (see above),
|
||||
generate html docs by running:
|
||||
|
||||
sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
|
||||
cd doc/python_api
|
||||
sphinx-build sphinx-in sphinx-out
|
||||
|
||||
|
||||
Sphinx: PDF generation
|
||||
@@ -98,7 +99,6 @@ SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
# See: D6261 for reference.
|
||||
USE_ONLY_BUILTIN_RNA_TYPES = True
|
||||
|
||||
|
||||
def handle_args():
|
||||
'''
|
||||
Parse the args passed to Blender after "--", ignored by Blender
|
||||
@@ -173,7 +173,7 @@ def handle_args():
|
||||
dest="log",
|
||||
default=False,
|
||||
action='store_true',
|
||||
help="Log the output of the API dump and sphinx|latex "
|
||||
help="Log the output of the api dump and sphinx|latex "
|
||||
"warnings and errors (default=False).\n"
|
||||
"If given, save logs in:\n"
|
||||
"* OUTPUT_DIR/.bpy.log\n"
|
||||
@@ -350,9 +350,9 @@ RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
|
||||
# stored in ./rst/info_*
|
||||
INFO_DOCS = (
|
||||
("info_quickstart.rst",
|
||||
"Quickstart: New to Blender or scripting and want to get your feet wet?"),
|
||||
"Quickstart: new to Blender or scripting and want to get your feet wet?"),
|
||||
("info_overview.rst",
|
||||
"API Overview: A more complete explanation of Python integration"),
|
||||
"API Overview: a more complete explanation of Python integration"),
|
||||
("info_api_reference.rst",
|
||||
"API Reference Usage: examples of how to use the API reference docs"),
|
||||
("info_best_practice.rst",
|
||||
@@ -360,8 +360,8 @@ INFO_DOCS = (
|
||||
("info_tips_and_tricks.rst",
|
||||
"Tips and Tricks: Hints to help you while writing scripts for Blender"),
|
||||
("info_gotcha.rst",
|
||||
"Gotcha's: Some of the problems you may encounter when writing scripts"),
|
||||
("change_log.rst", "Change Log: List of changes since last Blender release"),
|
||||
"Gotcha's: some of the problems you may encounter when writing scripts"),
|
||||
("change_log.rst", "List of changes since last Blender release"),
|
||||
)
|
||||
|
||||
# only support for properties atm.
|
||||
@@ -1095,7 +1095,7 @@ def pycontext2sphinx(basepath):
|
||||
fw("The context members available depend on the area of Blender which is currently being accessed.\n")
|
||||
fw("\n")
|
||||
fw("Note that all context values are readonly,\n")
|
||||
fw("but may be modified through the data API or by running operators\n\n")
|
||||
fw("but may be modified through the data api or by running operators\n\n")
|
||||
|
||||
def write_contex_cls():
|
||||
|
||||
@@ -1312,7 +1312,7 @@ def pyrna2sphinx(basepath):
|
||||
|
||||
fw(title_string(title, "="))
|
||||
|
||||
fw(".. module:: %s\n\n" % struct_module_name)
|
||||
fw(".. module:: %s.%s\n\n" % (struct_module_name, struct_id))
|
||||
|
||||
# docs first?, ok
|
||||
write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id))
|
||||
@@ -1543,7 +1543,7 @@ def pyrna2sphinx(basepath):
|
||||
|
||||
fw(title_string(class_name, "="))
|
||||
|
||||
fw(".. module:: %s\n" % class_module_name)
|
||||
fw(".. module:: %s.%s\n" % (class_module_name, class_name))
|
||||
fw("\n")
|
||||
|
||||
if use_subclasses:
|
||||
@@ -2227,7 +2227,7 @@ def main():
|
||||
shutil.rmtree(REFERENCE_PATH, True)
|
||||
|
||||
# copy SPHINX_OUT to the REFERENCE_PATH
|
||||
ignores = ('.doctrees', '.buildinfo')
|
||||
ignores = ('.doctrees', 'objects.inv', '.buildinfo')
|
||||
shutil.copytree(SPHINX_OUT,
|
||||
REFERENCE_PATH,
|
||||
ignore=shutil.ignore_patterns(*ignores))
|
||||
|
@@ -27,22 +27,6 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Get the number of cores for threaded build
|
||||
ifndef NPROCS
|
||||
NPROCS:=1
|
||||
ifeq ($(OS), Linux)
|
||||
NPROCS:=$(shell nproc)
|
||||
endif
|
||||
ifeq ($(OS), NetBSD)
|
||||
NPROCS:=$(shell getconf NPROCESSORS_ONLN)
|
||||
endif
|
||||
ifneq (,$(filter $(OS),Darwin FreeBSD))
|
||||
NPROCS:=$(shell sysctl -n hw.ncpu)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Blender Version & Info
|
||||
|
||||
@@ -92,7 +76,11 @@ fi
|
||||
# Generate HTML (sphinx)
|
||||
|
||||
if $DO_OUT_HTML ; then
|
||||
sphinx-build -b html -j $(NPROCS) $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
# sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
|
||||
# annoying bug in sphinx makes it very slow unless we do this. should report.
|
||||
cd $SPHINX_WORKDIR
|
||||
sphinx-build -b html sphinx-in sphinx-out
|
||||
|
||||
# XXX, saves space on upload and zip, should move HTML outside
|
||||
# and zip up there, for now this is OK
|
||||
@@ -119,7 +107,8 @@ fi
|
||||
# Generate PDF (sphinx/laytex)
|
||||
|
||||
if $DO_OUT_PDF ; then
|
||||
sphinx-build -n -b latex -j $(NPROCS) $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
cd $SPHINX_WORKDIR
|
||||
sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out
|
||||
make -C $SPHINX_WORKDIR/sphinx-out
|
||||
mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \
|
||||
$SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf
|
||||
|
8
extern/audaspace/bindings/C/AUD_Special.cpp
vendored
8
extern/audaspace/bindings/C/AUD_Special.cpp
vendored
@@ -270,7 +270,7 @@ AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, int sampl
|
||||
return length;
|
||||
}
|
||||
|
||||
AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, void(*callback)(float, void*), void* data)
|
||||
AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -280,7 +280,7 @@ AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned i
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader();
|
||||
reader->seek(start);
|
||||
std::shared_ptr<IWriter> writer = FileWriter::createWriter(filename, convCToDSpec(specs), static_cast<Container>(format), static_cast<Codec>(codec), bitrate);
|
||||
FileWriter::writeReader(reader, writer, length, buffersize, callback, data);
|
||||
FileWriter::writeReader(reader, writer, length, buffersize);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned i
|
||||
}
|
||||
}
|
||||
|
||||
AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate, void(*callback)(float, void*), void* data)
|
||||
AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length, unsigned int buffersize, const char* filename, AUD_DeviceSpecs specs, AUD_Container format, AUD_Codec codec, unsigned int bitrate)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -326,7 +326,7 @@ AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start
|
||||
|
||||
std::shared_ptr<IReader> reader = f->createQualityReader();
|
||||
reader->seek(start);
|
||||
FileWriter::writeReader(reader, writers, length, buffersize, callback, data);
|
||||
FileWriter::writeReader(reader, writers, length, buffersize);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
10
extern/audaspace/bindings/C/AUD_Special.h
vendored
10
extern/audaspace/bindings/C/AUD_Special.h
vendored
@@ -68,15 +68,12 @@ extern AUD_API int AUD_readSound(AUD_Sound* sound, float* buffer, int length, in
|
||||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \param callback A callback function that is called periodically during mixdown, reporting progress if length > 0. Can be NULL.
|
||||
* \param data Pass through parameter that is passed to the callback.
|
||||
* \return An error message or NULL in case of success.
|
||||
*/
|
||||
extern AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char* filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate,
|
||||
void(*callback)(float, void*), void* data);
|
||||
AUD_Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Mixes a sound down into multiple files.
|
||||
@@ -89,15 +86,12 @@ extern AUD_API const char* AUD_mixdown(AUD_Sound* sound, unsigned int start, uns
|
||||
* \param format The file's container format.
|
||||
* \param codec The codec used for encoding the audio data.
|
||||
* \param bitrate The bitrate for encoding.
|
||||
* \param callback A callback function that is called periodically during mixdown, reporting progress if length > 0. Can be NULL.
|
||||
* \param data Pass through parameter that is passed to the callback.
|
||||
* \return An error message or NULL in case of success.
|
||||
*/
|
||||
extern AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start, unsigned int length,
|
||||
unsigned int buffersize, const char* filename,
|
||||
AUD_DeviceSpecs specs, AUD_Container format,
|
||||
AUD_Codec codec, unsigned int bitrate,
|
||||
void(*callback)(float, void*), void* data);
|
||||
AUD_Codec codec, unsigned int bitrate);
|
||||
|
||||
/**
|
||||
* Opens a read device and prepares it for mixdown of the sound scene.
|
||||
|
4
extern/audaspace/include/file/FileWriter.h
vendored
4
extern/audaspace/include/file/FileWriter.h
vendored
@@ -63,7 +63,7 @@ public:
|
||||
* \param length How many samples should be transferred.
|
||||
* \param buffersize How many samples should be transferred at once.
|
||||
*/
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize, void(*callback)(float, void*) = nullptr, void* data = nullptr);
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize);
|
||||
|
||||
/**
|
||||
* Writes a reader to several writers.
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
* \param length How many samples should be transferred.
|
||||
* \param buffersize How many samples should be transferred at once.
|
||||
*/
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize, void(*callback)(float, void*) = nullptr, void* data = nullptr);
|
||||
static void writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize);
|
||||
};
|
||||
|
||||
AUD_NAMESPACE_END
|
||||
|
20
extern/audaspace/src/file/FileWriter.cpp
vendored
20
extern/audaspace/src/file/FileWriter.cpp
vendored
@@ -27,7 +27,7 @@ std::shared_ptr<IWriter> FileWriter::createWriter(std::string filename,DeviceSpe
|
||||
return FileManager::createWriter(filename, specs, format, codec, bitrate);
|
||||
}
|
||||
|
||||
void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize, void(*callback)(float, void*), void* data)
|
||||
void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IWriter> writer, unsigned int length, unsigned int buffersize)
|
||||
{
|
||||
Buffer buffer(buffersize * AUD_SAMPLE_SIZE(writer->getSpecs()));
|
||||
sample_t* buf = buffer.getBuffer();
|
||||
@@ -53,18 +53,10 @@ void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::shared_ptr<IW
|
||||
}
|
||||
|
||||
writer->write(len, buf);
|
||||
|
||||
if(callback)
|
||||
{
|
||||
float progress = -1;
|
||||
if(length > 0)
|
||||
progress = pos / float(length);
|
||||
callback(progress, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize, void(*callback)(float, void*), void* data)
|
||||
void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::vector<std::shared_ptr<IWriter> >& writers, unsigned int length, unsigned int buffersize)
|
||||
{
|
||||
Buffer buffer(buffersize * AUD_SAMPLE_SIZE(reader->getSpecs()));
|
||||
Buffer buffer2(buffersize * sizeof(sample_t));
|
||||
@@ -97,14 +89,6 @@ void FileWriter::writeReader(std::shared_ptr<IReader> reader, std::vector<std::s
|
||||
|
||||
writers[channel]->write(len, buf2);
|
||||
}
|
||||
|
||||
if(callback)
|
||||
{
|
||||
float progress = -1;
|
||||
if(length > 0)
|
||||
progress = pos / float(length);
|
||||
callback(progress, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
19
extern/bullet2/CMakeLists.txt
vendored
19
extern/bullet2/CMakeLists.txt
vendored
@@ -18,16 +18,6 @@
|
||||
# All rights reserved.
|
||||
# ***** END GPL LICENSE BLOCK *****
|
||||
|
||||
# avoid noisy warnings
|
||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
remove_cc_flag(
|
||||
"-Wall"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Use double precision to make simulations of small objects stable.
|
||||
add_definitions(-DBT_USE_DOUBLE_PRECISION)
|
||||
|
||||
set(INC
|
||||
.
|
||||
src
|
||||
@@ -44,6 +34,7 @@ set(SRC
|
||||
src/BulletCollision/BroadphaseCollision/btDbvt.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btDispatcher.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp
|
||||
src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp
|
||||
@@ -91,14 +82,12 @@ set(SRC
|
||||
src/BulletCollision/CollisionShapes/btCylinderShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btEmptyShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btMiniSDF.cpp
|
||||
src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btOptimizedBvh.cpp
|
||||
src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btSdfCollisionShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btShapeHull.cpp
|
||||
src/BulletCollision/CollisionShapes/btSphereShape.cpp
|
||||
src/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp
|
||||
@@ -152,6 +141,7 @@ set(SRC
|
||||
src/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp
|
||||
src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp
|
||||
src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
|
||||
src/BulletDynamics/Dynamics/Bullet-C-API.cpp
|
||||
src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp
|
||||
src/BulletDynamics/Dynamics/btRigidBody.cpp
|
||||
src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp
|
||||
@@ -184,7 +174,6 @@ set(SRC
|
||||
src/LinearMath/btPolarDecomposition.cpp
|
||||
src/LinearMath/btQuickprof.cpp
|
||||
src/LinearMath/btSerializer.cpp
|
||||
src/LinearMath/btSerializer64.cpp
|
||||
src/LinearMath/btVector3.cpp
|
||||
|
||||
src/BulletCollision/BroadphaseCollision/btAxisSweep3.h
|
||||
@@ -194,6 +183,7 @@ set(SRC
|
||||
src/BulletCollision/BroadphaseCollision/btDbvt.h
|
||||
src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h
|
||||
src/BulletCollision/BroadphaseCollision/btDispatcher.h
|
||||
src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h
|
||||
src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h
|
||||
src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h
|
||||
src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
|
||||
@@ -247,14 +237,12 @@ set(SRC
|
||||
src/BulletCollision/CollisionShapes/btEmptyShape.h
|
||||
src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h
|
||||
src/BulletCollision/CollisionShapes/btMaterial.h
|
||||
src/BulletCollision/CollisionShapes/btMiniSDF.h
|
||||
src/BulletCollision/CollisionShapes/btMinkowskiSumShape.h
|
||||
src/BulletCollision/CollisionShapes/btMultiSphereShape.h
|
||||
src/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h
|
||||
src/BulletCollision/CollisionShapes/btOptimizedBvh.h
|
||||
src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h
|
||||
src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h
|
||||
src/BulletCollision/CollisionShapes/btSdfCollisionShape.h
|
||||
src/BulletCollision/CollisionShapes/btShapeHull.h
|
||||
src/BulletCollision/CollisionShapes/btSphereShape.h
|
||||
src/BulletCollision/CollisionShapes/btStaticPlaneShape.h
|
||||
@@ -416,6 +404,7 @@ set(SRC
|
||||
|
||||
src/btBulletCollisionCommon.h
|
||||
src/btBulletDynamicsCommon.h
|
||||
src/Bullet-C-Api.h
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
368
extern/bullet2/patches/blender.patch
vendored
Normal file
368
extern/bullet2/patches/blender.patch
vendored
Normal file
@@ -0,0 +1,368 @@
|
||||
diff --git a/extern/bullet2/src/LinearMath/btVector3.h b/extern/bullet2/src/LinearMath/btVector3.h
|
||||
index 839b19c..3058195 100644
|
||||
--- a/extern/bullet2/src/LinearMath/btVector3.h
|
||||
+++ b/extern/bullet2/src/LinearMath/btVector3.h
|
||||
@@ -39,7 +39,7 @@ subject to the following restrictions:
|
||||
#endif
|
||||
|
||||
|
||||
-#define BT_SHUFFLE(x,y,z,w) ((w)<<6 | (z)<<4 | (y)<<2 | (x))
|
||||
+#define BT_SHUFFLE(x,y,z,w) (((w) << 6 | (z) << 4 | (y) << 2 | (x)) & 0xff)
|
||||
//#define bt_pshufd_ps( _a, _mask ) (__m128) _mm_shuffle_epi32((__m128i)(_a), (_mask) )
|
||||
#define bt_pshufd_ps( _a, _mask ) _mm_shuffle_ps((_a), (_a), (_mask) )
|
||||
#define bt_splat3_ps( _a, _i ) bt_pshufd_ps((_a), BT_SHUFFLE(_i,_i,_i, 3) )
|
||||
diff --git a/extern/bullet2/src/LinearMath/btScalar.h b/extern/bullet2/src/LinearMath/btScalar.h
|
||||
--- a/extern/bullet2/src/LinearMath/btScalar.h
|
||||
+++ b/extern/bullet2/src/LinearMath/btScalar.h
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
#ifndef BT_SCALAR_H
|
||||
#define BT_SCALAR_H
|
||||
+#if defined(_MSC_VER) && defined(__clang__) /* clang supplies it's own overloads already */
|
||||
+#define BT_NO_SIMD_OPERATOR_OVERLOADS
|
||||
+#endif
|
||||
|
||||
#ifdef BT_MANAGED_CODE
|
||||
//Aligned data types not supported in managed code
|
||||
@@ -83,7 +86,7 @@
|
||||
#ifdef BT_USE_SSE
|
||||
|
||||
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
|
||||
- #define BT_ALLOW_SSE4
|
||||
+ //#define BT_ALLOW_SSE4 //disable this cause blender targets sse2
|
||||
#endif //(_MSC_FULL_VER >= 160040219)
|
||||
|
||||
//BT_USE_SSE_IN_API is disabled under Windows by default, because
|
||||
@@ -102,7 +105,7 @@
|
||||
#endif //__MINGW32__
|
||||
|
||||
#ifdef BT_DEBUG
|
||||
- #ifdef _MSC_VER
|
||||
+ #if defined(_MSC_VER) && !defined(__clang__)
|
||||
#include <stdio.h>
|
||||
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
|
||||
#else//_MSC_VER
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
|
||||
index be9eca6..ec40c96 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
|
||||
@@ -15,7 +15,7 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
/**
|
||||
- * @mainpage Bullet Documentation
|
||||
+ * @page Bullet Documentation
|
||||
*
|
||||
* @section intro_sec Introduction
|
||||
* Bullet is a Collision Detection and Rigid Body Dynamics Library. The Library is Open Source and free for commercial use, under the ZLib license ( http://opensource.org/licenses/zlib-license.php ).
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
|
||||
index 36dd043..57eb817 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp
|
||||
@@ -579,14 +579,10 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape( btCollisionS
|
||||
btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData;
|
||||
btCompoundShape* compoundShape = createCompoundShape();
|
||||
|
||||
- btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0];
|
||||
-
|
||||
|
||||
btAlignedObjectArray<btCollisionShape*> childShapes;
|
||||
for (int i=0;i<compoundData->m_numChildShapes;i++)
|
||||
{
|
||||
- btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i];
|
||||
-
|
||||
btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape;
|
||||
|
||||
btCollisionShape* childShape = convertCollisionShape(cd);
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
|
||||
index 57fc119..31faf1d 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
|
||||
+++ b/extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
|
||||
@@ -29,14 +29,11 @@ subject to the following restrictions:
|
||||
static btVector3
|
||||
getNormalizedVector(const btVector3& v)
|
||||
{
|
||||
- btScalar l = v.length();
|
||||
- btVector3 n = v;
|
||||
- if (l < SIMD_EPSILON) {
|
||||
- n.setValue(0,0,0);
|
||||
- } else {
|
||||
- n /= l;
|
||||
- }
|
||||
+ btVector3 n(0, 0, 0);
|
||||
|
||||
+ if (v.length() > SIMD_EPSILON) {
|
||||
+ n = v.normalized();
|
||||
+ }
|
||||
return n;
|
||||
}
|
||||
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
|
||||
index 27ccefe..8e4456e 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
|
||||
+++ b/extern/bullet2/src/BulletDynamics/ConstraintSolver/btSolverBody.h
|
||||
@@ -37,8 +37,13 @@ struct btSimdScalar
|
||||
{
|
||||
|
||||
}
|
||||
-
|
||||
+/* workaround for clang 3.4 ( == apple clang 5.1 ) issue, friction would fail with forced inlining */
|
||||
+#if (defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ == 5) && (__clang_minor__ == 1)) \
|
||||
+|| (defined(__clang__) && !defined(__apple_build_version__) && (__clang_major__ == 3) && (__clang_minor__ == 4))
|
||||
+ inline __attribute__ ((noinline)) btSimdScalar(float fl)
|
||||
+#else
|
||||
SIMD_FORCE_INLINE btSimdScalar(float fl)
|
||||
+#endif
|
||||
:m_vec128 (_mm_set1_ps(fl))
|
||||
{
|
||||
}
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
|
||||
index 5d62da7..fcd312e 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
|
||||
+++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBody.cpp
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "btMultiBodyJointFeedback.h"
|
||||
#include "LinearMath/btTransformUtil.h"
|
||||
#include "LinearMath/btSerializer.h"
|
||||
-#include "Bullet3Common/b3Logging.h"
|
||||
// #define INCLUDE_GYRO_TERM
|
||||
|
||||
///todo: determine if we need these options. If so, make a proper API, otherwise delete those globals
|
||||
@@ -1732,7 +1731,6 @@ void btMultiBody::goToSleep()
|
||||
|
||||
void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep)
|
||||
{
|
||||
- int num_links = getNumLinks();
|
||||
extern bool gDisableDeactivation;
|
||||
if (!m_canSleep || gDisableDeactivation)
|
||||
{
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
|
||||
index 8a034b3..4f66b20 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
|
||||
+++ b/extern/bullet2/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp
|
||||
@@ -809,7 +809,6 @@ static void applyJointFeedback(btMultiBodyJacobianData& data, const btMultiBodyS
|
||||
}
|
||||
#endif
|
||||
|
||||
-#include "Bullet3Common/b3Logging.h"
|
||||
void btMultiBodyConstraintSolver::writeBackSolverBodyToMultiBody(btMultiBodySolverConstraint& c, btScalar deltaTime)
|
||||
{
|
||||
#if 1
|
||||
diff --git a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
|
||||
index bcf0c79..8992ddb 100644
|
||||
--- a/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
|
||||
+++ b/extern/bullet2/src/BulletSoftBody/btSparseSDF.h
|
||||
@@ -185,7 +185,6 @@ struct btSparseSdf
|
||||
{
|
||||
++nprobes;
|
||||
++ncells;
|
||||
- int sz = sizeof(Cell);
|
||||
if (ncells>m_clampCells)
|
||||
{
|
||||
static int numResets=0;
|
||||
diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
|
||||
index d58ac95..3fd77df 100644
|
||||
--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
|
||||
+++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.cpp
|
||||
@@ -2665,6 +2665,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
}
|
||||
|
||||
vertices.resize(0);
|
||||
+ original_vertex_index.resize(0);
|
||||
edges.resize(0);
|
||||
faces.resize(0);
|
||||
|
||||
@@ -2675,6 +2676,7 @@ btScalar btConvexHullComputer::compute(const void* coords, bool doubleCoords, in
|
||||
{
|
||||
btConvexHullInternal::Vertex* v = oldVertices[copied];
|
||||
vertices.push_back(hull.getCoordinates(v));
|
||||
+ original_vertex_index.push_back(v->point.index);
|
||||
btConvexHullInternal::Edge* firstEdge = v->edges;
|
||||
if (firstEdge)
|
||||
{
|
||||
diff --git a/extern/bullet2/src/LinearMath/btConvexHullComputer.h b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
|
||||
index 7240ac4..6871ce8 100644
|
||||
--- a/extern/bullet2/src/LinearMath/btConvexHullComputer.h
|
||||
+++ b/extern/bullet2/src/LinearMath/btConvexHullComputer.h
|
||||
@@ -67,6 +67,7 @@ class btConvexHullComputer
|
||||
|
||||
// Vertices of the output hull
|
||||
btAlignedObjectArray<btVector3> vertices;
|
||||
+ btAlignedObjectArray<int> original_vertex_index;
|
||||
|
||||
// Edges of the output hull
|
||||
btAlignedObjectArray<Edge> edges;
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
|
||||
index 0623e35..02ea503 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
|
||||
@@ -13,9 +13,9 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
-#if defined (_WIN32) || defined (__i386__)
|
||||
-#define BT_USE_SSE_IN_API
|
||||
-#endif
|
||||
+//#if defined (_WIN32) || defined (__i386__)
|
||||
+//#define BT_USE_SSE_IN_API
|
||||
+//#endif
|
||||
|
||||
#include "btConvexHullShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
|
||||
index b56d729..88018b4 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
|
||||
@@ -13,9 +13,9 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
-#if defined (_WIN32) || defined (__i386__)
|
||||
-#define BT_USE_SSE_IN_API
|
||||
-#endif
|
||||
+//#if defined (_WIN32) || defined (__i386__)
|
||||
+//#define BT_USE_SSE_IN_API
|
||||
+//#endif
|
||||
|
||||
#include "btConvexShape.h"
|
||||
#include "btTriangleShape.h"
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
|
||||
index a7362ea..6abfdff 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp
|
||||
@@ -13,9 +13,9 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
-#if defined (_WIN32) || defined (__i386__)
|
||||
-#define BT_USE_SSE_IN_API
|
||||
-#endif
|
||||
+//#if defined (_WIN32) || defined (__i386__)
|
||||
+//#define BT_USE_SSE_IN_API
|
||||
+//#endif
|
||||
|
||||
#include "btMultiSphereShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
index 4854f37..9095c59 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
@@ -12,9 +12,9 @@ subject to the following restrictions:
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
-#if defined (_WIN32) || defined (__i386__)
|
||||
-#define BT_USE_SSE_IN_API
|
||||
-#endif
|
||||
+//#if defined (_WIN32) || defined (__i386__)
|
||||
+//#define BT_USE_SSE_IN_API
|
||||
+//#endif
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
|
||||
#include "btConvexPolyhedron.h"
|
||||
diff --git a/extern/bullet2/src/LinearMath/btVector3.cpp b/extern/bullet2/src/LinearMath/btVector3.cpp
|
||||
index e05bdcc..dbcf2b6 100644
|
||||
--- a/extern/bullet2/src/LinearMath/btVector3.cpp
|
||||
+++ b/extern/bullet2/src/LinearMath/btVector3.cpp
|
||||
@@ -15,9 +15,9 @@
|
||||
This source version has been altered.
|
||||
*/
|
||||
|
||||
-#if defined (_WIN32) || defined (__i386__)
|
||||
-#define BT_USE_SSE_IN_API
|
||||
-#endif
|
||||
+//#if defined (_WIN32) || defined (__i386__)
|
||||
+//#define BT_USE_SSE_IN_API
|
||||
+//#endif
|
||||
|
||||
|
||||
#include "btVector3.h"
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
|
||||
index e0e8bc7..a788268 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
|
||||
+++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.cpp
|
||||
@@ -425,50 +425,38 @@ void btRigidBody::setCenterOfMassTransform(const btTransform& xform)
|
||||
}
|
||||
|
||||
|
||||
+bool btRigidBody::checkCollideWithOverride(const btCollisionObject* co) const
|
||||
+{
|
||||
+ const btRigidBody* otherRb = btRigidBody::upcast(co);
|
||||
+ if (!otherRb)
|
||||
+ return true;
|
||||
+
|
||||
+ for (int i = 0; i < m_constraintRefs.size(); ++i)
|
||||
+ {
|
||||
+ const btTypedConstraint* c = m_constraintRefs[i];
|
||||
+ if (c->isEnabled())
|
||||
+ if (&c->getRigidBodyA() == otherRb || &c->getRigidBodyB() == otherRb)
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
|
||||
|
||||
void btRigidBody::addConstraintRef(btTypedConstraint* c)
|
||||
{
|
||||
- ///disable collision with the 'other' body
|
||||
-
|
||||
int index = m_constraintRefs.findLinearSearch(c);
|
||||
- //don't add constraints that are already referenced
|
||||
- //btAssert(index == m_constraintRefs.size());
|
||||
if (index == m_constraintRefs.size())
|
||||
- {
|
||||
- m_constraintRefs.push_back(c);
|
||||
- btCollisionObject* colObjA = &c->getRigidBodyA();
|
||||
- btCollisionObject* colObjB = &c->getRigidBodyB();
|
||||
- if (colObjA == this)
|
||||
- {
|
||||
- colObjA->setIgnoreCollisionCheck(colObjB, true);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- colObjB->setIgnoreCollisionCheck(colObjA, true);
|
||||
- }
|
||||
- }
|
||||
+ m_constraintRefs.push_back(c);
|
||||
+
|
||||
+ m_checkCollideWith = true;
|
||||
}
|
||||
|
||||
void btRigidBody::removeConstraintRef(btTypedConstraint* c)
|
||||
{
|
||||
- int index = m_constraintRefs.findLinearSearch(c);
|
||||
- //don't remove constraints that are not referenced
|
||||
- if(index < m_constraintRefs.size())
|
||||
- {
|
||||
- m_constraintRefs.remove(c);
|
||||
- btCollisionObject* colObjA = &c->getRigidBodyA();
|
||||
- btCollisionObject* colObjB = &c->getRigidBodyB();
|
||||
- if (colObjA == this)
|
||||
- {
|
||||
- colObjA->setIgnoreCollisionCheck(colObjB, false);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- colObjB->setIgnoreCollisionCheck(colObjA, false);
|
||||
- }
|
||||
- }
|
||||
+ m_constraintRefs.remove(c);
|
||||
+ m_checkCollideWith = m_constraintRefs.size() > 0;
|
||||
}
|
||||
|
||||
int btRigidBody::calculateSerializeBufferSize() const
|
||||
diff --git a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
|
||||
index 1d177db..c2f8c5d 100644
|
||||
--- a/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
|
||||
+++ b/extern/bullet2/src/BulletDynamics/Dynamics/btRigidBody.h
|
||||
@@ -509,6 +509,8 @@ public:
|
||||
return (getBroadphaseProxy() != 0);
|
||||
}
|
||||
|
||||
+ virtual bool checkCollideWithOverride(const btCollisionObject* co) const;
|
||||
+
|
||||
void addConstraintRef(btTypedConstraint* c);
|
||||
void removeConstraintRef(btTypedConstraint* c);
|
||||
|
41
extern/bullet2/patches/btPolyhedralConvexShape_Inertia_fix.patch
vendored
Normal file
41
extern/bullet2/patches/btPolyhedralConvexShape_Inertia_fix.patch
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
index 9095c592d87..b831e20c2f9 100644
|
||||
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
@@ -406,17 +406,17 @@ void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& ine
|
||||
#ifndef __SPU__
|
||||
//not yet, return box inertia
|
||||
|
||||
- btScalar margin = getMargin();
|
||||
+ //btScalar margin = getMargin();
|
||||
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin,aabbMax;
|
||||
- getAabb(ident,aabbMin,aabbMax);
|
||||
+ getAabb(ident,aabbMin,aabbMax); // This already contains the margin
|
||||
btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5);
|
||||
|
||||
- btScalar lx=btScalar(2.)*(halfExtents.x()+margin);
|
||||
- btScalar ly=btScalar(2.)*(halfExtents.y()+margin);
|
||||
- btScalar lz=btScalar(2.)*(halfExtents.z()+margin);
|
||||
+ btScalar lx=btScalar(2.)*(halfExtents.x());
|
||||
+ btScalar ly=btScalar(2.)*(halfExtents.y());
|
||||
+ btScalar lz=btScalar(2.)*(halfExtents.z());
|
||||
const btScalar x2 = lx*lx;
|
||||
const btScalar y2 = ly*ly;
|
||||
const btScalar z2 = lz*lz;
|
||||
@@ -476,10 +476,10 @@ void btPolyhedralConvexAabbCachingShape::recalcLocalAabb()
|
||||
|
||||
for ( int i = 0; i < 3; ++i )
|
||||
{
|
||||
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
|
||||
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
|
||||
+ m_localAabbMax[i] = _supporting[i][i];
|
||||
+ m_localAabbMin[i] = _supporting[i + 3][i];
|
||||
}
|
||||
-
|
||||
+
|
||||
#else
|
||||
|
||||
for (int i=0;i<3;i++)
|
113
extern/bullet2/patches/inertia.patch
vendored
113
extern/bullet2/patches/inertia.patch
vendored
@@ -1,113 +0,0 @@
|
||||
From 1b4c1687748bafd3c521f454bfdfc89b3857b65e Mon Sep 17 00:00:00 2001
|
||||
From: David Vogel <Dadido3@aol.com>
|
||||
Date: Mon, 30 Mar 2020 19:45:23 +0200
|
||||
Subject: [PATCH 1/2] Fix inertia and margin calculation for
|
||||
btPolyhedralConvexShape
|
||||
|
||||
---
|
||||
.../CollisionShapes/btPolyhedralConvexShape.cpp | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
index 521ecfc760..e4bd7bb4d5 100644
|
||||
--- a/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
+++ b/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp
|
||||
@@ -463,17 +463,17 @@ void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass, btVector3& in
|
||||
#ifndef __SPU__
|
||||
//not yet, return box inertia
|
||||
|
||||
- btScalar margin = getMargin();
|
||||
+ //btScalar margin = getMargin();
|
||||
|
||||
btTransform ident;
|
||||
ident.setIdentity();
|
||||
btVector3 aabbMin, aabbMax;
|
||||
- getAabb(ident, aabbMin, aabbMax);
|
||||
+ getAabb(ident, aabbMin, aabbMax); // This already contains the margin
|
||||
btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5);
|
||||
|
||||
- btScalar lx = btScalar(2.) * (halfExtents.x() + margin);
|
||||
- btScalar ly = btScalar(2.) * (halfExtents.y() + margin);
|
||||
- btScalar lz = btScalar(2.) * (halfExtents.z() + margin);
|
||||
+ btScalar lx = btScalar(2.) * (halfExtents.x());
|
||||
+ btScalar ly = btScalar(2.) * (halfExtents.y());
|
||||
+ btScalar lz = btScalar(2.) * (halfExtents.z());
|
||||
const btScalar x2 = lx * lx;
|
||||
const btScalar y2 = ly * ly;
|
||||
const btScalar z2 = lz * lz;
|
||||
@@ -529,8 +529,8 @@ void btPolyhedralConvexAabbCachingShape::recalcLocalAabb()
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
|
||||
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
|
||||
+ m_localAabbMax[i] = _supporting[i][i];
|
||||
+ m_localAabbMin[i] = _supporting[i + 3][i];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
From 4b9a201d4c1b8cacbcdd68f9cdb55745caa6adc4 Mon Sep 17 00:00:00 2001
|
||||
From: David Vogel <Dadido3@aol.com>
|
||||
Date: Mon, 30 Mar 2020 20:43:55 +0200
|
||||
Subject: [PATCH 2/2] Fix margins
|
||||
|
||||
- Margin in ineratia calculation of btConeShape is already contained in the AABB
|
||||
- Remove margin from the cached AABB in btConvexInternalShape, as it is added on getAabb()
|
||||
---
|
||||
src/BulletCollision/CollisionShapes/btConeShape.h | 10 ++++------
|
||||
.../CollisionShapes/btConvexInternalShape.cpp | 8 ++++----
|
||||
2 files changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/BulletCollision/CollisionShapes/btConeShape.h b/src/BulletCollision/CollisionShapes/btConeShape.h
|
||||
index 49f26bc4e5..ee6786c807 100644
|
||||
--- a/src/BulletCollision/CollisionShapes/btConeShape.h
|
||||
+++ b/src/BulletCollision/CollisionShapes/btConeShape.h
|
||||
@@ -56,15 +56,13 @@ btConeShape : public btConvexInternalShape
|
||||
btTransform identity;
|
||||
identity.setIdentity();
|
||||
btVector3 aabbMin, aabbMax;
|
||||
- getAabb(identity, aabbMin, aabbMax);
|
||||
|
||||
+ getAabb(identity, aabbMin, aabbMax); // This already contains the margin
|
||||
btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5);
|
||||
|
||||
- btScalar margin = getMargin();
|
||||
-
|
||||
- btScalar lx = btScalar(2.) * (halfExtents.x() + margin);
|
||||
- btScalar ly = btScalar(2.) * (halfExtents.y() + margin);
|
||||
- btScalar lz = btScalar(2.) * (halfExtents.z() + margin);
|
||||
+ btScalar lx = btScalar(2.) * (halfExtents.x());
|
||||
+ btScalar ly = btScalar(2.) * (halfExtents.y());
|
||||
+ btScalar lz = btScalar(2.) * (halfExtents.z());
|
||||
const btScalar x2 = lx * lx;
|
||||
const btScalar y2 = ly * ly;
|
||||
const btScalar z2 = lz * lz;
|
||||
diff --git a/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp b/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
|
||||
index 4d598b1aa2..b847f8f40f 100644
|
||||
--- a/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
|
||||
+++ b/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp
|
||||
@@ -117,8 +117,8 @@ void btConvexInternalAabbCachingShape::recalcLocalAabb()
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
- m_localAabbMax[i] = _supporting[i][i] + m_collisionMargin;
|
||||
- m_localAabbMin[i] = _supporting[i + 3][i] - m_collisionMargin;
|
||||
+ m_localAabbMax[i] = _supporting[i][i];
|
||||
+ m_localAabbMin[i] = _supporting[i + 3][i];
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -128,10 +128,10 @@ void btConvexInternalAabbCachingShape::recalcLocalAabb()
|
||||
btVector3 vec(btScalar(0.), btScalar(0.), btScalar(0.));
|
||||
vec[i] = btScalar(1.);
|
||||
btVector3 tmp = localGetSupportingVertex(vec);
|
||||
- m_localAabbMax[i] = tmp[i] + m_collisionMargin;
|
||||
+ m_localAabbMax[i] = tmp[i];
|
||||
vec[i] = btScalar(-1.);
|
||||
tmp = localGetSupportingVertex(vec);
|
||||
- m_localAabbMin[i] = tmp[i] - m_collisionMargin;
|
||||
+ m_localAabbMin[i] = tmp[i];
|
||||
}
|
||||
#endif
|
||||
}
|
187
extern/bullet2/src/Bullet-C-Api.h
vendored
Normal file
187
extern/bullet2/src/Bullet-C-Api.h
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
/*
|
||||
Bullet Continuous Collision Detection and Physics Library
|
||||
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it freely,
|
||||
subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
Draft high-level generic physics C-API. For low-level access, use the physics SDK native API's.
|
||||
Work in progress, functionality will be added on demand.
|
||||
|
||||
If possible, use the richer Bullet C++ API, by including "btBulletDynamicsCommon.h"
|
||||
*/
|
||||
|
||||
#ifndef BULLET_C_API_H
|
||||
#define BULLET_C_API_H
|
||||
|
||||
#define PL_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
|
||||
|
||||
#ifdef BT_USE_DOUBLE_PRECISION
|
||||
typedef double plReal;
|
||||
#else
|
||||
typedef float plReal;
|
||||
#endif
|
||||
|
||||
typedef plReal plVector3[3];
|
||||
typedef plReal plQuaternion[4];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Particular physics SDK (C-API) */
|
||||
PL_DECLARE_HANDLE(plPhysicsSdkHandle);
|
||||
|
||||
/** Dynamics world, belonging to some physics SDK (C-API)*/
|
||||
PL_DECLARE_HANDLE(plDynamicsWorldHandle);
|
||||
|
||||
/** Rigid Body that can be part of a Dynamics World (C-API)*/
|
||||
PL_DECLARE_HANDLE(plRigidBodyHandle);
|
||||
|
||||
/** Collision Shape/Geometry, property of a Rigid Body (C-API)*/
|
||||
PL_DECLARE_HANDLE(plCollisionShapeHandle);
|
||||
|
||||
/** Constraint for Rigid Bodies (C-API)*/
|
||||
PL_DECLARE_HANDLE(plConstraintHandle);
|
||||
|
||||
/** Triangle Mesh interface (C-API)*/
|
||||
PL_DECLARE_HANDLE(plMeshInterfaceHandle);
|
||||
|
||||
/** Broadphase Scene/Proxy Handles (C-API)*/
|
||||
PL_DECLARE_HANDLE(plCollisionBroadphaseHandle);
|
||||
PL_DECLARE_HANDLE(plBroadphaseProxyHandle);
|
||||
PL_DECLARE_HANDLE(plCollisionWorldHandle);
|
||||
|
||||
/**
|
||||
Create and Delete a Physics SDK
|
||||
*/
|
||||
|
||||
extern plPhysicsSdkHandle plNewBulletSdk(void); //this could be also another sdk, like ODE, PhysX etc.
|
||||
extern void plDeletePhysicsSdk(plPhysicsSdkHandle physicsSdk);
|
||||
|
||||
/** Collision World, not strictly necessary, you can also just create a Dynamics World with Rigid Bodies which internally manages the Collision World with Collision Objects */
|
||||
|
||||
typedef void(*btBroadphaseCallback)(void* clientData, void* object1,void* object2);
|
||||
|
||||
extern plCollisionBroadphaseHandle plCreateSapBroadphase(btBroadphaseCallback beginCallback,btBroadphaseCallback endCallback);
|
||||
|
||||
extern void plDestroyBroadphase(plCollisionBroadphaseHandle bp);
|
||||
|
||||
extern plBroadphaseProxyHandle plCreateProxy(plCollisionBroadphaseHandle bp, void* clientData, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
|
||||
|
||||
extern void plDestroyProxy(plCollisionBroadphaseHandle bp, plBroadphaseProxyHandle proxyHandle);
|
||||
|
||||
extern void plSetBoundingBox(plBroadphaseProxyHandle proxyHandle, plReal minX,plReal minY,plReal minZ, plReal maxX,plReal maxY, plReal maxZ);
|
||||
|
||||
/* todo: add pair cache support with queries like add/remove/find pair */
|
||||
|
||||
extern plCollisionWorldHandle plCreateCollisionWorld(plPhysicsSdkHandle physicsSdk);
|
||||
|
||||
/* todo: add/remove objects */
|
||||
|
||||
|
||||
/* Dynamics World */
|
||||
|
||||
extern plDynamicsWorldHandle plCreateDynamicsWorld(plPhysicsSdkHandle physicsSdk);
|
||||
|
||||
extern void plDeleteDynamicsWorld(plDynamicsWorldHandle world);
|
||||
|
||||
extern void plStepSimulation(plDynamicsWorldHandle, plReal timeStep);
|
||||
|
||||
extern void plAddRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
|
||||
|
||||
extern void plRemoveRigidBody(plDynamicsWorldHandle world, plRigidBodyHandle object);
|
||||
|
||||
|
||||
/* Rigid Body */
|
||||
|
||||
extern plRigidBodyHandle plCreateRigidBody( void* user_data, float mass, plCollisionShapeHandle cshape );
|
||||
|
||||
extern void plDeleteRigidBody(plRigidBodyHandle body);
|
||||
|
||||
|
||||
/* Collision Shape definition */
|
||||
|
||||
extern plCollisionShapeHandle plNewSphereShape(plReal radius);
|
||||
extern plCollisionShapeHandle plNewBoxShape(plReal x, plReal y, plReal z);
|
||||
extern plCollisionShapeHandle plNewCapsuleShape(plReal radius, plReal height);
|
||||
extern plCollisionShapeHandle plNewConeShape(plReal radius, plReal height);
|
||||
extern plCollisionShapeHandle plNewCylinderShape(plReal radius, plReal height);
|
||||
extern plCollisionShapeHandle plNewCompoundShape(void);
|
||||
extern void plAddChildShape(plCollisionShapeHandle compoundShape,plCollisionShapeHandle childShape, plVector3 childPos,plQuaternion childOrn);
|
||||
|
||||
extern void plDeleteShape(plCollisionShapeHandle shape);
|
||||
|
||||
/* Convex Meshes */
|
||||
extern plCollisionShapeHandle plNewConvexHullShape(void);
|
||||
extern void plAddVertex(plCollisionShapeHandle convexHull, plReal x,plReal y,plReal z);
|
||||
/* Concave static triangle meshes */
|
||||
extern plMeshInterfaceHandle plNewMeshInterface(void);
|
||||
extern void plAddTriangle(plMeshInterfaceHandle meshHandle, plVector3 v0,plVector3 v1,plVector3 v2);
|
||||
extern plCollisionShapeHandle plNewStaticTriangleMeshShape(plMeshInterfaceHandle);
|
||||
|
||||
extern void plSetScaling(plCollisionShapeHandle shape, plVector3 scaling);
|
||||
|
||||
/* SOLID has Response Callback/Table/Management */
|
||||
/* PhysX has Triggers, User Callbacks and filtering */
|
||||
/* ODE has the typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2); */
|
||||
|
||||
/* typedef void plUpdatedPositionCallback(void* userData, plRigidBodyHandle rbHandle, plVector3 pos); */
|
||||
/* typedef void plUpdatedOrientationCallback(void* userData, plRigidBodyHandle rbHandle, plQuaternion orientation); */
|
||||
|
||||
/* get world transform */
|
||||
extern void plGetOpenGLMatrix(plRigidBodyHandle object, plReal* matrix);
|
||||
extern void plGetPosition(plRigidBodyHandle object,plVector3 position);
|
||||
extern void plGetOrientation(plRigidBodyHandle object,plQuaternion orientation);
|
||||
|
||||
/* set world transform (position/orientation) */
|
||||
extern void plSetPosition(plRigidBodyHandle object, const plVector3 position);
|
||||
extern void plSetOrientation(plRigidBodyHandle object, const plQuaternion orientation);
|
||||
extern void plSetEuler(plReal yaw,plReal pitch,plReal roll, plQuaternion orient);
|
||||
extern void plSetOpenGLMatrix(plRigidBodyHandle object, plReal* matrix);
|
||||
|
||||
typedef struct plRayCastResult {
|
||||
plRigidBodyHandle m_body;
|
||||
plCollisionShapeHandle m_shape;
|
||||
plVector3 m_positionWorld;
|
||||
plVector3 m_normalWorld;
|
||||
} plRayCastResult;
|
||||
|
||||
extern int plRayCast(plDynamicsWorldHandle world, const plVector3 rayStart, const plVector3 rayEnd, plRayCastResult res);
|
||||
|
||||
/* Sweep API */
|
||||
|
||||
/* extern plRigidBodyHandle plObjectCast(plDynamicsWorldHandle world, const plVector3 rayStart, const plVector3 rayEnd, plVector3 hitpoint, plVector3 normal); */
|
||||
|
||||
/* Continuous Collision Detection API */
|
||||
|
||||
// needed for source/blender/blenkernel/intern/collision.c
|
||||
double plNearestPoints(float p1[3], float p2[3], float p3[3], float q1[3], float q2[3], float q3[3], float *pa, float *pb, float normal[3]);
|
||||
|
||||
|
||||
/* Convex Hull */
|
||||
PL_DECLARE_HANDLE(plConvexHull);
|
||||
plConvexHull plConvexHullCompute(float (*coords)[3], int count);
|
||||
void plConvexHullDelete(plConvexHull hull);
|
||||
int plConvexHullNumVertices(plConvexHull hull);
|
||||
int plConvexHullNumFaces(plConvexHull hull);
|
||||
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index);
|
||||
int plConvexHullGetFaceSize(plConvexHull hull, int n);
|
||||
void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif //BULLET_C_API_H
|
||||
|
@@ -2,6 +2,7 @@
|
||||
//Bullet Continuous Collision Detection and Physics Library
|
||||
//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
|
||||
//
|
||||
// btAxisSweep3
|
||||
//
|
||||
@@ -18,13 +19,16 @@
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
#include "btAxisSweep3.h"
|
||||
|
||||
|
||||
btAxisSweep3::btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator)
|
||||
:btAxisSweep3Internal<unsigned short int>(worldAabbMin,worldAabbMax,0xfffe,0xffff,maxHandles,pairCache,disableRaycastAccelerator)
|
||||
{
|
||||
// 1 handle is reserved as sentinel
|
||||
btAssert(maxHandles > 1 && maxHandles < 32767);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bt32BitAxisSweep3::bt32BitAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned int maxHandles , btOverlappingPairCache* pairCache , bool disableRaycastAccelerator)
|
||||
:btAxisSweep3Internal<unsigned int>(worldAabbMin,worldAabbMax,0xfffffffe,0x7fffffff,maxHandles,pairCache,disableRaycastAccelerator)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,954 +0,0 @@
|
||||
//Bullet Continuous Collision Detection and Physics Library
|
||||
//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
|
||||
|
||||
//
|
||||
// btAxisSweep3.h
|
||||
//
|
||||
// Copyright (c) 2006 Simon Hobbs
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
#ifndef BT_AXIS_SWEEP_3_INTERNAL_H
|
||||
#define BT_AXIS_SWEEP_3_INTERNAL_H
|
||||
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "btOverlappingPairCache.h"
|
||||
#include "btBroadphaseInterface.h"
|
||||
#include "btBroadphaseProxy.h"
|
||||
#include "btOverlappingPairCallback.h"
|
||||
#include "btDbvtBroadphase.h"
|
||||
|
||||
//#define DEBUG_BROADPHASE 1
|
||||
#define USE_OVERLAP_TEST_ON_REMOVES 1
|
||||
|
||||
/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase.
|
||||
/// It uses quantized integers to represent the begin and end points for each of the 3 axis.
|
||||
/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead.
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
class btAxisSweep3Internal : public btBroadphaseInterface
|
||||
{
|
||||
protected:
|
||||
BP_FP_INT_TYPE m_bpHandleMask;
|
||||
BP_FP_INT_TYPE m_handleSentinel;
|
||||
|
||||
public:
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
class Edge
|
||||
{
|
||||
public:
|
||||
BP_FP_INT_TYPE m_pos; // low bit is min/max
|
||||
BP_FP_INT_TYPE m_handle;
|
||||
|
||||
BP_FP_INT_TYPE IsMax() const { return static_cast<BP_FP_INT_TYPE>(m_pos & 1); }
|
||||
};
|
||||
|
||||
public:
|
||||
class Handle : public btBroadphaseProxy
|
||||
{
|
||||
public:
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
// indexes into the edge arrays
|
||||
BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12
|
||||
// BP_FP_INT_TYPE m_uniqueId;
|
||||
btBroadphaseProxy* m_dbvtProxy; //for faster raycast
|
||||
//void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject
|
||||
|
||||
SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) { m_minEdges[0] = next; }
|
||||
SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const { return m_minEdges[0]; }
|
||||
}; // 24 bytes + 24 for Edge structures = 44 bytes total per entry
|
||||
|
||||
protected:
|
||||
btVector3 m_worldAabbMin; // overall system bounds
|
||||
btVector3 m_worldAabbMax; // overall system bounds
|
||||
|
||||
btVector3 m_quantize; // scaling factor for quantization
|
||||
|
||||
BP_FP_INT_TYPE m_numHandles; // number of active handles
|
||||
BP_FP_INT_TYPE m_maxHandles; // max number of handles
|
||||
Handle* m_pHandles; // handles pool
|
||||
|
||||
BP_FP_INT_TYPE m_firstFreeHandle; // free handles list
|
||||
|
||||
Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries)
|
||||
void* m_pEdgesRawPtr[3];
|
||||
|
||||
btOverlappingPairCache* m_pairCache;
|
||||
|
||||
///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache.
|
||||
btOverlappingPairCallback* m_userPairCallback;
|
||||
|
||||
bool m_ownsPairCache;
|
||||
|
||||
int m_invalidPair;
|
||||
|
||||
///additional dynamic aabb structure, used to accelerate ray cast queries.
|
||||
///can be disabled using a optional argument in the constructor
|
||||
btDbvtBroadphase* m_raycastAccelerator;
|
||||
btOverlappingPairCache* m_nullPairCache;
|
||||
|
||||
// allocation/deallocation
|
||||
BP_FP_INT_TYPE allocHandle();
|
||||
void freeHandle(BP_FP_INT_TYPE handle);
|
||||
|
||||
bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB, int axis0, int axis1);
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
void debugPrintAxis(int axis, bool checkCardinality = true);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
|
||||
//Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
|
||||
//void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB);
|
||||
|
||||
void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps);
|
||||
void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps);
|
||||
void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps);
|
||||
void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps);
|
||||
|
||||
public:
|
||||
btAxisSweep3Internal(const btVector3& worldAabbMin, const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false);
|
||||
|
||||
virtual ~btAxisSweep3Internal();
|
||||
|
||||
BP_FP_INT_TYPE getNumHandles() const
|
||||
{
|
||||
return m_numHandles;
|
||||
}
|
||||
|
||||
virtual void calculateOverlappingPairs(btDispatcher* dispatcher);
|
||||
|
||||
BP_FP_INT_TYPE addHandle(const btVector3& aabbMin, const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher);
|
||||
void removeHandle(BP_FP_INT_TYPE handle, btDispatcher* dispatcher);
|
||||
void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* dispatcher);
|
||||
SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const { return m_pHandles + index; }
|
||||
|
||||
virtual void resetPool(btDispatcher* dispatcher);
|
||||
|
||||
void processAllOverlappingPairs(btOverlapCallback* callback);
|
||||
|
||||
//Broadphase Interface
|
||||
virtual btBroadphaseProxy* createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int shapeType, void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher);
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy, btDispatcher* dispatcher);
|
||||
virtual void setAabb(btBroadphaseProxy* proxy, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* dispatcher);
|
||||
virtual void getAabb(btBroadphaseProxy* proxy, btVector3& aabbMin, btVector3& aabbMax) const;
|
||||
|
||||
virtual void rayTest(const btVector3& rayFrom, const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin = btVector3(0, 0, 0), const btVector3& aabbMax = btVector3(0, 0, 0));
|
||||
virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback);
|
||||
|
||||
void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const;
|
||||
///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result
|
||||
void unQuantize(btBroadphaseProxy* proxy, btVector3& aabbMin, btVector3& aabbMax) const;
|
||||
|
||||
bool testAabbOverlap(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1);
|
||||
|
||||
btOverlappingPairCache* getOverlappingPairCache()
|
||||
{
|
||||
return m_pairCache;
|
||||
}
|
||||
const btOverlappingPairCache* getOverlappingPairCache() const
|
||||
{
|
||||
return m_pairCache;
|
||||
}
|
||||
|
||||
void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback)
|
||||
{
|
||||
m_userPairCallback = pairCallback;
|
||||
}
|
||||
const btOverlappingPairCallback* getOverlappingPairUserCallback() const
|
||||
{
|
||||
return m_userPairCallback;
|
||||
}
|
||||
|
||||
///getAabb returns the axis aligned bounding box in the 'global' coordinate frame
|
||||
///will add some transform later
|
||||
virtual void getBroadphaseAabb(btVector3& aabbMin, btVector3& aabbMax) const
|
||||
{
|
||||
aabbMin = m_worldAabbMin;
|
||||
aabbMax = m_worldAabbMax;
|
||||
}
|
||||
|
||||
virtual void printStats()
|
||||
{
|
||||
/* printf("btAxisSweep3.h\n");
|
||||
printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles);
|
||||
printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(),
|
||||
m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ());
|
||||
*/
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
#include <stdio.h>
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3<BP_FP_INT_TYPE>::debugPrintAxis(int axis, bool checkCardinality)
|
||||
{
|
||||
int numEdges = m_pHandles[0].m_maxEdges[axis];
|
||||
printf("SAP Axis %d, numEdges=%d\n", axis, numEdges);
|
||||
|
||||
int i;
|
||||
for (i = 0; i < numEdges + 1; i++)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + i;
|
||||
Handle* pHandlePrev = getHandle(pEdge->m_handle);
|
||||
int handleIndex = pEdge->IsMax() ? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis];
|
||||
char beginOrEnd;
|
||||
beginOrEnd = pEdge->IsMax() ? 'E' : 'B';
|
||||
printf(" [%c,h=%d,p=%x,i=%d]\n", beginOrEnd, pEdge->m_handle, pEdge->m_pos, handleIndex);
|
||||
}
|
||||
|
||||
if (checkCardinality)
|
||||
btAssert(numEdges == m_numHandles * 2 + 1);
|
||||
}
|
||||
#endif //DEBUG_BROADPHASE
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
btBroadphaseProxy* btAxisSweep3Internal<BP_FP_INT_TYPE>::createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int shapeType, void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher)
|
||||
{
|
||||
(void)shapeType;
|
||||
BP_FP_INT_TYPE handleId = addHandle(aabbMin, aabbMax, userPtr, collisionFilterGroup, collisionFilterMask, dispatcher);
|
||||
|
||||
Handle* handle = getHandle(handleId);
|
||||
|
||||
if (m_raycastAccelerator)
|
||||
{
|
||||
btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin, aabbMax, shapeType, userPtr, collisionFilterGroup, collisionFilterMask, dispatcher);
|
||||
handle->m_dbvtProxy = rayProxy;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::destroyProxy(btBroadphaseProxy* proxy, btDispatcher* dispatcher)
|
||||
{
|
||||
Handle* handle = static_cast<Handle*>(proxy);
|
||||
if (m_raycastAccelerator)
|
||||
m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy, dispatcher);
|
||||
removeHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), dispatcher);
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::setAabb(btBroadphaseProxy* proxy, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* dispatcher)
|
||||
{
|
||||
Handle* handle = static_cast<Handle*>(proxy);
|
||||
handle->m_aabbMin = aabbMin;
|
||||
handle->m_aabbMax = aabbMax;
|
||||
updateHandle(static_cast<BP_FP_INT_TYPE>(handle->m_uniqueId), aabbMin, aabbMax, dispatcher);
|
||||
if (m_raycastAccelerator)
|
||||
m_raycastAccelerator->setAabb(handle->m_dbvtProxy, aabbMin, aabbMax, dispatcher);
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::rayTest(const btVector3& rayFrom, const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin, const btVector3& aabbMax)
|
||||
{
|
||||
if (m_raycastAccelerator)
|
||||
{
|
||||
m_raycastAccelerator->rayTest(rayFrom, rayTo, rayCallback, aabbMin, aabbMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
//choose axis?
|
||||
BP_FP_INT_TYPE axis = 0;
|
||||
//for each proxy
|
||||
for (BP_FP_INT_TYPE i = 1; i < m_numHandles * 2 + 1; i++)
|
||||
{
|
||||
if (m_pEdges[axis][i].IsMax())
|
||||
{
|
||||
rayCallback.process(getHandle(m_pEdges[axis][i].m_handle));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback)
|
||||
{
|
||||
if (m_raycastAccelerator)
|
||||
{
|
||||
m_raycastAccelerator->aabbTest(aabbMin, aabbMax, callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
//choose axis?
|
||||
BP_FP_INT_TYPE axis = 0;
|
||||
//for each proxy
|
||||
for (BP_FP_INT_TYPE i = 1; i < m_numHandles * 2 + 1; i++)
|
||||
{
|
||||
if (m_pEdges[axis][i].IsMax())
|
||||
{
|
||||
Handle* handle = getHandle(m_pEdges[axis][i].m_handle);
|
||||
if (TestAabbAgainstAabb2(aabbMin, aabbMax, handle->m_aabbMin, handle->m_aabbMax))
|
||||
{
|
||||
callback.process(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::getAabb(btBroadphaseProxy* proxy, btVector3& aabbMin, btVector3& aabbMax) const
|
||||
{
|
||||
Handle* pHandle = static_cast<Handle*>(proxy);
|
||||
aabbMin = pHandle->m_aabbMin;
|
||||
aabbMax = pHandle->m_aabbMax;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::unQuantize(btBroadphaseProxy* proxy, btVector3& aabbMin, btVector3& aabbMax) const
|
||||
{
|
||||
Handle* pHandle = static_cast<Handle*>(proxy);
|
||||
|
||||
unsigned short vecInMin[3];
|
||||
unsigned short vecInMax[3];
|
||||
|
||||
vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos;
|
||||
vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos + 1;
|
||||
vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos;
|
||||
vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos + 1;
|
||||
vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos;
|
||||
vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos + 1;
|
||||
|
||||
aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()), (btScalar)(vecInMin[1]) / (m_quantize.getY()), (btScalar)(vecInMin[2]) / (m_quantize.getZ()));
|
||||
aabbMin += m_worldAabbMin;
|
||||
|
||||
aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()), (btScalar)(vecInMax[1]) / (m_quantize.getY()), (btScalar)(vecInMax[2]) / (m_quantize.getZ()));
|
||||
aabbMax += m_worldAabbMin;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btVector3& worldAabbMin, const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache, bool disableRaycastAccelerator)
|
||||
: m_bpHandleMask(handleMask),
|
||||
m_handleSentinel(handleSentinel),
|
||||
m_pairCache(pairCache),
|
||||
m_userPairCallback(0),
|
||||
m_ownsPairCache(false),
|
||||
m_invalidPair(0),
|
||||
m_raycastAccelerator(0)
|
||||
{
|
||||
BP_FP_INT_TYPE maxHandles = static_cast<BP_FP_INT_TYPE>(userMaxHandles + 1); //need to add one sentinel handle
|
||||
|
||||
if (!m_pairCache)
|
||||
{
|
||||
void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache), 16);
|
||||
m_pairCache = new (ptr) btHashedOverlappingPairCache();
|
||||
m_ownsPairCache = true;
|
||||
}
|
||||
|
||||
if (!disableRaycastAccelerator)
|
||||
{
|
||||
m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache), 16)) btNullPairCache();
|
||||
m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase), 16)) btDbvtBroadphase(m_nullPairCache); //m_pairCache);
|
||||
m_raycastAccelerator->m_deferedcollide = true; //don't add/remove pairs
|
||||
}
|
||||
|
||||
//btAssert(bounds.HasVolume());
|
||||
|
||||
// init bounds
|
||||
m_worldAabbMin = worldAabbMin;
|
||||
m_worldAabbMax = worldAabbMax;
|
||||
|
||||
btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin;
|
||||
|
||||
BP_FP_INT_TYPE maxInt = m_handleSentinel;
|
||||
|
||||
m_quantize = btVector3(btScalar(maxInt), btScalar(maxInt), btScalar(maxInt)) / aabbSize;
|
||||
|
||||
// allocate handles buffer, using btAlignedAlloc, and put all handles on free list
|
||||
m_pHandles = new Handle[maxHandles];
|
||||
|
||||
m_maxHandles = maxHandles;
|
||||
m_numHandles = 0;
|
||||
|
||||
// handle 0 is reserved as the null index, and is also used as the sentinel
|
||||
m_firstFreeHandle = 1;
|
||||
{
|
||||
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++)
|
||||
m_pHandles[i].SetNextFree(static_cast<BP_FP_INT_TYPE>(i + 1));
|
||||
m_pHandles[maxHandles - 1].SetNextFree(0);
|
||||
}
|
||||
|
||||
{
|
||||
// allocate edge buffers
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge) * maxHandles * 2, 16);
|
||||
m_pEdges[i] = new (m_pEdgesRawPtr[i]) Edge[maxHandles * 2];
|
||||
}
|
||||
}
|
||||
//removed overlap management
|
||||
|
||||
// make boundary sentinels
|
||||
|
||||
m_pHandles[0].m_clientObject = 0;
|
||||
|
||||
for (int axis = 0; axis < 3; axis++)
|
||||
{
|
||||
m_pHandles[0].m_minEdges[axis] = 0;
|
||||
m_pHandles[0].m_maxEdges[axis] = 1;
|
||||
|
||||
m_pEdges[axis][0].m_pos = 0;
|
||||
m_pEdges[axis][0].m_handle = 0;
|
||||
m_pEdges[axis][1].m_pos = m_handleSentinel;
|
||||
m_pEdges[axis][1].m_handle = 0;
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
debugPrintAxis(axis);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
btAxisSweep3Internal<BP_FP_INT_TYPE>::~btAxisSweep3Internal()
|
||||
{
|
||||
if (m_raycastAccelerator)
|
||||
{
|
||||
m_nullPairCache->~btOverlappingPairCache();
|
||||
btAlignedFree(m_nullPairCache);
|
||||
m_raycastAccelerator->~btDbvtBroadphase();
|
||||
btAlignedFree(m_raycastAccelerator);
|
||||
}
|
||||
|
||||
for (int i = 2; i >= 0; i--)
|
||||
{
|
||||
btAlignedFree(m_pEdgesRawPtr[i]);
|
||||
}
|
||||
delete[] m_pHandles;
|
||||
|
||||
if (m_ownsPairCache)
|
||||
{
|
||||
m_pairCache->~btOverlappingPairCache();
|
||||
btAlignedFree(m_pairCache);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const
|
||||
{
|
||||
#ifdef OLD_CLAMPING_METHOD
|
||||
///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax]
|
||||
///see http://code.google.com/p/bullet/issues/detail?id=87
|
||||
btVector3 clampedPoint(point);
|
||||
clampedPoint.setMax(m_worldAabbMin);
|
||||
clampedPoint.setMin(m_worldAabbMax);
|
||||
btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize;
|
||||
out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax);
|
||||
out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax);
|
||||
out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax);
|
||||
#else
|
||||
btVector3 v = (point - m_worldAabbMin) * m_quantize;
|
||||
out[0] = (v[0] <= 0) ? (BP_FP_INT_TYPE)isMax : (v[0] >= m_handleSentinel) ? (BP_FP_INT_TYPE)((m_handleSentinel & m_bpHandleMask) | isMax) : (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0] & m_bpHandleMask) | isMax);
|
||||
out[1] = (v[1] <= 0) ? (BP_FP_INT_TYPE)isMax : (v[1] >= m_handleSentinel) ? (BP_FP_INT_TYPE)((m_handleSentinel & m_bpHandleMask) | isMax) : (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1] & m_bpHandleMask) | isMax);
|
||||
out[2] = (v[2] <= 0) ? (BP_FP_INT_TYPE)isMax : (v[2] >= m_handleSentinel) ? (BP_FP_INT_TYPE)((m_handleSentinel & m_bpHandleMask) | isMax) : (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2] & m_bpHandleMask) | isMax);
|
||||
#endif //OLD_CLAMPING_METHOD
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::allocHandle()
|
||||
{
|
||||
btAssert(m_firstFreeHandle);
|
||||
|
||||
BP_FP_INT_TYPE handle = m_firstFreeHandle;
|
||||
m_firstFreeHandle = getHandle(handle)->GetNextFree();
|
||||
m_numHandles++;
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::freeHandle(BP_FP_INT_TYPE handle)
|
||||
{
|
||||
btAssert(handle > 0 && handle < m_maxHandles);
|
||||
|
||||
getHandle(handle)->SetNextFree(m_firstFreeHandle);
|
||||
m_firstFreeHandle = handle;
|
||||
|
||||
m_numHandles--;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
BP_FP_INT_TYPE btAxisSweep3Internal<BP_FP_INT_TYPE>::addHandle(const btVector3& aabbMin, const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher)
|
||||
{
|
||||
// quantize the bounds
|
||||
BP_FP_INT_TYPE min[3], max[3];
|
||||
quantize(min, aabbMin, 0);
|
||||
quantize(max, aabbMax, 1);
|
||||
|
||||
// allocate a handle
|
||||
BP_FP_INT_TYPE handle = allocHandle();
|
||||
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
pHandle->m_uniqueId = static_cast<int>(handle);
|
||||
//pHandle->m_pOverlaps = 0;
|
||||
pHandle->m_clientObject = pOwner;
|
||||
pHandle->m_collisionFilterGroup = collisionFilterGroup;
|
||||
pHandle->m_collisionFilterMask = collisionFilterMask;
|
||||
|
||||
// compute current limit of edge arrays
|
||||
BP_FP_INT_TYPE limit = static_cast<BP_FP_INT_TYPE>(m_numHandles * 2);
|
||||
|
||||
// insert new edges just inside the max boundary edge
|
||||
for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++)
|
||||
{
|
||||
m_pHandles[0].m_maxEdges[axis] += 2;
|
||||
|
||||
m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1];
|
||||
|
||||
m_pEdges[axis][limit - 1].m_pos = min[axis];
|
||||
m_pEdges[axis][limit - 1].m_handle = handle;
|
||||
|
||||
m_pEdges[axis][limit].m_pos = max[axis];
|
||||
m_pEdges[axis][limit].m_handle = handle;
|
||||
|
||||
pHandle->m_minEdges[axis] = static_cast<BP_FP_INT_TYPE>(limit - 1);
|
||||
pHandle->m_maxEdges[axis] = limit;
|
||||
}
|
||||
|
||||
// now sort the new edges to their correct position
|
||||
sortMinDown(0, pHandle->m_minEdges[0], dispatcher, false);
|
||||
sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher, false);
|
||||
sortMinDown(1, pHandle->m_minEdges[1], dispatcher, false);
|
||||
sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher, false);
|
||||
sortMinDown(2, pHandle->m_minEdges[2], dispatcher, true);
|
||||
sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher, true);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::removeHandle(BP_FP_INT_TYPE handle, btDispatcher* dispatcher)
|
||||
{
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
//explicitly remove the pairs containing the proxy
|
||||
//we could do it also in the sortMinUp (passing true)
|
||||
///@todo: compare performance
|
||||
if (!m_pairCache->hasDeferredRemoval())
|
||||
{
|
||||
m_pairCache->removeOverlappingPairsContainingProxy(pHandle, dispatcher);
|
||||
}
|
||||
|
||||
// compute current limit of edge arrays
|
||||
int limit = static_cast<int>(m_numHandles * 2);
|
||||
|
||||
int axis;
|
||||
|
||||
for (axis = 0; axis < 3; axis++)
|
||||
{
|
||||
m_pHandles[0].m_maxEdges[axis] -= 2;
|
||||
}
|
||||
|
||||
// remove the edges by sorting them up to the end of the list
|
||||
for (axis = 0; axis < 3; axis++)
|
||||
{
|
||||
Edge* pEdges = m_pEdges[axis];
|
||||
BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis];
|
||||
pEdges[max].m_pos = m_handleSentinel;
|
||||
|
||||
sortMaxUp(axis, max, dispatcher, false);
|
||||
|
||||
BP_FP_INT_TYPE i = pHandle->m_minEdges[axis];
|
||||
pEdges[i].m_pos = m_handleSentinel;
|
||||
|
||||
sortMinUp(axis, i, dispatcher, false);
|
||||
|
||||
pEdges[limit - 1].m_handle = 0;
|
||||
pEdges[limit - 1].m_pos = m_handleSentinel;
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
debugPrintAxis(axis, false);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
}
|
||||
|
||||
// free the handle
|
||||
freeHandle(handle);
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::resetPool(btDispatcher* /*dispatcher*/)
|
||||
{
|
||||
if (m_numHandles == 0)
|
||||
{
|
||||
m_firstFreeHandle = 1;
|
||||
{
|
||||
for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++)
|
||||
m_pHandles[i].SetNextFree(static_cast<BP_FP_INT_TYPE>(i + 1));
|
||||
m_pHandles[m_maxHandles - 1].SetNextFree(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#include <stdio.h>
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::calculateOverlappingPairs(btDispatcher* dispatcher)
|
||||
{
|
||||
if (m_pairCache->hasDeferredRemoval())
|
||||
{
|
||||
btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray();
|
||||
|
||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
|
||||
m_invalidPair = 0;
|
||||
|
||||
int i;
|
||||
|
||||
btBroadphasePair previousPair;
|
||||
previousPair.m_pProxy0 = 0;
|
||||
previousPair.m_pProxy1 = 0;
|
||||
previousPair.m_algorithm = 0;
|
||||
|
||||
for (i = 0; i < overlappingPairArray.size(); i++)
|
||||
{
|
||||
btBroadphasePair& pair = overlappingPairArray[i];
|
||||
|
||||
bool isDuplicate = (pair == previousPair);
|
||||
|
||||
previousPair = pair;
|
||||
|
||||
bool needsRemoval = false;
|
||||
|
||||
if (!isDuplicate)
|
||||
{
|
||||
///important to use an AABB test that is consistent with the broadphase
|
||||
bool hasOverlap = testAabbOverlap(pair.m_pProxy0, pair.m_pProxy1);
|
||||
|
||||
if (hasOverlap)
|
||||
{
|
||||
needsRemoval = false; //callback->processOverlap(pair);
|
||||
}
|
||||
else
|
||||
{
|
||||
needsRemoval = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//remove duplicate
|
||||
needsRemoval = true;
|
||||
//should have no algorithm
|
||||
btAssert(!pair.m_algorithm);
|
||||
}
|
||||
|
||||
if (needsRemoval)
|
||||
{
|
||||
m_pairCache->cleanOverlappingPair(pair, dispatcher);
|
||||
|
||||
// m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1);
|
||||
// m_overlappingPairArray.pop_back();
|
||||
pair.m_pProxy0 = 0;
|
||||
pair.m_pProxy1 = 0;
|
||||
m_invalidPair++;
|
||||
}
|
||||
}
|
||||
|
||||
///if you don't like to skip the invalid pairs in the array, execute following code:
|
||||
#define CLEAN_INVALID_PAIRS 1
|
||||
#ifdef CLEAN_INVALID_PAIRS
|
||||
|
||||
//perform a sort, to sort 'invalid' pairs to the end
|
||||
overlappingPairArray.quickSort(btBroadphasePairSortPredicate());
|
||||
|
||||
overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair);
|
||||
m_invalidPair = 0;
|
||||
#endif //CLEAN_INVALID_PAIRS
|
||||
|
||||
//printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size());
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testAabbOverlap(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1)
|
||||
{
|
||||
const Handle* pHandleA = static_cast<Handle*>(proxy0);
|
||||
const Handle* pHandleB = static_cast<Handle*>(proxy1);
|
||||
|
||||
//optimization 1: check the array index (memory address), instead of the m_pos
|
||||
|
||||
for (int axis = 0; axis < 3; axis++)
|
||||
{
|
||||
if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] ||
|
||||
pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
bool btAxisSweep3Internal<BP_FP_INT_TYPE>::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB, int axis0, int axis1)
|
||||
{
|
||||
//optimization 1: check the array index (memory address), instead of the m_pos
|
||||
|
||||
if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] ||
|
||||
pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] ||
|
||||
pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] ||
|
||||
pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* dispatcher)
|
||||
{
|
||||
// btAssert(bounds.IsFinite());
|
||||
//btAssert(bounds.HasVolume());
|
||||
|
||||
Handle* pHandle = getHandle(handle);
|
||||
|
||||
// quantize the new bounds
|
||||
BP_FP_INT_TYPE min[3], max[3];
|
||||
quantize(min, aabbMin, 0);
|
||||
quantize(max, aabbMax, 1);
|
||||
|
||||
// update changed edges
|
||||
for (int axis = 0; axis < 3; axis++)
|
||||
{
|
||||
BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis];
|
||||
BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis];
|
||||
|
||||
int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos;
|
||||
int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos;
|
||||
|
||||
m_pEdges[axis][emin].m_pos = min[axis];
|
||||
m_pEdges[axis][emax].m_pos = max[axis];
|
||||
|
||||
// expand (only adds overlaps)
|
||||
if (dmin < 0)
|
||||
sortMinDown(axis, emin, dispatcher, true);
|
||||
|
||||
if (dmax > 0)
|
||||
sortMaxUp(axis, emax, dispatcher, true);
|
||||
|
||||
// shrink (only removes overlaps)
|
||||
if (dmin > 0)
|
||||
sortMinUp(axis, emin, dispatcher, true);
|
||||
|
||||
if (dmax < 0)
|
||||
sortMaxDown(axis, emax, dispatcher, true);
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
debugPrintAxis(axis);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
}
|
||||
}
|
||||
|
||||
// sorting a min edge downwards can only ever *add* overlaps
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pPrev = pEdge - 1;
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos < pPrev->m_pos)
|
||||
{
|
||||
Handle* pHandlePrev = getHandle(pPrev->m_handle);
|
||||
|
||||
if (pPrev->IsMax())
|
||||
{
|
||||
// if previous edge is a maximum check the bounds and add an overlap if necessary
|
||||
const int axis1 = (1 << axis) & 3;
|
||||
const int axis2 = (1 << axis1) & 3;
|
||||
if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev, axis1, axis2))
|
||||
{
|
||||
m_pairCache->addOverlappingPair(pHandleEdge, pHandlePrev);
|
||||
if (m_userPairCallback)
|
||||
m_userPairCallback->addOverlappingPair(pHandleEdge, pHandlePrev);
|
||||
|
||||
//AddOverlap(pEdge->m_handle, pPrev->m_handle);
|
||||
}
|
||||
|
||||
// update edge reference in other handle
|
||||
pHandlePrev->m_maxEdges[axis]++;
|
||||
}
|
||||
else
|
||||
pHandlePrev->m_minEdges[axis]++;
|
||||
|
||||
pHandleEdge->m_minEdges[axis]--;
|
||||
|
||||
// swap the edges
|
||||
Edge swap = *pEdge;
|
||||
*pEdge = *pPrev;
|
||||
*pPrev = swap;
|
||||
|
||||
// decrement
|
||||
pEdge--;
|
||||
pPrev--;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
debugPrintAxis(axis);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
}
|
||||
|
||||
// sorting a min edge upwards can only ever *remove* overlaps
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pNext = pEdge + 1;
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
|
||||
{
|
||||
Handle* pHandleNext = getHandle(pNext->m_handle);
|
||||
|
||||
if (pNext->IsMax())
|
||||
{
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pNext->m_handle);
|
||||
const int axis1 = (1 << axis) & 3;
|
||||
const int axis2 = (1 << axis1) & 3;
|
||||
|
||||
// if next edge is maximum remove any overlap between the two handles
|
||||
if (updateOverlaps
|
||||
#ifdef USE_OVERLAP_TEST_ON_REMOVES
|
||||
&& testOverlap2D(handle0, handle1, axis1, axis2)
|
||||
#endif //USE_OVERLAP_TEST_ON_REMOVES
|
||||
)
|
||||
{
|
||||
m_pairCache->removeOverlappingPair(handle0, handle1, dispatcher);
|
||||
if (m_userPairCallback)
|
||||
m_userPairCallback->removeOverlappingPair(handle0, handle1, dispatcher);
|
||||
}
|
||||
|
||||
// update edge reference in other handle
|
||||
pHandleNext->m_maxEdges[axis]--;
|
||||
}
|
||||
else
|
||||
pHandleNext->m_minEdges[axis]--;
|
||||
|
||||
pHandleEdge->m_minEdges[axis]++;
|
||||
|
||||
// swap the edges
|
||||
Edge swap = *pEdge;
|
||||
*pEdge = *pNext;
|
||||
*pNext = swap;
|
||||
|
||||
// increment
|
||||
pEdge++;
|
||||
pNext++;
|
||||
}
|
||||
}
|
||||
|
||||
// sorting a max edge downwards can only ever *remove* overlaps
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pPrev = pEdge - 1;
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pEdge->m_pos < pPrev->m_pos)
|
||||
{
|
||||
Handle* pHandlePrev = getHandle(pPrev->m_handle);
|
||||
|
||||
if (!pPrev->IsMax())
|
||||
{
|
||||
// if previous edge was a minimum remove any overlap between the two handles
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pPrev->m_handle);
|
||||
const int axis1 = (1 << axis) & 3;
|
||||
const int axis2 = (1 << axis1) & 3;
|
||||
|
||||
if (updateOverlaps
|
||||
#ifdef USE_OVERLAP_TEST_ON_REMOVES
|
||||
&& testOverlap2D(handle0, handle1, axis1, axis2)
|
||||
#endif //USE_OVERLAP_TEST_ON_REMOVES
|
||||
)
|
||||
{
|
||||
//this is done during the overlappingpairarray iteration/narrowphase collision
|
||||
|
||||
m_pairCache->removeOverlappingPair(handle0, handle1, dispatcher);
|
||||
if (m_userPairCallback)
|
||||
m_userPairCallback->removeOverlappingPair(handle0, handle1, dispatcher);
|
||||
}
|
||||
|
||||
// update edge reference in other handle
|
||||
pHandlePrev->m_minEdges[axis]++;
|
||||
;
|
||||
}
|
||||
else
|
||||
pHandlePrev->m_maxEdges[axis]++;
|
||||
|
||||
pHandleEdge->m_maxEdges[axis]--;
|
||||
|
||||
// swap the edges
|
||||
Edge swap = *pEdge;
|
||||
*pEdge = *pPrev;
|
||||
*pPrev = swap;
|
||||
|
||||
// decrement
|
||||
pEdge--;
|
||||
pPrev--;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_BROADPHASE
|
||||
debugPrintAxis(axis);
|
||||
#endif //DEBUG_BROADPHASE
|
||||
}
|
||||
|
||||
// sorting a max edge upwards can only ever *add* overlaps
|
||||
template <typename BP_FP_INT_TYPE>
|
||||
void btAxisSweep3Internal<BP_FP_INT_TYPE>::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps)
|
||||
{
|
||||
Edge* pEdge = m_pEdges[axis] + edge;
|
||||
Edge* pNext = pEdge + 1;
|
||||
Handle* pHandleEdge = getHandle(pEdge->m_handle);
|
||||
|
||||
while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos))
|
||||
{
|
||||
Handle* pHandleNext = getHandle(pNext->m_handle);
|
||||
|
||||
const int axis1 = (1 << axis) & 3;
|
||||
const int axis2 = (1 << axis1) & 3;
|
||||
|
||||
if (!pNext->IsMax())
|
||||
{
|
||||
// if next edge is a minimum check the bounds and add an overlap if necessary
|
||||
if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext, axis1, axis2))
|
||||
{
|
||||
Handle* handle0 = getHandle(pEdge->m_handle);
|
||||
Handle* handle1 = getHandle(pNext->m_handle);
|
||||
m_pairCache->addOverlappingPair(handle0, handle1);
|
||||
if (m_userPairCallback)
|
||||
m_userPairCallback->addOverlappingPair(handle0, handle1);
|
||||
}
|
||||
|
||||
// update edge reference in other handle
|
||||
pHandleNext->m_minEdges[axis]--;
|
||||
}
|
||||
else
|
||||
pHandleNext->m_maxEdges[axis]--;
|
||||
|
||||
pHandleEdge->m_maxEdges[axis]++;
|
||||
|
||||
// swap the edges
|
||||
Edge swap = *pEdge;
|
||||
*pEdge = *pNext;
|
||||
*pNext = swap;
|
||||
|
||||
// increment
|
||||
pEdge++;
|
||||
pNext++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -16,18 +16,23 @@ subject to the following restrictions:
|
||||
#ifndef BT_BROADPHASE_INTERFACE_H
|
||||
#define BT_BROADPHASE_INTERFACE_H
|
||||
|
||||
|
||||
|
||||
struct btDispatcherInfo;
|
||||
class btDispatcher;
|
||||
#include "btBroadphaseProxy.h"
|
||||
|
||||
class btOverlappingPairCache;
|
||||
|
||||
|
||||
|
||||
struct btBroadphaseAabbCallback
|
||||
{
|
||||
virtual ~btBroadphaseAabbCallback() {}
|
||||
virtual bool process(const btBroadphaseProxy* proxy) = 0;
|
||||
};
|
||||
|
||||
|
||||
struct btBroadphaseRayCallback : public btBroadphaseAabbCallback
|
||||
{
|
||||
///added some cached data to accelerate ray-AABB tests
|
||||
@@ -36,9 +41,6 @@ struct btBroadphaseRayCallback : public btBroadphaseAabbCallback
|
||||
btScalar m_lambda_max;
|
||||
|
||||
virtual ~btBroadphaseRayCallback() {}
|
||||
|
||||
protected:
|
||||
btBroadphaseRayCallback() {}
|
||||
};
|
||||
|
||||
#include "LinearMath/btVector3.h"
|
||||
@@ -51,7 +53,7 @@ class btBroadphaseInterface
|
||||
public:
|
||||
virtual ~btBroadphaseInterface() {}
|
||||
|
||||
virtual btBroadphaseProxy* createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int shapeType, void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher) = 0;
|
||||
virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy) =0;
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0;
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0;
|
||||
virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =0;
|
||||
@@ -74,6 +76,7 @@ public:
|
||||
virtual void resetPool(btDispatcher* dispatcher) { (void) dispatcher; };
|
||||
|
||||
virtual void printStats() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif //BT_BROADPHASE_INTERFACE_H
|
||||
|
@@ -15,4 +15,3 @@ subject to the following restrictions:
|
||||
|
||||
#include "btBroadphaseProxy.h"
|
||||
|
||||
BT_NOT_EMPTY_FILE // fix warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
|
||||
|
@@ -20,6 +20,7 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "LinearMath/btAlignedAllocator.h"
|
||||
|
||||
|
||||
/// btDispatcher uses these types
|
||||
/// IMPORTANT NOTE:The types are ordered polyhedral, implicit convex and concave
|
||||
/// to facilitate type checking
|
||||
@@ -65,7 +66,6 @@ enum BroadphaseNativeTypes
|
||||
EMPTY_SHAPE_PROXYTYPE,
|
||||
STATIC_PLANE_PROXYTYPE,
|
||||
CUSTOM_CONCAVE_SHAPE_TYPE,
|
||||
SDF_SHAPE_PROXYTYPE = CUSTOM_CONCAVE_SHAPE_TYPE,
|
||||
CONCAVE_SHAPES_END_HERE,
|
||||
|
||||
COMPOUND_SHAPE_PROXYTYPE,
|
||||
@@ -79,11 +79,12 @@ enum BroadphaseNativeTypes
|
||||
|
||||
};
|
||||
|
||||
|
||||
///The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
|
||||
///It stores collision shape type information, collision filter information and a client object, typically a btCollisionObject or btRigidBody.
|
||||
ATTRIBUTE_ALIGNED16(struct)
|
||||
btBroadphaseProxy
|
||||
ATTRIBUTE_ALIGNED16(struct) btBroadphaseProxy
|
||||
{
|
||||
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
///optional filtering to cull potential collisions
|
||||
@@ -100,9 +101,9 @@ btBroadphaseProxy
|
||||
|
||||
//Usually the client btCollisionObject or Rigidbody class
|
||||
void* m_clientObject;
|
||||
int m_collisionFilterGroup;
|
||||
int m_collisionFilterMask;
|
||||
|
||||
short int m_collisionFilterGroup;
|
||||
short int m_collisionFilterMask;
|
||||
void* m_multiSapParentProxy;
|
||||
int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc.
|
||||
|
||||
btVector3 m_aabbMin;
|
||||
@@ -114,19 +115,22 @@ btBroadphaseProxy
|
||||
}
|
||||
|
||||
//used for memory pools
|
||||
btBroadphaseProxy() : m_clientObject(0)
|
||||
btBroadphaseProxy() :m_clientObject(0),m_multiSapParentProxy(0)
|
||||
{
|
||||
}
|
||||
|
||||
btBroadphaseProxy(const btVector3& aabbMin, const btVector3& aabbMax, void* userPtr, int collisionFilterGroup, int collisionFilterMask)
|
||||
btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0)
|
||||
:m_clientObject(userPtr),
|
||||
m_collisionFilterGroup(collisionFilterGroup),
|
||||
m_collisionFilterMask(collisionFilterMask),
|
||||
m_aabbMin(aabbMin),
|
||||
m_aabbMax(aabbMax)
|
||||
{
|
||||
m_multiSapParentProxy = multiSapParentProxy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static SIMD_FORCE_INLINE bool isPolyhedral(int proxyType)
|
||||
{
|
||||
return (proxyType < IMPLICIT_CONVEX_SHAPES_START_HERE);
|
||||
@@ -166,19 +170,24 @@ btBroadphaseProxy
|
||||
{
|
||||
return (proxyType == BOX_2D_SHAPE_PROXYTYPE) || (proxyType == CONVEX_2D_SHAPE_PROXYTYPE);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
;
|
||||
|
||||
class btCollisionAlgorithm;
|
||||
|
||||
struct btBroadphaseProxy;
|
||||
|
||||
|
||||
|
||||
///The btBroadphasePair class contains a pair of aabb-overlapping objects.
|
||||
///A btDispatcher can search a btCollisionAlgorithm that performs exact/narrowphase collision detection on the actual collision shapes.
|
||||
ATTRIBUTE_ALIGNED16(struct)
|
||||
btBroadphasePair
|
||||
ATTRIBUTE_ALIGNED16(struct) btBroadphasePair
|
||||
{
|
||||
btBroadphasePair ()
|
||||
: m_pProxy0(0),
|
||||
:
|
||||
m_pProxy0(0),
|
||||
m_pProxy1(0),
|
||||
m_algorithm(0),
|
||||
m_internalInfo1(0)
|
||||
@@ -187,8 +196,16 @@ btBroadphasePair
|
||||
|
||||
BT_DECLARE_ALIGNED_ALLOCATOR();
|
||||
|
||||
btBroadphasePair(const btBroadphasePair& other)
|
||||
: m_pProxy0(other.m_pProxy0),
|
||||
m_pProxy1(other.m_pProxy1),
|
||||
m_algorithm(other.m_algorithm),
|
||||
m_internalInfo1(other.m_internalInfo1)
|
||||
{
|
||||
}
|
||||
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||
{
|
||||
|
||||
//keep them sorted, so the std::set operations work
|
||||
if (proxy0.m_uniqueId < proxy1.m_uniqueId)
|
||||
{
|
||||
@@ -203,16 +220,15 @@ btBroadphasePair
|
||||
|
||||
m_algorithm = 0;
|
||||
m_internalInfo1 = 0;
|
||||
|
||||
}
|
||||
|
||||
btBroadphaseProxy* m_pProxy0;
|
||||
btBroadphaseProxy* m_pProxy1;
|
||||
|
||||
mutable btCollisionAlgorithm* m_algorithm;
|
||||
union {
|
||||
void* m_internalInfo1;
|
||||
int m_internalTmpValue;
|
||||
}; //don't use this data, it will be removed in future version.
|
||||
union { void* m_internalInfo1; int m_internalTmpValue;};//don't use this data, it will be removed in future version.
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -224,9 +240,12 @@ SIMD_FORCE_INLINE bool operator<(const btBroadphasePair& a, const btBroadphasePa
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class btBroadphasePairSortPredicate
|
||||
{
|
||||
public:
|
||||
|
||||
bool operator() ( const btBroadphasePair& a, const btBroadphasePair& b ) const
|
||||
{
|
||||
const int uidA0 = a.m_pProxy0 ? a.m_pProxy0->m_uniqueId : -1;
|
||||
@@ -240,9 +259,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE bool operator==(const btBroadphasePair& a, const btBroadphasePair& b)
|
||||
{
|
||||
return (a.m_pProxy0 == b.m_pProxy0) && (a.m_pProxy1 == b.m_pProxy1);
|
||||
}
|
||||
|
||||
|
||||
#endif //BT_BROADPHASE_PROXY_H
|
||||
|
||||
|
@@ -20,3 +20,4 @@ btCollisionAlgorithm::btCollisionAlgorithm(const btCollisionAlgorithmConstructio
|
||||
{
|
||||
m_dispatcher = ci.m_dispatcher1;
|
||||
}
|
||||
|
||||
|
@@ -46,19 +46,24 @@ struct btCollisionAlgorithmConstructionInfo
|
||||
btPersistentManifold* m_manifold;
|
||||
|
||||
// int getDispatcherId();
|
||||
|
||||
};
|
||||
|
||||
|
||||
///btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatcher.
|
||||
///It is persistent over frames
|
||||
class btCollisionAlgorithm
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
btDispatcher* m_dispatcher;
|
||||
|
||||
protected:
|
||||
// int getDispatcherId();
|
||||
|
||||
public:
|
||||
|
||||
btCollisionAlgorithm() {};
|
||||
|
||||
btCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci);
|
||||
@@ -72,4 +77,5 @@ public:
|
||||
virtual void getAllContactManifolds(btManifoldArray& manifoldArray) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif //BT_COLLISION_ALGORITHM_H
|
||||
|
@@ -37,7 +37,7 @@ static DBVT_INLINE int indexof(const btDbvtNode* node)
|
||||
static DBVT_INLINE btDbvtVolume merge( const btDbvtVolume& a,
|
||||
const btDbvtVolume& b)
|
||||
{
|
||||
#ifdef BT_USE_SSE
|
||||
#if (DBVT_MERGE_IMPL==DBVT_IMPL_SSE)
|
||||
ATTRIBUTE_ALIGNED16( char locals[sizeof(btDbvtAabbMm)]);
|
||||
btDbvtVolume* ptr = (btDbvtVolume*) locals;
|
||||
btDbvtVolume& res=*ptr;
|
||||
@@ -63,9 +63,7 @@ static void getmaxdepth(const btDbvtNode* node, int depth, int& maxdepth)
|
||||
{
|
||||
getmaxdepth(node->childs[0],depth+1,maxdepth);
|
||||
getmaxdepth(node->childs[1],depth+1,maxdepth);
|
||||
}
|
||||
else
|
||||
maxdepth = btMax(maxdepth, depth);
|
||||
} else maxdepth=btMax(maxdepth,depth);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -80,7 +78,6 @@ static DBVT_INLINE void deletenode(btDbvt* pdbvt,
|
||||
static void recursedeletenode( btDbvt* pdbvt,
|
||||
btDbvtNode* node)
|
||||
{
|
||||
if (node == 0) return;
|
||||
if(!node->isleaf())
|
||||
{
|
||||
recursedeletenode(pdbvt,node->childs[0]);
|
||||
@@ -97,14 +94,9 @@ static DBVT_INLINE btDbvtNode* createnode(btDbvt* pdbvt,
|
||||
{
|
||||
btDbvtNode* node;
|
||||
if(pdbvt->m_free)
|
||||
{
|
||||
node = pdbvt->m_free;
|
||||
pdbvt->m_free = 0;
|
||||
}
|
||||
{ node=pdbvt->m_free;pdbvt->m_free=0; }
|
||||
else
|
||||
{
|
||||
node = new (btAlignedAlloc(sizeof(btDbvtNode), 16)) btDbvtNode();
|
||||
}
|
||||
{ node=new(btAlignedAlloc(sizeof(btDbvtNode),16)) btDbvtNode(); }
|
||||
node->parent = parent;
|
||||
node->data = data;
|
||||
node->childs[1] = 0;
|
||||
@@ -148,8 +140,7 @@ static void insertleaf(btDbvt* pdbvt,
|
||||
{
|
||||
if(!root->isleaf())
|
||||
{
|
||||
do
|
||||
{
|
||||
do {
|
||||
root=root->childs[Select( leaf->volume,
|
||||
root->childs[0]->volume,
|
||||
root->childs[1]->volume)];
|
||||
@@ -160,12 +151,9 @@ static void insertleaf(btDbvt* pdbvt,
|
||||
if(prev)
|
||||
{
|
||||
prev->childs[indexof(root)] = node;
|
||||
node->childs[0] = root;
|
||||
root->parent = node;
|
||||
node->childs[1] = leaf;
|
||||
leaf->parent = node;
|
||||
do
|
||||
{
|
||||
node->childs[0] = root;root->parent=node;
|
||||
node->childs[1] = leaf;leaf->parent=node;
|
||||
do {
|
||||
if(!prev->volume.Contain(node->volume))
|
||||
Merge(prev->childs[0]->volume,prev->childs[1]->volume,prev->volume);
|
||||
else
|
||||
@@ -175,10 +163,8 @@ static void insertleaf(btDbvt* pdbvt,
|
||||
}
|
||||
else
|
||||
{
|
||||
node->childs[0] = root;
|
||||
root->parent = node;
|
||||
node->childs[1] = leaf;
|
||||
leaf->parent = node;
|
||||
node->childs[0] = root;root->parent=node;
|
||||
node->childs[1] = leaf;leaf->parent=node;
|
||||
pdbvt->m_root = node;
|
||||
}
|
||||
}
|
||||
@@ -210,9 +196,7 @@ static btDbvtNode* removeleaf(btDbvt* pdbvt,
|
||||
if(NotEqual(pb,prev->volume))
|
||||
{
|
||||
prev=prev->parent;
|
||||
}
|
||||
else
|
||||
break;
|
||||
} else break;
|
||||
}
|
||||
return(prev?prev:pdbvt->m_root);
|
||||
}
|
||||
@@ -245,61 +229,27 @@ static void fetchleaves(btDbvt* pdbvt,
|
||||
}
|
||||
|
||||
//
|
||||
static bool leftOfAxis(const btDbvtNode* node,
|
||||
static void split( const tNodeArray& leaves,
|
||||
tNodeArray& left,
|
||||
tNodeArray& right,
|
||||
const btVector3& org,
|
||||
const btVector3& axis)
|
||||
{
|
||||
return btDot(axis, node->volume.Center() - org) <= 0;
|
||||
}
|
||||
|
||||
// Partitions leaves such that leaves[0, n) are on the
|
||||
// left of axis, and leaves[n, count) are on the right
|
||||
// of axis. returns N.
|
||||
static int split(btDbvtNode** leaves,
|
||||
int count,
|
||||
const btVector3& org,
|
||||
const btVector3& axis)
|
||||
left.resize(0);
|
||||
right.resize(0);
|
||||
for(int i=0,ni=leaves.size();i<ni;++i)
|
||||
{
|
||||
int begin = 0;
|
||||
int end = count;
|
||||
for (;;)
|
||||
{
|
||||
while (begin != end && leftOfAxis(leaves[begin], org, axis))
|
||||
{
|
||||
++begin;
|
||||
if(btDot(axis,leaves[i]->volume.Center()-org)<0)
|
||||
left.push_back(leaves[i]);
|
||||
else
|
||||
right.push_back(leaves[i]);
|
||||
}
|
||||
|
||||
if (begin == end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
while (begin != end && !leftOfAxis(leaves[end - 1], org, axis))
|
||||
{
|
||||
--end;
|
||||
}
|
||||
|
||||
if (begin == end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// swap out of place nodes
|
||||
--end;
|
||||
btDbvtNode* temp = leaves[begin];
|
||||
leaves[begin] = leaves[end];
|
||||
leaves[end] = temp;
|
||||
++begin;
|
||||
}
|
||||
|
||||
return begin;
|
||||
}
|
||||
|
||||
//
|
||||
static btDbvtVolume bounds(btDbvtNode** leaves,
|
||||
int count)
|
||||
static btDbvtVolume bounds( const tNodeArray& leaves)
|
||||
{
|
||||
#ifdef BT_USE_SSE
|
||||
#if DBVT_MERGE_IMPL==DBVT_IMPL_SSE
|
||||
ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtVolume)]);
|
||||
btDbvtVolume* ptr = (btDbvtVolume*) locals;
|
||||
btDbvtVolume& volume=*ptr;
|
||||
@@ -307,7 +257,7 @@ static btDbvtVolume bounds(btDbvtNode** leaves,
|
||||
#else
|
||||
btDbvtVolume volume=leaves[0]->volume;
|
||||
#endif
|
||||
for (int i = 1, ni = count; i < ni; ++i)
|
||||
for(int i=1,ni=leaves.size();i<ni;++i)
|
||||
{
|
||||
Merge(volume,leaves[i]->volume,volume);
|
||||
}
|
||||
@@ -316,16 +266,15 @@ static btDbvtVolume bounds(btDbvtNode** leaves,
|
||||
|
||||
//
|
||||
static void bottomup( btDbvt* pdbvt,
|
||||
btDbvtNode** leaves,
|
||||
int count)
|
||||
tNodeArray& leaves)
|
||||
{
|
||||
while (count > 1)
|
||||
while(leaves.size()>1)
|
||||
{
|
||||
btScalar minsize=SIMD_INFINITY;
|
||||
int minidx[2]={-1,-1};
|
||||
for (int i = 0; i < count; ++i)
|
||||
for(int i=0;i<leaves.size();++i)
|
||||
{
|
||||
for (int j = i + 1; j < count; ++j)
|
||||
for(int j=i+1;j<leaves.size();++j)
|
||||
{
|
||||
const btScalar sz=size(merge(leaves[i]->volume,leaves[j]->volume));
|
||||
if(sz<minsize)
|
||||
@@ -343,33 +292,31 @@ static void bottomup(btDbvt* pdbvt,
|
||||
n[0]->parent = p;
|
||||
n[1]->parent = p;
|
||||
leaves[minidx[0]] = p;
|
||||
leaves[minidx[1]] = leaves[count - 1];
|
||||
--count;
|
||||
leaves.swap(minidx[1],leaves.size()-1);
|
||||
leaves.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
static btDbvtNode* topdown(btDbvt* pdbvt,
|
||||
btDbvtNode** leaves,
|
||||
int count,
|
||||
tNodeArray& leaves,
|
||||
int bu_treshold)
|
||||
{
|
||||
static const btVector3 axis[]={btVector3(1,0,0),
|
||||
btVector3(0,1,0),
|
||||
btVector3(0,0,1)};
|
||||
btAssert(bu_treshold > 2);
|
||||
if (count > 1)
|
||||
if(leaves.size()>1)
|
||||
{
|
||||
if (count > bu_treshold)
|
||||
if(leaves.size()>bu_treshold)
|
||||
{
|
||||
const btDbvtVolume vol = bounds(leaves, count);
|
||||
const btDbvtVolume vol=bounds(leaves);
|
||||
const btVector3 org=vol.Center();
|
||||
int partition;
|
||||
tNodeArray sets[2];
|
||||
int bestaxis=-1;
|
||||
int bestmidp = count;
|
||||
int bestmidp=leaves.size();
|
||||
int splitcount[3][2]={{0,0},{0,0},{0,0}};
|
||||
int i;
|
||||
for (i = 0; i < count; ++i)
|
||||
for( i=0;i<leaves.size();++i)
|
||||
{
|
||||
const btVector3 x=leaves[i]->volume.Center()-org;
|
||||
for(int j=0;j<3;++j)
|
||||
@@ -391,23 +338,29 @@ static btDbvtNode* topdown(btDbvt* pdbvt,
|
||||
}
|
||||
if(bestaxis>=0)
|
||||
{
|
||||
partition = split(leaves, count, org, axis[bestaxis]);
|
||||
btAssert(partition != 0 && partition != count);
|
||||
sets[0].reserve(splitcount[bestaxis][0]);
|
||||
sets[1].reserve(splitcount[bestaxis][1]);
|
||||
split(leaves,sets[0],sets[1],org,axis[bestaxis]);
|
||||
}
|
||||
else
|
||||
{
|
||||
partition = count / 2 + 1;
|
||||
sets[0].reserve(leaves.size()/2+1);
|
||||
sets[1].reserve(leaves.size()/2);
|
||||
for(int i=0,ni=leaves.size();i<ni;++i)
|
||||
{
|
||||
sets[i&1].push_back(leaves[i]);
|
||||
}
|
||||
}
|
||||
btDbvtNode* node=createnode(pdbvt,0,vol,0);
|
||||
node->childs[0] = topdown(pdbvt, &leaves[0], partition, bu_treshold);
|
||||
node->childs[1] = topdown(pdbvt, &leaves[partition], count - partition, bu_treshold);
|
||||
node->childs[0]=topdown(pdbvt,sets[0],bu_treshold);
|
||||
node->childs[1]=topdown(pdbvt,sets[1],bu_treshold);
|
||||
node->childs[0]->parent=node;
|
||||
node->childs[1]->parent=node;
|
||||
return(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
bottomup(pdbvt, leaves, count);
|
||||
bottomup(pdbvt,leaves);
|
||||
return(leaves[0]);
|
||||
}
|
||||
}
|
||||
@@ -426,10 +379,7 @@ static DBVT_INLINE btDbvtNode* sort(btDbvtNode* n, btDbvtNode*& r)
|
||||
btDbvtNode* s=p->childs[j];
|
||||
btDbvtNode* q=p->parent;
|
||||
btAssert(n==p->childs[i]);
|
||||
if (q)
|
||||
q->childs[indexof(p)] = n;
|
||||
else
|
||||
r = n;
|
||||
if(q) q->childs[indexof(p)]=n; else r=n;
|
||||
s->parent=n;
|
||||
p->parent=n;
|
||||
n->parent=q;
|
||||
@@ -483,6 +433,7 @@ void btDbvt::clear()
|
||||
m_lkhd = -1;
|
||||
m_stkStack.clear();
|
||||
m_opath = 0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -493,7 +444,7 @@ void btDbvt::optimizeBottomUp()
|
||||
tNodeArray leaves;
|
||||
leaves.reserve(m_leaves);
|
||||
fetchleaves(this,m_root,leaves);
|
||||
bottomup(this, &leaves[0], leaves.size());
|
||||
bottomup(this,leaves);
|
||||
m_root=leaves[0];
|
||||
}
|
||||
}
|
||||
@@ -506,7 +457,7 @@ void btDbvt::optimizeTopDown(int bu_treshold)
|
||||
tNodeArray leaves;
|
||||
leaves.reserve(m_leaves);
|
||||
fetchleaves(this,m_root,leaves);
|
||||
m_root = topdown(this, &leaves[0], leaves.size(), bu_treshold);
|
||||
m_root=topdown(this,leaves,bu_treshold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,8 +467,7 @@ void btDbvt::optimizeIncremental(int passes)
|
||||
if(passes<0) passes=m_leaves;
|
||||
if(m_root&&(passes>0))
|
||||
{
|
||||
do
|
||||
{
|
||||
do {
|
||||
btDbvtNode* node=m_root;
|
||||
unsigned bit=0;
|
||||
while(node->isinternal())
|
||||
@@ -552,9 +502,7 @@ void btDbvt::update(btDbvtNode* leaf, int lookahead)
|
||||
{
|
||||
root=root->parent;
|
||||
}
|
||||
}
|
||||
else
|
||||
root = m_root;
|
||||
} else root=m_root;
|
||||
}
|
||||
insertleaf(this,root,leaf);
|
||||
}
|
||||
@@ -571,9 +519,7 @@ void btDbvt::update(btDbvtNode* leaf, btDbvtVolume& volume)
|
||||
{
|
||||
root=root->parent;
|
||||
}
|
||||
}
|
||||
else
|
||||
root = m_root;
|
||||
} else root=m_root;
|
||||
}
|
||||
leaf->volume=volume;
|
||||
insertleaf(this,root,leaf);
|
||||
@@ -649,8 +595,7 @@ void btDbvt::clone(btDbvt& dest, IClone* iclone) const
|
||||
btAlignedObjectArray<sStkCLN> stack;
|
||||
stack.reserve(m_leaves);
|
||||
stack.push_back(sStkCLN(m_root,0));
|
||||
do
|
||||
{
|
||||
do {
|
||||
const int i=stack.size()-1;
|
||||
const sStkCLN e=stack[i];
|
||||
btDbvtNode* n=createnode(&dest,e.parent,e.node->volume,e.node->data);
|
||||
@@ -756,12 +701,7 @@ struct btDbvtBenchmark
|
||||
{
|
||||
++m_pcount;
|
||||
if(m_checksort)
|
||||
{
|
||||
if (depth >= m_depth)
|
||||
m_depth = depth;
|
||||
else
|
||||
printf("wrong depth: %f (should be >= %f)\r\n", depth, m_depth);
|
||||
}
|
||||
{ if(depth>=m_depth) m_depth=depth; else printf("wrong depth: %f (should be >= %f)\r\n",depth,m_depth); }
|
||||
}
|
||||
int m_pcount;
|
||||
btScalar m_depth;
|
||||
|
@@ -21,10 +21,12 @@ subject to the following restrictions:
|
||||
#include "LinearMath/btVector3.h"
|
||||
#include "LinearMath/btTransform.h"
|
||||
#include "LinearMath/btAabbUtil2.h"
|
||||
|
||||
//
|
||||
// Compile time configuration
|
||||
//
|
||||
|
||||
|
||||
// Implementation profiles
|
||||
#define DBVT_IMPL_GENERIC 0 // Generic implementation
|
||||
#define DBVT_IMPL_SSE 1 // SSE
|
||||
@@ -80,12 +82,9 @@ subject to the following restrictions:
|
||||
#define DBVT_VIRTUAL_DTOR(a)
|
||||
#define DBVT_PREFIX template <typename T>
|
||||
#define DBVT_IPOLICY T& policy
|
||||
#define DBVT_CHECKTYPE \
|
||||
static const ICollide& typechecker = *(T*)1; \
|
||||
(void)typechecker;
|
||||
#define DBVT_CHECKTYPE static const ICollide& typechecker=*(T*)1;(void)typechecker;
|
||||
#else
|
||||
#define DBVT_VIRTUAL_DTOR(a) \
|
||||
virtual ~a() {}
|
||||
#define DBVT_VIRTUAL_DTOR(a) virtual ~a() {}
|
||||
#define DBVT_VIRTUAL virtual
|
||||
#define DBVT_PREFIX
|
||||
#define DBVT_IPOLICY ICollide& policy
|
||||
@@ -130,7 +129,6 @@ subject to the following restrictions:
|
||||
/* btDbvtAabbMm */
|
||||
struct btDbvtAabbMm
|
||||
{
|
||||
DBVT_INLINE btDbvtAabbMm(){}
|
||||
DBVT_INLINE btVector3 Center() const { return((mi+mx)/2); }
|
||||
DBVT_INLINE btVector3 Lengths() const { return(mx-mi); }
|
||||
DBVT_INLINE btVector3 Extents() const { return((mx-mi)/2); }
|
||||
@@ -168,7 +166,6 @@ struct btDbvtAabbMm
|
||||
|
||||
private:
|
||||
DBVT_INLINE void AddSpan(const btVector3& d,btScalar& smi,btScalar& smx) const;
|
||||
|
||||
private:
|
||||
btVector3 mi,mx;
|
||||
};
|
||||
@@ -183,45 +180,14 @@ struct btDbvtNode
|
||||
btDbvtNode* parent;
|
||||
DBVT_INLINE bool isleaf() const { return(childs[1]==0); }
|
||||
DBVT_INLINE bool isinternal() const { return(!isleaf()); }
|
||||
union {
|
||||
union
|
||||
{
|
||||
btDbvtNode* childs[2];
|
||||
void* data;
|
||||
int dataAsInt;
|
||||
};
|
||||
};
|
||||
|
||||
/* btDbv(normal)tNode */
|
||||
struct btDbvntNode
|
||||
{
|
||||
btDbvtVolume volume;
|
||||
btVector3 normal;
|
||||
btScalar angle;
|
||||
DBVT_INLINE bool isleaf() const { return (childs[1] == 0); }
|
||||
DBVT_INLINE bool isinternal() const { return (!isleaf()); }
|
||||
btDbvntNode* childs[2];
|
||||
void* data;
|
||||
|
||||
btDbvntNode(const btDbvtNode* n)
|
||||
: volume(n->volume)
|
||||
, normal(0,0,0)
|
||||
, angle(0)
|
||||
, data(n->data)
|
||||
{
|
||||
childs[0] = 0;
|
||||
childs[1] = 0;
|
||||
}
|
||||
|
||||
~btDbvntNode()
|
||||
{
|
||||
if (childs[0])
|
||||
delete childs[0];
|
||||
if (childs[1])
|
||||
delete childs[1];
|
||||
}
|
||||
};
|
||||
|
||||
typedef btAlignedObjectArray<const btDbvtNode*> btNodeStack;
|
||||
|
||||
///The btDbvt class implements a fast dynamic bounding volume tree based on axis aligned bounding boxes (aabb tree).
|
||||
///This btDbvt is used for soft body collision detection and for the btDbvtBroadphase. It has a fast insert, remove and update of nodes.
|
||||
///Unlike the btQuantizedBvh, nodes can be dynamically moved around, which allows for change in topology of the underlying data structure.
|
||||
@@ -255,14 +221,6 @@ struct btDbvt
|
||||
btDbvtNode* parent;
|
||||
sStkCLN(const btDbvtNode* n,btDbvtNode* p) : node(n),parent(p) {}
|
||||
};
|
||||
|
||||
struct sStknNN
|
||||
{
|
||||
const btDbvntNode* a;
|
||||
const btDbvntNode* b;
|
||||
sStknNN() {}
|
||||
sStknNN(const btDbvntNode* na, const btDbvntNode* nb) : a(na), b(nb) {}
|
||||
};
|
||||
// Policies/Interfaces
|
||||
|
||||
/* ICollide */
|
||||
@@ -272,7 +230,6 @@ struct btDbvt
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode*,const btDbvtNode*) {}
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode*) {}
|
||||
DBVT_VIRTUAL void Process(const btDbvtNode* n,btScalar) { Process(n); }
|
||||
DBVT_VIRTUAL void Process(const btDbvntNode*, const btDbvntNode*) {}
|
||||
DBVT_VIRTUAL bool Descent(const btDbvtNode*) { return(true); }
|
||||
DBVT_VIRTUAL bool AllLeaves(const btDbvtNode*) { return(true); }
|
||||
};
|
||||
@@ -292,8 +249,7 @@ struct btDbvt
|
||||
};
|
||||
|
||||
// Constants
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
SIMPLE_STACKSIZE = 64,
|
||||
DOUBLE_STACKSIZE = SIMPLE_STACKSIZE*2
|
||||
};
|
||||
@@ -305,7 +261,10 @@ struct btDbvt
|
||||
int m_leaves;
|
||||
unsigned m_opath;
|
||||
|
||||
|
||||
btAlignedObjectArray<sStkNN> m_stkStack;
|
||||
mutable btAlignedObjectArray<const btDbvtNode*> m_rayTestStack;
|
||||
|
||||
|
||||
// Methods
|
||||
btDbvt();
|
||||
@@ -330,9 +289,7 @@ struct btDbvt
|
||||
#if DBVT_ENABLE_BENCHMARK
|
||||
static void benchmark();
|
||||
#else
|
||||
static void benchmark()
|
||||
{
|
||||
}
|
||||
static void benchmark(){}
|
||||
#endif
|
||||
// DBVT_IPOLICY must support ICollide policy/interface
|
||||
DBVT_PREFIX
|
||||
@@ -345,12 +302,6 @@ struct btDbvt
|
||||
void collideTT( const btDbvtNode* root0,
|
||||
const btDbvtNode* root1,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
void selfCollideT(const btDbvntNode* root,
|
||||
DBVT_IPOLICY);
|
||||
DBVT_PREFIX
|
||||
void selfCollideTT(const btDbvtNode* root,
|
||||
DBVT_IPOLICY);
|
||||
|
||||
DBVT_PREFIX
|
||||
void collideTTpersistentStack( const btDbvtNode* root0,
|
||||
@@ -374,13 +325,6 @@ struct btDbvt
|
||||
void collideTV( const btDbvtNode* root,
|
||||
const btDbvtVolume& volume,
|
||||
DBVT_IPOLICY) const;
|
||||
|
||||
DBVT_PREFIX
|
||||
void collideTVNoStackAlloc(const btDbvtNode* root,
|
||||
const btDbvtVolume& volume,
|
||||
btNodeStack& stack,
|
||||
DBVT_IPOLICY) const;
|
||||
|
||||
///rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thread-safe (uses locking etc)
|
||||
///rayTest is slower than rayTestInternal, because it builds a local stack, using memory allocations, and it recomputes signs/rayDirectionInverses each time
|
||||
DBVT_PREFIX
|
||||
@@ -399,7 +343,6 @@ struct btDbvt
|
||||
btScalar lambda_max,
|
||||
const btVector3& aabbMin,
|
||||
const btVector3& aabbMax,
|
||||
btAlignedObjectArray<const btDbvtNode*>& stack,
|
||||
DBVT_IPOLICY) const;
|
||||
|
||||
DBVT_PREFIX
|
||||
@@ -426,10 +369,7 @@ struct btDbvt
|
||||
while(l<h)
|
||||
{
|
||||
m=(l+h)>>1;
|
||||
if (a[i[m]].value >= v)
|
||||
l = m + 1;
|
||||
else
|
||||
h = m;
|
||||
if(a[i[m]].value>=v) l=m+1; else h=m;
|
||||
}
|
||||
return(h);
|
||||
}
|
||||
@@ -439,16 +379,9 @@ struct btDbvt
|
||||
{
|
||||
int i;
|
||||
if(ifree.size()>0)
|
||||
{
|
||||
i = ifree[ifree.size() - 1];
|
||||
ifree.pop_back();
|
||||
stock[i] = value;
|
||||
}
|
||||
{ i=ifree[ifree.size()-1];ifree.pop_back();stock[i]=value; }
|
||||
else
|
||||
{
|
||||
i = stock.size();
|
||||
stock.push_back(value);
|
||||
}
|
||||
{ i=stock.size();stock.push_back(value); }
|
||||
return(i);
|
||||
}
|
||||
//
|
||||
@@ -464,8 +397,7 @@ private:
|
||||
inline btDbvtAabbMm btDbvtAabbMm::FromCE(const btVector3& c,const btVector3& e)
|
||||
{
|
||||
btDbvtAabbMm box;
|
||||
box.mi = c - e;
|
||||
box.mx = c + e;
|
||||
box.mi=c-e;box.mx=c+e;
|
||||
return(box);
|
||||
}
|
||||
|
||||
@@ -479,8 +411,7 @@ inline btDbvtAabbMm btDbvtAabbMm::FromCR(const btVector3& c, btScalar r)
|
||||
inline btDbvtAabbMm btDbvtAabbMm::FromMM(const btVector3& mi,const btVector3& mx)
|
||||
{
|
||||
btDbvtAabbMm box;
|
||||
box.mi = mi;
|
||||
box.mx = mx;
|
||||
box.mi=mi;box.mx=mx;
|
||||
return(box);
|
||||
}
|
||||
|
||||
@@ -513,25 +444,15 @@ inline btDbvtAabbMm btDbvtAabbMm::FromPoints(const btVector3** ppts, int n)
|
||||
//
|
||||
DBVT_INLINE void btDbvtAabbMm::Expand(const btVector3& e)
|
||||
{
|
||||
mi -= e;
|
||||
mx += e;
|
||||
mi-=e;mx+=e;
|
||||
}
|
||||
|
||||
//
|
||||
DBVT_INLINE void btDbvtAabbMm::SignedExpand(const btVector3& e)
|
||||
{
|
||||
if (e.x() > 0)
|
||||
mx.setX(mx.x() + e[0]);
|
||||
else
|
||||
mi.setX(mi.x() + e[0]);
|
||||
if (e.y() > 0)
|
||||
mx.setY(mx.y() + e[1]);
|
||||
else
|
||||
mi.setY(mi.y() + e[1]);
|
||||
if (e.z() > 0)
|
||||
mx.setZ(mx.z() + e[2]);
|
||||
else
|
||||
mi.setZ(mi.z() + e[2]);
|
||||
if(e.x()>0) mx.setX(mx.x()+e[0]); else mi.setX(mi.x()+e[0]);
|
||||
if(e.y()>0) mx.setY(mx.y()+e[1]); else mi.setY(mi.y()+e[1]);
|
||||
if(e.z()>0) mx.setZ(mx.z()+e[2]); else mi.setZ(mi.z()+e[2]);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -551,38 +472,22 @@ DBVT_INLINE int btDbvtAabbMm::Classify(const btVector3& n, btScalar o, int s) co
|
||||
btVector3 pi,px;
|
||||
switch(s)
|
||||
{
|
||||
case (0 + 0 + 0):
|
||||
px = btVector3(mi.x(), mi.y(), mi.z());
|
||||
pi = btVector3(mx.x(), mx.y(), mx.z());
|
||||
break;
|
||||
case (1 + 0 + 0):
|
||||
px = btVector3(mx.x(), mi.y(), mi.z());
|
||||
pi = btVector3(mi.x(), mx.y(), mx.z());
|
||||
break;
|
||||
case (0 + 2 + 0):
|
||||
px = btVector3(mi.x(), mx.y(), mi.z());
|
||||
pi = btVector3(mx.x(), mi.y(), mx.z());
|
||||
break;
|
||||
case (1 + 2 + 0):
|
||||
px = btVector3(mx.x(), mx.y(), mi.z());
|
||||
pi = btVector3(mi.x(), mi.y(), mx.z());
|
||||
break;
|
||||
case (0 + 0 + 4):
|
||||
px = btVector3(mi.x(), mi.y(), mx.z());
|
||||
pi = btVector3(mx.x(), mx.y(), mi.z());
|
||||
break;
|
||||
case (1 + 0 + 4):
|
||||
px = btVector3(mx.x(), mi.y(), mx.z());
|
||||
pi = btVector3(mi.x(), mx.y(), mi.z());
|
||||
break;
|
||||
case (0 + 2 + 4):
|
||||
px = btVector3(mi.x(), mx.y(), mx.z());
|
||||
pi = btVector3(mx.x(), mi.y(), mi.z());
|
||||
break;
|
||||
case (1 + 2 + 4):
|
||||
px = btVector3(mx.x(), mx.y(), mx.z());
|
||||
pi = btVector3(mi.x(), mi.y(), mi.z());
|
||||
break;
|
||||
case (0+0+0): px=btVector3(mi.x(),mi.y(),mi.z());
|
||||
pi=btVector3(mx.x(),mx.y(),mx.z());break;
|
||||
case (1+0+0): px=btVector3(mx.x(),mi.y(),mi.z());
|
||||
pi=btVector3(mi.x(),mx.y(),mx.z());break;
|
||||
case (0+2+0): px=btVector3(mi.x(),mx.y(),mi.z());
|
||||
pi=btVector3(mx.x(),mi.y(),mx.z());break;
|
||||
case (1+2+0): px=btVector3(mx.x(),mx.y(),mi.z());
|
||||
pi=btVector3(mi.x(),mi.y(),mx.z());break;
|
||||
case (0+0+4): px=btVector3(mi.x(),mi.y(),mx.z());
|
||||
pi=btVector3(mx.x(),mx.y(),mi.z());break;
|
||||
case (1+0+4): px=btVector3(mx.x(),mi.y(),mx.z());
|
||||
pi=btVector3(mi.x(),mx.y(),mi.z());break;
|
||||
case (0+2+4): px=btVector3(mi.x(),mx.y(),mx.z());
|
||||
pi=btVector3(mx.x(),mi.y(),mi.z());break;
|
||||
case (1+2+4): px=btVector3(mx.x(),mx.y(),mx.z());
|
||||
pi=btVector3(mi.x(),mi.y(),mi.z());break;
|
||||
}
|
||||
if((btDot(n,px)+o)<0) return(-1);
|
||||
if((btDot(n,pi)+o)>=0) return(+1);
|
||||
@@ -605,15 +510,9 @@ DBVT_INLINE void btDbvtAabbMm::AddSpan(const btVector3& d, btScalar& smi, btScal
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
if(d[i]<0)
|
||||
{
|
||||
smi += mx[i] * d[i];
|
||||
smx += mi[i] * d[i];
|
||||
}
|
||||
{ smi+=mx[i]*d[i];smx+=mi[i]*d[i]; }
|
||||
else
|
||||
{
|
||||
smi += mi[i] * d[i];
|
||||
smx += mx[i] * d[i];
|
||||
}
|
||||
{ smi+=mi[i]*d[i];smx+=mx[i]*d[i]; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,6 +539,8 @@ DBVT_INLINE bool Intersect(const btDbvtAabbMm& a,
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
DBVT_INLINE bool Intersect( const btDbvtAabbMm& a,
|
||||
const btVector3& b)
|
||||
@@ -652,8 +553,13 @@ DBVT_INLINE bool Intersect(const btDbvtAabbMm& a,
|
||||
(b.z()<=a.mx.z()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
DBVT_INLINE btScalar Proximity( const btDbvtAabbMm& a,
|
||||
const btDbvtAabbMm& b)
|
||||
@@ -662,6 +568,8 @@ DBVT_INLINE btScalar Proximity(const btDbvtAabbMm& a,
|
||||
return(btFabs(d.x())+btFabs(d.y())+btFabs(d.z()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
DBVT_INLINE int Select( const btDbvtAabbMm& o,
|
||||
const btDbvtAabbMm& a,
|
||||
@@ -758,14 +666,8 @@ DBVT_INLINE void Merge(const btDbvtAabbMm& a,
|
||||
#else
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
if (a.mi[i] < b.mi[i])
|
||||
r.mi[i] = a.mi[i];
|
||||
else
|
||||
r.mi[i] = b.mi[i];
|
||||
if (a.mx[i] > b.mx[i])
|
||||
r.mx[i] = a.mx[i];
|
||||
else
|
||||
r.mx[i] = b.mx[i];
|
||||
if(a.mi[i]<b.mi[i]) r.mi[i]=a.mi[i]; else r.mi[i]=b.mi[i];
|
||||
if(a.mx[i]>b.mx[i]) r.mx[i]=a.mx[i]; else r.mx[i]=b.mx[i];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -831,8 +733,7 @@ inline void btDbvt::collideTT(const btDbvtNode* root0,
|
||||
btAlignedObjectArray<sStkNN> stkStack;
|
||||
stkStack.resize(DOUBLE_STACKSIZE);
|
||||
stkStack[0]=sStkNN(root0,root1);
|
||||
do
|
||||
{
|
||||
do {
|
||||
sStkNN p=stkStack[--depth];
|
||||
if(depth>treshold)
|
||||
{
|
||||
@@ -882,133 +783,6 @@ inline void btDbvt::collideTT(const btDbvtNode* root0,
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::selfCollideT(const btDbvntNode* root,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
if (root)
|
||||
{
|
||||
int depth = 1;
|
||||
int treshold = DOUBLE_STACKSIZE - 4;
|
||||
btAlignedObjectArray<sStknNN> stkStack;
|
||||
stkStack.resize(DOUBLE_STACKSIZE);
|
||||
stkStack[0] = sStknNN(root, root);
|
||||
do
|
||||
{
|
||||
sStknNN p = stkStack[--depth];
|
||||
if (depth > treshold)
|
||||
{
|
||||
stkStack.resize(stkStack.size() * 2);
|
||||
treshold = stkStack.size() - 4;
|
||||
}
|
||||
if (p.a == p.b)
|
||||
{
|
||||
if (p.a->isinternal() && p.a->angle > SIMD_PI)
|
||||
{
|
||||
stkStack[depth++] = sStknNN(p.a->childs[0], p.a->childs[0]);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[1], p.a->childs[1]);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[0], p.a->childs[1]);
|
||||
}
|
||||
}
|
||||
else if (Intersect(p.a->volume, p.b->volume))
|
||||
{
|
||||
if (p.a->isinternal())
|
||||
{
|
||||
if (p.b->isinternal())
|
||||
{
|
||||
stkStack[depth++] = sStknNN(p.a->childs[0], p.b->childs[0]);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[1], p.b->childs[0]);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[0], p.b->childs[1]);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[1], p.b->childs[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
stkStack[depth++] = sStknNN(p.a->childs[0], p.b);
|
||||
stkStack[depth++] = sStknNN(p.a->childs[1], p.b);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.b->isinternal())
|
||||
{
|
||||
stkStack[depth++] = sStknNN(p.a, p.b->childs[0]);
|
||||
stkStack[depth++] = sStknNN(p.a, p.b->childs[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
policy.Process(p.a, p.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (depth);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::selfCollideTT(const btDbvtNode* root,
|
||||
DBVT_IPOLICY)
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
if (root)
|
||||
{
|
||||
int depth = 1;
|
||||
int treshold = DOUBLE_STACKSIZE - 4;
|
||||
btAlignedObjectArray<sStkNN> stkStack;
|
||||
stkStack.resize(DOUBLE_STACKSIZE);
|
||||
stkStack[0] = sStkNN(root, root);
|
||||
do
|
||||
{
|
||||
sStkNN p = stkStack[--depth];
|
||||
if (depth > treshold)
|
||||
{
|
||||
stkStack.resize(stkStack.size() * 2);
|
||||
treshold = stkStack.size() - 4;
|
||||
}
|
||||
if (p.a == p.b)
|
||||
{
|
||||
if (p.a->isinternal())
|
||||
{
|
||||
stkStack[depth++] = sStkNN(p.a->childs[0], p.a->childs[0]);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[1], p.a->childs[1]);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[0], p.a->childs[1]);
|
||||
}
|
||||
}
|
||||
else if (Intersect(p.a->volume, p.b->volume))
|
||||
{
|
||||
if (p.a->isinternal())
|
||||
{
|
||||
if (p.b->isinternal())
|
||||
{
|
||||
stkStack[depth++] = sStkNN(p.a->childs[0], p.b->childs[0]);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[1], p.b->childs[0]);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[0], p.b->childs[1]);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[1], p.b->childs[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
stkStack[depth++] = sStkNN(p.a->childs[0], p.b);
|
||||
stkStack[depth++] = sStkNN(p.a->childs[1], p.b);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p.b->isinternal())
|
||||
{
|
||||
stkStack[depth++] = sStkNN(p.a, p.b->childs[0]);
|
||||
stkStack[depth++] = sStkNN(p.a, p.b->childs[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
policy.Process(p.a, p.b);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DBVT_PREFIX
|
||||
@@ -1024,8 +798,7 @@ inline void btDbvt::collideTTpersistentStack(const btDbvtNode* root0,
|
||||
|
||||
m_stkStack.resize(DOUBLE_STACKSIZE);
|
||||
m_stkStack[0]=sStkNN(root0,root1);
|
||||
do
|
||||
{
|
||||
do {
|
||||
sStkNN p=m_stkStack[--depth];
|
||||
if(depth>treshold)
|
||||
{
|
||||
@@ -1144,6 +917,7 @@ inline void btDbvt::collideTT( const btDbvtNode* root0,
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTV( const btDbvtNode* root,
|
||||
const btDbvtVolume& vol,
|
||||
@@ -1152,55 +926,12 @@ inline void btDbvt::collideTV(const btDbvtNode* root,
|
||||
DBVT_CHECKTYPE
|
||||
if(root)
|
||||
{
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
volume(vol);
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) volume(vol);
|
||||
btAlignedObjectArray<const btDbvtNode*> stack;
|
||||
stack.resize(0);
|
||||
#ifndef BT_DISABLE_STACK_TEMP_MEMORY
|
||||
char tempmemory[SIMPLE_STACKSIZE * sizeof(const btDbvtNode*)];
|
||||
stack.initializeFromBuffer(tempmemory, 0, SIMPLE_STACKSIZE);
|
||||
#else
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
#endif //BT_DISABLE_STACK_TEMP_MEMORY
|
||||
|
||||
stack.push_back(root);
|
||||
do
|
||||
{
|
||||
const btDbvtNode* n = stack[stack.size() - 1];
|
||||
stack.pop_back();
|
||||
if (Intersect(n->volume, volume))
|
||||
{
|
||||
if (n->isinternal())
|
||||
{
|
||||
stack.push_back(n->childs[0]);
|
||||
stack.push_back(n->childs[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
policy.Process(n);
|
||||
}
|
||||
}
|
||||
} while (stack.size() > 0);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
DBVT_PREFIX
|
||||
inline void btDbvt::collideTVNoStackAlloc(const btDbvtNode* root,
|
||||
const btDbvtVolume& vol,
|
||||
btNodeStack& stack,
|
||||
DBVT_IPOLICY) const
|
||||
{
|
||||
DBVT_CHECKTYPE
|
||||
if (root)
|
||||
{
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
volume(vol);
|
||||
stack.resize(0);
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(root);
|
||||
do
|
||||
{
|
||||
do {
|
||||
const btDbvtNode* n=stack[stack.size()-1];
|
||||
stack.pop_back();
|
||||
if(Intersect(n->volume,volume))
|
||||
@@ -1228,7 +959,6 @@ inline void btDbvt::rayTestInternal(const btDbvtNode* root,
|
||||
btScalar lambda_max,
|
||||
const btVector3& aabbMin,
|
||||
const btVector3& aabbMax,
|
||||
btAlignedObjectArray<const btDbvtNode*>& stack,
|
||||
DBVT_IPOLICY) const
|
||||
{
|
||||
(void) rayTo;
|
||||
@@ -1239,6 +969,7 @@ inline void btDbvt::rayTestInternal(const btDbvtNode* root,
|
||||
|
||||
int depth=1;
|
||||
int treshold=DOUBLE_STACKSIZE-2;
|
||||
btAlignedObjectArray<const btDbvtNode*>& stack = m_rayTestStack;
|
||||
stack.resize(DOUBLE_STACKSIZE);
|
||||
stack[0]=root;
|
||||
btVector3 bounds[2];
|
||||
@@ -1300,16 +1031,10 @@ inline void btDbvt::rayTest(const btDbvtNode* root,
|
||||
int depth=1;
|
||||
int treshold=DOUBLE_STACKSIZE-2;
|
||||
|
||||
char tempmemory[DOUBLE_STACKSIZE * sizeof(const btDbvtNode*)];
|
||||
#ifndef BT_DISABLE_STACK_TEMP_MEMORY
|
||||
stack.initializeFromBuffer(tempmemory, DOUBLE_STACKSIZE, DOUBLE_STACKSIZE);
|
||||
#else //BT_DISABLE_STACK_TEMP_MEMORY
|
||||
stack.resize(DOUBLE_STACKSIZE);
|
||||
#endif //BT_DISABLE_STACK_TEMP_MEMORY
|
||||
stack[0]=root;
|
||||
btVector3 bounds[2];
|
||||
do
|
||||
{
|
||||
do {
|
||||
const btDbvtNode* node=stack[--depth];
|
||||
|
||||
bounds[0] = node->volume.Mins();
|
||||
@@ -1342,6 +1067,7 @@ inline void btDbvt::rayTest(const btDbvtNode* root,
|
||||
}
|
||||
}
|
||||
} while(depth);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1368,8 +1094,7 @@ inline void btDbvt::collideKDOP(const btDbvtNode* root,
|
||||
}
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(sStkNP(root,0));
|
||||
do
|
||||
{
|
||||
do {
|
||||
sStkNP se=stack[stack.size()-1];
|
||||
bool out=false;
|
||||
stack.pop_back();
|
||||
@@ -1380,12 +1105,8 @@ inline void btDbvt::collideKDOP(const btDbvtNode* root,
|
||||
const int side=se.node->volume.Classify(normals[i],offsets[i],signs[i]);
|
||||
switch(side)
|
||||
{
|
||||
case -1:
|
||||
out = true;
|
||||
break;
|
||||
case +1:
|
||||
se.mask |= j;
|
||||
break;
|
||||
case -1: out=true;break;
|
||||
case +1: se.mask|=j;break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1437,12 +1158,10 @@ inline void btDbvt::collideOCL(const btDbvtNode* root,
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
ifree.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(allocate(ifree,stock,sStkNPS(root,0,root->volume.ProjectMinimum(sortaxis,srtsgns))));
|
||||
do
|
||||
{
|
||||
do {
|
||||
const int id=stack[stack.size()-1];
|
||||
sStkNPS se=stock[id];
|
||||
stack.pop_back();
|
||||
ifree.push_back(id);
|
||||
stack.pop_back();ifree.push_back(id);
|
||||
if(se.mask!=inside)
|
||||
{
|
||||
bool out=false;
|
||||
@@ -1453,12 +1172,8 @@ inline void btDbvt::collideOCL(const btDbvtNode* root,
|
||||
const int side=se.node->volume.Classify(normals[i],offsets[i],signs[i]);
|
||||
switch(side)
|
||||
{
|
||||
case -1:
|
||||
out = true;
|
||||
break;
|
||||
case +1:
|
||||
se.mask |= j;
|
||||
break;
|
||||
case -1: out=true;break;
|
||||
case +1: se.mask|=j;break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1488,8 +1203,7 @@ inline void btDbvt::collideOCL(const btDbvtNode* root,
|
||||
memmove(&stack[j+1],&stack[j],sizeof(int)*num_items_to_move);
|
||||
}
|
||||
#else
|
||||
for (int k = stack.size() - 1; k > j; --k)
|
||||
{
|
||||
for(int k=stack.size()-1;k>j;--k) {
|
||||
stack[k]=stack[k-1];
|
||||
}
|
||||
#endif
|
||||
@@ -1504,8 +1218,7 @@ inline void btDbvt::collideOCL(const btDbvtNode* root,
|
||||
memmove(&stack[j+1],&stack[j],sizeof(int)*num_items_to_move);
|
||||
}
|
||||
#else
|
||||
for (int k = stack.size() - 1; k > j; --k)
|
||||
{
|
||||
for(int k=stack.size()-1;k>j;--k) {
|
||||
stack[k]=stack[k-1];
|
||||
}
|
||||
#endif
|
||||
@@ -1537,21 +1250,15 @@ inline void btDbvt::collideTU(const btDbvtNode* root,
|
||||
btAlignedObjectArray<const btDbvtNode*> stack;
|
||||
stack.reserve(SIMPLE_STACKSIZE);
|
||||
stack.push_back(root);
|
||||
do
|
||||
{
|
||||
do {
|
||||
const btDbvtNode* n=stack[stack.size()-1];
|
||||
stack.pop_back();
|
||||
if(policy.Descent(n))
|
||||
{
|
||||
if(n->isinternal())
|
||||
{
|
||||
stack.push_back(n->childs[0]);
|
||||
stack.push_back(n->childs[1]);
|
||||
}
|
||||
{ stack.push_back(n->childs[0]);stack.push_back(n->childs[1]); }
|
||||
else
|
||||
{
|
||||
policy.Process(n);
|
||||
}
|
||||
{ policy.Process(n); }
|
||||
}
|
||||
} while(stack.size()>0);
|
||||
}
|
||||
|
@@ -16,8 +16,7 @@ subject to the following restrictions:
|
||||
///btDbvtBroadphase implementation by Nathanael Presson
|
||||
|
||||
#include "btDbvtBroadphase.h"
|
||||
#include "LinearMath/btThreads.h"
|
||||
btScalar gDbvtMargin = btScalar(0.05);
|
||||
|
||||
//
|
||||
// Profiling
|
||||
//
|
||||
@@ -29,7 +28,8 @@ btScalar gDbvtMargin = btScalar(0.05);
|
||||
#if DBVT_BP_PROFILE
|
||||
struct ProfileScope
|
||||
{
|
||||
__forceinline ProfileScope(btClock& clock, unsigned long& value) : m_clock(&clock), m_value(&value), m_base(clock.getTimeMicroseconds())
|
||||
__forceinline ProfileScope(btClock& clock,unsigned long& value) :
|
||||
m_clock(&clock),m_value(&value),m_base(clock.getTimeMicroseconds())
|
||||
{
|
||||
}
|
||||
__forceinline ~ProfileScope()
|
||||
@@ -63,10 +63,7 @@ static inline void listappend(T* item, T*& list)
|
||||
template <typename T>
|
||||
static inline void listremove(T* item,T*& list)
|
||||
{
|
||||
if (item->links[0])
|
||||
item->links[0]->links[1] = item->links[1];
|
||||
else
|
||||
list = item->links[1];
|
||||
if(item->links[0]) item->links[0]->links[1]=item->links[1]; else list=item->links[1];
|
||||
if(item->links[1]) item->links[1]->links[0]=item->links[0];
|
||||
}
|
||||
|
||||
@@ -75,11 +72,7 @@ template <typename T>
|
||||
static inline int listcount(T* root)
|
||||
{
|
||||
int n=0;
|
||||
while (root)
|
||||
{
|
||||
++n;
|
||||
root = root->links[1];
|
||||
}
|
||||
while(root) { ++n;root=root->links[1]; }
|
||||
return(n);
|
||||
}
|
||||
|
||||
@@ -87,9 +80,7 @@ static inline int listcount(T* root)
|
||||
template <typename T>
|
||||
static inline void clear(T& value)
|
||||
{
|
||||
static const struct ZeroDummy : T
|
||||
{
|
||||
} zerodummy;
|
||||
static const struct ZeroDummy : T {} zerodummy;
|
||||
value=zerodummy;
|
||||
}
|
||||
|
||||
@@ -151,11 +142,6 @@ btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache)
|
||||
{
|
||||
m_stageRoots[i]=0;
|
||||
}
|
||||
#if BT_THREADSAFE
|
||||
m_rayTestStacks.resize(BT_MAX_THREAD_COUNT);
|
||||
#else
|
||||
m_rayTestStacks.resize(1);
|
||||
#endif
|
||||
#if DBVT_BP_PROFILE
|
||||
clear(m_profiling);
|
||||
#endif
|
||||
@@ -176,9 +162,10 @@ btBroadphaseProxy* btDbvtBroadphase::createProxy(const btVector3& aabbMin,
|
||||
const btVector3& aabbMax,
|
||||
int /*shapeType*/,
|
||||
void* userPtr,
|
||||
int collisionFilterGroup,
|
||||
int collisionFilterMask,
|
||||
btDispatcher* /*dispatcher*/)
|
||||
short int collisionFilterGroup,
|
||||
short int collisionFilterMask,
|
||||
btDispatcher* /*dispatcher*/,
|
||||
void* /*multiSapProxy*/)
|
||||
{
|
||||
btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( aabbMin,aabbMax,userPtr,
|
||||
collisionFilterGroup,
|
||||
@@ -240,25 +227,6 @@ struct BroadphaseRayTester : btDbvt::ICollide
|
||||
void btDbvtBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax)
|
||||
{
|
||||
BroadphaseRayTester callback(rayCallback);
|
||||
btAlignedObjectArray<const btDbvtNode*>* stack = &m_rayTestStacks[0];
|
||||
#if BT_THREADSAFE
|
||||
// for this function to be threadsafe, each thread must have a separate copy
|
||||
// of this stack. This could be thread-local static to avoid dynamic allocations,
|
||||
// instead of just a local.
|
||||
int threadIndex = btGetCurrentThreadIndex();
|
||||
btAlignedObjectArray<const btDbvtNode*> localStack;
|
||||
//todo(erwincoumans, "why do we get tsan issue here?")
|
||||
if (0)//threadIndex < m_rayTestStacks.size())
|
||||
//if (threadIndex < m_rayTestStacks.size())
|
||||
{
|
||||
// use per-thread preallocated stack if possible to avoid dynamic allocations
|
||||
stack = &m_rayTestStacks[threadIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
stack = &localStack;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_sets[0].rayTestInternal( m_sets[0].m_root,
|
||||
rayFrom,
|
||||
@@ -268,7 +236,6 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom, const btVector3& rayTo,
|
||||
rayCallback.m_lambda_max,
|
||||
aabbMin,
|
||||
aabbMax,
|
||||
*stack,
|
||||
callback);
|
||||
|
||||
m_sets[1].rayTestInternal( m_sets[1].m_root,
|
||||
@@ -279,10 +246,11 @@ void btDbvtBroadphase::rayTest(const btVector3& rayFrom, const btVector3& rayTo,
|
||||
rayCallback.m_lambda_max,
|
||||
aabbMin,
|
||||
aabbMax,
|
||||
*stack,
|
||||
callback);
|
||||
|
||||
}
|
||||
|
||||
|
||||
struct BroadphaseAabbTester : btDbvt::ICollide
|
||||
{
|
||||
btBroadphaseAabbCallback& m_aabbCallback;
|
||||
@@ -305,8 +273,11 @@ void btDbvtBroadphase::aabbTest(const btVector3& aabbMin, const btVector3& aabbM
|
||||
//process all children, that overlap with the given AABB bounds
|
||||
m_sets[0].collideTV(m_sets[0].m_root,bounds,callback);
|
||||
m_sets[1].collideTV(m_sets[1].m_root,bounds,callback);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
void btDbvtBroadphase::setAabb( btBroadphaseProxy* absproxy,
|
||||
const btVector3& aabbMin,
|
||||
@@ -314,8 +285,7 @@ void btDbvtBroadphase::setAabb(btBroadphaseProxy* absproxy,
|
||||
btDispatcher* /*dispatcher*/)
|
||||
{
|
||||
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
aabb = btDbvtVolume::FromMM(aabbMin, aabbMax);
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
|
||||
#if DBVT_BP_PREVENTFALSEUPDATE
|
||||
if(NotEqual(aabb,proxy->leaf->volume))
|
||||
#endif
|
||||
@@ -339,8 +309,11 @@ void btDbvtBroadphase::setAabb(btBroadphaseProxy* absproxy,
|
||||
if(delta[1]<0) velocity[1]=-velocity[1];
|
||||
if(delta[2]<0) velocity[2]=-velocity[2];
|
||||
if (
|
||||
m_sets[0].update(proxy->leaf, aabb, velocity, gDbvtMargin)
|
||||
|
||||
#ifdef DBVT_BP_MARGIN
|
||||
m_sets[0].update(proxy->leaf,aabb,velocity,DBVT_BP_MARGIN)
|
||||
#else
|
||||
m_sets[0].update(proxy->leaf,aabb,velocity)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
++m_updates_done;
|
||||
@@ -372,6 +345,7 @@ void btDbvtBroadphase::setAabb(btBroadphaseProxy* absproxy,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
void btDbvtBroadphase::setAabbForceUpdate( btBroadphaseProxy* absproxy,
|
||||
const btVector3& aabbMin,
|
||||
@@ -379,8 +353,7 @@ void btDbvtBroadphase::setAabbForceUpdate(btBroadphaseProxy* absproxy,
|
||||
btDispatcher* /*dispatcher*/)
|
||||
{
|
||||
btDbvtProxy* proxy=(btDbvtProxy*)absproxy;
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
aabb = btDbvtVolume::FromMM(aabbMin, aabbMax);
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) aabb=btDbvtVolume::FromMM(aabbMin,aabbMax);
|
||||
bool docollide=false;
|
||||
if(proxy->stage==STAGECOUNT)
|
||||
{/* fixed -> dynamic set */
|
||||
@@ -438,12 +411,15 @@ void btDbvtBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
|
||||
#endif
|
||||
|
||||
performDeferredRemoval(dispatcher);
|
||||
|
||||
}
|
||||
|
||||
void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
if (m_paircache->hasDeferredRemoval())
|
||||
{
|
||||
|
||||
btBroadphasePairArray& overlappingPairArray = m_paircache->getOverlappingPairArray();
|
||||
|
||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||
@@ -451,6 +427,7 @@ void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
|
||||
int invalidPair = 0;
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
btBroadphasePair previousPair;
|
||||
@@ -458,8 +435,10 @@ void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
previousPair.m_pProxy1 = 0;
|
||||
previousPair.m_algorithm = 0;
|
||||
|
||||
|
||||
for (i=0;i<overlappingPairArray.size();i++)
|
||||
{
|
||||
|
||||
btBroadphasePair& pair = overlappingPairArray[i];
|
||||
|
||||
bool isDuplicate = (pair == previousPair);
|
||||
@@ -478,13 +457,11 @@ void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
if (hasOverlap)
|
||||
{
|
||||
needsRemoval = false;
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
needsRemoval = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
//remove duplicate
|
||||
needsRemoval = true;
|
||||
@@ -500,6 +477,7 @@ void btDbvtBroadphase::performDeferredRemoval(btDispatcher* dispatcher)
|
||||
pair.m_pProxy1 = 0;
|
||||
invalidPair++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//perform a sort, to sort 'invalid' pairs to the end
|
||||
@@ -526,6 +504,8 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
SPC(m_profiling.m_total);
|
||||
/* optimize */
|
||||
m_sets[0].optimizeIncremental(1+(m_sets[0].m_leaves*m_dupdates)/100);
|
||||
@@ -540,11 +520,8 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
btDbvtProxy* current=m_stageRoots[m_stageCurrent];
|
||||
if(current)
|
||||
{
|
||||
#if DBVT_BP_ACCURATESLEEPING
|
||||
btDbvtTreeCollider collider(this);
|
||||
#endif
|
||||
do
|
||||
{
|
||||
do {
|
||||
btDbvtProxy* next=current->links[1];
|
||||
listremove(current,m_stageRoots[current->stage]);
|
||||
listappend(current,m_stageRoots[STAGECOUNT]);
|
||||
@@ -555,8 +532,7 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
btDbvt::collideTV(m_sets[1].m_root,current->aabb,collider);
|
||||
#endif
|
||||
m_sets[0].remove(current->leaf);
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
curAabb = btDbvtVolume::FromMM(current->m_aabbMin, current->m_aabbMax);
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) curAabb=btDbvtVolume::FromMM(current->m_aabbMin,current->m_aabbMax);
|
||||
current->leaf = m_sets[1].insert(curAabb,current);
|
||||
current->stage = STAGECOUNT;
|
||||
current = next;
|
||||
@@ -585,6 +561,7 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
btBroadphasePairArray& pairs=m_paircache->getOverlappingPairArray();
|
||||
if(pairs.size()>0)
|
||||
{
|
||||
|
||||
int ni=btMin(pairs.size(),btMax<int>(m_newpairs,(pairs.size()*m_cupdates)/100));
|
||||
for(int i=0;i<ni;++i)
|
||||
{
|
||||
@@ -598,27 +575,19 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher)
|
||||
btSwap(pa,pb);
|
||||
#endif
|
||||
m_paircache->removeOverlappingPair(pa,pb,dispatcher);
|
||||
--ni;
|
||||
--i;
|
||||
--ni;--i;
|
||||
}
|
||||
}
|
||||
if (pairs.size() > 0)
|
||||
m_cid = (m_cid + ni) % pairs.size();
|
||||
else
|
||||
m_cid = 0;
|
||||
if(pairs.size()>0) m_cid=(m_cid+ni)%pairs.size(); else m_cid=0;
|
||||
}
|
||||
}
|
||||
++m_pid;
|
||||
m_newpairs=1;
|
||||
m_needcleanup=false;
|
||||
if(m_updates_call>0)
|
||||
{
|
||||
m_updates_ratio = m_updates_done / (btScalar)m_updates_call;
|
||||
}
|
||||
{ m_updates_ratio=m_updates_done/(btScalar)m_updates_call; }
|
||||
else
|
||||
{
|
||||
m_updates_ratio = 0;
|
||||
}
|
||||
{ m_updates_ratio=0; }
|
||||
m_updates_done/=2;
|
||||
m_updates_call/=2;
|
||||
}
|
||||
@@ -645,17 +614,15 @@ const btOverlappingPairCache* btDbvtBroadphase::getOverlappingPairCache() const
|
||||
//
|
||||
void btDbvtBroadphase::getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const
|
||||
{
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume)
|
||||
bounds;
|
||||
|
||||
ATTRIBUTE_ALIGNED16(btDbvtVolume) bounds;
|
||||
|
||||
if(!m_sets[0].empty())
|
||||
if (!m_sets[1].empty())
|
||||
Merge(m_sets[0].m_root->volume,
|
||||
if(!m_sets[1].empty()) Merge( m_sets[0].m_root->volume,
|
||||
m_sets[1].m_root->volume,bounds);
|
||||
else
|
||||
bounds=m_sets[0].m_root->volume;
|
||||
else if (!m_sets[1].empty())
|
||||
bounds = m_sets[1].m_root->volume;
|
||||
else if(!m_sets[1].empty()) bounds=m_sets[1].m_root->volume;
|
||||
else
|
||||
bounds=btDbvtVolume::FromCR(btVector3(0,0,0),0);
|
||||
aabbMin=bounds.Mins();
|
||||
@@ -664,6 +631,7 @@ void btDbvtBroadphase::getBroadphaseAabb(btVector3& aabbMin, btVector3& aabbMax)
|
||||
|
||||
void btDbvtBroadphase::resetPool(btDispatcher* dispatcher)
|
||||
{
|
||||
|
||||
int totalObjects = m_sets[0].m_leaves + m_sets[1].m_leaves;
|
||||
if (!totalObjects)
|
||||
{
|
||||
@@ -695,8 +663,7 @@ void btDbvtBroadphase::resetPool(btDispatcher* dispatcher)
|
||||
|
||||
//
|
||||
void btDbvtBroadphase::printStats()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
//
|
||||
#if DBVT_BP_ENABLE_BENCHMARK
|
||||
@@ -816,13 +783,14 @@ void btDbvtBroadphase::benchmark(btBroadphaseInterface* pbi)
|
||||
objects.resize(0);
|
||||
btBroadphaseBenchmark::OutputTime("\tRelease",wallclock);
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
void btDbvtBroadphase::benchmark(btBroadphaseInterface*)
|
||||
{
|
||||
}
|
||||
{}
|
||||
#endif
|
||||
|
||||
#if DBVT_BP_PROFILE
|
||||
#undef SPC
|
||||
#endif
|
||||
|
||||
|
@@ -29,8 +29,7 @@ subject to the following restrictions:
|
||||
#define DBVT_BP_PREVENTFALSEUPDATE 0
|
||||
#define DBVT_BP_ACCURATESLEEPING 0
|
||||
#define DBVT_BP_ENABLE_BENCHMARK 0
|
||||
//#define DBVT_BP_MARGIN (btScalar)0.05
|
||||
extern btScalar gDbvtMargin;
|
||||
#define DBVT_BP_MARGIN (btScalar)0.05
|
||||
|
||||
#if DBVT_BP_PROFILE
|
||||
#define DBVT_BP_PROFILING_RATE 256
|
||||
@@ -48,7 +47,8 @@ struct btDbvtProxy : btBroadphaseProxy
|
||||
btDbvtProxy* links[2];
|
||||
int stage;
|
||||
/* ctor */
|
||||
btDbvtProxy(const btVector3& aabbMin, const btVector3& aabbMax, void* userPtr, int collisionFilterGroup, int collisionFilterMask) : btBroadphaseProxy(aabbMin, aabbMax, userPtr, collisionFilterGroup, collisionFilterMask)
|
||||
btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) :
|
||||
btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask)
|
||||
{
|
||||
links[0]=links[1]=0;
|
||||
}
|
||||
@@ -62,8 +62,7 @@ typedef btAlignedObjectArray<btDbvtProxy*> btDbvtProxyArray;
|
||||
struct btDbvtBroadphase : btBroadphaseInterface
|
||||
{
|
||||
/* Config */
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
DYNAMIC_SET = 0, /* Dynamic set index */
|
||||
FIXED_SET = 1, /* Fixed set index */
|
||||
STAGECOUNT = 2 /* Number of stages */
|
||||
@@ -88,11 +87,9 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
||||
bool m_releasepaircache; // Release pair cache on delete
|
||||
bool m_deferedcollide; // Defere dynamic/static collision to collide call
|
||||
bool m_needcleanup; // Need to run cleanup?
|
||||
btAlignedObjectArray<btAlignedObjectArray<const btDbvtNode*> > m_rayTestStacks;
|
||||
#if DBVT_BP_PROFILE
|
||||
btClock m_clock;
|
||||
struct
|
||||
{
|
||||
struct {
|
||||
unsigned long m_total;
|
||||
unsigned long m_ddcollide;
|
||||
unsigned long m_fdcollide;
|
||||
@@ -107,7 +104,7 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
||||
void optimize();
|
||||
|
||||
/* btBroadphaseInterface Implementation */
|
||||
btBroadphaseProxy* createProxy(const btVector3& aabbMin, const btVector3& aabbMax, int shapeType, void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher);
|
||||
btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
|
||||
virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
|
||||
virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
|
||||
virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
|
||||
@@ -120,6 +117,7 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
||||
virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
|
||||
virtual void printStats();
|
||||
|
||||
|
||||
///reset broadphase internal structures, to ensure determinism/reproducability
|
||||
virtual void resetPool(btDispatcher* dispatcher);
|
||||
|
||||
@@ -141,6 +139,8 @@ struct btDbvtBroadphase : btBroadphaseInterface
|
||||
void setAabbForceUpdate( btBroadphaseProxy* absproxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* /*dispatcher*/);
|
||||
|
||||
static void benchmark(btBroadphaseInterface*);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -17,4 +17,6 @@ subject to the following restrictions:
|
||||
|
||||
btDispatcher::~btDispatcher()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
@@ -46,9 +46,9 @@ struct btDispatcherInfo
|
||||
m_useEpa(true),
|
||||
m_allowedCcdPenetration(btScalar(0.04)),
|
||||
m_useConvexConservativeDistanceUtil(false),
|
||||
m_convexConservativeDistanceThreshold(0.0f),
|
||||
m_deterministicOverlappingPairs(false)
|
||||
m_convexConservativeDistanceThreshold(0.0f)
|
||||
{
|
||||
|
||||
}
|
||||
btScalar m_timeStep;
|
||||
int m_stepCount;
|
||||
@@ -62,23 +62,18 @@ struct btDispatcherInfo
|
||||
btScalar m_allowedCcdPenetration;
|
||||
bool m_useConvexConservativeDistanceUtil;
|
||||
btScalar m_convexConservativeDistanceThreshold;
|
||||
bool m_deterministicOverlappingPairs;
|
||||
};
|
||||
|
||||
enum ebtDispatcherQueryType
|
||||
{
|
||||
BT_CONTACT_POINT_ALGORITHMS = 1,
|
||||
BT_CLOSEST_POINT_ALGORITHMS = 2
|
||||
};
|
||||
|
||||
///The btDispatcher interface class can be used in combination with broadphase to dispatch calculations for overlapping pairs.
|
||||
///For example for pairwise collision detection, calculating contact points stored in btPersistentManifold or user callbacks (game logic).
|
||||
class btDispatcher
|
||||
{
|
||||
|
||||
|
||||
public:
|
||||
virtual ~btDispatcher() ;
|
||||
|
||||
virtual btCollisionAlgorithm* findAlgorithm(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap, btPersistentManifold* sharedManifold, ebtDispatcherQueryType queryType) = 0;
|
||||
virtual btCollisionAlgorithm* findAlgorithm(const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,btPersistentManifold* sharedManifold=0) = 0;
|
||||
|
||||
virtual btPersistentManifold* getNewManifold(const btCollisionObject* b0,const btCollisionObject* b1)=0;
|
||||
|
||||
@@ -105,6 +100,8 @@ public:
|
||||
virtual void* allocateCollisionAlgorithm(int size) = 0;
|
||||
|
||||
virtual void freeCollisionAlgorithm(void* ptr) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif //BT_DISPATCHER_H
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user