Compare commits
490 Commits
temp-gpu-p
...
node-group
Author | SHA1 | Date | |
---|---|---|---|
fd7e8634fa | |||
![]() |
aa32121174 | ||
f2fb5b6ff2 | |||
9bff211ac9 | |||
c971c851d3 | |||
a2ccd0e495 | |||
1029577a51 | |||
05c7d935e7 | |||
8fe0aecfde | |||
ede1ce6e9a | |||
8031326262 | |||
![]() |
2beff6197e | ||
3123f33380 | |||
![]() |
a092baa7f9 | ||
5e3d0840a3 | |||
c41b93bda5 | |||
eb43477851 | |||
239a74a130 | |||
6ac378e685 | |||
25fc77f46c | |||
de2c4ee587 | |||
f23b14091f | |||
ced94bc11c | |||
7ce0d9d791 | |||
36c0649d32 | |||
66548007a8 | |||
eea65cbd42 | |||
66dfef10a7 | |||
fd9fc809b7 | |||
39b2a7bb7e | |||
4ba06ad0a8 | |||
3fb47956c0 | |||
![]() |
fafd21b14c | ||
49e68f15f2 | |||
f76dfe8fb4 | |||
524d172742 | |||
![]() |
f013e3de81 | ||
e77a1dc6b0 | |||
1b44b47f69 | |||
1a91c57320 | |||
b1bf4c2a05 | |||
48e27ad122 | |||
91e2b1dcaf | |||
5f28a90b34 | |||
97712b018d | |||
![]() |
0e8d1c6bcf | ||
320f34af86 | |||
19b597c55d | |||
f2cce48698 | |||
0eccf57161 | |||
![]() |
574995478a | ||
![]() |
57668d84cf | ||
8d5b9478a2 | |||
64bb49fa4e | |||
![]() |
178086d581 | ||
785d87ee42 | |||
c830c5b16b | |||
e850c2b06d | |||
10e28bd270 | |||
8de2b6a020 | |||
952ded57de | |||
581a6da804 | |||
63da2c4082 | |||
![]() |
22bef356ae | ||
3cfd6439c6 | |||
16804297e6 | |||
d1e1d6c491 | |||
bbcc8330f7 | |||
e7082fbdb0 | |||
ab101d444d | |||
8b0fac4116 | |||
82ff5dd911 | |||
9aa0a3f533 | |||
75e41b1279 | |||
265c3a4724 | |||
![]() |
dc8a924efa | ||
![]() |
14d5a45750 | ||
807bb450a0 | |||
bfe6b55aa7 | |||
d3445496b1 | |||
cb0b017d8f | |||
0af08cea40 | |||
e99801390c | |||
5a1b1c0ed2 | |||
207df439e1 | |||
36fb03e2b9 | |||
8ffc3ee257 | |||
aeee7f390d | |||
cf28398471 | |||
1e063a0242 | |||
b65ec08bbb | |||
![]() |
26b2a35dd4 | ||
f53ca7e41c | |||
6754d7aef6 | |||
c4f71f3193 | |||
3e4c98429b | |||
f763929486 | |||
3ea4c6b9c9 | |||
f164188a6d | |||
3e29175af3 | |||
![]() |
83b6fcc70c | ||
76a3ff70d5 | |||
c3a400b73f | |||
48a45c43e4 | |||
9e1fdd1f14 | |||
6c5f8bf5aa | |||
9471715720 | |||
75c9788c27 | |||
d218ba8009 | |||
77e927b58f | |||
fe2f43a15c | |||
59eb71afa1 | |||
0e9c04a3ea | |||
cf8ea741f2 | |||
0733926a34 | |||
24aae7ed63 | |||
3021f9b48c | |||
468765d29e | |||
9aa88a6604 | |||
b35efa932e | |||
300fe84bf0 | |||
b848d5cdf5 | |||
0a0c2c0217 | |||
45b46e5de9 | |||
582c5530b6 | |||
ebe32e01e1 | |||
07a77816a1 | |||
bae1b64525 | |||
132522cba8 | |||
ceb612a79c | |||
62a2faa7ef | |||
101a493ab5 | |||
ff01070b5c | |||
ee857cc266 | |||
ad7455cd14 | |||
83883ae66a | |||
75ae328d62 | |||
76f0ef294a | |||
72d1ddfc9c | |||
4ed029fc02 | |||
![]() |
e7a800c52f | ||
24801e0a4a | |||
fc32567cda | |||
![]() |
9eafdb985d | ||
3c8d261557 | |||
![]() |
e82c5c6607 | ||
118803893e | |||
0793ced8ad | |||
e7b441a05c | |||
53743adc29 | |||
1dcf0f9cf1 | |||
feba1fe974 | |||
c4df8ac1a4 | |||
6025897cd6 | |||
802a59a58a | |||
1ab6d5c1dc | |||
a770faa811 | |||
15cfb375a3 | |||
e78e235cc5 | |||
3ec9681ac4 | |||
23209dc8f9 | |||
038345fa56 | |||
04379b5bde | |||
38131cc5e5 | |||
f61f4c89bb | |||
e26887598f | |||
42017b006e | |||
bf5b1fa726 | |||
09b89da349 | |||
d3c454d66c | |||
![]() |
98c4224ff0 | ||
![]() |
eccd03a826 | ||
7d618b4dde | |||
a566dc25aa | |||
9d9c879f4b | |||
0cc2a72f94 | |||
3af0e1f6fd | |||
34771cc9f5 | |||
72c34068cb | |||
f52e3aa210 | |||
8925d3b7bf | |||
6bd42baaeb | |||
26b098c04f | |||
bc4f99aa86 | |||
0c83ef567c | |||
89fd3afd1e | |||
87c1c8112f | |||
8edcb3af96 | |||
ae1dc8f5f9 | |||
00c7ea68a8 | |||
788d380460 | |||
6e01b52100 | |||
f3610a23d1 | |||
28dc07a153 | |||
9473c61b36 | |||
b40e05fcd1 | |||
637731dc61 | |||
55d48defc5 | |||
a26a059244 | |||
add6fa0924 | |||
35affaa971 | |||
3feb3ce32d | |||
7898089de3 | |||
![]() |
59f9a5e6ac | ||
60fee69682 | |||
![]() |
3df40cc343 | ||
![]() |
468d59e496 | ||
709e443152 | |||
ddc7e5f1b6 | |||
e509f9c3a0 | |||
e7e5fd96c4 | |||
2e8641e45e | |||
ae30f72c80 | |||
49b798ca7e | |||
c614eadb47 | |||
757ec00f83 | |||
de913516dd | |||
c27ef1e9e8 | |||
d5e626b243 | |||
8e8a6b80cf | |||
a63a0ee24b | |||
d35b14449e | |||
41e0a5b5ed | |||
15cdcb4e90 | |||
5cd1aaf080 | |||
4be166b6b5 | |||
4e65b1ef6c | |||
ebf7673f83 | |||
093074aefe | |||
2829caa9f8 | |||
c202d38659 | |||
37a5ff4a84 | |||
2acebcae24 | |||
3de3c3c23a | |||
c9e9a42215 | |||
f0ddbcb31d | |||
7cd91a06eb | |||
efe90944ee | |||
765406cb51 | |||
2761679180 | |||
5583d51773 | |||
192f0c9e17 | |||
271f34f77e | |||
3e125d12af | |||
6644e96f01 | |||
ae379714e4 | |||
96a4b54cfb | |||
538f452ea9 | |||
2ea47057d3 | |||
209aff0a35 | |||
3b6ee8cee7 | |||
52b94049f2 | |||
2373a2196e | |||
6a0fe79db5 | |||
10428ca472 | |||
d31abfef2c | |||
6a5e1bf9a1 | |||
488690c864 | |||
d374469f4c | |||
af42b35e53 | |||
71b4a1687e | |||
25c2875e0f | |||
8839b4c32a | |||
1b4d5c7a35 | |||
f9c9e000ca | |||
7a4fc9f59d | |||
22c4323b21 | |||
7a084c2eee | |||
b90b1af25c | |||
5098678308 | |||
dc679f6247 | |||
2e7e7a6fb6 | |||
d6b1d35bf8 | |||
![]() |
bfa3dc91b7 | ||
7b6c77aa84 | |||
7b954ba7a1 | |||
5e1702e7a5 | |||
![]() |
2a41ab5e6c | ||
a072e87e04 | |||
2ea565b0ec | |||
f709f12d93 | |||
45a47142fc | |||
5f3f5db95d | |||
8e69409eed | |||
280dac323c | |||
c4f9bfcf5e | |||
2289e26fa3 | |||
0f201049b4 | |||
49a363f0e0 | |||
77a28f34d5 | |||
62d9dabc7d | |||
d5e91ae883 | |||
53cf8e83b3 | |||
c21fc1687e | |||
![]() |
d7f88982a8 | ||
f83f5ef6e7 | |||
0e8542ebb7 | |||
4c716ced09 | |||
09082f6e85 | |||
c749c24682 | |||
![]() |
c04cceb40e | ||
b69ab42982 | |||
16099c00d0 | |||
8dd941cac0 | |||
249a7e2307 | |||
8225b610dd | |||
94f1726526 | |||
07faa3c5ac | |||
d0c5c67e94 | |||
0416aa767f | |||
7592a5097c | |||
ab70133db0 | |||
af8fb707da | |||
add2815723 | |||
![]() |
4e5537d0ed | ||
80d0b68290 | |||
5d54f38949 | |||
c304807099 | |||
7d66c04841 | |||
4c8a8950cf | |||
b6a35a8153 | |||
a91212e147 | |||
3366fc265b | |||
8cab5afe46 | |||
7489427e4d | |||
c3cb565250 | |||
8346417d09 | |||
![]() |
695e025c82 | ||
51019fbfce | |||
139c3f791e | |||
54fa5041e2 | |||
2b41b2f05b | |||
f4cb3ccd9c | |||
fb98f22ddd | |||
6b0869039a | |||
13672f8b32 | |||
cffbfe5568 | |||
ecbf838fee | |||
0153e99780 | |||
77834aff22 | |||
3fe0088cab | |||
8f94724f22 | |||
89831fae0c | |||
0b1050bf09 | |||
![]() |
eccdced972 | ||
5bbbc98471 | |||
![]() |
63a8b3b972 | ||
31e6f0dc7a | |||
f85ef3d442 | |||
cd38daeff4 | |||
0521272ab3 | |||
4e80573a76 | |||
c5b2381703 | |||
45d54ea67f | |||
6ac3a10619 | |||
1657fa039d | |||
f49f406f67 | |||
![]() |
4a24c6fe37 | ||
46a261e108 | |||
40de5742af | |||
586cf8b190 | |||
933eddc9a1 | |||
c26b46ddca | |||
257bfb65b2 | |||
a069fffcc4 | |||
9182c882fe | |||
1364f1e35c | |||
563ef943c7 | |||
e2c4a4c510 | |||
5780de2ae0 | |||
fc5be0b598 | |||
a070dd8bdd | |||
1af722b819 | |||
![]() |
b05ba2ef0e | ||
7af40ccf5f | |||
8f5a4a2453 | |||
834e87af7b | |||
ae8fa7062c | |||
3382b07ad6 | |||
432bfbf7a3 | |||
36584bbc2d | |||
4eeec6e9b5 | |||
ceff86aafe | |||
cf17f7e0cc | |||
3d9ecf1cf2 | |||
0c90aa097d | |||
bf75106ae9 | |||
c94877ae3d | |||
00c6cbb985 | |||
61afbf55f1 | |||
![]() |
f3ec0d8e58 | ||
b66c21f8b0 | |||
![]() |
29d6750134 | ||
de70bcbb36 | |||
![]() |
fd0370acc2 | ||
08241b313c | |||
![]() |
0ef794b553 | ||
![]() |
83e2f8c993 | ||
![]() |
ac1ed19eae | ||
673c254c7d | |||
cadda7aa5c | |||
b8115f0c5b | |||
dac81ad71b | |||
d27db03444 | |||
![]() |
2d0b9faaf6 | ||
![]() |
32124b940e | ||
bd0de99b52 | |||
2ecc33d84b | |||
6eb8340ef4 | |||
416e006a2a | |||
92b775d319 | |||
ab6a011b3b | |||
aad8b8405c | |||
2eca9c7ed4 | |||
![]() |
2c6c1b6cc0 | ||
![]() |
c1ba68dd04 | ||
24a77745a4 | |||
fb46c047bd | |||
ded4dc7761 | |||
dc3f46d96b | |||
bb971bead9 | |||
e785569c95 | |||
c9eaf04afb | |||
a87593e62a | |||
9009ac2c3d | |||
04313f1bb5 | |||
afe7387be8 | |||
b29a8a5dfe | |||
9075f63e8f | |||
76f7b22989 | |||
dccadc9e78 | |||
5b2d2b2319 | |||
2929cfe5de | |||
f0f7282d9d | |||
b73dc36859 | |||
9b89de2571 | |||
05f970847e | |||
2d146b61d8 | |||
5f5cf21a83 | |||
55f27617cf | |||
00e30f122b | |||
82466ca2e5 | |||
0c84939117 | |||
8221d64844 | |||
5f8969bb4b | |||
a1609340b4 | |||
a96b52e37f | |||
88c855174d | |||
5a693ce9e3 | |||
bc8ae58727 | |||
01e1944cd4 | |||
29b65f5345 | |||
9f5c0ffb5e | |||
016a2707f5 | |||
841b2cea7b | |||
addb1a5c9a | |||
b39d66adde | |||
0ff1c38fcc | |||
7eecf77f0b | |||
fd1fec5600 | |||
b7b5c23b80 | |||
519c12da41 | |||
4a7951fede | |||
4617172740 | |||
a112adf16a | |||
19d19970e4 | |||
8c3855dc6e | |||
![]() |
229c0580e2 | ||
96d487b3ae | |||
aaa8ee1307 | |||
927456491a | |||
02df67875a | |||
f578e31a8e | |||
4546f176eb | |||
1e532eb37a | |||
aa112dc77c | |||
39188f3c99 | |||
930ecef9b5 | |||
753806c731 | |||
a689b5932d | |||
dba675fb65 | |||
924596abad | |||
![]() |
c1fc180861 | ||
5a64c687dd | |||
4f3ec01101 | |||
17a67bf778 | |||
ca12d70af0 | |||
5737193d81 | |||
8de8ab38f6 | |||
0e4245bc28 |
@@ -217,7 +217,7 @@ if(UNIX AND NOT (APPLE OR HAIKU))
|
|||||||
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
option(WITH_GHOST_X11 "Enable building Blender against X11 for windowing" ON)
|
||||||
mark_as_advanced(WITH_GHOST_X11)
|
mark_as_advanced(WITH_GHOST_X11)
|
||||||
|
|
||||||
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF)
|
option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing" ON)
|
||||||
mark_as_advanced(WITH_GHOST_WAYLAND)
|
mark_as_advanced(WITH_GHOST_WAYLAND)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
|
|||||||
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
if(WIN32)
|
if(WIN32 OR APPLE)
|
||||||
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
|
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
|
||||||
endif()
|
endif()
|
||||||
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
|
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
|
||||||
@@ -1705,22 +1705,18 @@ if(WITH_PYTHON)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
# Select C++17 as the standard for C++ projects.
|
||||||
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
# Make MSVC properly report the value of the __cplusplus preprocessor macro
|
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
|
||||||
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
# of the C++ standard chosen above
|
# Do not enable compiler specific language extentions.
|
||||||
if(MSVC_VERSION GREATER 1913)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
|
|
||||||
endif()
|
# Make MSVC properly report the value of the __cplusplus preprocessor macro
|
||||||
elseif(
|
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
|
||||||
CMAKE_COMPILER_IS_GNUCC OR
|
# of the C++ standard chosen above.
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
|
if(MSVC AND MSVC_VERSION GREATER 1913)
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Intel"
|
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
|
||||||
)
|
|
||||||
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Visual Studio has all standards it supports available by default
|
# Visual Studio has all standards it supports available by default
|
||||||
@@ -1915,6 +1911,7 @@ if(FIRST_RUN)
|
|||||||
info_cfg_option(WITH_IK_ITASC)
|
info_cfg_option(WITH_IK_ITASC)
|
||||||
info_cfg_option(WITH_IK_SOLVER)
|
info_cfg_option(WITH_IK_SOLVER)
|
||||||
info_cfg_option(WITH_INPUT_NDOF)
|
info_cfg_option(WITH_INPUT_NDOF)
|
||||||
|
info_cfg_option(WITH_INPUT_IME)
|
||||||
info_cfg_option(WITH_INTERNATIONAL)
|
info_cfg_option(WITH_INTERNATIONAL)
|
||||||
info_cfg_option(WITH_OPENCOLLADA)
|
info_cfg_option(WITH_OPENCOLLADA)
|
||||||
info_cfg_option(WITH_OPENCOLORIO)
|
info_cfg_option(WITH_OPENCOLORIO)
|
||||||
|
@@ -56,6 +56,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cmake/zlib.cmake)
|
include(cmake/zlib.cmake)
|
||||||
|
include(cmake/zstd.cmake)
|
||||||
include(cmake/openal.cmake)
|
include(cmake/openal.cmake)
|
||||||
include(cmake/png.cmake)
|
include(cmake/png.cmake)
|
||||||
include(cmake/jpeg.cmake)
|
include(cmake/jpeg.cmake)
|
||||||
@@ -164,6 +165,7 @@ endif()
|
|||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
include(cmake/libglu.cmake)
|
include(cmake/libglu.cmake)
|
||||||
include(cmake/mesa.cmake)
|
include(cmake/mesa.cmake)
|
||||||
|
include(cmake/wayland_protocols.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cmake/harvest.cmake)
|
include(cmake/harvest.cmake)
|
||||||
|
@@ -87,7 +87,9 @@ download_source(LIBGLU)
|
|||||||
download_source(MESA)
|
download_source(MESA)
|
||||||
download_source(NASM)
|
download_source(NASM)
|
||||||
download_source(XR_OPENXR_SDK)
|
download_source(XR_OPENXR_SDK)
|
||||||
|
download_source(WL_PROTOCOLS)
|
||||||
download_source(ISPC)
|
download_source(ISPC)
|
||||||
download_source(GMP)
|
download_source(GMP)
|
||||||
download_source(POTRACE)
|
download_source(POTRACE)
|
||||||
download_source(HARU)
|
download_source(HARU)
|
||||||
|
download_source(ZSTD)
|
||||||
|
@@ -126,6 +126,8 @@ if(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
harvest(xml2/include xml2/include "*.h")
|
harvest(xml2/include xml2/include "*.h")
|
||||||
harvest(xml2/lib xml2/lib "*.a")
|
harvest(xml2/lib xml2/lib "*.a")
|
||||||
|
|
||||||
|
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
|
||||||
else()
|
else()
|
||||||
harvest(blosc/lib openvdb/lib "*.a")
|
harvest(blosc/lib openvdb/lib "*.a")
|
||||||
harvest(xml2/lib opencollada/lib "*.a")
|
harvest(xml2/lib opencollada/lib "*.a")
|
||||||
@@ -190,6 +192,8 @@ harvest(potrace/include potrace/include "*.h")
|
|||||||
harvest(potrace/lib potrace/lib "*.a")
|
harvest(potrace/lib potrace/lib "*.a")
|
||||||
harvest(haru/include haru/include "*.h")
|
harvest(haru/include haru/include "*.h")
|
||||||
harvest(haru/lib haru/lib "*.a")
|
harvest(haru/lib haru/lib "*.a")
|
||||||
|
harvest(zstd/include zstd/include "*.h")
|
||||||
|
harvest(zstd/lib zstd/lib "*.a")
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
harvest(libglu/lib mesa/lib "*.so*")
|
harvest(libglu/lib mesa/lib "*.so*")
|
||||||
|
@@ -216,9 +216,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
|
|||||||
set(OPENVDB_HASH_TYPE MD5)
|
set(OPENVDB_HASH_TYPE MD5)
|
||||||
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
|
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
|
||||||
|
|
||||||
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
|
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
|
||||||
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
|
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
|
||||||
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
|
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
|
||||||
set(NANOVDB_HASH_TYPE MD5)
|
set(NANOVDB_HASH_TYPE MD5)
|
||||||
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
|
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
|
||||||
|
|
||||||
@@ -456,12 +456,18 @@ set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
|
|||||||
set(NASM_HASH_TYPE SHA256)
|
set(NASM_HASH_TYPE SHA256)
|
||||||
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
|
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
|
||||||
|
|
||||||
set(XR_OPENXR_SDK_VERSION 1.0.14)
|
set(XR_OPENXR_SDK_VERSION 1.0.17)
|
||||||
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||||
set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
|
set(XR_OPENXR_SDK_HASH bf0fd8828837edff01047474e90013e1)
|
||||||
set(XR_OPENXR_SDK_HASH_TYPE MD5)
|
set(XR_OPENXR_SDK_HASH_TYPE MD5)
|
||||||
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
|
||||||
|
|
||||||
|
set(WL_PROTOCOLS_VERSION 1.21)
|
||||||
|
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
|
||||||
|
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
|
||||||
|
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
|
||||||
|
set(WL_PROTOCOLS_HASH_TYPE MD5)
|
||||||
|
|
||||||
if(BLENDER_PLATFORM_ARM)
|
if(BLENDER_PLATFORM_ARM)
|
||||||
# Unreleased version with macOS arm support.
|
# Unreleased version with macOS arm support.
|
||||||
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
|
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
|
||||||
@@ -494,5 +500,11 @@ set(HARU_HASH 4f916aa49c3069b3a10850013c507460)
|
|||||||
set(HARU_HASH_TYPE MD5)
|
set(HARU_HASH_TYPE MD5)
|
||||||
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
|
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
|
||||||
|
|
||||||
|
set(ZSTD_VERSION 1.5.0)
|
||||||
|
set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
|
||||||
|
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
|
||||||
|
set(ZSTD_HASH_TYPE SHA256)
|
||||||
|
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
|
||||||
|
|
||||||
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
|
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
|
||||||
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)
|
||||||
|
27
build_files/build_environment/cmake/wayland_protocols.cmake
Normal file
27
build_files/build_environment/cmake/wayland_protocols.cmake
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
ExternalProject_Add(external_wayland_protocols
|
||||||
|
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
|
||||||
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
|
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
|
||||||
|
PREFIX ${BUILD_DIR}/wayland-protocols
|
||||||
|
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
|
||||||
|
BUILD_COMMAND ninja
|
||||||
|
INSTALL_COMMAND ninja install
|
||||||
|
)
|
51
build_files/build_environment/cmake/zstd.cmake
Normal file
51
build_files/build_environment/cmake/zstd.cmake
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
set(ZSTD_EXTRA_ARGS
|
||||||
|
-DZSTD_BUILD_PROGRAMS=OFF
|
||||||
|
-DZSTD_BUILD_SHARED=OFF
|
||||||
|
-DZSTD_BUILD_STATIC=ON
|
||||||
|
-DZSTD_BUILD_TESTS=OFF
|
||||||
|
-DZSTD_LEGACY_SUPPORT=OFF
|
||||||
|
-DZSTD_LZ4_SUPPORT=OFF
|
||||||
|
-DZSTD_LZMA_SUPPORT=OFF
|
||||||
|
-DZSTD_MULTITHREAD_SUPPORT=ON
|
||||||
|
-DZSTD_PROGRAMS_LINK_SHARED=OFF
|
||||||
|
-DZSTD_USE_STATIC_RUNTIME=OFF
|
||||||
|
-DZSTD_ZLIB_SUPPORT=OFF
|
||||||
|
)
|
||||||
|
|
||||||
|
ExternalProject_Add(external_zstd
|
||||||
|
URL file://${PACKAGE_DIR}/${ZSTD_FILE}
|
||||||
|
DOWNLOAD_DIR ${DOWNLOAD_DIR}
|
||||||
|
URL_HASH ${ZSTD_HASH_TYPE}=${ZSTD_HASH}
|
||||||
|
PREFIX ${BUILD_DIR}/zstd
|
||||||
|
SOURCE_SUBDIR build/cmake
|
||||||
|
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zstd ${DEFAULT_CMAKE_FLAGS} ${ZSTD_EXTRA_ARGS}
|
||||||
|
INSTALL_DIR ${LIBDIR}/zstd
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(BUILD_MODE STREQUAL Release)
|
||||||
|
ExternalProject_Add_Step(external_zstd after_install
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zstd/lib/zstd_static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/zstd_static${LIBEXT}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
|
||||||
|
DEPENDEES install
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
@@ -572,7 +572,7 @@ FFMPEG_FORCE_REBUILD=false
|
|||||||
FFMPEG_SKIP=false
|
FFMPEG_SKIP=false
|
||||||
_ffmpeg_list_sep=";"
|
_ffmpeg_list_sep=";"
|
||||||
|
|
||||||
XR_OPENXR_VERSION="1.0.14"
|
XR_OPENXR_VERSION="1.0.17"
|
||||||
XR_OPENXR_VERSION_SHORT="1.0"
|
XR_OPENXR_VERSION_SHORT="1.0"
|
||||||
XR_OPENXR_VERSION_MIN="1.0.8"
|
XR_OPENXR_VERSION_MIN="1.0.8"
|
||||||
XR_OPENXR_VERSION_MAX="2.0"
|
XR_OPENXR_VERSION_MAX="2.0"
|
||||||
@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
|
|||||||
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
|
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
|
||||||
|
|
||||||
NANOVDB_USE_REPO=false
|
NANOVDB_USE_REPO=false
|
||||||
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
|
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
|
||||||
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
|
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
|
||||||
|
|
||||||
ALEMBIC_USE_REPO=false
|
ALEMBIC_USE_REPO=false
|
||||||
@@ -1108,9 +1108,9 @@ FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
|
|||||||
|
|
||||||
XR_OPENXR_USE_REPO=false
|
XR_OPENXR_USE_REPO=false
|
||||||
XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz")
|
XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz")
|
||||||
#~ XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
|
XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
|
||||||
#~ XR_OPENXR_REPO_UID="5900c51562769b03bea699dc0352cae56acb6419d"
|
XR_OPENXR_REPO_UID="bf21ccb1007bb531b45d9978919a56ea5059c245"
|
||||||
#~ XR_OPENXR_REPO_BRANCH="master"
|
XR_OPENXR_REPO_BRANCH="master"
|
||||||
|
|
||||||
# C++11 is required now
|
# C++11 is required now
|
||||||
CXXFLAGS_BACK=$CXXFLAGS
|
CXXFLAGS_BACK=$CXXFLAGS
|
||||||
@@ -1128,6 +1128,7 @@ Those libraries should be available as packages in all recent distributions (opt
|
|||||||
* Basics of dev environment (cmake, gcc, svn , git, ...).
|
* Basics of dev environment (cmake, gcc, svn , git, ...).
|
||||||
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
|
||||||
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
|
||||||
|
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
|
||||||
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
|
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
|
||||||
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
|
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
|
||||||
|
|
||||||
@@ -2737,7 +2738,7 @@ _init_openvdb() {
|
|||||||
_git=false
|
_git=false
|
||||||
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
|
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
|
||||||
_inst_shortcut=$INST/openvdb
|
_inst_shortcut=$INST/openvdb
|
||||||
|
|
||||||
_openvdb_source=$OPENVDB_SOURCE
|
_openvdb_source=$OPENVDB_SOURCE
|
||||||
if [ "$WITH_NANOVDB" = true ]; then
|
if [ "$WITH_NANOVDB" = true ]; then
|
||||||
_openvdb_source=$NANOVDB_SOURCE
|
_openvdb_source=$NANOVDB_SOURCE
|
||||||
@@ -2842,7 +2843,7 @@ compile_OPENVDB() {
|
|||||||
if [ -d $INST/blosc ]; then
|
if [ -d $INST/blosc ]; then
|
||||||
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
|
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake $cmake_d ..
|
cmake $cmake_d ..
|
||||||
|
|
||||||
make -j$THREADS install
|
make -j$THREADS install
|
||||||
@@ -3839,6 +3840,7 @@ install_DEB() {
|
|||||||
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
|
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
|
||||||
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
|
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
|
||||||
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
|
||||||
|
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
|
||||||
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
|
||||||
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
|
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
|
||||||
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
|
||||||
@@ -4508,6 +4510,7 @@ install_RPM() {
|
|||||||
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
|
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
|
||||||
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
|
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
|
||||||
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
|
||||||
|
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
|
||||||
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
|
||||||
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
|
||||||
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \
|
||||||
|
@@ -68,3 +68,32 @@
|
|||||||
+
|
+
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
--- a/libavcodec/rl.c
|
||||||
|
+++ b/libavcodec/rl.c
|
||||||
|
@@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
|
||||||
|
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
|
||||||
|
{
|
||||||
|
int i, q;
|
||||||
|
- VLC_TYPE table[1500][2] = {{0}};
|
||||||
|
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
|
||||||
|
VLC vlc = { .table = table, .table_allocated = static_size };
|
||||||
|
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
|
||||||
|
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
|
||||||
|
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
|
||||||
|
int qmul = q * 2;
|
||||||
|
int qadd = (q - 1) | 1;
|
||||||
|
|
||||||
|
- if (!rl->rl_vlc[q])
|
||||||
|
+ if (!rl->rl_vlc[q]){
|
||||||
|
+ av_free(table);
|
||||||
|
return;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (q == 0) {
|
||||||
|
qmul = 1;
|
||||||
|
@@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
|
||||||
|
rl->rl_vlc[q][i].run = run;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ av_free(table);
|
||||||
|
}
|
||||||
|
@@ -8,6 +8,9 @@ IGNORE_SOURCE = (
|
|||||||
# specific source files
|
# specific source files
|
||||||
"extern/audaspace/",
|
"extern/audaspace/",
|
||||||
|
|
||||||
|
# Use for `WIN32` only.
|
||||||
|
"source/creator/blender_launcher_win32.c",
|
||||||
|
|
||||||
# specific source files
|
# specific source files
|
||||||
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
|
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
|
||||||
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",
|
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",
|
||||||
|
@@ -82,7 +82,7 @@ def create_nb_project_main():
|
|||||||
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
|
||||||
make_exe_basename = os.path.basename(make_exe)
|
make_exe_basename = os.path.basename(make_exe)
|
||||||
|
|
||||||
# --------------- NB specific
|
# --------------- NetBeans specific.
|
||||||
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
|
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
|
||||||
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
|
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
|
||||||
|
|
||||||
|
@@ -29,6 +29,7 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
|
|||||||
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
||||||
|
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||||
|
@@ -30,6 +30,7 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
|
|||||||
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
|
||||||
|
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
|
||||||
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
echo No explicit msvc version requested, autodetecting version.
|
echo No explicit msvc version requested, autodetecting version.
|
||||||
|
|
||||||
call "%~dp0\detect_msvc2017.cmd"
|
call "%~dp0\detect_msvc2019.cmd"
|
||||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||||
|
|
||||||
call "%~dp0\detect_msvc2019.cmd"
|
call "%~dp0\detect_msvc2017.cmd"
|
||||||
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
if %ERRORLEVEL% EQU 0 goto DetectionComplete
|
||||||
|
|
||||||
call "%~dp0\detect_msvc2022.cmd"
|
call "%~dp0\detect_msvc2022.cmd"
|
||||||
|
@@ -122,7 +122,7 @@ is a full-featured 3D application. It supports the entirety of the 3D pipeline -
|
|||||||
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
|
'''modeling, rigging, animation, simulation, rendering, compositing, motion tracking, and video editing.
|
||||||
|
|
||||||
Use Blender to create 3D images and animations, films and commercials, content for games, '''
|
Use Blender to create 3D images and animations, films and commercials, content for games, '''
|
||||||
r'''architectural and industrial visualizatons, and scientific visualizations.
|
r'''architectural and industrial visualizations, and scientific visualizations.
|
||||||
|
|
||||||
https://www.blender.org''')
|
https://www.blender.org''')
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ such cases, lock the interface (Render → Lock Interface or
|
|||||||
Below is an example of a mesh that is altered from a handler:
|
Below is an example of a mesh that is altered from a handler:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def frame_change_pre(scene):
|
def frame_change_pre(scene):
|
||||||
# A triangle that shifts in the z direction
|
# A triangle that shifts in the z direction
|
||||||
zshift = scene.frame_current * 0.1
|
zshift = scene.frame_current * 0.1
|
||||||
|
@@ -16,10 +16,12 @@ execution_queue = queue.Queue()
|
|||||||
def run_in_main_thread(function):
|
def run_in_main_thread(function):
|
||||||
execution_queue.put(function)
|
execution_queue.put(function)
|
||||||
|
|
||||||
|
|
||||||
def execute_queued_functions():
|
def execute_queued_functions():
|
||||||
while not execution_queue.empty():
|
while not execution_queue.empty():
|
||||||
function = execution_queue.get()
|
function = execution_queue.get()
|
||||||
function()
|
function()
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
||||||
|
|
||||||
bpy.app.timers.register(execute_queued_functions)
|
bpy.app.timers.register(execute_queued_functions)
|
||||||
|
@@ -31,11 +31,13 @@ owner = object()
|
|||||||
|
|
||||||
subscribe_to = bpy.context.object.location
|
subscribe_to = bpy.context.object.location
|
||||||
|
|
||||||
|
|
||||||
def msgbus_callback(*args):
|
def msgbus_callback(*args):
|
||||||
# This will print:
|
# This will print:
|
||||||
# Something changed! (1, 2, 3)
|
# Something changed! (1, 2, 3)
|
||||||
print("Something changed!", args)
|
print("Something changed!", args)
|
||||||
|
|
||||||
|
|
||||||
bpy.msgbus.subscribe_rna(
|
bpy.msgbus.subscribe_rna(
|
||||||
key=subscribe_to,
|
key=subscribe_to,
|
||||||
owner=owner,
|
owner=owner,
|
||||||
|
@@ -44,7 +44,7 @@ class OBJECT_OT_object_to_curve(bpy.types.Operator):
|
|||||||
# Remove temporary curve.
|
# Remove temporary curve.
|
||||||
obj.to_curve_clear()
|
obj.to_curve_clear()
|
||||||
# Invoke to_curve() with applying modifiers.
|
# Invoke to_curve() with applying modifiers.
|
||||||
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers = True)
|
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers=True)
|
||||||
self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.")
|
self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.")
|
||||||
# Remove temporary curve.
|
# Remove temporary curve.
|
||||||
obj.to_curve_clear()
|
obj.to_curve_clear()
|
||||||
|
@@ -21,6 +21,7 @@ batch = batch_for_shader(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def draw():
|
def draw():
|
||||||
shader.bind()
|
shader.bind()
|
||||||
shader.uniform_sampler("image", texture)
|
shader.uniform_sampler("image", texture)
|
||||||
|
@@ -1047,6 +1047,7 @@ context_type_map = {
|
|||||||
"annotation_data": ("GreasePencil", False),
|
"annotation_data": ("GreasePencil", False),
|
||||||
"annotation_data_owner": ("ID", False),
|
"annotation_data_owner": ("ID", False),
|
||||||
"armature": ("Armature", False),
|
"armature": ("Armature", False),
|
||||||
|
"asset_library": ("AssetLibraryReference", False),
|
||||||
"bone": ("Bone", False),
|
"bone": ("Bone", False),
|
||||||
"brush": ("Brush", False),
|
"brush": ("Brush", False),
|
||||||
"camera": ("Camera", False),
|
"camera": ("Camera", False),
|
||||||
@@ -1113,6 +1114,7 @@ context_type_map = {
|
|||||||
"texture_slot": ("MaterialTextureSlot", False),
|
"texture_slot": ("MaterialTextureSlot", False),
|
||||||
"texture_user": ("ID", False),
|
"texture_user": ("ID", False),
|
||||||
"texture_user_property": ("Property", False),
|
"texture_user_property": ("Property", False),
|
||||||
|
"ui_list": ("UIList", False),
|
||||||
"vertex_paint_object": ("Object", False),
|
"vertex_paint_object": ("Object", False),
|
||||||
"view_layer": ("ViewLayer", False),
|
"view_layer": ("ViewLayer", False),
|
||||||
"visible_bones": ("EditBone", True),
|
"visible_bones": ("EditBone", True),
|
||||||
|
@@ -265,6 +265,12 @@ protected:
|
|||||||
*/
|
*/
|
||||||
void setSpecs(Specs specs);
|
void setSpecs(Specs specs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the audio output specification of the device.
|
||||||
|
* \param specs The output specification.
|
||||||
|
*/
|
||||||
|
void setSpecs(DeviceSpecs specs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty default constructor. To setup the device call the function create()
|
* Empty default constructor. To setup the device call the function create()
|
||||||
* and to uninitialize call destroy().
|
* and to uninitialize call destroy().
|
||||||
|
6
extern/audaspace/include/respec/Mixer.h
vendored
6
extern/audaspace/include/respec/Mixer.h
vendored
@@ -87,6 +87,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setSpecs(Specs specs);
|
void setSpecs(Specs specs);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the target specification for superposing.
|
||||||
|
* \param specs The target specification.
|
||||||
|
*/
|
||||||
|
void setSpecs(DeviceSpecs specs);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mixes a buffer.
|
* Mixes a buffer.
|
||||||
* \param buffer The buffer to superpose.
|
* \param buffer The buffer to superpose.
|
||||||
|
@@ -78,6 +78,7 @@ void PulseAudioDevice::runMixingThread()
|
|||||||
if(shouldStop())
|
if(shouldStop())
|
||||||
{
|
{
|
||||||
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
|
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
|
||||||
|
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
|
||||||
doStop();
|
doStop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -86,7 +87,10 @@ void PulseAudioDevice::runMixingThread()
|
|||||||
if(AUD_pa_stream_is_corked(m_stream))
|
if(AUD_pa_stream_is_corked(m_stream))
|
||||||
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
|
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
|
||||||
|
|
||||||
AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
|
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
|
||||||
|
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
|
||||||
|
AUD_pa_mainloop_poll(m_mainloop);
|
||||||
|
AUD_pa_mainloop_dispatch(m_mainloop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ PULSEAUDIO_SYMBOL(pa_context_unref);
|
|||||||
PULSEAUDIO_SYMBOL(pa_stream_begin_write);
|
PULSEAUDIO_SYMBOL(pa_stream_begin_write);
|
||||||
PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
|
PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
|
||||||
PULSEAUDIO_SYMBOL(pa_stream_cork);
|
PULSEAUDIO_SYMBOL(pa_stream_cork);
|
||||||
|
PULSEAUDIO_SYMBOL(pa_stream_flush);
|
||||||
PULSEAUDIO_SYMBOL(pa_stream_is_corked);
|
PULSEAUDIO_SYMBOL(pa_stream_is_corked);
|
||||||
PULSEAUDIO_SYMBOL(pa_stream_new);
|
PULSEAUDIO_SYMBOL(pa_stream_new);
|
||||||
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
|
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
|
||||||
@@ -35,3 +36,6 @@ PULSEAUDIO_SYMBOL(pa_mainloop_free);
|
|||||||
PULSEAUDIO_SYMBOL(pa_mainloop_get_api);
|
PULSEAUDIO_SYMBOL(pa_mainloop_get_api);
|
||||||
PULSEAUDIO_SYMBOL(pa_mainloop_new);
|
PULSEAUDIO_SYMBOL(pa_mainloop_new);
|
||||||
PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
|
PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
|
||||||
|
PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
|
||||||
|
PULSEAUDIO_SYMBOL(pa_mainloop_poll);
|
||||||
|
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);
|
||||||
|
199
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
199
extern/audaspace/plugins/wasapi/WASAPIDevice.cpp
vendored
@@ -31,65 +31,81 @@ template <class T> void SafeRelease(T **ppT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WASAPIDevice::runMixingThread()
|
HRESULT WASAPIDevice::setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size)
|
||||||
{
|
{
|
||||||
UINT32 buffer_size;
|
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
|
||||||
|
|
||||||
UINT32 padding;
|
UINT32 padding;
|
||||||
UINT32 length;
|
UINT32 length;
|
||||||
data_t* buffer;
|
data_t* buffer;
|
||||||
|
|
||||||
IAudioRenderClient* render_client = nullptr;
|
HRESULT result;
|
||||||
|
|
||||||
{
|
if(FAILED(result = m_audio_client->GetBufferSize(&buffer_size)))
|
||||||
std::lock_guard<ILockable> lock(*this);
|
return result;
|
||||||
|
|
||||||
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
|
if(FAILED(result = m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
|
||||||
|
return result;
|
||||||
|
|
||||||
if(FAILED(m_audio_client->GetBufferSize(&buffer_size)))
|
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
|
||||||
goto init_error;
|
return result;
|
||||||
|
|
||||||
if(FAILED(m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
|
length = buffer_size - padding;
|
||||||
goto init_error;
|
|
||||||
|
|
||||||
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
|
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
|
||||||
goto init_error;
|
return result;
|
||||||
|
|
||||||
length = buffer_size - padding;
|
mix((data_t*)buffer, length);
|
||||||
|
|
||||||
if(FAILED(render_client->GetBuffer(length, &buffer)))
|
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
|
||||||
goto init_error;
|
return result;
|
||||||
|
|
||||||
mix((data_t*)buffer, length);
|
|
||||||
|
|
||||||
if(FAILED(render_client->ReleaseBuffer(length, 0)))
|
|
||||||
{
|
|
||||||
init_error:
|
|
||||||
SafeRelease(&render_client);
|
|
||||||
doStop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_audio_client->Start();
|
m_audio_client->Start();
|
||||||
|
|
||||||
auto sleepDuration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WASAPIDevice::runMixingThread()
|
||||||
|
{
|
||||||
|
UINT32 buffer_size;
|
||||||
|
|
||||||
|
IAudioRenderClient* render_client = nullptr;
|
||||||
|
|
||||||
|
std::chrono::milliseconds sleep_duration;
|
||||||
|
|
||||||
|
bool run_init = true;
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
HRESULT result = S_OK;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
UINT32 padding;
|
||||||
|
UINT32 length;
|
||||||
|
data_t* buffer;
|
||||||
std::lock_guard<ILockable> lock(*this);
|
std::lock_guard<ILockable> lock(*this);
|
||||||
|
|
||||||
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
|
if(run_init)
|
||||||
|
{
|
||||||
|
result = setupRenderClient(render_client, buffer_size);
|
||||||
|
|
||||||
|
if(FAILED(result))
|
||||||
|
goto stop_thread;
|
||||||
|
|
||||||
|
sleep_duration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
|
||||||
goto stop_thread;
|
goto stop_thread;
|
||||||
|
|
||||||
length = buffer_size - padding;
|
length = buffer_size - padding;
|
||||||
|
|
||||||
if(FAILED(render_client->GetBuffer(length, &buffer)))
|
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
|
||||||
goto stop_thread;
|
goto stop_thread;
|
||||||
|
|
||||||
mix((data_t*)buffer, length);
|
mix((data_t*)buffer, length);
|
||||||
|
|
||||||
if(FAILED(render_client->ReleaseBuffer(length, 0)))
|
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
|
||||||
goto stop_thread;
|
goto stop_thread;
|
||||||
|
|
||||||
// stop thread
|
// stop thread
|
||||||
@@ -98,53 +114,51 @@ void WASAPIDevice::runMixingThread()
|
|||||||
stop_thread:
|
stop_thread:
|
||||||
m_audio_client->Stop();
|
m_audio_client->Stop();
|
||||||
SafeRelease(&render_client);
|
SafeRelease(&render_client);
|
||||||
doStop();
|
|
||||||
return;
|
if(result == AUDCLNT_E_DEVICE_INVALIDATED)
|
||||||
|
{
|
||||||
|
DeviceSpecs specs = m_specs;
|
||||||
|
if(!setupDevice(specs))
|
||||||
|
result = S_FALSE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setSpecs(specs);
|
||||||
|
|
||||||
|
run_init = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(result != AUDCLNT_E_DEVICE_INVALIDATED)
|
||||||
|
{
|
||||||
|
doStop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::this_thread::sleep_for(sleepDuration);
|
std::this_thread::sleep_for(sleep_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
|
||||||
m_imm_device_enumerator(nullptr),
|
|
||||||
m_imm_device(nullptr),
|
|
||||||
m_audio_client(nullptr),
|
|
||||||
|
|
||||||
m_wave_format_extensible({})
|
|
||||||
{
|
{
|
||||||
// initialize COM if it hasn't happened yet
|
SafeRelease(&m_audio_client);
|
||||||
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
SafeRelease(&m_imm_device);
|
||||||
|
|
||||||
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
|
||||||
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
|
|
||||||
const IID IID_IAudioClient = __uuidof(IAudioClient);
|
const IID IID_IAudioClient = __uuidof(IAudioClient);
|
||||||
|
|
||||||
|
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
|
||||||
|
return false;
|
||||||
|
|
||||||
WAVEFORMATEXTENSIBLE wave_format_extensible_closest_match;
|
WAVEFORMATEXTENSIBLE wave_format_extensible_closest_match;
|
||||||
WAVEFORMATEXTENSIBLE* closest_match_pointer = &wave_format_extensible_closest_match;
|
WAVEFORMATEXTENSIBLE* closest_match_pointer = &wave_format_extensible_closest_match;
|
||||||
|
|
||||||
HRESULT result;
|
|
||||||
|
|
||||||
REFERENCE_TIME minimum_time = 0;
|
REFERENCE_TIME minimum_time = 0;
|
||||||
REFERENCE_TIME buffer_duration;
|
REFERENCE_TIME buffer_duration;
|
||||||
|
|
||||||
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if(specs.channels == CHANNELS_INVALID)
|
|
||||||
specs.channels = CHANNELS_STEREO;
|
|
||||||
if(specs.format == FORMAT_INVALID)
|
|
||||||
specs.format = FORMAT_FLOAT32;
|
|
||||||
if(specs.rate == RATE_INVALID)
|
|
||||||
specs.rate = RATE_48000;
|
|
||||||
|
|
||||||
switch(specs.format)
|
switch(specs.format)
|
||||||
{
|
{
|
||||||
case FORMAT_U8:
|
case FORMAT_U8:
|
||||||
@@ -203,12 +217,14 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
|||||||
m_wave_format_extensible.Format.cbSize = 22;
|
m_wave_format_extensible.Format.cbSize = 22;
|
||||||
m_wave_format_extensible.Samples.wValidBitsPerSample = m_wave_format_extensible.Format.wBitsPerSample;
|
m_wave_format_extensible.Samples.wValidBitsPerSample = m_wave_format_extensible.Format.wBitsPerSample;
|
||||||
|
|
||||||
result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
|
HRESULT result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
|
||||||
|
|
||||||
if(result == S_FALSE)
|
if(result == S_FALSE)
|
||||||
{
|
{
|
||||||
|
bool errored = false;
|
||||||
|
|
||||||
if(closest_match_pointer->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
if(closest_match_pointer->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
||||||
goto error;
|
goto closest_match_error;
|
||||||
|
|
||||||
specs.channels = Channels(closest_match_pointer->Format.nChannels);
|
specs.channels = Channels(closest_match_pointer->Format.nChannels);
|
||||||
specs.rate = closest_match_pointer->Format.nSamplesPerSec;
|
specs.rate = closest_match_pointer->Format.nSamplesPerSec;
|
||||||
@@ -220,7 +236,7 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
|||||||
else if(closest_match_pointer->Format.wBitsPerSample == 64)
|
else if(closest_match_pointer->Format.wBitsPerSample == 64)
|
||||||
specs.format = FORMAT_FLOAT64;
|
specs.format = FORMAT_FLOAT64;
|
||||||
else
|
else
|
||||||
goto error;
|
goto closest_match_error;
|
||||||
}
|
}
|
||||||
else if(closest_match_pointer->SubFormat == KSDATAFORMAT_SUBTYPE_PCM)
|
else if(closest_match_pointer->SubFormat == KSDATAFORMAT_SUBTYPE_PCM)
|
||||||
{
|
{
|
||||||
@@ -239,44 +255,81 @@ WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
|||||||
specs.format = FORMAT_S32;
|
specs.format = FORMAT_S32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto error;
|
goto closest_match_error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto error;
|
goto closest_match_error;
|
||||||
|
|
||||||
m_wave_format_extensible = *closest_match_pointer;
|
m_wave_format_extensible = *closest_match_pointer;
|
||||||
|
|
||||||
|
if(false)
|
||||||
|
{
|
||||||
|
closest_match_error:
|
||||||
|
errored = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(closest_match_pointer != &wave_format_extensible_closest_match)
|
if(closest_match_pointer != &wave_format_extensible_closest_match)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(closest_match_pointer);
|
CoTaskMemFree(closest_match_pointer);
|
||||||
closest_match_pointer = &wave_format_extensible_closest_match;
|
closest_match_pointer = &wave_format_extensible_closest_match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(errored)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if(FAILED(result))
|
else if(FAILED(result))
|
||||||
goto error;
|
return false;
|
||||||
|
|
||||||
if(FAILED(m_audio_client->GetDevicePeriod(nullptr, &minimum_time)))
|
if(FAILED(m_audio_client->GetDevicePeriod(nullptr, &minimum_time)))
|
||||||
goto error;
|
return false;
|
||||||
|
|
||||||
buffer_duration = REFERENCE_TIME(buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
|
buffer_duration = REFERENCE_TIME(m_buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
|
||||||
|
|
||||||
if(minimum_time > buffer_duration)
|
if(minimum_time > buffer_duration)
|
||||||
buffer_duration = minimum_time;
|
buffer_duration = minimum_time;
|
||||||
|
|
||||||
m_specs = specs;
|
|
||||||
|
|
||||||
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
|
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
|
||||||
|
m_buffersize(buffersize),
|
||||||
|
m_imm_device_enumerator(nullptr),
|
||||||
|
m_imm_device(nullptr),
|
||||||
|
m_audio_client(nullptr),
|
||||||
|
|
||||||
|
m_wave_format_extensible({})
|
||||||
|
{
|
||||||
|
// initialize COM if it hasn't happened yet
|
||||||
|
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||||
|
|
||||||
|
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
|
||||||
|
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
|
||||||
|
|
||||||
|
if(specs.channels == CHANNELS_INVALID)
|
||||||
|
specs.channels = CHANNELS_STEREO;
|
||||||
|
if(specs.format == FORMAT_INVALID)
|
||||||
|
specs.format = FORMAT_FLOAT32;
|
||||||
|
if(specs.rate == RATE_INVALID)
|
||||||
|
specs.rate = RATE_48000;
|
||||||
|
|
||||||
|
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
if(!setupDevice(specs))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
m_specs = specs;
|
||||||
|
|
||||||
create();
|
create();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if(closest_match_pointer != &wave_format_extensible_closest_match)
|
|
||||||
CoTaskMemFree(closest_match_pointer);
|
|
||||||
SafeRelease(&m_imm_device);
|
SafeRelease(&m_imm_device);
|
||||||
SafeRelease(&m_imm_device_enumerator);
|
SafeRelease(&m_imm_device_enumerator);
|
||||||
SafeRelease(&m_audio_client);
|
SafeRelease(&m_audio_client);
|
||||||
|
@@ -43,16 +43,21 @@ AUD_NAMESPACE_BEGIN
|
|||||||
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
|
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
int m_buffersize;
|
||||||
IMMDeviceEnumerator* m_imm_device_enumerator;
|
IMMDeviceEnumerator* m_imm_device_enumerator;
|
||||||
IMMDevice* m_imm_device;
|
IMMDevice* m_imm_device;
|
||||||
IAudioClient* m_audio_client;
|
IAudioClient* m_audio_client;
|
||||||
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
|
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
|
||||||
|
|
||||||
|
AUD_LOCAL HRESULT setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streaming thread main function.
|
* Streaming thread main function.
|
||||||
*/
|
*/
|
||||||
AUD_LOCAL void runMixingThread();
|
AUD_LOCAL void runMixingThread();
|
||||||
|
|
||||||
|
AUD_LOCAL bool setupDevice(DeviceSpecs& specs);
|
||||||
|
|
||||||
// delete copy constructor and operator=
|
// delete copy constructor and operator=
|
||||||
WASAPIDevice(const WASAPIDevice&) = delete;
|
WASAPIDevice(const WASAPIDevice&) = delete;
|
||||||
WASAPIDevice& operator=(const WASAPIDevice&) = delete;
|
WASAPIDevice& operator=(const WASAPIDevice&) = delete;
|
||||||
|
22
extern/audaspace/src/devices/SoftwareDevice.cpp
vendored
22
extern/audaspace/src/devices/SoftwareDevice.cpp
vendored
@@ -756,6 +756,7 @@ void SoftwareDevice::mix(data_t* buffer, int length)
|
|||||||
// get the buffer from the source
|
// get the buffer from the source
|
||||||
pos = 0;
|
pos = 0;
|
||||||
len = length;
|
len = length;
|
||||||
|
eos = false;
|
||||||
|
|
||||||
// update 3D Info
|
// update 3D Info
|
||||||
sound->update();
|
sound->update();
|
||||||
@@ -842,6 +843,27 @@ void SoftwareDevice::setSpecs(Specs specs)
|
|||||||
{
|
{
|
||||||
sound->setSpecs(specs);
|
sound->setSpecs(specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(auto& sound : m_pausedSounds)
|
||||||
|
{
|
||||||
|
sound->setSpecs(specs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SoftwareDevice::setSpecs(DeviceSpecs specs)
|
||||||
|
{
|
||||||
|
m_specs = specs;
|
||||||
|
m_mixer->setSpecs(specs);
|
||||||
|
|
||||||
|
for(auto& sound : m_playingSounds)
|
||||||
|
{
|
||||||
|
sound->setSpecs(specs.specs);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto& sound : m_pausedSounds)
|
||||||
|
{
|
||||||
|
sound->setSpecs(specs.specs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SoftwareDevice::SoftwareDevice()
|
SoftwareDevice::SoftwareDevice()
|
||||||
|
30
extern/audaspace/src/respec/Mixer.cpp
vendored
30
extern/audaspace/src/respec/Mixer.cpp
vendored
@@ -21,9 +21,25 @@
|
|||||||
|
|
||||||
AUD_NAMESPACE_BEGIN
|
AUD_NAMESPACE_BEGIN
|
||||||
|
|
||||||
Mixer::Mixer(DeviceSpecs specs) :
|
Mixer::Mixer(DeviceSpecs specs)
|
||||||
m_specs(specs)
|
|
||||||
{
|
{
|
||||||
|
setSpecs(specs);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceSpecs Mixer::getSpecs() const
|
||||||
|
{
|
||||||
|
return m_specs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mixer::setSpecs(Specs specs)
|
||||||
|
{
|
||||||
|
m_specs.specs = specs;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mixer::setSpecs(DeviceSpecs specs)
|
||||||
|
{
|
||||||
|
m_specs = specs;
|
||||||
|
|
||||||
switch(m_specs.format)
|
switch(m_specs.format)
|
||||||
{
|
{
|
||||||
case FORMAT_U8:
|
case FORMAT_U8:
|
||||||
@@ -54,16 +70,6 @@ Mixer::Mixer(DeviceSpecs specs) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceSpecs Mixer::getSpecs() const
|
|
||||||
{
|
|
||||||
return m_specs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mixer::setSpecs(Specs specs)
|
|
||||||
{
|
|
||||||
m_specs.specs = specs;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Mixer::clear(int length)
|
void Mixer::clear(int length)
|
||||||
{
|
{
|
||||||
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
|
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
|
||||||
|
1
extern/glog/README.blender
vendored
1
extern/glog/README.blender
vendored
@@ -7,3 +7,4 @@ Local modifications:
|
|||||||
checks for functions and so are needed.
|
checks for functions and so are needed.
|
||||||
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
|
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
|
||||||
in Windows' specific config.h.
|
in Windows' specific config.h.
|
||||||
|
* Silenced syscall deprecation warnings on macOS >= 10.12.
|
||||||
|
2
extern/glog/src/raw_logging.cc
vendored
2
extern/glog/src/raw_logging.cc
vendored
@@ -59,7 +59,7 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)
|
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && (!(defined OS_MACOSX))
|
||||||
# define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
|
# define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
|
||||||
#else
|
#else
|
||||||
// Not so safe, but what can you do?
|
// Not so safe, but what can you do?
|
||||||
|
6
extern/glog/src/utilities.cc
vendored
6
extern/glog/src/utilities.cc
vendored
@@ -259,7 +259,13 @@ pid_t GetTID() {
|
|||||||
#endif
|
#endif
|
||||||
static bool lacks_gettid = false;
|
static bool lacks_gettid = false;
|
||||||
if (!lacks_gettid) {
|
if (!lacks_gettid) {
|
||||||
|
#ifdef OS_MACOSX
|
||||||
|
uint64_t tid64;
|
||||||
|
const int error = pthread_threadid_np(NULL, &tid64);
|
||||||
|
pid_t tid = error ? -1 : (pid_t)tid64;
|
||||||
|
#else
|
||||||
pid_t tid = syscall(__NR_gettid);
|
pid_t tid = syscall(__NR_gettid);
|
||||||
|
#endif
|
||||||
if (tid != -1) {
|
if (tid != -1) {
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
2
extern/rangetree/intern/generic_alloc_impl.h
vendored
2
extern/rangetree/intern/generic_alloc_impl.h
vendored
@@ -32,7 +32,7 @@
|
|||||||
* - #TPOOL_STRUCT: Name for pool struct name.
|
* - #TPOOL_STRUCT: Name for pool struct name.
|
||||||
* - #TPOOL_CHUNK_SIZE: Chunk size (optional), use 64kb when not defined.
|
* - #TPOOL_CHUNK_SIZE: Chunk size (optional), use 64kb when not defined.
|
||||||
*
|
*
|
||||||
* \note #TPOOL_ALLOC_TYPE must be at least ``sizeof(void *)``.
|
* \note #TPOOL_ALLOC_TYPE must be at least `sizeof(void *)`.
|
||||||
*
|
*
|
||||||
* Defines the API, uses #TPOOL_IMPL_PREFIX to prefix each function.
|
* Defines the API, uses #TPOOL_IMPL_PREFIX to prefix each function.
|
||||||
*
|
*
|
||||||
|
@@ -49,9 +49,9 @@
|
|||||||
|
|
||||||
#include "atomic_ops_utils.h"
|
#include "atomic_ops_utils.h"
|
||||||
|
|
||||||
#if defined(__arm__)
|
#if defined(__arm__) || defined(__riscv)
|
||||||
/* Attempt to fix compilation error on Debian armel kernel.
|
/* Attempt to fix compilation error on Debian armel and RISC-V kernels.
|
||||||
* arm7 architecture does have both 32 and 64bit atomics, however
|
* Both architectures do have both 32 and 64bit atomics, however
|
||||||
* its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
|
* its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
|
||||||
*/
|
*/
|
||||||
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
|
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1
|
||||||
|
@@ -482,7 +482,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
|||||||
|
|
||||||
transparent_max_bounces: IntProperty(
|
transparent_max_bounces: IntProperty(
|
||||||
name="Transparent Max Bounces",
|
name="Transparent Max Bounces",
|
||||||
description="Maximum number of transparent bounces",
|
description="Maximum number of transparent bounces. This is independent of maximum number of other bounces ",
|
||||||
min=0, max=1024,
|
min=0, max=1024,
|
||||||
default=8,
|
default=8,
|
||||||
)
|
)
|
||||||
|
@@ -485,10 +485,12 @@ class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
|
|||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
col.prop(cscene, "diffuse_bounces", text="Diffuse")
|
col.prop(cscene, "diffuse_bounces", text="Diffuse")
|
||||||
col.prop(cscene, "glossy_bounces", text="Glossy")
|
col.prop(cscene, "glossy_bounces", text="Glossy")
|
||||||
col.prop(cscene, "transparent_max_bounces", text="Transparency")
|
|
||||||
col.prop(cscene, "transmission_bounces", text="Transmission")
|
col.prop(cscene, "transmission_bounces", text="Transmission")
|
||||||
col.prop(cscene, "volume_bounces", text="Volume")
|
col.prop(cscene, "volume_bounces", text="Volume")
|
||||||
|
|
||||||
|
col = layout.column(align=True)
|
||||||
|
col.prop(cscene, "transparent_max_bounces", text="Transparent")
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_RENDER_PT_light_paths_clamping(CyclesButtonsPanel, Panel):
|
class CYCLES_RENDER_PT_light_paths_clamping(CyclesButtonsPanel, Panel):
|
||||||
bl_label = "Clamping"
|
bl_label = "Clamping"
|
||||||
@@ -1134,7 +1136,7 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
|
|||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.operator("object.material_slot_add", icon='ADD', text="")
|
col.operator("object.material_slot_add", icon='ADD', text="")
|
||||||
col.operator("object.material_slot_remove", icon='REMOVE', text="")
|
col.operator("object.material_slot_remove", icon='REMOVE', text="")
|
||||||
|
col.separator()
|
||||||
col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="")
|
col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="")
|
||||||
|
|
||||||
if is_sortable:
|
if is_sortable:
|
||||||
@@ -1149,16 +1151,15 @@ class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
|
|||||||
row.operator("object.material_slot_select", text="Select")
|
row.operator("object.material_slot_select", text="Select")
|
||||||
row.operator("object.material_slot_deselect", text="Deselect")
|
row.operator("object.material_slot_deselect", text="Deselect")
|
||||||
|
|
||||||
split = layout.split(factor=0.65)
|
row = layout.row()
|
||||||
|
|
||||||
if ob:
|
if ob:
|
||||||
split.template_ID(ob, "active_material", new="material.new")
|
row.template_ID(ob, "active_material", new="material.new")
|
||||||
row = split.row()
|
|
||||||
|
|
||||||
if slot:
|
if slot:
|
||||||
row.prop(slot, "link", text="")
|
icon_link = 'MESH_DATA' if slot.link == 'DATA' else 'OBJECT_DATA'
|
||||||
else:
|
row.prop(slot, "link", text="", icon=icon_link, icon_only=True)
|
||||||
row.label()
|
|
||||||
elif mat:
|
elif mat:
|
||||||
split.template_ID(space, "pin_id")
|
split.template_ID(space, "pin_id")
|
||||||
split.separator()
|
split.separator()
|
||||||
|
@@ -137,9 +137,9 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
|
|||||||
/* Premultiply, byte images are always straight for Blender. */
|
/* Premultiply, byte images are always straight for Blender. */
|
||||||
unsigned char *cp = (unsigned char *)pixels;
|
unsigned char *cp = (unsigned char *)pixels;
|
||||||
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
|
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
|
||||||
cp[0] = (cp[0] * cp[3]) >> 8;
|
cp[0] = (cp[0] * cp[3]) / 255;
|
||||||
cp[1] = (cp[1] * cp[3]) >> 8;
|
cp[1] = (cp[1] * cp[3]) / 255;
|
||||||
cp[2] = (cp[2] * cp[3]) >> 8;
|
cp[2] = (cp[2] * cp[3]) / 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -109,23 +109,23 @@ void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
Geometry *geom = object->get_geometry();
|
Geometry *geom = object->get_geometry();
|
||||||
geom->set_use_motion_blur(false);
|
|
||||||
geom->set_motion_steps(0);
|
|
||||||
|
|
||||||
uint motion_steps;
|
int motion_steps = 0;
|
||||||
|
bool use_motion_blur = false;
|
||||||
|
|
||||||
if (need_motion == Scene::MOTION_BLUR) {
|
if (need_motion == Scene::MOTION_BLUR) {
|
||||||
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
|
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
|
||||||
geom->set_motion_steps(motion_steps);
|
|
||||||
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
|
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
|
||||||
geom->set_use_motion_blur(true);
|
use_motion_blur = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
motion_steps = 3;
|
motion_steps = 3;
|
||||||
geom->set_motion_steps(motion_steps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
geom->set_use_motion_blur(use_motion_blur);
|
||||||
|
geom->set_motion_steps(motion_steps);
|
||||||
|
|
||||||
motion.resize(motion_steps, transform_empty());
|
motion.resize(motion_steps, transform_empty());
|
||||||
|
|
||||||
if (motion_steps) {
|
if (motion_steps) {
|
||||||
|
@@ -404,8 +404,6 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
|
|||||||
|
|
||||||
Film *film = scene->film;
|
Film *film = scene->film;
|
||||||
|
|
||||||
vector<Pass> prevpasses = scene->passes;
|
|
||||||
|
|
||||||
if (b_v3d) {
|
if (b_v3d) {
|
||||||
film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
|
film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
|
||||||
}
|
}
|
||||||
@@ -435,11 +433,6 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Pass::equals(prevpasses, scene->passes)) {
|
|
||||||
film->tag_passes_update(scene, prevpasses, false);
|
|
||||||
film->tag_modified();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Render Layer */
|
/* Render Layer */
|
||||||
@@ -749,10 +742,13 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
|
|||||||
DENOISING_CLEAN_ALL_PASSES);
|
DENOISING_CLEAN_ALL_PASSES);
|
||||||
scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
|
scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
|
||||||
denoising.type == DENOISER_NLM);
|
denoising.type == DENOISER_NLM);
|
||||||
|
|
||||||
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
|
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
|
||||||
scene->film->tag_passes_update(scene, passes);
|
|
||||||
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
|
if (!Pass::equals(passes, scene->passes)) {
|
||||||
|
scene->film->tag_passes_update(scene, passes);
|
||||||
|
scene->film->tag_modified();
|
||||||
|
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
|
||||||
|
}
|
||||||
|
|
||||||
return passes;
|
return passes;
|
||||||
}
|
}
|
||||||
|
@@ -40,8 +40,8 @@ BlenderViewportParameters::BlenderViewportParameters(BL::SpaceView3D &b_v3d)
|
|||||||
BL::View3DShading shading = b_v3d.shading();
|
BL::View3DShading shading = b_v3d.shading();
|
||||||
PointerRNA cshading = RNA_pointer_get(&shading.ptr, "cycles");
|
PointerRNA cshading = RNA_pointer_get(&shading.ptr, "cycles");
|
||||||
|
|
||||||
/* We only copy the shading parameters if we are in look dev mode. otherwise
|
/* We only copy the shading parameters if we are in look-dev mode.
|
||||||
* defaults are being used. These defaults mimic normal render settings */
|
* Otherwise defaults are being used. These defaults mimic normal render settings. */
|
||||||
if (shading.type() == BL::View3DShading::type_RENDERED) {
|
if (shading.type() == BL::View3DShading::type_RENDERED) {
|
||||||
use_scene_world = shading.use_scene_world_render();
|
use_scene_world = shading.use_scene_world_render();
|
||||||
use_scene_lights = shading.use_scene_lights_render();
|
use_scene_lights = shading.use_scene_lights_render();
|
||||||
|
@@ -86,8 +86,7 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd
|
|||||||
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
|
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 */
|
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
|
||||||
|
|
||||||
n = normalize(
|
object_normal_transform(kg, sd, &n); /* Normal x scale, world space */
|
||||||
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
|
|
||||||
|
|
||||||
/* Parabolic approximation */
|
/* Parabolic approximation */
|
||||||
float a = dot(N[2] - N[0], V[0] - V[2]);
|
float a = dot(N[2] - N[0], V[0] - V[2]);
|
||||||
|
@@ -237,7 +237,7 @@ ccl_device bool curve_intersect_iterative(const float3 ray_dir,
|
|||||||
return false; /* Rejects NaNs */
|
return false; /* Rejects NaNs */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Backface culling. */
|
/* Back-face culling. */
|
||||||
const float3 R = normalize(Q - P);
|
const float3 R = normalize(Q - P);
|
||||||
const float3 U = dradiusdu * R + dPdu;
|
const float3 U = dradiusdu * R + dPdu;
|
||||||
const float3 V = cross(dPdu, R);
|
const float3 V = cross(dPdu, R);
|
||||||
@@ -458,10 +458,12 @@ ccl_device_inline bool cylinder_culling_test(const float2 p1, const float2 p2, c
|
|||||||
return num * num <= r * r * den2;
|
return num * num <= r * r * den2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Intersects a ray with a quad with backface culling
|
/**
|
||||||
* enabled. The quad v0,v1,v2,v3 is split into two triangles
|
* Intersects a ray with a quad with back-face culling
|
||||||
* v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two
|
* enabled. The quad v0,v1,v2,v3 is split into two triangles
|
||||||
* triangles gets intersected. */
|
* v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two
|
||||||
|
* triangles gets intersected.
|
||||||
|
*/
|
||||||
ccl_device_inline bool ribbon_intersect_quad(const float ray_tfar,
|
ccl_device_inline bool ribbon_intersect_quad(const float ray_tfar,
|
||||||
const float3 quad_v0,
|
const float3 quad_v0,
|
||||||
const float3 quad_v1,
|
const float3 quad_v1,
|
||||||
|
@@ -40,7 +40,7 @@ ccl_device_noinline void compute_light_pass(
|
|||||||
/* Evaluate surface shader. */
|
/* Evaluate surface shader. */
|
||||||
shader_eval_surface(kg, sd, &state, NULL, state.flag);
|
shader_eval_surface(kg, sd, &state, NULL, state.flag);
|
||||||
|
|
||||||
/* TODO, disable more closures we don't need besides transparent */
|
/* TODO: disable more closures we don't need besides transparent. */
|
||||||
shader_bsdf_disable_transparency(kg, sd);
|
shader_bsdf_disable_transparency(kg, sd);
|
||||||
|
|
||||||
/* Init ray. */
|
/* Init ray. */
|
||||||
|
@@ -50,24 +50,29 @@ ccl_device void svm_node_vector_rotate(ShaderData *sd,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float3 axis;
|
float3 axis;
|
||||||
|
float axis_length;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_X:
|
case NODE_VECTOR_ROTATE_TYPE_AXIS_X:
|
||||||
axis = make_float3(1.0f, 0.0f, 0.0f);
|
axis = make_float3(1.0f, 0.0f, 0.0f);
|
||||||
|
axis_length = 1.0f;
|
||||||
break;
|
break;
|
||||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_Y:
|
case NODE_VECTOR_ROTATE_TYPE_AXIS_Y:
|
||||||
axis = make_float3(0.0f, 1.0f, 0.0f);
|
axis = make_float3(0.0f, 1.0f, 0.0f);
|
||||||
|
axis_length = 1.0f;
|
||||||
break;
|
break;
|
||||||
case NODE_VECTOR_ROTATE_TYPE_AXIS_Z:
|
case NODE_VECTOR_ROTATE_TYPE_AXIS_Z:
|
||||||
axis = make_float3(0.0f, 0.0f, 1.0f);
|
axis = make_float3(0.0f, 0.0f, 1.0f);
|
||||||
|
axis_length = 1.0f;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
axis = normalize(stack_load_float3(stack, axis_stack_offset));
|
axis = stack_load_float3(stack, axis_stack_offset);
|
||||||
|
axis_length = len(axis);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
float angle = stack_load_float(stack, angle_stack_offset);
|
float angle = stack_load_float(stack, angle_stack_offset);
|
||||||
angle = invert ? -angle : angle;
|
angle = invert ? -angle : angle;
|
||||||
result = (len_squared(axis) != 0.0f) ?
|
result = (axis_length != 0.0f) ?
|
||||||
rotate_around_axis(vector - center, axis, angle) + center :
|
rotate_around_axis(vector - center, axis / axis_length, angle) + center :
|
||||||
vector;
|
vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,7 +81,7 @@ class Camera : public Node {
|
|||||||
/* ** Rolling shutter effect. ** */
|
/* ** Rolling shutter effect. ** */
|
||||||
/* Defines rolling shutter effect type. */
|
/* Defines rolling shutter effect type. */
|
||||||
NODE_SOCKET_API(RollingShutterType, rolling_shutter_type)
|
NODE_SOCKET_API(RollingShutterType, rolling_shutter_type)
|
||||||
/* Specifies exposure time of scanlines when using
|
/* Specifies exposure time of scan-lines when using
|
||||||
* rolling shutter effect.
|
* rolling shutter effect.
|
||||||
*/
|
*/
|
||||||
NODE_SOCKET_API(float, rolling_shutter_duration)
|
NODE_SOCKET_API(float, rolling_shutter_duration)
|
||||||
|
@@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
#include "render/image_vdb.h"
|
#include "render/image_vdb.h"
|
||||||
|
|
||||||
|
#include "util/util_logging.h"
|
||||||
|
#include "util/util_openvdb.h"
|
||||||
|
|
||||||
#ifdef WITH_OPENVDB
|
#ifdef WITH_OPENVDB
|
||||||
# include <openvdb/openvdb.h>
|
|
||||||
# include <openvdb/tools/Dense.h>
|
# include <openvdb/tools/Dense.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_NANOVDB
|
#ifdef WITH_NANOVDB
|
||||||
@@ -26,6 +28,57 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
#ifdef WITH_OPENVDB
|
||||||
|
struct NumChannelsOp {
|
||||||
|
int num_channels = 0;
|
||||||
|
|
||||||
|
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
|
||||||
|
bool operator()(const openvdb::GridBase::ConstPtr &)
|
||||||
|
{
|
||||||
|
num_channels = channels;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ToDenseOp {
|
||||||
|
openvdb::CoordBBox bbox;
|
||||||
|
void *pixels;
|
||||||
|
|
||||||
|
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
|
||||||
|
bool operator()(const openvdb::GridBase::ConstPtr &grid)
|
||||||
|
{
|
||||||
|
openvdb::tools::Dense<FloatDataType, openvdb::tools::LayoutXYZ> dense(bbox,
|
||||||
|
(FloatDataType *)pixels);
|
||||||
|
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<GridType>(grid), dense);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# ifdef WITH_NANOVDB
|
||||||
|
struct ToNanoOp {
|
||||||
|
nanovdb::GridHandle<> nanogrid;
|
||||||
|
|
||||||
|
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
|
||||||
|
bool operator()(const openvdb::GridBase::ConstPtr &grid)
|
||||||
|
{
|
||||||
|
if constexpr (!std::is_same_v<GridType, openvdb::MaskGrid>) {
|
||||||
|
try {
|
||||||
|
nanogrid = nanovdb::openToNanoVDB(
|
||||||
|
FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
|
||||||
|
}
|
||||||
|
catch (const std::exception &e) {
|
||||||
|
VLOG(1) << "Error converting OpenVDB to NanoVDB grid: " << e.what();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
VDBImageLoader::VDBImageLoader(const string &grid_name) : grid_name(grid_name)
|
VDBImageLoader::VDBImageLoader(const string &grid_name) : grid_name(grid_name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -41,98 +94,40 @@ bool VDBImageLoader::load_metadata(const ImageDeviceFeatures &features, ImageMet
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get number of channels from type. */
|
||||||
|
NumChannelsOp op;
|
||||||
|
if (!openvdb::grid_type_operation(grid, op)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata.channels = op.num_channels;
|
||||||
|
|
||||||
|
/* Set data type. */
|
||||||
|
# ifdef WITH_NANOVDB
|
||||||
|
if (features.has_nanovdb) {
|
||||||
|
/* NanoVDB expects no inactive leaf nodes. */
|
||||||
|
/*openvdb::FloatGrid &pruned_grid = *openvdb::gridPtrCast<openvdb::FloatGrid>(grid);
|
||||||
|
openvdb::tools::pruneInactive(pruned_grid.tree());
|
||||||
|
nanogrid = nanovdb::openToNanoVDB(pruned_grid);*/
|
||||||
|
ToNanoOp op;
|
||||||
|
if (!openvdb::grid_type_operation(grid, op)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
nanogrid = std::move(op.nanogrid);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Set dimensions. */
|
||||||
bbox = grid->evalActiveVoxelBoundingBox();
|
bbox = grid->evalActiveVoxelBoundingBox();
|
||||||
if (bbox.empty()) {
|
if (bbox.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set dimensions. */
|
|
||||||
openvdb::Coord dim = bbox.dim();
|
openvdb::Coord dim = bbox.dim();
|
||||||
metadata.width = dim.x();
|
metadata.width = dim.x();
|
||||||
metadata.height = dim.y();
|
metadata.height = dim.y();
|
||||||
metadata.depth = dim.z();
|
metadata.depth = dim.z();
|
||||||
|
|
||||||
/* Set data type. */
|
|
||||||
if (grid->isType<openvdb::FloatGrid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Vec3fGrid>()) {
|
|
||||||
metadata.channels = 3;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::BoolGrid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::DoubleGrid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Int32Grid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Int64Grid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Vec3IGrid>()) {
|
|
||||||
metadata.channels = 3;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Vec3dGrid>()) {
|
|
||||||
metadata.channels = 3;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
if (features.has_nanovdb) {
|
|
||||||
nanogrid = nanovdb::openToNanoVDB(
|
|
||||||
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid)));
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::MaskGrid>()) {
|
|
||||||
metadata.channels = 1;
|
|
||||||
# ifdef WITH_NANOVDB
|
|
||||||
return false; // Unsupported
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
# ifdef WITH_NANOVDB
|
# ifdef WITH_NANOVDB
|
||||||
if (nanogrid) {
|
if (nanogrid) {
|
||||||
metadata.byte_size = nanogrid.size();
|
metadata.byte_size = nanogrid.size();
|
||||||
@@ -200,45 +195,10 @@ bool VDBImageLoader::load_pixels(const ImageMetaData &, void *pixels, const size
|
|||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
if (grid->isType<openvdb::FloatGrid>()) {
|
ToDenseOp op;
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
op.pixels = pixels;
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid), dense);
|
op.bbox = bbox;
|
||||||
}
|
openvdb::grid_type_operation(grid, op);
|
||||||
else if (grid->isType<openvdb::Vec3fGrid>()) {
|
|
||||||
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
|
|
||||||
bbox, (openvdb::Vec3f *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::BoolGrid>()) {
|
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::DoubleGrid>()) {
|
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Int32Grid>()) {
|
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Int64Grid>()) {
|
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Vec3IGrid>()) {
|
|
||||||
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
|
|
||||||
bbox, (openvdb::Vec3f *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::Vec3dGrid>()) {
|
|
||||||
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
|
|
||||||
bbox, (openvdb::Vec3f *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
else if (grid->isType<openvdb::MaskGrid>()) {
|
|
||||||
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
|
|
||||||
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::MaskGrid>(grid), dense);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
|
@@ -993,7 +993,7 @@ void OSLCompiler::parameter_array(const char *name, const float f[], int arrayle
|
|||||||
|
|
||||||
void OSLCompiler::parameter_color_array(const char *name, const array<float3> &f)
|
void OSLCompiler::parameter_color_array(const char *name, const array<float3> &f)
|
||||||
{
|
{
|
||||||
/* NB: cycles float3 type is actually 4 floats! need to use an explicit array */
|
/* NOTE: cycles float3 type is actually 4 floats! need to use an explicit array. */
|
||||||
array<float[3]> table(f.size());
|
array<float[3]> table(f.size());
|
||||||
|
|
||||||
for (int i = 0; i < f.size(); ++i) {
|
for (int i = 0; i < f.size(); ++i) {
|
||||||
|
@@ -209,7 +209,7 @@ class SceneParams {
|
|||||||
|
|
||||||
int curve_subdivisions()
|
int curve_subdivisions()
|
||||||
{
|
{
|
||||||
/* Matching the tesselation rate limit in Embree. */
|
/* Matching the tessellation rate limit in Embree. */
|
||||||
return clamp(1 << hair_subdivisions, 1, 16);
|
return clamp(1 << hair_subdivisions, 1, 16);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -227,66 +227,25 @@ void Session::run_gpu()
|
|||||||
progress.set_render_start_time();
|
progress.set_render_start_time();
|
||||||
|
|
||||||
while (!progress.get_cancel()) {
|
while (!progress.get_cancel()) {
|
||||||
/* advance to next tile */
|
const bool no_tiles = !run_update_for_next_iteration();
|
||||||
bool no_tiles = !tile_manager.next();
|
|
||||||
|
|
||||||
DeviceKernelStatus kernel_state = DEVICE_KERNEL_UNKNOWN;
|
|
||||||
if (no_tiles) {
|
if (no_tiles) {
|
||||||
kernel_state = device->get_active_kernel_switch_state();
|
if (params.background) {
|
||||||
}
|
/* if no work left and in background mode, we can stop immediately */
|
||||||
|
|
||||||
if (params.background) {
|
|
||||||
/* if no work left and in background mode, we can stop immediately */
|
|
||||||
if (no_tiles) {
|
|
||||||
progress.set_status("Finished");
|
progress.set_status("Finished");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (no_tiles && kernel_state == DEVICE_KERNEL_FEATURE_KERNEL_AVAILABLE) {
|
if (run_wait_for_work(no_tiles)) {
|
||||||
reset_gpu(tile_manager.params, params.samples);
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
if (progress.get_cancel()) {
|
||||||
/* if in interactive mode, and we are either paused or done for now,
|
break;
|
||||||
* wait for pause condition notify to wake up again */
|
|
||||||
thread_scoped_lock pause_lock(pause_mutex);
|
|
||||||
|
|
||||||
if (!pause && !tile_manager.done()) {
|
|
||||||
/* reset could have happened after no_tiles was set, before this lock.
|
|
||||||
* in this case we shall not wait for pause condition
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
else if (pause || no_tiles) {
|
|
||||||
update_status_time(pause, no_tiles);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
scoped_timer pause_timer;
|
|
||||||
pause_cond.wait(pause_lock);
|
|
||||||
if (pause) {
|
|
||||||
progress.add_skip_time(pause_timer, params.background);
|
|
||||||
}
|
|
||||||
|
|
||||||
update_status_time(pause, no_tiles);
|
|
||||||
progress.set_update();
|
|
||||||
|
|
||||||
if (!pause)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress.get_cancel())
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_tiles) {
|
if (!no_tiles) {
|
||||||
/* update scene */
|
|
||||||
scoped_timer update_timer;
|
|
||||||
if (update_scene()) {
|
|
||||||
profiler.reset(scene->shaders.size(), scene->objects.size());
|
|
||||||
}
|
|
||||||
progress.add_skip_time(update_timer, params.background);
|
|
||||||
|
|
||||||
if (!device->error_message().empty())
|
if (!device->error_message().empty())
|
||||||
progress.set_error(device->error_message());
|
progress.set_error(device->error_message());
|
||||||
|
|
||||||
@@ -729,82 +688,27 @@ void Session::run_cpu()
|
|||||||
last_update_time = time_dt();
|
last_update_time = time_dt();
|
||||||
last_display_time = last_update_time;
|
last_display_time = last_update_time;
|
||||||
|
|
||||||
{
|
|
||||||
/* reset once to start */
|
|
||||||
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
|
||||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
|
||||||
thread_scoped_lock display_lock(display_mutex);
|
|
||||||
|
|
||||||
reset_(delayed_reset.params, delayed_reset.samples);
|
|
||||||
delayed_reset.do_reset = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!progress.get_cancel()) {
|
while (!progress.get_cancel()) {
|
||||||
/* advance to next tile */
|
const bool no_tiles = !run_update_for_next_iteration();
|
||||||
bool no_tiles = !tile_manager.next();
|
|
||||||
bool need_copy_to_display_buffer = false;
|
bool need_copy_to_display_buffer = false;
|
||||||
|
|
||||||
DeviceKernelStatus kernel_state = DEVICE_KERNEL_UNKNOWN;
|
|
||||||
if (no_tiles) {
|
if (no_tiles) {
|
||||||
kernel_state = device->get_active_kernel_switch_state();
|
if (params.background) {
|
||||||
}
|
/* if no work left and in background mode, we can stop immediately */
|
||||||
|
|
||||||
if (params.background) {
|
|
||||||
/* if no work left and in background mode, we can stop immediately */
|
|
||||||
if (no_tiles) {
|
|
||||||
progress.set_status("Finished");
|
progress.set_status("Finished");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (no_tiles && kernel_state == DEVICE_KERNEL_FEATURE_KERNEL_AVAILABLE) {
|
if (run_wait_for_work(no_tiles)) {
|
||||||
reset_cpu(tile_manager.params, params.samples);
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
if (progress.get_cancel()) {
|
||||||
/* if in interactive mode, and we are either paused or done for now,
|
break;
|
||||||
* wait for pause condition notify to wake up again */
|
|
||||||
thread_scoped_lock pause_lock(pause_mutex);
|
|
||||||
|
|
||||||
if (!pause && delayed_reset.do_reset) {
|
|
||||||
/* reset once to start */
|
|
||||||
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
|
||||||
thread_scoped_lock buffers_lock(buffers_mutex);
|
|
||||||
thread_scoped_lock display_lock(display_mutex);
|
|
||||||
|
|
||||||
reset_(delayed_reset.params, delayed_reset.samples);
|
|
||||||
delayed_reset.do_reset = false;
|
|
||||||
}
|
|
||||||
else if (pause || no_tiles) {
|
|
||||||
update_status_time(pause, no_tiles);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
scoped_timer pause_timer;
|
|
||||||
pause_cond.wait(pause_lock);
|
|
||||||
if (pause) {
|
|
||||||
progress.add_skip_time(pause_timer, params.background);
|
|
||||||
}
|
|
||||||
|
|
||||||
update_status_time(pause, no_tiles);
|
|
||||||
progress.set_update();
|
|
||||||
|
|
||||||
if (!pause)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (progress.get_cancel())
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!no_tiles) {
|
if (!no_tiles) {
|
||||||
/* update scene */
|
|
||||||
scoped_timer update_timer;
|
|
||||||
if (update_scene()) {
|
|
||||||
profiler.reset(scene->shaders.size(), scene->objects.size());
|
|
||||||
}
|
|
||||||
progress.add_skip_time(update_timer, params.background);
|
|
||||||
|
|
||||||
if (!device->error_message().empty())
|
if (!device->error_message().empty())
|
||||||
progress.set_error(device->error_message());
|
progress.set_error(device->error_message());
|
||||||
|
|
||||||
@@ -894,6 +798,63 @@ void Session::run()
|
|||||||
progress.set_update();
|
progress.set_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Session::run_update_for_next_iteration()
|
||||||
|
{
|
||||||
|
thread_scoped_lock scene_lock(scene->mutex);
|
||||||
|
thread_scoped_lock reset_lock(delayed_reset.mutex);
|
||||||
|
|
||||||
|
if (delayed_reset.do_reset) {
|
||||||
|
thread_scoped_lock buffers_lock(buffers_mutex);
|
||||||
|
reset_(delayed_reset.params, delayed_reset.samples);
|
||||||
|
delayed_reset.do_reset = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool have_tiles = tile_manager.next();
|
||||||
|
|
||||||
|
if (have_tiles) {
|
||||||
|
scoped_timer update_timer;
|
||||||
|
if (update_scene()) {
|
||||||
|
profiler.reset(scene->shaders.size(), scene->objects.size());
|
||||||
|
}
|
||||||
|
progress.add_skip_time(update_timer, params.background);
|
||||||
|
}
|
||||||
|
|
||||||
|
return have_tiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Session::run_wait_for_work(bool no_tiles)
|
||||||
|
{
|
||||||
|
/* In an offline rendering there is no pause, and no tiles will mean the job is fully done. */
|
||||||
|
if (params.background) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread_scoped_lock pause_lock(pause_mutex);
|
||||||
|
|
||||||
|
if (!pause && !no_tiles) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
update_status_time(pause, no_tiles);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
scoped_timer pause_timer;
|
||||||
|
pause_cond.wait(pause_lock);
|
||||||
|
if (pause) {
|
||||||
|
progress.add_skip_time(pause_timer, params.background);
|
||||||
|
}
|
||||||
|
|
||||||
|
update_status_time(pause, no_tiles);
|
||||||
|
progress.set_update();
|
||||||
|
|
||||||
|
if (!pause) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return no_tiles;
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::draw(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
bool Session::draw(BufferParams &buffer_params, DeviceDrawParams &draw_params)
|
||||||
{
|
{
|
||||||
if (device_use_gl)
|
if (device_use_gl)
|
||||||
@@ -1012,8 +973,6 @@ void Session::wait()
|
|||||||
|
|
||||||
bool Session::update_scene()
|
bool Session::update_scene()
|
||||||
{
|
{
|
||||||
thread_scoped_lock scene_lock(scene->mutex);
|
|
||||||
|
|
||||||
/* update camera if dimensions changed for progressive render. the camera
|
/* update camera if dimensions changed for progressive render. the camera
|
||||||
* knows nothing about progressive or cropped rendering, it just gets the
|
* knows nothing about progressive or cropped rendering, it just gets the
|
||||||
* image dimensions passed in */
|
* image dimensions passed in */
|
||||||
|
@@ -178,6 +178,9 @@ class Session {
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
bool run_update_for_next_iteration();
|
||||||
|
bool run_wait_for_work(bool no_tiles);
|
||||||
|
|
||||||
void update_status_time(bool show_pause = false, bool show_done = false);
|
void update_status_time(bool show_pause = false, bool show_done = false);
|
||||||
|
|
||||||
void render(bool use_denoise);
|
void render(bool use_denoise);
|
||||||
|
@@ -25,6 +25,42 @@ namespace openvdb {
|
|||||||
using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type;
|
using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type;
|
||||||
using Vec4fGrid = Grid<Vec4fTree>;
|
using Vec4fGrid = Grid<Vec4fTree>;
|
||||||
|
|
||||||
|
/* Apply operation to known grid types. */
|
||||||
|
template<typename OpType>
|
||||||
|
bool grid_type_operation(const openvdb::GridBase::ConstPtr &grid, OpType &&op)
|
||||||
|
{
|
||||||
|
if (grid->isType<openvdb::FloatGrid>()) {
|
||||||
|
return op.template operator()<openvdb::FloatGrid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::Vec3fGrid>()) {
|
||||||
|
return op.template operator()<openvdb::Vec3fGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::BoolGrid>()) {
|
||||||
|
return op.template operator()<openvdb::BoolGrid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::DoubleGrid>()) {
|
||||||
|
return op.template operator()<openvdb::DoubleGrid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::Int32Grid>()) {
|
||||||
|
return op.template operator()<openvdb::Int32Grid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::Int64Grid>()) {
|
||||||
|
return op.template operator()<openvdb::Int64Grid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::Vec3IGrid>()) {
|
||||||
|
return op.template operator()<openvdb::Vec3IGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::Vec3dGrid>()) {
|
||||||
|
return op.template operator()<openvdb::Vec3dGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
|
||||||
|
}
|
||||||
|
else if (grid->isType<openvdb::MaskGrid>()) {
|
||||||
|
return op.template operator()<openvdb::MaskGrid, openvdb::FloatGrid, float, 1>(grid);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}; // namespace openvdb
|
}; // namespace openvdb
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -155,6 +155,9 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
elseif(APPLE AND NOT WITH_GHOST_X11)
|
elseif(APPLE AND NOT WITH_GHOST_X11)
|
||||||
|
if(WITH_INPUT_IME)
|
||||||
|
add_definitions(-DWITH_INPUT_IME)
|
||||||
|
endif()
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_DisplayManagerCocoa.mm
|
intern/GHOST_DisplayManagerCocoa.mm
|
||||||
intern/GHOST_SystemCocoa.mm
|
intern/GHOST_SystemCocoa.mm
|
||||||
@@ -285,16 +288,37 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
|
|||||||
${dbus_INCLUDE_DIRS}
|
${dbus_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
|
||||||
|
check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
|
||||||
|
if (HAVE_MEMFD_CREATE)
|
||||||
|
add_definitions(-DHAVE_MEMFD_CREATE)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
intern/GHOST_SystemWayland.cpp
|
intern/GHOST_SystemWayland.cpp
|
||||||
intern/GHOST_WindowWayland.cpp
|
intern/GHOST_WindowWayland.cpp
|
||||||
|
|
||||||
intern/GHOST_SystemWayland.h
|
intern/GHOST_SystemWayland.h
|
||||||
|
intern/GHOST_WaylandCursorSettings.h
|
||||||
intern/GHOST_WindowWayland.h
|
intern/GHOST_WindowWayland.h
|
||||||
)
|
)
|
||||||
|
|
||||||
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
|
||||||
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
|
||||||
|
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
|
||||||
|
if (${wayland-protocols_FOUND})
|
||||||
|
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||||
|
else()
|
||||||
|
find_path(WAYLAND_PROTOCOLS_DIR
|
||||||
|
NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
|
||||||
|
PATH_SUFFIXES share/wayland-protocols
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT EXISTS ${WAYLAND_PROTOCOLS_DIR})
|
||||||
|
message(FATAL_ERROR "path to wayland-protocols not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Generate protocols bindings.
|
# Generate protocols bindings.
|
||||||
macro(generate_protocol_bindings NAME PROT_DEF)
|
macro(generate_protocol_bindings NAME PROT_DEF)
|
||||||
|
@@ -96,7 +96,7 @@ extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consu
|
|||||||
* \param systemhandle: The handle to the system.
|
* \param systemhandle: The handle to the system.
|
||||||
* \return The number of milliseconds.
|
* \return The number of milliseconds.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
|
extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a timer.
|
* Installs a timer.
|
||||||
@@ -110,8 +110,8 @@ extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
|
|||||||
* \return A timer task (0 if timer task installation failed).
|
* \return A timer task (0 if timer task installation failed).
|
||||||
*/
|
*/
|
||||||
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns64 delay,
|
uint64_t delay,
|
||||||
GHOST_TUns64 interval,
|
uint64_t interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData);
|
GHOST_TUserDataPtr userData);
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
|||||||
* \param systemhandle: The handle to the system.
|
* \param systemhandle: The handle to the system.
|
||||||
* \return The number of displays.
|
* \return The number of displays.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
|
extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dimensions of the main display on this system.
|
* Returns the dimensions of the main display on this system.
|
||||||
@@ -142,8 +142,8 @@ extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
|
|||||||
* \param height: A pointer the height gets put in.
|
* \param height: A pointer the height gets put in.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32 *width,
|
uint32_t *width,
|
||||||
GHOST_TUns32 *height);
|
uint32_t *height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dimensions of all displays combine
|
* Returns the dimensions of all displays combine
|
||||||
@@ -154,8 +154,8 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
* \param height: A pointer the height gets put in.
|
* \param height: A pointer the height gets put in.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32 *width,
|
uint32_t *width,
|
||||||
GHOST_TUns32 *height);
|
uint32_t *height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new window.
|
* Create a new window.
|
||||||
@@ -178,10 +178,10 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_WindowHandle parent_windowhandle,
|
GHOST_WindowHandle parent_windowhandle,
|
||||||
const char *title,
|
const char *title,
|
||||||
GHOST_TInt32 left,
|
int32_t left,
|
||||||
GHOST_TInt32 top,
|
int32_t top,
|
||||||
GHOST_TUns32 width,
|
uint32_t width,
|
||||||
GHOST_TUns32 height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
bool is_dialog,
|
bool is_dialog,
|
||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
@@ -360,13 +360,13 @@ extern GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
|
|||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns8 *bitmap,
|
uint8_t *bitmap,
|
||||||
GHOST_TUns8 *mask,
|
uint8_t *mask,
|
||||||
int sizex,
|
int sizex,
|
||||||
int sizey,
|
int sizey,
|
||||||
int hotX,
|
int hotX,
|
||||||
int hotY,
|
int hotY,
|
||||||
GHOST_TUns8 canInvertColor);
|
bool canInvertColor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the visibility state of the cursor.
|
* Returns the visibility state of the cursor.
|
||||||
@@ -391,8 +391,8 @@ extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
|
|||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TInt32 *x,
|
int32_t *x,
|
||||||
GHOST_TInt32 *y);
|
int32_t *y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the location of the cursor (location in screen coordinates).
|
* Updates the location of the cursor (location in screen coordinates).
|
||||||
@@ -403,8 +403,8 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
|||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TInt32 x,
|
int32_t x,
|
||||||
GHOST_TInt32 y);
|
int32_t y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grabs the cursor for a modal operation, to keep receiving
|
* Grabs the cursor for a modal operation, to keep receiving
|
||||||
@@ -467,7 +467,7 @@ extern void GHOST_setNDOFDeadZone(float deadzone);
|
|||||||
/**
|
/**
|
||||||
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
||||||
*/
|
*/
|
||||||
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
|
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the event type.
|
* Returns the event type.
|
||||||
@@ -481,7 +481,7 @@ extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
|
|||||||
* \param eventhandle: The handle to the event.
|
* \param eventhandle: The handle to the event.
|
||||||
* \return The event generation time.
|
* \return The event generation time.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
|
extern uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the window this event was generated on,
|
* Returns the window this event was generated on,
|
||||||
@@ -507,7 +507,7 @@ extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhand
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the timer callback.
|
* Changes the timer callback.
|
||||||
* \param timertaskhandle: The handle to the timertask.
|
* \param timertaskhandle: The handle to the timer-task.
|
||||||
* \param timerProc: The timer callback.
|
* \param timerProc: The timer callback.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
||||||
@@ -515,14 +515,14 @@ extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timer user data.
|
* Returns the timer user data.
|
||||||
* \param timertaskhandle: The handle to the timertask.
|
* \param timertaskhandle: The handle to the timer-task.
|
||||||
* \return The timer user data.
|
* \return The timer user data.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
|
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the time user data.
|
* Changes the time user data.
|
||||||
* \param timertaskhandle: The handle to the timertask.
|
* \param timertaskhandle: The handle to the timer-task.
|
||||||
* \param userdata: The timer user data.
|
* \param userdata: The timer user data.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
|
||||||
@@ -595,7 +595,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
|
|||||||
* \param width: The new width of the client area of the window.
|
* \param width: The new width of the client area of the window.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width);
|
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes client rectangle height.
|
* Resizes client rectangle height.
|
||||||
@@ -603,7 +603,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOS
|
|||||||
* \param height: The new height of the client area of the window.
|
* \param height: The new height of the client area of the window.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height);
|
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes client rectangle.
|
* Resizes client rectangle.
|
||||||
@@ -613,8 +613,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHO
|
|||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns32 width,
|
uint32_t width,
|
||||||
GHOST_TUns32 height);
|
uint32_t height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a point in screen coordinates to client rectangle coordinates
|
* Converts a point in screen coordinates to client rectangle coordinates
|
||||||
@@ -624,25 +624,19 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
|||||||
* \param outX: The x-coordinate in the client rectangle.
|
* \param outX: The x-coordinate in the client rectangle.
|
||||||
* \param outY: The y-coordinate in the client rectangle.
|
* \param outY: The y-coordinate in the client rectangle.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
extern void GHOST_ScreenToClient(
|
||||||
GHOST_TInt32 inX,
|
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 *outX,
|
|
||||||
GHOST_TInt32 *outY);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a point in screen coordinates to client rectangle coordinates
|
* Converts a point in client rectangle coordinates to screen coordinates.
|
||||||
* \param windowhandle: The handle to the window.
|
* \param windowhandle: The handle to the window.
|
||||||
* \param inX: The x-coordinate in the client rectangle.
|
* \param inX: The x-coordinate in the client rectangle.
|
||||||
* \param inY: The y-coordinate in the client rectangle.
|
* \param inY: The y-coordinate in the client rectangle.
|
||||||
* \param outX: The x-coordinate on the screen.
|
* \param outX: The x-coordinate on the screen.
|
||||||
* \param outY: The y-coordinate on the screen.
|
* \param outY: The y-coordinate on the screen.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
extern void GHOST_ClientToScreen(
|
||||||
GHOST_TInt32 inX,
|
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 *outX,
|
|
||||||
GHOST_TInt32 *outY);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the state of the window (normal, minimized, maximized).
|
* Returns the state of the window (normal, minimized, maximized).
|
||||||
@@ -667,7 +661,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
|
|||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
|
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns8 isUnsavedChanges);
|
bool isUnsavedChanges);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the order of the window (bottom, top).
|
* Sets the order of the window (bottom, top).
|
||||||
@@ -758,14 +752,14 @@ extern void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI
|
|||||||
* \param rectanglehandle: The handle to the rectangle.
|
* \param rectanglehandle: The handle to the rectangle.
|
||||||
* \return width of the rectangle
|
* \return width of the rectangle
|
||||||
*/
|
*/
|
||||||
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
|
extern int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to rectangle height.
|
* Access to rectangle height.
|
||||||
* \param rectanglehandle: The handle to the rectangle.
|
* \param rectanglehandle: The handle to the rectangle.
|
||||||
* \return height of the rectangle
|
* \return height of the rectangle
|
||||||
*/
|
*/
|
||||||
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
|
extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all members of the rectangle.
|
* Gets all members of the rectangle.
|
||||||
@@ -775,11 +769,8 @@ extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehand
|
|||||||
* \param r: Pointer to return right coordinate in.
|
* \param r: Pointer to return right coordinate in.
|
||||||
* \param b: Pointer to return bottom coordinate in.
|
* \param b: Pointer to return bottom coordinate in.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_GetRectangle(
|
||||||
GHOST_TInt32 *l,
|
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b);
|
||||||
GHOST_TInt32 *t,
|
|
||||||
GHOST_TInt32 *r,
|
|
||||||
GHOST_TInt32 *b);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all members of the rectangle.
|
* Sets all members of the rectangle.
|
||||||
@@ -789,11 +780,8 @@ extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* \param r: requested right coordinate of the rectangle.
|
* \param r: requested right coordinate of the rectangle.
|
||||||
* \param b: requested bottom coordinate of the rectangle.
|
* \param b: requested bottom coordinate of the rectangle.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_SetRectangle(
|
||||||
GHOST_TInt32 l,
|
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b);
|
||||||
GHOST_TInt32 t,
|
|
||||||
GHOST_TInt32 r,
|
|
||||||
GHOST_TInt32 b);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this rectangle is empty.
|
* Returns whether this rectangle is empty.
|
||||||
@@ -818,7 +806,7 @@ extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehand
|
|||||||
* \param rectanglehandle: The handle to the rectangle.
|
* \param rectanglehandle: The handle to the rectangle.
|
||||||
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
|
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
|
||||||
*/
|
*/
|
||||||
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i);
|
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does a union of the rectangle given and this rectangle.
|
* Does a union of the rectangle given and this rectangle.
|
||||||
@@ -835,9 +823,7 @@ extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* \param x: The x-coordinate of the point.
|
* \param x: The x-coordinate of the point.
|
||||||
* \param y: The y-coordinate of the point.
|
* \param y: The y-coordinate of the point.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y);
|
||||||
GHOST_TInt32 x,
|
|
||||||
GHOST_TInt32 y);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the point is inside this rectangle.
|
* Returns whether the point is inside this rectangle.
|
||||||
@@ -848,8 +834,8 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* \return Success value (true if point is inside).
|
* \return Success value (true if point is inside).
|
||||||
*/
|
*/
|
||||||
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_TInt32 x,
|
int32_t x,
|
||||||
GHOST_TInt32 y);
|
int32_t y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the rectangle is inside this rectangle.
|
* Returns whether the rectangle is inside this rectangle.
|
||||||
@@ -868,8 +854,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(
|
|||||||
* \param cy: Requested center y-coordinate of the rectangle.
|
* \param cy: Requested center y-coordinate of the rectangle.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
|
||||||
GHOST_TInt32 cx,
|
int32_t cx,
|
||||||
GHOST_TInt32 cy);
|
int32_t cy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets rectangle members.
|
* Sets rectangle members.
|
||||||
@@ -881,11 +867,8 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* \param w: requested width of the rectangle.
|
* \param w: requested width of the rectangle.
|
||||||
* \param h: requested height of the rectangle.
|
* \param h: requested height of the rectangle.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
|
extern void GHOST_SetRectangleCenter(
|
||||||
GHOST_TInt32 cx,
|
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h);
|
||||||
GHOST_TInt32 cy,
|
|
||||||
GHOST_TInt32 w,
|
|
||||||
GHOST_TInt32 h);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clips a rectangle.
|
* Clips a rectangle.
|
||||||
@@ -903,14 +886,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
* \param selection: Boolean to return the selection instead, X11 only feature.
|
* \param selection: Boolean to return the selection instead, X11 only feature.
|
||||||
* \return clipboard data
|
* \return clipboard data
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
|
extern char *GHOST_getClipboard(bool selection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put data to the Clipboard
|
* Put data to the Clipboard
|
||||||
* \param buffer: the string buffer to set.
|
* \param buffer: the string buffer to set.
|
||||||
* \param selection: Set the selection instead, X11 only feature.
|
* \param selection: Set the selection instead, X11 only feature.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
|
extern void GHOST_putClipboard(const char *buffer, bool selection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles console
|
* Toggles console
|
||||||
@@ -942,7 +925,7 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
|
|||||||
/**
|
/**
|
||||||
* Returns the suggested DPI for this window.
|
* Returns the suggested DPI for this window.
|
||||||
*/
|
*/
|
||||||
extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
|
extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable IME attached to the given window, i.e. allows user-input
|
* Enable IME attached to the given window, i.e. allows user-input
|
||||||
@@ -956,12 +939,8 @@ extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
|
|||||||
* - true: Start a new composition.
|
* - true: Start a new composition.
|
||||||
* - false: Move the IME windows to the given position without finishing it.
|
* - false: Move the IME windows to the given position without finishing it.
|
||||||
*/
|
*/
|
||||||
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
|
extern void GHOST_BeginIME(
|
||||||
GHOST_TInt32 x,
|
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete);
|
||||||
GHOST_TInt32 y,
|
|
||||||
GHOST_TInt32 w,
|
|
||||||
GHOST_TInt32 h,
|
|
||||||
int complete);
|
|
||||||
/**
|
/**
|
||||||
* Disable the IME attached to the given window, i.e. prohibits any user-input
|
* Disable the IME attached to the given window, i.e. prohibits any user-input
|
||||||
* events from being dispatched to the IME.
|
* events from being dispatched to the IME.
|
||||||
@@ -1076,7 +1055,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_context, const char *acti
|
|||||||
*/
|
*/
|
||||||
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
|
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionInfo *infos);
|
const GHOST_XrActionInfo *infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1084,7 +1063,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
|
|||||||
*/
|
*/
|
||||||
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
|
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const char *const *action_names);
|
const char *const *action_names);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1092,7 +1071,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
|
|||||||
*/
|
*/
|
||||||
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
|
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionSpaceInfo *infos);
|
const GHOST_XrActionSpaceInfo *infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1100,7 +1079,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
|
|||||||
*/
|
*/
|
||||||
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
|
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionSpaceInfo *infos);
|
const GHOST_XrActionSpaceInfo *infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1108,7 +1087,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
|
|||||||
*/
|
*/
|
||||||
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
|
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionProfileInfo *infos);
|
const GHOST_XrActionProfileInfo *infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1116,7 +1095,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
|
|||||||
*/
|
*/
|
||||||
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
|
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionProfileInfo *infos);
|
const GHOST_XrActionProfileInfo *infos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1138,7 +1117,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
|
|||||||
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
|
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
const char *action_name,
|
const char *action_name,
|
||||||
const GHOST_TInt64 *duration,
|
const int64_t *duration,
|
||||||
const float *frequency,
|
const float *frequency,
|
||||||
const float *amplitude);
|
const float *amplitude);
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ class GHOST_IEvent {
|
|||||||
* Returns the time this event was generated.
|
* Returns the time this event was generated.
|
||||||
* \return The event generation time.
|
* \return The event generation time.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns64 getTime() = 0;
|
virtual uint64_t getTime() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the window this event was generated on,
|
* Returns the window this event was generated on,
|
||||||
|
@@ -177,7 +177,7 @@ class GHOST_ISystem {
|
|||||||
* Based on ANSI clock() routine.
|
* Based on ANSI clock() routine.
|
||||||
* \return The number of milliseconds.
|
* \return The number of milliseconds.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns64 getMilliSeconds() const = 0;
|
virtual uint64_t getMilliSeconds() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs a timer.
|
* Installs a timer.
|
||||||
@@ -189,8 +189,8 @@ class GHOST_ISystem {
|
|||||||
* \param userData: Placeholder for user data.
|
* \param userData: Placeholder for user data.
|
||||||
* \return A timer task (0 if timer task installation failed).
|
* \return A timer task (0 if timer task installation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
|
virtual GHOST_ITimerTask *installTimer(uint64_t delay,
|
||||||
GHOST_TUns64 interval,
|
uint64_t interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData = NULL) = 0;
|
GHOST_TUserDataPtr userData = NULL) = 0;
|
||||||
|
|
||||||
@@ -209,19 +209,19 @@ class GHOST_ISystem {
|
|||||||
* Returns the number of displays on this system.
|
* Returns the number of displays on this system.
|
||||||
* \return The number of displays.
|
* \return The number of displays.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8 getNumDisplays() const = 0;
|
virtual uint8_t getNumDisplays() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the dimensions of the main display on this system.
|
* Returns the dimensions of the main display on this system.
|
||||||
* \return The dimension of the main display.
|
* \return The dimension of the main display.
|
||||||
*/
|
*/
|
||||||
virtual void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
|
virtual void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the combine dimensions of all monitors.
|
* Returns the combine dimensions of all monitors.
|
||||||
* \return The dimension of the workspace.
|
* \return The dimension of the workspace.
|
||||||
*/
|
*/
|
||||||
virtual void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
|
virtual void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new window.
|
* Create a new window.
|
||||||
@@ -242,10 +242,10 @@ class GHOST_ISystem {
|
|||||||
* \return The new window (or 0 if creation failed).
|
* \return The new window (or 0 if creation failed).
|
||||||
*/
|
*/
|
||||||
virtual GHOST_IWindow *createWindow(const char *title,
|
virtual GHOST_IWindow *createWindow(const char *title,
|
||||||
GHOST_TInt32 left,
|
int32_t left,
|
||||||
GHOST_TInt32 top,
|
int32_t top,
|
||||||
GHOST_TUns32 width,
|
uint32_t width,
|
||||||
GHOST_TUns32 height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
GHOST_GLSettings glSettings,
|
GHOST_GLSettings glSettings,
|
||||||
@@ -365,7 +365,7 @@ class GHOST_ISystem {
|
|||||||
* \param y: The y-coordinate of the cursor.
|
* \param y: The y-coordinate of the cursor.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const = 0;
|
virtual GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the location of the cursor (location in screen coordinates).
|
* Updates the location of the cursor (location in screen coordinates).
|
||||||
@@ -374,7 +374,7 @@ class GHOST_ISystem {
|
|||||||
* \param y: The y-coordinate of the cursor.
|
* \param y: The y-coordinate of the cursor.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
|
virtual GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) = 0;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* Access to mouse button and keyboard states.
|
* Access to mouse button and keyboard states.
|
||||||
@@ -431,12 +431,12 @@ class GHOST_ISystem {
|
|||||||
* \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer
|
* \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
|
virtual char *getClipboard(bool selection) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put data to the Clipboard
|
* Put data to the Clipboard
|
||||||
*/
|
*/
|
||||||
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
|
virtual void putClipboard(const char *buffer, bool selection) const = 0;
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* System Message Box.
|
* System Message Box.
|
||||||
|
@@ -68,26 +68,26 @@ class GHOST_ISystemPaths {
|
|||||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
|
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* If needed, it will create the base directory.
|
* If needed, it will create the base directory.
|
||||||
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
|
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
|
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine a special ("well known") and easy to reach user directory.
|
* Determine a special ("well known") and easy to reach user directory.
|
||||||
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
|
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
|
virtual const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the directory of the current binary
|
* Determine the directory of the current binary
|
||||||
* \return Unsigned char string pointing to the binary dir
|
* \return Unsigned char string pointing to the binary dir
|
||||||
*/
|
*/
|
||||||
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
|
virtual const char *getBinaryDir() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
|
@@ -108,20 +108,20 @@ class GHOST_IWindow {
|
|||||||
* Resizes client rectangle width.
|
* Resizes client rectangle width.
|
||||||
* \param width: The new width of the client area of the window.
|
* \param width: The new width of the client area of the window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
|
virtual GHOST_TSuccess setClientWidth(uint32_t width) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes client rectangle height.
|
* Resizes client rectangle height.
|
||||||
* \param height: The new height of the client area of the window.
|
* \param height: The new height of the client area of the window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
|
virtual GHOST_TSuccess setClientHeight(uint32_t height) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resizes client rectangle.
|
* Resizes client rectangle.
|
||||||
* \param width: The new width of the client area of the window.
|
* \param width: The new width of the client area of the window.
|
||||||
* \param height: The new height of the client area of the window.
|
* \param height: The new height of the client area of the window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
|
virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a point in screen coordinates to client rectangle coordinates
|
* Converts a point in screen coordinates to client rectangle coordinates
|
||||||
@@ -130,22 +130,16 @@ class GHOST_IWindow {
|
|||||||
* \param outX: The x-coordinate in the client rectangle.
|
* \param outX: The x-coordinate in the client rectangle.
|
||||||
* \param outY: The y-coordinate in the client rectangle.
|
* \param outY: The y-coordinate in the client rectangle.
|
||||||
*/
|
*/
|
||||||
virtual void screenToClient(GHOST_TInt32 inX,
|
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 &outX,
|
|
||||||
GHOST_TInt32 &outY) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a point in screen coordinates to client rectangle coordinates
|
* Converts a point in client rectangle coordinates to screen coordinates.
|
||||||
* \param inX: The x-coordinate in the client rectangle.
|
* \param inX: The x-coordinate in the client rectangle.
|
||||||
* \param inY: The y-coordinate in the client rectangle.
|
* \param inY: The y-coordinate in the client rectangle.
|
||||||
* \param outX: The x-coordinate on the screen.
|
* \param outX: The x-coordinate on the screen.
|
||||||
* \param outY: The y-coordinate on the screen.
|
* \param outY: The y-coordinate on the screen.
|
||||||
*/
|
*/
|
||||||
virtual void clientToScreen(GHOST_TInt32 inX,
|
virtual void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 &outX,
|
|
||||||
GHOST_TInt32 &outY) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
|
||||||
@@ -290,8 +284,8 @@ class GHOST_IWindow {
|
|||||||
* \param hotY: The Y coordinate of the cursor hot-spot.
|
* \param hotY: The Y coordinate of the cursor hot-spot.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
|
virtual GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
|
||||||
GHOST_TUns8 *mask,
|
uint8_t *mask,
|
||||||
int sizex,
|
int sizex,
|
||||||
int sizey,
|
int sizey,
|
||||||
int hotX,
|
int hotX,
|
||||||
@@ -319,7 +313,7 @@ class GHOST_IWindow {
|
|||||||
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode /*mode*/,
|
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode /*mode*/,
|
||||||
GHOST_TAxisFlag /*wrap_axis*/,
|
GHOST_TAxisFlag /*wrap_axis*/,
|
||||||
GHOST_Rect * /*bounds*/,
|
GHOST_Rect * /*bounds*/,
|
||||||
GHOST_TInt32 /*mouse_ungrab_xy*/[2])
|
int32_t /*mouse_ungrab_xy*/[2])
|
||||||
{
|
{
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
@@ -334,7 +328,7 @@ class GHOST_IWindow {
|
|||||||
* Returns the recommended DPI for this window.
|
* Returns the recommended DPI for this window.
|
||||||
* \return The recommended DPI for this window.
|
* \return The recommended DPI for this window.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TUns16 getDPIHint() = 0;
|
virtual uint16_t getDPIHint() = 0;
|
||||||
|
|
||||||
#ifdef WITH_INPUT_IME
|
#ifdef WITH_INPUT_IME
|
||||||
/**
|
/**
|
||||||
@@ -348,8 +342,7 @@ class GHOST_IWindow {
|
|||||||
* - true: Start a new composition
|
* - true: Start a new composition
|
||||||
* - false: Move the IME windows to the given position without finishing it.
|
* - false: Move the IME windows to the given position without finishing it.
|
||||||
*/
|
*/
|
||||||
virtual void beginIME(
|
virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) = 0;
|
||||||
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the IME attached to the given window, i.e. prohibits any user-input
|
* Disable the IME attached to the given window, i.e. prohibits any user-input
|
||||||
|
@@ -48,25 +48,25 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
|
|||||||
* "unpack and run" path, then look for properly installed path, including versioning.
|
* "unpack and run" path, then look for properly installed path, including versioning.
|
||||||
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
|
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the base dir in which user configuration is stored, including versioning.
|
* Determine the base dir in which user configuration is stored, including versioning.
|
||||||
* \return Unsigned char string pointing to user dir (eg ~).
|
* \return Unsigned char string pointing to user dir (eg ~).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
|
extern const char *GHOST_getUserDir(int version, const char *versionstr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine a special ("well known") and easy to reach user directory.
|
* Determine a special ("well known") and easy to reach user directory.
|
||||||
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
|
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
|
extern const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine the dir in which the binary file is found.
|
* Determine the dir in which the binary file is found.
|
||||||
* \return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
|
* \return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
|
||||||
*/
|
*/
|
||||||
extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
|
extern const char *GHOST_getBinaryDir(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the file to the operating system most recently used files
|
* Add the file to the operating system most recently used files
|
||||||
|
@@ -42,7 +42,7 @@ class GHOST_Rect {
|
|||||||
* \param r: requested right coordinate of the rectangle.
|
* \param r: requested right coordinate of the rectangle.
|
||||||
* \param b: requested bottom coordinate of the rectangle.
|
* \param b: requested bottom coordinate of the rectangle.
|
||||||
*/
|
*/
|
||||||
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
|
GHOST_Rect(int32_t l = 0, int32_t t = 0, int32_t r = 0, int32_t b = 0)
|
||||||
: m_l(l), m_t(t), m_r(r), m_b(b)
|
: m_l(l), m_t(t), m_r(r), m_b(b)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -58,13 +58,13 @@ class GHOST_Rect {
|
|||||||
* Access to rectangle width.
|
* Access to rectangle width.
|
||||||
* \return width of the rectangle.
|
* \return width of the rectangle.
|
||||||
*/
|
*/
|
||||||
virtual inline GHOST_TInt32 getWidth() const;
|
virtual inline int32_t getWidth() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access to rectangle height.
|
* Access to rectangle height.
|
||||||
* \return height of the rectangle.
|
* \return height of the rectangle.
|
||||||
*/
|
*/
|
||||||
virtual inline GHOST_TInt32 getHeight() const;
|
virtual inline int32_t getHeight() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all members of the rectangle.
|
* Sets all members of the rectangle.
|
||||||
@@ -73,7 +73,7 @@ class GHOST_Rect {
|
|||||||
* \param r: requested right coordinate of the rectangle.
|
* \param r: requested right coordinate of the rectangle.
|
||||||
* \param b: requested bottom coordinate of the rectangle.
|
* \param b: requested bottom coordinate of the rectangle.
|
||||||
*/
|
*/
|
||||||
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
|
virtual inline void set(int32_t l, int32_t t, int32_t r, int32_t b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether this rectangle is empty.
|
* Returns whether this rectangle is empty.
|
||||||
@@ -95,7 +95,7 @@ class GHOST_Rect {
|
|||||||
* The method avoids negative insets making the rectangle invalid
|
* The method avoids negative insets making the rectangle invalid
|
||||||
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
|
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
|
||||||
*/
|
*/
|
||||||
virtual void inset(GHOST_TInt32 i);
|
virtual void inset(int32_t i);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does a union of the rectangle given and this rectangle.
|
* Does a union of the rectangle given and this rectangle.
|
||||||
@@ -109,17 +109,14 @@ class GHOST_Rect {
|
|||||||
* \param x: The x-coordinate of the point.
|
* \param x: The x-coordinate of the point.
|
||||||
* \param y: The y-coordinate of the point.
|
* \param y: The y-coordinate of the point.
|
||||||
*/
|
*/
|
||||||
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
|
virtual inline void unionPoint(int32_t x, int32_t y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Grows the rectangle to included a point.
|
* Grows the rectangle to included a point.
|
||||||
* \param x: The x-coordinate of the point.
|
* \param x: The x-coordinate of the point.
|
||||||
* \param y: The y-coordinate of the point.
|
* \param y: The y-coordinate of the point.
|
||||||
*/
|
*/
|
||||||
virtual inline void wrapPoint(GHOST_TInt32 &x,
|
virtual inline void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis);
|
||||||
GHOST_TInt32 &y,
|
|
||||||
GHOST_TInt32 ofs,
|
|
||||||
GHOST_TAxisFlag axis);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the point is inside this rectangle.
|
* Returns whether the point is inside this rectangle.
|
||||||
@@ -128,7 +125,7 @@ class GHOST_Rect {
|
|||||||
* \param y: y-coordinate of point to test.
|
* \param y: y-coordinate of point to test.
|
||||||
* \return boolean value (true if point is inside).
|
* \return boolean value (true if point is inside).
|
||||||
*/
|
*/
|
||||||
virtual inline bool isInside(GHOST_TInt32 x, GHOST_TInt32 y) const;
|
virtual inline bool isInside(int32_t x, int32_t y) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the rectangle is inside this rectangle.
|
* Returns whether the rectangle is inside this rectangle.
|
||||||
@@ -143,7 +140,7 @@ class GHOST_Rect {
|
|||||||
* \param cx: requested center x-coordinate of the rectangle.
|
* \param cx: requested center x-coordinate of the rectangle.
|
||||||
* \param cy: requested center y-coordinate of the rectangle.
|
* \param cy: requested center y-coordinate of the rectangle.
|
||||||
*/
|
*/
|
||||||
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
|
virtual void setCenter(int32_t cx, int32_t cy);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets rectangle members.
|
* Sets rectangle members.
|
||||||
@@ -154,7 +151,7 @@ class GHOST_Rect {
|
|||||||
* \param w: requested width of the rectangle.
|
* \param w: requested width of the rectangle.
|
||||||
* \param h: requested height of the rectangle.
|
* \param h: requested height of the rectangle.
|
||||||
*/
|
*/
|
||||||
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
|
virtual void setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clips a rectangle.
|
* Clips a rectangle.
|
||||||
@@ -166,30 +163,30 @@ class GHOST_Rect {
|
|||||||
virtual bool clip(GHOST_Rect &r) const;
|
virtual bool clip(GHOST_Rect &r) const;
|
||||||
|
|
||||||
/** Left coordinate of the rectangle */
|
/** Left coordinate of the rectangle */
|
||||||
GHOST_TInt32 m_l;
|
int32_t m_l;
|
||||||
/** Top coordinate of the rectangle */
|
/** Top coordinate of the rectangle */
|
||||||
GHOST_TInt32 m_t;
|
int32_t m_t;
|
||||||
/** Right coordinate of the rectangle */
|
/** Right coordinate of the rectangle */
|
||||||
GHOST_TInt32 m_r;
|
int32_t m_r;
|
||||||
/** Bottom coordinate of the rectangle */
|
/** Bottom coordinate of the rectangle */
|
||||||
GHOST_TInt32 m_b;
|
int32_t m_b;
|
||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Rect")
|
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Rect")
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
inline GHOST_TInt32 GHOST_Rect::getWidth() const
|
inline int32_t GHOST_Rect::getWidth() const
|
||||||
{
|
{
|
||||||
return m_r - m_l;
|
return m_r - m_l;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline GHOST_TInt32 GHOST_Rect::getHeight() const
|
inline int32_t GHOST_Rect::getHeight() const
|
||||||
{
|
{
|
||||||
return m_b - m_t;
|
return m_b - m_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GHOST_Rect::set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b)
|
inline void GHOST_Rect::set(int32_t l, int32_t t, int32_t r, int32_t b)
|
||||||
{
|
{
|
||||||
m_l = l;
|
m_l = l;
|
||||||
m_t = t;
|
m_t = t;
|
||||||
@@ -219,7 +216,7 @@ inline void GHOST_Rect::unionRect(const GHOST_Rect &r)
|
|||||||
m_b = r.m_b;
|
m_b = r.m_b;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
|
inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
|
||||||
{
|
{
|
||||||
if (x < m_l)
|
if (x < m_l)
|
||||||
m_l = x;
|
m_l = x;
|
||||||
@@ -231,13 +228,10 @@ inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
|
|||||||
m_b = y;
|
m_b = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
|
inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
|
||||||
GHOST_TInt32 &y,
|
|
||||||
GHOST_TInt32 ofs,
|
|
||||||
GHOST_TAxisFlag axis)
|
|
||||||
{
|
{
|
||||||
GHOST_TInt32 w = getWidth();
|
int32_t w = getWidth();
|
||||||
GHOST_TInt32 h = getHeight();
|
int32_t h = getHeight();
|
||||||
|
|
||||||
/* highly unlikely but avoid eternal loop */
|
/* highly unlikely but avoid eternal loop */
|
||||||
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
|
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
|
||||||
@@ -258,7 +252,7 @@ inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
|
inline bool GHOST_Rect::isInside(int32_t x, int32_t y) const
|
||||||
{
|
{
|
||||||
return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
|
return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#ifdef WITH_CXX_GUARDEDALLOC
|
#ifdef WITH_CXX_GUARDEDALLOC
|
||||||
# include "MEM_guardedalloc.h"
|
# include "MEM_guardedalloc.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -56,13 +58,6 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
|
|||||||
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
|
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
|
||||||
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
|
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
|
||||||
|
|
||||||
typedef char GHOST_TInt8;
|
|
||||||
typedef unsigned char GHOST_TUns8;
|
|
||||||
typedef short GHOST_TInt16;
|
|
||||||
typedef unsigned short GHOST_TUns16;
|
|
||||||
typedef int GHOST_TInt32;
|
|
||||||
typedef unsigned int GHOST_TUns32;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int flags;
|
int flags;
|
||||||
} GHOST_GLSettings;
|
} GHOST_GLSettings;
|
||||||
@@ -78,14 +73,6 @@ typedef enum GHOST_DialogOptions {
|
|||||||
GHOST_DialogError = (1 << 1),
|
GHOST_DialogError = (1 << 1),
|
||||||
} GHOST_DialogOptions;
|
} GHOST_DialogOptions;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef __int64 GHOST_TInt64;
|
|
||||||
typedef unsigned __int64 GHOST_TUns64;
|
|
||||||
#else
|
|
||||||
typedef long long GHOST_TInt64;
|
|
||||||
typedef unsigned long long GHOST_TUns64;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef void *GHOST_TUserDataPtr;
|
typedef void *GHOST_TUserDataPtr;
|
||||||
|
|
||||||
typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
|
typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
|
||||||
@@ -436,9 +423,9 @@ typedef void *GHOST_TEventDataPtr;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** The x-coordinate of the cursor position. */
|
/** The x-coordinate of the cursor position. */
|
||||||
GHOST_TInt32 x;
|
int32_t x;
|
||||||
/** The y-coordinate of the cursor position. */
|
/** The y-coordinate of the cursor position. */
|
||||||
GHOST_TInt32 y;
|
int32_t y;
|
||||||
/** Associated tablet data. */
|
/** Associated tablet data. */
|
||||||
GHOST_TabletData tablet;
|
GHOST_TabletData tablet;
|
||||||
} GHOST_TEventCursorData;
|
} GHOST_TEventCursorData;
|
||||||
@@ -452,7 +439,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Displacement of a mouse wheel. */
|
/** Displacement of a mouse wheel. */
|
||||||
GHOST_TInt32 z;
|
int32_t z;
|
||||||
} GHOST_TEventWheelData;
|
} GHOST_TEventWheelData;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -468,13 +455,13 @@ typedef struct {
|
|||||||
/** The event subtype */
|
/** The event subtype */
|
||||||
GHOST_TTrackpadEventSubTypes subtype;
|
GHOST_TTrackpadEventSubTypes subtype;
|
||||||
/** The x-location of the trackpad event */
|
/** The x-location of the trackpad event */
|
||||||
GHOST_TInt32 x;
|
int32_t x;
|
||||||
/** The y-location of the trackpad event */
|
/** The y-location of the trackpad event */
|
||||||
GHOST_TInt32 y;
|
int32_t y;
|
||||||
/** The x-delta or value of the trackpad event */
|
/** The x-delta or value of the trackpad event */
|
||||||
GHOST_TInt32 deltaX;
|
int32_t deltaX;
|
||||||
/** The y-delta (currently only for scroll subtype) of the trackpad event */
|
/** The y-delta (currently only for scroll subtype) of the trackpad event */
|
||||||
GHOST_TInt32 deltaY;
|
int32_t deltaY;
|
||||||
/** The delta is inverted from the device due to system preferences. */
|
/** The delta is inverted from the device due to system preferences. */
|
||||||
char isDirectionInverted;
|
char isDirectionInverted;
|
||||||
} GHOST_TEventTrackpadData;
|
} GHOST_TEventTrackpadData;
|
||||||
@@ -488,9 +475,9 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** The x-coordinate of the cursor position. */
|
/** The x-coordinate of the cursor position. */
|
||||||
GHOST_TInt32 x;
|
int32_t x;
|
||||||
/** The y-coordinate of the cursor position. */
|
/** The y-coordinate of the cursor position. */
|
||||||
GHOST_TInt32 y;
|
int32_t y;
|
||||||
/** The dropped item type */
|
/** The dropped item type */
|
||||||
GHOST_TDragnDropTypes dataType;
|
GHOST_TDragnDropTypes dataType;
|
||||||
/** The "dropped content" */
|
/** The "dropped content" */
|
||||||
@@ -515,7 +502,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int count;
|
int count;
|
||||||
GHOST_TUns8 **strings;
|
uint8_t **strings;
|
||||||
} GHOST_TStringArray;
|
} GHOST_TStringArray;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@@ -587,13 +574,13 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Number of pixels on a line. */
|
/** Number of pixels on a line. */
|
||||||
GHOST_TUns32 xPixels;
|
uint32_t xPixels;
|
||||||
/** Number of lines. */
|
/** Number of lines. */
|
||||||
GHOST_TUns32 yPixels;
|
uint32_t yPixels;
|
||||||
/** Number of bits per pixel. */
|
/** Number of bits per pixel. */
|
||||||
GHOST_TUns32 bpp;
|
uint32_t bpp;
|
||||||
/** Refresh rate (in Hertz). */
|
/** Refresh rate (in Hertz). */
|
||||||
GHOST_TUns32 frequency;
|
uint32_t frequency;
|
||||||
} GHOST_DisplaySetting;
|
} GHOST_DisplaySetting;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -613,10 +600,10 @@ typedef int GHOST_TEmbedderWindowID;
|
|||||||
*/
|
*/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
class GHOST_ITimerTask;
|
class GHOST_ITimerTask;
|
||||||
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
|
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, uint64_t time);
|
||||||
#else
|
#else
|
||||||
struct GHOST_TimerTaskHandle__;
|
struct GHOST_TimerTaskHandle__;
|
||||||
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time);
|
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_XR_OPENXR
|
#ifdef WITH_XR_OPENXR
|
||||||
@@ -696,6 +683,10 @@ typedef struct GHOST_XrDrawViewInfo {
|
|||||||
|
|
||||||
/** 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;
|
char expects_srgb_buffer;
|
||||||
|
|
||||||
|
/** The view that this info represents. Not necessarily the "eye index" (e.g. for quad view
|
||||||
|
* systems, etc). */
|
||||||
|
char view_idx;
|
||||||
} GHOST_XrDrawViewInfo;
|
} GHOST_XrDrawViewInfo;
|
||||||
|
|
||||||
typedef struct GHOST_XrError {
|
typedef struct GHOST_XrError {
|
||||||
@@ -724,7 +715,7 @@ typedef enum GHOST_XrActionType {
|
|||||||
typedef struct GHOST_XrActionInfo {
|
typedef struct GHOST_XrActionInfo {
|
||||||
const char *name;
|
const char *name;
|
||||||
GHOST_XrActionType type;
|
GHOST_XrActionType type;
|
||||||
GHOST_TUns32 count_subaction_paths;
|
uint32_t count_subaction_paths;
|
||||||
const char **subaction_paths;
|
const char **subaction_paths;
|
||||||
/** States for each subaction path. */
|
/** States for each subaction path. */
|
||||||
void *states;
|
void *states;
|
||||||
@@ -735,7 +726,7 @@ typedef struct GHOST_XrActionInfo {
|
|||||||
|
|
||||||
typedef struct GHOST_XrActionSpaceInfo {
|
typedef struct GHOST_XrActionSpaceInfo {
|
||||||
const char *action_name;
|
const char *action_name;
|
||||||
GHOST_TUns32 count_subaction_paths;
|
uint32_t count_subaction_paths;
|
||||||
const char **subaction_paths;
|
const char **subaction_paths;
|
||||||
/** Poses for each subaction path. */
|
/** Poses for each subaction path. */
|
||||||
const GHOST_XrPose *poses;
|
const GHOST_XrPose *poses;
|
||||||
@@ -743,14 +734,14 @@ typedef struct GHOST_XrActionSpaceInfo {
|
|||||||
|
|
||||||
typedef struct GHOST_XrActionBindingInfo {
|
typedef struct GHOST_XrActionBindingInfo {
|
||||||
const char *action_name;
|
const char *action_name;
|
||||||
GHOST_TUns32 count_interaction_paths;
|
uint32_t count_interaction_paths;
|
||||||
/** Interaction path: User (sub-action) path + component path. */
|
/** Interaction path: User (sub-action) path + component path. */
|
||||||
const char **interaction_paths;
|
const char **interaction_paths;
|
||||||
} GHOST_XrActionBindingInfo;
|
} GHOST_XrActionBindingInfo;
|
||||||
|
|
||||||
typedef struct GHOST_XrActionProfileInfo {
|
typedef struct GHOST_XrActionProfileInfo {
|
||||||
const char *profile_path;
|
const char *profile_path;
|
||||||
GHOST_TUns32 count_bindings;
|
uint32_t count_bindings;
|
||||||
const GHOST_XrActionBindingInfo *bindings;
|
const GHOST_XrActionBindingInfo *bindings;
|
||||||
} GHOST_XrActionProfileInfo;
|
} GHOST_XrActionProfileInfo;
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ struct GHOST_Buttons {
|
|||||||
*/
|
*/
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
GHOST_TUns8 m_ButtonLeft : 1;
|
uint8_t m_ButtonLeft : 1;
|
||||||
GHOST_TUns8 m_ButtonMiddle : 1;
|
uint8_t m_ButtonMiddle : 1;
|
||||||
GHOST_TUns8 m_ButtonRight : 1;
|
uint8_t m_ButtonRight : 1;
|
||||||
};
|
};
|
||||||
|
@@ -84,7 +84,7 @@ GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhand
|
|||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
|
uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
@@ -92,8 +92,8 @@ GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns64 delay,
|
uint64_t delay,
|
||||||
GHOST_TUns64 interval,
|
uint64_t interval,
|
||||||
GHOST_TimerProcPtr timerproc,
|
GHOST_TimerProcPtr timerproc,
|
||||||
GHOST_TUserDataPtr userdata)
|
GHOST_TUserDataPtr userdata)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
|
|||||||
return system->removeTimer(timertask);
|
return system->removeTimer(timertask);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
@@ -119,8 +119,8 @@ GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32 *width,
|
uint32_t *width,
|
||||||
GHOST_TUns32 *height)
|
uint32_t *height)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_TUns32 *width,
|
uint32_t *width,
|
||||||
GHOST_TUns32 *height)
|
uint32_t *height)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
@@ -156,10 +156,10 @@ GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,
|
|||||||
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
|
||||||
GHOST_WindowHandle parent_windowhandle,
|
GHOST_WindowHandle parent_windowhandle,
|
||||||
const char *title,
|
const char *title,
|
||||||
GHOST_TInt32 left,
|
int32_t left,
|
||||||
GHOST_TInt32 top,
|
int32_t top,
|
||||||
GHOST_TUns32 width,
|
uint32_t width,
|
||||||
GHOST_TUns32 height,
|
uint32_t height,
|
||||||
GHOST_TWindowState state,
|
GHOST_TWindowState state,
|
||||||
bool is_dialog,
|
bool is_dialog,
|
||||||
GHOST_TDrawingContextType type,
|
GHOST_TDrawingContextType type,
|
||||||
@@ -317,13 +317,13 @@ GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns8 *bitmap,
|
uint8_t *bitmap,
|
||||||
GHOST_TUns8 *mask,
|
uint8_t *mask,
|
||||||
int sizex,
|
int sizex,
|
||||||
int sizey,
|
int sizey,
|
||||||
int hotX,
|
int hotX,
|
||||||
int hotY,
|
int hotY,
|
||||||
GHOST_TUns8 canInvertColor)
|
bool canInvertColor)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
@@ -344,18 +344,14 @@ GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, int vi
|
|||||||
return window->setCursorVisibility(visible ? true : false);
|
return window->setCursorVisibility(visible ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle, int32_t *x, int32_t *y)
|
||||||
GHOST_TInt32 *x,
|
|
||||||
GHOST_TInt32 *y)
|
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
return system->getCursorPosition(*x, *y);
|
return system->getCursorPosition(*x, *y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
|
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, int32_t x, int32_t y)
|
||||||
GHOST_TInt32 x,
|
|
||||||
GHOST_TInt32 y)
|
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
|
||||||
|
|
||||||
@@ -370,7 +366,7 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
|
|||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
GHOST_Rect bounds_rect;
|
GHOST_Rect bounds_rect;
|
||||||
GHOST_TInt32 mouse_xy[2];
|
int32_t mouse_xy[2];
|
||||||
|
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
|
bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
|
||||||
@@ -420,7 +416,7 @@ void GHOST_setNDOFDeadZone(float deadzone)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
|
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
@@ -434,7 +430,7 @@ GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
|
|||||||
return event->getType();
|
return event->getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
|
uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
|
||||||
{
|
{
|
||||||
GHOST_IEvent *event = (GHOST_IEvent *)eventhandle;
|
GHOST_IEvent *event = (GHOST_IEvent *)eventhandle;
|
||||||
|
|
||||||
@@ -555,14 +551,14 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
delete (GHOST_Rect *)rectanglehandle;
|
delete (GHOST_Rect *)rectanglehandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width)
|
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
return window->setClientWidth(width);
|
return window->setClientWidth(width);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height)
|
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
@@ -570,30 +566,24 @@ GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
|
||||||
GHOST_TUns32 width,
|
uint32_t width,
|
||||||
GHOST_TUns32 height)
|
uint32_t height)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
return window->setClientSize(width, height);
|
return window->setClientSize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
|
void GHOST_ScreenToClient(
|
||||||
GHOST_TInt32 inX,
|
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 *outX,
|
|
||||||
GHOST_TInt32 *outY)
|
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
window->screenToClient(inX, inY, *outX, *outY);
|
window->screenToClient(inX, inY, *outX, *outY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
|
void GHOST_ClientToScreen(
|
||||||
GHOST_TInt32 inX,
|
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
|
||||||
GHOST_TInt32 inY,
|
|
||||||
GHOST_TInt32 *outX,
|
|
||||||
GHOST_TInt32 *outY)
|
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
@@ -614,8 +604,7 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWind
|
|||||||
return window->setState(state);
|
return window->setState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
|
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
|
||||||
GHOST_TUns8 isUnsavedChanges)
|
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
|
|
||||||
@@ -703,21 +692,18 @@ void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
|
|||||||
system->setTabletAPI(api);
|
system->setTabletAPI(api);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
|
int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||||
{
|
{
|
||||||
return ((GHOST_Rect *)rectanglehandle)->getWidth();
|
return ((GHOST_Rect *)rectanglehandle)->getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
|
int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
|
||||||
{
|
{
|
||||||
return ((GHOST_Rect *)rectanglehandle)->getHeight();
|
return ((GHOST_Rect *)rectanglehandle)->getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_GetRectangle(
|
||||||
GHOST_TInt32 *l,
|
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
|
||||||
GHOST_TInt32 *t,
|
|
||||||
GHOST_TInt32 *r,
|
|
||||||
GHOST_TInt32 *b)
|
|
||||||
{
|
{
|
||||||
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
|
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
|
||||||
|
|
||||||
@@ -727,11 +713,8 @@ void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
*b = rect->m_b;
|
*b = rect->m_b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_SetRectangle(
|
||||||
GHOST_TInt32 l,
|
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b)
|
||||||
GHOST_TInt32 t,
|
|
||||||
GHOST_TInt32 r,
|
|
||||||
GHOST_TInt32 b)
|
|
||||||
{
|
{
|
||||||
((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
|
((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
|
||||||
}
|
}
|
||||||
@@ -756,7 +739,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i)
|
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i)
|
||||||
{
|
{
|
||||||
((GHOST_Rect *)rectanglehandle)->inset(i);
|
((GHOST_Rect *)rectanglehandle)->inset(i);
|
||||||
}
|
}
|
||||||
@@ -767,16 +750,12 @@ void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
|
((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
|
||||||
GHOST_TInt32 x,
|
|
||||||
GHOST_TInt32 y)
|
|
||||||
{
|
{
|
||||||
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
|
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
|
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
|
||||||
GHOST_TInt32 x,
|
|
||||||
GHOST_TInt32 y)
|
|
||||||
{
|
{
|
||||||
GHOST_TSuccess result = GHOST_kFailure;
|
GHOST_TSuccess result = GHOST_kFailure;
|
||||||
|
|
||||||
@@ -796,18 +775,13 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
|
|||||||
return visible;
|
return visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy)
|
||||||
GHOST_TInt32 cx,
|
|
||||||
GHOST_TInt32 cy)
|
|
||||||
{
|
{
|
||||||
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
|
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
|
void GHOST_SetRectangleCenter(
|
||||||
GHOST_TInt32 cx,
|
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h)
|
||||||
GHOST_TInt32 cy,
|
|
||||||
GHOST_TInt32 w,
|
|
||||||
GHOST_TInt32 h)
|
|
||||||
{
|
{
|
||||||
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
|
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
|
||||||
}
|
}
|
||||||
@@ -823,13 +797,13 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns8 *GHOST_getClipboard(int selection)
|
char *GHOST_getClipboard(bool selection)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
return system->getClipboard(selection);
|
return system->getClipboard(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
|
void GHOST_putClipboard(const char *buffer, bool selection)
|
||||||
{
|
{
|
||||||
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
GHOST_ISystem *system = GHOST_ISystem::getSystem();
|
||||||
system->putClipboard(buffer, selection);
|
system->putClipboard(buffer, selection);
|
||||||
@@ -861,7 +835,7 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
|
|||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
|
uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
return window->getDPIHint();
|
return window->getDPIHint();
|
||||||
@@ -869,12 +843,8 @@ GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
|
|||||||
|
|
||||||
#ifdef WITH_INPUT_IME
|
#ifdef WITH_INPUT_IME
|
||||||
|
|
||||||
void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
|
void GHOST_BeginIME(
|
||||||
GHOST_TInt32 x,
|
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
|
||||||
GHOST_TInt32 y,
|
|
||||||
GHOST_TInt32 w,
|
|
||||||
GHOST_TInt32 h,
|
|
||||||
int complete)
|
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
|
||||||
window->beginIME(x, y, w, h, complete);
|
window->beginIME(x, y, w, h, complete);
|
||||||
@@ -972,7 +942,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_contexthandle, const char
|
|||||||
|
|
||||||
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
|
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionInfo *infos)
|
const GHOST_XrActionInfo *infos)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -983,7 +953,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
|
|||||||
|
|
||||||
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
|
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const char *const *action_names)
|
const char *const *action_names)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -993,7 +963,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
|
|||||||
|
|
||||||
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionSpaceInfo *infos)
|
const GHOST_XrActionSpaceInfo *infos)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -1005,7 +975,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
|||||||
|
|
||||||
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionSpaceInfo *infos)
|
const GHOST_XrActionSpaceInfo *infos)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -1015,7 +985,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
|
|||||||
|
|
||||||
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionProfileInfo *infos)
|
const GHOST_XrActionProfileInfo *infos)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -1027,7 +997,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
|||||||
|
|
||||||
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
GHOST_TUns32 count,
|
uint32_t count,
|
||||||
const GHOST_XrActionProfileInfo *infos)
|
const GHOST_XrActionProfileInfo *infos)
|
||||||
{
|
{
|
||||||
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
|
||||||
@@ -1054,7 +1024,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
|
|||||||
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
|
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
|
||||||
const char *action_set_name,
|
const char *action_set_name,
|
||||||
const char *action_name,
|
const char *action_name,
|
||||||
const GHOST_TInt64 *duration,
|
const int64_t *duration,
|
||||||
const float *frequency,
|
const float *frequency,
|
||||||
const float *amplitude)
|
const float *amplitude)
|
||||||
{
|
{
|
||||||
|
@@ -217,7 +217,7 @@ static void makeAttribList(std::vector<NSOpenGLPixelFormatAttribute> &attribs,
|
|||||||
attribs.push_back(NSOpenGLPFAOpenGLProfile);
|
attribs.push_back(NSOpenGLPFAOpenGLProfile);
|
||||||
attribs.push_back(coreProfile ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy);
|
attribs.push_back(coreProfile ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy);
|
||||||
|
|
||||||
// Pixel Format Attributes for the windowed NSOpenGLContext
|
/* Pixel Format Attributes for the windowed NSOpenGLContext. */
|
||||||
attribs.push_back(NSOpenGLPFADoubleBuffer);
|
attribs.push_back(NSOpenGLPFADoubleBuffer);
|
||||||
|
|
||||||
if (softwareGL) {
|
if (softwareGL) {
|
||||||
@@ -250,7 +250,8 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
|
|||||||
static const bool needAlpha = false;
|
static const bool needAlpha = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool softwareGL = getenv("BLENDER_SOFTWAREGL"); // command-line argument would be better
|
/* Command-line argument would be better. */
|
||||||
|
static bool softwareGL = getenv("BLENDER_SOFTWAREGL");
|
||||||
|
|
||||||
std::vector<NSOpenGLPixelFormatAttribute> attribs;
|
std::vector<NSOpenGLPixelFormatAttribute> attribs;
|
||||||
attribs.reserve(40);
|
attribs.reserve(40);
|
||||||
@@ -287,7 +288,7 @@ GHOST_TSuccess GHOST_ContextCGL::initializeDrawingContext()
|
|||||||
|
|
||||||
if (m_metalView) {
|
if (m_metalView) {
|
||||||
if (m_defaultFramebuffer == 0) {
|
if (m_defaultFramebuffer == 0) {
|
||||||
// Create a virtual framebuffer
|
/* Create a virtual frame-buffer. */
|
||||||
[m_openGLContext makeCurrentContext];
|
[m_openGLContext makeCurrentContext];
|
||||||
metalInitFramebuffer();
|
metalInitFramebuffer();
|
||||||
initClearGL();
|
initClearGL();
|
||||||
@@ -342,11 +343,11 @@ void GHOST_ContextCGL::metalInit()
|
|||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
id<MTLDevice> device = m_metalLayer.device;
|
id<MTLDevice> device = m_metalLayer.device;
|
||||||
|
|
||||||
// Create a command queue for blit/present operation
|
/* Create a command queue for blit/present operation. */
|
||||||
m_metalCmdQueue = (MTLCommandQueue *)[device newCommandQueue];
|
m_metalCmdQueue = (MTLCommandQueue *)[device newCommandQueue];
|
||||||
[m_metalCmdQueue retain];
|
[m_metalCmdQueue retain];
|
||||||
|
|
||||||
// Create shaders for blit operation
|
/* Create shaders for blit operation. */
|
||||||
NSString *source = @R"msl(
|
NSString *source = @R"msl(
|
||||||
using namespace metal;
|
using namespace metal;
|
||||||
|
|
||||||
@@ -387,7 +388,7 @@ void GHOST_ContextCGL::metalInit()
|
|||||||
"GHOST_ContextCGL::metalInit: newLibraryWithSource:options:error: failed!");
|
"GHOST_ContextCGL::metalInit: newLibraryWithSource:options:error: failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a render pipeline for blit operation
|
/* Create a render pipeline for blit operation. */
|
||||||
MTLRenderPipelineDescriptor *desc = [[[MTLRenderPipelineDescriptor alloc] init] autorelease];
|
MTLRenderPipelineDescriptor *desc = [[[MTLRenderPipelineDescriptor alloc] init] autorelease];
|
||||||
|
|
||||||
desc.fragmentFunction = [library newFunctionWithName:@"fragment_shader"];
|
desc.fragmentFunction = [library newFunctionWithName:@"fragment_shader"];
|
||||||
@@ -460,7 +461,7 @@ void GHOST_ContextCGL::metalUpdateFramebuffer()
|
|||||||
"GHOST_ContextCGL::metalUpdateFramebuffer: CVPixelBufferCreate failed!");
|
"GHOST_ContextCGL::metalUpdateFramebuffer: CVPixelBufferCreate failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an OpenGL texture
|
/* Create an OpenGL texture. */
|
||||||
CVOpenGLTextureCacheRef cvGLTexCache = nil;
|
CVOpenGLTextureCacheRef cvGLTexCache = nil;
|
||||||
cvret = CVOpenGLTextureCacheCreate(kCFAllocatorDefault,
|
cvret = CVOpenGLTextureCacheCreate(kCFAllocatorDefault,
|
||||||
nil,
|
nil,
|
||||||
@@ -485,7 +486,7 @@ void GHOST_ContextCGL::metalUpdateFramebuffer()
|
|||||||
unsigned int glTex;
|
unsigned int glTex;
|
||||||
glTex = CVOpenGLTextureGetName(cvGLTex);
|
glTex = CVOpenGLTextureGetName(cvGLTex);
|
||||||
|
|
||||||
// Create a Metal texture
|
/* Create a Metal texture. */
|
||||||
CVMetalTextureCacheRef cvMetalTexCache = nil;
|
CVMetalTextureCacheRef cvMetalTexCache = nil;
|
||||||
cvret = CVMetalTextureCacheCreate(
|
cvret = CVMetalTextureCacheCreate(
|
||||||
kCFAllocatorDefault, nil, m_metalLayer.device, nil, &cvMetalTexCache);
|
kCFAllocatorDefault, nil, m_metalLayer.device, nil, &cvMetalTexCache);
|
||||||
|
@@ -283,8 +283,8 @@ GHOST_TSuccess GHOST_ContextEGL::setSwapInterval(int interval)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
|
GHOST_TSuccess GHOST_ContextEGL::getSwapInterval(int &intervalOut)
|
||||||
{
|
{
|
||||||
// This is a bit of a kludge because there does not seem to
|
/* This is a bit of a kludge because there does not seem to
|
||||||
// be a way to query the swap interval with EGL.
|
* be a way to query the swap interval with EGL. */
|
||||||
intervalOut = m_swap_interval;
|
intervalOut = m_swap_interval;
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
@@ -365,21 +365,21 @@ static const std::string &api_string(EGLenum api)
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
||||||
{
|
{
|
||||||
// objects have to be declared here due to the use of goto
|
/* Objects have to be declared here due to the use of `goto`. */
|
||||||
std::vector<EGLint> attrib_list;
|
std::vector<EGLint> attrib_list;
|
||||||
EGLint num_config = 0;
|
EGLint num_config = 0;
|
||||||
|
|
||||||
if (m_stereoVisual)
|
if (m_stereoVisual)
|
||||||
fprintf(stderr, "Warning! Stereo OpenGL ES contexts are not supported.\n");
|
fprintf(stderr, "Warning! Stereo OpenGL ES contexts are not supported.\n");
|
||||||
|
|
||||||
m_stereoVisual = false; // It doesn't matter what the Window wants.
|
m_stereoVisual = false; /* It doesn't matter what the Window wants. */
|
||||||
|
|
||||||
if (!initContextEGLEW()) {
|
if (!initContextEGLEW()) {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_GL_ANGLE
|
#ifdef WITH_GL_ANGLE
|
||||||
// d3dcompiler_XX.dll needs to be loaded before ANGLE will work
|
/* `d3dcompiler_XX.dll` needs to be loaded before ANGLE will work. */
|
||||||
if (s_d3dcompiler == NULL) {
|
if (s_d3dcompiler == NULL) {
|
||||||
s_d3dcompiler = LoadLibrary(D3DCOMPILER);
|
s_d3dcompiler = LoadLibrary(D3DCOMPILER);
|
||||||
|
|
||||||
@@ -410,13 +410,13 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
|||||||
if (!bindAPI(m_api))
|
if (!bindAPI(m_api))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
// build attribute list
|
/* Build attribute list. */
|
||||||
|
|
||||||
attrib_list.reserve(20);
|
attrib_list.reserve(20);
|
||||||
|
|
||||||
if (m_api == EGL_OPENGL_ES_API && EGLEW_VERSION_1_2) {
|
if (m_api == EGL_OPENGL_ES_API && EGLEW_VERSION_1_2) {
|
||||||
// According to the spec it seems that you are required to set EGL_RENDERABLE_TYPE,
|
/* According to the spec it seems that you are required to set EGL_RENDERABLE_TYPE,
|
||||||
// but some implementations (ANGLE) do not seem to care.
|
* but some implementations (ANGLE) do not seem to care. */
|
||||||
|
|
||||||
if (m_contextMajorVersion == 1) {
|
if (m_contextMajorVersion == 1) {
|
||||||
attrib_list.push_back(EGL_RENDERABLE_TYPE);
|
attrib_list.push_back(EGL_RENDERABLE_TYPE);
|
||||||
@@ -469,7 +469,7 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_nativeWindow == 0) {
|
if (m_nativeWindow == 0) {
|
||||||
// off-screen surface
|
/* Off-screen surface. */
|
||||||
attrib_list.push_back(EGL_SURFACE_TYPE);
|
attrib_list.push_back(EGL_SURFACE_TYPE);
|
||||||
attrib_list.push_back(EGL_PBUFFER_BIT);
|
attrib_list.push_back(EGL_PBUFFER_BIT);
|
||||||
}
|
}
|
||||||
@@ -479,8 +479,8 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext()
|
|||||||
if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &m_config, 1, &num_config)))
|
if (!EGL_CHK(::eglChooseConfig(m_display, &(attrib_list[0]), &m_config, 1, &num_config)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
// A common error is to assume that ChooseConfig worked because it returned EGL_TRUE
|
/* A common error is to assume that ChooseConfig worked because it returned EGL_TRUE. */
|
||||||
if (num_config != 1) // num_config should be exactly 1
|
if (num_config != 1) /* `num_config` should be exactly 1. */
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (m_nativeWindow != 0) {
|
if (m_nativeWindow != 0) {
|
||||||
|
@@ -335,10 +335,11 @@ void GHOST_ContextWGL::initContextWGLEW(PIXELFORMATDESCRIPTOR &preferredPFD)
|
|||||||
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
|
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
|
||||||
goto finalize;
|
goto finalize;
|
||||||
|
|
||||||
if (GLEW_CHK(glewInit()) != GLEW_OK)
|
if (GLEW_CHK(glewInit()) != GLEW_OK) {
|
||||||
fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize properly.\n");
|
fprintf(stderr, "Warning! Dummy GLEW/WGLEW failed to initialize properly.\n");
|
||||||
|
}
|
||||||
|
|
||||||
// the following are not technially WGLEW, but they also require a context to work
|
/* The following are not technically WGLEW, but they also require a context to work. */
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
free((void *)m_dummyRenderer);
|
free((void *)m_dummyRenderer);
|
||||||
|
@@ -49,20 +49,20 @@ GHOST_TSuccess GHOST_DisplayManager::initialize(void)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(GHOST_TUns8 & /*numDisplays*/) const
|
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(uint8_t & /*numDisplays*/) const
|
||||||
{
|
{
|
||||||
// Don't know if we have a display...
|
/* Don't know if we have a display. */
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(uint8_t display,
|
||||||
GHOST_TInt32 &numSettings) const
|
int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
|
|
||||||
GHOST_ASSERT(m_settingsInitialized,
|
GHOST_ASSERT(m_settingsInitialized,
|
||||||
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
|
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
|
||||||
GHOST_TUns8 numDisplays;
|
uint8_t numDisplays;
|
||||||
success = getNumDisplays(numDisplays);
|
success = getNumDisplays(numDisplays);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
if (display < numDisplays) {
|
if (display < numDisplays) {
|
||||||
@@ -75,18 +75,18 @@ GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(GHOST_TUns8 display,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
|
|
||||||
GHOST_ASSERT(m_settingsInitialized,
|
GHOST_ASSERT(m_settingsInitialized,
|
||||||
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
|
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
|
||||||
GHOST_TUns8 numDisplays;
|
uint8_t numDisplays;
|
||||||
success = getNumDisplays(numDisplays);
|
success = getNumDisplays(numDisplays);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
if (display < numDisplays && ((GHOST_TUns8)index < m_settings[display].size())) {
|
if (display < numDisplays && ((uint8_t)index < m_settings[display].size())) {
|
||||||
setting = m_settings[display][index];
|
setting = m_settings[display][index];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -97,18 +97,18 @@ GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::getCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManager::getCurrentDisplaySetting(
|
||||||
GHOST_TUns8 /*display*/, GHOST_DisplaySetting & /*setting*/) const
|
uint8_t /*display*/, GHOST_DisplaySetting & /*setting*/) const
|
||||||
{
|
{
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::setCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManager::setCurrentDisplaySetting(
|
||||||
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting & /*setting*/)
|
uint8_t /*display*/, const GHOST_DisplaySetting & /*setting*/)
|
||||||
{
|
{
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::findMatch(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
|
||||||
const GHOST_DisplaySetting &setting,
|
const GHOST_DisplaySetting &setting,
|
||||||
GHOST_DisplaySetting &match) const
|
GHOST_DisplaySetting &match) const
|
||||||
{
|
{
|
||||||
@@ -120,18 +120,18 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(GHOST_TUns8 display,
|
|||||||
(int)setting.xPixels, (int)setting.yPixels, (int)setting.bpp, (int)setting.frequency};
|
(int)setting.xPixels, (int)setting.yPixels, (int)setting.bpp, (int)setting.frequency};
|
||||||
int capabilities[4];
|
int capabilities[4];
|
||||||
double field, score;
|
double field, score;
|
||||||
double best = 1e12; // A big number
|
double best = 1e12; /* A big number. */
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
// Look at all the display modes
|
/* Look at all the display modes. */
|
||||||
for (int i = 0; (i < (int)m_settings[display].size()); i++) {
|
for (int i = 0; (i < (int)m_settings[display].size()); i++) {
|
||||||
// Store the capabilities of the display device
|
/* Store the capabilities of the display device. */
|
||||||
capabilities[0] = m_settings[display][i].xPixels;
|
capabilities[0] = m_settings[display][i].xPixels;
|
||||||
capabilities[1] = m_settings[display][i].yPixels;
|
capabilities[1] = m_settings[display][i].yPixels;
|
||||||
capabilities[2] = m_settings[display][i].bpp;
|
capabilities[2] = m_settings[display][i].bpp;
|
||||||
capabilities[3] = m_settings[display][i].frequency;
|
capabilities[3] = m_settings[display][i].frequency;
|
||||||
|
|
||||||
// Match against all the fields of the display settings
|
/* Match against all the fields of the display settings. */
|
||||||
score = 0;
|
score = 0;
|
||||||
for (int j = 0; j < 4; j++) {
|
for (int j = 0; j < 4; j++) {
|
||||||
field = capabilities[j] - criteria[j];
|
field = capabilities[j] - criteria[j];
|
||||||
@@ -157,17 +157,16 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(GHOST_TUns8 display,
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManager::initializeSettings(void)
|
GHOST_TSuccess GHOST_DisplayManager::initializeSettings(void)
|
||||||
{
|
{
|
||||||
GHOST_TUns8 numDisplays;
|
uint8_t numDisplays;
|
||||||
GHOST_TSuccess success = getNumDisplays(numDisplays);
|
GHOST_TSuccess success = getNumDisplays(numDisplays);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
for (GHOST_TUns8 display = 0; (display < numDisplays) && (success == GHOST_kSuccess);
|
for (uint8_t display = 0; (display < numDisplays) && (success == GHOST_kSuccess); display++) {
|
||||||
display++) {
|
|
||||||
GHOST_DisplaySettings displaySettings;
|
GHOST_DisplaySettings displaySettings;
|
||||||
m_settings.push_back(displaySettings);
|
m_settings.push_back(displaySettings);
|
||||||
GHOST_TInt32 numSettings;
|
int32_t numSettings;
|
||||||
success = getNumDisplaySettings(display, numSettings);
|
success = getNumDisplaySettings(display, numSettings);
|
||||||
if (success == GHOST_kSuccess) {
|
if (success == GHOST_kSuccess) {
|
||||||
GHOST_TInt32 index;
|
int32_t index;
|
||||||
GHOST_DisplaySetting setting;
|
GHOST_DisplaySetting setting;
|
||||||
for (index = 0; (index < numSettings) && (success == GHOST_kSuccess); index++) {
|
for (index = 0; (index < numSettings) && (success == GHOST_kSuccess); index++) {
|
||||||
success = getDisplaySetting(display, index, setting);
|
success = getDisplaySetting(display, index, setting);
|
||||||
|
@@ -55,7 +55,7 @@ class GHOST_DisplayManager {
|
|||||||
* \param numDisplays: The number of displays on this system.
|
* \param numDisplays: The number of displays on this system.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
|
virtual GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of display settings for this display device.
|
* Returns the number of display settings for this display device.
|
||||||
@@ -63,8 +63,7 @@ class GHOST_DisplayManager {
|
|||||||
* \param numSettings: The number of settings of the display device with this index.
|
* \param numSettings: The number of settings of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display,
|
virtual GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||||
GHOST_TInt32 &numSettings) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current setting for this display device.
|
* Returns the current setting for this display device.
|
||||||
@@ -73,8 +72,8 @@ class GHOST_DisplayManager {
|
|||||||
* \param setting: The setting of the display device with this index.
|
* \param setting: The setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
virtual GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +82,7 @@ class GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
|
virtual GHOST_TSuccess getCurrentDisplaySetting(uint8_t display,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,7 +93,7 @@ class GHOST_DisplayManager {
|
|||||||
* \param setting: The setting of the display device to be matched and activated.
|
* \param setting: The setting of the display device to be matched and activated.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
|
virtual GHOST_TSuccess setCurrentDisplaySetting(uint8_t display,
|
||||||
const GHOST_DisplaySetting &setting);
|
const GHOST_DisplaySetting &setting);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -107,7 +106,7 @@ class GHOST_DisplayManager {
|
|||||||
* \param match: The optimal display setting.
|
* \param match: The optimal display setting.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess findMatch(GHOST_TUns8 display,
|
GHOST_TSuccess findMatch(uint8_t display,
|
||||||
const GHOST_DisplaySetting &setting,
|
const GHOST_DisplaySetting &setting,
|
||||||
GHOST_DisplaySetting &match) const;
|
GHOST_DisplaySetting &match) const;
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
|||||||
* \param numDisplays: The number of displays on this system.
|
* \param numDisplays: The number of displays on this system.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
|
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of display settings for this display device.
|
* Returns the number of display settings for this display device.
|
||||||
@@ -54,7 +54,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
|||||||
* \param numSetting: The number of settings of the display device with this index.
|
* \param numSetting: The number of settings of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
|
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current setting for this display device.
|
* Returns the current setting for this display device.
|
||||||
@@ -63,8 +63,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
|||||||
* \param setting: The setting of the display device with this index.
|
* \param setting: The setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,8 +73,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||||
GHOST_DisplaySetting &setting) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the current setting for this display device.
|
* Changes the current setting for this display device.
|
||||||
@@ -82,8 +81,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||||
const GHOST_DisplaySetting &setting);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Do not cache values as OS X supports screen hot plug
|
// Do not cache values as OS X supports screen hot plug
|
||||||
|
@@ -29,26 +29,26 @@ GHOST_DisplayManagerCocoa::GHOST_DisplayManagerCocoa(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(GHOST_TUns8 &numDisplays) const
|
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(uint8_t &numDisplays) const
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
numDisplays = (GHOST_TUns8)[[NSScreen screens] count];
|
numDisplays = (uint8_t)[[NSScreen screens] count];
|
||||||
|
|
||||||
[pool drain];
|
[pool drain];
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(uint8_t display,
|
||||||
GHOST_TInt32 &numSettings) const
|
int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
numSettings = (GHOST_TInt32)3; // Width, Height, BitsPerPixel
|
numSettings = (int32_t)3; // Width, Height, BitsPerPixel
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
NSScreen *askedDisplay;
|
NSScreen *askedDisplay;
|
||||||
@@ -86,7 +86,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
|
uint8_t display, GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
NSScreen *askedDisplay;
|
NSScreen *askedDisplay;
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
|
uint8_t display, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(
|
GHOST_ASSERT(
|
||||||
(display == kMainDisplay),
|
(display == kMainDisplay),
|
||||||
|
@@ -31,25 +31,25 @@ class GHOST_DisplayManagerNULL : public GHOST_DisplayManager {
|
|||||||
GHOST_DisplayManagerNULL(GHOST_SystemNULL *system) : GHOST_DisplayManager(), m_system(system)
|
GHOST_DisplayManagerNULL(GHOST_SystemNULL *system) : GHOST_DisplayManager(), m_system(system)
|
||||||
{ /* nop */
|
{ /* nop */
|
||||||
}
|
}
|
||||||
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const
|
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const
|
||||||
{
|
{
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const
|
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
|
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
return getDisplaySetting(display, GHOST_TInt32(0), setting);
|
return getDisplaySetting(display, int32_t(0), setting);
|
||||||
}
|
}
|
||||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
|
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
@@ -33,14 +33,14 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
|
|||||||
memset(&m_mode, 0, sizeof(m_mode));
|
memset(&m_mode, 0, sizeof(m_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8 &numDisplays) const
|
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(uint8_t &numDisplays) const
|
||||||
{
|
{
|
||||||
numDisplays = SDL_GetNumVideoDisplays();
|
numDisplays = SDL_GetNumVideoDisplays();
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(uint8_t display,
|
||||||
GHOST_TInt32 &numSettings) const
|
int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ static void ghost_mode_to_sdl(const GHOST_DisplaySetting &setting, SDL_DisplayMo
|
|||||||
mode->refresh_rate = setting.frequency;
|
mode->refresh_rate = setting.frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
|
||||||
@@ -81,7 +81,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
|
uint8_t display, GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
SDL_GetCurrentDisplayMode(display, &mode);
|
SDL_GetCurrentDisplayMode(display, &mode);
|
||||||
@@ -98,7 +98,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL(SDL_DisplayMode
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
|
uint8_t display, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Mode switching code ported from Quake 2 version 3.21 and bzflag version
|
* Mode switching code ported from Quake 2 version 3.21 and bzflag version
|
||||||
|
@@ -37,21 +37,19 @@ class GHOST_DisplayManagerSDL : public GHOST_DisplayManager {
|
|||||||
public:
|
public:
|
||||||
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system);
|
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system);
|
||||||
|
|
||||||
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
|
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||||
|
|
||||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
|
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||||
|
|
||||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||||
GHOST_DisplaySetting &setting) const;
|
|
||||||
|
|
||||||
GHOST_TSuccess getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const;
|
GHOST_TSuccess getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const;
|
||||||
|
|
||||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||||
const GHOST_DisplaySetting &setting);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GHOST_SystemSDL *m_system;
|
GHOST_SystemSDL *m_system;
|
||||||
|
@@ -35,7 +35,7 @@ GHOST_DisplayManagerWin32::GHOST_DisplayManagerWin32(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8 &numDisplays) const
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(uint8_t &numDisplays) const
|
||||||
{
|
{
|
||||||
numDisplays = ::GetSystemMetrics(SM_CMONITORS);
|
numDisplays = ::GetSystemMetrics(SM_CMONITORS);
|
||||||
return numDisplays > 0 ? GHOST_kSuccess : GHOST_kFailure;
|
return numDisplays > 0 ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
@@ -54,8 +54,8 @@ static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd)
|
|||||||
* the information that was cached the last time the function was called with iModeNum
|
* the information that was cached the last time the function was called with iModeNum
|
||||||
* set to zero.
|
* set to zero.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
|
||||||
GHOST_TInt32 &numSettings) const
|
int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
if (!get_dd(display, &display_device))
|
if (!get_dd(display, &display_device))
|
||||||
@@ -69,8 +69,8 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 disp
|
|||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
@@ -111,13 +111,13 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
|
uint8_t display, GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
return getDisplaySetting(display, ENUM_CURRENT_SETTINGS, setting);
|
return getDisplaySetting(display, ENUM_CURRENT_SETTINGS, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
|
uint8_t display, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
if (!get_dd(display, &display_device))
|
if (!get_dd(display, &display_device))
|
||||||
|
@@ -45,7 +45,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
|||||||
* \param numDisplays: The number of displays on this system.
|
* \param numDisplays: The number of displays on this system.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
|
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of display settings for this display device.
|
* Returns the number of display settings for this display device.
|
||||||
@@ -53,7 +53,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
|||||||
* \param numSetting: The number of settings of the display device with this index.
|
* \param numSetting: The number of settings of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
|
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current setting for this display device.
|
* Returns the current setting for this display device.
|
||||||
@@ -62,8 +62,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The setting of the display device with this index.
|
* \param setting: The setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,8 +72,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||||
GHOST_DisplaySetting &setting) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the current setting for this display device.
|
* Changes the current setting for this display device.
|
||||||
@@ -81,8 +80,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||||
const GHOST_DisplaySetting &setting);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
@@ -40,14 +40,14 @@ GHOST_DisplayManagerX11::GHOST_DisplayManagerX11(GHOST_SystemX11 *system)
|
|||||||
/* nothing to do. */
|
/* nothing to do. */
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(GHOST_TUns8 &numDisplays) const
|
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(uint8_t &numDisplays) const
|
||||||
{
|
{
|
||||||
numDisplays = m_system->getNumDisplays();
|
numDisplays = m_system->getNumDisplays();
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display,
|
||||||
GHOST_TInt32 &numSettings) const
|
int32_t &numSettings) const
|
||||||
{
|
{
|
||||||
#ifdef WITH_X11_XF86VMODE
|
#ifdef WITH_X11_XF86VMODE
|
||||||
int majorVersion, minorVersion;
|
int majorVersion, minorVersion;
|
||||||
@@ -88,8 +88,8 @@ static int calculate_rate(XF86VidModeModeInfo *info)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
Display *dpy = m_system->getXDisplay();
|
Display *dpy = m_system->getXDisplay();
|
||||||
@@ -140,7 +140,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(GHOST_TUns8 display,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
|
||||||
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
|
uint8_t display, GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
/* According to the xf86vidmodegetallmodelines man page,
|
/* According to the xf86vidmodegetallmodelines man page,
|
||||||
* "The first element of the array corresponds to the current video mode."
|
* "The first element of the array corresponds to the current video mode."
|
||||||
@@ -149,7 +149,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
|
|||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_DisplayManagerX11::setCurrentDisplaySetting(
|
GHOST_TSuccess GHOST_DisplayManagerX11::setCurrentDisplaySetting(
|
||||||
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting &setting)
|
uint8_t /*display*/, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
#ifdef WITH_X11_XF86VMODE
|
#ifdef WITH_X11_XF86VMODE
|
||||||
/* Mode switching code ported from SDL:
|
/* Mode switching code ported from SDL:
|
||||||
|
@@ -43,7 +43,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
|||||||
* \param numDisplays: The number of displays on this system.
|
* \param numDisplays: The number of displays on this system.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
|
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of display settings for this display device.
|
* Returns the number of display settings for this display device.
|
||||||
@@ -51,7 +51,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
|||||||
* \param numSetting: The number of settings of the display device with this index.
|
* \param numSetting: The number of settings of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
|
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current setting for this display device.
|
* Returns the current setting for this display device.
|
||||||
@@ -60,8 +60,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The setting of the display device with this index.
|
* \param setting: The setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getDisplaySetting(uint8_t display,
|
||||||
GHOST_TInt32 index,
|
int32_t index,
|
||||||
GHOST_DisplaySetting &setting) const;
|
GHOST_DisplaySetting &setting) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,8 +70,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
|
||||||
GHOST_DisplaySetting &setting) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the current setting for this display device.
|
* Changes the current setting for this display device.
|
||||||
@@ -79,8 +78,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
|
|||||||
* \param setting: The current setting of the display device with this index.
|
* \param setting: The current setting of the display device with this index.
|
||||||
* \return Indication of success.
|
* \return Indication of success.
|
||||||
*/
|
*/
|
||||||
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
|
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
|
||||||
const GHOST_DisplaySetting &setting);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GHOST_SystemX11 *m_system;
|
GHOST_SystemX11 *m_system;
|
||||||
|
@@ -242,7 +242,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
|
|||||||
|
|
||||||
strArray = (GHOST_TStringArray *)::malloc(sizeof(GHOST_TStringArray));
|
strArray = (GHOST_TStringArray *)::malloc(sizeof(GHOST_TStringArray));
|
||||||
strArray->count = 0;
|
strArray->count = 0;
|
||||||
strArray->strings = (GHOST_TUns8 **)::malloc(totfiles * sizeof(GHOST_TUns8 *));
|
strArray->strings = (uint8_t **)::malloc(totfiles * sizeof(uint8_t *));
|
||||||
|
|
||||||
for (UINT nfile = 0; nfile < totfiles; nfile++) {
|
for (UINT nfile = 0; nfile < totfiles; nfile++) {
|
||||||
if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0) {
|
if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0) {
|
||||||
@@ -251,7 +251,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
|
|||||||
}
|
}
|
||||||
// Just ignore paths that could not be converted verbatim.
|
// Just ignore paths that could not be converted verbatim.
|
||||||
|
|
||||||
strArray->strings[nvalid] = (GHOST_TUns8 *)temp_path;
|
strArray->strings[nvalid] = (uint8_t *)temp_path;
|
||||||
strArray->count = nvalid + 1;
|
strArray->count = nvalid + 1;
|
||||||
nvalid++;
|
nvalid++;
|
||||||
}
|
}
|
||||||
|
@@ -115,8 +115,10 @@ GHOST_DropTargetX11::~GHOST_DropTargetX11()
|
|||||||
/* Based on: https://stackoverflow.com/a/2766963/432509 */
|
/* Based on: https://stackoverflow.com/a/2766963/432509 */
|
||||||
|
|
||||||
typedef enum DecodeState_e {
|
typedef enum DecodeState_e {
|
||||||
STATE_SEARCH = 0, ///< searching for an ampersand to convert
|
/** Searching for an ampersand to convert. */
|
||||||
STATE_CONVERTING ///< convert the two proceeding characters from hex
|
STATE_SEARCH = 0,
|
||||||
|
/** Convert the two proceeding characters from hex. */
|
||||||
|
STATE_CONVERTING
|
||||||
} DecodeState_e;
|
} DecodeState_e;
|
||||||
|
|
||||||
void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn)
|
void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn)
|
||||||
@@ -216,7 +218,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
|
|||||||
|
|
||||||
strArray = (GHOST_TStringArray *)malloc(sizeof(GHOST_TStringArray));
|
strArray = (GHOST_TStringArray *)malloc(sizeof(GHOST_TStringArray));
|
||||||
strArray->count = 0;
|
strArray->count = 0;
|
||||||
strArray->strings = (GHOST_TUns8 **)malloc(totPaths * sizeof(GHOST_TUns8 *));
|
strArray->strings = (uint8_t **)malloc(totPaths * sizeof(uint8_t *));
|
||||||
|
|
||||||
curLength = 0;
|
curLength = 0;
|
||||||
for (int i = 0; i <= dropBufferSize; i++) {
|
for (int i = 0; i <= dropBufferSize; i++) {
|
||||||
@@ -230,7 +232,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
|
|||||||
|
|
||||||
decodedPath = FileUrlDecode(curPath);
|
decodedPath = FileUrlDecode(curPath);
|
||||||
if (decodedPath) {
|
if (decodedPath) {
|
||||||
strArray->strings[strArray->count] = (GHOST_TUns8 *)decodedPath;
|
strArray->strings[strArray->count] = (uint8_t *)decodedPath;
|
||||||
strArray->count++;
|
strArray->count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ class GHOST_Event : public GHOST_IEvent {
|
|||||||
* \param type: The type of this event.
|
* \param type: The type of this event.
|
||||||
* \param window: The generating window (or NULL if system event).
|
* \param window: The generating window (or NULL if system event).
|
||||||
*/
|
*/
|
||||||
GHOST_Event(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window)
|
GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
|
||||||
: m_type(type), m_time(msec), m_window(window), m_data(NULL)
|
: m_type(type), m_time(msec), m_window(window), m_data(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ class GHOST_Event : public GHOST_IEvent {
|
|||||||
* Returns the time this event was generated.
|
* Returns the time this event was generated.
|
||||||
* \return The event generation time.
|
* \return The event generation time.
|
||||||
*/
|
*/
|
||||||
GHOST_TUns64 getTime()
|
uint64_t getTime()
|
||||||
{
|
{
|
||||||
return m_time;
|
return m_time;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class GHOST_Event : public GHOST_IEvent {
|
|||||||
/** Type of this event. */
|
/** Type of this event. */
|
||||||
GHOST_TEventType m_type;
|
GHOST_TEventType m_type;
|
||||||
/** The time this event was generated. */
|
/** The time this event was generated. */
|
||||||
GHOST_TUns64 m_time;
|
uint64_t m_time;
|
||||||
/** Pointer to the generating window. */
|
/** Pointer to the generating window. */
|
||||||
GHOST_IWindow *m_window;
|
GHOST_IWindow *m_window;
|
||||||
/** Pointer to the event data. */
|
/** Pointer to the event data. */
|
||||||
|
@@ -40,7 +40,7 @@ class GHOST_EventButton : public GHOST_Event {
|
|||||||
* \param button: The state of the buttons were at the time of the event.
|
* \param button: The state of the buttons were at the time of the event.
|
||||||
* \param tablet: The tablet data associated with this event.
|
* \param tablet: The tablet data associated with this event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventButton(GHOST_TUns64 time,
|
GHOST_EventButton(uint64_t time,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TButtonMask button,
|
GHOST_TButtonMask button,
|
||||||
|
@@ -39,11 +39,11 @@ class GHOST_EventCursor : public GHOST_Event {
|
|||||||
* \param y: The y-coordinate of the location the cursor was at the time of the event.
|
* \param y: The y-coordinate of the location the cursor was at the time of the event.
|
||||||
* \param tablet: The tablet data associated with this event.
|
* \param tablet: The tablet data associated with this event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventCursor(GHOST_TUns64 msec,
|
GHOST_EventCursor(uint64_t msec,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TInt32 x,
|
int32_t x,
|
||||||
GHOST_TInt32 y,
|
int32_t y,
|
||||||
const GHOST_TabletData &tablet)
|
const GHOST_TabletData &tablet)
|
||||||
: GHOST_Event(msec, type, window), m_cursorEventData({x, y, tablet})
|
: GHOST_Event(msec, type, window), m_cursorEventData({x, y, tablet})
|
||||||
{
|
{
|
||||||
|
@@ -72,7 +72,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
|
|||||||
* \param y: The y-coordinate of the location the cursor was at the time of the event.
|
* \param y: The y-coordinate of the location the cursor was at the time of the event.
|
||||||
* \param data: The "content" dropped in the window.
|
* \param data: The "content" dropped in the window.
|
||||||
*/
|
*/
|
||||||
GHOST_EventDragnDrop(GHOST_TUns64 time,
|
GHOST_EventDragnDrop(uint64_t time,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_TDragnDropTypes dataType,
|
GHOST_TDragnDropTypes dataType,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
@@ -90,7 +90,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
|
|||||||
|
|
||||||
~GHOST_EventDragnDrop()
|
~GHOST_EventDragnDrop()
|
||||||
{
|
{
|
||||||
// Free the dropped object data
|
/* Free the dropped object data. */
|
||||||
if (m_dragnDropEventData.data == NULL)
|
if (m_dragnDropEventData.data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -39,11 +39,8 @@ class GHOST_EventKey : public GHOST_Event {
|
|||||||
* \param type: The type of key event.
|
* \param type: The type of key event.
|
||||||
* \param key: The key code of the key.
|
* \param key: The key code of the key.
|
||||||
*/
|
*/
|
||||||
GHOST_EventKey(GHOST_TUns64 msec,
|
GHOST_EventKey(
|
||||||
GHOST_TEventType type,
|
uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TKey key, bool is_repeat)
|
||||||
GHOST_IWindow *window,
|
|
||||||
GHOST_TKey key,
|
|
||||||
bool is_repeat)
|
|
||||||
: GHOST_Event(msec, type, window)
|
: GHOST_Event(msec, type, window)
|
||||||
{
|
{
|
||||||
m_keyEventData.key = key;
|
m_keyEventData.key = key;
|
||||||
@@ -60,7 +57,7 @@ class GHOST_EventKey : public GHOST_Event {
|
|||||||
* \param key: The key code of the key.
|
* \param key: The key code of the key.
|
||||||
* \param ascii: The ascii code for the key event.
|
* \param ascii: The ascii code for the key event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventKey(GHOST_TUns64 msec,
|
GHOST_EventKey(uint64_t msec,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TKey key,
|
GHOST_TKey key,
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include "GHOST_EventManager.h"
|
#include "GHOST_EventManager.h"
|
||||||
#include "GHOST_Debug.h"
|
#include "GHOST_Debug.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h> // [mce] temp debug
|
|
||||||
|
|
||||||
GHOST_EventManager::GHOST_EventManager()
|
GHOST_EventManager::GHOST_EventManager()
|
||||||
{
|
{
|
||||||
@@ -46,14 +45,14 @@ GHOST_EventManager::~GHOST_EventManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns32 GHOST_EventManager::getNumEvents()
|
uint32_t GHOST_EventManager::getNumEvents()
|
||||||
{
|
{
|
||||||
return (GHOST_TUns32)m_events.size();
|
return (uint32_t)m_events.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns32 GHOST_EventManager::getNumEvents(GHOST_TEventType type)
|
uint32_t GHOST_EventManager::getNumEvents(GHOST_TEventType type)
|
||||||
{
|
{
|
||||||
GHOST_TUns32 numEvents = 0;
|
uint32_t numEvents = 0;
|
||||||
TEventStack::iterator p;
|
TEventStack::iterator p;
|
||||||
for (p = m_events.begin(); p != m_events.end(); ++p) {
|
for (p = m_events.begin(); p != m_events.end(); ++p) {
|
||||||
if ((*p)->getType() == type) {
|
if ((*p)->getType() == type) {
|
||||||
@@ -109,12 +108,12 @@ GHOST_TSuccess GHOST_EventManager::addConsumer(GHOST_IEventConsumer *consumer)
|
|||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(consumer, "invalid consumer");
|
GHOST_ASSERT(consumer, "invalid consumer");
|
||||||
|
|
||||||
// Check to see whether the consumer is already in our list
|
/* Check to see whether the consumer is already in our list. */
|
||||||
TConsumerVector::const_iterator iter = std::find(
|
TConsumerVector::const_iterator iter = std::find(
|
||||||
m_consumers.begin(), m_consumers.end(), consumer);
|
m_consumers.begin(), m_consumers.end(), consumer);
|
||||||
|
|
||||||
if (iter == m_consumers.end()) {
|
if (iter == m_consumers.end()) {
|
||||||
// Add the consumer
|
/* Add the consumer. */
|
||||||
m_consumers.push_back(consumer);
|
m_consumers.push_back(consumer);
|
||||||
success = GHOST_kSuccess;
|
success = GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
@@ -129,11 +128,11 @@ GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer *consumer
|
|||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
GHOST_ASSERT(consumer, "invalid consumer");
|
GHOST_ASSERT(consumer, "invalid consumer");
|
||||||
|
|
||||||
// Check to see whether the consumer is in our list
|
/* Check to see whether the consumer is in our list. */
|
||||||
TConsumerVector::iterator iter = std::find(m_consumers.begin(), m_consumers.end(), consumer);
|
TConsumerVector::iterator iter = std::find(m_consumers.begin(), m_consumers.end(), consumer);
|
||||||
|
|
||||||
if (iter != m_consumers.end()) {
|
if (iter != m_consumers.end()) {
|
||||||
// Remove the consumer
|
/* Remove the consumer. */
|
||||||
m_consumers.erase(iter);
|
m_consumers.erase(iter);
|
||||||
success = GHOST_kSuccess;
|
success = GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
|
@@ -53,14 +53,14 @@ class GHOST_EventManager {
|
|||||||
* Returns the number of events currently on the stack.
|
* Returns the number of events currently on the stack.
|
||||||
* \return The number of events on the stack.
|
* \return The number of events on the stack.
|
||||||
*/
|
*/
|
||||||
GHOST_TUns32 getNumEvents();
|
uint32_t getNumEvents();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of events of a certain type currently on the stack.
|
* Returns the number of events of a certain type currently on the stack.
|
||||||
* \param type: The type of events to be counted.
|
* \param type: The type of events to be counted.
|
||||||
* \return The number of events on the stack of this type.
|
* \return The number of events on the stack of this type.
|
||||||
*/
|
*/
|
||||||
GHOST_TUns32 getNumEvents(GHOST_TEventType type);
|
uint32_t getNumEvents(GHOST_TEventType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes an event on the stack.
|
* Pushes an event on the stack.
|
||||||
|
@@ -31,7 +31,7 @@ class GHOST_EventNDOFMotion : public GHOST_Event {
|
|||||||
GHOST_TEventNDOFMotionData m_axisData;
|
GHOST_TEventNDOFMotionData m_axisData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow *window)
|
GHOST_EventNDOFMotion(uint64_t time, GHOST_IWindow *window)
|
||||||
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
|
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
|
||||||
{
|
{
|
||||||
m_data = &m_axisData;
|
m_data = &m_axisData;
|
||||||
@@ -43,7 +43,7 @@ class GHOST_EventNDOFButton : public GHOST_Event {
|
|||||||
GHOST_TEventNDOFButtonData m_buttonData;
|
GHOST_TEventNDOFButtonData m_buttonData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow *window)
|
GHOST_EventNDOFButton(uint64_t time, GHOST_IWindow *window)
|
||||||
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
|
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
|
||||||
{
|
{
|
||||||
m_data = &m_buttonData;
|
m_data = &m_buttonData;
|
||||||
|
@@ -39,7 +39,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
|
|||||||
if (event->getType() == GHOST_kEventWindowUpdate)
|
if (event->getType() == GHOST_kEventWindowUpdate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::cout << "GHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime()
|
std::cout << "GHOST_EventPrinter::processEvent, time: " << (int32_t)event->getTime()
|
||||||
<< ", type: ";
|
<< ", type: ";
|
||||||
switch (event->getType()) {
|
switch (event->getType()) {
|
||||||
case GHOST_kEventUnknown:
|
case GHOST_kEventUnknown:
|
||||||
|
@@ -38,7 +38,7 @@ class GHOST_EventString : public GHOST_Event {
|
|||||||
* \param window: The generating window (or NULL if system event).
|
* \param window: The generating window (or NULL if system event).
|
||||||
* \param data_ptr: Pointer to the (un-formatted) data associated with the event.
|
* \param data_ptr: Pointer to the (un-formatted) data associated with the event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventString(GHOST_TUns64 msec,
|
GHOST_EventString(uint64_t msec,
|
||||||
GHOST_TEventType type,
|
GHOST_TEventType type,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TEventDataPtr data_ptr)
|
GHOST_TEventDataPtr data_ptr)
|
||||||
|
@@ -39,13 +39,13 @@ class GHOST_EventTrackpad : public GHOST_Event {
|
|||||||
* \param x: The x-delta of the pan event.
|
* \param x: The x-delta of the pan event.
|
||||||
* \param y: The y-delta of the pan event.
|
* \param y: The y-delta of the pan event.
|
||||||
*/
|
*/
|
||||||
GHOST_EventTrackpad(GHOST_TUns64 msec,
|
GHOST_EventTrackpad(uint64_t msec,
|
||||||
GHOST_IWindow *window,
|
GHOST_IWindow *window,
|
||||||
GHOST_TTrackpadEventSubTypes subtype,
|
GHOST_TTrackpadEventSubTypes subtype,
|
||||||
GHOST_TInt32 x,
|
int32_t x,
|
||||||
GHOST_TInt32 y,
|
int32_t y,
|
||||||
GHOST_TInt32 deltaX,
|
int32_t deltaX,
|
||||||
GHOST_TInt32 deltaY,
|
int32_t deltaY,
|
||||||
bool isDirectionInverted)
|
bool isDirectionInverted)
|
||||||
: GHOST_Event(msec, GHOST_kEventTrackpad, window)
|
: GHOST_Event(msec, GHOST_kEventTrackpad, window)
|
||||||
{
|
{
|
||||||
|
@@ -39,7 +39,7 @@ class GHOST_EventWheel : public GHOST_Event {
|
|||||||
* \param window: The window of this event.
|
* \param window: The window of this event.
|
||||||
* \param z: The displacement of the mouse wheel.
|
* \param z: The displacement of the mouse wheel.
|
||||||
*/
|
*/
|
||||||
GHOST_EventWheel(GHOST_TUns64 msec, GHOST_IWindow *window, GHOST_TInt32 z)
|
GHOST_EventWheel(uint64_t msec, GHOST_IWindow *window, int32_t z)
|
||||||
: GHOST_Event(msec, GHOST_kEventWheel, window)
|
: GHOST_Event(msec, GHOST_kEventWheel, window)
|
||||||
{
|
{
|
||||||
m_wheelEventData.z = z;
|
m_wheelEventData.z = z;
|
||||||
|
@@ -57,9 +57,17 @@ GHOST_TSuccess GHOST_ISystem::createSystem()
|
|||||||
/* Special case, try Wayland, fall back to X11. */
|
/* Special case, try Wayland, fall back to X11. */
|
||||||
try {
|
try {
|
||||||
m_system = new GHOST_SystemWayland();
|
m_system = new GHOST_SystemWayland();
|
||||||
|
if (!std::getenv("BLENDER_WAYLAND")) {
|
||||||
|
printf("Connected to a Wayland compositor but Wayland is disabled at "\
|
||||||
|
"runtime.\nSet environment variable 'BLENDER_WAYLAND' (e.g. "\
|
||||||
|
"BLENDER_WAYLAND= blender) to use Wayland.\n");
|
||||||
|
throw std::runtime_error(std::string());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (const std::runtime_error &) {
|
catch (const std::runtime_error &) {
|
||||||
/* fallback to X11. */
|
/* fallback to X11. */
|
||||||
|
delete m_system;
|
||||||
|
m_system = nullptr;
|
||||||
}
|
}
|
||||||
if (!m_system) {
|
if (!m_system) {
|
||||||
m_system = new GHOST_SystemX11();
|
m_system = new GHOST_SystemX11();
|
||||||
|
@@ -44,7 +44,7 @@ class GHOST_EventIME : public GHOST_Event {
|
|||||||
* \param type: The type of key event.
|
* \param type: The type of key event.
|
||||||
* \param key: The key code of the key.
|
* \param key: The key code of the key.
|
||||||
*/
|
*/
|
||||||
GHOST_EventIME(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
|
GHOST_EventIME(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
|
||||||
: GHOST_Event(msec, type, window)
|
: GHOST_Event(msec, type, window)
|
||||||
{
|
{
|
||||||
this->m_data = customdata;
|
this->m_data = customdata;
|
||||||
|
@@ -72,17 +72,17 @@ struct GHOST_ModifierKeys {
|
|||||||
bool equals(const GHOST_ModifierKeys &keys) const;
|
bool equals(const GHOST_ModifierKeys &keys) const;
|
||||||
|
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_LeftShift : 1;
|
uint8_t m_LeftShift : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_RightShift : 1;
|
uint8_t m_RightShift : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_LeftAlt : 1;
|
uint8_t m_LeftAlt : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_RightAlt : 1;
|
uint8_t m_RightAlt : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_LeftControl : 1;
|
uint8_t m_LeftControl : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_RightControl : 1;
|
uint8_t m_RightControl : 1;
|
||||||
/** Bitfield that stores the appropriate key state. */
|
/** Bitfield that stores the appropriate key state. */
|
||||||
GHOST_TUns8 m_OS : 1;
|
uint8_t m_OS : 1;
|
||||||
};
|
};
|
||||||
|
@@ -22,51 +22,51 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h> // for error/info reporting
|
#include <stdio.h> /* For error/info reporting. */
|
||||||
#include <string.h> // for memory functions
|
#include <string.h> /* For memory functions. */
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_MOTION
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
// printable version of each GHOST_TProgress value
|
/* Printable version of each GHOST_TProgress value. */
|
||||||
static const char *progress_string[] = {
|
static const char *progress_string[] = {
|
||||||
"not started", "starting", "in progress", "finishing", "finished"};
|
"not started", "starting", "in progress", "finishing", "finished"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_BUTTONS
|
#ifdef DEBUG_NDOF_BUTTONS
|
||||||
static const char *ndof_button_names[] = {
|
static const char *ndof_button_names[] = {
|
||||||
// used internally, never sent
|
/* used internally, never sent */
|
||||||
"NDOF_BUTTON_NONE",
|
"NDOF_BUTTON_NONE",
|
||||||
// these two are available from any 3Dconnexion device
|
/* these two are available from any 3Dconnexion device */
|
||||||
"NDOF_BUTTON_MENU",
|
"NDOF_BUTTON_MENU",
|
||||||
"NDOF_BUTTON_FIT",
|
"NDOF_BUTTON_FIT",
|
||||||
// standard views
|
/* standard views */
|
||||||
"NDOF_BUTTON_TOP",
|
"NDOF_BUTTON_TOP",
|
||||||
"NDOF_BUTTON_BOTTOM",
|
"NDOF_BUTTON_BOTTOM",
|
||||||
"NDOF_BUTTON_LEFT",
|
"NDOF_BUTTON_LEFT",
|
||||||
"NDOF_BUTTON_RIGHT",
|
"NDOF_BUTTON_RIGHT",
|
||||||
"NDOF_BUTTON_FRONT",
|
"NDOF_BUTTON_FRONT",
|
||||||
"NDOF_BUTTON_BACK",
|
"NDOF_BUTTON_BACK",
|
||||||
// more views
|
/* more views */
|
||||||
"NDOF_BUTTON_ISO1",
|
"NDOF_BUTTON_ISO1",
|
||||||
"NDOF_BUTTON_ISO2",
|
"NDOF_BUTTON_ISO2",
|
||||||
// 90 degree rotations
|
/* 90 degree rotations */
|
||||||
"NDOF_BUTTON_ROLL_CW",
|
"NDOF_BUTTON_ROLL_CW",
|
||||||
"NDOF_BUTTON_ROLL_CCW",
|
"NDOF_BUTTON_ROLL_CCW",
|
||||||
"NDOF_BUTTON_SPIN_CW",
|
"NDOF_BUTTON_SPIN_CW",
|
||||||
"NDOF_BUTTON_SPIN_CCW",
|
"NDOF_BUTTON_SPIN_CCW",
|
||||||
"NDOF_BUTTON_TILT_CW",
|
"NDOF_BUTTON_TILT_CW",
|
||||||
"NDOF_BUTTON_TILT_CCW",
|
"NDOF_BUTTON_TILT_CCW",
|
||||||
// device control
|
/* device control */
|
||||||
"NDOF_BUTTON_ROTATE",
|
"NDOF_BUTTON_ROTATE",
|
||||||
"NDOF_BUTTON_PANZOOM",
|
"NDOF_BUTTON_PANZOOM",
|
||||||
"NDOF_BUTTON_DOMINANT",
|
"NDOF_BUTTON_DOMINANT",
|
||||||
"NDOF_BUTTON_PLUS",
|
"NDOF_BUTTON_PLUS",
|
||||||
"NDOF_BUTTON_MINUS",
|
"NDOF_BUTTON_MINUS",
|
||||||
// keyboard emulation
|
/* keyboard emulation */
|
||||||
"NDOF_BUTTON_ESC",
|
"NDOF_BUTTON_ESC",
|
||||||
"NDOF_BUTTON_ALT",
|
"NDOF_BUTTON_ALT",
|
||||||
"NDOF_BUTTON_SHIFT",
|
"NDOF_BUTTON_SHIFT",
|
||||||
"NDOF_BUTTON_CTRL",
|
"NDOF_BUTTON_CTRL",
|
||||||
// general-purpose buttons
|
/* general-purpose buttons */
|
||||||
"NDOF_BUTTON_1",
|
"NDOF_BUTTON_1",
|
||||||
"NDOF_BUTTON_2",
|
"NDOF_BUTTON_2",
|
||||||
"NDOF_BUTTON_3",
|
"NDOF_BUTTON_3",
|
||||||
@@ -77,17 +77,17 @@ static const char *ndof_button_names[] = {
|
|||||||
"NDOF_BUTTON_8",
|
"NDOF_BUTTON_8",
|
||||||
"NDOF_BUTTON_9",
|
"NDOF_BUTTON_9",
|
||||||
"NDOF_BUTTON_10",
|
"NDOF_BUTTON_10",
|
||||||
// more general-purpose buttons
|
/* more general-purpose buttons */
|
||||||
"NDOF_BUTTON_A",
|
"NDOF_BUTTON_A",
|
||||||
"NDOF_BUTTON_B",
|
"NDOF_BUTTON_B",
|
||||||
"NDOF_BUTTON_C",
|
"NDOF_BUTTON_C",
|
||||||
// the end
|
/* the end */
|
||||||
"NDOF_BUTTON_LAST"};
|
"NDOF_BUTTON_LAST"};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// shared by the latest 3Dconnexion hardware
|
/* Shared by the latest 3Dconnexion hardware
|
||||||
// SpacePilotPro uses all of these
|
* SpacePilotPro uses all of these
|
||||||
// smaller devices use only some, based on button mask
|
* smaller devices use only some, based on button mask. */
|
||||||
static const NDOF_ButtonT Modern3Dx_HID_map[] = {
|
static const NDOF_ButtonT Modern3Dx_HID_map[] = {
|
||||||
NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
NDOF_BUTTON_MENU, NDOF_BUTTON_FIT, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
||||||
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BACK,
|
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BACK,
|
||||||
@@ -116,15 +116,15 @@ static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
|
|||||||
NDOF_BUTTON_ROTATE,
|
NDOF_BUTTON_ROTATE,
|
||||||
};
|
};
|
||||||
|
|
||||||
// this is the older SpacePilot (sans Pro)
|
/* This is the older SpacePilot (sans Pro)
|
||||||
// thanks to polosson for info about this device
|
* thanks to polosson for info about this device. */
|
||||||
static const NDOF_ButtonT SpacePilot_HID_map[] = {
|
static const NDOF_ButtonT SpacePilot_HID_map[] = {
|
||||||
NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, NDOF_BUTTON_4,
|
NDOF_BUTTON_1, NDOF_BUTTON_2, NDOF_BUTTON_3, NDOF_BUTTON_4,
|
||||||
NDOF_BUTTON_5, NDOF_BUTTON_6, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
NDOF_BUTTON_5, NDOF_BUTTON_6, NDOF_BUTTON_TOP, NDOF_BUTTON_LEFT,
|
||||||
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_ESC, NDOF_BUTTON_ALT,
|
NDOF_BUTTON_RIGHT, NDOF_BUTTON_FRONT, NDOF_BUTTON_ESC, NDOF_BUTTON_ALT,
|
||||||
NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, NDOF_BUTTON_FIT, NDOF_BUTTON_MENU,
|
NDOF_BUTTON_SHIFT, NDOF_BUTTON_CTRL, NDOF_BUTTON_FIT, NDOF_BUTTON_MENU,
|
||||||
NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS, NDOF_BUTTON_DOMINANT, NDOF_BUTTON_ROTATE,
|
NDOF_BUTTON_PLUS, NDOF_BUTTON_MINUS, NDOF_BUTTON_DOMINANT, NDOF_BUTTON_ROTATE,
|
||||||
NDOF_BUTTON_NONE // the CONFIG button -- what does it do?
|
NDOF_BUTTON_NONE /* the CONFIG button -- what does it do? */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NDOF_ButtonT Generic_HID_map[] = {
|
static const NDOF_ButtonT Generic_HID_map[] = {
|
||||||
@@ -146,7 +146,7 @@ static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_Butt
|
|||||||
|
|
||||||
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
|
GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
|
||||||
: m_system(sys),
|
: m_system(sys),
|
||||||
m_deviceType(NDOF_UnknownDevice), // each platform has its own device detection code
|
m_deviceType(NDOF_UnknownDevice), /* Each platform has its own device detection code. */
|
||||||
m_buttonCount(genericButtonCount),
|
m_buttonCount(genericButtonCount),
|
||||||
m_buttonMask(0),
|
m_buttonMask(0),
|
||||||
m_hidMap(Generic_HID_map),
|
m_hidMap(Generic_HID_map),
|
||||||
@@ -157,37 +157,37 @@ GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System &sys)
|
|||||||
m_motionEventPending(false),
|
m_motionEventPending(false),
|
||||||
m_deadZone(0.0f)
|
m_deadZone(0.0f)
|
||||||
{
|
{
|
||||||
// to avoid the rare situation where one triple is updated and
|
/* To avoid the rare situation where one triple is updated and
|
||||||
// the other is not, initialize them both here:
|
* the other is not, initialize them both here: */
|
||||||
memset(m_translation, 0, sizeof(m_translation));
|
memset(m_translation, 0, sizeof(m_translation));
|
||||||
memset(m_rotation, 0, sizeof(m_rotation));
|
memset(m_rotation, 0, sizeof(m_rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short product_id)
|
bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short product_id)
|
||||||
{
|
{
|
||||||
// call this function until it returns true
|
/* Call this function until it returns true
|
||||||
// it's a good idea to stop calling it after that, as it will "forget"
|
* it's a good idea to stop calling it after that, as it will "forget"
|
||||||
// whichever device it already found
|
* whichever device it already found */
|
||||||
|
|
||||||
// default to safe generic behavior for "unknown" devices
|
/* Default to safe generic behavior for "unknown" devices
|
||||||
// unidentified devices will emit motion events like normal
|
* unidentified devices will emit motion events like normal
|
||||||
// rogue buttons do nothing by default, but can be customized by the user
|
* rogue buttons do nothing by default, but can be customized by the user. */
|
||||||
|
|
||||||
m_deviceType = NDOF_UnknownDevice;
|
m_deviceType = NDOF_UnknownDevice;
|
||||||
m_hidMap = Generic_HID_map;
|
m_hidMap = Generic_HID_map;
|
||||||
m_buttonCount = genericButtonCount;
|
m_buttonCount = genericButtonCount;
|
||||||
m_buttonMask = 0;
|
m_buttonMask = 0;
|
||||||
|
|
||||||
// "mystery device" owners can help build a HID_map for their hardware
|
/* "mystery device" owners can help build a HID_map for their hardware
|
||||||
// A few users have already contributed information about several older devices
|
* A few users have already contributed information about several older devices
|
||||||
// that I don't have access to. Thanks!
|
* that I don't have access to. Thanks! */
|
||||||
|
|
||||||
switch (vendor_id) {
|
switch (vendor_id) {
|
||||||
case 0x046D: // Logitech (3Dconnexion was a subsidiary)
|
case 0x046D: /* Logitech (3Dconnexion was a subsidiary). */
|
||||||
switch (product_id) {
|
switch (product_id) {
|
||||||
// -- current devices --
|
/* -- current devices -- */
|
||||||
case 0xC626: // full-size SpaceNavigator
|
case 0xC626: /* full-size SpaceNavigator */
|
||||||
case 0xC628: // the "for Notebooks" one
|
case 0xC628: /* the "for Notebooks" one */
|
||||||
puts("ndof: using SpaceNavigator");
|
puts("ndof: using SpaceNavigator");
|
||||||
m_deviceType = NDOF_SpaceNavigator;
|
m_deviceType = NDOF_SpaceNavigator;
|
||||||
m_buttonCount = 2;
|
m_buttonCount = 2;
|
||||||
@@ -209,12 +209,12 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
|
|||||||
puts("ndof: using SpaceMouse Pro");
|
puts("ndof: using SpaceMouse Pro");
|
||||||
m_deviceType = NDOF_SpaceMousePro;
|
m_deviceType = NDOF_SpaceMousePro;
|
||||||
m_buttonCount = 27;
|
m_buttonCount = 27;
|
||||||
// ^^ actually has 15 buttons, but their HID codes range from 0 to 26
|
/* ^^ actually has 15 buttons, but their HID codes range from 0 to 26 */
|
||||||
m_buttonMask = 0x07C0F137;
|
m_buttonMask = 0x07C0F137;
|
||||||
m_hidMap = Modern3Dx_HID_map;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// -- older devices --
|
/* -- older devices -- */
|
||||||
case 0xC625:
|
case 0xC625:
|
||||||
puts("ndof: using SpacePilot");
|
puts("ndof: using SpacePilot");
|
||||||
m_deviceType = NDOF_SpacePilot;
|
m_deviceType = NDOF_SpacePilot;
|
||||||
@@ -236,21 +236,21 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
|
|||||||
printf("ndof: unknown Logitech product %04hx\n", product_id);
|
printf("ndof: unknown Logitech product %04hx\n", product_id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x256F: // 3Dconnexion
|
case 0x256F: /* 3Dconnexion */
|
||||||
switch (product_id) {
|
switch (product_id) {
|
||||||
case 0xC62E: // plugged in
|
case 0xC62E: /* Plugged in. */
|
||||||
case 0xC62F: // wireless
|
case 0xC62F: /* Wireless. */
|
||||||
puts("ndof: using SpaceMouse Wireless");
|
puts("ndof: using SpaceMouse Wireless");
|
||||||
m_deviceType = NDOF_SpaceMouseWireless;
|
m_deviceType = NDOF_SpaceMouseWireless;
|
||||||
m_buttonCount = 2;
|
m_buttonCount = 2;
|
||||||
m_hidMap = Modern3Dx_HID_map;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
case 0xC631: // plugged in
|
case 0xC631: /* Plugged in. */
|
||||||
case 0xC632: // wireless
|
case 0xC632: /* Wireless. */
|
||||||
puts("ndof: using SpaceMouse Pro Wireless");
|
puts("ndof: using SpaceMouse Pro Wireless");
|
||||||
m_deviceType = NDOF_SpaceMouseProWireless;
|
m_deviceType = NDOF_SpaceMouseProWireless;
|
||||||
m_buttonCount = 27;
|
m_buttonCount = 27;
|
||||||
// ^^ actually has 15 buttons, but their HID codes range from 0 to 26
|
/* ^^ actually has 15 buttons, but their HID codes range from 0 to 26. */
|
||||||
m_buttonMask = 0x07C0F137;
|
m_buttonMask = 0x07C0F137;
|
||||||
m_hidMap = Modern3Dx_HID_map;
|
m_hidMap = Modern3Dx_HID_map;
|
||||||
break;
|
break;
|
||||||
@@ -279,14 +279,14 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
|
|||||||
return m_deviceType != NDOF_UnknownDevice;
|
return m_deviceType != NDOF_UnknownDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateTranslation(const int t[3], GHOST_TUns64 time)
|
void GHOST_NDOFManager::updateTranslation(const int t[3], uint64_t time)
|
||||||
{
|
{
|
||||||
memcpy(m_translation, t, sizeof(m_translation));
|
memcpy(m_translation, t, sizeof(m_translation));
|
||||||
m_motionTime = time;
|
m_motionTime = time;
|
||||||
m_motionEventPending = true;
|
m_motionEventPending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateRotation(const int r[3], GHOST_TUns64 time)
|
void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
|
||||||
{
|
{
|
||||||
memcpy(m_rotation, r, sizeof(m_rotation));
|
memcpy(m_rotation, r, sizeof(m_rotation));
|
||||||
m_motionTime = time;
|
m_motionTime = time;
|
||||||
@@ -295,7 +295,7 @@ void GHOST_NDOFManager::updateRotation(const int r[3], GHOST_TUns64 time)
|
|||||||
|
|
||||||
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
||||||
bool press,
|
bool press,
|
||||||
GHOST_TUns64 time,
|
uint64_t time,
|
||||||
GHOST_IWindow *window)
|
GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
|
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
|
||||||
@@ -316,7 +316,7 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
|
|||||||
|
|
||||||
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
||||||
bool press,
|
bool press,
|
||||||
GHOST_TUns64 time,
|
uint64_t time,
|
||||||
GHOST_IWindow *window)
|
GHOST_IWindow *window)
|
||||||
{
|
{
|
||||||
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
|
||||||
@@ -329,7 +329,7 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
|
|||||||
m_system.pushEvent(event);
|
m_system.pushEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 time)
|
void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t time)
|
||||||
{
|
{
|
||||||
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
|
|
||||||
@@ -364,16 +364,16 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64
|
|||||||
|
|
||||||
int mask = 1 << button_number;
|
int mask = 1 << button_number;
|
||||||
if (press) {
|
if (press) {
|
||||||
m_buttons |= mask; // set this button's bit
|
m_buttons |= mask; /* Set this button's bit. */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_buttons &= ~mask; // clear this button's bit
|
m_buttons &= ~mask; /* Clear this button's bit. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_NDOFManager::updateButtons(int button_bits, GHOST_TUns64 time)
|
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
|
||||||
{
|
{
|
||||||
button_bits &= m_buttonMask; // discard any "garbage" bits
|
button_bits &= m_buttonMask; /* Discard any "garbage" bits. */
|
||||||
|
|
||||||
int diff = m_buttons ^ button_bits;
|
int diff = m_buttons ^ button_bits;
|
||||||
|
|
||||||
@@ -390,11 +390,11 @@ void GHOST_NDOFManager::updateButtons(int button_bits, GHOST_TUns64 time)
|
|||||||
void GHOST_NDOFManager::setDeadZone(float dz)
|
void GHOST_NDOFManager::setDeadZone(float dz)
|
||||||
{
|
{
|
||||||
if (dz < 0.0f) {
|
if (dz < 0.0f) {
|
||||||
// negative values don't make sense, so clamp at zero
|
/* Negative values don't make sense, so clamp at zero. */
|
||||||
dz = 0.0f;
|
dz = 0.0f;
|
||||||
}
|
}
|
||||||
else if (dz > 0.5f) {
|
else if (dz > 0.5f) {
|
||||||
// warn the rogue user/developer, but allow it
|
/* Warn the rogue user/developer, but allow it. */
|
||||||
GHOST_PRINTF("ndof: dead zone of %.2f is rather high...\n", dz);
|
GHOST_PRINTF("ndof: dead zone of %.2f is rather high...\n", dz);
|
||||||
}
|
}
|
||||||
m_deadZone = dz;
|
m_deadZone = dz;
|
||||||
@@ -426,22 +426,22 @@ bool GHOST_NDOFManager::sendMotionEvent()
|
|||||||
if (!m_motionEventPending)
|
if (!m_motionEventPending)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_motionEventPending = false; // any pending motion is handled right now
|
m_motionEventPending = false; /* Any pending motion is handled right now. */
|
||||||
|
|
||||||
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
|
||||||
|
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
m_motionState = GHOST_kNotStarted; // avoid large 'dt' times when changing windows
|
m_motionState = GHOST_kNotStarted; /* Avoid large `dt` times when changing windows. */
|
||||||
return false; // delivery will fail, so don't bother sending
|
return false; /* Delivery will fail, so don't bother sending. */
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
|
GHOST_EventNDOFMotion *event = new GHOST_EventNDOFMotion(m_motionTime, window);
|
||||||
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *)event->getData();
|
GHOST_TEventNDOFMotionData *data = (GHOST_TEventNDOFMotionData *)event->getData();
|
||||||
|
|
||||||
// scale axis values here to normalize them to around +/- 1
|
/* Scale axis values here to normalize them to around +/- 1
|
||||||
// they are scaled again for overall sensitivity in the WM based on user prefs
|
* they are scaled again for overall sensitivity in the WM based on user preferences. */
|
||||||
|
|
||||||
const float scale = 1.0f / 350.0f; // 3Dconnexion devices send +/- 350 usually
|
const float scale = 1.0f / 350.0f; /* 3Dconnexion devices send +/- 350 usually */
|
||||||
|
|
||||||
data->tx = scale * m_translation[0];
|
data->tx = scale * m_translation[0];
|
||||||
data->ty = scale * m_translation[1];
|
data->ty = scale * m_translation[1];
|
||||||
@@ -451,24 +451,24 @@ bool GHOST_NDOFManager::sendMotionEvent()
|
|||||||
data->ry = scale * m_rotation[1];
|
data->ry = scale * m_rotation[1];
|
||||||
data->rz = scale * m_rotation[2];
|
data->rz = scale * m_rotation[2];
|
||||||
|
|
||||||
data->dt = 0.001f * (m_motionTime - m_prevMotionTime); // in seconds
|
data->dt = 0.001f * (m_motionTime - m_prevMotionTime); /* In seconds. */
|
||||||
m_prevMotionTime = m_motionTime;
|
m_prevMotionTime = m_motionTime;
|
||||||
|
|
||||||
bool weHaveMotion = !nearHomePosition(data, m_deadZone);
|
bool weHaveMotion = !nearHomePosition(data, m_deadZone);
|
||||||
|
|
||||||
// determine what kind of motion event to send (Starting, InProgress, Finishing)
|
/* Determine what kind of motion event to send `(Starting, InProgress, Finishing)`
|
||||||
// and where that leaves this NDOF manager (NotStarted, InProgress, Finished)
|
* and where that leaves this NDOF manager `(NotStarted, InProgress, Finished)`. */
|
||||||
switch (m_motionState) {
|
switch (m_motionState) {
|
||||||
case GHOST_kNotStarted:
|
case GHOST_kNotStarted:
|
||||||
case GHOST_kFinished:
|
case GHOST_kFinished:
|
||||||
if (weHaveMotion) {
|
if (weHaveMotion) {
|
||||||
data->progress = GHOST_kStarting;
|
data->progress = GHOST_kStarting;
|
||||||
m_motionState = GHOST_kInProgress;
|
m_motionState = GHOST_kInProgress;
|
||||||
// prev motion time will be ancient, so just make up a reasonable time delta
|
/* Previous motion time will be ancient, so just make up a reasonable time delta. */
|
||||||
data->dt = 0.0125f;
|
data->dt = 0.0125f;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// send no event and keep current state
|
/* Send no event and keep current state. */
|
||||||
#ifdef DEBUG_NDOF_MOTION
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
printf("ndof motion ignored -- %s\n", progress_string[data->progress]);
|
printf("ndof motion ignored -- %s\n", progress_string[data->progress]);
|
||||||
#endif
|
#endif
|
||||||
@@ -479,20 +479,22 @@ bool GHOST_NDOFManager::sendMotionEvent()
|
|||||||
case GHOST_kInProgress:
|
case GHOST_kInProgress:
|
||||||
if (weHaveMotion) {
|
if (weHaveMotion) {
|
||||||
data->progress = GHOST_kInProgress;
|
data->progress = GHOST_kInProgress;
|
||||||
// remain 'InProgress'
|
/* Remain 'InProgress'. */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->progress = GHOST_kFinishing;
|
data->progress = GHOST_kFinishing;
|
||||||
m_motionState = GHOST_kFinished;
|
m_motionState = GHOST_kFinished;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:; // will always be one of the above
|
default:
|
||||||
|
/* Will always be one of the above. */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_NDOF_MOTION
|
#ifdef DEBUG_NDOF_MOTION
|
||||||
printf("ndof motion sent -- %s\n", progress_string[data->progress]);
|
printf("ndof motion sent -- %s\n", progress_string[data->progress]);
|
||||||
|
|
||||||
// show details about this motion event
|
/* Show details about this motion event. */
|
||||||
printf(" T=(%d,%d,%d) R=(%d,%d,%d) raw\n",
|
printf(" T=(%d,%d,%d) R=(%d,%d,%d) raw\n",
|
||||||
m_translation[0],
|
m_translation[0],
|
||||||
m_translation[1],
|
m_translation[1],
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
NDOF_UnknownDevice,
|
NDOF_UnknownDevice,
|
||||||
|
|
||||||
// current devices
|
/* Current devices. */
|
||||||
NDOF_SpaceNavigator,
|
NDOF_SpaceNavigator,
|
||||||
NDOF_SpaceExplorer,
|
NDOF_SpaceExplorer,
|
||||||
NDOF_SpacePilotPro,
|
NDOF_SpacePilotPro,
|
||||||
@@ -37,51 +37,51 @@ typedef enum {
|
|||||||
NDOF_SpaceMouseProWireless,
|
NDOF_SpaceMouseProWireless,
|
||||||
NDOF_SpaceMouseEnterprise,
|
NDOF_SpaceMouseEnterprise,
|
||||||
|
|
||||||
// older devices
|
/* Older devices. */
|
||||||
NDOF_SpacePilot,
|
NDOF_SpacePilot,
|
||||||
NDOF_Spaceball5000,
|
NDOF_Spaceball5000,
|
||||||
NDOF_SpaceTraveler
|
NDOF_SpaceTraveler
|
||||||
|
|
||||||
} NDOF_DeviceT;
|
} NDOF_DeviceT;
|
||||||
|
|
||||||
// NDOF device button event types
|
/* NDOF device button event types */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
// used internally, never sent
|
/* Used internally, never sent. */
|
||||||
NDOF_BUTTON_NONE,
|
NDOF_BUTTON_NONE,
|
||||||
// these two are available from any 3Dconnexion device
|
/* These two are available from any 3Dconnexion device. */
|
||||||
NDOF_BUTTON_MENU,
|
NDOF_BUTTON_MENU,
|
||||||
NDOF_BUTTON_FIT,
|
NDOF_BUTTON_FIT,
|
||||||
// standard views
|
/* Standard views. */
|
||||||
NDOF_BUTTON_TOP,
|
NDOF_BUTTON_TOP,
|
||||||
NDOF_BUTTON_BOTTOM,
|
NDOF_BUTTON_BOTTOM,
|
||||||
NDOF_BUTTON_LEFT,
|
NDOF_BUTTON_LEFT,
|
||||||
NDOF_BUTTON_RIGHT,
|
NDOF_BUTTON_RIGHT,
|
||||||
NDOF_BUTTON_FRONT,
|
NDOF_BUTTON_FRONT,
|
||||||
NDOF_BUTTON_BACK,
|
NDOF_BUTTON_BACK,
|
||||||
// more views
|
/* More views. */
|
||||||
NDOF_BUTTON_ISO1,
|
NDOF_BUTTON_ISO1,
|
||||||
NDOF_BUTTON_ISO2,
|
NDOF_BUTTON_ISO2,
|
||||||
// 90 degree rotations
|
/* 90 degree rotations.
|
||||||
// these don't all correspond to physical buttons
|
* These don't all correspond to physical buttons. */
|
||||||
NDOF_BUTTON_ROLL_CW,
|
NDOF_BUTTON_ROLL_CW,
|
||||||
NDOF_BUTTON_ROLL_CCW,
|
NDOF_BUTTON_ROLL_CCW,
|
||||||
NDOF_BUTTON_SPIN_CW,
|
NDOF_BUTTON_SPIN_CW,
|
||||||
NDOF_BUTTON_SPIN_CCW,
|
NDOF_BUTTON_SPIN_CCW,
|
||||||
NDOF_BUTTON_TILT_CW,
|
NDOF_BUTTON_TILT_CW,
|
||||||
NDOF_BUTTON_TILT_CCW,
|
NDOF_BUTTON_TILT_CCW,
|
||||||
// device control
|
/* Device control. */
|
||||||
NDOF_BUTTON_ROTATE,
|
NDOF_BUTTON_ROTATE,
|
||||||
NDOF_BUTTON_PANZOOM,
|
NDOF_BUTTON_PANZOOM,
|
||||||
NDOF_BUTTON_DOMINANT,
|
NDOF_BUTTON_DOMINANT,
|
||||||
NDOF_BUTTON_PLUS,
|
NDOF_BUTTON_PLUS,
|
||||||
NDOF_BUTTON_MINUS,
|
NDOF_BUTTON_MINUS,
|
||||||
// keyboard emulation
|
/* Keyboard emulation. */
|
||||||
NDOF_BUTTON_ESC,
|
NDOF_BUTTON_ESC,
|
||||||
NDOF_BUTTON_ALT,
|
NDOF_BUTTON_ALT,
|
||||||
NDOF_BUTTON_SHIFT,
|
NDOF_BUTTON_SHIFT,
|
||||||
NDOF_BUTTON_CTRL,
|
NDOF_BUTTON_CTRL,
|
||||||
// general-purpose buttons
|
/* General-purpose buttons.
|
||||||
// users can assign functions via keymap editor
|
* Users can assign functions via keymap editor. */
|
||||||
NDOF_BUTTON_1,
|
NDOF_BUTTON_1,
|
||||||
NDOF_BUTTON_2,
|
NDOF_BUTTON_2,
|
||||||
NDOF_BUTTON_3,
|
NDOF_BUTTON_3,
|
||||||
@@ -92,11 +92,11 @@ typedef enum {
|
|||||||
NDOF_BUTTON_8,
|
NDOF_BUTTON_8,
|
||||||
NDOF_BUTTON_9,
|
NDOF_BUTTON_9,
|
||||||
NDOF_BUTTON_10,
|
NDOF_BUTTON_10,
|
||||||
// more general-purpose buttons
|
/* More general-purpose buttons. */
|
||||||
NDOF_BUTTON_A,
|
NDOF_BUTTON_A,
|
||||||
NDOF_BUTTON_B,
|
NDOF_BUTTON_B,
|
||||||
NDOF_BUTTON_C,
|
NDOF_BUTTON_C,
|
||||||
// the end
|
/* The end. */
|
||||||
NDOF_BUTTON_LAST
|
NDOF_BUTTON_LAST
|
||||||
} NDOF_ButtonT;
|
} NDOF_ButtonT;
|
||||||
|
|
||||||
@@ -107,48 +107,61 @@ class GHOST_NDOFManager {
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// whether multi-axis functionality is available (via the OS or driver)
|
/**
|
||||||
// does not imply that a device is plugged in or being used
|
* Whether multi-axis functionality is available (via the OS or driver)
|
||||||
|
* does not imply that a device is plugged in or being used.
|
||||||
|
*/
|
||||||
virtual bool available() = 0;
|
virtual bool available() = 0;
|
||||||
|
|
||||||
// each platform's device detection should call this
|
/**
|
||||||
// use standard USB/HID identifiers
|
* Each platform's device detection should call this
|
||||||
|
* use standard USB/HID identifiers.
|
||||||
|
*/
|
||||||
bool setDevice(unsigned short vendor_id, unsigned short product_id);
|
bool setDevice(unsigned short vendor_id, unsigned short product_id);
|
||||||
|
|
||||||
// filter out small/accidental/uncalibrated motions by
|
/**
|
||||||
// setting up a "dead zone" around home position
|
* Filter out small/accidental/un-calibrated motions by
|
||||||
// set to 0 to disable
|
* setting up a "dead zone" around home position
|
||||||
// 0.1 is a safe and reasonable value
|
* set to 0 to disable
|
||||||
|
* 0.1 is a safe and reasonable value.
|
||||||
|
*/
|
||||||
void setDeadZone(float);
|
void setDeadZone(float);
|
||||||
|
|
||||||
// the latest raw axis data from the device
|
/**
|
||||||
// NOTE: axis data should be in blender view coordinates
|
* The latest raw axis data from the device.
|
||||||
// +X is to the right
|
*
|
||||||
// +Y is up
|
* \note axis data should be in blender view coordinates
|
||||||
// +Z is out of the screen
|
* - +X is to the right.
|
||||||
// for rotations, look from origin to each +axis
|
* - +Y is up.
|
||||||
// rotations are + when CCW, - when CW
|
* - +Z is out of the screen.
|
||||||
// each platform is responsible for getting axis data into this form
|
* - for rotations, look from origin to each +axis.
|
||||||
// these values should not be scaled (just shuffled or flipped)
|
* - rotations are + when CCW, - when CW.
|
||||||
void updateTranslation(const int t[3], GHOST_TUns64 time);
|
* Each platform is responsible for getting axis data into this form
|
||||||
void updateRotation(const int r[3], GHOST_TUns64 time);
|
* these values should not be scaled (just shuffled or flipped).
|
||||||
|
*/
|
||||||
|
void updateTranslation(const int t[3], uint64_t time);
|
||||||
|
void updateRotation(const int r[3], uint64_t time);
|
||||||
|
|
||||||
// the latest raw button data from the device
|
/**
|
||||||
// use HID button encoding (not NDOF_ButtonT)
|
* The latest raw button data from the device
|
||||||
void updateButton(int button_number, bool press, GHOST_TUns64 time);
|
* use HID button encoding (not #NDOF_ButtonT).
|
||||||
void updateButtons(int button_bits, GHOST_TUns64 time);
|
*/
|
||||||
// NDOFButton events are sent immediately
|
void updateButton(int button_number, bool press, uint64_t time);
|
||||||
|
void updateButtons(int button_bits, uint64_t time);
|
||||||
|
/* #NDOFButton events are sent immediately */
|
||||||
|
|
||||||
// processes and sends most recent raw data as an NDOFMotion event
|
/**
|
||||||
// returns whether an event was sent
|
* Processes and sends most recent raw data as an #NDOFMotion event
|
||||||
|
* returns whether an event was sent.
|
||||||
|
*/
|
||||||
bool sendMotionEvent();
|
bool sendMotionEvent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GHOST_System &m_system;
|
GHOST_System &m_system;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow *);
|
void sendButtonEvent(NDOF_ButtonT, bool press, uint64_t time, GHOST_IWindow *);
|
||||||
void sendKeyEvent(GHOST_TKey, bool press, GHOST_TUns64 time, GHOST_IWindow *);
|
void sendKeyEvent(GHOST_TKey, bool press, uint64_t time, GHOST_IWindow *);
|
||||||
|
|
||||||
NDOF_DeviceT m_deviceType;
|
NDOF_DeviceT m_deviceType;
|
||||||
int m_buttonCount;
|
int m_buttonCount;
|
||||||
@@ -157,12 +170,12 @@ class GHOST_NDOFManager {
|
|||||||
|
|
||||||
int m_translation[3];
|
int m_translation[3];
|
||||||
int m_rotation[3];
|
int m_rotation[3];
|
||||||
int m_buttons; // bit field
|
int m_buttons; /* Bit field. */
|
||||||
|
|
||||||
GHOST_TUns64 m_motionTime; // in milliseconds
|
uint64_t m_motionTime; /* In milliseconds. */
|
||||||
GHOST_TUns64 m_prevMotionTime; // time of most recent Motion event sent
|
uint64_t m_prevMotionTime; /* Time of most recent motion event sent. */
|
||||||
|
|
||||||
GHOST_TProgress m_motionState;
|
GHOST_TProgress m_motionState;
|
||||||
bool m_motionEventPending;
|
bool m_motionEventPending;
|
||||||
float m_deadZone; // discard motion with each component < this
|
float m_deadZone; /* Discard motion with each component < this. */
|
||||||
};
|
};
|
||||||
|
@@ -195,7 +195,7 @@ static void DeviceEvent(uint32_t unused, uint32_t msg_type, void *msg_arg)
|
|||||||
// device state is broadcast to all clients; only react if sent to us
|
// device state is broadcast to all clients; only react if sent to us
|
||||||
if (s->client == clientID) {
|
if (s->client == clientID) {
|
||||||
// TODO: is s->time compatible with GHOST timestamps? if so use that instead.
|
// TODO: is s->time compatible with GHOST timestamps? if so use that instead.
|
||||||
GHOST_TUns64 now = ghost_system->getMilliSeconds();
|
uint64_t now = ghost_system->getMilliSeconds();
|
||||||
|
|
||||||
switch (s->command) {
|
switch (s->command) {
|
||||||
case kConnexionCmdHandleAxis: {
|
case kConnexionCmdHandleAxis: {
|
||||||
|
@@ -97,7 +97,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case SPNAV_EVENT_MOTION: {
|
case SPNAV_EVENT_MOTION: {
|
||||||
/* convert to blender view coords */
|
/* convert to blender view coords */
|
||||||
GHOST_TUns64 now = m_system.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
const int t[3] = {(int)e.motion.x, (int)e.motion.y, (int)-e.motion.z};
|
const int t[3] = {(int)e.motion.x, (int)e.motion.y, (int)-e.motion.z};
|
||||||
const int r[3] = {(int)-e.motion.rx, (int)-e.motion.ry, (int)e.motion.rz};
|
const int r[3] = {(int)-e.motion.rx, (int)-e.motion.ry, (int)e.motion.rz};
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPNAV_EVENT_BUTTON:
|
case SPNAV_EVENT_BUTTON:
|
||||||
GHOST_TUns64 now = m_system.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
updateButton(e.button.bnum, e.button.press, now);
|
updateButton(e.button.bnum, e.button.press, now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
|
|||||||
|
|
||||||
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
#ifdef USE_FINISH_GLITCH_WORKAROUND
|
||||||
if (motion_test_prev == true && motion_test == false) {
|
if (motion_test_prev == true && motion_test == false) {
|
||||||
GHOST_TUns64 now = m_system.getMilliSeconds();
|
uint64_t now = m_system.getMilliSeconds();
|
||||||
const int v[3] = {0, 0, 0};
|
const int v[3] = {0, 0, 0};
|
||||||
|
|
||||||
updateTranslation(v, now);
|
updateTranslation(v, now);
|
||||||
|
@@ -38,25 +38,25 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
|
|||||||
return GHOST_ISystemPaths::dispose();
|
return GHOST_ISystemPaths::dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
|
const char *GHOST_getSystemDir(int version, const char *versionstr)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : NULL;
|
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
|
const char *GHOST_getUserDir(int version, const char *versionstr)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getUserDir(version, versionstr) : NULL; /* shouldn't be NULL */
|
return systemPaths ? systemPaths->getUserDir(version, versionstr) : NULL; /* shouldn't be NULL */
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
|
const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getUserSpecialDir(type) : NULL; /* shouldn't be NULL */
|
return systemPaths ? systemPaths->getUserSpecialDir(type) : NULL; /* shouldn't be NULL */
|
||||||
}
|
}
|
||||||
|
|
||||||
const GHOST_TUns8 *GHOST_getBinaryDir()
|
const char *GHOST_getBinaryDir()
|
||||||
{
|
{
|
||||||
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
|
||||||
return systemPaths ? systemPaths->getBinaryDir() : NULL; /* shouldn't be NULL */
|
return systemPaths ? systemPaths->getBinaryDir() : NULL; /* shouldn't be NULL */
|
||||||
|
@@ -23,18 +23,18 @@
|
|||||||
|
|
||||||
#include "GHOST_Rect.h"
|
#include "GHOST_Rect.h"
|
||||||
|
|
||||||
void GHOST_Rect::inset(GHOST_TInt32 i)
|
void GHOST_Rect::inset(int32_t i)
|
||||||
{
|
{
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
// Grow the rectangle
|
/* Grow the rectangle. */
|
||||||
m_l -= i;
|
m_l -= i;
|
||||||
m_r += i;
|
m_r += i;
|
||||||
m_t -= i;
|
m_t -= i;
|
||||||
m_b += i;
|
m_b += i;
|
||||||
}
|
}
|
||||||
else if (i < 0) {
|
else if (i < 0) {
|
||||||
// Shrink the rectangle, check for insets larger than half the size
|
/* Shrink the rectangle, check for insets larger than half the size. */
|
||||||
GHOST_TInt32 i2 = i * 2;
|
int32_t i2 = i * 2;
|
||||||
if (getWidth() > i2) {
|
if (getWidth() > i2) {
|
||||||
m_l += i;
|
m_l += i;
|
||||||
m_r -= i;
|
m_r -= i;
|
||||||
@@ -62,12 +62,12 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
|
|||||||
bool rb = isInside(r.m_r, r.m_b);
|
bool rb = isInside(r.m_r, r.m_b);
|
||||||
GHOST_TVisibility v;
|
GHOST_TVisibility v;
|
||||||
if (lt && rt && lb && rb) {
|
if (lt && rt && lb && rb) {
|
||||||
// All points inside, rectangle is inside this
|
/* All points inside, rectangle is inside this. */
|
||||||
v = GHOST_kFullyVisible;
|
v = GHOST_kFullyVisible;
|
||||||
}
|
}
|
||||||
else if (!(lt || rt || lb || rb)) {
|
else if (!(lt || rt || lb || rb)) {
|
||||||
// None of the points inside
|
/* None of the points inside.
|
||||||
// Check to see whether the rectangle is larger than this one
|
* Check to see whether the rectangle is larger than this one. */
|
||||||
if ((r.m_l < m_l) && (r.m_t < m_t) && (r.m_r > m_r) && (r.m_b > m_b)) {
|
if ((r.m_l < m_l) && (r.m_t < m_t) && (r.m_r > m_r) && (r.m_b > m_b)) {
|
||||||
v = GHOST_kPartiallyVisible;
|
v = GHOST_kPartiallyVisible;
|
||||||
}
|
}
|
||||||
@@ -76,15 +76,15 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Some of the points inside, rectangle is partially inside
|
/* Some of the points inside, rectangle is partially inside. */
|
||||||
v = GHOST_kPartiallyVisible;
|
v = GHOST_kPartiallyVisible;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
|
void GHOST_Rect::setCenter(int32_t cx, int32_t cy)
|
||||||
{
|
{
|
||||||
GHOST_TInt32 offset = cx - (m_l + (m_r - m_l) / 2);
|
int32_t offset = cx - (m_l + (m_r - m_l) / 2);
|
||||||
m_l += offset;
|
m_l += offset;
|
||||||
m_r += offset;
|
m_r += offset;
|
||||||
offset = cy - (m_t + (m_b - m_t) / 2);
|
offset = cy - (m_t + (m_b - m_t) / 2);
|
||||||
@@ -92,7 +92,7 @@ void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
|
|||||||
m_b += offset;
|
m_b += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h)
|
void GHOST_Rect::setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h)
|
||||||
{
|
{
|
||||||
long w_2, h_2;
|
long w_2, h_2;
|
||||||
|
|
||||||
|
@@ -56,23 +56,23 @@ GHOST_System::~GHOST_System()
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TUns64 GHOST_System::getMilliSeconds() const
|
uint64_t GHOST_System::getMilliSeconds() const
|
||||||
{
|
{
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_ITimerTask *GHOST_System::installTimer(GHOST_TUns64 delay,
|
GHOST_ITimerTask *GHOST_System::installTimer(uint64_t delay,
|
||||||
GHOST_TUns64 interval,
|
uint64_t interval,
|
||||||
GHOST_TimerProcPtr timerProc,
|
GHOST_TimerProcPtr timerProc,
|
||||||
GHOST_TUserDataPtr userData)
|
GHOST_TUserDataPtr userData)
|
||||||
{
|
{
|
||||||
GHOST_TUns64 millis = getMilliSeconds();
|
uint64_t millis = getMilliSeconds();
|
||||||
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
|
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
|
||||||
if (timer) {
|
if (timer) {
|
||||||
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
|
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {
|
||||||
// Check to see whether we need to fire the timer right away
|
/* Check to see whether we need to fire the timer right away. */
|
||||||
m_timerManager->fireTimers(millis);
|
m_timerManager->fireTimers(millis);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -208,7 +208,7 @@ bool GHOST_System::getFullScreen(void)
|
|||||||
void GHOST_System::dispatchEvents()
|
void GHOST_System::dispatchEvents()
|
||||||
{
|
{
|
||||||
#ifdef WITH_INPUT_NDOF
|
#ifdef WITH_INPUT_NDOF
|
||||||
// NDOF Motion event is sent only once per dispatch, so do it now:
|
/* NDOF Motion event is sent only once per dispatch, so do it now: */
|
||||||
if (m_ndofManager) {
|
if (m_ndofManager) {
|
||||||
m_ndofManager->sendMotionEvent();
|
m_ndofManager->sendMotionEvent();
|
||||||
}
|
}
|
||||||
@@ -260,10 +260,10 @@ GHOST_TSuccess GHOST_System::pushEvent(GHOST_IEvent *event)
|
|||||||
GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const
|
GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const
|
||||||
{
|
{
|
||||||
GHOST_ModifierKeys keys;
|
GHOST_ModifierKeys keys;
|
||||||
// Get the state of all modifier keys
|
/* Get the state of all modifier keys. */
|
||||||
GHOST_TSuccess success = getModifierKeys(keys);
|
GHOST_TSuccess success = getModifierKeys(keys);
|
||||||
if (success) {
|
if (success) {
|
||||||
// Isolate the state of the key requested
|
/* Isolate the state of the key requested. */
|
||||||
isDown = keys.get(mask);
|
isDown = keys.get(mask);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
@@ -272,10 +272,10 @@ GHOST_TSuccess GHOST_System::getModifierKeyState(GHOST_TModifierKeyMask mask, bo
|
|||||||
GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool &isDown) const
|
GHOST_TSuccess GHOST_System::getButtonState(GHOST_TButtonMask mask, bool &isDown) const
|
||||||
{
|
{
|
||||||
GHOST_Buttons buttons;
|
GHOST_Buttons buttons;
|
||||||
// Get the state of all mouse buttons
|
/* Get the state of all mouse buttons. */
|
||||||
GHOST_TSuccess success = getButtons(buttons);
|
GHOST_TSuccess success = getButtons(buttons);
|
||||||
if (success) {
|
if (success) {
|
||||||
// Isolate the state of the mouse button requested
|
/* Isolate the state of the mouse button requested. */
|
||||||
isDown = buttons.get(mask);
|
isDown = buttons.get(mask);
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
@@ -311,7 +311,7 @@ GHOST_TSuccess GHOST_System::init()
|
|||||||
m_eventPrinter = new GHOST_EventPrinter();
|
m_eventPrinter = new GHOST_EventPrinter();
|
||||||
m_eventManager->addConsumer(m_eventPrinter);
|
m_eventManager->addConsumer(m_eventPrinter);
|
||||||
}
|
}
|
||||||
#endif // WITH_GHOST_DEBUG
|
#endif /* WITH_GHOST_DEBUG */
|
||||||
|
|
||||||
if (m_timerManager && m_windowManager && m_eventManager) {
|
if (m_timerManager && m_windowManager && m_eventManager) {
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
@@ -359,7 +359,7 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
|||||||
if (alphaBackground)
|
if (alphaBackground)
|
||||||
glSettings.flags |= GHOST_glAlphaBackground;
|
glSettings.flags |= GHOST_glAlphaBackground;
|
||||||
|
|
||||||
/* note: don't use getCurrentDisplaySetting() because on X11 we may
|
/* NOTE: don't use #getCurrentDisplaySetting() because on X11 we may
|
||||||
* be zoomed in and the desktop may be bigger than the viewport. */
|
* be zoomed in and the desktop may be bigger than the viewport. */
|
||||||
GHOST_ASSERT(m_displayManager,
|
GHOST_ASSERT(m_displayManager,
|
||||||
"GHOST_System::createFullScreenWindow(): invalid display manager");
|
"GHOST_System::createFullScreenWindow(): invalid display manager");
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user