Compare commits
14 Commits
temp-gpu-p
...
temp-geome
Author | SHA1 | Date | |
---|---|---|---|
73ed9afd03 | |||
de040ccb96 | |||
a9ba86c046 | |||
842375e1ed | |||
41bfb64da1 | |||
db59a5f9f0 | |||
a25dbf243a | |||
782b0df9c8 | |||
8969f4ba23 | |||
7cea4dc6f5 | |||
1e006e58dc | |||
0702871110 | |||
5ea958a992 | |||
7694a098ef |
@@ -265,5 +265,4 @@ ForEachMacros:
|
||||
- VECTOR_SET_SLOT_PROBING_BEGIN
|
||||
|
||||
StatementMacros:
|
||||
- PyObject_HEAD
|
||||
- PyObject_VAR_HEAD
|
||||
|
@@ -836,7 +836,7 @@ if(WITH_PYTHON)
|
||||
# because UNIX will search for the old Python paths which may not exist.
|
||||
# giving errors about missing paths before this case is met.
|
||||
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
|
||||
message(FATAL_ERROR "At least Python 3.9 is required to build, but found Python ${PYTHON_VERSION}")
|
||||
message(FATAL_ERROR "At least Python 3.9 is required to build")
|
||||
endif()
|
||||
|
||||
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")
|
||||
|
@@ -43,12 +43,6 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
set(EMBREE_BUILD_DIR ${BUILD_MODE}/)
|
||||
if(BUILD_MODE STREQUAL Debug)
|
||||
list(APPEND EMBREE_EXTRA_ARGS
|
||||
-DEMBREE_TBBMALLOC_LIBRARY_NAME=tbbmalloc_debug
|
||||
-DEMBREE_TBB_LIBRARY_NAME=tbb_debug
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(EMBREE_BUILD_DIR)
|
||||
endif()
|
||||
|
@@ -22,7 +22,6 @@ if(WIN32)
|
||||
-DTBB_BUILD_TBBMALLOC_PROXY=On
|
||||
-DTBB_BUILD_STATIC=Off
|
||||
-DTBB_BUILD_TESTS=Off
|
||||
-DCMAKE_DEBUG_POSTFIX=_debug
|
||||
)
|
||||
set(TBB_LIBRARY tbb)
|
||||
set(TBB_STATIC_LIBRARY Off)
|
||||
@@ -56,17 +55,17 @@ if(WIN32)
|
||||
ExternalProject_Add_Step(external_tbb after_install
|
||||
# findtbb.cmake in some deps *NEEDS* to find tbb_debug.lib even if they are not going to use it
|
||||
# to make that test pass, we place a copy with the right name in the lib folder.
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${LIBDIR}/tbb/lib/tbb_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${LIBDIR}/tbb/bin/tbb_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.dll
|
||||
# Normal collection of build artifacts
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb.dll ${HARVEST_TARGET}/tbb/bin/tbb.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tbb/include/ ${HARVEST_TARGET}/tbb/include/
|
||||
DEPENDEES install
|
||||
)
|
||||
@@ -77,12 +76,11 @@ if(WIN32)
|
||||
# to make that test pass, we place a copy with the right name in the lib folder.
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${LIBDIR}/tbb/lib/tbb.lib
|
||||
# Normal collection of build artifacts
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbb_debug.dll ${HARVEST_TARGET}/tbb/bin/tbb_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy_debug.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/bin/tbbmalloc_proxy_debug.dll ${HARVEST_TARGET}/tbb/bin/tbbmalloc_proxy_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.dll ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc_proxy.dll
|
||||
DEPENDEES install
|
||||
)
|
||||
endif()
|
||||
|
@@ -432,9 +432,9 @@ set(USD_HASH 1dd1e2092d085ed393c1f7c450a4155a)
|
||||
set(USD_HASH_TYPE MD5)
|
||||
set(USD_FILE usd-v${USD_VERSION}.tar.gz)
|
||||
|
||||
set(OIDN_VERSION 1.4.0)
|
||||
set(OIDN_VERSION 1.3.0)
|
||||
set(OIDN_URI https://github.com/OpenImageDenoise/oidn/releases/download/v${OIDN_VERSION}/oidn-${OIDN_VERSION}.src.tar.gz)
|
||||
set(OIDN_HASH 421824019becc5b664a22a2b98332bc5)
|
||||
set(OIDN_HASH 301a5a0958d375a942014df0679b9270)
|
||||
set(OIDN_HASH_TYPE MD5)
|
||||
set(OIDN_FILE oidn-${OIDN_VERSION}.src.tar.gz)
|
||||
|
||||
|
@@ -553,10 +553,10 @@ EMBREE_FORCE_BUILD=false
|
||||
EMBREE_FORCE_REBUILD=false
|
||||
EMBREE_SKIP=false
|
||||
|
||||
OIDN_VERSION="1.4.0"
|
||||
OIDN_VERSION_SHORT="1.4"
|
||||
OIDN_VERSION_MIN="1.4.0"
|
||||
OIDN_VERSION_MAX="1.5"
|
||||
OIDN_VERSION="1.3.0"
|
||||
OIDN_VERSION_SHORT="1.3"
|
||||
OIDN_VERSION_MIN="1.3.0"
|
||||
OIDN_VERSION_MAX="1.4"
|
||||
OIDN_FORCE_BUILD=false
|
||||
OIDN_FORCE_REBUILD=false
|
||||
OIDN_SKIP=false
|
||||
@@ -565,7 +565,7 @@ ISPC_VERSION="1.14.1"
|
||||
|
||||
FFMPEG_VERSION="4.4"
|
||||
FFMPEG_VERSION_SHORT="4.4"
|
||||
FFMPEG_VERSION_MIN="3.0"
|
||||
FFMPEG_VERSION_MIN="4.4"
|
||||
FFMPEG_VERSION_MAX="5.0"
|
||||
FFMPEG_FORCE_BUILD=false
|
||||
FFMPEG_FORCE_REBUILD=false
|
||||
|
@@ -1,3 +1,33 @@
|
||||
diff -Naur oidn-1.3.0/cmake/FindTBB.cmake external_openimagedenoise/cmake/FindTBB.cmake
|
||||
--- oidn-1.3.0/cmake/FindTBB.cmake 2021-02-04 16:20:26 -0700
|
||||
+++ external_openimagedenoise/cmake/FindTBB.cmake 2021-02-12 09:35:53 -0700
|
||||
@@ -332,20 +332,22 @@
|
||||
${TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER}
|
||||
${TBB_ROOT}/lib
|
||||
)
|
||||
-
|
||||
# On Windows, also search the DLL so that the client may install it.
|
||||
file(GLOB DLL_NAMES
|
||||
${TBB_ROOT}/bin/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME}.dll
|
||||
${TBB_ROOT}/bin/${LIB_NAME}.dll
|
||||
+ ${TBB_ROOT}/lib/${LIB_NAME}.dll
|
||||
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME}.dll
|
||||
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME_GLOB1}.dll
|
||||
${TBB_ROOT}/redist/${TBB_ARCH}/${TBB_VCVER}/${LIB_NAME_GLOB2}.dll
|
||||
${TBB_ROOT}/../redist/${TBB_ARCH}/tbb/${TBB_VCVER}/${LIB_NAME}.dll
|
||||
${TBB_ROOT}/../redist/${TBB_ARCH}_win/tbb/${TBB_VCVER}/${LIB_NAME}.dll
|
||||
)
|
||||
- list(GET DLL_NAMES 0 DLL_NAME)
|
||||
- get_filename_component(${BIN_DIR_VAR} "${DLL_NAME}" DIRECTORY)
|
||||
- set(${DLL_VAR} "${DLL_NAME}" CACHE PATH "${COMPONENT_NAME} ${BUILD_CONFIG} dll path")
|
||||
+ if (DLL_NAMES)
|
||||
+ list(GET DLL_NAMES 0 DLL_NAME)
|
||||
+ get_filename_component(${BIN_DIR_VAR} "${DLL_NAME}" DIRECTORY)
|
||||
+ set(${DLL_VAR} "${DLL_NAME}" CACHE PATH "${COMPONENT_NAME} ${BUILD_CONFIG} dll path")
|
||||
+ endif()
|
||||
elseif(APPLE)
|
||||
set(LIB_PATHS ${TBB_ROOT}/lib)
|
||||
else()
|
||||
--- external_openimagedenoise/cmake/oidn_ispc.cmake 2021-02-15 17:29:34.000000000 +0100
|
||||
+++ external_openimagedenoise/cmake/oidn_ispc.cmake2 2021-02-15 17:29:28.000000000 +0100
|
||||
@@ -98,7 +98,7 @@
|
||||
|
@@ -20,24 +20,8 @@ if(NOT CLANG_ROOT_DIR AND NOT $ENV{CLANG_ROOT_DIR} STREQUAL "")
|
||||
set(CLANG_ROOT_DIR $ENV{CLANG_ROOT_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT LLVM_ROOT_DIR)
|
||||
if(DEFINED LLVM_VERSION)
|
||||
message(running llvm-config-${LLVM_VERSION})
|
||||
find_program(LLVM_CONFIG llvm-config-${LLVM_VERSION})
|
||||
endif()
|
||||
if(NOT LLVM_CONFIG)
|
||||
find_program(LLVM_CONFIG llvm-config)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${LLVM_CONFIG} --prefix
|
||||
OUTPUT_VARIABLE LLVM_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(LLVM_ROOT_DIR ${LLVM_ROOT_DIR} CACHE PATH "Path to the LLVM installation")
|
||||
endif()
|
||||
|
||||
set(_CLANG_SEARCH_DIRS
|
||||
${CLANG_ROOT_DIR}
|
||||
${LLVM_ROOT_DIR}
|
||||
/opt/lib/clang
|
||||
)
|
||||
|
||||
|
@@ -472,7 +472,8 @@ if(NOT GFLAGS_FOUND)
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
|
||||
"to directory containing gflags/gflags.h")
|
||||
endif()
|
||||
endif(NOT GFLAGS_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
|
||||
|
||||
find_library(GFLAGS_LIBRARY NAMES gflags
|
||||
PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
|
||||
@@ -483,7 +484,8 @@ if(NOT GFLAGS_FOUND)
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags library, set GFLAGS_LIBRARY "
|
||||
"to full path to libgflags.")
|
||||
endif()
|
||||
endif(NOT GFLAGS_LIBRARY OR
|
||||
NOT EXISTS ${GFLAGS_LIBRARY})
|
||||
|
||||
# gflags typically requires a threading library (which is OS dependent), note
|
||||
# that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
|
||||
@@ -558,7 +560,8 @@ if(NOT GFLAGS_FOUND)
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_INCLUDE_DIR:"
|
||||
" ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
|
||||
endif()
|
||||
endif(GFLAGS_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
# TODO: This regex for gflags library is pretty primitive, we use lowercase
|
||||
# for comparison to handle Windows using CamelCase library names, could
|
||||
# this check be better?
|
||||
@@ -568,7 +571,8 @@ if(NOT GFLAGS_FOUND)
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_LIBRARY: "
|
||||
"${GFLAGS_LIBRARY} does not match gflags.")
|
||||
endif()
|
||||
endif(GFLAGS_LIBRARY AND
|
||||
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
|
||||
|
||||
gflags_reset_find_library_prefix()
|
||||
|
||||
|
@@ -40,7 +40,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(NanoVDB DEFAULT_MSG
|
||||
|
||||
IF(NANOVDB_FOUND)
|
||||
SET(NANOVDB_INCLUDE_DIRS ${NANOVDB_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(NANOVDB_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
NANOVDB_INCLUDE_DIR
|
||||
|
@@ -46,7 +46,7 @@ SET(_opencollada_FIND_COMPONENTS
|
||||
)
|
||||
|
||||
# Fedora openCOLLADA package links these statically
|
||||
# note that order is important here or it won't link
|
||||
# note that order is important here ot it wont link
|
||||
SET(_opencollada_FIND_STATIC_COMPONENTS
|
||||
buffer
|
||||
ftoa
|
||||
|
@@ -44,7 +44,7 @@ SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for p
|
||||
MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
|
||||
|
||||
|
||||
# if the user passes these defines as args, we don't want to overwrite
|
||||
# if the user passes these defines as args, we dont want to overwrite
|
||||
SET(_IS_INC_DEF OFF)
|
||||
SET(_IS_INC_CONF_DEF OFF)
|
||||
SET(_IS_LIB_DEF OFF)
|
||||
@@ -143,7 +143,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
|
||||
SET(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
|
||||
break()
|
||||
ELSE()
|
||||
# ensure we don't find values from 2 different ABI versions
|
||||
# ensure we dont find values from 2 different ABI versions
|
||||
IF(NOT _IS_INC_DEF)
|
||||
UNSET(PYTHON_INCLUDE_DIR CACHE)
|
||||
ENDIF()
|
||||
|
@@ -40,7 +40,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(sse2neon DEFAULT_MSG
|
||||
|
||||
IF(SSE2NEON_FOUND)
|
||||
SET(SSE2NEON_INCLUDE_DIRS ${SSE2NEON_INCLUDE_DIR})
|
||||
ENDIF()
|
||||
ENDIF(SSE2NEON_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
SSE2NEON_INCLUDE_DIR
|
||||
|
@@ -305,7 +305,7 @@ def file_check_arg_sizes(tu):
|
||||
for i, node_child in enumerate(children):
|
||||
children = list(node_child.get_children())
|
||||
|
||||
# skip if we don't have an index...
|
||||
# skip if we dont have an index...
|
||||
size_def = args_size_definition.get(i, -1)
|
||||
|
||||
if size_def == -1:
|
||||
@@ -354,7 +354,7 @@ def file_check_arg_sizes(tu):
|
||||
filepath # always the same but useful when running threaded
|
||||
))
|
||||
|
||||
# we don't really care what we are looking at, just scan entire file for
|
||||
# we dont really care what we are looking at, just scan entire file for
|
||||
# function calls.
|
||||
|
||||
def recursive_func_call_check(node):
|
||||
|
@@ -596,6 +596,14 @@ function(SETUP_LIBDIRS)
|
||||
link_directories(${GMP_LIBPATH})
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
link_directories(
|
||||
${wayland-client_LIBRARY_DIRS}
|
||||
${wayland-egl_LIBRARY_DIRS}
|
||||
${xkbcommon_LIBRARY_DIRS}
|
||||
${wayland-cursor_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT UNIX)
|
||||
link_directories(${PTHREADS_LIBPATH})
|
||||
endif()
|
||||
@@ -694,7 +702,7 @@ macro(message_first_run)
|
||||
endmacro()
|
||||
|
||||
# when we have warnings as errors applied globally this
|
||||
# needs to be removed for some external libs which we don't maintain.
|
||||
# needs to be removed for some external libs which we dont maintain.
|
||||
|
||||
# utility macro
|
||||
macro(remove_cc_flag
|
||||
@@ -794,7 +802,7 @@ macro(remove_extra_strict_flags)
|
||||
endmacro()
|
||||
|
||||
# note, we can only append flags on a single file so we need to negate the options.
|
||||
# at the moment we can't shut up ffmpeg deprecations, so use this, but will
|
||||
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
||||
# probably add more removals here.
|
||||
macro(remove_strict_c_flags_file
|
||||
filenames)
|
||||
@@ -963,6 +971,14 @@ macro(blender_project_hack_post)
|
||||
unset(_reset_standard_cflags_rel)
|
||||
unset(_reset_standard_cxxflags_rel)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(NOT DARWIN)
|
||||
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
# pair of macros to allow libraries to be specify files to install, but to
|
||||
|
@@ -388,10 +388,6 @@ endif()
|
||||
|
||||
if(WITH_TBB)
|
||||
find_package(TBB)
|
||||
if(NOT TBB_FOUND)
|
||||
message(WARNING "TBB not found, disabling WITH_TBB")
|
||||
set(WITH_TBB OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_POTRACE)
|
||||
|
@@ -457,10 +457,6 @@ endif()
|
||||
|
||||
if(WITH_TBB)
|
||||
find_package_wrapper(TBB)
|
||||
if(NOT TBB_FOUND)
|
||||
message(WARNING "TBB not found, disabling WITH_TBB")
|
||||
set(WITH_TBB OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_XR_OPENXR)
|
||||
@@ -579,18 +575,18 @@ if(WITH_GHOST_WAYLAND)
|
||||
pkg_check_modules(wayland-scanner REQUIRED wayland-scanner)
|
||||
pkg_check_modules(xkbcommon REQUIRED xkbcommon)
|
||||
pkg_check_modules(wayland-cursor REQUIRED wayland-cursor)
|
||||
pkg_check_modules(dbus REQUIRED dbus-1)
|
||||
|
||||
set(WITH_GL_EGL ON)
|
||||
|
||||
if(WITH_GHOST_WAYLAND)
|
||||
list(APPEND PLATFORM_LINKLIBS
|
||||
${wayland-client_LINK_LIBRARIES}
|
||||
${wayland-egl_LINK_LIBRARIES}
|
||||
${xkbcommon_LINK_LIBRARIES}
|
||||
${wayland-cursor_LINK_LIBRARIES}
|
||||
${dbus_LINK_LIBRARIES}
|
||||
${wayland-client_LIBRARIES}
|
||||
${wayland-egl_LIBRARIES}
|
||||
${xkbcommon_LIBRARIES}
|
||||
${wayland-cursor_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_GHOST_X11)
|
||||
find_package(X11 REQUIRED)
|
||||
|
@@ -261,10 +261,8 @@ if(NOT DEFINED LIBDIR)
|
||||
else()
|
||||
message(FATAL_ERROR "32 bit compiler detected, blender no longer provides pre-build libraries for 32 bit windows, please set the LIBDIR cmake variable to your own library folder")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30130)
|
||||
message(STATUS "Visual Studio 2022 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
|
||||
elseif(MSVC_VERSION GREATER 1919)
|
||||
# Can be 1910..1912
|
||||
if(MSVC_VERSION GREATER 1919)
|
||||
message(STATUS "Visual Studio 2019 detected.")
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15)
|
||||
elseif(MSVC_VERSION GREATER 1909)
|
||||
@@ -550,6 +548,7 @@ if(WITH_OPENIMAGEIO)
|
||||
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
|
||||
|
||||
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
|
||||
set(OPENCOLORIO_DEFINITIONS "-DDOpenColorIO_SKIP_IMPORTS")
|
||||
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
|
||||
add_definitions(-DOIIO_STATIC_DEFINE)
|
||||
add_definitions(-DOIIO_NO_SSE=1)
|
||||
@@ -595,7 +594,7 @@ if(WITH_OPENCOLORIO)
|
||||
debug ${OPENCOLORIO_LIBPATH}/libexpatdMD.lib
|
||||
debug ${OPENCOLORIO_LIBPATH}/pystring_d.lib
|
||||
)
|
||||
set(OPENCOLORIO_DEFINITIONS "-DOpenColorIO_SKIP_IMPORTS")
|
||||
set(OPENCOLORIO_DEFINITIONS)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
@@ -676,11 +675,10 @@ if(WITH_SYSTEM_AUDASPACE)
|
||||
endif()
|
||||
|
||||
if(WITH_TBB)
|
||||
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
|
||||
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/debug/tbb_debug.lib)
|
||||
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
|
||||
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
|
||||
if(WITH_TBB_MALLOC_PROXY)
|
||||
set(TBB_MALLOC_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbbmalloc.lib debug ${LIBDIR}/tbb/lib/tbbmalloc_debug.lib)
|
||||
add_definitions(-DWITH_TBB_MALLOC)
|
||||
endif()
|
||||
endif()
|
||||
|
@@ -15,15 +15,6 @@ if(WITH_WINDOWS_BUNDLE_CRT)
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
|
||||
# ucrtbase(d).dll cannot be in the manifest, due to the way windows 10 handles
|
||||
# redirects for this dll, for details see T88813.
|
||||
foreach(lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS})
|
||||
string(FIND ${lib} "ucrtbase" pos)
|
||||
if(NOT pos EQUAL -1)
|
||||
list(REMOVE_ITEM CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS ${lib})
|
||||
install(FILES ${lib} DESTINATION . COMPONENT Libraries)
|
||||
endif()
|
||||
endforeach()
|
||||
# Install the CRT to the blender.crt Sub folder.
|
||||
install(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ./blender.crt COMPONENT Libraries)
|
||||
|
||||
|
@@ -6,9 +6,6 @@ if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||
call "%~dp0\detect_msvc2019.cmd"
|
||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||
|
||||
call "%~dp0\detect_msvc2022.cmd"
|
||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||
|
||||
echo Compiler Detection failed. Use verbose switch for more information.
|
||||
exit /b 1
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
if "%BUILD_VS_YEAR%"=="2017" set BUILD_VS_LIBDIRPOST=vc15
|
||||
if "%BUILD_VS_YEAR%"=="2019" set BUILD_VS_LIBDIRPOST=vc15
|
||||
if "%BUILD_VS_YEAR%"=="2022" set BUILD_VS_LIBDIRPOST=vc15
|
||||
|
||||
set BUILD_VS_SVNDIR=win64_%BUILD_VS_LIBDIRPOST%
|
||||
set BUILD_VS_LIBDIR="%BLENDER_DIR%..\lib\%BUILD_VS_SVNDIR%"
|
||||
|
@@ -19,10 +19,10 @@ if "%WITH_PYDEBUG%"=="1" (
|
||||
set PYDEBUG_CMAKE_ARGS=-DWINDOWS_PYTHON_DEBUG=On
|
||||
)
|
||||
|
||||
if "%BUILD_VS_YEAR%"=="2017" (
|
||||
set BUILD_GENERATOR_POST=%WINDOWS_ARCH%
|
||||
) else (
|
||||
if "%BUILD_VS_YEAR%"=="2019" (
|
||||
set BUILD_PLATFORM_SELECT=-A %MSBUILD_PLATFORM%
|
||||
) else (
|
||||
set BUILD_GENERATOR_POST=%WINDOWS_ARCH%
|
||||
)
|
||||
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%BUILD_GENERATOR_POST%" %BUILD_PLATFORM_SELECT% %TESTS_CMAKE_ARGS% %CLANG_CMAKE_ARGS% %ASAN_CMAKE_ARGS% %PYDEBUG_CMAKE_ARGS%
|
||||
|
@@ -1,3 +0,0 @@
|
||||
set BUILD_VS_VER=17
|
||||
set BUILD_VS_YEAR=2022
|
||||
call "%~dp0\detect_msvc_vswhere.cmd"
|
@@ -66,14 +66,6 @@ if NOT "%1" == "" (
|
||||
) else if "%1" == "2019b" (
|
||||
set BUILD_VS_YEAR=2019
|
||||
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
|
||||
) else if "%1" == "2022" (
|
||||
set BUILD_VS_YEAR=2022
|
||||
) else if "%1" == "2022pre" (
|
||||
set BUILD_VS_YEAR=2022
|
||||
set VSWHERE_ARGS=-prerelease
|
||||
) else if "%1" == "2022b" (
|
||||
set BUILD_VS_YEAR=2022
|
||||
set VSWHERE_ARGS=-products Microsoft.VisualStudio.Product.BuildTools
|
||||
) else if "%1" == "packagename" (
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DCPACK_OVERRIDE_PACKAGENAME="%2"
|
||||
shift /1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.9.1
|
||||
# Doxyfile 1.8.16
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@@ -38,7 +38,7 @@ PROJECT_NAME = Blender
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = V3.0
|
||||
PROJECT_NUMBER = "V3.0"
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -227,14 +227,6 @@ QT_AUTOBRIEF = NO
|
||||
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
# By default Python docstrings are displayed as preformatted text and doxygen's
|
||||
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
|
||||
# doxygen's special commands can be used and the contents of the docstring
|
||||
# documentation blocks is shown as doxygen documentation.
|
||||
# The default value is: YES.
|
||||
|
||||
PYTHON_DOCSTRING = YES
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
|
||||
# documentation from any documented member that it re-implements.
|
||||
# The default value is: YES.
|
||||
@@ -271,6 +263,12 @@ TAB_SIZE = 4
|
||||
|
||||
ALIASES =
|
||||
|
||||
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||
# A mapping has the form "name=value". For example adding "class=itcl::class"
|
||||
# will allow you to use the command class in the itcl::class meaning.
|
||||
|
||||
TCL_SUBST =
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
|
||||
# only. Doxygen will then generate output that is more tailored for C. For
|
||||
# instance, some of the names that are used will be different. The list of all
|
||||
@@ -311,22 +309,19 @@ OPTIMIZE_OUTPUT_SLICE = NO
|
||||
# parses. With this tag you can assign which parser to use for a given
|
||||
# extension. Doxygen has a built-in mapping, but you can override or extend it
|
||||
# using this tag. The format is ext=language, where ext is a file extension, and
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
|
||||
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
|
||||
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
|
||||
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice,
|
||||
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
|
||||
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
|
||||
# tries to guess whether the code is fixed or free formatted code, this is the
|
||||
# default for Fortran type files). For instance to make doxygen treat .inc files
|
||||
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
|
||||
# use: inc=Fortran f=C.
|
||||
# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat
|
||||
# .inc files as Fortran files (default is PHP), and .f files as C (default is
|
||||
# Fortran), use: inc=Fortran f=C.
|
||||
#
|
||||
# Note: For files without extension you can use no_extension as a placeholder.
|
||||
#
|
||||
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
|
||||
# the files are not read by doxygen. When specifying no_extension you should add
|
||||
# * to the FILE_PATTERNS.
|
||||
#
|
||||
# Note see also the list of default file extension mappings.
|
||||
# the files are not read by doxygen.
|
||||
|
||||
EXTENSION_MAPPING =
|
||||
|
||||
@@ -460,19 +455,6 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
|
||||
LOOKUP_CACHE_SIZE = 3
|
||||
|
||||
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
|
||||
# during processing. When set to 0 doxygen will based this on the number of
|
||||
# cores available in the system. You can set it explicitly to a value larger
|
||||
# than 0 to get more control over the balance between CPU load and processing
|
||||
# speed. At this moment only the input processing can be done using multiple
|
||||
# threads. Since this is still an experimental feature the default is set to 1,
|
||||
# which efficively disables parallel processing. Please report any issues you
|
||||
# encounter. Generating dot graphs in parallel is controlled by the
|
||||
# DOT_NUM_THREADS setting.
|
||||
# Minimum value: 0, maximum value: 32, default value: 1.
|
||||
|
||||
NUM_PROC_THREADS = 1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -536,13 +518,6 @@ EXTRACT_LOCAL_METHODS = NO
|
||||
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
|
||||
# If this flag is set to YES, the name of an unnamed parameter in a declaration
|
||||
# will be determined by the corresponding definition. By default unnamed
|
||||
# parameters remain unnamed in the output.
|
||||
# The default value is: YES.
|
||||
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
|
||||
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
|
||||
# undocumented members inside documented classes or files. If set to NO these
|
||||
# members will be included in the various overviews, but no documentation
|
||||
@@ -560,8 +535,8 @@ HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
||||
# declarations. If set to NO, these declarations will be included in the
|
||||
# documentation.
|
||||
# (class|struct|union) declarations. If set to NO, these declarations will be
|
||||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
@@ -580,18 +555,11 @@ HIDE_IN_BODY_DOCS = NO
|
||||
|
||||
INTERNAL_DOCS = YES
|
||||
|
||||
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
|
||||
# able to match the capabilities of the underlying filesystem. In case the
|
||||
# filesystem is case sensitive (i.e. it supports files in the same directory
|
||||
# whose names only differ in casing), the option must be set to YES to properly
|
||||
# deal with such files in case they appear in the input. For filesystems that
|
||||
# are not case sensitive the option should be be set to NO to properly deal with
|
||||
# output files written for symbols that only differ in casing, such as for two
|
||||
# classes, one named CLASS and the other named Class, and to also support
|
||||
# references to files without having to specify the exact matching casing. On
|
||||
# Windows (including Cygwin) and MacOS, users should typically set this option
|
||||
# to NO, whereas on Linux or other Unix flavors it should typically be set to
|
||||
# YES.
|
||||
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
|
||||
# names in lower-case letters. If set to YES, upper-case letters are also
|
||||
# allowed. This is useful if you have classes or files whose names only differ
|
||||
# in case and if your file system supports case sensitive file names. Windows
|
||||
# (including Cygwin) ands Mac users are advised to set this option to NO.
|
||||
# The default value is: system dependent.
|
||||
|
||||
CASE_SENSE_NAMES = YES
|
||||
@@ -830,10 +798,7 @@ WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
|
||||
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
|
||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||
# a warning is encountered.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
@@ -875,8 +840,8 @@ INPUT = doxygen.main.h \
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
|
||||
# documentation (see:
|
||||
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
|
||||
# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
|
||||
# possible encodings.
|
||||
# The default value is: UTF-8.
|
||||
|
||||
INPUT_ENCODING = UTF-8
|
||||
@@ -889,15 +854,11 @@ INPUT_ENCODING = UTF-8
|
||||
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
|
||||
# read by doxygen.
|
||||
#
|
||||
# Note the list of default checked file patterns might differ from the list of
|
||||
# default file extension mappings.
|
||||
#
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
|
||||
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
|
||||
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
|
||||
# *.ucf, *.qsf and *.ice.
|
||||
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS =
|
||||
|
||||
@@ -1125,6 +1086,13 @@ VERBATIM_HEADERS = YES
|
||||
|
||||
ALPHABETICAL_INDEX = YES
|
||||
|
||||
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
|
||||
# which the alphabetical index list will be split.
|
||||
# Minimum value: 1, maximum value: 20, default value: 5.
|
||||
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
|
||||
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
|
||||
# In case all classes in a project start with a common prefix, all classes will
|
||||
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
|
||||
# can be used to specify a prefix (or a list of prefixes) that should be ignored
|
||||
@@ -1263,9 +1231,9 @@ HTML_TIMESTAMP = YES
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via JavaScript. If disabled, the navigation index will
|
||||
# are dynamically created via Javascript. If disabled, the navigation index will
|
||||
# consists of multiple levels of tabs that are statically embedded in every HTML
|
||||
# page. Disable this option to support browsers that do not have JavaScript,
|
||||
# page. Disable this option to support browsers that do not have Javascript,
|
||||
# like the Qt help browser.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
@@ -1295,11 +1263,10 @@ HTML_INDEX_NUM_ENTRIES = 100
|
||||
|
||||
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
|
||||
# generated that can be used as input for Apple's Xcode 3 integrated development
|
||||
# environment (see:
|
||||
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
|
||||
# create a documentation set, doxygen will generate a Makefile in the HTML
|
||||
# output directory. Running make will produce the docset in that directory and
|
||||
# running make install will install the docset in
|
||||
# environment (see: https://developer.apple.com/xcode/), introduced with OSX
|
||||
# 10.5 (Leopard). To create a documentation set, doxygen will generate a
|
||||
# Makefile in the HTML output directory. Running make will produce the docset in
|
||||
# that directory and running make install will install the docset in
|
||||
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
|
||||
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
|
||||
# genXcode/_index.html for more information.
|
||||
@@ -1341,8 +1308,8 @@ DOCSET_PUBLISHER_NAME = Publisher
|
||||
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
|
||||
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
|
||||
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
|
||||
# (see:
|
||||
# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
|
||||
# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on
|
||||
# Windows.
|
||||
#
|
||||
# The HTML Help Workshop contains a compiler that can convert all HTML output
|
||||
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
|
||||
@@ -1372,7 +1339,7 @@ CHM_FILE = blender.chm
|
||||
HHC_LOCATION = "C:/Program Files (x86)/HTML Help Workshop/hhc.exe"
|
||||
|
||||
# The GENERATE_CHI flag controls if a separate .chi index file is generated
|
||||
# (YES) or that it should be included in the main .chm file (NO).
|
||||
# (YES) or that it should be included in the master .chm file (NO).
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
|
||||
|
||||
@@ -1417,8 +1384,7 @@ QCH_FILE =
|
||||
|
||||
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
|
||||
# Project output. For more information please see Qt Help Project / Namespace
|
||||
# (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||
# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
|
||||
# The default value is: org.doxygen.Project.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@@ -1426,8 +1392,8 @@ QHP_NAMESPACE = org.doxygen.Project
|
||||
|
||||
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
|
||||
# Help Project output. For more information please see Qt Help Project / Virtual
|
||||
# Folders (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
|
||||
# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-
|
||||
# folders).
|
||||
# The default value is: doc.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
@@ -1435,16 +1401,16 @@ QHP_VIRTUAL_FOLDER = doc
|
||||
|
||||
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
|
||||
# filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_NAME =
|
||||
|
||||
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
|
||||
# custom filter to add. For more information please see Qt Help Project / Custom
|
||||
# Filters (see:
|
||||
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
|
||||
# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-
|
||||
# filters).
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
@@ -1456,9 +1422,9 @@ QHP_CUST_FILTER_ATTRS =
|
||||
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
|
||||
# The QHG_LOCATION tag can be used to specify the location (absolute path
|
||||
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
|
||||
# run qhelpgenerator on the generated .qhp file.
|
||||
# The QHG_LOCATION tag can be used to specify the location of Qt's
|
||||
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
|
||||
# generated .qhp file.
|
||||
# This tag requires that the tag GENERATE_QHP is set to YES.
|
||||
|
||||
QHG_LOCATION =
|
||||
@@ -1535,17 +1501,6 @@ TREEVIEW_WIDTH = 246
|
||||
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
|
||||
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
|
||||
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
|
||||
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
|
||||
# the HTML output. These images will generally look nicer at scaled resolutions.
|
||||
# Possible values are: png (the default) and svg (looks nicer but requires the
|
||||
# pdf2svg or inkscape tool).
|
||||
# The default value is: png.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_FORMULA_FORMAT = png
|
||||
|
||||
# Use this tag to change the font size of LaTeX formulas included as images in
|
||||
# the HTML documentation. When you change the font size after a successful
|
||||
# doxygen run you need to manually remove any form_*.png images from the HTML
|
||||
@@ -1566,14 +1521,8 @@ FORMULA_FONTSIZE = 10
|
||||
|
||||
FORMULA_TRANSPARENT = YES
|
||||
|
||||
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
|
||||
# to create new LaTeX commands to be used in formulas as building blocks. See
|
||||
# the section "Including formulas" for details.
|
||||
|
||||
FORMULA_MACROFILE =
|
||||
|
||||
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
|
||||
# https://www.mathjax.org) which uses client side JavaScript for the rendering
|
||||
# https://www.mathjax.org) which uses client side Javascript for the rendering
|
||||
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
|
||||
# installed or if you want to formulas look prettier in the HTML output. When
|
||||
# enabled you may also need to install MathJax separately and configure the path
|
||||
@@ -1585,7 +1534,7 @@ USE_MATHJAX = NO
|
||||
|
||||
# When MathJax is enabled you can set the default output format to be used for
|
||||
# the MathJax output. See the MathJax site (see:
|
||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
|
||||
# http://docs.mathjax.org/en/latest/output.html) for more details.
|
||||
# Possible values are: HTML-CSS (which is slower, but has the best
|
||||
# compatibility), NativeMML (i.e. MathML) and SVG.
|
||||
# The default value is: HTML-CSS.
|
||||
@@ -1601,7 +1550,7 @@ MATHJAX_FORMAT = HTML-CSS
|
||||
# Content Delivery Network so you can quickly see the result without installing
|
||||
# MathJax. However, it is strongly recommended to install a local copy of
|
||||
# MathJax from https://www.mathjax.org before deployment.
|
||||
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
|
||||
# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
||||
@@ -1615,8 +1564,7 @@ MATHJAX_EXTENSIONS =
|
||||
|
||||
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
|
||||
# of code that will be used on startup of the MathJax code. See the MathJax site
|
||||
# (see:
|
||||
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
|
||||
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
|
||||
# example see the documentation.
|
||||
# This tag requires that the tag USE_MATHJAX is set to YES.
|
||||
|
||||
@@ -1644,7 +1592,7 @@ MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = NO
|
||||
|
||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||
# implemented using a web server instead of a web client using JavaScript. There
|
||||
# implemented using a web server instead of a web client using Javascript. There
|
||||
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
|
||||
# setting. When disabled, doxygen will generate a PHP script for searching and
|
||||
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
|
||||
@@ -1663,8 +1611,7 @@ SERVER_BASED_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see:
|
||||
# https://xapian.org/).
|
||||
# Xapian (see: https://xapian.org/).
|
||||
#
|
||||
# See the section "External Indexing and Searching" for details.
|
||||
# The default value is: NO.
|
||||
@@ -1677,9 +1624,8 @@ EXTERNAL_SEARCH = NO
|
||||
#
|
||||
# Doxygen ships with an example indexer (doxyindexer) and search engine
|
||||
# (doxysearch.cgi) which are based on the open source search engine library
|
||||
# Xapian (see:
|
||||
# https://xapian.org/). See the section "External Indexing and Searching" for
|
||||
# details.
|
||||
# Xapian (see: https://xapian.org/). See the section "External Indexing and
|
||||
# Searching" for details.
|
||||
# This tag requires that the tag SEARCHENGINE is set to YES.
|
||||
|
||||
SEARCHENGINE_URL =
|
||||
@@ -1843,11 +1789,9 @@ LATEX_EXTRA_FILES =
|
||||
|
||||
PDF_HYPERLINKS = NO
|
||||
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
|
||||
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
|
||||
# files. Set this option to YES, to get a higher quality PDF documentation.
|
||||
#
|
||||
# See also section LATEX_CMD_NAME for selecting the engine.
|
||||
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
|
||||
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
|
||||
# higher quality PDF documentation.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@@ -2182,8 +2126,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED = BUILD_DATE \
|
||||
DOXYGEN=1
|
||||
PREDEFINED = BUILD_DATE
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
@@ -2360,31 +2303,9 @@ UML_LOOK = YES
|
||||
# but if the number exceeds 15, the total amount of fields shown is limited to
|
||||
# 10.
|
||||
# Minimum value: 0, maximum value: 100, default value: 10.
|
||||
# This tag requires that the tag UML_LOOK is set to YES.
|
||||
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
||||
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
|
||||
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
|
||||
# tag is set to YES, doxygen will add type and arguments for attributes and
|
||||
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
|
||||
# will not generate fields with class member information in the UML graphs. The
|
||||
# class diagrams will look similar to the default class diagrams but using UML
|
||||
# notation for the relationships.
|
||||
# Possible values are: NO, YES and NONE.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag UML_LOOK is set to YES.
|
||||
|
||||
DOT_UML_DETAILS = NO
|
||||
|
||||
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
|
||||
# to display on a single line. If the actual line length exceeds this threshold
|
||||
# significantly it will wrapped across multiple lines. Some heuristics are apply
|
||||
# to avoid ugly line breaks.
|
||||
# Minimum value: 0, maximum value: 1000, default value: 17.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
|
||||
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
|
||||
# collaboration graphs will show the relations between templates and their
|
||||
@@ -2575,11 +2496,9 @@ DOT_MULTI_TARGETS = YES
|
||||
|
||||
GENERATE_LEGEND = YES
|
||||
|
||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
|
||||
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
|
||||
# files that are used to generate the various graphs.
|
||||
#
|
||||
# Note: This setting is not only used for dot files but also for msc and
|
||||
# plantuml temporary files.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
@@ -29,7 +29,7 @@ with offscreen.bind():
|
||||
amount = 10
|
||||
for i in range(-amount, amount + 1):
|
||||
x_pos = i / amount
|
||||
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, segments=200)
|
||||
draw_circle_2d((x_pos, 0.0), (1, 1, 1, 1), 0.5, 200)
|
||||
|
||||
|
||||
# Drawing the generated texture in 3D space
|
||||
|
@@ -34,9 +34,7 @@ with offscreen.bind():
|
||||
for i in range(RING_AMOUNT):
|
||||
draw_circle_2d(
|
||||
(random.uniform(-1, 1), random.uniform(-1, 1)),
|
||||
(1, 1, 1, 1), random.uniform(0.1, 1),
|
||||
segments=20,
|
||||
)
|
||||
(1, 1, 1, 1), random.uniform(0.1, 1), 20)
|
||||
|
||||
buffer = fb.read_color(0, 0, WIDTH, HEIGHT, 4, 0, 'UBYTE')
|
||||
|
||||
|
@@ -1,13 +1,2 @@
|
||||
sphinx==3.5.4
|
||||
|
||||
# Sphinx dependencies that are important
|
||||
Jinja2==2.11.3
|
||||
Pygments==2.9.0
|
||||
docutils==0.16
|
||||
snowballstemmer==2.1.0
|
||||
babel==2.9.1
|
||||
requests==2.25.1
|
||||
|
||||
# Only needed to match the theme used for the official documentation.
|
||||
# Without this theme, the default theme will be used.
|
||||
Sphinx==3.5.3
|
||||
sphinx_rtd_theme==0.5.2
|
||||
|
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
2
extern/mantaflow/preprocessed/gitinfo.h
vendored
@@ -1,3 +1,3 @@
|
||||
|
||||
|
||||
#define MANTA_GIT_VERSION "commit 8fbebe02459b7f72575872c20961f7cb757db408"
|
||||
#define MANTA_GIT_VERSION "commit 9c505cd22e289b98c9aa717efba8ef3201c7e458"
|
||||
|
13
extern/mantaflow/preprocessed/kernel.h
vendored
13
extern/mantaflow/preprocessed/kernel.h
vendored
@@ -71,19 +71,6 @@ class ParticleBase;
|
||||
for (int j = bnd; j < (grid).getSizeY() - bnd; ++j) \
|
||||
for (int i = bnd; i < (grid).getSizeX() - bnd; ++i)
|
||||
|
||||
#define FOR_NEIGHBORS_BND(grid, radius, bnd) \
|
||||
for (int zj = ((grid).is3D() ? std::max(bnd, k - radius) : 0); \
|
||||
zj <= ((grid).is3D() ? std::min(k + radius, (grid).getSizeZ() - 1 - bnd) : 0); \
|
||||
zj++) \
|
||||
for (int yj = std::max(bnd, j - radius); \
|
||||
yj <= std::min(j + radius, (grid).getSizeY() - 1 - bnd); \
|
||||
yj++) \
|
||||
for (int xj = std::max(bnd, i - radius); \
|
||||
xj <= std::min(i + radius, (grid).getSizeX() - 1 - bnd); \
|
||||
xj++)
|
||||
|
||||
#define FOR_NEIGHBORS(grid, radius) FOR_NEIGHBORS_BND(grid, radius, 0)
|
||||
|
||||
//! Basic data structure for kernel data, initialized based on kernel type (e.g. single, idx, etc).
|
||||
struct KernelBase {
|
||||
int maxX, maxY, maxZ, minZ, maxT, minT;
|
||||
|
24
extern/mantaflow/preprocessed/plugin/flip.cpp
vendored
24
extern/mantaflow/preprocessed/plugin/flip.cpp
vendored
@@ -822,13 +822,17 @@ struct ComputeUnionLevelsetPindex : public KernelBase {
|
||||
{
|
||||
const Vec3 gridPos = Vec3(i, j, k) + Vec3(0.5); // shifted by half cell
|
||||
Real phiv = radius * 1.0; // outside
|
||||
const int r = int(radius) + 1;
|
||||
|
||||
FOR_NEIGHBORS(phi, r)
|
||||
{
|
||||
int r = int(radius) + 1;
|
||||
int rZ = phi.is3D() ? r : 0;
|
||||
for (int zj = k - rZ; zj <= k + rZ; zj++)
|
||||
for (int yj = j - r; yj <= j + r; yj++)
|
||||
for (int xj = i - r; xj <= i + r; xj++) {
|
||||
if (!phi.isInBounds(Vec3i(xj, yj, zj)))
|
||||
continue;
|
||||
|
||||
// note, for the particle indices in indexSys the access is periodic (ie, dont skip for eg
|
||||
// inBounds(sx,10,10)
|
||||
// note, for the particle indices in indexSys the access is periodic (ie, dont skip for
|
||||
// eg inBounds(sx,10,10)
|
||||
IndexInt isysIdxS = index.index(xj, yj, zj);
|
||||
IndexInt pStart = index(isysIdxS), pEnd = 0;
|
||||
if (phi.isInBounds(isysIdxS + 1))
|
||||
@@ -1022,14 +1026,18 @@ struct ComputeAveragedLevelsetWeight : public KernelBase {
|
||||
|
||||
// loop over neighborhood, similar to ComputeUnionLevelsetPindex
|
||||
const Real sradiusInv = 1. / (4. * radius * radius);
|
||||
const int r = int(radius) + 1;
|
||||
int r = int(1. * radius) + 1;
|
||||
int rZ = phi.is3D() ? r : 0;
|
||||
// accumulators
|
||||
Real wacc = 0.;
|
||||
Vec3 pacc = Vec3(0.);
|
||||
Real racc = 0.;
|
||||
|
||||
FOR_NEIGHBORS(phi, r)
|
||||
{
|
||||
for (int zj = k - rZ; zj <= k + rZ; zj++)
|
||||
for (int yj = j - r; yj <= j + r; yj++)
|
||||
for (int xj = i - r; xj <= i + r; xj++) {
|
||||
if (!phi.isInBounds(Vec3i(xj, yj, zj)))
|
||||
continue;
|
||||
|
||||
IndexInt isysIdxS = index.index(xj, yj, zj);
|
||||
IndexInt pStart = index(isysIdxS), pEnd = 0;
|
||||
|
@@ -2287,9 +2287,10 @@ struct knFlipComputePotentialTrappedAir : public KernelBase {
|
||||
const Vec3 &vj = scaleFromManta * v.getCentered(x, y, z);
|
||||
const Vec3 xij = xi - xj;
|
||||
const Vec3 vij = vi - vj;
|
||||
Real h = !pot.is3D() ? 1.414 * radius :
|
||||
1.732 * radius; // estimate sqrt(2)*radius resp. sqrt(3)*radius
|
||||
// for h, due to squared resp. cubic neighbor area
|
||||
Real h = !pot.is3D() ?
|
||||
1.414 * radius :
|
||||
1.732 * radius; // estimate sqrt(2)*radius resp. sqrt(3)*radius for h, due
|
||||
// to squared resp. cubic neighbor area
|
||||
vdiff += norm(vij) * (1 - dot(getNormalized(vij), getNormalized(xij))) *
|
||||
(1 - norm(xij) / h);
|
||||
}
|
||||
|
@@ -51,12 +51,12 @@ CCL_NAMESPACE_BEGIN
|
||||
/* XML reading state */
|
||||
|
||||
struct XMLReadState : public XMLReader {
|
||||
Scene *scene; /* Scene pointer. */
|
||||
Transform tfm; /* Current transform state. */
|
||||
bool smooth; /* Smooth normal state. */
|
||||
Shader *shader; /* Current shader. */
|
||||
string base; /* Base path to current file. */
|
||||
float dicing_rate; /* Current dicing rate. */
|
||||
Scene *scene; /* scene pointer */
|
||||
Transform tfm; /* current transform state */
|
||||
bool smooth; /* smooth normal state */
|
||||
Shader *shader; /* current shader */
|
||||
string base; /* base path to current file*/
|
||||
float dicing_rate; /* current dicing rate */
|
||||
|
||||
XMLReadState() : scene(NULL), smooth(false), shader(NULL), dicing_rate(1.0f)
|
||||
{
|
||||
@@ -385,7 +385,7 @@ static Mesh *xml_add_mesh(Scene *scene, const Transform &tfm)
|
||||
Mesh *mesh = new Mesh();
|
||||
scene->geometry.push_back(mesh);
|
||||
|
||||
/* Create object. */
|
||||
/* create object*/
|
||||
Object *object = new Object();
|
||||
object->set_geometry(mesh);
|
||||
object->set_tfm(tfm);
|
||||
|
@@ -132,7 +132,7 @@ def init():
|
||||
_workaround_buggy_drivers()
|
||||
|
||||
path = os.path.dirname(__file__)
|
||||
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
|
||||
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
|
||||
|
||||
_cycles.init(path, user_path, bpy.app.background)
|
||||
_parse_command_line()
|
||||
|
@@ -1254,19 +1254,12 @@ class CyclesObjectSettings(bpy.types.PropertyGroup):
|
||||
)
|
||||
|
||||
shadow_terminator_offset: FloatProperty(
|
||||
name="Shadow Terminator Shading Offset",
|
||||
name="Shadow Terminator Offset",
|
||||
description="Push the shadow terminator towards the light to hide artifacts on low poly geometry",
|
||||
min=0.0, max=1.0,
|
||||
default=0.0,
|
||||
)
|
||||
|
||||
shadow_terminator_geometry_offset: FloatProperty(
|
||||
name="Shadow Terminator Geometry Offset",
|
||||
description="Offset rays from the surface to reduce shadow terminator artifact on low poly geometry. Only affects triangles at grazing angles to light",
|
||||
min=0.0, max=1.0,
|
||||
default=0.1,
|
||||
)
|
||||
|
||||
is_shadow_catcher: BoolProperty(
|
||||
name="Shadow Catcher",
|
||||
description="Only render shadows on this object, for compositing renders into real footage",
|
||||
|
@@ -821,11 +821,6 @@ class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
|
||||
col.prop(view_layer, "use_strand", text="Hair")
|
||||
col.prop(view_layer, "use_volumes", text="Volumes")
|
||||
|
||||
col = layout.column(heading="Use")
|
||||
sub = col.row()
|
||||
sub.prop(view_layer, "use_motion_blur", text="Motion Blur")
|
||||
sub.active = rd.use_motion_blur
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_override(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Override"
|
||||
@@ -1223,31 +1218,20 @@ class CYCLES_OBJECT_PT_shading(CyclesButtonsPanel, Panel):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if not CyclesButtonsPanel.poll(context):
|
||||
return False
|
||||
|
||||
ob = context.object
|
||||
return ob and has_geometry_visibility(ob)
|
||||
|
||||
def draw(self, context):
|
||||
pass
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_shading_shadow_terminator(CyclesButtonsPanel, Panel):
|
||||
bl_label = "Shadow Terminator"
|
||||
bl_parent_id = "CYCLES_OBJECT_PT_shading"
|
||||
bl_context = "object"
|
||||
return CyclesButtonsPanel.poll(context) and (context.object)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
|
||||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
|
||||
|
||||
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
|
||||
layout = self.layout
|
||||
ob = context.object
|
||||
cob = ob.cycles
|
||||
flow.prop(cob, "shadow_terminator_geometry_offset", text="Geometry Offset")
|
||||
flow.prop(cob, "shadow_terminator_offset", text="Shading Offset")
|
||||
|
||||
if has_geometry_visibility(ob):
|
||||
col = flow.column()
|
||||
col.prop(cob, "shadow_terminator_offset")
|
||||
|
||||
|
||||
class CYCLES_OBJECT_PT_visibility(CyclesButtonsPanel, Panel):
|
||||
@@ -2327,7 +2311,6 @@ classes = (
|
||||
CYCLES_PT_context_material,
|
||||
CYCLES_OBJECT_PT_motion_blur,
|
||||
CYCLES_OBJECT_PT_shading,
|
||||
CYCLES_OBJECT_PT_shading_shadow_terminator,
|
||||
CYCLES_OBJECT_PT_visibility,
|
||||
CYCLES_OBJECT_PT_visibility_ray_visibility,
|
||||
CYCLES_OBJECT_PT_visibility_culling,
|
||||
|
@@ -533,7 +533,7 @@ void BlenderSync::sync_particle_hair(
|
||||
return;
|
||||
}
|
||||
|
||||
/* Extract particle hair data - should be combined with connecting to mesh later. */
|
||||
/* extract particle hair data - should be combined with connecting to mesh later*/
|
||||
|
||||
ParticleCurveData CData;
|
||||
|
||||
|
@@ -34,17 +34,12 @@ void BlenderSync::sync_light(BL::Object &b_parent,
|
||||
bool *use_portal)
|
||||
{
|
||||
/* test if we need to sync */
|
||||
Light *light;
|
||||
ObjectKey key(b_parent, persistent_id, b_ob_instance, false);
|
||||
BL::Light b_light(b_ob.data());
|
||||
|
||||
Light *light = light_map.find(key);
|
||||
|
||||
/* Check if the transform was modified, in case a linked collection is moved we do not get a
|
||||
* specific depsgraph update (T88515). This also mimics the behavior for Objects. */
|
||||
const bool tfm_updated = (light && light->get_tfm() != tfm);
|
||||
|
||||
/* Update if either object or light data changed. */
|
||||
if (!light_map.add_or_update(&light, b_ob, b_parent, key) && !tfm_updated) {
|
||||
if (!light_map.add_or_update(&light, b_ob, b_parent, key)) {
|
||||
Shader *shader;
|
||||
if (!shader_map.add_or_update(&shader, b_light)) {
|
||||
if (light->get_is_portal())
|
||||
|
@@ -290,12 +290,8 @@ Object *BlenderSync::sync_object(BL::Depsgraph &b_depsgraph,
|
||||
bool is_shadow_catcher = get_boolean(cobject, "is_shadow_catcher");
|
||||
object->set_is_shadow_catcher(is_shadow_catcher);
|
||||
|
||||
float shadow_terminator_shading_offset = get_float(cobject, "shadow_terminator_offset");
|
||||
object->set_shadow_terminator_shading_offset(shadow_terminator_shading_offset);
|
||||
|
||||
float shadow_terminator_geometry_offset = get_float(cobject,
|
||||
"shadow_terminator_geometry_offset");
|
||||
object->set_shadow_terminator_geometry_offset(shadow_terminator_geometry_offset);
|
||||
float shadow_terminator_offset = get_float(cobject, "shadow_terminator_offset");
|
||||
object->set_shadow_terminator_offset(shadow_terminator_offset);
|
||||
|
||||
/* sync the asset name for Cryptomatte */
|
||||
BL::Object parent = b_ob.parent();
|
||||
|
@@ -289,10 +289,11 @@ static PyObject *render_func(PyObject * /*self*/, PyObject *args)
|
||||
RNA_pointer_create(NULL, &RNA_Depsgraph, (ID *)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr);
|
||||
BL::Depsgraph b_depsgraph(depsgraphptr);
|
||||
|
||||
/* Allow Blender to execute other Python scripts. */
|
||||
/* Allow Blender to execute other Python scripts, and isolate TBB tasks so we
|
||||
* don't get deadlocks with Blender threads accessing shared data like images. */
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->render(b_depsgraph);
|
||||
tbb::this_task_arena::isolate([&] { session->render(b_depsgraph); });
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
@@ -329,7 +330,8 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height);
|
||||
tbb::this_task_arena::isolate(
|
||||
[&] { session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height); });
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
@@ -375,7 +377,7 @@ static PyObject *reset_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->reset_session(b_data, b_depsgraph);
|
||||
tbb::this_task_arena::isolate([&] { session->reset_session(b_data, b_depsgraph); });
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
@@ -397,7 +399,7 @@ static PyObject *sync_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->synchronize(b_depsgraph);
|
||||
tbb::this_task_arena::isolate([&] { session->synchronize(b_depsgraph); });
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
|
@@ -281,6 +281,7 @@ void BlenderSync::sync_data(BL::RenderSettings &b_render,
|
||||
|
||||
void BlenderSync::sync_integrator()
|
||||
{
|
||||
BL::RenderSettings r = b_scene.render();
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
|
||||
experimental = (get_enum(cscene, "feature_set") != 0);
|
||||
@@ -324,7 +325,7 @@ void BlenderSync::sync_integrator()
|
||||
integrator->set_sample_clamp_direct(get_float(cscene, "sample_clamp_direct"));
|
||||
integrator->set_sample_clamp_indirect(get_float(cscene, "sample_clamp_indirect"));
|
||||
if (!preview) {
|
||||
integrator->set_motion_blur(view_layer.use_motion_blur);
|
||||
integrator->set_motion_blur(r.use_motion_blur());
|
||||
}
|
||||
|
||||
integrator->set_method((Integrator::Method)get_enum(
|
||||
@@ -455,8 +456,6 @@ void BlenderSync::sync_view_layer(BL::ViewLayer &b_view_layer)
|
||||
view_layer.use_surfaces = b_view_layer.use_solid() || scene->bake_manager->get_baking();
|
||||
view_layer.use_hair = b_view_layer.use_strand();
|
||||
view_layer.use_volumes = b_view_layer.use_volumes();
|
||||
view_layer.use_motion_blur = b_view_layer.use_motion_blur() &&
|
||||
b_scene.render().use_motion_blur();
|
||||
|
||||
/* Material override. */
|
||||
view_layer.material_override = b_view_layer.material_override();
|
||||
@@ -603,10 +602,8 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
|
||||
for (BL::RenderPass &b_pass : b_rlay.passes) {
|
||||
PassType pass_type = get_pass_type(b_pass);
|
||||
|
||||
if (pass_type == PASS_MOTION &&
|
||||
(b_view_layer.use_motion_blur() && b_scene.render().use_motion_blur())) {
|
||||
if (pass_type == PASS_MOTION && b_scene.render().use_motion_blur())
|
||||
continue;
|
||||
}
|
||||
if (pass_type != PASS_NONE)
|
||||
Pass::add(pass_type, passes, b_pass.name().c_str());
|
||||
}
|
||||
|
@@ -246,7 +246,6 @@ class BlenderSync {
|
||||
use_surfaces(true),
|
||||
use_hair(true),
|
||||
use_volumes(true),
|
||||
use_motion_blur(true),
|
||||
samples(0),
|
||||
bound_samples(false)
|
||||
{
|
||||
@@ -259,7 +258,6 @@ class BlenderSync {
|
||||
bool use_surfaces;
|
||||
bool use_hair;
|
||||
bool use_volumes;
|
||||
bool use_motion_blur;
|
||||
int samples;
|
||||
bool bound_samples;
|
||||
} view_layer;
|
||||
|
@@ -179,7 +179,7 @@ class InnerNode : public BVHNode {
|
||||
}
|
||||
|
||||
/* NOTE: This function is only used during binary BVH builder, and it
|
||||
* supposed to be configured to have 2 children which will be filled-in in a
|
||||
* supposed to be configured to have 2 children which will be filled in in a
|
||||
* bit. But this is important to have children reset to NULL. */
|
||||
explicit InnerNode(const BoundBox &bounds) : BVHNode(bounds), num_children_(0)
|
||||
{
|
||||
|
@@ -1196,18 +1196,16 @@ class OptiXDevice : public CUDADevice {
|
||||
|
||||
const CUDAContextScope scope(cuContext);
|
||||
|
||||
const bool use_fast_trace_bvh = (bvh->params.bvh_type == SceneParams::BVH_STATIC);
|
||||
|
||||
// Compute memory usage
|
||||
OptixAccelBufferSizes sizes = {};
|
||||
OptixAccelBuildOptions options = {};
|
||||
options.operation = operation;
|
||||
if (use_fast_trace_bvh) {
|
||||
VLOG(2) << "Using fast to trace OptiX BVH";
|
||||
if (background) {
|
||||
// Prefer best performance and lowest memory consumption in background
|
||||
options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE | OPTIX_BUILD_FLAG_ALLOW_COMPACTION;
|
||||
}
|
||||
else {
|
||||
VLOG(2) << "Using fast to update OptiX BVH";
|
||||
// Prefer fast updates in viewport
|
||||
options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_BUILD | OPTIX_BUILD_FLAG_ALLOW_UPDATE;
|
||||
}
|
||||
|
||||
@@ -1255,16 +1253,15 @@ class OptiXDevice : public CUDADevice {
|
||||
out_data.device_pointer,
|
||||
sizes.outputSizeInBytes,
|
||||
&out_handle,
|
||||
use_fast_trace_bvh ? &compacted_size_prop : NULL,
|
||||
use_fast_trace_bvh ? 1 : 0));
|
||||
background ? &compacted_size_prop : NULL,
|
||||
background ? 1 : 0));
|
||||
bvh->traversable_handle = static_cast<uint64_t>(out_handle);
|
||||
|
||||
// Wait for all operations to finish
|
||||
check_result_cuda_ret(cuStreamSynchronize(NULL));
|
||||
|
||||
// Compact acceleration structure to save memory (only if using fast trace as the
|
||||
// OPTIX_BUILD_FLAG_ALLOW_COMPACTION flag is only set in this case).
|
||||
if (use_fast_trace_bvh) {
|
||||
// Compact acceleration structure to save memory (do not do this in viewport for faster builds)
|
||||
if (background) {
|
||||
uint64_t compacted_size = sizes.outputSizeInBytes;
|
||||
check_result_cuda_ret(
|
||||
cuMemcpyDtoH(&compacted_size, compacted_size_prop.result, sizeof(compacted_size)));
|
||||
@@ -1309,8 +1306,6 @@ class OptiXDevice : public CUDADevice {
|
||||
return;
|
||||
}
|
||||
|
||||
const bool use_fast_trace_bvh = (bvh->params.bvh_type == SceneParams::BVH_STATIC);
|
||||
|
||||
free_bvh_memory_delayed();
|
||||
|
||||
BVHOptiX *const bvh_optix = static_cast<BVHOptiX *>(bvh);
|
||||
@@ -1320,10 +1315,10 @@ class OptiXDevice : public CUDADevice {
|
||||
if (!bvh->params.top_level) {
|
||||
assert(bvh->objects.size() == 1 && bvh->geometry.size() == 1);
|
||||
|
||||
// Refit is only possible in viewport for now (because AS is built with
|
||||
// OPTIX_BUILD_FLAG_ALLOW_UPDATE only there, see above)
|
||||
OptixBuildOperation operation = OPTIX_BUILD_OPERATION_BUILD;
|
||||
/* Refit is only possible when using fast to trace BVH (because AS is built with
|
||||
* OPTIX_BUILD_FLAG_ALLOW_UPDATE only there, see above). */
|
||||
if (refit && !use_fast_trace_bvh) {
|
||||
if (refit && !background) {
|
||||
assert(bvh_optix->traversable_handle != 0);
|
||||
operation = OPTIX_BUILD_OPERATION_UPDATE;
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class DenoiseParams {
|
||||
/* Viewport start sample. */
|
||||
int start_sample;
|
||||
|
||||
/** Native Denoiser. */
|
||||
/** Native Denoiser **/
|
||||
|
||||
/* Pixel radius for neighboring pixels to take into account. */
|
||||
int radius;
|
||||
@@ -81,7 +81,7 @@ class DenoiseParams {
|
||||
/* Clamp the input to the range of +-1e8. Should be enough for any legitimate data. */
|
||||
bool clamp_input;
|
||||
|
||||
/** OIDN/Optix Denoiser. */
|
||||
/** OIDN/Optix Denoiser **/
|
||||
|
||||
/* Passes handed over to the OIDN/OptiX denoiser (default to color + albedo). */
|
||||
DenoiserInput input_passes;
|
||||
|
@@ -1186,7 +1186,7 @@ bool OpenCLInfo::get_device_extensions(cl_device_id device_id,
|
||||
{
|
||||
size_t extension_length = 0;
|
||||
cl_int err;
|
||||
/* Determine the size of the extension string. */
|
||||
/* Determine the size of the extension string*/
|
||||
if ((err = clGetDeviceInfo(device_id, CL_DEVICE_EXTENSIONS, 0, 0, &extension_length)) !=
|
||||
CL_SUCCESS) {
|
||||
if (error != NULL) {
|
||||
|
@@ -116,7 +116,7 @@ CCL_NAMESPACE_BEGIN
|
||||
# endif
|
||||
# endif /* __SHADOW_RECORD_ALL__ */
|
||||
|
||||
/* Record all intersections - Volume BVH traversal. */
|
||||
/* Record all intersections - Volume BVH traversal */
|
||||
|
||||
# if defined(__VOLUME_RECORD_ALL__)
|
||||
# define BVH_FUNCTION_NAME bvh_intersect_volume_all
|
||||
|
@@ -71,87 +71,6 @@ ccl_device_inline float3 ray_offset(float3 P, float3 Ng)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function should be used to compute a modified ray start position for
|
||||
* rays leaving from a surface. The algorithm slightly distorts flat surface
|
||||
* of a triangle. Surface is lifted by amount h along normal n in the incident
|
||||
* point. */
|
||||
|
||||
ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd, float3 Ng)
|
||||
{
|
||||
float3 V[3], N[3];
|
||||
triangle_vertices_and_normals(kg, sd->prim, V, N);
|
||||
|
||||
const float u = sd->u, v = sd->v;
|
||||
const float w = 1 - u - v;
|
||||
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
|
||||
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
|
||||
|
||||
n = normalize(
|
||||
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
|
||||
|
||||
/* Parabolic approximation */
|
||||
float a = dot(N[2] - N[0], V[0] - V[2]);
|
||||
float b = dot(N[2] - N[1], V[1] - V[2]);
|
||||
float c = dot(N[1] - N[0], V[1] - V[0]);
|
||||
float h = a * u * (u - 1) + (a + b + c) * u * v + b * v * (v - 1);
|
||||
|
||||
/* Check flipped normals */
|
||||
if (dot(n, Ng) > 0) {
|
||||
/* Local linear envelope */
|
||||
float h0 = max(max(dot(V[1] - V[0], N[0]), dot(V[2] - V[0], N[0])), 0.0f);
|
||||
float h1 = max(max(dot(V[0] - V[1], N[1]), dot(V[2] - V[1], N[1])), 0.0f);
|
||||
float h2 = max(max(dot(V[0] - V[2], N[2]), dot(V[1] - V[2], N[2])), 0.0f);
|
||||
h0 = max(dot(V[0] - P, N[0]) + h0, 0.0f);
|
||||
h1 = max(dot(V[1] - P, N[1]) + h1, 0.0f);
|
||||
h2 = max(dot(V[2] - P, N[2]) + h2, 0.0f);
|
||||
h = max(min(min(h0, h1), h2), h * 0.5f);
|
||||
}
|
||||
else {
|
||||
float h0 = max(max(dot(V[0] - V[1], N[0]), dot(V[0] - V[2], N[0])), 0.0f);
|
||||
float h1 = max(max(dot(V[1] - V[0], N[1]), dot(V[1] - V[2], N[1])), 0.0f);
|
||||
float h2 = max(max(dot(V[2] - V[0], N[2]), dot(V[2] - V[1], N[2])), 0.0f);
|
||||
h0 = max(dot(P - V[0], N[0]) + h0, 0.0f);
|
||||
h1 = max(dot(P - V[1], N[1]) + h1, 0.0f);
|
||||
h2 = max(dot(P - V[2], N[2]) + h2, 0.0f);
|
||||
h = min(-min(min(h0, h1), h2), h * 0.5f);
|
||||
}
|
||||
|
||||
return n * h;
|
||||
}
|
||||
|
||||
/* Ray offset to avoid shadow terminator artifact. */
|
||||
|
||||
ccl_device_inline float3 ray_offset_shadow(KernelGlobals *kg, ShaderData *sd, float3 L)
|
||||
{
|
||||
float NL = dot(sd->N, L);
|
||||
bool transmit = (NL < 0.0f);
|
||||
float3 Ng = (transmit ? -sd->Ng : sd->Ng);
|
||||
float3 P = ray_offset(sd->P, Ng);
|
||||
|
||||
if ((sd->type & PRIMITIVE_ALL_TRIANGLE) && (sd->shader & SHADER_SMOOTH_NORMAL)) {
|
||||
const float offset_cutoff =
|
||||
kernel_tex_fetch(__objects, sd->object).shadow_terminator_geometry_offset;
|
||||
/* Do ray offset (heavy stuff) only for close to be terminated triangles:
|
||||
* offset_cutoff = 0.1f means that 10-20% of rays will be affected. Also
|
||||
* make a smooth transition near the threshold. */
|
||||
if (offset_cutoff > 0.0f) {
|
||||
float NgL = dot(Ng, L);
|
||||
float offset_amount = 0.0f;
|
||||
if (NL < offset_cutoff) {
|
||||
offset_amount = clamp(2.0f - (NgL + NL) / offset_cutoff, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
offset_amount = clamp(1.0f - NgL / offset_cutoff, 0.0f, 1.0f);
|
||||
}
|
||||
if (offset_amount > 0.0f) {
|
||||
P += smooth_surface_offset(kg, sd, Ng) * offset_amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return P;
|
||||
}
|
||||
|
||||
#if defined(__VOLUME_RECORD_ALL__) || (defined(__SHADOW_RECORD_ALL__) && defined(__KERNEL_CPU__))
|
||||
/* ToDo: Move to another file? */
|
||||
ccl_device int intersections_compare(const void *a, const void *b)
|
||||
|
@@ -462,7 +462,7 @@ ccl_device_inline int bsdf_sample(KernelGlobals *kg,
|
||||
else {
|
||||
/* Shadow terminator offset. */
|
||||
const float frequency_multiplier =
|
||||
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
|
||||
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
|
||||
if (frequency_multiplier > 1.0f) {
|
||||
*eval *= shift_cos_in(dot(*omega_in, sc->N), frequency_multiplier);
|
||||
}
|
||||
@@ -488,9 +488,12 @@ ccl_device_inline
|
||||
const float3 omega_in,
|
||||
float *pdf)
|
||||
{
|
||||
/* For curves use the smooth normal, particularly for ribbons the geometric
|
||||
* normal gives too much darkening otherwise. */
|
||||
const float3 Ng = (sd->type & PRIMITIVE_ALL_CURVE) ? sd->N : sd->Ng;
|
||||
float3 eval;
|
||||
|
||||
if (dot(sd->N, omega_in) >= 0.0f) {
|
||||
if (dot(Ng, omega_in) >= 0.0f) {
|
||||
switch (sc->type) {
|
||||
case CLOSURE_BSDF_DIFFUSE_ID:
|
||||
case CLOSURE_BSDF_BSSRDF_ID:
|
||||
@@ -586,7 +589,7 @@ ccl_device_inline
|
||||
}
|
||||
/* Shadow terminator offset. */
|
||||
const float frequency_multiplier =
|
||||
kernel_tex_fetch(__objects, sd->object).shadow_terminator_shading_offset;
|
||||
kernel_tex_fetch(__objects, sd->object).shadow_terminator_offset;
|
||||
if (frequency_multiplier > 1.0f) {
|
||||
eval *= shift_cos_in(dot(omega_in, sc->N), frequency_multiplier);
|
||||
}
|
||||
|
@@ -138,7 +138,7 @@ ccl_device_inline float4 primitive_surface_attribute_float4(KernelGlobals *kg,
|
||||
ccl_device_inline bool primitive_is_volume_attribute(const ShaderData *sd,
|
||||
const AttributeDescriptor desc)
|
||||
{
|
||||
return sd->type == PRIMITIVE_VOLUME;
|
||||
return (sd->object != OBJECT_NONE && desc.element == ATTR_ELEMENT_VOXEL);
|
||||
}
|
||||
|
||||
ccl_device_inline float primitive_volume_attribute_float(KernelGlobals *kg,
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Normal on triangle. */
|
||||
/* normal on triangle */
|
||||
ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
|
||||
{
|
||||
/* load triangle vertices */
|
||||
@@ -40,7 +40,7 @@ ccl_device_inline float3 triangle_normal(KernelGlobals *kg, ShaderData *sd)
|
||||
}
|
||||
}
|
||||
|
||||
/* Point and normal on triangle. */
|
||||
/* point and normal on triangle */
|
||||
ccl_device_inline void triangle_point_normal(
|
||||
KernelGlobals *kg, int object, int prim, float u, float v, float3 *P, float3 *Ng, int *shader)
|
||||
{
|
||||
@@ -75,22 +75,6 @@ ccl_device_inline void triangle_vertices(KernelGlobals *kg, int prim, float3 P[3
|
||||
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
|
||||
}
|
||||
|
||||
/* Triangle vertex locations and vertex normals */
|
||||
|
||||
ccl_device_inline void triangle_vertices_and_normals(KernelGlobals *kg,
|
||||
int prim,
|
||||
float3 P[3],
|
||||
float3 N[3])
|
||||
{
|
||||
const uint4 tri_vindex = kernel_tex_fetch(__tri_vindex, prim);
|
||||
P[0] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 0));
|
||||
P[1] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 1));
|
||||
P[2] = float4_to_float3(kernel_tex_fetch(__prim_tri_verts, tri_vindex.w + 2));
|
||||
N[0] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.x));
|
||||
N[1] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.y));
|
||||
N[2] = float4_to_float3(kernel_tex_fetch(__tri_vnormal, tri_vindex.z));
|
||||
}
|
||||
|
||||
/* Interpolate smooth vertex normal from vertices */
|
||||
|
||||
ccl_device_inline float3
|
||||
|
@@ -72,10 +72,6 @@ ccl_device float4 volume_attribute_float4(KernelGlobals *kg,
|
||||
const ShaderData *sd,
|
||||
const AttributeDescriptor desc)
|
||||
{
|
||||
if (desc.element & (ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) {
|
||||
return kernel_tex_fetch(__attributes_float3, desc.offset);
|
||||
}
|
||||
else if (desc.element == ATTR_ELEMENT_VOXEL) {
|
||||
/* todo: optimize this so we don't have to transform both here and in
|
||||
* kernel_tex_image_interp_3d when possible. Also could optimize for the
|
||||
* common case where transform is translation/scale only. */
|
||||
@@ -85,10 +81,6 @@ ccl_device float4 volume_attribute_float4(KernelGlobals *kg,
|
||||
INTERPOLATION_NONE;
|
||||
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
|
||||
}
|
||||
else {
|
||||
return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -176,7 +176,8 @@ ccl_device_noinline_cpu bool direct_emission(KernelGlobals *kg,
|
||||
|
||||
if (ls->shader & SHADER_CAST_SHADOW) {
|
||||
/* setup ray */
|
||||
ray->P = ray_offset_shadow(kg, sd, ls->D);
|
||||
bool transmit = (dot(sd->Ng, ls->D) < 0.0f);
|
||||
ray->P = ray_offset(sd->P, (transmit) ? -sd->Ng : sd->Ng);
|
||||
|
||||
if (ls->t == FLT_MAX) {
|
||||
/* distant light */
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Spherical coordinates <-> Cartesian direction. */
|
||||
/* Spherical coordinates <-> Cartesian direction */
|
||||
|
||||
ccl_device float2 direction_to_spherical(float3 dir)
|
||||
{
|
||||
|
@@ -274,7 +274,7 @@ ccl_device_inline void shader_setup_from_sample(KernelGlobals *kg,
|
||||
/* primitive */
|
||||
sd->object = object;
|
||||
sd->lamp = LAMP_NONE;
|
||||
/* Currently no access to bvh prim index for strand sd->prim. */
|
||||
/* currently no access to bvh prim index for strand sd->prim*/
|
||||
sd->prim = prim;
|
||||
sd->u = u;
|
||||
sd->v = v;
|
||||
@@ -1268,7 +1268,6 @@ ccl_device_inline void shader_eval_volume(KernelGlobals *kg,
|
||||
sd->num_closure_left = max_closures;
|
||||
sd->flag = 0;
|
||||
sd->object_flag = 0;
|
||||
sd->type = PRIMITIVE_VOLUME;
|
||||
|
||||
for (int i = 0; stack[i].shader != SHADER_NONE; i++) {
|
||||
/* setup shaderdata from stack. it's mostly setup already in
|
||||
|
@@ -689,24 +689,22 @@ typedef enum PrimitiveType {
|
||||
PRIMITIVE_MOTION_CURVE_THICK = (1 << 3),
|
||||
PRIMITIVE_CURVE_RIBBON = (1 << 4),
|
||||
PRIMITIVE_MOTION_CURVE_RIBBON = (1 << 5),
|
||||
PRIMITIVE_VOLUME = (1 << 6),
|
||||
/* Lamp primitive is not included below on purpose,
|
||||
* since it is no real traceable primitive.
|
||||
*/
|
||||
PRIMITIVE_LAMP = (1 << 7),
|
||||
PRIMITIVE_LAMP = (1 << 6),
|
||||
|
||||
PRIMITIVE_ALL_TRIANGLE = (PRIMITIVE_TRIANGLE | PRIMITIVE_MOTION_TRIANGLE),
|
||||
PRIMITIVE_ALL_CURVE = (PRIMITIVE_CURVE_THICK | PRIMITIVE_MOTION_CURVE_THICK |
|
||||
PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON),
|
||||
PRIMITIVE_ALL_VOLUME = (PRIMITIVE_VOLUME),
|
||||
PRIMITIVE_ALL_MOTION = (PRIMITIVE_MOTION_TRIANGLE | PRIMITIVE_MOTION_CURVE_THICK |
|
||||
PRIMITIVE_MOTION_CURVE_RIBBON),
|
||||
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE | PRIMITIVE_ALL_VOLUME),
|
||||
PRIMITIVE_ALL = (PRIMITIVE_ALL_TRIANGLE | PRIMITIVE_ALL_CURVE),
|
||||
|
||||
/* Total number of different traceable primitives.
|
||||
* NOTE: This is an actual value, not a bitflag.
|
||||
*/
|
||||
PRIMITIVE_NUM_TOTAL = 7,
|
||||
PRIMITIVE_NUM_TOTAL = 6,
|
||||
} PrimitiveType;
|
||||
|
||||
#define PRIMITIVE_PACK_SEGMENT(type, segment) ((segment << PRIMITIVE_NUM_TOTAL) | (type))
|
||||
@@ -1481,8 +1479,7 @@ typedef struct KernelObject {
|
||||
float cryptomatte_object;
|
||||
float cryptomatte_asset;
|
||||
|
||||
float shadow_terminator_shading_offset;
|
||||
float shadow_terminator_geometry_offset;
|
||||
float shadow_terminator_offset;
|
||||
float pad1, pad2, pad3;
|
||||
} KernelObject;
|
||||
static_assert_align(KernelObject, 16);
|
||||
|
@@ -49,7 +49,7 @@ void OSLShader::thread_init(KernelGlobals *kg,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Per thread kernel data init. */
|
||||
/* per thread kernel data init*/
|
||||
kg->osl = osl_globals;
|
||||
|
||||
OSL::ShadingSystem *ss = kg->osl->ss;
|
||||
|
@@ -52,9 +52,6 @@ shader node_vector_math(string math_type = "add",
|
||||
else if (math_type == "faceforward") {
|
||||
Vector = compatible_faceforward(Vector1, Vector2, Vector3);
|
||||
}
|
||||
else if (math_type == "multiply_add") {
|
||||
Vector = Vector1 * Vector2 + Vector3;
|
||||
}
|
||||
else if (math_type == "dot_product") {
|
||||
Value = dot(Vector1, Vector2);
|
||||
}
|
||||
|
@@ -220,13 +220,11 @@ ccl_device void svm_node_hair_info(
|
||||
stack_store_float(stack, out_offset, data);
|
||||
break;
|
||||
}
|
||||
# if 0
|
||||
case NODE_INFO_CURVE_FADE: {
|
||||
/*case NODE_INFO_CURVE_FADE: {
|
||||
data = sd->curve_transparency;
|
||||
stack_store_float(stack, out_offset, data);
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
}*/
|
||||
case NODE_INFO_CURVE_TANGENT_NORMAL: {
|
||||
data3 = curve_tangent_normal(kg, sd);
|
||||
stack_store_float3(stack, out_offset, data3);
|
||||
|
@@ -58,8 +58,7 @@ ccl_device void svm_node_vector_math(KernelGlobals *kg,
|
||||
float3 vector;
|
||||
|
||||
/* 3 Vector Operators */
|
||||
if (type == NODE_VECTOR_MATH_WRAP || type == NODE_VECTOR_MATH_FACEFORWARD ||
|
||||
type == NODE_VECTOR_MATH_MULTIPLY_ADD) {
|
||||
if (type == NODE_VECTOR_MATH_WRAP || type == NODE_VECTOR_MATH_FACEFORWARD) {
|
||||
uint4 extra_node = read_node(kg, offset);
|
||||
c = stack_load_float3(stack, extra_node.x);
|
||||
}
|
||||
|
@@ -52,9 +52,6 @@ ccl_device void svm_vector_math(float *value,
|
||||
case NODE_VECTOR_MATH_FACEFORWARD:
|
||||
*vector = faceforward(a, b, c);
|
||||
break;
|
||||
case NODE_VECTOR_MATH_MULTIPLY_ADD:
|
||||
*vector = a * b + c;
|
||||
break;
|
||||
case NODE_VECTOR_MATH_DOT_PRODUCT:
|
||||
*value = dot(a, b);
|
||||
break;
|
||||
|
@@ -341,7 +341,6 @@ typedef enum NodeVectorMathType {
|
||||
NODE_VECTOR_MATH_TANGENT,
|
||||
NODE_VECTOR_MATH_REFRACT,
|
||||
NODE_VECTOR_MATH_FACEFORWARD,
|
||||
NODE_VECTOR_MATH_MULTIPLY_ADD,
|
||||
} NodeVectorMathType;
|
||||
|
||||
typedef enum NodeClampType {
|
||||
|
@@ -333,7 +333,7 @@ static M44d get_interpolated_matrix_for_time(const MatrixSampleMap &samples, chr
|
||||
|
||||
chrono_t t = (time - prev_time) / (next_time - prev_time);
|
||||
|
||||
/* Ensure rotation around the shortest angle. */
|
||||
/* ensure rotation around the shortest angle */
|
||||
if ((prev_rotation ^ next_rotation) < 0) {
|
||||
next_rotation = -next_rotation;
|
||||
}
|
||||
|
@@ -736,14 +736,13 @@ static void process_uvs(CachedData &cache,
|
||||
const IV2fGeomParam::Sample &sample,
|
||||
double time)
|
||||
{
|
||||
if (scope != kFacevaryingScope && scope != kVaryingScope && scope != kVertexScope) {
|
||||
if (scope != kFacevaryingScope) {
|
||||
return;
|
||||
}
|
||||
|
||||
const array<int> *uv_loops = cache.uv_loops.data_for_time_no_check(time).get_data_or_null();
|
||||
|
||||
/* It's ok to not have loop indices, as long as the scope is not face-varying. */
|
||||
if (!uv_loops && scope == kFacevaryingScope) {
|
||||
if (!uv_loops) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -767,28 +766,10 @@ static void process_uvs(CachedData &cache,
|
||||
const uint32_t *indices = sample.getIndices()->get();
|
||||
const V2f *values = sample.getVals()->get();
|
||||
|
||||
if (scope == kFacevaryingScope) {
|
||||
for (const int uv_loop_index : *uv_loops) {
|
||||
const uint32_t index = indices[uv_loop_index];
|
||||
*data_float2++ = make_float2(values[index][0], values[index][1]);
|
||||
}
|
||||
}
|
||||
else if (scope == kVaryingScope || scope == kVertexScope) {
|
||||
if (triangles) {
|
||||
for (size_t i = 0; i < triangles->size(); i++) {
|
||||
const int3 t = (*triangles)[i];
|
||||
*data_float2++ = make_float2(values[t.x][0], values[t.x][1]);
|
||||
*data_float2++ = make_float2(values[t.y][0], values[t.y][1]);
|
||||
*data_float2++ = make_float2(values[t.z][0], values[t.z][1]);
|
||||
}
|
||||
}
|
||||
else if (corners) {
|
||||
for (size_t i = 0; i < corners->size(); i++) {
|
||||
const int c = (*corners)[i];
|
||||
*data_float2++ = make_float2(values[c][0], values[c][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attribute.data.add_data(data, time);
|
||||
}
|
||||
|
@@ -48,7 +48,6 @@ void ConstantFolder::make_constant(float value) const
|
||||
|
||||
foreach (ShaderInput *sock, output->links) {
|
||||
sock->set(value);
|
||||
sock->constant_folded_in = true;
|
||||
}
|
||||
|
||||
graph->disconnect(output);
|
||||
@@ -60,7 +59,6 @@ void ConstantFolder::make_constant(float3 value) const
|
||||
|
||||
foreach (ShaderInput *sock, output->links) {
|
||||
sock->set(value);
|
||||
sock->constant_folded_in = true;
|
||||
}
|
||||
|
||||
graph->disconnect(output);
|
||||
|
@@ -676,8 +676,8 @@ void GeometryManager::update_attribute_element_offset(Geometry *geom,
|
||||
Mesh *mesh = static_cast<Mesh *>(geom);
|
||||
if (mesh->subdivision_type == Mesh::SUBDIVISION_CATMULL_CLARK &&
|
||||
desc.flags & ATTR_SUBDIVIDED) {
|
||||
/* Indices for subdivided attributes are retrieved
|
||||
* from patch table so no need for correction here. */
|
||||
/* indices for subdivided attributes are retrieved
|
||||
* from patch table so no need for correction here*/
|
||||
}
|
||||
else if (element == ATTR_ELEMENT_VERTEX)
|
||||
offset -= mesh->vert_offset;
|
||||
|
@@ -79,11 +79,7 @@ enum ShaderNodeSpecialType {
|
||||
class ShaderInput {
|
||||
public:
|
||||
ShaderInput(const SocketType &socket_type_, ShaderNode *parent_)
|
||||
: socket_type(socket_type_),
|
||||
parent(parent_),
|
||||
link(NULL),
|
||||
stack_offset(SVM_STACK_INVALID),
|
||||
constant_folded_in(false)
|
||||
: socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -115,10 +111,6 @@ class ShaderInput {
|
||||
ShaderNode *parent;
|
||||
ShaderOutput *link;
|
||||
int stack_offset; /* for SVM compiler */
|
||||
|
||||
/* Keeps track of whether a constant was folded in this socket, to avoid over-optimizing when the
|
||||
* link is null. */
|
||||
bool constant_folded_in;
|
||||
};
|
||||
|
||||
/* Output
|
||||
|
@@ -4374,7 +4374,7 @@ NODE_DEFINE(HairInfoNode)
|
||||
SOCKET_OUT_FLOAT(intercept, "Intercept");
|
||||
SOCKET_OUT_FLOAT(thickness, "Thickness");
|
||||
SOCKET_OUT_NORMAL(tangent_normal, "Tangent Normal");
|
||||
#if 0 /* Output for minimum hair width transparency - deactivated. */
|
||||
#if 0 /*output for minimum hair width transparency - deactivated */
|
||||
SOCKET_OUT_FLOAT(fade, "Fade");
|
||||
#endif
|
||||
SOCKET_OUT_FLOAT(index, "Random");
|
||||
@@ -4425,12 +4425,12 @@ void HairInfoNode::compile(SVMCompiler &compiler)
|
||||
if (!out->links.empty()) {
|
||||
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_TANGENT_NORMAL, compiler.stack_assign(out));
|
||||
}
|
||||
#if 0
|
||||
out = output("Fade");
|
||||
|
||||
/*out = output("Fade");
|
||||
if(!out->links.empty()) {
|
||||
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_FADE, compiler.stack_assign(out));
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
out = output("Random");
|
||||
if (!out->links.empty()) {
|
||||
int attr = compiler.attribute(ATTR_STD_CURVE_RANDOM);
|
||||
@@ -6093,7 +6093,6 @@ NODE_DEFINE(VectorMathNode)
|
||||
type_enum.insert("reflect", NODE_VECTOR_MATH_REFLECT);
|
||||
type_enum.insert("refract", NODE_VECTOR_MATH_REFRACT);
|
||||
type_enum.insert("faceforward", NODE_VECTOR_MATH_FACEFORWARD);
|
||||
type_enum.insert("multiply_add", NODE_VECTOR_MATH_MULTIPLY_ADD);
|
||||
|
||||
type_enum.insert("dot_product", NODE_VECTOR_MATH_DOT_PRODUCT);
|
||||
|
||||
@@ -6166,8 +6165,7 @@ void VectorMathNode::compile(SVMCompiler &compiler)
|
||||
int vector_stack_offset = compiler.stack_assign_if_linked(vector_out);
|
||||
|
||||
/* 3 Vector Operators */
|
||||
if (math_type == NODE_VECTOR_MATH_WRAP || math_type == NODE_VECTOR_MATH_FACEFORWARD ||
|
||||
math_type == NODE_VECTOR_MATH_MULTIPLY_ADD) {
|
||||
if (math_type == NODE_VECTOR_MATH_WRAP || math_type == NODE_VECTOR_MATH_FACEFORWARD) {
|
||||
ShaderInput *vector3_in = input("Vector3");
|
||||
int vector3_stack_offset = compiler.stack_assign(vector3_in);
|
||||
compiler.add_node(
|
||||
|
@@ -93,8 +93,7 @@ NODE_DEFINE(Object)
|
||||
SOCKET_POINT(dupli_generated, "Dupli Generated", zero_float3());
|
||||
SOCKET_POINT2(dupli_uv, "Dupli UV", zero_float2());
|
||||
SOCKET_TRANSFORM_ARRAY(motion, "Motion", array<Transform>());
|
||||
SOCKET_FLOAT(shadow_terminator_shading_offset, "Shadow Terminator Shading Offset", 0.0f);
|
||||
SOCKET_FLOAT(shadow_terminator_geometry_offset, "Shadow Terminator Geometry Offset", 0.1f);
|
||||
SOCKET_FLOAT(shadow_terminator_offset, "Terminator Offset", 0.0f);
|
||||
SOCKET_STRING(asset_name, "Asset Name", ustring());
|
||||
|
||||
SOCKET_BOOLEAN(is_shadow_catcher, "Shadow Catcher", false);
|
||||
@@ -508,9 +507,7 @@ void ObjectManager::device_update_object_transform(UpdateObjectTransformState *s
|
||||
kobject.cryptomatte_asset = util_hash_to_float(hash_asset);
|
||||
}
|
||||
|
||||
kobject.shadow_terminator_shading_offset = 1.0f /
|
||||
(1.0f - 0.5f * ob->shadow_terminator_shading_offset);
|
||||
kobject.shadow_terminator_geometry_offset = ob->shadow_terminator_geometry_offset;
|
||||
kobject.shadow_terminator_offset = 1.0f / (1.0f - 0.5f * ob->shadow_terminator_offset);
|
||||
|
||||
/* Object flag. */
|
||||
if (ob->use_holdout) {
|
||||
|
@@ -64,8 +64,7 @@ class Object : public Node {
|
||||
NODE_SOCKET_API(bool, hide_on_missing_motion)
|
||||
NODE_SOCKET_API(bool, use_holdout)
|
||||
NODE_SOCKET_API(bool, is_shadow_catcher)
|
||||
NODE_SOCKET_API(float, shadow_terminator_shading_offset)
|
||||
NODE_SOCKET_API(float, shadow_terminator_geometry_offset)
|
||||
NODE_SOCKET_API(float, shadow_terminator_offset)
|
||||
|
||||
NODE_SOCKET_API(float3, dupli_generated)
|
||||
NODE_SOCKET_API(float2, dupli_uv)
|
||||
|
@@ -1252,7 +1252,7 @@ bool Session::update_progressive_refine(bool cancel)
|
||||
double current_time = time_dt();
|
||||
|
||||
if (current_time - last_update_time < params.progressive_update_timeout) {
|
||||
/* If last sample was processed, we need to write buffers anyway. */
|
||||
/* if last sample was processed, we need to write buffers anyway */
|
||||
if (!write && sample != 1)
|
||||
return false;
|
||||
}
|
||||
|
@@ -304,7 +304,7 @@ int SVMCompiler::stack_assign(ShaderOutput *output)
|
||||
|
||||
int SVMCompiler::stack_assign_if_linked(ShaderInput *input)
|
||||
{
|
||||
if (input->link || input->constant_folded_in)
|
||||
if (input->link)
|
||||
return stack_assign(input);
|
||||
|
||||
return SVM_STACK_INVALID;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
if(WITH_GTESTS)
|
||||
Include(GTestTesting)
|
||||
|
||||
# Otherwise we get warnings here that we can't fix in external projects
|
||||
# Otherwise we get warnings here that we cant fix in external projects
|
||||
remove_strict_flags()
|
||||
endif()
|
||||
|
||||
|
@@ -223,14 +223,12 @@ ccl_device_inline ssef fastpow24(const ssef &arg)
|
||||
ssef x = fastpow<0x3F4CCCCD, 0x4F55A7FB>(arg); // error max = 0.17 avg = 0.0018 |avg| = 0.05
|
||||
ssef arg2 = arg * arg;
|
||||
ssef arg4 = arg2 * arg2;
|
||||
|
||||
/* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
|
||||
x = improve_5throot_solution(x, arg4);
|
||||
/* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
|
||||
x = improve_5throot_solution(x, arg4);
|
||||
/* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
|
||||
x = improve_5throot_solution(x, arg4);
|
||||
|
||||
x = improve_5throot_solution(x,
|
||||
arg4); /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */
|
||||
x = improve_5throot_solution(x,
|
||||
arg4); /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */
|
||||
x = improve_5throot_solution(x,
|
||||
arg4); /* error max = 6.1e-07 avg = 5.2e-08 |avg| = 1.1e-07 */
|
||||
return x * (x * x);
|
||||
}
|
||||
|
||||
|
@@ -243,7 +243,7 @@ ccl_device float fast_sinpif(float x)
|
||||
const float P = 3.584135056f; /* P = 16-4*Q */
|
||||
return y * (Q + P * fabsf(y));
|
||||
|
||||
/* The original article used inferior constants for Q and P and
|
||||
/* The original article used used inferior constants for Q and P and
|
||||
* so had max error 1.091e-3.
|
||||
*
|
||||
* The optimal value for Q was determined by exhaustive search, minimizing
|
||||
|
@@ -282,8 +282,8 @@ static CPUCapabilities &system_cpu_capabilities()
|
||||
/* actual opcode for xgetbv */
|
||||
__asm__(".byte 0x0f, 0x01, 0xd0" : "=a"(xcr_feature_mask), "=d"(edx) : "c"(0));
|
||||
# elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
||||
/* Minimum VS2010 SP1 compiler is required. */
|
||||
xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK);
|
||||
xcr_feature_mask = (uint32_t)_xgetbv(
|
||||
_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */
|
||||
# else
|
||||
xcr_feature_mask = 0;
|
||||
# endif
|
||||
|
@@ -68,7 +68,7 @@ class TaskPool {
|
||||
|
||||
/* ** Statistics ** */
|
||||
|
||||
/* Time stamp of first task pushed. */
|
||||
/* Time time stamp of first task pushed. */
|
||||
double start_time;
|
||||
|
||||
/* Number of all tasks pushed to the pool. Cleared after wait_work() and cancel(). */
|
||||
@@ -88,7 +88,7 @@ class TaskScheduler {
|
||||
|
||||
/* Approximate number of threads that will work on task, which may be lower
|
||||
* or higher than the actual number of threads. Use as little as possible and
|
||||
* leave splitting up tasks to the scheduler. */
|
||||
* leave splitting up tasks to the scheduler.. */
|
||||
static int num_threads();
|
||||
|
||||
protected:
|
||||
|
@@ -93,21 +93,40 @@ void my_guess_pkt_duration(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||
#endif
|
||||
|
||||
FFMPEG_INLINE
|
||||
int64_t timestamp_from_pts_or_dts(int64_t pts, int64_t dts)
|
||||
void my_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
||||
{
|
||||
/* Some videos do not have any pts values, use dts instead in those cases if
|
||||
* possible. Usually when this happens dts can act as pts because as all frames
|
||||
* should then be presented in their decoded in order. IE pts == dts. */
|
||||
if (pts == AV_NOPTS_VALUE) {
|
||||
return dts;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
AVStream *st = s->streams[i];
|
||||
|
||||
st->cur_dts = av_rescale(timestamp,
|
||||
st->time_base.den * (int64_t)ref_st->time_base.num,
|
||||
st->time_base.num * (int64_t)ref_st->time_base.den);
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
||||
FFMPEG_INLINE
|
||||
int64_t av_get_pts_from_frame(AVFrame *picture)
|
||||
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
||||
{
|
||||
return timestamp_from_pts_or_dts(picture->pts, picture->pkt_dts);
|
||||
my_update_cur_dts(s, ref_st, timestamp);
|
||||
}
|
||||
|
||||
FFMPEG_INLINE
|
||||
int64_t av_get_pts_from_frame(AVFormatContext *avctx, AVFrame *picture)
|
||||
{
|
||||
int64_t pts;
|
||||
pts = picture->pts;
|
||||
|
||||
if (pts == AV_NOPTS_VALUE) {
|
||||
pts = picture->pkt_dts;
|
||||
}
|
||||
if (pts == AV_NOPTS_VALUE) {
|
||||
pts = 0;
|
||||
}
|
||||
|
||||
(void)avctx;
|
||||
return pts;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@@ -282,7 +282,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
||||
${wayland-egl_INCLUDE_DIRS}
|
||||
${xkbcommon_INCLUDE_DIRS}
|
||||
${wayland-cursor_INCLUDE_DIRS}
|
||||
${dbus_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
list(APPEND SRC
|
||||
@@ -322,11 +321,6 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
||||
xdg-shell
|
||||
"${WAYLAND_PROTOCOLS_DIR}/stable/xdg-shell/xdg-shell.xml"
|
||||
)
|
||||
# xdg-decoration.
|
||||
generate_protocol_bindings(
|
||||
xdg-decoration
|
||||
"${WAYLAND_PROTOCOLS_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
|
||||
)
|
||||
# Pointer-constraints.
|
||||
generate_protocol_bindings(
|
||||
pointer-constraints
|
||||
@@ -370,7 +364,6 @@ elseif(WIN32)
|
||||
intern/GHOST_DropTargetWin32.cpp
|
||||
intern/GHOST_SystemWin32.cpp
|
||||
intern/GHOST_WindowWin32.cpp
|
||||
intern/GHOST_Wintab.cpp
|
||||
|
||||
intern/GHOST_ContextD3D.h
|
||||
intern/GHOST_DisplayManagerWin32.h
|
||||
@@ -378,7 +371,6 @@ elseif(WIN32)
|
||||
intern/GHOST_SystemWin32.h
|
||||
intern/GHOST_TaskbarWin32.h
|
||||
intern/GHOST_WindowWin32.h
|
||||
intern/GHOST_Wintab.h
|
||||
)
|
||||
|
||||
if(NOT WITH_GL_EGL)
|
||||
@@ -483,17 +475,10 @@ if(WITH_XR_OPENXR)
|
||||
shlwapi
|
||||
)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_OS_LINUX)
|
||||
if (WITH_GHOST_WAYLAND)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_WAYLAND)
|
||||
endif()
|
||||
if (WITH_GHOST_X11)
|
||||
if (WITH_GL_EGL)
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_EGL)
|
||||
else()
|
||||
list(APPEND XR_PLATFORM_DEFINES -DXR_USE_PLATFORM_XLIB)
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND XR_PLATFORM_DEFINES
|
||||
-DXR_OS_LINUX
|
||||
-DXR_USE_PLATFORM_XLIB
|
||||
)
|
||||
endif()
|
||||
|
||||
add_definitions(-DWITH_XR_OPENXR ${XR_PLATFORM_DEFINES})
|
||||
|
@@ -95,7 +95,7 @@ class GHOST_ISystemPaths {
|
||||
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
||||
|
||||
private:
|
||||
/** The one and only system paths. */
|
||||
/** The one and only system paths*/
|
||||
static GHOST_ISystemPaths *m_systemPaths;
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
|
@@ -105,9 +105,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
GHOST_kTabletAutomatic = 0,
|
||||
/* Show as Windows Ink to users to match "Use Windows Ink" in tablet utilities,
|
||||
* but we use the dependent Windows Pointer API. */
|
||||
GHOST_kTabletWinPointer,
|
||||
GHOST_kTabletNative,
|
||||
GHOST_kTabletWintab,
|
||||
} GHOST_TTabletAPI;
|
||||
|
||||
@@ -170,7 +168,7 @@ typedef enum {
|
||||
GHOST_kButtonMaskRight,
|
||||
GHOST_kButtonMaskButton4,
|
||||
GHOST_kButtonMaskButton5,
|
||||
/* Trackballs and programmable buttons. */
|
||||
/* Trackballs and programmable buttons */
|
||||
GHOST_kButtonMaskButton6,
|
||||
GHOST_kButtonMaskButton7,
|
||||
GHOST_kButtonNumMasks
|
||||
@@ -179,15 +177,15 @@ typedef enum {
|
||||
typedef enum {
|
||||
GHOST_kEventUnknown = 0,
|
||||
|
||||
GHOST_kEventCursorMove, /* Mouse move event. */
|
||||
GHOST_kEventButtonDown, /* Mouse button event. */
|
||||
GHOST_kEventButtonUp, /* Mouse button event. */
|
||||
GHOST_kEventWheel, /* Mouse wheel event. */
|
||||
GHOST_kEventTrackpad, /* Trackpad event. */
|
||||
GHOST_kEventCursorMove, /// Mouse move event
|
||||
GHOST_kEventButtonDown, /// Mouse button event
|
||||
GHOST_kEventButtonUp, /// Mouse button event
|
||||
GHOST_kEventWheel, /// Mouse wheel event
|
||||
GHOST_kEventTrackpad, /// Trackpad event
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
GHOST_kEventNDOFMotion, /* N degree of freedom device motion event. */
|
||||
GHOST_kEventNDOFButton, /* N degree of freedom device button event. */
|
||||
GHOST_kEventNDOFMotion, /// N degree of freedom device motion event
|
||||
GHOST_kEventNDOFButton, /// N degree of freedom device button event
|
||||
#endif
|
||||
|
||||
GHOST_kEventKeyDown,
|
||||
@@ -209,8 +207,8 @@ typedef enum {
|
||||
GHOST_kEventDraggingExited,
|
||||
GHOST_kEventDraggingDropDone,
|
||||
|
||||
GHOST_kEventOpenMainFile, /* Needed for Cocoa to open double-clicked .blend file at startup. */
|
||||
GHOST_kEventNativeResolutionChange, /* Needed for Cocoa when window moves to other display. */
|
||||
GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup
|
||||
GHOST_kEventNativeResolutionChange, // Needed for Cocoa when window moves to other display
|
||||
|
||||
GHOST_kEventTimer,
|
||||
|
||||
@@ -283,7 +281,7 @@ typedef enum {
|
||||
GHOST_kKeyPeriod = '.',
|
||||
GHOST_kKeySlash = '/',
|
||||
|
||||
/* Number keys. */
|
||||
// Number keys
|
||||
GHOST_kKey0 = '0',
|
||||
GHOST_kKey1,
|
||||
GHOST_kKey2,
|
||||
@@ -298,7 +296,7 @@ typedef enum {
|
||||
GHOST_kKeySemicolon = ';',
|
||||
GHOST_kKeyEqual = '=',
|
||||
|
||||
/* Character keys. */
|
||||
// Character keys
|
||||
GHOST_kKeyA = 'A',
|
||||
GHOST_kKeyB,
|
||||
GHOST_kKeyC,
|
||||
@@ -337,8 +335,8 @@ typedef enum {
|
||||
GHOST_kKeyRightControl,
|
||||
GHOST_kKeyLeftAlt,
|
||||
GHOST_kKeyRightAlt,
|
||||
GHOST_kKeyOS, /* Command key on Apple, Windows key(s) on Windows. */
|
||||
GHOST_kKeyGrLess, /* German PC only! */
|
||||
GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows
|
||||
GHOST_kKeyGrLess, // German PC only!
|
||||
GHOST_kKeyApp, /* Also known as menu key. */
|
||||
|
||||
GHOST_kKeyCapsLock,
|
||||
@@ -360,7 +358,7 @@ typedef enum {
|
||||
GHOST_kKeyUpPage,
|
||||
GHOST_kKeyDownPage,
|
||||
|
||||
/* Numpad keys. */
|
||||
// Numpad keys
|
||||
GHOST_kKeyNumpad0,
|
||||
GHOST_kKeyNumpad1,
|
||||
GHOST_kKeyNumpad2,
|
||||
@@ -378,7 +376,7 @@ typedef enum {
|
||||
GHOST_kKeyNumpadAsterisk,
|
||||
GHOST_kKeyNumpadSlash,
|
||||
|
||||
/* Function keys. */
|
||||
// Function keys
|
||||
GHOST_kKeyF1,
|
||||
GHOST_kKeyF2,
|
||||
GHOST_kKeyF3,
|
||||
@@ -404,7 +402,7 @@ typedef enum {
|
||||
GHOST_kKeyF23,
|
||||
GHOST_kKeyF24,
|
||||
|
||||
/* Multimedia keypad buttons. */
|
||||
// Multimedia keypad buttons
|
||||
GHOST_kKeyMediaPlay,
|
||||
GHOST_kKeyMediaStop,
|
||||
GHOST_kKeyMediaFirst,
|
||||
@@ -481,9 +479,9 @@ typedef struct {
|
||||
|
||||
typedef enum {
|
||||
GHOST_kDragnDropTypeUnknown = 0,
|
||||
GHOST_kDragnDropTypeFilenames, /* Array of strings representing file names (full path). */
|
||||
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string. */
|
||||
GHOST_kDragnDropTypeBitmap /* Bitmap image data. */
|
||||
GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */
|
||||
GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */
|
||||
GHOST_kDragnDropTypeBitmap /*Bitmap image data */
|
||||
} GHOST_TDragnDropTypes;
|
||||
|
||||
typedef struct {
|
||||
@@ -529,23 +527,18 @@ typedef enum {
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
typedef struct {
|
||||
/** N-degree of freedom device data v3 [GSoC 2010] */
|
||||
/* Each component normally ranges from -1 to +1, but can exceed that.
|
||||
* These use blender standard view coordinates,
|
||||
* with positive rotations being CCW about the axis. */
|
||||
/* translation: */
|
||||
float tx, ty, tz;
|
||||
/* rotation:
|
||||
* - `axis = (rx,ry,rz).normalized`
|
||||
* - `amount = (rx,ry,rz).magnitude` [in revolutions, 1.0 = 360 deg]. */
|
||||
float rx, ry, rz;
|
||||
/** Time since previous NDOF Motion event */
|
||||
float dt;
|
||||
/** Starting, #GHOST_kInProgress or #GHOST_kFinishing (for modal handlers) */
|
||||
GHOST_TProgress progress;
|
||||
// Each component normally ranges from -1 to +1, but can exceed that.
|
||||
// These use blender standard view coordinates, with positive rotations being CCW about the axis.
|
||||
float tx, ty, tz; // translation
|
||||
float rx, ry, rz; // rotation:
|
||||
// axis = (rx,ry,rz).normalized
|
||||
// amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg]
|
||||
float dt; // time since previous NDOF Motion event
|
||||
GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers)
|
||||
} GHOST_TEventNDOFMotionData;
|
||||
|
||||
typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction;
|
||||
/* Good for mouse or other buttons too, hmmm? */
|
||||
// good for mouse or other buttons too, hmmm?
|
||||
|
||||
typedef struct {
|
||||
GHOST_TButtonAction action;
|
||||
@@ -568,7 +561,7 @@ typedef struct {
|
||||
*/
|
||||
/** The ascii code for the key event ('\0' if none). */
|
||||
char ascii;
|
||||
/** The unicode character. if the length is 6, not NULL terminated if all 6 are set. */
|
||||
/** The unicode character. if the length is 6, not NULL terminated if all 6 are set */
|
||||
char utf8_buf[6];
|
||||
|
||||
/** Generated by auto-repeat. */
|
||||
@@ -601,8 +594,7 @@ typedef void *GHOST_TEmbedderWindowID;
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef _WIN32
|
||||
/* I can't use "Window" from `X11/Xlib.h`
|
||||
* because it conflicts with Window defined in `winlay.h`. */
|
||||
// I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h
|
||||
typedef int GHOST_TEmbedderWindowID;
|
||||
#endif // _WIN32
|
||||
|
||||
@@ -650,10 +642,8 @@ typedef void *(*GHOST_XrGraphicsContextBindFn)(void);
|
||||
typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_ContextHandle graphics_context);
|
||||
typedef void (*GHOST_XrDrawViewFn)(const struct GHOST_XrDrawViewInfo *draw_view, void *customdata);
|
||||
|
||||
/**
|
||||
* An array of #GHOST_TXrGraphicsBinding items defining the candidate bindings to use.
|
||||
* The first available candidate will be chosen, so order defines priority.
|
||||
*/
|
||||
/* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings to use. The first
|
||||
* available candidate will be chosen, so order defines priority. */
|
||||
typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates;
|
||||
|
||||
typedef struct {
|
||||
@@ -694,7 +684,7 @@ typedef struct GHOST_XrDrawViewInfo {
|
||||
float angle_up, angle_down;
|
||||
} fov;
|
||||
|
||||
/** Set if the buffer should be submitted with a SRGB transfer applied. */
|
||||
/** Set if the buffer should be submitted with a srgb transfer applied. */
|
||||
char expects_srgb_buffer;
|
||||
} GHOST_XrDrawViewInfo;
|
||||
|
||||
@@ -744,7 +734,7 @@ typedef struct GHOST_XrActionSpaceInfo {
|
||||
typedef struct GHOST_XrActionBindingInfo {
|
||||
const char *action_name;
|
||||
GHOST_TUns32 count_interaction_paths;
|
||||
/** Interaction path: User (sub-action) path + component path. */
|
||||
/** Interaction path: User (subaction) path + component path. */
|
||||
const char **interaction_paths;
|
||||
} GHOST_XrActionBindingInfo;
|
||||
|
||||
|
@@ -149,9 +149,6 @@ static bool egl_chk(bool result, const char *file = NULL, int line = 0, const ch
|
||||
static_cast<unsigned int>(error),
|
||||
code ? code : "<Unknown>",
|
||||
msg ? msg : "<Unknown>");
|
||||
(void)(file);
|
||||
(void)(line);
|
||||
(void)(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -202,8 +199,7 @@ template<typename T> T &choose_api(EGLenum api, T &a, T &b, T &c)
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_ContextEGL::GHOST_ContextEGL(const GHOST_System *const system,
|
||||
bool stereoVisual,
|
||||
GHOST_ContextEGL::GHOST_ContextEGL(bool stereoVisual,
|
||||
EGLNativeWindowType nativeWindow,
|
||||
EGLNativeDisplayType nativeDisplay,
|
||||
EGLint contextProfileMask,
|
||||
@@ -213,7 +209,6 @@ GHOST_ContextEGL::GHOST_ContextEGL(const GHOST_System *const system,
|
||||
EGLint contextResetNotificationStrategy,
|
||||
EGLenum api)
|
||||
: GHOST_Context(stereoVisual),
|
||||
m_system(system),
|
||||
m_nativeDisplay(nativeDisplay),
|
||||
m_nativeWindow(nativeWindow),
|
||||
m_contextProfileMask(contextProfileMask),
|
||||
@@ -290,21 +285,6 @@ GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
EGLDisplay GHOST_ContextEGL::getDisplay() const
|
||||
{
|
||||
return m_display;
|
||||
}
|
||||
|
||||
EGLConfig GHOST_ContextEGL::getConfig() const
|
||||
{
|
||||
return m_config;
|
||||
}
|
||||
|
||||
EGLContext GHOST_ContextEGL::getContext() const
|
||||
{
|
||||
return m_context;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_ContextEGL::activateDrawingContext()
|
||||
{
|
||||
if (m_display) {
|
||||
@@ -476,7 +456,9 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
||||
|
||||
attrib_list.push_back(EGL_NONE);
|
||||
|
||||
if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &m_config, 1, &num_config)))
|
||||
EGLConfig config;
|
||||
|
||||
if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &config, 1, &num_config)))
|
||||
goto error;
|
||||
|
||||
// A common error is to assume that ChooseConfig worked because it returned EGL_TRUE
|
||||
@@ -484,7 +466,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
||||
goto error;
|
||||
|
||||
if (m_nativeWindow != 0) {
|
||||
m_surface = ::eglCreateWindowSurface(m_display, m_config, m_nativeWindow, NULL);
|
||||
m_surface = ::eglCreateWindowSurface(m_display, config, m_nativeWindow, NULL);
|
||||
}
|
||||
else {
|
||||
static const EGLint pb_attrib_list[] = {
|
||||
@@ -494,7 +476,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
||||
1,
|
||||
EGL_NONE,
|
||||
};
|
||||
m_surface = ::eglCreatePbufferSurface(m_display, m_config, pb_attrib_list);
|
||||
m_surface = ::eglCreatePbufferSurface(m_display, config, pb_attrib_list);
|
||||
}
|
||||
|
||||
if (!EGL_CHK(m_surface != EGL_NO_SURFACE))
|
||||
@@ -595,7 +577,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
||||
|
||||
attrib_list.push_back(EGL_NONE);
|
||||
|
||||
m_context = ::eglCreateContext(m_display, m_config, m_sharedContext, &(attrib_list[0]));
|
||||
m_context = ::eglCreateContext(m_display, config, m_sharedContext, &(attrib_list[0]));
|
||||
|
||||
if (!EGL_CHK(m_context != EGL_NO_CONTEXT))
|
||||
goto error;
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "GHOST_Context.h"
|
||||
#include "GHOST_System.h"
|
||||
|
||||
#include <GL/eglew.h>
|
||||
|
||||
@@ -37,15 +36,11 @@
|
||||
#endif
|
||||
|
||||
class GHOST_ContextEGL : public GHOST_Context {
|
||||
/* XR code needs low level graphics data to send to OpenXR. */
|
||||
friend class GHOST_XrGraphicsBindingOpenGL;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
GHOST_ContextEGL(const GHOST_System *const system,
|
||||
bool stereoVisual,
|
||||
GHOST_ContextEGL(bool stereoVisual,
|
||||
EGLNativeWindowType nativeWindow,
|
||||
EGLNativeDisplayType nativeDisplay,
|
||||
EGLint contextProfileMask,
|
||||
@@ -105,17 +100,9 @@ class GHOST_ContextEGL : public GHOST_Context {
|
||||
*/
|
||||
GHOST_TSuccess getSwapInterval(int &intervalOut);
|
||||
|
||||
EGLDisplay getDisplay() const;
|
||||
|
||||
EGLConfig getConfig() const;
|
||||
|
||||
EGLContext getContext() const;
|
||||
|
||||
private:
|
||||
bool initContextEGLEW();
|
||||
|
||||
const GHOST_System *const m_system;
|
||||
|
||||
EGLNativeDisplayType m_nativeDisplay;
|
||||
EGLNativeWindowType m_nativeWindow;
|
||||
|
||||
@@ -130,7 +117,6 @@ class GHOST_ContextEGL : public GHOST_Context {
|
||||
EGLContext m_context;
|
||||
EGLSurface m_surface;
|
||||
EGLDisplay m_display;
|
||||
EGLConfig m_config;
|
||||
|
||||
EGLint m_swap_interval;
|
||||
|
||||
|
@@ -160,7 +160,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
|
||||
else {
|
||||
/* this is a problem for the BGE player :S, perhaps SDL2 will resolve at some point.
|
||||
* we really need SDL_SetDisplayModeForDisplay() to become an API func! - campbell */
|
||||
printf("no windows available, can't fullscreen\n");
|
||||
printf("no windows available, cant fullscreen\n");
|
||||
|
||||
/* do not fail, we will try again later when the window is created - wander */
|
||||
return GHOST_kSuccess;
|
||||
|
@@ -31,17 +31,10 @@ class GHOST_IXrGraphicsBinding {
|
||||
public:
|
||||
union {
|
||||
#if defined(WITH_GHOST_X11)
|
||||
# if defined(WITH_GL_EGL)
|
||||
XrGraphicsBindingEGLMNDX egl;
|
||||
# else
|
||||
XrGraphicsBindingOpenGLXlibKHR glx;
|
||||
# endif
|
||||
#elif defined(WIN32)
|
||||
XrGraphicsBindingOpenGLWin32KHR wgl;
|
||||
XrGraphicsBindingD3D11KHR d3d11;
|
||||
#endif
|
||||
#if defined(WITH_GHOST_WAYLAND)
|
||||
XrGraphicsBindingOpenGLWaylandKHR wl;
|
||||
#endif
|
||||
} oxr_binding;
|
||||
|
||||
|
@@ -239,7 +239,7 @@ class GHOST_System : public GHOST_ISystem {
|
||||
* Set which tablet API to use. Only affects Windows, other platforms have a single API.
|
||||
* \param api: Enum indicating which API to use.
|
||||
*/
|
||||
virtual void setTabletAPI(GHOST_TTabletAPI api);
|
||||
void setTabletAPI(GHOST_TTabletAPI api);
|
||||
GHOST_TTabletAPI getTabletAPI(void);
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
|
@@ -32,7 +32,11 @@
|
||||
#include "GHOST_WindowCocoa.h"
|
||||
#include "GHOST_WindowManager.h"
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
# include "GHOST_ContextEGL.h"
|
||||
#else
|
||||
# include "GHOST_ContextCGL.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
# include "GHOST_NDOFManagerCocoa.h"
|
||||
@@ -86,8 +90,7 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
{
|
||||
// printf("\nrecvchar %c 0x%x",recvChar,recvChar);
|
||||
switch (rawCode) {
|
||||
/* Physical key-codes: (not used due to map changes in int'l keyboards). */
|
||||
#if 0
|
||||
/*Physical keycodes not used due to map changes in int'l keyboards
|
||||
case kVK_ANSI_A: return GHOST_kKeyA;
|
||||
case kVK_ANSI_B: return GHOST_kKeyB;
|
||||
case kVK_ANSI_C: return GHOST_kKeyC;
|
||||
@@ -113,9 +116,9 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
case kVK_ANSI_W: return GHOST_kKeyW;
|
||||
case kVK_ANSI_X: return GHOST_kKeyX;
|
||||
case kVK_ANSI_Y: return GHOST_kKeyY;
|
||||
case kVK_ANSI_Z: return GHOST_kKeyZ;
|
||||
#endif
|
||||
/* Numbers keys: mapped to handle some int'l keyboard (e.g. French). */
|
||||
case kVK_ANSI_Z: return GHOST_kKeyZ;*/
|
||||
|
||||
/* Numbers keys mapped to handle some int'l keyboard (e.g. French)*/
|
||||
case kVK_ISO_Section:
|
||||
return GHOST_kKeyUnknown;
|
||||
case kVK_ANSI_1:
|
||||
@@ -245,8 +248,8 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
return GHOST_kKeyUpPage;
|
||||
case kVK_PageDown:
|
||||
return GHOST_kKeyDownPage;
|
||||
#if 0 /* TODO: why are these commented? */
|
||||
case kVK_ANSI_Minus: return GHOST_kKeyMinus;
|
||||
|
||||
/*case kVK_ANSI_Minus: return GHOST_kKeyMinus;
|
||||
case kVK_ANSI_Equal: return GHOST_kKeyEqual;
|
||||
case kVK_ANSI_Comma: return GHOST_kKeyComma;
|
||||
case kVK_ANSI_Period: return GHOST_kKeyPeriod;
|
||||
@@ -256,15 +259,15 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
case kVK_ANSI_Backslash: return GHOST_kKeyBackslash;
|
||||
case kVK_ANSI_LeftBracket: return GHOST_kKeyLeftBracket;
|
||||
case kVK_ANSI_RightBracket: return GHOST_kKeyRightBracket;
|
||||
case kVK_ANSI_Grave: return GHOST_kKeyAccentGrave;
|
||||
#endif
|
||||
case kVK_ANSI_Grave: return GHOST_kKeyAccentGrave;*/
|
||||
|
||||
case kVK_VolumeUp:
|
||||
case kVK_VolumeDown:
|
||||
case kVK_Mute:
|
||||
return GHOST_kKeyUnknown;
|
||||
|
||||
default: {
|
||||
/* Alphanumerical or punctuation key that is remappable in int'l keyboards. */
|
||||
/* alphanumerical or punctuation key that is remappable in int'l keyboards */
|
||||
if ((recvChar >= 'A') && (recvChar <= 'Z')) {
|
||||
return (GHOST_TKey)(recvChar - 'A' + GHOST_kKeyA);
|
||||
}
|
||||
@@ -272,8 +275,8 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
return (GHOST_TKey)(recvChar - 'a' + GHOST_kKeyA);
|
||||
}
|
||||
else {
|
||||
/* Leopard and Snow Leopard 64bit compatible API. */
|
||||
CFDataRef uchrHandle; /* The keyboard layout. */
|
||||
/* Leopard and Snow Leopard 64bit compatible API*/
|
||||
CFDataRef uchrHandle; /*the keyboard layout*/
|
||||
TISInputSourceRef kbdTISHandle;
|
||||
|
||||
kbdTISHandle = TISCopyCurrentKeyboardLayoutInputSource();
|
||||
@@ -281,9 +284,9 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
|
||||
kTISPropertyUnicodeKeyLayoutData);
|
||||
CFRelease(kbdTISHandle);
|
||||
|
||||
/* Get actual character value of the "remappable" keys in int'l keyboards,
|
||||
* if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
|
||||
* then fallback on using the received #charactersIgnoringModifiers. */
|
||||
/*get actual character value of the "remappable" keys in int'l keyboards,
|
||||
if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
|
||||
then fallback on using the received charactersIgnoringModifiers */
|
||||
if (uchrHandle) {
|
||||
UInt32 deadKeyState = 0;
|
||||
UniCharCount actualStrLength = 0;
|
||||
@@ -434,10 +437,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG])
|
||||
// So WM_exit needs to be called directly, as the event loop will never run before termination
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
#if 0
|
||||
G.is_break = false; /* Let Cocoa perform the termination at the end. */
|
||||
WM_exit(C);
|
||||
#endif
|
||||
/*G.is_break = FALSE; //Let Cocoa perform the termination at the end
|
||||
WM_exit(C);*/
|
||||
}
|
||||
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
||||
@@ -552,12 +553,10 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
|
||||
// ProcessSerialNumber psn;
|
||||
|
||||
// Carbon stuff to move window & menu to foreground
|
||||
#if 0
|
||||
if (!GetCurrentProcess(&psn)) {
|
||||
/*if (!GetCurrentProcess(&psn)) {
|
||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||
SetFrontProcess(&psn);
|
||||
}
|
||||
#endif
|
||||
}*/
|
||||
|
||||
@autoreleasepool {
|
||||
[NSApplication sharedApplication]; // initializes NSApp
|
||||
@@ -1218,7 +1217,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
/* Get the bitmap of the image. */
|
||||
/*Get the bitmap of the image*/
|
||||
enumerator = [[droppedImg representations] objectEnumerator];
|
||||
while ((representation = [enumerator nextObject])) {
|
||||
if ([representation isKindOfClass:[NSBitmapImageRep class]]) {
|
||||
@@ -1231,7 +1230,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
|
||||
|
||||
if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) &&
|
||||
![bitmapImage isPlanar]) {
|
||||
/* Try a fast copy if the image is a meshed RGBA 32bit bitmap. */
|
||||
/* Try a fast copy if the image is a meshed RGBA 32bit bitmap*/
|
||||
toIBuf = (GHOST_TUns8 *)ibuf->rect;
|
||||
rasterRGB = (GHOST_TUns8 *)[bitmapImage bitmapData];
|
||||
for (y = 0; y < imgSize.height; y++) {
|
||||
@@ -1261,7 +1260,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bitmapFormat:(NSBitmapFormat)0
|
||||
bytesPerRow:4 * imgSize.width
|
||||
bitsPerPixel:32 /* RGB format padded to 32bits. */];
|
||||
bitsPerPixel:32 /*RGB format padded to 32bits*/];
|
||||
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[NSGraphicsContext
|
||||
@@ -1308,7 +1307,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
/* Copy the image to ibuf, flipping it vertically. */
|
||||
/*Copy the image to ibuf, flipping it vertically*/
|
||||
toIBuf = (GHOST_TUns8 *)ibuf->rect;
|
||||
for (y = 0; y < imgSize.height; y++) {
|
||||
for (x = 0; x < imgSize.width; x++) {
|
||||
|
@@ -376,7 +376,7 @@ void GHOST_SystemSDL::processEvent(SDL_Event *sdl_event)
|
||||
bounds.wrapPoint(x_new, y_new, 8, window->getCursorGrabAxis());
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
|
||||
// can't use setCursorPosition because the mouse may have no focus!
|
||||
// cant use setCursorPosition because the mouse may have no focus!
|
||||
if (x_new != x_root || y_new != y_root) {
|
||||
if (1) { //xme.time > m_last_warp) {
|
||||
/* when wrapping we don't need to add an event because the
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "GHOST_WaylandCursorSettings.h"
|
||||
#include <pointer-constraints-client-protocol.h>
|
||||
#include <relative-pointer-client-protocol.h>
|
||||
#include <wayland-cursor.h>
|
||||
@@ -53,6 +52,15 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
struct output_t {
|
||||
struct wl_output *output;
|
||||
int32_t width, height;
|
||||
int transform;
|
||||
int scale;
|
||||
std::string make;
|
||||
std::string model;
|
||||
};
|
||||
|
||||
struct buffer_t {
|
||||
void *data;
|
||||
size_t size;
|
||||
@@ -64,12 +72,6 @@ struct cursor_t {
|
||||
struct wl_buffer *buffer;
|
||||
struct wl_cursor_image image;
|
||||
struct buffer_t *file_buffer = nullptr;
|
||||
struct wl_cursor_theme *theme = nullptr;
|
||||
int size;
|
||||
std::string theme_name;
|
||||
// outputs on which the cursor is visible
|
||||
std::unordered_set<const output_t *> outputs;
|
||||
int scale = 1;
|
||||
};
|
||||
|
||||
struct data_offer_t {
|
||||
@@ -140,14 +142,10 @@ struct display_t {
|
||||
struct wl_display *display;
|
||||
struct wl_compositor *compositor = nullptr;
|
||||
struct xdg_wm_base *xdg_shell = nullptr;
|
||||
struct zxdg_decoration_manager_v1 *xdg_decoration_manager = nullptr;
|
||||
struct wl_shm *shm = nullptr;
|
||||
std::vector<output_t *> outputs;
|
||||
std::vector<input_t *> inputs;
|
||||
struct {
|
||||
std::string theme;
|
||||
int size;
|
||||
} cursor;
|
||||
struct wl_cursor_theme *cursor_theme = nullptr;
|
||||
struct wl_data_device_manager *data_device_manager = nullptr;
|
||||
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager = nullptr;
|
||||
struct zwp_pointer_constraints_v1 *pointer_constraints = nullptr;
|
||||
@@ -156,8 +154,6 @@ struct display_t {
|
||||
std::vector<struct wl_egl_window *> os_egl_windows;
|
||||
};
|
||||
|
||||
static GHOST_WindowManager *window_manager = nullptr;
|
||||
|
||||
static void display_destroy(display_t *d)
|
||||
{
|
||||
if (d->data_device_manager) {
|
||||
@@ -192,9 +188,6 @@ static void display_destroy(display_t *d)
|
||||
if (input->cursor.surface) {
|
||||
wl_surface_destroy(input->cursor.surface);
|
||||
}
|
||||
if (input->cursor.theme) {
|
||||
wl_cursor_theme_destroy(input->cursor.theme);
|
||||
}
|
||||
if (input->pointer) {
|
||||
wl_pointer_destroy(input->pointer);
|
||||
}
|
||||
@@ -217,6 +210,10 @@ static void display_destroy(display_t *d)
|
||||
delete input;
|
||||
}
|
||||
|
||||
if (d->cursor_theme) {
|
||||
wl_cursor_theme_destroy(d->cursor_theme);
|
||||
}
|
||||
|
||||
if (d->shm) {
|
||||
wl_shm_destroy(d->shm);
|
||||
}
|
||||
@@ -241,10 +238,6 @@ static void display_destroy(display_t *d)
|
||||
wl_compositor_destroy(d->compositor);
|
||||
}
|
||||
|
||||
if (d->xdg_decoration_manager) {
|
||||
zxdg_decoration_manager_v1_destroy(d->xdg_decoration_manager);
|
||||
}
|
||||
|
||||
if (d->xdg_shell) {
|
||||
xdg_wm_base_destroy(d->xdg_shell);
|
||||
}
|
||||
@@ -485,9 +478,7 @@ static void dnd_events(const input_t *const input, const GHOST_TEventType event)
|
||||
static std::string read_pipe(data_offer_t *data_offer, const std::string mime_receive)
|
||||
{
|
||||
int pipefd[2];
|
||||
if (pipe(pipefd) != 0) {
|
||||
return {};
|
||||
}
|
||||
pipe(pipefd);
|
||||
wl_data_offer_receive(data_offer->id, mime_receive.c_str(), pipefd[1]);
|
||||
close(pipefd[1]);
|
||||
|
||||
@@ -522,9 +513,7 @@ static void data_source_send(void *data,
|
||||
int32_t fd)
|
||||
{
|
||||
const char *const buffer = static_cast<char *>(data);
|
||||
if (write(fd, buffer, strlen(buffer) + 1) < 0) {
|
||||
GHOST_PRINT("error writing to clipboard: " << std::strerror(errno) << std::endl);
|
||||
}
|
||||
write(fd, buffer, strlen(buffer) + 1);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@@ -800,80 +789,13 @@ static void cursor_buffer_release(void *data, struct wl_buffer *wl_buffer)
|
||||
cursor_t *cursor = static_cast<cursor_t *>(data);
|
||||
|
||||
wl_buffer_destroy(wl_buffer);
|
||||
|
||||
if (wl_buffer == cursor->buffer) {
|
||||
/* the mapped buffer was from a custom cursor */
|
||||
cursor->buffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const struct wl_buffer_listener cursor_buffer_listener = {
|
||||
cursor_buffer_release,
|
||||
};
|
||||
|
||||
static GHOST_IWindow *get_window(struct wl_surface *surface)
|
||||
{
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (GHOST_IWindow *win : window_manager->getWindows()) {
|
||||
if (surface == static_cast<const GHOST_WindowWayland *>(win)->surface()) {
|
||||
return win;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool update_cursor_scale(cursor_t &cursor, wl_shm *shm)
|
||||
{
|
||||
int scale = 0;
|
||||
for (const output_t *output : cursor.outputs) {
|
||||
if (output->scale > scale)
|
||||
scale = output->scale;
|
||||
}
|
||||
|
||||
if (scale > 0 && cursor.scale != scale) {
|
||||
cursor.scale = scale;
|
||||
wl_surface_set_buffer_scale(cursor.surface, scale);
|
||||
wl_cursor_theme_destroy(cursor.theme);
|
||||
cursor.theme = wl_cursor_theme_load(cursor.theme_name.c_str(), scale * cursor.size, shm);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void cursor_surface_enter(void *data,
|
||||
struct wl_surface * /*wl_surface*/,
|
||||
struct wl_output *output)
|
||||
{
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
for (const output_t *reg_output : input->system->outputs()) {
|
||||
if (reg_output->output == output) {
|
||||
input->cursor.outputs.insert(reg_output);
|
||||
}
|
||||
}
|
||||
update_cursor_scale(input->cursor, input->system->shm());
|
||||
}
|
||||
|
||||
static void cursor_surface_leave(void *data,
|
||||
struct wl_surface * /*wl_surface*/,
|
||||
struct wl_output *output)
|
||||
{
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
for (const output_t *reg_output : input->system->outputs()) {
|
||||
if (reg_output->output == output) {
|
||||
input->cursor.outputs.erase(reg_output);
|
||||
}
|
||||
}
|
||||
update_cursor_scale(input->cursor, input->system->shm());
|
||||
}
|
||||
|
||||
struct wl_surface_listener cursor_surface_listener = {
|
||||
cursor_surface_enter,
|
||||
cursor_surface_leave,
|
||||
};
|
||||
|
||||
static void pointer_enter(void *data,
|
||||
struct wl_pointer * /*wl_pointer*/,
|
||||
uint32_t serial,
|
||||
@@ -881,25 +803,19 @@ static void pointer_enter(void *data,
|
||||
wl_fixed_t surface_x,
|
||||
wl_fixed_t surface_y)
|
||||
{
|
||||
GHOST_WindowWayland *win = static_cast<GHOST_WindowWayland *>(get_window(surface));
|
||||
|
||||
if (!win) {
|
||||
if (!surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
win->activate();
|
||||
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
input->pointer_serial = serial;
|
||||
input->x = win->scale() * wl_fixed_to_int(surface_x);
|
||||
input->y = win->scale() * wl_fixed_to_int(surface_y);
|
||||
input->x = wl_fixed_to_int(surface_x);
|
||||
input->y = wl_fixed_to_int(surface_y);
|
||||
input->focus_pointer = surface;
|
||||
|
||||
win->setCursorShape(win->getCursorShape());
|
||||
|
||||
input->system->pushEvent(new GHOST_EventCursor(input->system->getMilliSeconds(),
|
||||
input->system->pushEvent(
|
||||
new GHOST_EventCursor(input->system->getMilliSeconds(),
|
||||
GHOST_kEventCursorMove,
|
||||
static_cast<GHOST_WindowWayland *>(win),
|
||||
static_cast<GHOST_WindowWayland *>(wl_surface_get_user_data(surface)),
|
||||
input->x,
|
||||
input->y,
|
||||
GHOST_TABLET_DATA_NONE));
|
||||
@@ -910,14 +826,9 @@ static void pointer_leave(void *data,
|
||||
uint32_t /*serial*/,
|
||||
struct wl_surface *surface)
|
||||
{
|
||||
GHOST_IWindow *win = get_window(surface);
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (surface != nullptr) {
|
||||
static_cast<input_t *>(data)->focus_pointer = nullptr;
|
||||
static_cast<GHOST_WindowWayland *>(win)->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
static void pointer_motion(void *data,
|
||||
@@ -928,20 +839,21 @@ static void pointer_motion(void *data,
|
||||
{
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
|
||||
GHOST_WindowWayland *win = static_cast<GHOST_WindowWayland *>(get_window(input->focus_pointer));
|
||||
GHOST_IWindow *win = static_cast<GHOST_WindowWayland *>(
|
||||
wl_surface_get_user_data(input->focus_pointer));
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
input->x = win->scale() * wl_fixed_to_int(surface_x);
|
||||
input->y = win->scale() * wl_fixed_to_int(surface_y);
|
||||
input->x = wl_fixed_to_int(surface_x);
|
||||
input->y = wl_fixed_to_int(surface_y);
|
||||
|
||||
input->system->pushEvent(new GHOST_EventCursor(input->system->getMilliSeconds(),
|
||||
GHOST_kEventCursorMove,
|
||||
win,
|
||||
input->x,
|
||||
input->y,
|
||||
wl_fixed_to_int(surface_x),
|
||||
wl_fixed_to_int(surface_y),
|
||||
GHOST_TABLET_DATA_NONE));
|
||||
}
|
||||
|
||||
@@ -952,14 +864,6 @@ static void pointer_button(void *data,
|
||||
uint32_t button,
|
||||
uint32_t state)
|
||||
{
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
|
||||
GHOST_IWindow *win = get_window(input->focus_pointer);
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
GHOST_TEventType etype = GHOST_kEventUnknown;
|
||||
switch (state) {
|
||||
case WL_POINTER_BUTTON_STATE_RELEASED:
|
||||
@@ -983,6 +887,9 @@ static void pointer_button(void *data,
|
||||
break;
|
||||
}
|
||||
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
GHOST_IWindow *win = static_cast<GHOST_WindowWayland *>(
|
||||
wl_surface_get_user_data(input->focus_pointer));
|
||||
input->data_source->source_serial = serial;
|
||||
input->buttons.set(ebutton, state == WL_POINTER_BUTTON_STATE_PRESSED);
|
||||
input->system->pushEvent(new GHOST_EventButton(
|
||||
@@ -995,18 +902,12 @@ static void pointer_axis(void *data,
|
||||
uint32_t axis,
|
||||
wl_fixed_t value)
|
||||
{
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
|
||||
GHOST_IWindow *win = get_window(input->focus_pointer);
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (axis != WL_POINTER_AXIS_VERTICAL_SCROLL) {
|
||||
return;
|
||||
}
|
||||
|
||||
input_t *input = static_cast<input_t *>(data);
|
||||
GHOST_IWindow *win = static_cast<GHOST_WindowWayland *>(
|
||||
wl_surface_get_user_data(input->focus_pointer));
|
||||
input->system->pushEvent(
|
||||
new GHOST_EventWheel(input->system->getMilliSeconds(), win, std::signbit(value) ? +1 : -1));
|
||||
}
|
||||
@@ -1236,12 +1137,7 @@ static void seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capa
|
||||
input->cursor.visible = true;
|
||||
input->cursor.buffer = nullptr;
|
||||
input->cursor.file_buffer = new buffer_t;
|
||||
if (!get_cursor_settings(input->cursor.theme_name, input->cursor.size)) {
|
||||
input->cursor.theme_name = std::string();
|
||||
input->cursor.size = default_cursor_size;
|
||||
}
|
||||
wl_pointer_add_listener(input->pointer, &pointer_listener, data);
|
||||
wl_surface_add_listener(input->cursor.surface, &cursor_surface_listener, data);
|
||||
}
|
||||
|
||||
if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) {
|
||||
@@ -1264,8 +1160,8 @@ static void output_geometry(void *data,
|
||||
struct wl_output * /*wl_output*/,
|
||||
int32_t /*x*/,
|
||||
int32_t /*y*/,
|
||||
int32_t physical_width,
|
||||
int32_t physical_height,
|
||||
int32_t /*physical_width*/,
|
||||
int32_t /*physical_height*/,
|
||||
int32_t /*subpixel*/,
|
||||
const char *make,
|
||||
const char *model,
|
||||
@@ -1275,8 +1171,6 @@ static void output_geometry(void *data,
|
||||
output->transform = transform;
|
||||
output->make = std::string(make);
|
||||
output->model = std::string(model);
|
||||
output->width_mm = physical_width;
|
||||
output->height_mm = physical_height;
|
||||
}
|
||||
|
||||
static void output_mode(void *data,
|
||||
@@ -1287,8 +1181,8 @@ static void output_mode(void *data,
|
||||
int32_t /*refresh*/)
|
||||
{
|
||||
output_t *output = static_cast<output_t *>(data);
|
||||
output->width_pxl = width;
|
||||
output->height_pxl = height;
|
||||
output->width = width;
|
||||
output->height = height;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1333,17 +1227,13 @@ static void global_add(void *data,
|
||||
struct display_t *display = static_cast<struct display_t *>(data);
|
||||
if (!strcmp(interface, wl_compositor_interface.name)) {
|
||||
display->compositor = static_cast<wl_compositor *>(
|
||||
wl_registry_bind(wl_registry, name, &wl_compositor_interface, 3));
|
||||
wl_registry_bind(wl_registry, name, &wl_compositor_interface, 1));
|
||||
}
|
||||
else if (!strcmp(interface, xdg_wm_base_interface.name)) {
|
||||
display->xdg_shell = static_cast<xdg_wm_base *>(
|
||||
wl_registry_bind(wl_registry, name, &xdg_wm_base_interface, 1));
|
||||
xdg_wm_base_add_listener(display->xdg_shell, &shell_listener, nullptr);
|
||||
}
|
||||
else if (!strcmp(interface, zxdg_decoration_manager_v1_interface.name)) {
|
||||
display->xdg_decoration_manager = static_cast<zxdg_decoration_manager_v1 *>(
|
||||
wl_registry_bind(wl_registry, name, &zxdg_decoration_manager_v1_interface, 1));
|
||||
}
|
||||
else if (!strcmp(interface, wl_output_interface.name)) {
|
||||
output_t *output = new output_t;
|
||||
output->scale = 1;
|
||||
@@ -1445,6 +1335,16 @@ GHOST_SystemWayland::GHOST_SystemWayland() : GHOST_System(), d(new display_t)
|
||||
wl_data_device_add_listener(input->data_device, &data_device_listener, input);
|
||||
}
|
||||
}
|
||||
|
||||
const char *theme = std::getenv("XCURSOR_THEME");
|
||||
const char *size = std::getenv("XCURSOR_SIZE");
|
||||
const int sizei = size ? std::stoi(size) : default_cursor_size;
|
||||
|
||||
d->cursor_theme = wl_cursor_theme_load(theme, sizei, d->shm);
|
||||
if (!d->cursor_theme) {
|
||||
display_destroy(d);
|
||||
throw std::runtime_error("Wayland: unable to access cursor themes!");
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_SystemWayland::~GHOST_SystemWayland()
|
||||
@@ -1571,8 +1471,8 @@ void GHOST_SystemWayland::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TU
|
||||
{
|
||||
if (getNumDisplays() > 0) {
|
||||
/* We assume first output as main. */
|
||||
width = uint32_t(d->outputs[0]->width_pxl) / d->outputs[0]->scale;
|
||||
height = uint32_t(d->outputs[0]->height_pxl) / d->outputs[0]->scale;
|
||||
width = uint32_t(d->outputs[0]->width);
|
||||
height = uint32_t(d->outputs[0]->height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1581,7 +1481,7 @@ void GHOST_SystemWayland::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUn
|
||||
getMainDisplayDimensions(width, height);
|
||||
}
|
||||
|
||||
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*glSettings*/)
|
||||
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings glSettings)
|
||||
{
|
||||
/* Create new off-screen window. */
|
||||
wl_surface *os_surface = wl_compositor_create_surface(compositor());
|
||||
@@ -1590,28 +1490,7 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*g
|
||||
d->os_surfaces.push_back(os_surface);
|
||||
d->os_egl_windows.push_back(os_egl_window);
|
||||
|
||||
GHOST_Context *context;
|
||||
|
||||
for (int minor = 6; minor >= 0; --minor) {
|
||||
context = new GHOST_ContextEGL(this,
|
||||
false,
|
||||
EGLNativeWindowType(os_egl_window),
|
||||
EGLNativeDisplayType(d->display),
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||
4,
|
||||
minor,
|
||||
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
|
||||
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
|
||||
EGL_OPENGL_API);
|
||||
|
||||
if (context->initializeDrawingContext())
|
||||
return context;
|
||||
else
|
||||
delete context;
|
||||
}
|
||||
|
||||
context = new GHOST_ContextEGL(this,
|
||||
false,
|
||||
GHOST_Context *context = new GHOST_ContextEGL(false,
|
||||
EGLNativeWindowType(os_egl_window),
|
||||
EGLNativeDisplayType(d->display),
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||
@@ -1651,11 +1530,6 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title,
|
||||
const bool is_dialog,
|
||||
const GHOST_IWindow *parentWindow)
|
||||
{
|
||||
/* globally store pointer to window manager */
|
||||
if (!window_manager) {
|
||||
window_manager = getWindowManager();
|
||||
}
|
||||
|
||||
GHOST_WindowWayland *window = new GHOST_WindowWayland(
|
||||
this,
|
||||
title,
|
||||
@@ -1700,21 +1574,6 @@ xdg_wm_base *GHOST_SystemWayland::shell()
|
||||
return d->xdg_shell;
|
||||
}
|
||||
|
||||
zxdg_decoration_manager_v1 *GHOST_SystemWayland::decoration_manager()
|
||||
{
|
||||
return d->xdg_decoration_manager;
|
||||
}
|
||||
|
||||
const std::vector<output_t *> &GHOST_SystemWayland::outputs() const
|
||||
{
|
||||
return d->outputs;
|
||||
}
|
||||
|
||||
wl_shm *GHOST_SystemWayland::shm() const
|
||||
{
|
||||
return d->shm;
|
||||
}
|
||||
|
||||
void GHOST_SystemWayland::setSelection(const std::string &selection)
|
||||
{
|
||||
this->selection = selection;
|
||||
@@ -1722,20 +1581,23 @@ void GHOST_SystemWayland::setSelection(const std::string &selection)
|
||||
|
||||
static void set_cursor_buffer(input_t *input, wl_buffer *buffer)
|
||||
{
|
||||
cursor_t *c = &input->cursor;
|
||||
input->cursor.visible = (buffer != nullptr);
|
||||
|
||||
c->visible = (buffer != nullptr);
|
||||
wl_surface_attach(input->cursor.surface, buffer, 0, 0);
|
||||
wl_surface_commit(input->cursor.surface);
|
||||
|
||||
wl_surface_attach(c->surface, buffer, 0, 0);
|
||||
|
||||
wl_surface_damage(c->surface, 0, 0, int32_t(c->image.width), int32_t(c->image.height));
|
||||
if (input->cursor.visible) {
|
||||
wl_surface_damage(input->cursor.surface,
|
||||
0,
|
||||
0,
|
||||
int32_t(input->cursor.image.width),
|
||||
int32_t(input->cursor.image.height));
|
||||
wl_pointer_set_cursor(input->pointer,
|
||||
input->pointer_serial,
|
||||
c->visible ? c->surface : nullptr,
|
||||
int32_t(c->image.hotspot_x) / c->scale,
|
||||
int32_t(c->image.hotspot_y) / c->scale);
|
||||
|
||||
wl_surface_commit(c->surface);
|
||||
input->cursor.surface,
|
||||
int32_t(input->cursor.image.hotspot_x),
|
||||
int32_t(input->cursor.image.hotspot_y));
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemWayland::setCursorShape(GHOST_TStandardCursor shape)
|
||||
@@ -1746,15 +1608,7 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorShape(GHOST_TStandardCursor shape)
|
||||
const std::string cursor_name = cursors.count(shape) ? cursors.at(shape) :
|
||||
cursors.at(GHOST_kStandardCursorDefault);
|
||||
|
||||
input_t *input = d->inputs[0];
|
||||
cursor_t *c = &input->cursor;
|
||||
|
||||
if (!c->theme) {
|
||||
/* The cursor surface hasn't entered an output yet. Initialize theme with scale 1. */
|
||||
c->theme = wl_cursor_theme_load(c->theme_name.c_str(), c->size, d->inputs[0]->system->shm());
|
||||
}
|
||||
|
||||
wl_cursor *cursor = wl_cursor_theme_get_cursor(c->theme, cursor_name.c_str());
|
||||
wl_cursor *cursor = wl_cursor_theme_get_cursor(d->cursor_theme, cursor_name.c_str());
|
||||
|
||||
if (!cursor) {
|
||||
GHOST_PRINT("cursor '" << cursor_name << "' does not exist" << std::endl);
|
||||
@@ -1766,11 +1620,11 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorShape(GHOST_TStandardCursor shape)
|
||||
if (!buffer) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
cursor_t *c = &d->inputs[0]->cursor;
|
||||
c->buffer = buffer;
|
||||
c->image = *image;
|
||||
|
||||
set_cursor_buffer(input, buffer);
|
||||
set_cursor_buffer(d->inputs[0], buffer);
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
@@ -1881,11 +1735,6 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorVisibility(bool visible)
|
||||
GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const GHOST_TGrabCursorMode mode,
|
||||
wl_surface *surface)
|
||||
{
|
||||
/* ignore, if the required protocols are not supported */
|
||||
if (!d->relative_pointer_manager || !d->pointer_constraints) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
if (d->inputs.empty()) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
@@ -1905,7 +1754,6 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorGrab(const GHOST_TGrabCursorMode mo
|
||||
break;
|
||||
|
||||
case GHOST_kGrabNormal:
|
||||
break;
|
||||
case GHOST_kGrabWrap:
|
||||
input->relative_pointer = zwp_relative_pointer_manager_v1_get_relative_pointer(
|
||||
d->relative_pointer_manager, input->pointer);
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "GHOST_WindowWayland.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include <xdg-decoration-client-protocol.h>
|
||||
#include <xdg-shell-client-protocol.h>
|
||||
|
||||
#include <string>
|
||||
@@ -35,16 +34,6 @@ class GHOST_WindowWayland;
|
||||
|
||||
struct display_t;
|
||||
|
||||
struct output_t {
|
||||
struct wl_output *output;
|
||||
int32_t width_pxl, height_pxl; // dimensions in pixel
|
||||
int32_t width_mm, height_mm; // dimensions in millimeter
|
||||
int transform;
|
||||
int scale;
|
||||
std::string make;
|
||||
std::string model;
|
||||
};
|
||||
|
||||
class GHOST_SystemWayland : public GHOST_System {
|
||||
public:
|
||||
GHOST_SystemWayland();
|
||||
@@ -95,12 +84,6 @@ class GHOST_SystemWayland : public GHOST_System {
|
||||
|
||||
xdg_wm_base *shell();
|
||||
|
||||
zxdg_decoration_manager_v1 *decoration_manager();
|
||||
|
||||
const std::vector<output_t *> &outputs() const;
|
||||
|
||||
wl_shm *shm() const;
|
||||
|
||||
void setSelection(const std::string &selection);
|
||||
|
||||
GHOST_TSuccess setCursorShape(GHOST_TStandardCursor shape);
|
||||
|
@@ -50,7 +50,11 @@
|
||||
#include "GHOST_WindowManager.h"
|
||||
#include "GHOST_WindowWin32.h"
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
# include "GHOST_ContextEGL.h"
|
||||
#else
|
||||
# include "GHOST_ContextWGL.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
# include "GHOST_NDOFManagerWin32.h"
|
||||
@@ -135,6 +139,7 @@ static void initRawInput()
|
||||
#undef DEVICE_COUNT
|
||||
}
|
||||
|
||||
typedef HRESULT(API *GHOST_WIN32_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
|
||||
typedef BOOL(API *GHOST_WIN32_EnableNonClientDpiScaling)(HWND);
|
||||
|
||||
GHOST_SystemWin32::GHOST_SystemWin32()
|
||||
@@ -862,159 +867,23 @@ GHOST_EventButton *GHOST_SystemWin32::processButtonEvent(GHOST_TEventType type,
|
||||
{
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
|
||||
GHOST_TabletData td = window->getTabletData();
|
||||
|
||||
/* Move mouse to button event position. */
|
||||
if (window->getTabletData().Active != GHOST_kTabletModeNone) {
|
||||
/* Tablet should be handling in between mouse moves, only move to event position. */
|
||||
DWORD msgPos = ::GetMessagePos();
|
||||
int msgPosX = GET_X_LPARAM(msgPos);
|
||||
int msgPosY = GET_Y_LPARAM(msgPos);
|
||||
system->pushEvent(new GHOST_EventCursor(
|
||||
::GetMessageTime(), GHOST_kEventCursorMove, window, msgPosX, msgPosY, td));
|
||||
}
|
||||
|
||||
window->updateMouseCapture(type == GHOST_kEventButtonDown ? MousePressed : MouseReleased);
|
||||
return new GHOST_EventButton(system->getMilliSeconds(), type, window, mask, td);
|
||||
}
|
||||
|
||||
void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
|
||||
{
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (!wt) {
|
||||
return;
|
||||
}
|
||||
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
|
||||
std::vector<GHOST_WintabInfoWin32> wintabInfo;
|
||||
wt->getInput(wintabInfo);
|
||||
|
||||
/* Wintab provided coordinates are untrusted until a Wintab and Win32 button down event match.
|
||||
* This is checked on every button down event, and revoked if there is a mismatch. This can
|
||||
* happen when Wintab incorrectly scales cursor position or is in mouse mode.
|
||||
*
|
||||
* If Wintab was never trusted while processing this Win32 event, a fallback Ghost cursor move
|
||||
* event is created at the position of the Win32 WT_PACKET event. */
|
||||
bool mouseMoveHandled;
|
||||
bool useWintabPos;
|
||||
mouseMoveHandled = useWintabPos = wt->trustCoordinates();
|
||||
|
||||
for (GHOST_WintabInfoWin32 &info : wintabInfo) {
|
||||
switch (info.type) {
|
||||
case GHOST_kEventCursorMove: {
|
||||
if (!useWintabPos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wt->mapWintabToSysCoordinates(info.x, info.y, info.x, info.y);
|
||||
system->pushEvent(new GHOST_EventCursor(
|
||||
info.time, GHOST_kEventCursorMove, window, info.x, info.y, info.tabletData));
|
||||
|
||||
break;
|
||||
}
|
||||
case GHOST_kEventButtonDown: {
|
||||
UINT message;
|
||||
switch (info.button) {
|
||||
case GHOST_kButtonMaskLeft:
|
||||
message = WM_LBUTTONDOWN;
|
||||
break;
|
||||
case GHOST_kButtonMaskRight:
|
||||
message = WM_RBUTTONDOWN;
|
||||
break;
|
||||
case GHOST_kButtonMaskMiddle:
|
||||
message = WM_MBUTTONDOWN;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Wintab buttons are modal, but the API does not inform us what mode a pressed button is
|
||||
* in. Only issue button events if we can steal an equivalent Win32 button event from the
|
||||
* event queue. */
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, window->getHWND(), message, message, PM_NOYIELD) &&
|
||||
msg.message != WM_QUIT) {
|
||||
|
||||
/* Test for Win32/Wintab button down match. */
|
||||
useWintabPos = wt->testCoordinates(msg.pt.x, msg.pt.y, info.x, info.y);
|
||||
if (!useWintabPos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Steal the Win32 event which was previously peeked. */
|
||||
PeekMessage(&msg, window->getHWND(), message, message, PM_REMOVE | PM_NOYIELD);
|
||||
|
||||
/* Move cursor to button location, to prevent incorrect cursor position when
|
||||
* transitioning from unsynchronized Win32 to Wintab cursor control. */
|
||||
wt->mapWintabToSysCoordinates(info.x, info.y, info.x, info.y);
|
||||
system->pushEvent(new GHOST_EventCursor(
|
||||
info.time, GHOST_kEventCursorMove, window, info.x, info.y, info.tabletData));
|
||||
|
||||
if (type == GHOST_kEventButtonDown) {
|
||||
window->updateMouseCapture(MousePressed);
|
||||
system->pushEvent(
|
||||
new GHOST_EventButton(info.time, info.type, window, info.button, info.tabletData));
|
||||
|
||||
mouseMoveHandled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case GHOST_kEventButtonUp: {
|
||||
if (!useWintabPos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
UINT message;
|
||||
switch (info.button) {
|
||||
case GHOST_kButtonMaskLeft:
|
||||
message = WM_LBUTTONUP;
|
||||
break;
|
||||
case GHOST_kButtonMaskRight:
|
||||
message = WM_RBUTTONUP;
|
||||
break;
|
||||
case GHOST_kButtonMaskMiddle:
|
||||
message = WM_MBUTTONUP;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Wintab buttons are modal, but the API does not inform us what mode a pressed button is
|
||||
* in. Only issue button events if we can steal an equivalent Win32 button event from the
|
||||
* event queue. */
|
||||
MSG msg;
|
||||
if (PeekMessage(&msg, window->getHWND(), message, message, PM_REMOVE | PM_NOYIELD) &&
|
||||
msg.message != WM_QUIT) {
|
||||
|
||||
else if (type == GHOST_kEventButtonUp) {
|
||||
window->updateMouseCapture(MouseReleased);
|
||||
system->pushEvent(
|
||||
new GHOST_EventButton(info.time, info.type, window, info.button, info.tabletData));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback cursor movement if Wintab position were never trusted while processing this event. */
|
||||
if (!mouseMoveHandled) {
|
||||
DWORD pos = GetMessagePos();
|
||||
int x = GET_X_LPARAM(pos);
|
||||
int y = GET_Y_LPARAM(pos);
|
||||
|
||||
/* TODO supply tablet data */
|
||||
system->pushEvent(new GHOST_EventCursor(
|
||||
system->getMilliSeconds(), GHOST_kEventCursorMove, window, x, y, GHOST_TABLET_DATA_NONE));
|
||||
}
|
||||
return new GHOST_EventButton(
|
||||
system->getMilliSeconds(), type, window, mask, window->getTabletData());
|
||||
}
|
||||
|
||||
void GHOST_SystemWin32::processPointerEvent(
|
||||
UINT type, GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam, bool &eventHandled)
|
||||
{
|
||||
/* Pointer events might fire when changing windows for a device which is set to use Wintab,
|
||||
* even when Wintab is left enabled but set to the bottom of Wintab overlap order. */
|
||||
if (!window->usingTabletAPI(GHOST_kTabletWinPointer)) {
|
||||
/* Pointer events might fire when changing windows for a device which is set to use Wintab, even
|
||||
* when when Wintab is left enabled but set to the bottom of Wintab overlap order. */
|
||||
if (!window->useTabletAPI(GHOST_kTabletNative)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1025,21 +894,20 @@ void GHOST_SystemWin32::processPointerEvent(
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case WM_POINTERUPDATE:
|
||||
/* Coalesced pointer events are reverse chronological order, reorder chronologically.
|
||||
* Only contiguous move events are coalesced. */
|
||||
for (GHOST_TUns32 i = pointerInfo.size(); i-- > 0;) {
|
||||
system->pushEvent(new GHOST_EventCursor(pointerInfo[i].time,
|
||||
GHOST_kEventCursorMove,
|
||||
window,
|
||||
pointerInfo[i].pixelLocation.x,
|
||||
pointerInfo[i].pixelLocation.y,
|
||||
pointerInfo[i].tabletData));
|
||||
if (!pointerInfo[0].isPrimary) {
|
||||
eventHandled = true;
|
||||
return; // For multi-touch displays we ignore these events
|
||||
}
|
||||
|
||||
/* Leave event unhandled so that system cursor is moved. */
|
||||
|
||||
switch (type) {
|
||||
case WM_POINTERENTER:
|
||||
window->m_tabletInRange = true;
|
||||
system->pushEvent(new GHOST_EventCursor(pointerInfo[0].time,
|
||||
GHOST_kEventCursorMove,
|
||||
window,
|
||||
pointerInfo[0].pixelLocation.x,
|
||||
pointerInfo[0].pixelLocation.y,
|
||||
pointerInfo[0].tabletData));
|
||||
break;
|
||||
case WM_POINTERDOWN:
|
||||
/* Move cursor to point of contact because GHOST_EventButton does not include position. */
|
||||
@@ -1055,10 +923,18 @@ void GHOST_SystemWin32::processPointerEvent(
|
||||
pointerInfo[0].buttonMask,
|
||||
pointerInfo[0].tabletData));
|
||||
window->updateMouseCapture(MousePressed);
|
||||
|
||||
/* Mark event handled so that mouse button events are not generated. */
|
||||
eventHandled = true;
|
||||
|
||||
break;
|
||||
case WM_POINTERUPDATE:
|
||||
/* Coalesced pointer events are reverse chronological order, reorder chronologically.
|
||||
* Only contiguous move events are coalesced. */
|
||||
for (GHOST_TUns32 i = pointerInfo.size(); i-- > 0;) {
|
||||
system->pushEvent(new GHOST_EventCursor(pointerInfo[i].time,
|
||||
GHOST_kEventCursorMove,
|
||||
window,
|
||||
pointerInfo[i].pixelLocation.x,
|
||||
pointerInfo[i].pixelLocation.y,
|
||||
pointerInfo[i].tabletData));
|
||||
}
|
||||
break;
|
||||
case WM_POINTERUP:
|
||||
system->pushEvent(new GHOST_EventButton(pointerInfo[0].time,
|
||||
@@ -1067,14 +943,16 @@ void GHOST_SystemWin32::processPointerEvent(
|
||||
pointerInfo[0].buttonMask,
|
||||
pointerInfo[0].tabletData));
|
||||
window->updateMouseCapture(MouseReleased);
|
||||
|
||||
/* Mark event handled so that mouse button events are not generated. */
|
||||
eventHandled = true;
|
||||
|
||||
break;
|
||||
case WM_POINTERLEAVE:
|
||||
window->m_tabletInRange = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
eventHandled = true;
|
||||
system->setCursorPosition(pointerInfo[0].pixelLocation.x, pointerInfo[0].pixelLocation.y);
|
||||
}
|
||||
|
||||
GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *window)
|
||||
@@ -1082,14 +960,18 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
||||
GHOST_TInt32 x_screen, y_screen;
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
|
||||
if (window->getTabletData().Active != GHOST_kTabletModeNone) {
|
||||
/* While pen devices are in range, cursor movement is handled by tablet input processing. */
|
||||
if (window->m_tabletInRange) {
|
||||
if (window->useTabletAPI(GHOST_kTabletNative)) {
|
||||
/* Tablet input handled in WM_POINTER* events. WM_MOUSEMOVE events in response to tablet
|
||||
* input aren't normally generated when using WM_POINTER events, but manually moving the
|
||||
* system cursor as we do in WM_POINTER handling does. */
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
system->getCursorPosition(x_screen, y_screen);
|
||||
|
||||
if (window->getCursorGrabModeIsWarp()) {
|
||||
if (window->getCursorGrabModeIsWarp() && !window->m_tabletInRange) {
|
||||
GHOST_TInt32 x_new = x_screen;
|
||||
GHOST_TInt32 y_new = y_screen;
|
||||
GHOST_TInt32 x_accum, y_accum;
|
||||
@@ -1101,7 +983,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
||||
}
|
||||
|
||||
/* Could also clamp to screen bounds wrap with a window outside the view will fail atm.
|
||||
* Use inset in case the window is at screen bounds. */
|
||||
* Use offset of 8 in case the window is at screen bounds. */
|
||||
bounds.wrapPoint(x_new, y_new, 2, window->getCursorGrabAxis());
|
||||
|
||||
window->getCursorGrabAccum(x_accum, y_accum);
|
||||
@@ -1117,7 +999,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
||||
window,
|
||||
x_screen + x_accum,
|
||||
y_screen + y_accum,
|
||||
GHOST_TABLET_DATA_NONE);
|
||||
window->getTabletData());
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1126,7 +1008,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind
|
||||
window,
|
||||
x_screen,
|
||||
y_screen,
|
||||
GHOST_TABLET_DATA_NONE);
|
||||
window->getTabletData());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -1236,23 +1118,6 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA
|
||||
return event;
|
||||
}
|
||||
|
||||
GHOST_Event *GHOST_SystemWin32::processWindowSizeEvent(GHOST_WindowWin32 *window)
|
||||
{
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
|
||||
GHOST_Event *sizeEvent = new GHOST_Event(
|
||||
system->getMilliSeconds(), GHOST_kEventWindowSize, window);
|
||||
|
||||
/* We get WM_SIZE before we fully init. Do not dispatch before we are continuously resizing. */
|
||||
if (window->m_inLiveResize) {
|
||||
system->pushEvent(sizeEvent);
|
||||
system->dispatchEvents();
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return sizeEvent;
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_Event *GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type,
|
||||
GHOST_WindowWin32 *window)
|
||||
{
|
||||
@@ -1260,6 +1125,7 @@ GHOST_Event *GHOST_SystemWin32::processWindowEvent(GHOST_TEventType type,
|
||||
|
||||
if (type == GHOST_kEventWindowActivate) {
|
||||
system->getWindowManager()->setActiveWindow(window);
|
||||
window->bringTabletContextToFront();
|
||||
}
|
||||
|
||||
return new GHOST_Event(system->getMilliSeconds(), type, window);
|
||||
@@ -1287,31 +1153,6 @@ GHOST_TSuccess GHOST_SystemWin32::pushDragDropEvent(GHOST_TEventType eventType,
|
||||
system->getMilliSeconds(), eventType, draggedObjectType, window, mouseX, mouseY, data));
|
||||
}
|
||||
|
||||
void GHOST_SystemWin32::setTabletAPI(GHOST_TTabletAPI api)
|
||||
{
|
||||
GHOST_System::setTabletAPI(api);
|
||||
|
||||
/* If API is set to WinPointer (Windows Ink), unload Wintab so that trouble drivers don't disable
|
||||
* Windows Ink. Load Wintab when API is Automatic because decision logic relies on knowing
|
||||
* whether a Wintab device is present. */
|
||||
const bool loadWintab = GHOST_kTabletWinPointer != api;
|
||||
GHOST_WindowManager *wm = getWindowManager();
|
||||
|
||||
for (GHOST_IWindow *win : wm->getWindows()) {
|
||||
GHOST_WindowWin32 *windowWin32 = (GHOST_WindowWin32 *)win;
|
||||
if (loadWintab) {
|
||||
windowWin32->loadWintab(GHOST_kWindowStateMinimized != windowWin32->getState());
|
||||
|
||||
if (windowWin32->usingTabletAPI(GHOST_kTabletWintab)) {
|
||||
windowWin32->resetPointerPenInfo();
|
||||
}
|
||||
}
|
||||
else {
|
||||
windowWin32->closeWintab();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GHOST_SystemWin32::processMinMaxInfo(MINMAXINFO *minmax)
|
||||
{
|
||||
minmax->ptMinTrackSize.x = 320;
|
||||
@@ -1503,7 +1344,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
/* These functions were replaced by #WM_INPUT. */
|
||||
/* These functions were replaced by WM_INPUT*/
|
||||
case WM_CHAR:
|
||||
/* The WM_CHAR message is posted to the window with the keyboard focus when
|
||||
* a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR
|
||||
@@ -1546,100 +1387,33 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
case SC_KEYMENU:
|
||||
eventHandled = true;
|
||||
break;
|
||||
case SC_RESTORE: {
|
||||
case SC_RESTORE:
|
||||
::ShowWindow(hwnd, SW_RESTORE);
|
||||
window->setState(window->getState());
|
||||
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->enable();
|
||||
}
|
||||
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
case SC_MAXIMIZE: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->enable();
|
||||
}
|
||||
/* Don't report event as handled so that default handling occurs. */
|
||||
break;
|
||||
}
|
||||
case SC_MINIMIZE: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->disable();
|
||||
}
|
||||
/* Don't report event as handled so that default handling occurs. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Wintab events, processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
case WT_CSRCHANGE: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->updateCursorInfo();
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
case WT_PROXIMITY: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
bool inRange = LOWORD(lParam);
|
||||
if (inRange) {
|
||||
/* Some devices don't emit WT_CSRCHANGE events, so update cursor info here. */
|
||||
wt->updateCursorInfo();
|
||||
}
|
||||
else {
|
||||
wt->leaveRange();
|
||||
}
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
case WT_INFOCHANGE: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->processInfoChange(lParam);
|
||||
|
||||
if (window->usingTabletAPI(GHOST_kTabletWintab)) {
|
||||
window->resetPointerPenInfo();
|
||||
}
|
||||
}
|
||||
eventHandled = true;
|
||||
break;
|
||||
}
|
||||
case WT_PACKET:
|
||||
processWintabEvent(window);
|
||||
eventHandled = true;
|
||||
window->processWin32TabletEvent(wParam, lParam);
|
||||
break;
|
||||
case WT_CSRCHANGE:
|
||||
case WT_PROXIMITY:
|
||||
window->processWin32TabletInitEvent();
|
||||
break;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Pointer events, processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
case WM_POINTERUPDATE:
|
||||
case WM_POINTERENTER:
|
||||
case WM_POINTERDOWN:
|
||||
case WM_POINTERUPDATE:
|
||||
case WM_POINTERUP:
|
||||
case WM_POINTERLEAVE:
|
||||
processPointerEvent(msg, window, wParam, lParam, eventHandled);
|
||||
break;
|
||||
case WM_POINTERLEAVE: {
|
||||
GHOST_TUns32 pointerId = GET_POINTERID_WPARAM(wParam);
|
||||
POINTER_INFO pointerInfo;
|
||||
if (!GetPointerInfo(pointerId, &pointerInfo)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Reset pointer pen info if pen device has left tracking range. */
|
||||
if (pointerInfo.pointerType == PT_PEN) {
|
||||
window->resetPointerPenInfo();
|
||||
eventHandled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Mouse events, processed
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -1678,20 +1452,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
}
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if (!window->m_mousePresent) {
|
||||
TRACKMOUSEEVENT tme = {sizeof(tme)};
|
||||
tme.dwFlags = TME_LEAVE;
|
||||
tme.hwndTrack = hwnd;
|
||||
TrackMouseEvent(&tme);
|
||||
window->m_mousePresent = true;
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->gainFocus();
|
||||
}
|
||||
}
|
||||
|
||||
event = processCursorEvent(window);
|
||||
|
||||
break;
|
||||
case WM_MOUSEWHEEL: {
|
||||
/* The WM_MOUSEWHEEL message is sent to the focus window
|
||||
@@ -1701,7 +1462,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* since DefWindowProc propagates it up the parent chain
|
||||
* until it finds a window that processes it.
|
||||
*/
|
||||
processWheelEvent(window, wParam, lParam);
|
||||
|
||||
/* Get the window under the mouse and send event to its queue. */
|
||||
POINT mouse_pos = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
|
||||
HWND mouse_hwnd = ChildWindowFromPoint(HWND_DESKTOP, mouse_pos);
|
||||
GHOST_WindowWin32 *mouse_window = (GHOST_WindowWin32 *)::GetWindowLongPtr(mouse_hwnd,
|
||||
GWLP_USERDATA);
|
||||
|
||||
processWheelEvent(mouse_window ? mouse_window : window, wParam, lParam);
|
||||
eventHandled = true;
|
||||
#ifdef BROKEN_PEEK_TOUCHPAD
|
||||
PostMessage(hwnd, WM_USER, 0, 0);
|
||||
@@ -1726,17 +1494,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
window->loadCursor(true, GHOST_kStandardCursorDefault);
|
||||
}
|
||||
break;
|
||||
case WM_MOUSELEAVE: {
|
||||
window->m_mousePresent = false;
|
||||
if (window->getTabletData().Active == GHOST_kTabletModeNone) {
|
||||
processCursorEvent(window);
|
||||
}
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->loseFocus();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Mouse events, ignored
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -1784,7 +1542,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* will not be dispatched to OUR active window if we minimize one of OUR windows. */
|
||||
if (LOWORD(wParam) == WA_INACTIVE)
|
||||
window->lostMouseCapture();
|
||||
|
||||
window->processWin32TabletActivateEvent(GET_WM_ACTIVATE_STATE(wParam, lParam));
|
||||
lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
@@ -1826,8 +1584,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
/* Let DefWindowProc handle it. */
|
||||
break;
|
||||
case WM_SIZING:
|
||||
event = processWindowSizeEvent(window);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
/* The WM_SIZE message is sent to a window after its size has changed.
|
||||
* The WM_SIZE and WM_MOVE messages are not sent if an application handles the
|
||||
@@ -1835,7 +1591,15 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
*/
|
||||
event = processWindowSizeEvent(window);
|
||||
/* we get first WM_SIZE before we fully init.
|
||||
* So, do not dispatch before we continuously resizing. */
|
||||
if (window->m_inLiveResize) {
|
||||
system->pushEvent(processWindowEvent(GHOST_kEventWindowSize, window));
|
||||
system->dispatchEvents();
|
||||
}
|
||||
else {
|
||||
event = processWindowEvent(GHOST_kEventWindowSize, window);
|
||||
}
|
||||
break;
|
||||
case WM_CAPTURECHANGED:
|
||||
window->lostMouseCapture();
|
||||
@@ -1851,7 +1615,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* to perform any move or size change processing during the WM_WINDOWPOSCHANGED
|
||||
* message without calling DefWindowProc.
|
||||
*/
|
||||
/* See #WM_SIZE comment. */
|
||||
/* see WM_SIZE comment*/
|
||||
if (window->m_inLiveResize) {
|
||||
system->pushEvent(processWindowEvent(GHOST_kEventWindowMove, window));
|
||||
system->dispatchEvents();
|
||||
@@ -1886,21 +1650,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
break;
|
||||
case WM_DISPLAYCHANGE: {
|
||||
GHOST_Wintab *wt = window->getWintab();
|
||||
if (wt) {
|
||||
wt->remapCoordinates();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_KILLFOCUS:
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard
|
||||
* focus. We want to prevent this if a window is still active and it loses focus to
|
||||
* nowhere. */
|
||||
if (!wParam && hwnd == ::GetActiveWindow()) {
|
||||
::SetFocus(hwnd);
|
||||
}
|
||||
break;
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Window events, ignored
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -1937,6 +1686,12 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
* object associated with the window.
|
||||
*/
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
/* The WM_KILLFOCUS message is sent to a window immediately before it loses the
|
||||
* keyboard focus. We want to prevent this if a window is still active and it loses
|
||||
* focus to nowhere. */
|
||||
if (!wParam && hwnd == ::GetActiveWindow())
|
||||
::SetFocus(hwnd);
|
||||
case WM_SHOWWINDOW:
|
||||
/* The WM_SHOWWINDOW message is sent to a window when the window is
|
||||
* about to be hidden or shown. */
|
||||
|
@@ -265,16 +265,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
int mouseY,
|
||||
void *data);
|
||||
|
||||
/***************************************************************************************
|
||||
** Modify tablet API
|
||||
***************************************************************************************/
|
||||
|
||||
/**
|
||||
* Set which tablet API to use.
|
||||
* \param api: Enum indicating which API to use.
|
||||
*/
|
||||
void setTabletAPI(GHOST_TTabletAPI api) override;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initializes the system.
|
||||
@@ -318,12 +308,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
GHOST_WindowWin32 *window,
|
||||
GHOST_TButtonMask mask);
|
||||
|
||||
/**
|
||||
* Creates tablet events from Wintab events.
|
||||
* \param window: The window receiving the event (the active window).
|
||||
*/
|
||||
static void processWintabEvent(GHOST_WindowWin32 *window);
|
||||
|
||||
/**
|
||||
* Creates tablet events from pointer events.
|
||||
* \param type: The type of pointer event.
|
||||
@@ -367,13 +351,6 @@ class GHOST_SystemWin32 : public GHOST_System {
|
||||
*/
|
||||
GHOST_TKey processSpecialKey(short vKey, short scanCode) const;
|
||||
|
||||
/**
|
||||
* Creates a window size event.
|
||||
* \param window: The window receiving the event (the active window).
|
||||
* \return The event created.
|
||||
*/
|
||||
static GHOST_Event *processWindowSizeEvent(GHOST_WindowWin32 *window);
|
||||
|
||||
/**
|
||||
* Creates a window event.
|
||||
* \param type: The type of event to create.
|
||||
|
@@ -89,7 +89,7 @@
|
||||
/* see T34039 Fix Alt key glitch on Unity desktop */
|
||||
#define USE_UNITY_WORKAROUND
|
||||
|
||||
/* Fix 'shortcut' part of keyboard reading code only ever using first defined key-map
|
||||
/* Fix 'shortcut' part of keyboard reading code only ever using first defined keymap
|
||||
* instead of active one. See T47228 and D1746 */
|
||||
#define USE_NON_LATIN_KB_WORKAROUND
|
||||
|
||||
@@ -441,8 +441,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
|
||||
|
||||
for (int minor = 5; minor >= 0; --minor) {
|
||||
#if defined(WITH_GL_EGL)
|
||||
context = new GHOST_ContextEGL(this,
|
||||
false,
|
||||
context = new GHOST_ContextEGL(false,
|
||||
EGLNativeWindowType(nullptr),
|
||||
EGLNativeDisplayType(m_display),
|
||||
profile_mask,
|
||||
@@ -472,8 +471,7 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
|
||||
}
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
context = new GHOST_ContextEGL(this,
|
||||
false,
|
||||
context = new GHOST_ContextEGL(false,
|
||||
EGLNativeWindowType(nullptr),
|
||||
EGLNativeDisplayType(m_display),
|
||||
profile_mask,
|
||||
@@ -591,7 +589,9 @@ static void SleepTillEvent(Display *display, GHOST_TInt64 maxSleep)
|
||||
}
|
||||
}
|
||||
|
||||
/* This function borrowed from Qt's X11 support qclipboard_x11.cpp */
|
||||
/* This function borrowed from Qt's X11 support
|
||||
* qclipboard_x11.cpp
|
||||
* */
|
||||
struct init_timestamp_data {
|
||||
Time timestamp;
|
||||
};
|
||||
@@ -2563,7 +2563,7 @@ static bool is_filler_char(char c)
|
||||
return isspace(c) || c == '_' || c == '-' || c == ';' || c == ':';
|
||||
}
|
||||
|
||||
/* These C functions are copied from Wine 3.12's `wintab.c` */
|
||||
/* These C functions are copied from Wine 3.12's wintab.c */
|
||||
static bool match_token(const char *haystack, const char *needle)
|
||||
{
|
||||
const char *h, *n;
|
||||
@@ -2675,8 +2675,8 @@ void GHOST_SystemX11::refreshXInputDevices()
|
||||
xtablet.PressureLevels = xvi->axes[2].max_value;
|
||||
|
||||
if (xvi->num_axes > 3) {
|
||||
/* This is assuming that the tablet has the same tilt resolution in both
|
||||
* positive and negative directions. It would be rather weird if it didn't. */
|
||||
/* this is assuming that the tablet has the same tilt resolution in both
|
||||
* positive and negative directions. It would be rather weird if it didn't.. */
|
||||
xtablet.XtiltLevels = xvi->axes[3].max_value;
|
||||
xtablet.YtiltLevels = xvi->axes[4].max_value;
|
||||
}
|
||||
|
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup GHOST
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <dbus/dbus.h>
|
||||
#include <string>
|
||||
|
||||
static DBusMessage *get_setting_sync(DBusConnection *const connection,
|
||||
const char *key,
|
||||
const char *value)
|
||||
{
|
||||
DBusError error;
|
||||
dbus_bool_t success;
|
||||
DBusMessage *message;
|
||||
DBusMessage *reply;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
message = dbus_message_new_method_call("org.freedesktop.portal.Desktop",
|
||||
"/org/freedesktop/portal/desktop",
|
||||
"org.freedesktop.portal.Settings",
|
||||
"Read");
|
||||
|
||||
success = dbus_message_append_args(
|
||||
message, DBUS_TYPE_STRING, &key, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID);
|
||||
|
||||
if (!success) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
reply = dbus_connection_send_with_reply_and_block(
|
||||
connection, message, DBUS_TIMEOUT_USE_DEFAULT, &error);
|
||||
|
||||
dbus_message_unref(message);
|
||||
|
||||
if (dbus_error_is_set(&error)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
static bool parse_type(DBusMessage *const reply, const int type, void *value)
|
||||
{
|
||||
DBusMessageIter iter[3];
|
||||
|
||||
dbus_message_iter_init(reply, &iter[0]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[0]) != DBUS_TYPE_VARIANT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_recurse(&iter[0], &iter[1]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[1]) != DBUS_TYPE_VARIANT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_recurse(&iter[1], &iter[2]);
|
||||
if (dbus_message_iter_get_arg_type(&iter[2]) != type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_iter_get_basic(&iter[2], value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool get_cursor_settings(std::string &theme, int &size)
|
||||
{
|
||||
static const char name[] = "org.gnome.desktop.interface";
|
||||
static const char key_theme[] = "cursor-theme";
|
||||
static const char key_size[] = "cursor-size";
|
||||
|
||||
DBusError error;
|
||||
DBusConnection *connection;
|
||||
DBusMessage *reply;
|
||||
const char *value_theme = NULL;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
connection = dbus_bus_get(DBUS_BUS_SESSION, &error);
|
||||
|
||||
if (dbus_error_is_set(&error)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
reply = get_setting_sync(connection, name, key_theme);
|
||||
if (!reply) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_type(reply, DBUS_TYPE_STRING, &value_theme)) {
|
||||
dbus_message_unref(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
theme = std::string(value_theme);
|
||||
|
||||
dbus_message_unref(reply);
|
||||
|
||||
reply = get_setting_sync(connection, name, key_size);
|
||||
if (!reply) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_type(reply, DBUS_TYPE_INT32, &size)) {
|
||||
dbus_message_unref(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
dbus_message_unref(reply);
|
||||
|
||||
return true;
|
||||
}
|
@@ -22,7 +22,11 @@
|
||||
#include "GHOST_Debug.h"
|
||||
#include "GHOST_SystemCocoa.h"
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
# include "GHOST_ContextEGL.h"
|
||||
#else
|
||||
# include "GHOST_ContextCGL.h"
|
||||
#endif
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <Metal/Metal.h>
|
||||
|
@@ -556,7 +556,7 @@ static SDL_Cursor *sdl_ghost_CreateCursor(
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/* TODO, this is currently never freed but it won't leak either. */
|
||||
/* TODO, this is currently never freed but it wont leak either. */
|
||||
static SDL_Cursor *getStandardCursorShape(GHOST_TStandardCursor shape)
|
||||
{
|
||||
if (sdl_std_cursor_array[0] == NULL) {
|
||||
|
@@ -29,19 +29,11 @@
|
||||
|
||||
#include <wayland-egl.h>
|
||||
|
||||
static constexpr size_t base_dpi = 96;
|
||||
|
||||
struct window_t {
|
||||
GHOST_WindowWayland *w;
|
||||
wl_surface *surface;
|
||||
// outputs on which the window is currently shown on
|
||||
std::unordered_set<const output_t *> outputs;
|
||||
GHOST_TUns16 dpi = 0;
|
||||
int scale = 1;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration = nullptr;
|
||||
enum zxdg_toplevel_decoration_v1_mode decoration_mode;
|
||||
wl_egl_window *egl_window;
|
||||
int32_t pending_width, pending_height;
|
||||
bool is_maximised;
|
||||
@@ -101,30 +93,17 @@ static const xdg_toplevel_listener toplevel_listener = {
|
||||
toplevel_close,
|
||||
};
|
||||
|
||||
static void toplevel_decoration_configure(
|
||||
void *data,
|
||||
struct zxdg_toplevel_decoration_v1 * /*zxdg_toplevel_decoration_v1*/,
|
||||
uint32_t mode)
|
||||
{
|
||||
static_cast<window_t *>(data)->decoration_mode = zxdg_toplevel_decoration_v1_mode(mode);
|
||||
}
|
||||
|
||||
static const zxdg_toplevel_decoration_v1_listener toplevel_decoration_v1_listener = {
|
||||
toplevel_decoration_configure,
|
||||
};
|
||||
|
||||
static void surface_configure(void *data, xdg_surface *xdg_surface, uint32_t serial)
|
||||
{
|
||||
window_t *win = static_cast<window_t *>(data);
|
||||
|
||||
if (win->xdg_surface != xdg_surface) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (win->pending_width != 0 && win->pending_height != 0) {
|
||||
win->width = win->scale * win->pending_width;
|
||||
win->height = win->scale * win->pending_height;
|
||||
wl_egl_window_resize(win->egl_window, win->width, win->height, 0, 0);
|
||||
int w, h;
|
||||
wl_egl_window_get_attached_size(win->egl_window, &w, &h);
|
||||
if (win->pending_width != 0 && win->pending_height != 0 && win->pending_width != w &&
|
||||
win->pending_height != h) {
|
||||
win->width = win->pending_width;
|
||||
win->height = win->pending_height;
|
||||
wl_egl_window_resize(win->egl_window, win->pending_width, win->pending_height, 0, 0);
|
||||
win->pending_width = 0;
|
||||
win->pending_height = 0;
|
||||
win->w->notify_size();
|
||||
@@ -144,52 +123,6 @@ static const xdg_surface_listener surface_listener = {
|
||||
surface_configure,
|
||||
};
|
||||
|
||||
static bool update_scale(GHOST_WindowWayland *window)
|
||||
{
|
||||
int scale = 0;
|
||||
for (const output_t *output : window->outputs_active()) {
|
||||
if (output->scale > scale)
|
||||
scale = output->scale;
|
||||
}
|
||||
|
||||
if (scale > 0 && window->scale() != scale) {
|
||||
window->scale() = scale;
|
||||
// using the real DPI will cause wrong scaling of the UI
|
||||
// use a multiplier for the default DPI as workaround
|
||||
window->dpi() = scale * base_dpi;
|
||||
wl_surface_set_buffer_scale(window->surface(), scale);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void surface_enter(void *data, struct wl_surface * /*wl_surface*/, struct wl_output *output)
|
||||
{
|
||||
GHOST_WindowWayland *w = static_cast<GHOST_WindowWayland *>(data);
|
||||
for (const output_t *reg_output : w->outputs()) {
|
||||
if (reg_output->output == output) {
|
||||
w->outputs_active().insert(reg_output);
|
||||
}
|
||||
}
|
||||
update_scale(w);
|
||||
}
|
||||
|
||||
static void surface_leave(void *data, struct wl_surface * /*wl_surface*/, struct wl_output *output)
|
||||
{
|
||||
GHOST_WindowWayland *w = static_cast<GHOST_WindowWayland *>(data);
|
||||
for (const output_t *reg_output : w->outputs()) {
|
||||
if (reg_output->output == output) {
|
||||
w->outputs_active().erase(reg_output);
|
||||
}
|
||||
}
|
||||
update_scale(w);
|
||||
}
|
||||
|
||||
struct wl_surface_listener wl_surface_listener = {
|
||||
surface_enter,
|
||||
surface_leave,
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -228,28 +161,17 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
||||
|
||||
/* Window surfaces. */
|
||||
w->surface = wl_compositor_create_surface(m_system->compositor());
|
||||
wl_surface_add_listener(w->surface, &wl_surface_listener, this);
|
||||
|
||||
w->egl_window = wl_egl_window_create(w->surface, int(width), int(height));
|
||||
|
||||
w->xdg_surface = xdg_wm_base_get_xdg_surface(m_system->shell(), w->surface);
|
||||
w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
|
||||
|
||||
if (m_system->decoration_manager()) {
|
||||
w->xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
|
||||
m_system->decoration_manager(), w->xdg_toplevel);
|
||||
zxdg_toplevel_decoration_v1_add_listener(
|
||||
w->xdg_toplevel_decoration, &toplevel_decoration_v1_listener, w);
|
||||
zxdg_toplevel_decoration_v1_set_mode(w->xdg_toplevel_decoration,
|
||||
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||
}
|
||||
|
||||
wl_surface_set_user_data(w->surface, this);
|
||||
|
||||
xdg_surface_add_listener(w->xdg_surface, &surface_listener, w);
|
||||
xdg_toplevel_add_listener(w->xdg_toplevel, &toplevel_listener, w);
|
||||
|
||||
if (parentWindow && is_dialog) {
|
||||
if (parentWindow) {
|
||||
xdg_toplevel_set_parent(
|
||||
w->xdg_toplevel, dynamic_cast<const GHOST_WindowWayland *>(parentWindow)->w->xdg_toplevel);
|
||||
}
|
||||
@@ -270,9 +192,6 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
|
||||
if (setDrawingContextType(type) == GHOST_kFailure) {
|
||||
GHOST_PRINT("Failed to create EGL context" << std::endl);
|
||||
}
|
||||
|
||||
/* set swap interval to 0 to prevent blocking */
|
||||
setSwapInterval(0);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowWayland::close()
|
||||
@@ -307,31 +226,6 @@ GHOST_TSuccess GHOST_WindowWayland::notify_size()
|
||||
new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowSize, this));
|
||||
}
|
||||
|
||||
wl_surface *GHOST_WindowWayland::surface() const
|
||||
{
|
||||
return w->surface;
|
||||
}
|
||||
|
||||
const std::vector<output_t *> &GHOST_WindowWayland::outputs() const
|
||||
{
|
||||
return m_system->outputs();
|
||||
}
|
||||
|
||||
std::unordered_set<const output_t *> &GHOST_WindowWayland::outputs_active()
|
||||
{
|
||||
return w->outputs;
|
||||
}
|
||||
|
||||
uint16_t &GHOST_WindowWayland::dpi()
|
||||
{
|
||||
return w->dpi;
|
||||
}
|
||||
|
||||
int &GHOST_WindowWayland::scale()
|
||||
{
|
||||
return w->scale;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
|
||||
{
|
||||
return m_system->setCursorGrab(mode, w->surface);
|
||||
@@ -416,9 +310,6 @@ GHOST_WindowWayland::~GHOST_WindowWayland()
|
||||
releaseNativeHandles();
|
||||
|
||||
wl_egl_window_destroy(w->egl_window);
|
||||
if (w->xdg_toplevel_decoration) {
|
||||
zxdg_toplevel_decoration_v1_destroy(w->xdg_toplevel_decoration);
|
||||
}
|
||||
xdg_toplevel_destroy(w->xdg_toplevel);
|
||||
xdg_surface_destroy(w->xdg_surface);
|
||||
wl_surface_destroy(w->surface);
|
||||
@@ -426,11 +317,6 @@ GHOST_WindowWayland::~GHOST_WindowWayland()
|
||||
delete w;
|
||||
}
|
||||
|
||||
GHOST_TUns16 GHOST_WindowWayland::getDPIHint()
|
||||
{
|
||||
return w->dpi;
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility(bool visible)
|
||||
{
|
||||
return m_system->setCursorVisibility(visible);
|
||||
@@ -532,25 +418,7 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
|
||||
context = new GHOST_ContextNone(m_wantStereoVisual);
|
||||
break;
|
||||
case GHOST_kDrawingContextTypeOpenGL:
|
||||
for (int minor = 6; minor >= 0; --minor) {
|
||||
context = new GHOST_ContextEGL(this->m_system,
|
||||
m_wantStereoVisual,
|
||||
EGLNativeWindowType(w->egl_window),
|
||||
EGLNativeDisplayType(m_system->display()),
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||
4,
|
||||
minor,
|
||||
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
|
||||
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
|
||||
EGL_OPENGL_API);
|
||||
|
||||
if (context->initializeDrawingContext())
|
||||
return context;
|
||||
else
|
||||
delete context;
|
||||
}
|
||||
context = new GHOST_ContextEGL(this->m_system,
|
||||
m_wantStereoVisual,
|
||||
context = new GHOST_ContextEGL(m_wantStereoVisual,
|
||||
EGLNativeWindowType(w->egl_window),
|
||||
EGLNativeDisplayType(m_system->display()),
|
||||
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
|
||||
@@ -559,6 +427,7 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
|
||||
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
|
||||
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
|
||||
EGL_OPENGL_API);
|
||||
break;
|
||||
}
|
||||
|
||||
return (context->initializeDrawingContext() == GHOST_kSuccess) ? context : nullptr;
|
||||
|
@@ -24,14 +24,9 @@
|
||||
|
||||
#include "GHOST_Window.h"
|
||||
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
class GHOST_SystemWayland;
|
||||
|
||||
struct window_t;
|
||||
struct wl_surface;
|
||||
struct output_t;
|
||||
|
||||
class GHOST_WindowWayland : public GHOST_Window {
|
||||
public:
|
||||
@@ -52,8 +47,6 @@ class GHOST_WindowWayland : public GHOST_Window {
|
||||
|
||||
~GHOST_WindowWayland() override;
|
||||
|
||||
GHOST_TUns16 getDPIHint() override;
|
||||
|
||||
GHOST_TSuccess close();
|
||||
|
||||
GHOST_TSuccess activate();
|
||||
@@ -62,16 +55,6 @@ class GHOST_WindowWayland : public GHOST_Window {
|
||||
|
||||
GHOST_TSuccess notify_size();
|
||||
|
||||
wl_surface *surface() const;
|
||||
|
||||
const std::vector<output_t *> &outputs() const;
|
||||
|
||||
std::unordered_set<const output_t *> &outputs_active();
|
||||
|
||||
uint16_t &dpi();
|
||||
|
||||
int &scale();
|
||||
|
||||
protected:
|
||||
GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode) override;
|
||||
|
||||
|
@@ -21,6 +21,8 @@
|
||||
* \ingroup GHOST
|
||||
*/
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
#include "GHOST_WindowWin32.h"
|
||||
#include "GHOST_ContextD3D.h"
|
||||
#include "GHOST_ContextNone.h"
|
||||
@@ -30,15 +32,17 @@
|
||||
#include "utf_winfunc.h"
|
||||
#include "utfconv.h"
|
||||
|
||||
#if defined(WITH_GL_EGL)
|
||||
# include "GHOST_ContextEGL.h"
|
||||
#else
|
||||
# include "GHOST_ContextWGL.h"
|
||||
|
||||
#endif
|
||||
#ifdef WIN32_COMPOSITING
|
||||
# include <Dwmapi.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <shellscalingapi.h>
|
||||
#include <string.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
@@ -68,7 +72,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
bool is_debug,
|
||||
bool dialog)
|
||||
: GHOST_Window(width, height, state, wantStereoVisual, false),
|
||||
m_mousePresent(false),
|
||||
m_tabletInRange(false),
|
||||
m_inLiveResize(false),
|
||||
m_system(system),
|
||||
m_hDC(0),
|
||||
@@ -78,13 +82,18 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
m_nPressedButtons(0),
|
||||
m_customCursor(0),
|
||||
m_wantAlphaBackground(alphaBackground),
|
||||
m_wintab(NULL),
|
||||
m_lastPointerTabletData(GHOST_TABLET_DATA_NONE),
|
||||
m_normal_state(GHOST_kWindowStateNormal),
|
||||
m_user32(::LoadLibrary("user32.dll")),
|
||||
m_user32(NULL),
|
||||
m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : HWND_DESKTOP),
|
||||
m_debug_context(is_debug)
|
||||
{
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
|
||||
|
||||
// Initialize tablet variables
|
||||
memset(&m_wintab, 0, sizeof(m_wintab));
|
||||
m_tabletData = GHOST_TABLET_DATA_NONE;
|
||||
|
||||
DWORD style = parentwindow ?
|
||||
WS_POPUPWINDOW | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX :
|
||||
WS_OVERLAPPEDWINDOW;
|
||||
@@ -103,10 +112,27 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
*/
|
||||
}
|
||||
|
||||
RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
|
||||
adjustWindowRectForClosestMonitor(&win_rect, style, extended_style);
|
||||
/* Monitor details. */
|
||||
MONITORINFOEX monitor;
|
||||
monitor.cbSize = sizeof(MONITORINFOEX);
|
||||
monitor.dwFlags = 0;
|
||||
GetMonitorInfo(MonitorFromRect(&win_rect, MONITOR_DEFAULTTONEAREST), &monitor);
|
||||
|
||||
/* Constrain requested size and position to fit within this monitor. */
|
||||
width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left);
|
||||
height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top);
|
||||
win_rect.left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width);
|
||||
win_rect.right = win_rect.left + width;
|
||||
win_rect.top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height);
|
||||
win_rect.bottom = win_rect.top + height;
|
||||
|
||||
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
|
||||
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
|
||||
AdjustWindowRectEx(&win_rect, style & ~WS_OVERLAPPED, FALSE, extended_style);
|
||||
|
||||
/* But never allow a top position that can hide part of the title bar. */
|
||||
win_rect.top = max(monitor.rcWork.top, win_rect.top);
|
||||
|
||||
wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
|
||||
m_hWnd = ::CreateWindowExW(extended_style, // window extended style
|
||||
s_windowClassName, // pointer to registered class name
|
||||
title_16, // pointer to window name
|
||||
@@ -121,34 +147,33 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
0); // pointer to window-creation data
|
||||
free(title_16);
|
||||
|
||||
if (m_hWnd == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store the device context. */
|
||||
m_hDC = ::GetDC(m_hWnd);
|
||||
|
||||
if (!setDrawingContextType(type)) {
|
||||
::DestroyWindow(m_hWnd);
|
||||
m_hWnd = NULL;
|
||||
return;
|
||||
}
|
||||
m_user32 = ::LoadLibrary("user32.dll");
|
||||
|
||||
if (m_hWnd) {
|
||||
RegisterTouchWindow(m_hWnd, 0);
|
||||
|
||||
/* Register as droptarget. OleInitialize(0) required first, done in GHOST_SystemWin32. */
|
||||
// Register this window as a droptarget. Requires m_hWnd to be valid.
|
||||
// Note that OleInitialize(0) has to be called prior to this. Done in GHOST_SystemWin32.
|
||||
m_dropTarget = new GHOST_DropTargetWin32(this, m_system);
|
||||
if (m_dropTarget) {
|
||||
::RegisterDragDrop(m_hWnd, m_dropTarget);
|
||||
}
|
||||
|
||||
/* Store a pointer to this class in the window structure. */
|
||||
// Store a pointer to this class in the window structure
|
||||
::SetWindowLongPtr(m_hWnd, GWLP_USERDATA, (LONG_PTR)this);
|
||||
|
||||
if (!m_system->m_windowFocus) {
|
||||
/* If we don't want focus then lower to bottom. */
|
||||
// Lower to bottom and don't activate if we don't want focus
|
||||
::SetWindowPos(m_hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
/* Show the window. */
|
||||
// Store the device context
|
||||
m_hDC = ::GetDC(m_hWnd);
|
||||
|
||||
GHOST_TSuccess success = setDrawingContextType(type);
|
||||
|
||||
if (success) {
|
||||
// Show the window
|
||||
int nCmdShow;
|
||||
switch (state) {
|
||||
case GHOST_kWindowStateMaximized:
|
||||
@@ -164,35 +189,94 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
|
||||
}
|
||||
|
||||
::ShowWindow(m_hWnd, nCmdShow);
|
||||
|
||||
#ifdef WIN32_COMPOSITING
|
||||
if (alphaBackground && parentwindowhwnd == 0) {
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
/* Create and populate the Blur Behind structure. */
|
||||
// Create and populate the Blur Behind structure
|
||||
DWM_BLURBEHIND bb = {0};
|
||||
|
||||
/* Enable Blur Behind and apply to the entire client area. */
|
||||
// Enable Blur Behind and apply to the entire client area
|
||||
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
||||
bb.fEnable = true;
|
||||
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
|
||||
|
||||
/* Apply Blur Behind. */
|
||||
// Apply Blur Behind
|
||||
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
|
||||
DeleteObject(bb.hRgnBlur);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Force an initial paint of the window. */
|
||||
// Force an initial paint of the window
|
||||
::UpdateWindow(m_hWnd);
|
||||
|
||||
/* Initialize Wintab. */
|
||||
if (system->getTabletAPI() != GHOST_kTabletWinPointer) {
|
||||
loadWintab(GHOST_kWindowStateMinimized != state);
|
||||
}
|
||||
else {
|
||||
// invalidate the window
|
||||
::DestroyWindow(m_hWnd);
|
||||
m_hWnd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allow the showing of a progress bar on the taskbar. */
|
||||
// Initialize Wintab
|
||||
m_wintab.handle = ::LoadLibrary("Wintab32.dll");
|
||||
if (m_wintab.handle && m_system->getTabletAPI() != GHOST_kTabletNative) {
|
||||
// Get API functions
|
||||
m_wintab.info = (GHOST_WIN32_WTInfo)::GetProcAddress(m_wintab.handle, "WTInfoA");
|
||||
m_wintab.open = (GHOST_WIN32_WTOpen)::GetProcAddress(m_wintab.handle, "WTOpenA");
|
||||
m_wintab.close = (GHOST_WIN32_WTClose)::GetProcAddress(m_wintab.handle, "WTClose");
|
||||
m_wintab.packet = (GHOST_WIN32_WTPacket)::GetProcAddress(m_wintab.handle, "WTPacket");
|
||||
m_wintab.enable = (GHOST_WIN32_WTEnable)::GetProcAddress(m_wintab.handle, "WTEnable");
|
||||
m_wintab.overlap = (GHOST_WIN32_WTOverlap)::GetProcAddress(m_wintab.handle, "WTOverlap");
|
||||
|
||||
// Let's see if we can initialize tablet here.
|
||||
// Check if WinTab available by getting system context info.
|
||||
LOGCONTEXT lc = {0};
|
||||
lc.lcOptions |= CXO_SYSTEM;
|
||||
if (m_wintab.open && m_wintab.info && m_wintab.info(WTI_DEFSYSCTX, 0, &lc)) {
|
||||
// Now init the tablet
|
||||
/* The maximum tablet size, pressure and orientation (tilt) */
|
||||
AXIS TabletX, TabletY, Pressure, Orientation[3];
|
||||
|
||||
// Open a Wintab context
|
||||
|
||||
// Open the context
|
||||
lc.lcPktData = PACKETDATA;
|
||||
lc.lcPktMode = PACKETMODE;
|
||||
lc.lcOptions |= CXO_MESSAGES;
|
||||
lc.lcMoveMask = PACKETDATA;
|
||||
|
||||
/* Set the entire tablet as active */
|
||||
m_wintab.info(WTI_DEVICES, DVC_X, &TabletX);
|
||||
m_wintab.info(WTI_DEVICES, DVC_Y, &TabletY);
|
||||
|
||||
/* get the max pressure, to divide into a float */
|
||||
BOOL pressureSupport = m_wintab.info(WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
||||
if (pressureSupport)
|
||||
m_wintab.maxPressure = Pressure.axMax;
|
||||
else
|
||||
m_wintab.maxPressure = 0;
|
||||
|
||||
/* get the max tilt axes, to divide into floats */
|
||||
BOOL tiltSupport = m_wintab.info(WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
||||
if (tiltSupport) {
|
||||
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
||||
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
||||
/* all this assumes the minimum is 0 */
|
||||
m_wintab.maxAzimuth = Orientation[0].axMax;
|
||||
m_wintab.maxAltitude = Orientation[1].axMax;
|
||||
}
|
||||
else { /* No so don't do tilt stuff. */
|
||||
m_wintab.maxAzimuth = m_wintab.maxAltitude = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// The Wintab spec says we must open the context disabled if we are using cursor masks.
|
||||
m_wintab.tablet = m_wintab.open(m_hWnd, &lc, FALSE);
|
||||
if (m_wintab.enable && m_wintab.tablet) {
|
||||
m_wintab.enable(m_wintab.tablet, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
CoCreateInstance(
|
||||
CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, (LPVOID *)&m_Bar);
|
||||
}
|
||||
@@ -205,7 +289,14 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
|
||||
m_Bar = NULL;
|
||||
}
|
||||
|
||||
closeWintab();
|
||||
if (m_wintab.handle) {
|
||||
if (m_wintab.close && m_wintab.tablet) {
|
||||
m_wintab.close(m_wintab.tablet);
|
||||
}
|
||||
|
||||
FreeLibrary(m_wintab.handle);
|
||||
memset(&m_wintab, 0, sizeof(m_wintab));
|
||||
}
|
||||
|
||||
if (m_user32) {
|
||||
FreeLibrary(m_user32);
|
||||
@@ -246,47 +337,6 @@ GHOST_WindowWin32::~GHOST_WindowWin32()
|
||||
}
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::adjustWindowRectForClosestMonitor(LPRECT win_rect,
|
||||
DWORD dwStyle,
|
||||
DWORD dwExStyle)
|
||||
{
|
||||
/* Get Details of the closest monitor. */
|
||||
HMONITOR hmonitor = MonitorFromRect(win_rect, MONITOR_DEFAULTTONEAREST);
|
||||
MONITORINFOEX monitor;
|
||||
monitor.cbSize = sizeof(MONITORINFOEX);
|
||||
monitor.dwFlags = 0;
|
||||
GetMonitorInfo(hmonitor, &monitor);
|
||||
|
||||
/* Constrain requested size and position to fit within this monitor. */
|
||||
LONG width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect->right - win_rect->left);
|
||||
LONG height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect->bottom - win_rect->top);
|
||||
win_rect->left = min(max(monitor.rcWork.left, win_rect->left), monitor.rcWork.right - width);
|
||||
win_rect->right = win_rect->left + width;
|
||||
win_rect->top = min(max(monitor.rcWork.top, win_rect->top), monitor.rcWork.bottom - height);
|
||||
win_rect->bottom = win_rect->top + height;
|
||||
|
||||
/* With Windows 10 and newer we can adjust for chrome that differs with DPI and scale. */
|
||||
GHOST_WIN32_AdjustWindowRectExForDpi fpAdjustWindowRectExForDpi = nullptr;
|
||||
if (m_user32) {
|
||||
fpAdjustWindowRectExForDpi = (GHOST_WIN32_AdjustWindowRectExForDpi)::GetProcAddress(
|
||||
m_user32, "AdjustWindowRectExForDpi");
|
||||
}
|
||||
|
||||
/* Adjust to allow for caption, borders, shadows, scaling, etc. Resulting values can be
|
||||
* correctly outside of monitor bounds. Note: You cannot specify WS_OVERLAPPED when calling. */
|
||||
if (fpAdjustWindowRectExForDpi) {
|
||||
UINT dpiX, dpiY;
|
||||
GetDpiForMonitor(hmonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY);
|
||||
fpAdjustWindowRectExForDpi(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle, dpiX);
|
||||
}
|
||||
else {
|
||||
AdjustWindowRectEx(win_rect, dwStyle & ~WS_OVERLAPPED, FALSE, dwExStyle);
|
||||
}
|
||||
|
||||
/* But never allow a top position that can hide part of the title bar. */
|
||||
win_rect->top = max(monitor.rcWork.top, win_rect->top);
|
||||
}
|
||||
|
||||
bool GHOST_WindowWin32::getValid() const
|
||||
{
|
||||
return GHOST_Window::getValid() && m_hWnd != 0 && m_hDC != 0;
|
||||
@@ -306,7 +356,7 @@ void GHOST_WindowWin32::setTitle(const char *title)
|
||||
|
||||
std::string GHOST_WindowWin32::getTitle() const
|
||||
{
|
||||
char buf[s_maxTitleLength]; /* CHANGE + never used yet. */
|
||||
char buf[s_maxTitleLength]; /*CHANGE + never used yet*/
|
||||
::GetWindowText(m_hWnd, buf, s_maxTitleLength);
|
||||
return std::string(buf);
|
||||
}
|
||||
@@ -863,16 +913,20 @@ GHOST_TSuccess GHOST_WindowWin32::hasCursorShape(GHOST_TStandardCursor cursorSha
|
||||
GHOST_TSuccess GHOST_WindowWin32::getPointerInfo(
|
||||
std::vector<GHOST_PointerInfoWin32> &outPointerInfo, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
GHOST_TInt32 pointerId = GET_POINTERID_WPARAM(wParam);
|
||||
GHOST_TInt32 isPrimary = IS_POINTER_PRIMARY_WPARAM(wParam);
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)GHOST_System::getSystem();
|
||||
GHOST_TUns32 outCount = 0;
|
||||
|
||||
if (!(GetPointerPenInfoHistory(pointerId, &outCount, NULL))) {
|
||||
if (!useTabletAPI(GHOST_kTabletNative)) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
std::vector<POINTER_PEN_INFO> pointerPenInfo(outCount);
|
||||
GHOST_TInt32 pointerId = GET_POINTERID_WPARAM(wParam);
|
||||
GHOST_TInt32 isPrimary = IS_POINTER_PRIMARY_WPARAM(wParam);
|
||||
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)GHOST_System::getSystem();
|
||||
GHOST_TUns32 outCount;
|
||||
|
||||
if (!(GetPointerInfoHistory(pointerId, &outCount, NULL))) {
|
||||
return GHOST_kFailure;
|
||||
}
|
||||
|
||||
auto pointerPenInfo = std::vector<POINTER_PEN_INFO>(outCount);
|
||||
outPointerInfo.resize(outCount);
|
||||
|
||||
if (!(GetPointerPenInfoHistory(pointerId, &outCount, pointerPenInfo.data()))) {
|
||||
@@ -934,77 +988,148 @@ GHOST_TSuccess GHOST_WindowWin32::getPointerInfo(
|
||||
}
|
||||
}
|
||||
|
||||
if (!outPointerInfo.empty()) {
|
||||
m_lastPointerTabletData = outPointerInfo.back().tabletData;
|
||||
}
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::resetPointerPenInfo()
|
||||
void GHOST_WindowWin32::processWin32TabletActivateEvent(WORD state)
|
||||
{
|
||||
m_lastPointerTabletData = GHOST_TABLET_DATA_NONE;
|
||||
if (!useTabletAPI(GHOST_kTabletWintab)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GHOST_Wintab *GHOST_WindowWin32::getWintab() const
|
||||
{
|
||||
return m_wintab;
|
||||
}
|
||||
if (m_wintab.enable && m_wintab.tablet) {
|
||||
m_wintab.enable(m_wintab.tablet, state);
|
||||
|
||||
void GHOST_WindowWin32::loadWintab(bool enable)
|
||||
{
|
||||
if (!m_wintab) {
|
||||
if (m_wintab = GHOST_Wintab::loadWintab(m_hWnd)) {
|
||||
if (enable) {
|
||||
m_wintab->enable();
|
||||
|
||||
/* Focus Wintab if cursor is inside this window. This ensures Wintab is enabled when the
|
||||
* tablet is used to change the Tablet API. */
|
||||
GHOST_TInt32 x, y;
|
||||
if (m_system->getCursorPosition(x, y)) {
|
||||
GHOST_Rect rect;
|
||||
getClientBounds(rect);
|
||||
|
||||
if (rect.isInside(x, y)) {
|
||||
m_wintab->gainFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_wintab.overlap && state) {
|
||||
m_wintab.overlap(m_wintab.tablet, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::closeWintab()
|
||||
{
|
||||
delete m_wintab;
|
||||
m_wintab = NULL;
|
||||
}
|
||||
|
||||
bool GHOST_WindowWin32::usingTabletAPI(GHOST_TTabletAPI api) const
|
||||
bool GHOST_WindowWin32::useTabletAPI(GHOST_TTabletAPI api) const
|
||||
{
|
||||
if (m_system->getTabletAPI() == api) {
|
||||
return true;
|
||||
}
|
||||
else if (m_system->getTabletAPI() == GHOST_kTabletAutomatic) {
|
||||
if (m_wintab && m_wintab->devicesPresent()) {
|
||||
if (m_wintab.tablet)
|
||||
return api == GHOST_kTabletWintab;
|
||||
}
|
||||
else {
|
||||
return api == GHOST_kTabletWinPointer;
|
||||
}
|
||||
else
|
||||
return api == GHOST_kTabletNative;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_TabletData GHOST_WindowWin32::getTabletData()
|
||||
void GHOST_WindowWin32::processWin32TabletInitEvent()
|
||||
{
|
||||
if (usingTabletAPI(GHOST_kTabletWintab)) {
|
||||
return m_wintab ? m_wintab->getLastTabletData() : GHOST_TABLET_DATA_NONE;
|
||||
if (!useTabletAPI(GHOST_kTabletWintab)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Let's see if we can initialize tablet here
|
||||
if (m_wintab.info && m_wintab.tablet) {
|
||||
AXIS Pressure, Orientation[3]; /* The maximum tablet size */
|
||||
|
||||
BOOL pressureSupport = m_wintab.info(WTI_DEVICES, DVC_NPRESSURE, &Pressure);
|
||||
if (pressureSupport)
|
||||
m_wintab.maxPressure = Pressure.axMax;
|
||||
else
|
||||
m_wintab.maxPressure = 0;
|
||||
|
||||
BOOL tiltSupport = m_wintab.info(WTI_DEVICES, DVC_ORIENTATION, &Orientation);
|
||||
if (tiltSupport) {
|
||||
/* does the tablet support azimuth ([0]) and altitude ([1]) */
|
||||
if (Orientation[0].axResolution && Orientation[1].axResolution) {
|
||||
m_wintab.maxAzimuth = Orientation[0].axMax;
|
||||
m_wintab.maxAltitude = Orientation[1].axMax;
|
||||
}
|
||||
else { /* No so don't do tilt stuff. */
|
||||
m_wintab.maxAzimuth = m_wintab.maxAltitude = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_tabletData.Active = GHOST_kTabletModeNone;
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::processWin32TabletEvent(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (!useTabletAPI(GHOST_kTabletWintab)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_wintab.packet && m_wintab.tablet) {
|
||||
PACKET pkt;
|
||||
if (m_wintab.packet((HCTX)lParam, wParam, &pkt)) {
|
||||
switch (pkt.pkCursor % 3) { /* % 3 for multiple devices ("DualTrack") */
|
||||
case 0:
|
||||
m_tabletData.Active = GHOST_kTabletModeNone; /* puck - not yet supported */
|
||||
break;
|
||||
case 1:
|
||||
m_tabletData.Active = GHOST_kTabletModeStylus; /* stylus */
|
||||
break;
|
||||
case 2:
|
||||
m_tabletData.Active = GHOST_kTabletModeEraser; /* eraser */
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_wintab.maxPressure > 0) {
|
||||
m_tabletData.Pressure = (float)pkt.pkNormalPressure / (float)m_wintab.maxPressure;
|
||||
}
|
||||
else {
|
||||
return m_lastPointerTabletData;
|
||||
m_tabletData.Pressure = 1.0f;
|
||||
}
|
||||
|
||||
if ((m_wintab.maxAzimuth > 0) && (m_wintab.maxAltitude > 0)) {
|
||||
ORIENTATION ort = pkt.pkOrientation;
|
||||
float vecLen;
|
||||
float altRad, azmRad; /* in radians */
|
||||
|
||||
/*
|
||||
* from the wintab spec:
|
||||
* orAzimuth Specifies the clockwise rotation of the
|
||||
* cursor about the z axis through a full circular range.
|
||||
*
|
||||
* orAltitude Specifies the angle with the x-y plane
|
||||
* through a signed, semicircular range. Positive values
|
||||
* specify an angle upward toward the positive z axis;
|
||||
* negative values specify an angle downward toward the negative z axis.
|
||||
*
|
||||
* wintab.h defines .orAltitude as a UINT but documents .orAltitude
|
||||
* as positive for upward angles and negative for downward angles.
|
||||
* WACOM uses negative altitude values to show that the pen is inverted;
|
||||
* therefore we cast .orAltitude as an (int) and then use the absolute value.
|
||||
*/
|
||||
|
||||
/* convert raw fixed point data to radians */
|
||||
altRad = (float)((fabs((float)ort.orAltitude) / (float)m_wintab.maxAltitude) * M_PI / 2.0);
|
||||
azmRad = (float)(((float)ort.orAzimuth / (float)m_wintab.maxAzimuth) * M_PI * 2.0);
|
||||
|
||||
/* find length of the stylus' projected vector on the XY plane */
|
||||
vecLen = cos(altRad);
|
||||
|
||||
/* from there calculate X and Y components based on azimuth */
|
||||
m_tabletData.Xtilt = sin(azmRad) * vecLen;
|
||||
m_tabletData.Ytilt = (float)(sin(M_PI / 2.0 - azmRad) * vecLen);
|
||||
}
|
||||
else {
|
||||
m_tabletData.Xtilt = 0.0f;
|
||||
m_tabletData.Ytilt = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GHOST_WindowWin32::bringTabletContextToFront()
|
||||
{
|
||||
if (!useTabletAPI(GHOST_kTabletWintab)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_wintab.overlap && m_wintab.tablet) {
|
||||
m_wintab.overlap(m_wintab.tablet, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -30,21 +30,34 @@
|
||||
|
||||
#include "GHOST_TaskbarWin32.h"
|
||||
#include "GHOST_Window.h"
|
||||
#include "GHOST_Wintab.h"
|
||||
#ifdef WITH_INPUT_IME
|
||||
# include "GHOST_ImeWin32.h"
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wintab.h>
|
||||
// PACKETDATA and PACKETMODE modify structs in pktdef.h, so make sure they come first
|
||||
#define PACKETDATA (PK_BUTTONS | PK_NORMAL_PRESSURE | PK_ORIENTATION | PK_CURSOR)
|
||||
#define PACKETMODE PK_BUTTONS
|
||||
#include <pktdef.h>
|
||||
|
||||
class GHOST_SystemWin32;
|
||||
class GHOST_DropTargetWin32;
|
||||
|
||||
// typedefs for WinTab functions to allow dynamic loading
|
||||
typedef UINT(API *GHOST_WIN32_WTInfo)(UINT, UINT, LPVOID);
|
||||
typedef HCTX(API *GHOST_WIN32_WTOpen)(HWND, LPLOGCONTEXTA, BOOL);
|
||||
typedef BOOL(API *GHOST_WIN32_WTClose)(HCTX);
|
||||
typedef BOOL(API *GHOST_WIN32_WTPacket)(HCTX, UINT, LPVOID);
|
||||
typedef BOOL(API *GHOST_WIN32_WTEnable)(HCTX, BOOL);
|
||||
typedef BOOL(API *GHOST_WIN32_WTOverlap)(HCTX, BOOL);
|
||||
|
||||
// typedefs for user32 functions to allow dynamic loading of Windows 10 DPI scaling functions
|
||||
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND);
|
||||
|
||||
typedef BOOL(API *GHOST_WIN32_AdjustWindowRectExForDpi)(
|
||||
LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi);
|
||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||
# define USER_DEFAULT_SCREEN_DPI 96
|
||||
#endif // USER_DEFAULT_SCREEN_DPI
|
||||
|
||||
struct GHOST_PointerInfoWin32 {
|
||||
GHOST_TInt32 pointerId;
|
||||
@@ -52,6 +65,7 @@ struct GHOST_PointerInfoWin32 {
|
||||
GHOST_TButtonMask buttonMask;
|
||||
POINT pixelLocation;
|
||||
GHOST_TUns64 time;
|
||||
|
||||
GHOST_TabletData tabletData;
|
||||
};
|
||||
|
||||
@@ -101,14 +115,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
*/
|
||||
~GHOST_WindowWin32();
|
||||
|
||||
/**
|
||||
* Adjusts a requested window rect to fit and position correctly in monitor.
|
||||
* \param win_rect: pointer to rectangle that will be modified.
|
||||
* \param dwStyle: The Window Style of the window whose required size is to be calculated.
|
||||
* \param dwExStyle: The Extended Window Style of the window.
|
||||
*/
|
||||
void adjustWindowRectForClosestMonitor(LPRECT win_rect, DWORD dwStyle, DWORD dwExStyle);
|
||||
|
||||
/**
|
||||
* Returns indication as to whether the window is valid.
|
||||
* \return The validity of the window.
|
||||
@@ -253,11 +259,16 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
HCURSOR getStandardCursor(GHOST_TStandardCursor shape) const;
|
||||
void loadCursor(bool visible, GHOST_TStandardCursor cursorShape) const;
|
||||
|
||||
const GHOST_TabletData &getTabletData()
|
||||
{
|
||||
return m_tabletData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether given tablet API should be used.
|
||||
* \param api: Tablet API to test.
|
||||
*/
|
||||
bool usingTabletAPI(GHOST_TTabletAPI api) const;
|
||||
bool useTabletAPI(GHOST_TTabletAPI api) const;
|
||||
|
||||
/**
|
||||
* Translate WM_POINTER events into GHOST_PointerInfoWin32 structs.
|
||||
@@ -270,34 +281,10 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
WPARAM wParam,
|
||||
LPARAM lParam);
|
||||
|
||||
/**
|
||||
* Resets pointer pen tablet state.
|
||||
*/
|
||||
void resetPointerPenInfo();
|
||||
|
||||
/**
|
||||
* Retrieves pointer to Wintab if Wintab is the set Tablet API.
|
||||
* \return Pointer to Wintab member.
|
||||
*/
|
||||
GHOST_Wintab *getWintab() const;
|
||||
|
||||
/**
|
||||
* Loads Wintab context for the window.
|
||||
* \param enable: True if Wintab should be enabled after loading. Wintab should not be enabled if
|
||||
* the window is minimized.
|
||||
*/
|
||||
void loadWintab(bool enable);
|
||||
|
||||
/**
|
||||
* Closes Wintab for the window.
|
||||
*/
|
||||
void closeWintab();
|
||||
|
||||
/**
|
||||
* Get the most recent Windows Pointer tablet data.
|
||||
* \return Most recent pointer tablet data.
|
||||
*/
|
||||
GHOST_TabletData getTabletData();
|
||||
void processWin32TabletActivateEvent(WORD state);
|
||||
void processWin32TabletInitEvent();
|
||||
void processWin32TabletEvent(WPARAM wParam, LPARAM lParam);
|
||||
void bringTabletContextToFront();
|
||||
|
||||
GHOST_TSuccess beginFullScreen() const
|
||||
{
|
||||
@@ -311,10 +298,10 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
|
||||
GHOST_TUns16 getDPIHint() override;
|
||||
|
||||
/** True if the mouse is either over or captured by the window. */
|
||||
bool m_mousePresent;
|
||||
/** Whether a tablet stylus is being tracked. */
|
||||
bool m_tabletInRange;
|
||||
|
||||
/** True if the window currently resizing. */
|
||||
/** if the window currently resizing */
|
||||
bool m_inLiveResize;
|
||||
|
||||
#ifdef WITH_INPUT_IME
|
||||
@@ -398,11 +385,27 @@ class GHOST_WindowWin32 : public GHOST_Window {
|
||||
static const wchar_t *s_windowClassName;
|
||||
static const int s_maxTitleLength;
|
||||
|
||||
/** Pointer to Wintab manager if Wintab is loaded. */
|
||||
GHOST_Wintab *m_wintab;
|
||||
/** Tablet data for GHOST */
|
||||
GHOST_TabletData m_tabletData;
|
||||
|
||||
/** Most recent tablet data. */
|
||||
GHOST_TabletData m_lastPointerTabletData;
|
||||
/* Wintab API */
|
||||
struct {
|
||||
/** `WinTab.dll` handle. */
|
||||
HMODULE handle = NULL;
|
||||
|
||||
/** API functions */
|
||||
GHOST_WIN32_WTInfo info;
|
||||
GHOST_WIN32_WTOpen open;
|
||||
GHOST_WIN32_WTClose close;
|
||||
GHOST_WIN32_WTPacket packet;
|
||||
GHOST_WIN32_WTEnable enable;
|
||||
GHOST_WIN32_WTOverlap overlap;
|
||||
|
||||
/** Stores the Tablet context if detected Tablet features using `WinTab.dll` */
|
||||
HCTX tablet;
|
||||
LONG maxPressure;
|
||||
LONG maxAzimuth, maxAltitude;
|
||||
} m_wintab;
|
||||
|
||||
GHOST_TWindowState m_normal_state;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user