file_path
stringlengths
21
202
content
stringlengths
12
1.02M
size
int64
12
1.02M
lang
stringclasses
9 values
avg_line_length
float64
3.33
100
max_line_length
int64
10
993
alphanum_fraction
float64
0.27
0.93
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_crc32.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_crc32.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* Implements CRC32 calculations (default output is Perl String::CRC32 compatible). */ #ifndef SDL_test_crc32_h_ #define SDL_test_crc32_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* ------------ Definitions --------- */ /* Definition shared by all CRC routines */ #ifndef CrcUint32 #define CrcUint32 unsigned int #endif #ifndef CrcUint8 #define CrcUint8 unsigned char #endif #ifdef ORIGINAL_METHOD #define CRC32_POLY 0x04c11db7 /* AUTODIN II, Ethernet, & FDDI */ #else #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ #endif /** * Data structure for CRC32 (checksum) computation */ typedef struct { CrcUint32 crc32_table[256]; /* CRC table */ } SDLTest_Crc32Context; /* ---------- Function Prototypes ------------- */ /** * \brief Initialize the CRC context * * Note: The function initializes the crc table required for all crc calculations. * * \param crcContext pointer to context variable * * \returns 0 for OK, -1 on error * */ int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); /** * \brief calculate a crc32 from a data block * * \param crcContext pointer to context variable * \param inBuf input buffer to checksum * \param inLen length of input buffer * \param crc32 pointer to Uint32 to store the final CRC into * * \returns 0 for OK, -1 on error * */ int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /** * \brief clean up CRC context * * \param crcContext pointer to context variable * * \returns 0 for OK, -1 on error * */ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_crc32_h_ */ /* vi: set ts=4 sw=4 expandtab: */
3,385
C
26.088
115
0.703397
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_quit.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_quit.h * * Include file for SDL quit event handling. */ #ifndef SDL_quit_h_ #define SDL_quit_h_ #include "SDL_stdinc.h" #include "SDL_error.h" /** * \file SDL_quit.h * * An ::SDL_QUIT event is generated when the user tries to close the application * window. If it is ignored or filtered out, the window will remain open. * If it is not ignored or filtered, it is queued normally and the window * is allowed to close. When the window is closed, screen updates will * complete, but have no effect. * * SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) * and SIGTERM (system termination request), if handlers do not already * exist, that generate ::SDL_QUIT events as well. There is no way * to determine the cause of an ::SDL_QUIT event, but setting a signal * handler in your application will override the default generation of * quit events for that signal. * * \sa SDL_Quit() */ /* There are no functions directly affecting the quit event */ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) #endif /* SDL_quit_h_ */
2,106
C
34.711864
88
0.726496
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_cpuinfo.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_cpuinfo.h * * CPU feature detection for SDL. */ #ifndef SDL_cpuinfo_h_ #define SDL_cpuinfo_h_ #include "SDL_stdinc.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) #ifdef __clang__ /* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ #undef __MMX__ #undef __SSE__ #undef __SSE2__ #else #include <intrin.h> #ifndef _WIN64 #define __MMX__ #define __3dNOW__ #endif #define __SSE__ #define __SSE2__ #endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include <intrin.h> #else #ifdef __ALTIVEC__ #if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include <altivec.h> #undef pixel #undef bool #endif #endif #if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include <mm3dnow.h> #endif #if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H) #include <immintrin.h> #else #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) #include <mmintrin.h> #endif #if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include <xmmintrin.h> #endif #if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include <emmintrin.h> #endif #if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) #include <pmmintrin.h> #endif #endif /* HAVE_IMMINTRIN_H */ #endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* This is a guess for the cacheline size used for padding. * Most x86 processors have a 64 byte cache line. * The 64-bit PowerPC processors have a 128 byte cache line. * We'll use the larger value to be generally safe. */ #define SDL_CACHELINE_SIZE 128 /** * This function returns the number of CPU cores available. */ extern DECLSPEC int SDLCALL SDL_GetCPUCount(void); /** * This function returns the L1 cache line size of the CPU * * This is useful for determining multi-threaded structure padding * or SIMD prefetch sizes. */ extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); /** * This function returns true if the CPU has the RDTSC instruction. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void); /** * This function returns true if the CPU has AltiVec features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); /** * This function returns true if the CPU has MMX features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); /** * This function returns true if the CPU has 3DNow! features. */ extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void); /** * This function returns true if the CPU has SSE features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); /** * This function returns true if the CPU has SSE2 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); /** * This function returns true if the CPU has SSE3 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); /** * This function returns true if the CPU has SSE4.1 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); /** * This function returns true if the CPU has SSE4.2 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); /** * This function returns true if the CPU has AVX features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); /** * This function returns true if the CPU has AVX2 features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); /** * This function returns true if the CPU has NEON (ARM SIMD) features. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); /** * This function returns the amount of RAM configured in the system, in MB. */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_cpuinfo_h_ */ /* vi: set ts=4 sw=4 expandtab: */
4,937
C
26.131868
85
0.713794
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_vulkan.h
/* Simple DirectMedia Layer Copyright (C) 2017, Mark Callow This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_vulkan.h * * Header file for functions to creating Vulkan surfaces on SDL windows. */ #ifndef SDL_vulkan_h_ #define SDL_vulkan_h_ #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Avoid including vulkan.h, don't define VkInstance if it's already included */ #ifdef VULKAN_H_ #define NO_SDL_VULKAN_TYPEDEFS #endif #ifndef NO_SDL_VULKAN_TYPEDEFS #define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; #if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; #else #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; #endif VK_DEFINE_HANDLE(VkInstance) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) #endif /* !NO_SDL_VULKAN_TYPEDEFS */ typedef VkInstance SDL_vulkanInstance; typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ /** * \name Vulkan support functions * * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API * is compatable with Tizen's implementation of Vulkan in SDL. */ /* @{ */ /** * \brief Dynamically load a Vulkan loader library. * * \param [in] path The platform dependent Vulkan loader library name, or * \c NULL. * * \return \c 0 on success, or \c -1 if the library couldn't be loaded. * * If \a path is NULL SDL will use the value of the environment variable * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan * loader library. * * This should be called after initializing the video driver, but before * creating any Vulkan windows. If no Vulkan loader library is loaded, the * default library will be loaded upon creation of the first Vulkan window. * * \note It is fairly common for Vulkan applications to link with \a libvulkan * instead of explicitly loading it at run time. This will work with * SDL provided the application links to a dynamic library and both it * and SDL use the same search path. * * \note If you specify a non-NULL \c path, an application should retrieve all * of the Vulkan functions it uses from the dynamic library using * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee * \c path points to the same vulkan loader library the application * linked to. * * \note On Apple devices, if \a path is NULL, SDL will attempt to find * the vkGetInstanceProcAddr address within all the mach-o images of * the current process. This is because it is fairly common for Vulkan * applications to link with libvulkan (and historically MoltenVK was * provided as a static library). If it is not found then, on macOS, SDL * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications * using a dynamic framework or .dylib must ensure it is included in its * application bundle. * * \note On non-Apple devices, application linking with a static libvulkan is * not supported. Either do not link to the Vulkan loader or link to a * dynamic library version. * * \note This function will fail if there are no working Vulkan drivers * installed. * * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() * \sa SDL_Vulkan_UnloadLibrary() */ extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); /** * \brief Get the address of the \c vkGetInstanceProcAddr function. * * \note This should be called after either calling SDL_Vulkan_LoadLibrary * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. */ extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); /** * \brief Unload the Vulkan loader library previously loaded by * \c SDL_Vulkan_LoadLibrary(). * * \sa SDL_Vulkan_LoadLibrary() */ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); /** * \brief Get the names of the Vulkan instance extensions needed to create * a surface with \c SDL_Vulkan_CreateSurface(). * * \param [in] window Window for which the required Vulkan instance * extensions should be retrieved * \param [in,out] count pointer to an \c unsigned related to the number of * required Vulkan instance extensions * \param [out] names \c NULL or a pointer to an array to be filled with the * required Vulkan instance extensions * * \return \c SDL_TRUE on success, \c SDL_FALSE on error. * * If \a pNames is \c NULL, then the number of required Vulkan instance * extensions is returned in pCount. Otherwise, \a pCount must point to a * variable set to the number of elements in the \a pNames array, and on * return the variable is overwritten with the number of names actually * written to \a pNames. If \a pCount is less than the number of required * extensions, at most \a pCount structures will be written. If \a pCount * is smaller than the number of required extensions, \c SDL_FALSE will be * returned instead of \c SDL_TRUE, to indicate that not all the required * extensions were returned. * * \note The returned list of extensions will contain \c VK_KHR_surface * and zero or more platform specific extensions * * \note The extension names queried here must be enabled when calling * VkCreateInstance, otherwise surface creation will fail. * * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. * * \code * unsigned int count; * // get count of required extensions * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) * handle_error(); * * static const char *const additionalExtensions[] = * { * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension * }; * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); * size_t extensionCount = count + additionalExtensionsCount; * const char **names = malloc(sizeof(const char *) * extensionCount); * if(!names) * handle_error(); * * // get names of required extensions * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) * handle_error(); * * // copy additional extensions after required extensions * for(size_t i = 0; i < additionalExtensionsCount; i++) * names[i + count] = additionalExtensions[i]; * * VkInstanceCreateInfo instanceCreateInfo = {}; * instanceCreateInfo.enabledExtensionCount = extensionCount; * instanceCreateInfo.ppEnabledExtensionNames = names; * // fill in rest of instanceCreateInfo * * VkInstance instance; * // create the Vulkan instance * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); * free(names); * \endcode * * \sa SDL_Vulkan_CreateSurface() */ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions( SDL_Window *window, unsigned int *pCount, const char **pNames); /** * \brief Create a Vulkan rendering surface for a window. * * \param [in] window SDL_Window to which to attach the rendering surface. * \param [in] instance handle to the Vulkan instance to use. * \param [out] surface pointer to a VkSurfaceKHR handle to receive the * handle of the newly created surface. * * \return \c SDL_TRUE on success, \c SDL_FALSE on error. * * \code * VkInstance instance; * SDL_Window *window; * * // create instance and window * * // create the Vulkan surface * VkSurfaceKHR surface; * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) * handle_error(); * \endcode * * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. * * \note \a instance should have been created with the extensions returned * by \c SDL_Vulkan_CreateSurface() enabled. * * \sa SDL_Vulkan_GetInstanceExtensions() */ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( SDL_Window *window, VkInstance instance, VkSurfaceKHR* surface); /** * \brief Get the size of a window's underlying drawable in pixels (for use * with setting viewport, scissor & etc). * * \param window SDL_Window from which the drawable size should be queried * \param w Pointer to variable for storing the width in pixels, * may be NULL * \param h Pointer to variable for storing the height in pixels, * may be NULL * * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * * \note On macOS high-DPI support must be enabled for an application by * setting NSHighResolutionCapable to true in its Info.plist. * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h); /* @} *//* Vulkan support functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_vulkan_h_ */
10,580
C
37.616788
172
0.693289
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_egl.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_egl.h * * This is a simple file to encapsulate the EGL API headers. */ #if !defined(_MSC_VER) && !defined(__ANDROID__) #include <EGL/egl.h> #include <EGL/eglext.h> #else /* _MSC_VER */ /* EGL headers for Visual Studio */ #ifndef __khrplatform_h_ #define __khrplatform_h_ /* ** Copyright (c) 2008-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* Khronos platform-specific types and definitions. * * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $ * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. * Please submit changes by sending them to the public Khronos Bugzilla * (http://khronos.org/bugzilla) by filing a bug against product * "Khronos (general)" component "Registry". * * A predefined template which fills in some of the bug fields can be * reached using http://tinyurl.com/khrplatform-h-bugreport, but you * must create a Bugzilla login first. * * * See the Implementer's Guidelines for information about where this file * should be located on your system and for more details of its use: * http://www.khronos.org/registry/implementers_guide.pdf * * This file should be included as * #include <KHR/khrplatform.h> * by Khronos client API header files that use its types and defines. * * The types in khrplatform.h should only be used to define API-specific types. * * Types defined in khrplatform.h: * khronos_int8_t signed 8 bit * khronos_uint8_t unsigned 8 bit * khronos_int16_t signed 16 bit * khronos_uint16_t unsigned 16 bit * khronos_int32_t signed 32 bit * khronos_uint32_t unsigned 32 bit * khronos_int64_t signed 64 bit * khronos_uint64_t unsigned 64 bit * khronos_intptr_t signed same number of bits as a pointer * khronos_uintptr_t unsigned same number of bits as a pointer * khronos_ssize_t signed size * khronos_usize_t unsigned size * khronos_float_t signed 32 bit floating point * khronos_time_ns_t unsigned 64 bit time in nanoseconds * khronos_utime_nanoseconds_t unsigned time interval or absolute time in * nanoseconds * khronos_stime_nanoseconds_t signed time interval in nanoseconds * khronos_boolean_enum_t enumerated boolean type. This should * only be used as a base type when a client API's boolean type is * an enum. Client APIs which use an integer or other type for * booleans cannot use this as the base type for their boolean. * * Tokens defined in khrplatform.h: * * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. * * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. * * Calling convention macros defined in this file: * KHRONOS_APICALL * KHRONOS_APIENTRY * KHRONOS_APIATTRIBUTES * * These may be used in function prototypes as: * * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( * int arg1, * int arg2) KHRONOS_APIATTRIBUTES; */ /*------------------------------------------------------------------------- * Definition of KHRONOS_APICALL *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ #if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C #else # define KHRONOS_APICALL #endif /*------------------------------------------------------------------------- * Definition of KHRONOS_APIENTRY *------------------------------------------------------------------------- * This follows the return type of the function and precedes the function * name in the function prototype. */ #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) /* Win32 but not WinCE */ # define KHRONOS_APIENTRY __stdcall #else # define KHRONOS_APIENTRY #endif /*------------------------------------------------------------------------- * Definition of KHRONOS_APIATTRIBUTES *------------------------------------------------------------------------- * This follows the closing parenthesis of the function prototype arguments. */ #if defined (__ARMCC_2__) #define KHRONOS_APIATTRIBUTES __softfp #else #define KHRONOS_APIATTRIBUTES #endif /*------------------------------------------------------------------------- * basic type definitions *-----------------------------------------------------------------------*/ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) /* * Using <stdint.h> */ #include <stdint.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(__VMS ) || defined(__sgi) /* * Using <inttypes.h> */ #include <inttypes.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(_WIN32) && !defined(__SCITECH_SNAP__) /* * Win32 */ typedef __int32 khronos_int32_t; typedef unsigned __int32 khronos_uint32_t; typedef __int64 khronos_int64_t; typedef unsigned __int64 khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif defined(__sun__) || defined(__digital__) /* * Sun or Digital */ typedef int khronos_int32_t; typedef unsigned int khronos_uint32_t; #if defined(__arch64__) || defined(_LP64) typedef long int khronos_int64_t; typedef unsigned long int khronos_uint64_t; #else typedef long long int khronos_int64_t; typedef unsigned long long int khronos_uint64_t; #endif /* __arch64__ */ #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #elif 0 /* * Hypothetical platform with no float or int64 support */ typedef int khronos_int32_t; typedef unsigned int khronos_uint32_t; #define KHRONOS_SUPPORT_INT64 0 #define KHRONOS_SUPPORT_FLOAT 0 #else /* * Generic fallback */ #include <stdint.h> typedef int32_t khronos_int32_t; typedef uint32_t khronos_uint32_t; typedef int64_t khronos_int64_t; typedef uint64_t khronos_uint64_t; #define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_FLOAT 1 #endif /* * Types that are (so far) the same on all platforms */ typedef signed char khronos_int8_t; typedef unsigned char khronos_uint8_t; typedef signed short int khronos_int16_t; typedef unsigned short int khronos_uint16_t; /* * Types that differ between LLP64 and LP64 architectures - in LLP64, * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * to be the only LLP64 architecture in current use. */ #ifdef _WIN64 typedef signed long long int khronos_intptr_t; typedef unsigned long long int khronos_uintptr_t; typedef signed long long int khronos_ssize_t; typedef unsigned long long int khronos_usize_t; #else typedef signed long int khronos_intptr_t; typedef unsigned long int khronos_uintptr_t; typedef signed long int khronos_ssize_t; typedef unsigned long int khronos_usize_t; #endif #if KHRONOS_SUPPORT_FLOAT /* * Float type */ typedef float khronos_float_t; #endif #if KHRONOS_SUPPORT_INT64 /* Time types * * These types can be used to represent a time interval in nanoseconds or * an absolute Unadjusted System Time. Unadjusted System Time is the number * of nanoseconds since some arbitrary system event (e.g. since the last * time the system booted). The Unadjusted System Time is an unsigned * 64 bit value that wraps back to 0 every 584 years. Time intervals * may be either signed or unsigned. */ typedef khronos_uint64_t khronos_utime_nanoseconds_t; typedef khronos_int64_t khronos_stime_nanoseconds_t; #endif /* * Dummy value used to pad enum types to 32 bits. */ #ifndef KHRONOS_MAX_ENUM #define KHRONOS_MAX_ENUM 0x7FFFFFFF #endif /* * Enumerated boolean type * * Values other than zero should be considered to be true. Therefore * comparisons should not be made against KHRONOS_TRUE. */ typedef enum { KHRONOS_FALSE = 0, KHRONOS_TRUE = 1, KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM } khronos_boolean_enum_t; #endif /* __khrplatform_h_ */ #ifndef __eglplatform_h_ #define __eglplatform_h_ /* ** Copyright (c) 2007-2009 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* Platform-specific types and definitions for egl.h * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that * they can be included in future versions of this file. Please submit changes * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) * by filing a bug against product "EGL" component "Registry". */ /*#include <KHR/khrplatform.h>*/ /* Macros used in EGL function prototype declarations. * * EGL functions should be prototyped as: * * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); * * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h */ #ifndef EGLAPI #define EGLAPI KHRONOS_APICALL #endif #ifndef EGLAPIENTRY #define EGLAPIENTRY KHRONOS_APIENTRY #endif #define EGLAPIENTRYP EGLAPIENTRY* /* The types NativeDisplayType, NativeWindowType, and NativePixmapType * are aliases of window-system-dependent types, such as X Display * or * Windows Device Context. They must be defined in platform-specific * code below. The EGL-prefixed versions of Native*Type are the same * types, renamed in EGL 1.3 so all types in the API start with "EGL". * * Khronos STRONGLY RECOMMENDS that you use the default definitions * provided below, since these changes affect both binary and source * portability of applications using EGL running on different EGL * implementations. */ #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #include <windows.h> #if __WINRT__ #include <Unknwn.h> typedef IUnknown * EGLNativeWindowType; typedef IUnknown * EGLNativePixmapType; typedef IUnknown * EGLNativeDisplayType; #else typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; #endif #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ typedef int EGLNativeDisplayType; typedef void *EGLNativeWindowType; typedef void *EGLNativePixmapType; #elif defined(WL_EGL_PLATFORM) typedef struct wl_display *EGLNativeDisplayType; typedef struct wl_egl_pixmap *EGLNativePixmapType; typedef struct wl_egl_window *EGLNativeWindowType; #elif defined(__GBM__) typedef struct gbm_device *EGLNativeDisplayType; typedef struct gbm_bo *EGLNativePixmapType; typedef void *EGLNativeWindowType; #elif defined(__ANDROID__) /* Android */ struct ANativeWindow; struct egl_native_pixmap_t; typedef struct ANativeWindow *EGLNativeWindowType; typedef struct egl_native_pixmap_t *EGLNativePixmapType; typedef void *EGLNativeDisplayType; #elif defined(MIR_EGL_PLATFORM) #include <mir_toolkit/mir_client_library.h> typedef MirEGLNativeDisplayType EGLNativeDisplayType; typedef void *EGLNativePixmapType; typedef MirEGLNativeWindowType EGLNativeWindowType; #elif defined(__unix__) #ifdef MESA_EGL_NO_X11_HEADERS typedef void *EGLNativeDisplayType; typedef khronos_uintptr_t EGLNativePixmapType; typedef khronos_uintptr_t EGLNativeWindowType; #else /* X11 (tentative) */ #include <X11/Xlib.h> #include <X11/Xutil.h> typedef Display *EGLNativeDisplayType; typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; #endif /* MESA_EGL_NO_X11_HEADERS */ #else #error "Platform not recognized" #endif /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ typedef EGLNativeDisplayType NativeDisplayType; typedef EGLNativePixmapType NativePixmapType; typedef EGLNativeWindowType NativeWindowType; /* Define EGLint. This must be a signed integral type large enough to contain * all legal attribute names and values passed into and out of EGL, whether * their type is boolean, bitmask, enumerant (symbolic constant), integer, * handle, or other. While in general a 32-bit integer will suffice, if * handles are 64 bit types, then EGLint should be defined as a signed 64-bit * integer type. */ typedef khronos_int32_t EGLint; #endif /* __eglplatform_h */ #ifndef __egl_h_ #define __egl_h_ 1 #ifdef __cplusplus extern "C" { #endif /* ** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** ** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ */ /*#include <EGL/eglplatform.h>*/ /* Generated on date 20150623 */ /* Generated C header for: * API: egl * Versions considered: .* * Versions emitted: .* * Default extensions included: None * Additional extensions included: _nomatch_^ * Extensions removed: _nomatch_^ */ #ifndef EGL_VERSION_1_0 #define EGL_VERSION_1_0 1 typedef unsigned int EGLBoolean; typedef void *EGLDisplay; typedef void *EGLConfig; typedef void *EGLSurface; typedef void *EGLContext; typedef void (*__eglMustCastToProperFunctionPointerType)(void); #define EGL_ALPHA_SIZE 0x3021 #define EGL_BAD_ACCESS 0x3002 #define EGL_BAD_ALLOC 0x3003 #define EGL_BAD_ATTRIBUTE 0x3004 #define EGL_BAD_CONFIG 0x3005 #define EGL_BAD_CONTEXT 0x3006 #define EGL_BAD_CURRENT_SURFACE 0x3007 #define EGL_BAD_DISPLAY 0x3008 #define EGL_BAD_MATCH 0x3009 #define EGL_BAD_NATIVE_PIXMAP 0x300A #define EGL_BAD_NATIVE_WINDOW 0x300B #define EGL_BAD_PARAMETER 0x300C #define EGL_BAD_SURFACE 0x300D #define EGL_BLUE_SIZE 0x3022 #define EGL_BUFFER_SIZE 0x3020 #define EGL_CONFIG_CAVEAT 0x3027 #define EGL_CONFIG_ID 0x3028 #define EGL_CORE_NATIVE_ENGINE 0x305B #define EGL_DEPTH_SIZE 0x3025 #define EGL_DONT_CARE ((EGLint)-1) #define EGL_DRAW 0x3059 #define EGL_EXTENSIONS 0x3055 #define EGL_FALSE 0 #define EGL_GREEN_SIZE 0x3023 #define EGL_HEIGHT 0x3056 #define EGL_LARGEST_PBUFFER 0x3058 #define EGL_LEVEL 0x3029 #define EGL_MAX_PBUFFER_HEIGHT 0x302A #define EGL_MAX_PBUFFER_PIXELS 0x302B #define EGL_MAX_PBUFFER_WIDTH 0x302C #define EGL_NATIVE_RENDERABLE 0x302D #define EGL_NATIVE_VISUAL_ID 0x302E #define EGL_NATIVE_VISUAL_TYPE 0x302F #define EGL_NONE 0x3038 #define EGL_NON_CONFORMANT_CONFIG 0x3051 #define EGL_NOT_INITIALIZED 0x3001 #define EGL_NO_CONTEXT ((EGLContext)0) #define EGL_NO_DISPLAY ((EGLDisplay)0) #define EGL_NO_SURFACE ((EGLSurface)0) #define EGL_PBUFFER_BIT 0x0001 #define EGL_PIXMAP_BIT 0x0002 #define EGL_READ 0x305A #define EGL_RED_SIZE 0x3024 #define EGL_SAMPLES 0x3031 #define EGL_SAMPLE_BUFFERS 0x3032 #define EGL_SLOW_CONFIG 0x3050 #define EGL_STENCIL_SIZE 0x3026 #define EGL_SUCCESS 0x3000 #define EGL_SURFACE_TYPE 0x3033 #define EGL_TRANSPARENT_BLUE_VALUE 0x3035 #define EGL_TRANSPARENT_GREEN_VALUE 0x3036 #define EGL_TRANSPARENT_RED_VALUE 0x3037 #define EGL_TRANSPARENT_RGB 0x3052 #define EGL_TRANSPARENT_TYPE 0x3034 #define EGL_TRUE 1 #define EGL_VENDOR 0x3053 #define EGL_VERSION 0x3054 #define EGL_WIDTH 0x3057 #define EGL_WINDOW_BIT 0x0004 EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); EGLAPI EGLint EGLAPIENTRY eglGetError (void); EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); #endif /* EGL_VERSION_1_0 */ #ifndef EGL_VERSION_1_1 #define EGL_VERSION_1_1 1 #define EGL_BACK_BUFFER 0x3084 #define EGL_BIND_TO_TEXTURE_RGB 0x3039 #define EGL_BIND_TO_TEXTURE_RGBA 0x303A #define EGL_CONTEXT_LOST 0x300E #define EGL_MIN_SWAP_INTERVAL 0x303B #define EGL_MAX_SWAP_INTERVAL 0x303C #define EGL_MIPMAP_TEXTURE 0x3082 #define EGL_MIPMAP_LEVEL 0x3083 #define EGL_NO_TEXTURE 0x305C #define EGL_TEXTURE_2D 0x305F #define EGL_TEXTURE_FORMAT 0x3080 #define EGL_TEXTURE_RGB 0x305D #define EGL_TEXTURE_RGBA 0x305E #define EGL_TEXTURE_TARGET 0x3081 EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); #endif /* EGL_VERSION_1_1 */ #ifndef EGL_VERSION_1_2 #define EGL_VERSION_1_2 1 typedef unsigned int EGLenum; typedef void *EGLClientBuffer; #define EGL_ALPHA_FORMAT 0x3088 #define EGL_ALPHA_FORMAT_NONPRE 0x308B #define EGL_ALPHA_FORMAT_PRE 0x308C #define EGL_ALPHA_MASK_SIZE 0x303E #define EGL_BUFFER_PRESERVED 0x3094 #define EGL_BUFFER_DESTROYED 0x3095 #define EGL_CLIENT_APIS 0x308D #define EGL_COLORSPACE 0x3087 #define EGL_COLORSPACE_sRGB 0x3089 #define EGL_COLORSPACE_LINEAR 0x308A #define EGL_COLOR_BUFFER_TYPE 0x303F #define EGL_CONTEXT_CLIENT_TYPE 0x3097 #define EGL_DISPLAY_SCALING 10000 #define EGL_HORIZONTAL_RESOLUTION 0x3090 #define EGL_LUMINANCE_BUFFER 0x308F #define EGL_LUMINANCE_SIZE 0x303D #define EGL_OPENGL_ES_BIT 0x0001 #define EGL_OPENVG_BIT 0x0002 #define EGL_OPENGL_ES_API 0x30A0 #define EGL_OPENVG_API 0x30A1 #define EGL_OPENVG_IMAGE 0x3096 #define EGL_PIXEL_ASPECT_RATIO 0x3092 #define EGL_RENDERABLE_TYPE 0x3040 #define EGL_RENDER_BUFFER 0x3086 #define EGL_RGB_BUFFER 0x308E #define EGL_SINGLE_BUFFER 0x3085 #define EGL_SWAP_BEHAVIOR 0x3093 #define EGL_UNKNOWN ((EGLint)-1) #define EGL_VERTICAL_RESOLUTION 0x3091 EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); #endif /* EGL_VERSION_1_2 */ #ifndef EGL_VERSION_1_3 #define EGL_VERSION_1_3 1 #define EGL_CONFORMANT 0x3042 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 #define EGL_MATCH_NATIVE_PIXMAP 0x3041 #define EGL_OPENGL_ES2_BIT 0x0004 #define EGL_VG_ALPHA_FORMAT 0x3088 #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B #define EGL_VG_ALPHA_FORMAT_PRE 0x308C #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 #define EGL_VG_COLORSPACE 0x3087 #define EGL_VG_COLORSPACE_sRGB 0x3089 #define EGL_VG_COLORSPACE_LINEAR 0x308A #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 #endif /* EGL_VERSION_1_3 */ #ifndef EGL_VERSION_1_4 #define EGL_VERSION_1_4 1 #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 #define EGL_MULTISAMPLE_RESOLVE 0x3099 #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B #define EGL_OPENGL_API 0x30A2 #define EGL_OPENGL_BIT 0x0008 #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); #endif /* EGL_VERSION_1_4 */ #ifndef EGL_VERSION_1_5 #define EGL_VERSION_1_5 1 typedef void *EGLSync; typedef intptr_t EGLAttrib; typedef khronos_utime_nanoseconds_t EGLTime; typedef void *EGLImage; #define EGL_CONTEXT_MAJOR_VERSION 0x3098 #define EGL_CONTEXT_MINOR_VERSION 0x30FB #define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD #define EGL_NO_RESET_NOTIFICATION 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET 0x31BF #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 #define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 #define EGL_OPENGL_ES3_BIT 0x00000040 #define EGL_CL_EVENT_HANDLE 0x309C #define EGL_SYNC_CL_EVENT 0x30FE #define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 #define EGL_SYNC_TYPE 0x30F7 #define EGL_SYNC_STATUS 0x30F1 #define EGL_SYNC_CONDITION 0x30F8 #define EGL_SIGNALED 0x30F2 #define EGL_UNSIGNALED 0x30F3 #define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 #define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull #define EGL_TIMEOUT_EXPIRED 0x30F5 #define EGL_CONDITION_SATISFIED 0x30F6 #define EGL_NO_SYNC ((EGLSync)0) #define EGL_SYNC_FENCE 0x30F9 #define EGL_GL_COLORSPACE 0x309D #define EGL_GL_COLORSPACE_SRGB 0x3089 #define EGL_GL_COLORSPACE_LINEAR 0x308A #define EGL_GL_RENDERBUFFER 0x30B9 #define EGL_GL_TEXTURE_2D 0x30B1 #define EGL_GL_TEXTURE_LEVEL 0x30BC #define EGL_GL_TEXTURE_3D 0x30B2 #define EGL_GL_TEXTURE_ZOFFSET 0x30BD #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 #define EGL_IMAGE_PRESERVED 0x30D2 #define EGL_NO_IMAGE ((EGLImage)0) EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); #endif /* EGL_VERSION_1_5 */ #ifdef __cplusplus } #endif #endif /* __egl_h_ */ #ifndef __eglext_h_ #define __eglext_h_ 1 #ifdef __cplusplus extern "C" { #endif /* ** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ /* ** This header is generated from the Khronos OpenGL / OpenGL ES XML ** API Registry. The current version of the Registry, generator scripts ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** ** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $ */ /*#include <EGL/eglplatform.h>*/ #define EGL_EGLEXT_VERSION 20150623 /* Generated C header for: * API: egl * Versions considered: .* * Versions emitted: _nomatch_^ * Default extensions included: egl * Additional extensions included: _nomatch_^ * Extensions removed: _nomatch_^ */ #ifndef EGL_KHR_cl_event #define EGL_KHR_cl_event 1 #define EGL_CL_EVENT_HANDLE_KHR 0x309C #define EGL_SYNC_CL_EVENT_KHR 0x30FE #define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF #endif /* EGL_KHR_cl_event */ #ifndef EGL_KHR_cl_event2 #define EGL_KHR_cl_event2 1 typedef void *EGLSyncKHR; typedef intptr_t EGLAttribKHR; typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); #endif #endif /* EGL_KHR_cl_event2 */ #ifndef EGL_KHR_client_get_all_proc_addresses #define EGL_KHR_client_get_all_proc_addresses 1 #endif /* EGL_KHR_client_get_all_proc_addresses */ #ifndef EGL_KHR_config_attribs #define EGL_KHR_config_attribs 1 #define EGL_CONFORMANT_KHR 0x3042 #define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 #define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 #endif /* EGL_KHR_config_attribs */ #ifndef EGL_KHR_create_context #define EGL_KHR_create_context 1 #define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 #define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB #define EGL_CONTEXT_FLAGS_KHR 0x30FC #define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD #define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF #define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 #define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 #define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 #define EGL_OPENGL_ES3_BIT_KHR 0x00000040 #endif /* EGL_KHR_create_context */ #ifndef EGL_KHR_create_context_no_error #define EGL_KHR_create_context_no_error 1 #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 #endif /* EGL_KHR_create_context_no_error */ #ifndef EGL_KHR_fence_sync #define EGL_KHR_fence_sync 1 typedef khronos_utime_nanoseconds_t EGLTimeKHR; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 #define EGL_SYNC_CONDITION_KHR 0x30F8 #define EGL_SYNC_FENCE_KHR 0x30F9 typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_fence_sync */ #ifndef EGL_KHR_get_all_proc_addresses #define EGL_KHR_get_all_proc_addresses 1 #endif /* EGL_KHR_get_all_proc_addresses */ #ifndef EGL_KHR_gl_colorspace #define EGL_KHR_gl_colorspace 1 #define EGL_GL_COLORSPACE_KHR 0x309D #define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 #define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A #endif /* EGL_KHR_gl_colorspace */ #ifndef EGL_KHR_gl_renderbuffer_image #define EGL_KHR_gl_renderbuffer_image 1 #define EGL_GL_RENDERBUFFER_KHR 0x30B9 #endif /* EGL_KHR_gl_renderbuffer_image */ #ifndef EGL_KHR_gl_texture_2D_image #define EGL_KHR_gl_texture_2D_image 1 #define EGL_GL_TEXTURE_2D_KHR 0x30B1 #define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC #endif /* EGL_KHR_gl_texture_2D_image */ #ifndef EGL_KHR_gl_texture_3D_image #define EGL_KHR_gl_texture_3D_image 1 #define EGL_GL_TEXTURE_3D_KHR 0x30B2 #define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD #endif /* EGL_KHR_gl_texture_3D_image */ #ifndef EGL_KHR_gl_texture_cubemap_image #define EGL_KHR_gl_texture_cubemap_image 1 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 #define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 #define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 #endif /* EGL_KHR_gl_texture_cubemap_image */ #ifndef EGL_KHR_image #define EGL_KHR_image 1 typedef void *EGLImageKHR; #define EGL_NATIVE_PIXMAP_KHR 0x30B0 #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); #endif #endif /* EGL_KHR_image */ #ifndef EGL_KHR_image_base #define EGL_KHR_image_base 1 #define EGL_IMAGE_PRESERVED_KHR 0x30D2 #endif /* EGL_KHR_image_base */ #ifndef EGL_KHR_image_pixmap #define EGL_KHR_image_pixmap 1 #endif /* EGL_KHR_image_pixmap */ #ifndef EGL_KHR_lock_surface #define EGL_KHR_lock_surface 1 #define EGL_READ_SURFACE_BIT_KHR 0x0001 #define EGL_WRITE_SURFACE_BIT_KHR 0x0002 #define EGL_LOCK_SURFACE_BIT_KHR 0x0080 #define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 #define EGL_MATCH_FORMAT_KHR 0x3043 #define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 #define EGL_FORMAT_RGB_565_KHR 0x30C1 #define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 #define EGL_FORMAT_RGBA_8888_KHR 0x30C3 #define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 #define EGL_LOCK_USAGE_HINT_KHR 0x30C5 #define EGL_BITMAP_POINTER_KHR 0x30C6 #define EGL_BITMAP_PITCH_KHR 0x30C7 #define EGL_BITMAP_ORIGIN_KHR 0x30C8 #define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 #define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA #define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB #define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC #define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD #define EGL_LOWER_LEFT_KHR 0x30CE #define EGL_UPPER_LEFT_KHR 0x30CF typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); #endif #endif /* EGL_KHR_lock_surface */ #ifndef EGL_KHR_lock_surface2 #define EGL_KHR_lock_surface2 1 #define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 #endif /* EGL_KHR_lock_surface2 */ #ifndef EGL_KHR_lock_surface3 #define EGL_KHR_lock_surface3 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); #endif #endif /* EGL_KHR_lock_surface3 */ #ifndef EGL_KHR_partial_update #define EGL_KHR_partial_update 1 #define EGL_BUFFER_AGE_KHR 0x313D typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_KHR_partial_update */ #ifndef EGL_KHR_platform_android #define EGL_KHR_platform_android 1 #define EGL_PLATFORM_ANDROID_KHR 0x3141 #endif /* EGL_KHR_platform_android */ #ifndef EGL_KHR_platform_gbm #define EGL_KHR_platform_gbm 1 #define EGL_PLATFORM_GBM_KHR 0x31D7 #endif /* EGL_KHR_platform_gbm */ #ifndef EGL_KHR_platform_wayland #define EGL_KHR_platform_wayland 1 #define EGL_PLATFORM_WAYLAND_KHR 0x31D8 #endif /* EGL_KHR_platform_wayland */ #ifndef EGL_KHR_platform_x11 #define EGL_KHR_platform_x11 1 #define EGL_PLATFORM_X11_KHR 0x31D5 #define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 #endif /* EGL_KHR_platform_x11 */ #ifndef EGL_KHR_reusable_sync #define EGL_KHR_reusable_sync 1 #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_STATUS_KHR 0x30F1 #define EGL_SIGNALED_KHR 0x30F2 #define EGL_UNSIGNALED_KHR 0x30F3 #define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 #define EGL_CONDITION_SATISFIED_KHR 0x30F6 #define EGL_SYNC_TYPE_KHR 0x30F7 #define EGL_SYNC_REUSABLE_KHR 0x30FA #define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 #define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull #define EGL_NO_SYNC_KHR ((EGLSyncKHR)0) typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_reusable_sync */ #ifndef EGL_KHR_stream #define EGL_KHR_stream 1 typedef void *EGLStreamKHR; typedef khronos_uint64_t EGLuint64KHR; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) #define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 #define EGL_PRODUCER_FRAME_KHR 0x3212 #define EGL_CONSUMER_FRAME_KHR 0x3213 #define EGL_STREAM_STATE_KHR 0x3214 #define EGL_STREAM_STATE_CREATED_KHR 0x3215 #define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 #define EGL_STREAM_STATE_EMPTY_KHR 0x3217 #define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 #define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 #define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A #define EGL_BAD_STREAM_KHR 0x321B #define EGL_BAD_STATE_KHR 0x321C typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_KHR_stream */ #ifndef EGL_KHR_stream_consumer_gltexture #define EGL_KHR_stream_consumer_gltexture 1 #ifdef EGL_KHR_stream #define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_consumer_gltexture */ #ifndef EGL_KHR_stream_cross_process_fd #define EGL_KHR_stream_cross_process_fd 1 typedef int EGLNativeFileDescriptorKHR; #ifdef EGL_KHR_stream #define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_cross_process_fd */ #ifndef EGL_KHR_stream_fifo #define EGL_KHR_stream_fifo 1 #ifdef EGL_KHR_stream #define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC #define EGL_STREAM_TIME_NOW_KHR 0x31FD #define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE #define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_fifo */ #ifndef EGL_KHR_stream_producer_aldatalocator #define EGL_KHR_stream_producer_aldatalocator 1 #ifdef EGL_KHR_stream #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_producer_aldatalocator */ #ifndef EGL_KHR_stream_producer_eglsurface #define EGL_KHR_stream_producer_eglsurface 1 #ifdef EGL_KHR_stream #define EGL_STREAM_BIT_KHR 0x0800 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); #endif #endif /* EGL_KHR_stream */ #endif /* EGL_KHR_stream_producer_eglsurface */ #ifndef EGL_KHR_surfaceless_context #define EGL_KHR_surfaceless_context 1 #endif /* EGL_KHR_surfaceless_context */ #ifndef EGL_KHR_swap_buffers_with_damage #define EGL_KHR_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_KHR_swap_buffers_with_damage */ #ifndef EGL_KHR_vg_parent_image #define EGL_KHR_vg_parent_image 1 #define EGL_VG_PARENT_IMAGE_KHR 0x30BA #endif /* EGL_KHR_vg_parent_image */ #ifndef EGL_KHR_wait_sync #define EGL_KHR_wait_sync 1 typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #endif #endif /* EGL_KHR_wait_sync */ #ifndef EGL_ANDROID_blob_cache #define EGL_ANDROID_blob_cache 1 typedef khronos_ssize_t EGLsizeiANDROID; typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #endif #endif /* EGL_ANDROID_blob_cache */ #ifndef EGL_ANDROID_framebuffer_target #define EGL_ANDROID_framebuffer_target 1 #define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 #endif /* EGL_ANDROID_framebuffer_target */ #ifndef EGL_ANDROID_image_native_buffer #define EGL_ANDROID_image_native_buffer 1 #define EGL_NATIVE_BUFFER_ANDROID 0x3140 #endif /* EGL_ANDROID_image_native_buffer */ #ifndef EGL_ANDROID_native_fence_sync #define EGL_ANDROID_native_fence_sync 1 #define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 #define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 #define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 #define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); #endif #endif /* EGL_ANDROID_native_fence_sync */ #ifndef EGL_ANDROID_recordable #define EGL_ANDROID_recordable 1 #define EGL_RECORDABLE_ANDROID 0x3142 #endif /* EGL_ANDROID_recordable */ #ifndef EGL_ANGLE_d3d_share_handle_client_buffer #define EGL_ANGLE_d3d_share_handle_client_buffer 1 #define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 #endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ #ifndef EGL_ANGLE_device_d3d #define EGL_ANGLE_device_d3d 1 #define EGL_D3D9_DEVICE_ANGLE 0x33A0 #define EGL_D3D11_DEVICE_ANGLE 0x33A1 #endif /* EGL_ANGLE_device_d3d */ #ifndef EGL_ANGLE_query_surface_pointer #define EGL_ANGLE_query_surface_pointer 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); #endif #endif /* EGL_ANGLE_query_surface_pointer */ #ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle #define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 #endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ #ifndef EGL_ANGLE_window_fixed_size #define EGL_ANGLE_window_fixed_size 1 #define EGL_FIXED_SIZE_ANGLE 0x3201 #endif /* EGL_ANGLE_window_fixed_size */ #ifndef EGL_ARM_pixmap_multisample_discard #define EGL_ARM_pixmap_multisample_discard 1 #define EGL_DISCARD_SAMPLES_ARM 0x3286 #endif /* EGL_ARM_pixmap_multisample_discard */ #ifndef EGL_EXT_buffer_age #define EGL_EXT_buffer_age 1 #define EGL_BUFFER_AGE_EXT 0x313D #endif /* EGL_EXT_buffer_age */ #ifndef EGL_EXT_client_extensions #define EGL_EXT_client_extensions 1 #endif /* EGL_EXT_client_extensions */ #ifndef EGL_EXT_create_context_robustness #define EGL_EXT_create_context_robustness 1 #define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF #define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 #define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE #define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF #endif /* EGL_EXT_create_context_robustness */ #ifndef EGL_EXT_device_base #define EGL_EXT_device_base 1 typedef void *EGLDeviceEXT; #define EGL_NO_DEVICE_EXT ((EGLDeviceEXT)(0)) #define EGL_BAD_DEVICE_EXT 0x322B #define EGL_DEVICE_EXT 0x322C typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); #endif #endif /* EGL_EXT_device_base */ #ifndef EGL_EXT_device_drm #define EGL_EXT_device_drm 1 #define EGL_DRM_DEVICE_FILE_EXT 0x3233 #endif /* EGL_EXT_device_drm */ #ifndef EGL_EXT_device_enumeration #define EGL_EXT_device_enumeration 1 #endif /* EGL_EXT_device_enumeration */ #ifndef EGL_EXT_device_openwf #define EGL_EXT_device_openwf 1 #define EGL_OPENWF_DEVICE_ID_EXT 0x3237 #endif /* EGL_EXT_device_openwf */ #ifndef EGL_EXT_device_query #define EGL_EXT_device_query 1 #endif /* EGL_EXT_device_query */ #ifndef EGL_EXT_image_dma_buf_import #define EGL_EXT_image_dma_buf_import 1 #define EGL_LINUX_DMA_BUF_EXT 0x3270 #define EGL_LINUX_DRM_FOURCC_EXT 0x3271 #define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 #define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 #define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 #define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 #define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 #define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 #define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 #define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 #define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A #define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B #define EGL_SAMPLE_RANGE_HINT_EXT 0x327C #define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D #define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E #define EGL_ITU_REC601_EXT 0x327F #define EGL_ITU_REC709_EXT 0x3280 #define EGL_ITU_REC2020_EXT 0x3281 #define EGL_YUV_FULL_RANGE_EXT 0x3282 #define EGL_YUV_NARROW_RANGE_EXT 0x3283 #define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 #define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 #endif /* EGL_EXT_image_dma_buf_import */ #ifndef EGL_EXT_multiview_window #define EGL_EXT_multiview_window 1 #define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 #endif /* EGL_EXT_multiview_window */ #ifndef EGL_EXT_output_base #define EGL_EXT_output_base 1 typedef void *EGLOutputLayerEXT; typedef void *EGLOutputPortEXT; #define EGL_NO_OUTPUT_LAYER_EXT ((EGLOutputLayerEXT)0) #define EGL_NO_OUTPUT_PORT_EXT ((EGLOutputPortEXT)0) #define EGL_BAD_OUTPUT_LAYER_EXT 0x322D #define EGL_BAD_OUTPUT_PORT_EXT 0x322E #define EGL_SWAP_INTERVAL_EXT 0x322F typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); #endif #endif /* EGL_EXT_output_base */ #ifndef EGL_EXT_output_drm #define EGL_EXT_output_drm 1 #define EGL_DRM_CRTC_EXT 0x3234 #define EGL_DRM_PLANE_EXT 0x3235 #define EGL_DRM_CONNECTOR_EXT 0x3236 #endif /* EGL_EXT_output_drm */ #ifndef EGL_EXT_output_openwf #define EGL_EXT_output_openwf 1 #define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 #define EGL_OPENWF_PORT_ID_EXT 0x3239 #endif /* EGL_EXT_output_openwf */ #ifndef EGL_EXT_platform_base #define EGL_EXT_platform_base 1 typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); #endif #endif /* EGL_EXT_platform_base */ #ifndef EGL_EXT_platform_device #define EGL_EXT_platform_device 1 #define EGL_PLATFORM_DEVICE_EXT 0x313F #endif /* EGL_EXT_platform_device */ #ifndef EGL_EXT_platform_wayland #define EGL_EXT_platform_wayland 1 #define EGL_PLATFORM_WAYLAND_EXT 0x31D8 #endif /* EGL_EXT_platform_wayland */ #ifndef EGL_EXT_platform_x11 #define EGL_EXT_platform_x11 1 #define EGL_PLATFORM_X11_EXT 0x31D5 #define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 #endif /* EGL_EXT_platform_x11 */ #ifndef EGL_EXT_protected_surface #define EGL_EXT_protected_surface 1 #define EGL_PROTECTED_CONTENT_EXT 0x32C0 #endif /* EGL_EXT_protected_surface */ #ifndef EGL_EXT_stream_consumer_egloutput #define EGL_EXT_stream_consumer_egloutput 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); #endif #endif /* EGL_EXT_stream_consumer_egloutput */ #ifndef EGL_EXT_swap_buffers_with_damage #define EGL_EXT_swap_buffers_with_damage 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); #endif #endif /* EGL_EXT_swap_buffers_with_damage */ #ifndef EGL_EXT_yuv_surface #define EGL_EXT_yuv_surface 1 #define EGL_YUV_ORDER_EXT 0x3301 #define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 #define EGL_YUV_SUBSAMPLE_EXT 0x3312 #define EGL_YUV_DEPTH_RANGE_EXT 0x3317 #define EGL_YUV_CSC_STANDARD_EXT 0x330A #define EGL_YUV_PLANE_BPP_EXT 0x331A #define EGL_YUV_BUFFER_EXT 0x3300 #define EGL_YUV_ORDER_YUV_EXT 0x3302 #define EGL_YUV_ORDER_YVU_EXT 0x3303 #define EGL_YUV_ORDER_YUYV_EXT 0x3304 #define EGL_YUV_ORDER_UYVY_EXT 0x3305 #define EGL_YUV_ORDER_YVYU_EXT 0x3306 #define EGL_YUV_ORDER_VYUY_EXT 0x3307 #define EGL_YUV_ORDER_AYUV_EXT 0x3308 #define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 #define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 #define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 #define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 #define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 #define EGL_YUV_CSC_STANDARD_601_EXT 0x330B #define EGL_YUV_CSC_STANDARD_709_EXT 0x330C #define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D #define EGL_YUV_PLANE_BPP_0_EXT 0x331B #define EGL_YUV_PLANE_BPP_8_EXT 0x331C #define EGL_YUV_PLANE_BPP_10_EXT 0x331D #endif /* EGL_EXT_yuv_surface */ #ifndef EGL_HI_clientpixmap #define EGL_HI_clientpixmap 1 struct EGLClientPixmapHI { void *pData; EGLint iWidth; EGLint iHeight; EGLint iStride; }; #define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); #endif #endif /* EGL_HI_clientpixmap */ #ifndef EGL_HI_colorformats #define EGL_HI_colorformats 1 #define EGL_COLOR_FORMAT_HI 0x8F70 #define EGL_COLOR_RGB_HI 0x8F71 #define EGL_COLOR_RGBA_HI 0x8F72 #define EGL_COLOR_ARGB_HI 0x8F73 #endif /* EGL_HI_colorformats */ #ifndef EGL_IMG_context_priority #define EGL_IMG_context_priority 1 #define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 #define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 #define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 #define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 #endif /* EGL_IMG_context_priority */ #ifndef EGL_MESA_drm_image #define EGL_MESA_drm_image 1 #define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 #define EGL_DRM_BUFFER_USE_MESA 0x31D1 #define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 #define EGL_DRM_BUFFER_MESA 0x31D3 #define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 #define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 #define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); #endif #endif /* EGL_MESA_drm_image */ #ifndef EGL_MESA_image_dma_buf_export #define EGL_MESA_image_dma_buf_export 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); #endif #endif /* EGL_MESA_image_dma_buf_export */ #ifndef EGL_MESA_platform_gbm #define EGL_MESA_platform_gbm 1 #define EGL_PLATFORM_GBM_MESA 0x31D7 #endif /* EGL_MESA_platform_gbm */ #ifndef EGL_NOK_swap_region #define EGL_NOK_swap_region 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #endif #endif /* EGL_NOK_swap_region */ #ifndef EGL_NOK_swap_region2 #define EGL_NOK_swap_region2 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); #endif #endif /* EGL_NOK_swap_region2 */ #ifndef EGL_NOK_texture_from_pixmap #define EGL_NOK_texture_from_pixmap 1 #define EGL_Y_INVERTED_NOK 0x307F #endif /* EGL_NOK_texture_from_pixmap */ #ifndef EGL_NV_3dvision_surface #define EGL_NV_3dvision_surface 1 #define EGL_AUTO_STEREO_NV 0x3136 #endif /* EGL_NV_3dvision_surface */ #ifndef EGL_NV_coverage_sample #define EGL_NV_coverage_sample 1 #define EGL_COVERAGE_BUFFERS_NV 0x30E0 #define EGL_COVERAGE_SAMPLES_NV 0x30E1 #endif /* EGL_NV_coverage_sample */ #ifndef EGL_NV_coverage_sample_resolve #define EGL_NV_coverage_sample_resolve 1 #define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 #define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 #define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 #endif /* EGL_NV_coverage_sample_resolve */ #ifndef EGL_NV_cuda_event #define EGL_NV_cuda_event 1 #define EGL_CUDA_EVENT_HANDLE_NV 0x323B #define EGL_SYNC_CUDA_EVENT_NV 0x323C #define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D #endif /* EGL_NV_cuda_event */ #ifndef EGL_NV_depth_nonlinear #define EGL_NV_depth_nonlinear 1 #define EGL_DEPTH_ENCODING_NV 0x30E2 #define EGL_DEPTH_ENCODING_NONE_NV 0 #define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 #endif /* EGL_NV_depth_nonlinear */ #ifndef EGL_NV_device_cuda #define EGL_NV_device_cuda 1 #define EGL_CUDA_DEVICE_NV 0x323A #endif /* EGL_NV_device_cuda */ #ifndef EGL_NV_native_query #define EGL_NV_native_query 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); #endif #endif /* EGL_NV_native_query */ #ifndef EGL_NV_post_convert_rounding #define EGL_NV_post_convert_rounding 1 #endif /* EGL_NV_post_convert_rounding */ #ifndef EGL_NV_post_sub_buffer #define EGL_NV_post_sub_buffer 1 #define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); #endif #endif /* EGL_NV_post_sub_buffer */ #ifndef EGL_NV_stream_sync #define EGL_NV_stream_sync 1 #define EGL_SYNC_NEW_FRAME_NV 0x321F typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); #endif #endif /* EGL_NV_stream_sync */ #ifndef EGL_NV_sync #define EGL_NV_sync 1 typedef void *EGLSyncNV; typedef khronos_utime_nanoseconds_t EGLTimeNV; #ifdef KHRONOS_SUPPORT_INT64 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 #define EGL_SYNC_STATUS_NV 0x30E7 #define EGL_SIGNALED_NV 0x30E8 #define EGL_UNSIGNALED_NV 0x30E9 #define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 #define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull #define EGL_ALREADY_SIGNALED_NV 0x30EA #define EGL_TIMEOUT_EXPIRED_NV 0x30EB #define EGL_CONDITION_SATISFIED_NV 0x30EC #define EGL_SYNC_TYPE_NV 0x30ED #define EGL_SYNC_CONDITION_NV 0x30EE #define EGL_SYNC_FENCE_NV 0x30EF #define EGL_NO_SYNC_NV ((EGLSyncNV)0) typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_NV_sync */ #ifndef EGL_NV_system_time #define EGL_NV_system_time 1 typedef khronos_utime_nanoseconds_t EGLuint64NV; #ifdef KHRONOS_SUPPORT_INT64 typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #endif #endif /* KHRONOS_SUPPORT_INT64 */ #endif /* EGL_NV_system_time */ #ifndef EGL_TIZEN_image_native_buffer #define EGL_TIZEN_image_native_buffer 1 #define EGL_NATIVE_BUFFER_TIZEN 0x32A0 #endif /* EGL_TIZEN_image_native_buffer */ #ifndef EGL_TIZEN_image_native_surface #define EGL_TIZEN_image_native_surface 1 #define EGL_NATIVE_SURFACE_TIZEN 0x32A1 #endif /* EGL_TIZEN_image_native_surface */ #ifdef __cplusplus } #endif #endif /* __eglext_h_ */ #endif /* _MSC_VER */
73,586
C
42.958781
176
0.732368
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_image.h
/* SDL_image: An example image loading library for use with SDL Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* A simple library to load images of various formats as SDL surfaces */ #ifndef SDL_IMAGE_H_ #define SDL_IMAGE_H_ #include "SDL.h" #include "SDL_version.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_IMAGE_MAJOR_VERSION 2 #define SDL_IMAGE_MINOR_VERSION 0 #define SDL_IMAGE_PATCHLEVEL 3 /* This macro can be used to fill a version structure with the compile-time * version of the SDL_image library. */ #define SDL_IMAGE_VERSION(X) \ { \ (X)->major = SDL_IMAGE_MAJOR_VERSION; \ (X)->minor = SDL_IMAGE_MINOR_VERSION; \ (X)->patch = SDL_IMAGE_PATCHLEVEL; \ } /** * This is the version number macro for the current SDL_image version. */ #define SDL_IMAGE_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL) /** * This macro will evaluate to true if compiled with SDL_image at least X.Y.Z. */ #define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \ (SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) /* This function gets the version of the dynamically linked SDL_image library. it should NOT be used to fill a version structure, instead you should use the SDL_IMAGE_VERSION() macro. */ extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void); typedef enum { IMG_INIT_JPG = 0x00000001, IMG_INIT_PNG = 0x00000002, IMG_INIT_TIF = 0x00000004, IMG_INIT_WEBP = 0x00000008 } IMG_InitFlags; /* Loads dynamic libraries and prepares them for use. Flags should be one or more flags from IMG_InitFlags OR'd together. It returns the flags successfully initialized, or 0 on failure. */ extern DECLSPEC int SDLCALL IMG_Init(int flags); /* Unloads libraries loaded with IMG_Init */ extern DECLSPEC void SDLCALL IMG_Quit(void); /* Load an image from an SDL data source. The 'type' may be one of: "BMP", "GIF", "PNG", etc. If the image format supports a transparent pixel, SDL will set the colorkey for the surface. You can enable RLE acceleration on the surface afterwards by calling: SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey); */ extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type); /* Convenience functions */ extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file); extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc); #if SDL_VERSION_ATLEAST(2,0,0) /* Load an image directly into a render texture. */ extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file); extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc); extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type); #endif /* SDL 2.0 */ /* Functions to detect a file type, given a seekable source */ extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isSVG(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src); extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src); /* Individual loading functions */ extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadSVG_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src); extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm); /* Individual saving functions */ extern DECLSPEC int SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file); extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst); extern DECLSPEC int SDLCALL IMG_SaveJPG(SDL_Surface *surface, const char *file, int quality); extern DECLSPEC int SDLCALL IMG_SaveJPG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst, int quality); /* We'll use SDL for reporting errors */ #define IMG_SetError SDL_SetError #define IMG_GetError SDL_GetError /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_IMAGE_H_ */
6,820
C
41.104938
133
0.734311
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_thread.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_thread_h_ #define SDL_thread_h_ /** * \file SDL_thread.h * * Header for the SDL thread management routines. */ #include "SDL_stdinc.h" #include "SDL_error.h" /* Thread synchronization primitives */ #include "SDL_atomic.h" #include "SDL_mutex.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* The SDL thread structure, defined in SDL_thread.c */ struct SDL_Thread; typedef struct SDL_Thread SDL_Thread; /* The SDL thread ID */ typedef unsigned long SDL_threadID; /* Thread local storage ID, 0 is the invalid ID */ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * * \note On many systems you require special privileges to set high priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, SDL_THREAD_PRIORITY_HIGH } SDL_ThreadPriority; /** * The function passed to SDL_CreateThread(). * It is passed a void* user context parameter and returns an int. */ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); #if defined(__WIN32__) && !defined(HAVE_LIBC) /** * \file SDL_thread.h * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() * API. There is a problem with this, that only the RTL of the SDL2.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to * start a new thread. This way, if it's the SDL2.DLL which uses this API, * then the RTL of SDL2.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: * Always use the _beginthread() and _endthread() of the calling runtime * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD #include <process.h> /* _beginthreadex() and _endthreadex() */ typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, unsigned (__stdcall *func)(void *), void * /*arg*/, unsigned, unsigned * /* threadID */); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** * Create a thread. */ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif #elif defined(__OS2__) /* * just like the windows case above: We compile SDL2 * into a dll with Watcom's runtime statically linked. */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD #ifndef __EMX__ #include <process.h> #else #include <stdlib.h> #endif typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); typedef void (*pfnSDL_CurrentEndThread)(void); extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else /** * Create a thread. * * Thread naming is a little complicated: Most systems have very small * limits for the string length (Haiku has 32 bytes, Linux currently has 16, * Visual C++ 6.0 has nine!), and possibly other arbitrary rules. You'll * have to see what happens with your system's debugger. The name should be * UTF-8 (but using the naming limits of C identifiers is a better bet). * There are no requirements for thread naming conventions, so long as the * string is null-terminated UTF-8, but these guidelines are helpful in * choosing a name: * * http://stackoverflow.com/questions/149932/naming-conventions-for-threads * * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). */ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); #endif /** * Get the thread name, as it was specified in SDL_CreateThread(). * This function returns a pointer to a UTF-8 string that names the * specified thread, or NULL if it doesn't have a name. This is internal * memory, not to be free()'d by the caller, and remains valid until the * specified thread is cleaned up by SDL_WaitThread(). */ extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread); /** * Get the thread identifier for the current thread. */ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void); /** * Get the thread identifier for the specified thread. * * Equivalent to SDL_ThreadID() if the specified thread is NULL. */ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread); /** * Set the priority for the current thread */ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); /** * Wait for a thread to finish. Threads that haven't been detached will * remain (as a "zombie") until this function cleans them up. Not doing so * is a resource leak. * * Once a thread has been cleaned up through this function, the SDL_Thread * that references it becomes invalid and should not be referenced again. * As such, only one thread may call SDL_WaitThread() on another. * * The return code for the thread function is placed in the area * pointed to by \c status, if \c status is not NULL. * * You may not wait on a thread that has been used in a call to * SDL_DetachThread(). Use either that function or this one, but not * both, or behavior is undefined. * * It is safe to pass NULL to this function; it is a no-op. */ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status); /** * A thread may be "detached" to signify that it should not remain until * another thread has called SDL_WaitThread() on it. Detaching a thread * is useful for long-running threads that nothing needs to synchronize * with or further manage. When a detached thread is done, it simply * goes away. * * There is no way to recover the return code of a detached thread. If you * need this, don't detach the thread and instead use SDL_WaitThread(). * * Once a thread is detached, you should usually assume the SDL_Thread isn't * safe to reference again, as it will become invalid immediately upon * the detached thread's exit, instead of remaining until someone has called * SDL_WaitThread() to finally clean it up. As such, don't detach the same * thread more than once. * * If a thread has already exited when passed to SDL_DetachThread(), it will * stop waiting for a call to SDL_WaitThread() and clean up immediately. * It is not safe to detach a thread that might be used with SDL_WaitThread(). * * You may not call SDL_WaitThread() on a thread that has been detached. * Use either that function or this one, but not both, or behavior is * undefined. * * It is safe to pass NULL to this function; it is a no-op. */ extern DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread * thread); /** * \brief Create an identifier that is globally visible to all threads but refers to data that is thread-specific. * * \return The newly created thread local storage identifier, or 0 on error * * \code * static SDL_SpinLock tls_lock; * static SDL_TLSID thread_local_storage; * * void SetMyThreadData(void *value) * { * if (!thread_local_storage) { * SDL_AtomicLock(&tls_lock); * if (!thread_local_storage) { * thread_local_storage = SDL_TLSCreate(); * } * SDL_AtomicUnlock(&tls_lock); * } * SDL_TLSSet(thread_local_storage, value, 0); * } * * void *GetMyThreadData(void) * { * return SDL_TLSGet(thread_local_storage); * } * \endcode * * \sa SDL_TLSGet() * \sa SDL_TLSSet() */ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void); /** * \brief Get the value associated with a thread local storage ID for the current thread. * * \param id The thread local storage ID * * \return The value associated with the ID for the current thread, or NULL if no value has been set. * * \sa SDL_TLSCreate() * \sa SDL_TLSSet() */ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); /** * \brief Set the value associated with a thread local storage ID for the current thread. * * \param id The thread local storage ID * \param value The value to associate with the ID for the current thread * \param destructor A function called when the thread exits, to free the value. * * \return 0 on success, -1 on error * * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_thread_h_ */ /* vi: set ts=4 sw=4 expandtab: */
10,851
C
34.119741
160
0.70869
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_loadso.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_loadso.h * * System dependent library loading routines * * Some things to keep in mind: * \li These functions only work on C function names. Other languages may * have name mangling and intrinsic language support that varies from * compiler to compiler. * \li Make sure you declare your function pointers with the same calling * convention as the actual library function. Your code will crash * mysteriously if you do not do this. * \li Avoid namespace collisions. If you load a symbol from the library, * it is not defined whether or not it goes into the global symbol * namespace for the application. If it does and it conflicts with * symbols in your code or other shared libraries, you will not get * the results you expect. :) */ #ifndef SDL_loadso_h_ #define SDL_loadso_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * This function dynamically loads a shared object and returns a pointer * to the object handle (or NULL if there was an error). * The 'sofile' parameter is a system dependent name of the object file. */ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile); /** * Given an object handle, this function looks up the address of the * named function in the shared object and returns it. This address * is no longer valid after calling SDL_UnloadObject(). */ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, const char *name); /** * Unload a shared object from memory. */ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_loadso_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,866
C
33.963414
76
0.713538
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_harness.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_harness.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* Defines types for test case definitions and the test execution harness API. Based on original GSOC code by Markus Kauppila <[email protected]> */ #ifndef SDL_test_h_arness_h #define SDL_test_h_arness_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* ! Definitions for test case structures */ #define TEST_ENABLED 1 #define TEST_DISABLED 0 /* ! Definition of all the possible test return values of the test case method */ #define TEST_ABORTED -1 #define TEST_STARTED 0 #define TEST_COMPLETED 1 #define TEST_SKIPPED 2 /* ! Definition of all the possible test results for the harness */ #define TEST_RESULT_PASSED 0 #define TEST_RESULT_FAILED 1 #define TEST_RESULT_NO_ASSERT 2 #define TEST_RESULT_SKIPPED 3 #define TEST_RESULT_SETUP_FAILURE 4 /* !< Function pointer to a test case setup function (run before every test) */ typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); /* !< Function pointer to a test case function */ typedef int (*SDLTest_TestCaseFp)(void *arg); /* !< Function pointer to a test case teardown function (run after every test) */ typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); /** * Holds information about a single test case. */ typedef struct SDLTest_TestCaseReference { /* !< Func2Stress */ SDLTest_TestCaseFp testCase; /* !< Short name (or function name) "Func2Stress" */ char *name; /* !< Long name or full description "This test pushes func2() to the limit." */ char *description; /* !< Set to TEST_ENABLED or TEST_DISABLED (test won't be run) */ int enabled; } SDLTest_TestCaseReference; /** * Holds information about a test suite (multiple test cases). */ typedef struct SDLTest_TestSuiteReference { /* !< "PlatformSuite" */ char *name; /* !< The function that is run before each test. NULL skips. */ SDLTest_TestCaseSetUpFp testSetUp; /* !< The test cases that are run as part of the suite. Last item should be NULL. */ const SDLTest_TestCaseReference **testCases; /* !< The function that is run after each test. NULL skips. */ SDLTest_TestCaseTearDownFp testTearDown; } SDLTest_TestSuiteReference; /** * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). * * Note: The returned string needs to be deallocated by the caller. * * \param length The length of the seed string to generate * * \returns The generated seed string */ char *SDLTest_GenerateRunSeed(const int length); /** * \brief Execute a test suite using the given run seed and execution key. * * \param testSuites Suites containing the test case. * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. * \param filter Filter specification. NULL disables. Case sensitive. * \param testIterations Number of iterations to run each test case. * * \returns Test run result; 0 when all tests passed, 1 if any tests failed. */ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_h_arness_h */ /* vi: set ts=4 sw=4 expandtab: */
4,612
C
33.17037
149
0.714224
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_log.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_log.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* * * Wrapper to log in the TEST category * */ #ifndef SDL_test_log_h_ #define SDL_test_log_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Prints given message with a timestamp in the TEST category and INFO priority. * * \param fmt Message to be logged */ void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); /** * \brief Prints given message with a timestamp in the TEST category and the ERROR priority. * * \param fmt Message to be logged */ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */
1,954
C
27.75
95
0.718526
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_assert.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_assert.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* * * Assert API for test code and test cases * */ #ifndef SDL_test_assert_h_ #define SDL_test_assert_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Fails the assert. */ #define ASSERT_FAIL 0 /** * \brief Passes the assert. */ #define ASSERT_PASS 1 /** * \brief Assert that logs and break execution flow on failures. * * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertDescription Message to log with the assert describing it. */ void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. * * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertDescription Message to log with the assert describing it. * * \returns Returns the assertCondition so it can be used to externally to break execution flow if desired. */ int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Explicitly pass without checking an assertion condition. Updates assertion counter. * * \param assertDescription Message to log with the assert describing it. */ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); /** * \brief Resets the assert summary counters to zero. */ void SDLTest_ResetAssertSummary(void); /** * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ void SDLTest_LogAssertSummary(void); /** * \brief Converts the current assert summary state to a test result. * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ int SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */
3,243
C
29.603773
132
0.730805
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_rect.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_rect.h * * Header file for SDL_rect definition and management functions. */ #ifndef SDL_rect_h_ #define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_pixels.h" #include "SDL_rwops.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The structure that defines a point * * \sa SDL_EnclosePoints * \sa SDL_PointInRect */ typedef struct SDL_Point { int x; int y; } SDL_Point; /** * \brief A rectangle, with the origin at the upper left. * * \sa SDL_RectEmpty * \sa SDL_RectEquals * \sa SDL_HasIntersection * \sa SDL_IntersectRect * \sa SDL_UnionRect * \sa SDL_EnclosePoints */ typedef struct SDL_Rect { int x, y; int w, h; } SDL_Rect; /** * \brief Returns true if point resides inside a rectangle. */ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) { return ( (p->x >= r->x) && (p->x < (r->x + r->w)) && (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; } /** * \brief Returns true if the rectangle has no area. */ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) { return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; } /** * \brief Returns true if the two rectangles are equal. */ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b) { return (a && b && (a->x == b->x) && (a->y == b->y) && (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; } /** * \brief Determine whether two rectangles intersect. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B); /** * \brief Calculate the intersection of two rectangles. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); /** * \brief Calculate the union of two rectangles. */ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A, const SDL_Rect * B, SDL_Rect * result); /** * \brief Calculate a minimal rectangle enclosing a set of points * * \return SDL_TRUE if any points were within the clipping rect */ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points, int count, const SDL_Rect * clip, SDL_Rect * result); /** * \brief Calculate the intersection of a rectangle and line segment. * * \return SDL_TRUE if there is an intersection, SDL_FALSE otherwise. */ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, int *Y2); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */
4,445
C
28.838926
80
0.586727
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_system.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_system.h * * Include file for platform specific SDL API functions */ #ifndef SDL_system_h_ #define SDL_system_h_ #include "SDL_stdinc.h" #include "SDL_keyboard.h" #include "SDL_render.h" #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Platform specific functions for Windows */ #ifdef __WIN32__ /** \brief Set a function that is called for every windows message, before TranslateMessage() */ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam); extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); /** \brief Returns the D3D9 adapter index that matches the specified display index. This adapter index can be passed to IDirect3D9::CreateDevice and controls on which monitor a full screen application will appear. */ extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex( int displayIndex ); typedef struct IDirect3DDevice9 IDirect3DDevice9; /** \brief Returns the D3D device associated with a renderer, or NULL if it's not a D3D renderer. Once you are done using the device, you should release it to avoid a resource leak. */ extern DECLSPEC IDirect3DDevice9* SDLCALL SDL_RenderGetD3D9Device(SDL_Renderer * renderer); /** \brief Returns the DXGI Adapter and Output indices for the specified display index. These can be passed to EnumAdapters and EnumOutputs respectively to get the objects required to create a DX10 or DX11 device and swap chain. */ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *adapterIndex, int *outputIndex ); #endif /* __WIN32__ */ /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam) extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled) extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); #endif /* __IPHONEOS__ */ /* Platform specific functions for Android */ #if defined(__ANDROID__) && __ANDROID__ /** \brief Get the JNI environment for the current thread This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application This returns jobject, but the prototype is void* so we don't need jni.h The jobject returned by SDL_AndroidGetActivity is a local reference. It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); /** \brief Return true if the application is running on Android TV */ extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); /** See the official Android developer guide for more information: http://developer.android.com/guide/topics/data/data-storage.html */ #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 /** \brief Get the path used for internal storage for this application. This path is unique to your application and cannot be written to by other applications. */ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: SDL_ANDROID_EXTERNAL_STORAGE_READ SDL_ANDROID_EXTERNAL_STORAGE_WRITE If external storage is currently unavailable, this will return 0. */ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. This path is unique to your application, but is public and can be written to by other applications. */ extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ /* Platform specific functions for WinRT */ #if defined(__WINRT__) && __WINRT__ /** * \brief WinRT / Windows Phone path types */ typedef enum { /** \brief The installed app's root directory. Files here are likely to be read-only. */ SDL_WINRT_PATH_INSTALLED_LOCATION, /** \brief The app's local data store. Files may be written here */ SDL_WINRT_PATH_LOCAL_FOLDER, /** \brief The app's roaming data store. Unsupported on Windows Phone. Files written here may be copied to other machines via a network connection. */ SDL_WINRT_PATH_ROAMING_FOLDER, /** \brief The app's temporary data store. Unsupported on Windows Phone. Files written here may be deleted at any time. */ SDL_WINRT_PATH_TEMP_FOLDER } SDL_WinRT_Path; /** * \brief WinRT Device Family */ typedef enum { /** \brief Unknown family */ SDL_WINRT_DEVICEFAMILY_UNKNOWN, /** \brief Desktop family*/ SDL_WINRT_DEVICEFAMILY_DESKTOP, /** \brief Mobile family (for example smartphone) */ SDL_WINRT_DEVICEFAMILY_MOBILE, /** \brief XBox family */ SDL_WINRT_DEVICEFAMILY_XBOX, } SDL_WinRT_DeviceFamily; /** * \brief Retrieves a WinRT defined path on the local file system * * \note Documentation on most app-specific path types on WinRT * can be found on MSDN, at the URL: * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * * \param pathType The type of path to retrieve. * \return A UCS-2 string (16-bit, wide-char) containing the path, or NULL * if the path is not available for any reason. Not all paths are * available on all versions of Windows. This is especially true on * Windows Phone. Check the documentation for the given * SDL_WinRT_Path for more information on which path types are * supported where. */ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType); /** * \brief Retrieves a WinRT defined path on the local file system * * \note Documentation on most app-specific path types on WinRT * can be found on MSDN, at the URL: * http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * * \param pathType The type of path to retrieve. * \return A UTF-8 string (8-bit, multi-byte) containing the path, or NULL * if the path is not available for any reason. Not all paths are * available on all versions of Windows. This is especially true on * Windows Phone. Check the documentation for the given * SDL_WinRT_Path for more information on which path types are * supported where. */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); /** * \brief Detects the device family of WinRT plattform on runtime * * \return Device family */ extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); #endif /* __WINRT__ */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_system_h_ */ /* vi: set ts=4 sw=4 expandtab: */
8,292
C
32.439516
152
0.729619
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_config.h
/* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ /* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_config_h_ #define SDL_config_h_ /** * \file SDL_config.h.in * * This is a set of defines to configure the SDL features */ /* General platform specific identifiers */ #include "SDL_platform.h" /* Make sure that this isn't included by Visual C++ */ #ifdef _MSC_VER #error You should run hg revert SDL_config.h #endif /* C language features */ /* #undef const */ /* #undef inline */ /* #undef volatile */ /* C datatypes */ #ifdef __LP64__ #define SIZEOF_VOIDP 8 #else #define SIZEOF_VOIDP 4 #endif #define HAVE_GCC_ATOMICS 1 /* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ /* Comment this if you want to build without any C library requirements */ #define HAVE_LIBC 1 #if HAVE_LIBC /* Useful headers */ #define STDC_HEADERS 1 #define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 #define HAVE_FLOAT_H 1 #define HAVE_ICONV_H 1 #define HAVE_INTTYPES_H 1 #define HAVE_LIMITS_H 1 #define HAVE_MALLOC_H 1 #define HAVE_MATH_H 1 #define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 #define HAVE_STDARG_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDIO_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_WCHAR_H 1 /* #undef HAVE_PTHREAD_NP_H */ /* #undef HAVE_LIBUNWIND_H */ /* C library functions */ #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 #define HAVE_FREE 1 #define HAVE_ALLOCA 1 #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ #define HAVE_GETENV 1 #define HAVE_SETENV 1 #define HAVE_PUTENV 1 #define HAVE_UNSETENV 1 #endif #define HAVE_QSORT 1 #define HAVE_ABS 1 #define HAVE_BCOPY 1 #define HAVE_MEMSET 1 #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 #define HAVE_WCSLEN 1 /* #undef HAVE_WCSLCPY */ /* #undef HAVE_WCSLCAT */ #define HAVE_WCSCMP 1 #define HAVE_STRLEN 1 /* #undef HAVE_STRLCPY */ /* #undef HAVE_STRLCAT */ /* #undef HAVE__STRREV */ /* #undef HAVE__STRUPR */ /* #undef HAVE__STRLWR */ /* #undef HAVE_INDEX */ /* #undef HAVE_RINDEX */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 /* #undef HAVE_ITOA */ /* #undef HAVE__LTOA */ /* #undef HAVE__UITOA */ /* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 /* #undef HAVE__I64TOA */ /* #undef HAVE__UI64TOA */ #define HAVE_STRTOLL 1 #define HAVE_STRTOULL 1 #define HAVE_STRTOD 1 #define HAVE_ATOI 1 #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 /* #undef HAVE__STRICMP */ #define HAVE_STRCASECMP 1 /* #undef HAVE__STRNICMP */ #define HAVE_STRNCASECMP 1 /* #undef HAVE_SSCANF */ #define HAVE_VSSCANF 1 /* #undef HAVE_SNPRINTF */ #define HAVE_VSNPRINTF 1 #define HAVE_M_PI /**/ #define HAVE_ACOS 1 #define HAVE_ACOSF 1 #define HAVE_ASIN 1 #define HAVE_ASINF 1 #define HAVE_ATAN 1 #define HAVE_ATANF 1 #define HAVE_ATAN2 1 #define HAVE_ATAN2F 1 #define HAVE_CEIL 1 #define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 #define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 #define HAVE_FABSF 1 #define HAVE_FLOOR 1 #define HAVE_FLOORF 1 #define HAVE_FMOD 1 #define HAVE_FMODF 1 #define HAVE_LOG 1 #define HAVE_LOGF 1 #define HAVE_LOG10 1 #define HAVE_LOG10F 1 #define HAVE_POW 1 #define HAVE_POWF 1 #define HAVE_SCALBN 1 #define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 #define HAVE_SQRTF 1 #define HAVE_TAN 1 #define HAVE_TANF 1 #define HAVE_FOPEN64 1 #define HAVE_FSEEKO 1 #define HAVE_FSEEKO64 1 #define HAVE_SIGACTION 1 #define HAVE_SA_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 /* #undef HAVE_SYSCTLBYNAME */ #define HAVE_CLOCK_GETTIME 1 /* #undef HAVE_GETPAGESIZE */ #define HAVE_MPROTECT 1 #define HAVE_ICONV 1 #define HAVE_PTHREAD_SETNAME_NP 1 /* #undef HAVE_PTHREAD_SET_NAME_NP */ #define HAVE_SEM_TIMEDWAIT 1 #define HAVE_GETAUXVAL 1 #define HAVE_POLL 1 #else #define HAVE_STDARG_H 1 #define HAVE_STDDEF_H 1 #define HAVE_STDINT_H 1 #endif /* HAVE_LIBC */ /* #undef HAVE_ALTIVEC_H */ #define HAVE_DBUS_DBUS_H 1 #define HAVE_FCITX_FRONTEND_H 1 #define HAVE_IBUS_IBUS_H 1 #define HAVE_IMMINTRIN_H 1 #define HAVE_LIBSAMPLERATE_H 1 #define HAVE_LIBUDEV_H 1 /* #undef HAVE_DDRAW_H */ /* #undef HAVE_DINPUT_H */ /* #undef HAVE_DSOUND_H */ /* #undef HAVE_DXGI_H */ /* #undef HAVE_XINPUT_H */ /* #undef HAVE_XINPUT_GAMEPAD_EX */ /* #undef HAVE_XINPUT_STATE_EX */ /* SDL internal assertion support */ /* #undef SDL_DEFAULT_ASSERT_LEVEL */ /* Allow disabling of core subsystems */ /* #undef SDL_ATOMIC_DISABLED */ /* #undef SDL_AUDIO_DISABLED */ /* #undef SDL_CPUINFO_DISABLED */ /* #undef SDL_EVENTS_DISABLED */ /* #undef SDL_FILE_DISABLED */ /* #undef SDL_JOYSTICK_DISABLED */ /* #undef SDL_HAPTIC_DISABLED */ /* #undef SDL_LOADSO_DISABLED */ /* #undef SDL_RENDER_DISABLED */ /* #undef SDL_THREADS_DISABLED */ /* #undef SDL_TIMERS_DISABLED */ /* #undef SDL_VIDEO_DISABLED */ /* #undef SDL_POWER_DISABLED */ /* #undef SDL_FILESYSTEM_DISABLED */ /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_ALSA 1 /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_ANDROID */ /* #undef SDL_AUDIO_DRIVER_ARTS */ /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_COREAUDIO */ #define SDL_AUDIO_DRIVER_DISK 1 /* #undef SDL_AUDIO_DRIVER_DSOUND */ #define SDL_AUDIO_DRIVER_DUMMY 1 /* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */ /* #undef SDL_AUDIO_DRIVER_ESD */ /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_HAIKU */ /* #undef SDL_AUDIO_DRIVER_JACK */ /* #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_NACL */ /* #undef SDL_AUDIO_DRIVER_NAS */ /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_NETBSD */ #define SDL_AUDIO_DRIVER_OSS 1 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ /* #undef SDL_AUDIO_DRIVER_PAUDIO */ #define SDL_AUDIO_DRIVER_PULSEAUDIO 1 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_QSA */ #define SDL_AUDIO_DRIVER_SNDIO 1 /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ /* #undef SDL_AUDIO_DRIVER_WASAPI */ /* #undef SDL_AUDIO_DRIVER_WINMM */ /* Enable various input drivers */ #define SDL_INPUT_LINUXEV 1 #define SDL_INPUT_LINUXKD 1 /* #undef SDL_INPUT_TSLIB */ /* #undef SDL_JOYSTICK_HAIKU */ /* #undef SDL_JOYSTICK_DINPUT */ /* #undef SDL_JOYSTICK_XINPUT */ /* #undef SDL_JOYSTICK_DUMMY */ /* #undef SDL_JOYSTICK_IOKIT */ #define SDL_JOYSTICK_LINUX 1 /* #undef SDL_JOYSTICK_ANDROID */ /* #undef SDL_JOYSTICK_WINMM */ /* #undef SDL_JOYSTICK_USBHID */ /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ /* #undef SDL_JOYSTICK_EMSCRIPTEN */ /* #undef SDL_HAPTIC_DUMMY */ /* #undef SDL_HAPTIC_ANDROID */ #define SDL_HAPTIC_LINUX 1 /* #undef SDL_HAPTIC_IOKIT */ /* #undef SDL_HAPTIC_DINPUT */ /* #undef SDL_HAPTIC_XINPUT */ /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 /* #undef SDL_LOADSO_DUMMY */ /* #undef SDL_LOADSO_LDG */ /* #undef SDL_LOADSO_WINDOWS */ /* Enable various threading systems */ #define SDL_THREAD_PTHREAD 1 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ /* #undef SDL_THREAD_WINDOWS */ /* Enable various timer systems */ /* #undef SDL_TIMER_HAIKU */ /* #undef SDL_TIMER_DUMMY */ #define SDL_TIMER_UNIX 1 /* #undef SDL_TIMER_WINDOWS */ /* Enable various video drivers */ /* #undef SDL_VIDEO_DRIVER_HAIKU */ /* #undef SDL_VIDEO_DRIVER_COCOA */ /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ #define SDL_VIDEO_DRIVER_DUMMY 1 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ #define SDL_VIDEO_DRIVER_WAYLAND 1 #define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ #define SDL_VIDEO_DRIVER_MIR 1 #define SDL_VIDEO_DRIVER_MIR_DYNAMIC "libmirclient.so.9" #define SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON "libxkbcommon.so.0" #define SDL_VIDEO_DRIVER_X11 1 /* #undef SDL_VIDEO_DRIVER_RPI */ /* #undef SDL_VIDEO_DRIVER_KMSDRM */ /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */ /* #undef SDL_VIDEO_DRIVER_ANDROID */ /* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */ /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE */ #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 #define SDL_VIDEO_DRIVER_X11_XDBE 1 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 #define SDL_VIDEO_DRIVER_X11_XINPUT2 1 #define SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1 #define SDL_VIDEO_DRIVER_X11_XRANDR 1 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 #define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 /* #undef SDL_VIDEO_DRIVER_NACL */ /* #undef SDL_VIDEO_DRIVER_VIVANTE */ /* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */ /* #undef SDL_VIDEO_DRIVER_QNX */ /* #undef SDL_VIDEO_RENDER_D3D */ /* #undef SDL_VIDEO_RENDER_D3D11 */ #define SDL_VIDEO_RENDER_OGL 1 /* #undef SDL_VIDEO_RENDER_OGL_ES */ #define SDL_VIDEO_RENDER_OGL_ES2 1 /* #undef SDL_VIDEO_RENDER_DIRECTFB */ /* #undef SDL_VIDEO_RENDER_METAL */ /* Enable OpenGL support */ #define SDL_VIDEO_OPENGL 1 /* #undef SDL_VIDEO_OPENGL_ES */ #define SDL_VIDEO_OPENGL_ES2 1 /* #undef SDL_VIDEO_OPENGL_BGL */ /* #undef SDL_VIDEO_OPENGL_CGL */ #define SDL_VIDEO_OPENGL_EGL 1 #define SDL_VIDEO_OPENGL_GLX 1 /* #undef SDL_VIDEO_OPENGL_WGL */ /* #undef SDL_VIDEO_OPENGL_OSMESA */ /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ /* Enable Vulkan support */ #define SDL_VIDEO_VULKAN 1 /* Enable system power support */ #define SDL_POWER_LINUX 1 /* #undef SDL_POWER_WINDOWS */ /* #undef SDL_POWER_MACOSX */ /* #undef SDL_POWER_HAIKU */ /* #undef SDL_POWER_ANDROID */ /* #undef SDL_POWER_EMSCRIPTEN */ /* #undef SDL_POWER_HARDWIRED */ /* Enable system filesystem support */ /* #undef SDL_FILESYSTEM_HAIKU */ /* #undef SDL_FILESYSTEM_COCOA */ /* #undef SDL_FILESYSTEM_DUMMY */ #define SDL_FILESYSTEM_UNIX 1 /* #undef SDL_FILESYSTEM_WINDOWS */ /* #undef SDL_FILESYSTEM_NACL */ /* #undef SDL_FILESYSTEM_ANDROID */ /* #undef SDL_FILESYSTEM_EMSCRIPTEN */ /* Enable assembly routines */ #define SDL_ASSEMBLY_ROUTINES 1 /* #undef SDL_ALTIVEC_BLITTERS */ /* Enable ime support */ #define SDL_USE_IME 1 /* Enable dynamic udev support */ #define SDL_UDEV_DYNAMIC "libudev.so.1" /* Enable dynamic libsamplerate support */ #define SDL_LIBSAMPLERATE_DYNAMIC "libsamplerate.so.0" #endif /* SDL_config_h_ */
12,015
C
28.23601
76
0.716271
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_random.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_random.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* A "32-bit Multiply with carry random number generator. Very fast. Includes a list of recommended multipliers. multiply-with-carry generator: x(n) = a*x(n-1) + carry mod 2^32. period: (a*2^31)-1 */ #ifndef SDL_test_random_h_ #define SDL_test_random_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* --- Definitions */ /* * Macros that return a random number in a specific format. */ #define SDLTest_RandomInt(c) ((int)SDLTest_Random(c)) /* * Context structure for the random number generator state. */ typedef struct { unsigned int a; unsigned int x; unsigned int c; unsigned int ah; unsigned int al; } SDLTest_RandomContext; /* --- Function prototypes */ /** * \brief Initialize random number generator with two integers. * * Note: The random sequence of numbers returned by ...Random() is the * same for the same two integers and has a period of 2^31. * * \param rndContext pointer to context structure * \param xi integer that defines the random sequence * \param ci integer that defines the random sequence * */ void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, unsigned int ci); /** * \brief Initialize random number generator based on current system time. * * \param rndContext pointer to context structure * */ void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); /** * \brief Initialize random number generator based on current system time. * * Note: ...RandomInit() or ...RandomInitTime() must have been called * before using this function. * * \param rndContext pointer to context structure * * \returns A random number (32bit unsigned integer) * */ unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_random_h_ */ /* vi: set ts=4 sw=4 expandtab: */
3,156
C
26.215517
77
0.704373
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_md5.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_md5.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* *********************************************************************** ** Header file for implementation of MD5 ** ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** ** Created: 2/17/90 RLR ** ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** ** Revised (for MD5): RLR 4/27/91 ** ** -- G modified to have y&~z instead of y&z ** ** -- FF, GG, HH modified to add in last register done ** ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** ** -- distinct additive constant for each step ** ** -- round 4 added, working mod 7 ** *********************************************************************** */ /* *********************************************************************** ** Message-digest routines: ** ** To form the message digest for a message M ** ** (1) Initialize a context buffer mdContext using MD5Init ** ** (2) Call MD5Update on mdContext and M ** ** (3) Call MD5Final on mdContext ** ** The message digest is now in mdContext->digest[0...15] ** *********************************************************************** */ #ifndef SDL_test_md5_h_ #define SDL_test_md5_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* ------------ Definitions --------- */ /* typedef a 32-bit type */ typedef unsigned long int MD5UINT4; /* Data structure for MD5 (Message-Digest) computation */ typedef struct { MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ MD5UINT4 buf[4]; /* scratch buffer */ unsigned char in[64]; /* input buffer */ unsigned char digest[16]; /* actual digest after Md5Final call */ } SDLTest_Md5Context; /* ---------- Function Prototypes ------------- */ /** * \brief initialize the context * * \param mdContext pointer to context variable * * Note: The function initializes the message-digest context * mdContext. Call before each new use of the context - * all fields are set to zero. */ void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); /** * \brief update digest from variable length data * * \param mdContext pointer to context variable * \param inBuf pointer to data array/string * \param inLen length of data array/string * * Note: The function updates the message-digest context to account * for the presence of each of the characters inBuf[0..inLen-1] * in the message whose digest is being computed. */ void SDLTest_Md5Update(SDLTest_Md5Context * mdContext, unsigned char *inBuf, unsigned int inLen); /** * \brief complete digest computation * * \param mdContext pointer to context variable * * Note: The function terminates the message-digest computation and * ends with the desired message digest in mdContext.digest[0..15]. * Always call before using the digest[] variable. */ void SDLTest_Md5Final(SDLTest_Md5Context * mdContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_md5_h_ */ /* vi: set ts=4 sw=4 expandtab: */
4,630
C
34.623077
77
0.578186
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_opengles.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_opengles.h * * This is a simple file to encapsulate the OpenGL ES 1.X API headers. */ #include "SDL_config.h" #ifdef __IPHONEOS__ #include <OpenGLES/ES1/gl.h> #include <OpenGLES/ES1/glext.h> #else #include <GLES/gl.h> #include <GLES/glext.h> #endif #ifndef APIENTRY #define APIENTRY #endif
1,254
C
30.374999
76
0.746411
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_log.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_log.h * * Simple log messages with categories and priorities. * * By default logs are quiet, but if you're debugging SDL you might want: * * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); * * Here's where the messages go on different platforms: * Windows: debug output stream * Android: log output * Others: standard error output (stderr) */ #ifndef SDL_log_h_ #define SDL_log_h_ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The maximum size of a log message * * Messages longer than the maximum size will be truncated */ #define SDL_MAX_LOG_MESSAGE 4096 /** * \brief The predefined log categories * * By default the application category is enabled at the INFO level, * the assert category is enabled at the WARN level, test is enabled * at the VERBOSE level and all other categories are enabled at the * CRITICAL level. */ enum { SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_ASSERT, SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_CATEGORY_AUDIO, SDL_LOG_CATEGORY_VIDEO, SDL_LOG_CATEGORY_RENDER, SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_TEST, /* Reserved for future SDL library use */ SDL_LOG_CATEGORY_RESERVED1, SDL_LOG_CATEGORY_RESERVED2, SDL_LOG_CATEGORY_RESERVED3, SDL_LOG_CATEGORY_RESERVED4, SDL_LOG_CATEGORY_RESERVED5, SDL_LOG_CATEGORY_RESERVED6, SDL_LOG_CATEGORY_RESERVED7, SDL_LOG_CATEGORY_RESERVED8, SDL_LOG_CATEGORY_RESERVED9, SDL_LOG_CATEGORY_RESERVED10, /* Beyond this point is reserved for application use, e.g. enum { MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM, MYAPP_CATEGORY_AWESOME2, MYAPP_CATEGORY_AWESOME3, ... }; */ SDL_LOG_CATEGORY_CUSTOM }; /** * \brief The predefined log priorities */ typedef enum { SDL_LOG_PRIORITY_VERBOSE = 1, SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_INFO, SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_CRITICAL, SDL_NUM_LOG_PRIORITIES } SDL_LogPriority; /** * \brief Set the priority of all log categories */ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority); /** * \brief Set the priority of a particular log category */ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category, SDL_LogPriority priority); /** * \brief Get the priority of a particular log category */ extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category); /** * \brief Reset all priorities to default. * * \note This is called in SDL_Quit(). */ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void); /** * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO */ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); /** * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE */ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with SDL_LOG_PRIORITY_DEBUG */ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with SDL_LOG_PRIORITY_INFO */ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with SDL_LOG_PRIORITY_WARN */ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with SDL_LOG_PRIORITY_ERROR */ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL */ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /** * \brief Log a message with the specified category and priority. */ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(3); /** * \brief Log a message with the specified category and priority. */ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list ap); /** * \brief The prototype for the log output function */ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. */ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata); /** * \brief This function allows you to replace the default log output * function with one of your own. */ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */
6,491
C
29.622641
132
0.690032
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_audio.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_audio.h * * Access to the raw audio mixing buffer for the SDL library. */ #ifndef SDL_audio_h_ #define SDL_audio_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_endian.h" #include "SDL_mutex.h" #include "SDL_thread.h" #include "SDL_rwops.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Audio format flags. * * These are what the 16 bits in SDL_AudioFormat currently mean... * (Unspecified bits are always zero). * * \verbatim ++-----------------------sample is signed if set || || ++-----------sample is bigendian if set || || || || ++---sample is float if set || || || || || || +---sample bit size---+ || || || | | 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 \endverbatim * * There are macros in SDL 2.0 and later to query these bits. */ typedef Uint16 SDL_AudioFormat; /** * \name Audio flags */ /* @{ */ #define SDL_AUDIO_MASK_BITSIZE (0xFF) #define SDL_AUDIO_MASK_DATATYPE (1<<8) #define SDL_AUDIO_MASK_ENDIAN (1<<12) #define SDL_AUDIO_MASK_SIGNED (1<<15) #define SDL_AUDIO_BITSIZE(x) (x & SDL_AUDIO_MASK_BITSIZE) #define SDL_AUDIO_ISFLOAT(x) (x & SDL_AUDIO_MASK_DATATYPE) #define SDL_AUDIO_ISBIGENDIAN(x) (x & SDL_AUDIO_MASK_ENDIAN) #define SDL_AUDIO_ISSIGNED(x) (x & SDL_AUDIO_MASK_SIGNED) #define SDL_AUDIO_ISINT(x) (!SDL_AUDIO_ISFLOAT(x)) #define SDL_AUDIO_ISLITTLEENDIAN(x) (!SDL_AUDIO_ISBIGENDIAN(x)) #define SDL_AUDIO_ISUNSIGNED(x) (!SDL_AUDIO_ISSIGNED(x)) /** * \name Audio format flags * * Defaults to LSB byte order. */ /* @{ */ #define AUDIO_U8 0x0008 /**< Unsigned 8-bit samples */ #define AUDIO_S8 0x8008 /**< Signed 8-bit samples */ #define AUDIO_U16LSB 0x0010 /**< Unsigned 16-bit samples */ #define AUDIO_S16LSB 0x8010 /**< Signed 16-bit samples */ #define AUDIO_U16MSB 0x1010 /**< As above, but big-endian byte order */ #define AUDIO_S16MSB 0x9010 /**< As above, but big-endian byte order */ #define AUDIO_U16 AUDIO_U16LSB #define AUDIO_S16 AUDIO_S16LSB /* @} */ /** * \name int32 support */ /* @{ */ #define AUDIO_S32LSB 0x8020 /**< 32-bit integer samples */ #define AUDIO_S32MSB 0x9020 /**< As above, but big-endian byte order */ #define AUDIO_S32 AUDIO_S32LSB /* @} */ /** * \name float32 support */ /* @{ */ #define AUDIO_F32LSB 0x8120 /**< 32-bit floating point samples */ #define AUDIO_F32MSB 0x9120 /**< As above, but big-endian byte order */ #define AUDIO_F32 AUDIO_F32LSB /* @} */ /** * \name Native audio byte ordering */ /* @{ */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define AUDIO_U16SYS AUDIO_U16LSB #define AUDIO_S16SYS AUDIO_S16LSB #define AUDIO_S32SYS AUDIO_S32LSB #define AUDIO_F32SYS AUDIO_F32LSB #else #define AUDIO_U16SYS AUDIO_U16MSB #define AUDIO_S16SYS AUDIO_S16MSB #define AUDIO_S32SYS AUDIO_S32MSB #define AUDIO_F32SYS AUDIO_F32MSB #endif /* @} */ /** * \name Allow change flags * * Which audio format changes are allowed when opening a device. */ /* @{ */ #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 #define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) /* @} */ /* @} *//* Audio flags */ /** * This function is called when the audio device needs more data. * * \param userdata An application-specific parameter saved in * the SDL_AudioSpec structure * \param stream A pointer to the audio data buffer. * \param len The length of that buffer in bytes. * * Once the callback returns, the buffer will no longer be valid. * Stereo samples are stored in a LRLRLR ordering. * * You can choose to avoid callbacks and use SDL_QueueAudio() instead, if * you like. Just open your audio device with a NULL callback. */ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, int len); /** * The calculated values in this structure are calculated by SDL_OpenAudio(). * * For multi-channel audio, the default SDL channel mapping is: * 2: FL FR (stereo) * 3: FL FR LFE (2.1 surround) * 4: FL FR BL BR (quad) * 5: FL FR FC BL BR (quad + center) * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) * 7: FL FR FC LFE BC SL SR (6.1 surround) * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { int freq; /**< DSP frequency -- samples per second */ SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ void *userdata; /**< Userdata passed to callback (ignored for NULL callbacks). */ } SDL_AudioSpec; struct SDL_AudioCVT; typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** * \brief Upper limit of filters in SDL_AudioCVT * * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, * one of which is the terminating NULL pointer. */ #define SDL_AUDIOCVT_MAX_FILTERS 9 /** * \struct SDL_AudioCVT * \brief A structure to hold a set of audio conversion filters and buffers. * * Note that various parts of the conversion pipeline can take advantage * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require * you to pass it aligned data, but can possibly run much faster if you * set both its (buf) field to a pointer that is aligned to 16 bytes, and its * (len) field to something that's a multiple of 16, if possible. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't pad it out to 88 bytes to guarantee ABI compatibility between compilers. vvv The next time we rev the ABI, make sure to size the ints and add padding. */ #define SDL_AUDIOCVT_PACKED __attribute__((packed)) #else #define SDL_AUDIOCVT_PACKED #endif /* */ typedef struct SDL_AudioCVT { int needed; /**< Set to 1 if conversion possible */ SDL_AudioFormat src_format; /**< Source audio format */ SDL_AudioFormat dst_format; /**< Target audio format */ double rate_incr; /**< Rate conversion increment */ Uint8 *buf; /**< Buffer to hold entire audio data */ int len; /**< Length of original audio buffer */ int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; /* Function prototypes */ /** * \name Driver discovery functions * * These functions return the list of built in audio drivers, in the * order that they are normally initialized by default. */ /* @{ */ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void); extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index); /* @} */ /** * \name Initialization and cleanup * * \internal These functions are used internally, and should not be used unless * you have a specific need to specify the audio driver you want to * use. You should normally use SDL_Init() or SDL_InitSubSystem(). */ /* @{ */ extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name); extern DECLSPEC void SDLCALL SDL_AudioQuit(void); /* @} */ /** * This function returns the name of the current audio driver, or NULL * if no driver has been initialized. */ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); /** * This function opens the audio device with the desired parameters, and * returns 0 if successful, placing the actual hardware parameters in the * structure pointed to by \c obtained. If \c obtained is NULL, the audio * data passed to the callback function will be guaranteed to be in the * requested format, and will be automatically converted to the hardware * audio format if necessary. This function returns -1 if it failed * to open the audio device, or couldn't set up the audio thread. * * When filling in the desired audio spec structure, * - \c desired->freq should be the desired audio frequency in samples-per- * second. * - \c desired->format should be the desired audio format. * - \c desired->samples is the desired size of the audio buffer, in * samples. This number should be a power of two, and may be adjusted by * the audio driver to a value more suitable for the hardware. Good values * seem to range between 512 and 8096 inclusive, depending on the * application and CPU speed. Smaller values yield faster response time, * but can lead to underflow if the application is doing heavy processing * and cannot fill the audio buffer in time. A stereo sample consists of * both right and left channels in LR ordering. * Note that the number of samples is directly related to time by the * following formula: \code ms = (samples*1000)/freq \endcode * - \c desired->size is the size in bytes of the audio buffer, and is * calculated by SDL_OpenAudio(). * - \c desired->silence is the value used to set the buffer to silence, * and is calculated by SDL_OpenAudio(). * - \c desired->callback should be set to a function that will be called * when the audio device is ready for more data. It is passed a pointer * to the audio buffer, and the length in bytes of the audio buffer. * This function usually runs in a separate thread, and so you should * protect data structures that it accesses by calling SDL_LockAudio() * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL * pointer here, and call SDL_QueueAudio() with some frequency, to queue * more audio samples to be played (or for capture devices, call * SDL_DequeueAudio() with some frequency, to obtain audio samples). * - \c desired->userdata is passed as the first parameter to your callback * function. If you passed a NULL callback, this value is ignored. * * The audio device starts out playing silence when it's opened, and should * be enabled for playing by calling \c SDL_PauseAudio(0) when you are ready * for your audio callback function to be called. Since the audio driver * may modify the requested size of the audio buffer, you should allocate * any local mixing buffers after you open the audio device. */ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained); /** * SDL Audio Device IDs. * * A successful call to SDL_OpenAudio() is always device id 1, and legacy * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls * always returns devices >= 2 on success. The legacy calls are good both * for backwards compatibility and when you don't care about multiple, * specific, or capture devices. */ typedef Uint32 SDL_AudioDeviceID; /** * Get the number of available devices exposed by the current driver. * Only valid after a successfully initializing the audio subsystem. * Returns -1 if an explicit list of devices can't be determined; this is * not an error. For example, if SDL is set up to talk to a remote audio * server, it can't list every one available on the Internet, but it will * still allow a specific host to be specified to SDL_OpenAudioDevice(). * * In many common cases, when this function returns a value <= 0, it can still * successfully open the default device (NULL for first argument of * SDL_OpenAudioDevice()). */ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture); /** * Get the human-readable name of a specific audio device. * Must be a value between 0 and (number of audio devices-1). * Only valid after a successfully initializing the audio subsystem. * The values returned by this function reflect the latest call to * SDL_GetNumAudioDevices(); recall that function to redetect available * hardware. * * The string returned by this function is UTF-8 encoded, read-only, and * managed internally. You are not to free it. If you need to keep the * string for any length of time, you should make your own copy of it, as it * will be invalid next time any of several other SDL functions is called. */ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index, int iscapture); /** * Open a specific audio device. Passing in a device name of NULL requests * the most reasonable default (and is equivalent to calling SDL_OpenAudio()). * * The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but * some drivers allow arbitrary and driver-specific strings, such as a * hostname/IP address for a remote audio server, or a filename in the * diskaudio driver. * * \return 0 on error, a valid device ID that is >= 2 on success. * * SDL_OpenAudio(), unlike this function, always acts on device ID 1. */ extern DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(const char *device, int iscapture, const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, int allowed_changes); /** * \name Audio state * * Get the current audio state. */ /* @{ */ typedef enum { SDL_AUDIO_STOPPED = 0, SDL_AUDIO_PLAYING, SDL_AUDIO_PAUSED } SDL_AudioStatus; extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void); extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDeviceID dev); /* @} *//* Audio State */ /** * \name Pause audio functions * * These functions pause and unpause the audio callback processing. * They should be called with a parameter of 0 after opening the audio * device to start playing sound. This is so you can safely initialize * data for your callback function after opening the audio device. * Silence will be written to the audio device during the pause. */ /* @{ */ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on); extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev, int pause_on); /* @} *//* Pause audio functions */ /** * This function loads a WAVE from the data source, automatically freeing * that source if \c freesrc is non-zero. For example, to load a WAVE file, * you could do: * \code * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); * \endcode * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets * \c *audio_buf to a malloc()'d buffer containing the audio data, * and sets \c *audio_len to the length of that audio buffer, in bytes. * You need to free the audio buffer with SDL_FreeWAV() when you are * done with it. * * This function returns NULL and sets the SDL error message if the * wave file cannot be opened, uses an unknown data format, or is * corrupt. Currently raw and MS-ADPCM WAVE files are supported. */ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len); /** * Loads a WAV from a file. * Compatibility convenience function. */ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) /** * This function frees data previously allocated with SDL_LoadWAV_RW() */ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); /** * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format * to the other. An unsupported format causes an error and -1 will be returned. * * \return 0 if no conversion is needed, 1 if the audio filter is set up, * or -1 on error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_format, Uint8 dst_channels, int dst_rate); /** * Once you have initialized the \c cvt structure using SDL_BuildAudioCVT(), * created an audio buffer \c cvt->buf, and filled it with \c cvt->len bytes of * audio data in the source format, this function will convert it in-place * to the desired format. * * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. * * \return 0 on success or -1 if \c cvt->buf is NULL. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); /* SDL_AudioStream is a new audio conversion interface. The benefits vs SDL_AudioCVT: - it can handle resampling data in chunks without generating artifacts, when it doesn't have the complete buffer available. - it can handle incoming data in any variable size. - You push data as you have it, and pull it when you need it */ /* this is opaque to the outside world. */ struct _SDL_AudioStream; typedef struct _SDL_AudioStream SDL_AudioStream; /** * Create a new audio stream * * \param src_format The format of the source audio * \param src_channels The number of channels of the source audio * \param src_rate The sampling rate of the source audio * \param dst_format The format of the desired audio output * \param dst_channels The number of channels of the desired audio output * \param dst_rate The sampling rate of the desired audio output * \return 0 on success, or -1 on error. * * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream */ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, const Uint8 src_channels, const int src_rate, const SDL_AudioFormat dst_format, const Uint8 dst_channels, const int dst_rate); /** * Add data to be converted/resampled to the stream * * \param stream The stream the audio data is being added to * \param buf A pointer to the audio data to add * \param len The number of bytes to write to the stream * \return 0 on success, or -1 on error. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream */ extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); /** * Get converted/resampled data from the stream * * \param stream The stream the audio is being requested from * \param buf A buffer to fill with audio data * \param len The maximum number of bytes to fill * \return The number of bytes read from the stream, or -1 on error * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream */ extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); /** * Get the number of converted/resampled bytes available. The stream may be * buffering data behind the scenes until it has enough to resample * correctly, so this number might be lower than what you expect, or even * be zero. Add more data or flush the stream if you need the data now. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream */ extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); /** * Tell the stream that you're done sending data, and anything being buffered * should be converted/resampled and made available immediately. * * It is legal to add more data to a stream after flushing, but there will * be audio gaps in the output. Generally this is intended to signal the * end of input, so the complete output becomes available. * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamClear * \sa SDL_FreeAudioStream */ extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); /** * Clear any pending data in the stream without converting it * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamFlush * \sa SDL_FreeAudioStream */ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); /** * Free an audio stream * * \sa SDL_NewAudioStream * \sa SDL_AudioStreamPut * \sa SDL_AudioStreamGet * \sa SDL_AudioStreamAvailable * \sa SDL_AudioStreamFlush * \sa SDL_AudioStreamClear */ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes * them, performing addition, volume adjustment, and overflow clipping. * The volume ranges from 0 - 128, and should be set to ::SDL_MIX_MAXVOLUME * for full audio volume. Note this does not change hardware volume. * This is provided for convenience -- you can mix your own audio data. */ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume); /** * This works like SDL_MixAudio(), but you specify the audio format instead of * using the format of audio device 1. Thus it can be used when no audio * device is open at all. */ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format, Uint32 len, int volume); /** * Queue more audio on non-callback devices. * * (If you are looking to retrieve queued audio from a non-callback capture * device, you want SDL_DequeueAudio() instead. This will return -1 to * signify an error if you use it with capture devices.) * * SDL offers two ways to feed audio to the device: you can either supply a * callback that SDL triggers with some frequency to obtain more audio * (pull method), or you can supply no callback, and then SDL will expect * you to supply data at regular intervals (push method) with this function. * * There are no limits on the amount of data you can queue, short of * exhaustion of address space. Queued data will drain to the device as * necessary without further intervention from you. If the device needs * audio but there is not enough queued, it will play silence to make up * the difference. This means you will have skips in your audio playback * if you aren't routinely queueing sufficient data. * * This function copies the supplied data, so you are safe to free it when * the function returns. This function is thread-safe, but queueing to the * same device from two threads at once does not promise which buffer will * be queued first. * * You may not queue audio on a device that is using an application-supplied * callback; doing so returns an error. You have to use the audio callback * or queue audio with this function, but not both. * * You should not call SDL_LockAudio() on the device before queueing; SDL * handles locking internally for this function. * * \param dev The device ID to which we will queue audio. * \param data The data to queue to the device for later playback. * \param len The number of bytes (not samples!) to which (data) points. * \return 0 on success, or -1 on error. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio */ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); /** * Dequeue more audio on non-callback devices. * * (If you are looking to queue audio for output on a non-callback playback * device, you want SDL_QueueAudio() instead. This will always return 0 * if you use it with playback devices.) * * SDL offers two ways to retrieve audio from a capture device: you can * either supply a callback that SDL triggers with some frequency as the * device records more audio data, (push method), or you can supply no * callback, and then SDL will expect you to retrieve data at regular * intervals (pull method) with this function. * * There are no limits on the amount of data you can queue, short of * exhaustion of address space. Data from the device will keep queuing as * necessary without further intervention from you. This means you will * eventually run out of memory if you aren't routinely dequeueing data. * * Capture devices will not queue data when paused; if you are expecting * to not need captured audio for some length of time, use * SDL_PauseAudioDevice() to stop the capture device from queueing more * data. This can be useful during, say, level loading times. When * unpaused, capture devices will start queueing data from that point, * having flushed any capturable data available while paused. * * This function is thread-safe, but dequeueing from the same device from * two threads at once does not promise which thread will dequeued data * first. * * You may not dequeue audio from a device that is using an * application-supplied callback; doing so returns an error. You have to use * the audio callback, or dequeue audio with this function, but not both. * * You should not call SDL_LockAudio() on the device before queueing; SDL * handles locking internally for this function. * * \param dev The device ID from which we will dequeue audio. * \param data A pointer into where audio data should be copied. * \param len The number of bytes (not samples!) to which (data) points. * \return number of bytes dequeued, which could be less than requested. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio */ extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); /** * Get the number of bytes of still-queued audio. * * For playback device: * * This is the number of bytes that have been queued for playback with * SDL_QueueAudio(), but have not yet been sent to the hardware. This * number may shrink at any time, so this only informs of pending data. * * Once we've sent it to the hardware, this function can not decide the * exact byte boundary of what has been played. It's possible that we just * gave the hardware several kilobytes right before you called this * function, but it hasn't played any of it yet, or maybe half of it, etc. * * For capture devices: * * This is the number of bytes that have been captured by the device and * are waiting for you to dequeue. This number may grow at any time, so * this only informs of the lower-bound of available data. * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device always returns 0. * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before querying; SDL * handles locking internally for this function. * * \param dev The device ID of which we will query queued audio size. * \return Number of bytes (not samples!) of queued audio. * * \sa SDL_QueueAudio * \sa SDL_ClearQueuedAudio */ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); /** * Drop any queued audio data. For playback devices, this is any queued data * still waiting to be submitted to the hardware. For capture devices, this * is any data that was queued by the device that hasn't yet been dequeued by * the application. * * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For * playback devices, the hardware will start playing silence if more audio * isn't queued. Unpaused capture devices will start filling the queue again * as soon as they have more data available (which, depending on the state * of the hardware and the thread, could be before this function call * returns!). * * This will not prevent playback of queued audio that's already been sent * to the hardware, as we can not undo that, so expect there to be some * fraction of a second of audio that might still be heard. This can be * useful if you want to, say, drop any pending music during a level change * in your game. * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device is always a no-op. * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before clearing the * queue; SDL handles locking internally for this function. * * This function always succeeds and thus returns void. * * \param dev The device ID of which to clear the audio queue. * * \sa SDL_QueueAudio * \sa SDL_GetQueuedAudioSize */ extern DECLSPEC void SDLCALL SDL_ClearQueuedAudio(SDL_AudioDeviceID dev); /** * \name Audio lock functions * * The lock manipulated by these functions protects the callback function. * During a SDL_LockAudio()/SDL_UnlockAudio() pair, you can be guaranteed that * the callback function is not running. Do not call these from the callback * function or you will cause deadlock. */ /* @{ */ extern DECLSPEC void SDLCALL SDL_LockAudio(void); extern DECLSPEC void SDLCALL SDL_LockAudioDevice(SDL_AudioDeviceID dev); extern DECLSPEC void SDLCALL SDL_UnlockAudio(void); extern DECLSPEC void SDLCALL SDL_UnlockAudioDevice(SDL_AudioDeviceID dev); /* @} *//* Audio lock functions */ /** * This function shuts down audio processing and closes the audio device. */ extern DECLSPEC void SDLCALL SDL_CloseAudio(void); extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */
33,865
C
40
140
0.669423
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_messagebox.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_messagebox_h_ #define SDL_messagebox_h_ #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief SDL_MessageBox flags. If supported will display warning icon, etc. */ typedef enum { SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */ } SDL_MessageBoxFlags; /** * \brief Flags for SDL_MessageBoxButtonData. */ typedef enum { SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ } SDL_MessageBoxButtonFlags; /** * \brief Individual button data. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ const char * text; /**< The UTF-8 button text */ } SDL_MessageBoxButtonData; /** * \brief RGB value used in a message box color scheme */ typedef struct { Uint8 r, g, b; } SDL_MessageBoxColor; typedef enum { SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, SDL_MESSAGEBOX_COLOR_MAX } SDL_MessageBoxColorType; /** * \brief A set of colors to use for message box dialogs */ typedef struct { SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; } SDL_MessageBoxColorScheme; /** * \brief MessageBox structure containing title, text, window, etc. */ typedef struct { Uint32 flags; /**< ::SDL_MessageBoxFlags */ SDL_Window *window; /**< Parent window, can be NULL */ const char *title; /**< UTF-8 title */ const char *message; /**< UTF-8 message text */ int numbuttons; const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */ } SDL_MessageBoxData; /** * \brief Create a modal message box. * * \param messageboxdata The SDL_MessageBoxData structure with title, text, etc. * \param buttonid The pointer to which user id of hit button should be copied. * * \return -1 on error, otherwise 0 and buttonid contains user id of button * hit or -1 if dialog was closed. * * \note This function should be called on the thread that created the parent * window, or on the main thread if the messagebox has no parent. It will * block execution of that thread until the user clicks a button or * closes the messagebox. */ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); /** * \brief Create a simple modal message box * * \param flags ::SDL_MessageBoxFlags * \param title UTF-8 title text * \param message UTF-8 message text * \param window The parent window, or NULL for no parent * * \return 0 on success, -1 on error * * \sa SDL_ShowMessageBox */ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *message, SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_messagebox_h_ */ /* vi: set ts=4 sw=4 expandtab: */
4,611
C
30.806896
127
0.693125
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_hints.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_hints.h * * Official documentation for SDL configuration variables * * This file contains functions to set and get configuration hints, * as well as listing each of them alphabetically. * * The convention for naming hints is SDL_HINT_X, where "SDL_X" is * the environment variable that can be used to override the default. * * In general these hints are just that - they may or may not be * supported or applicable on any given platform, but they provide * a way for an application or user to give the library a hint as * to how they would like the library to work. */ #ifndef SDL_hints_h_ #define SDL_hints_h_ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface. * * SDL can try to accelerate the SDL screen surface by using streaming * textures with a 3D rendering engine. This variable controls whether and * how this is done. * * This variable can be set to the following values: * "0" - Disable 3D acceleration * "1" - Enable 3D acceleration, using the default renderer. * "X" - Enable 3D acceleration, using X where X is one of the valid rendering drivers. (e.g. "direct3d", "opengl", etc.) * * By default SDL tries to make a best guess for each platform whether * to use acceleration or not. */ #define SDL_HINT_FRAMEBUFFER_ACCELERATION "SDL_FRAMEBUFFER_ACCELERATION" /** * \brief A variable specifying which render driver to use. * * If the application doesn't pick a specific renderer to use, this variable * specifies the name of the preferred renderer. If the preferred renderer * can't be initialized, the normal default renderer is used. * * This variable is case insensitive and can be set to the following values: * "direct3d" * "opengl" * "opengles2" * "opengles" * "metal" * "software" * * The default varies by platform, but it's the first one in the list that * is available on the current platform. */ #define SDL_HINT_RENDER_DRIVER "SDL_RENDER_DRIVER" /** * \brief A variable controlling whether the OpenGL render driver uses shaders if they are available. * * This variable can be set to the following values: * "0" - Disable shaders * "1" - Enable shaders * * By default shaders are used if OpenGL supports them. */ #define SDL_HINT_RENDER_OPENGL_SHADERS "SDL_RENDER_OPENGL_SHADERS" /** * \brief A variable controlling whether the Direct3D device is initialized for thread-safe operations. * * This variable can be set to the following values: * "0" - Thread-safety is not enabled (faster) * "1" - Thread-safety is enabled * * By default the Direct3D device is created with thread-safety disabled. */ #define SDL_HINT_RENDER_DIRECT3D_THREADSAFE "SDL_RENDER_DIRECT3D_THREADSAFE" /** * \brief A variable controlling whether to enable Direct3D 11+'s Debug Layer. * * This variable does not have any effect on the Direct3D 9 based renderer. * * This variable can be set to the following values: * "0" - Disable Debug Layer use * "1" - Enable Debug Layer use * * By default, SDL does not use Direct3D Debug Layer. */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" /** * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. * * This variable can be set to the following values: * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen * * By default letterbox is used */ #define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" /** * \brief A variable controlling the scaling quality * * This variable can be set to the following values: * "0" or "nearest" - Nearest pixel sampling * "1" or "linear" - Linear filtering (supported by OpenGL and Direct3D) * "2" or "best" - Currently this is the same as "linear" * * By default nearest pixel sampling is used */ #define SDL_HINT_RENDER_SCALE_QUALITY "SDL_RENDER_SCALE_QUALITY" /** * \brief A variable controlling whether updates to the SDL screen surface should be synchronized with the vertical refresh, to avoid tearing. * * This variable can be set to the following values: * "0" - Disable vsync * "1" - Enable vsync * * By default SDL does not sync screen surface updates with vertical refresh. */ #define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" /** * \brief A variable controlling whether the screensaver is enabled. * * This variable can be set to the following values: * "0" - Disable screensaver * "1" - Enable screensaver * * By default SDL will disable the screensaver. */ #define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER" /** * \brief A variable controlling whether the X11 VidMode extension should be used. * * This variable can be set to the following values: * "0" - Disable XVidMode * "1" - Enable XVidMode * * By default SDL will use XVidMode if it is available. */ #define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" /** * \brief A variable controlling whether the X11 Xinerama extension should be used. * * This variable can be set to the following values: * "0" - Disable Xinerama * "1" - Enable Xinerama * * By default SDL will use Xinerama if it is available. */ #define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" /** * \brief A variable controlling whether the X11 XRandR extension should be used. * * This variable can be set to the following values: * "0" - Disable XRandR * "1" - Enable XRandR * * By default SDL will not use XRandR because of window manager issues. */ #define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" /** * \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported. * * This variable can be set to the following values: * "0" - Disable _NET_WM_PING * "1" - Enable _NET_WM_PING * * By default SDL will use _NET_WM_PING, but for applications that know they * will not always be able to respond to ping requests in a timely manner they can * turn it off to avoid the window manager thinking the app is hung. * The hint is checked in CreateWindow. */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" /** * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. * * This variable can be set to the following values: * "0" - Disable _NET_WM_BYPASS_COMPOSITOR * "1" - Enable _NET_WM_BYPASS_COMPOSITOR * * By default SDL will use _NET_WM_BYPASS_COMPOSITOR * */ #define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * * This variable can be set to the following values: * "0" - The window frame is not interactive when the cursor is hidden (no move, resize, etc) * "1" - The window frame is interactive when the cursor is hidden * * By default SDL will allow interaction with the window frame when the cursor is hidden */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" /** * \brief A variable to specify custom icon resource id from RC file on Windows platform */ #define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" #define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" /** * \brief A variable controlling whether the windows message loop is processed by SDL * * This variable can be set to the following values: * "0" - The window message loop is not run * "1" - The window message loop is processed in SDL_PumpEvents() * * By default SDL will process the windows message loop */ #define SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP "SDL_WINDOWS_ENABLE_MESSAGELOOP" /** * \brief A variable controlling whether grabbing input grabs the keyboard * * This variable can be set to the following values: * "0" - Grab will affect only the mouse * "1" - Grab will affect mouse and keyboard * * By default SDL will not grab the keyboard so system shortcuts still work. */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" /** * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode */ #define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" /** * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode */ #define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * * This variable can be set to the following values: * "0" - Relative mouse mode uses raw input * "1" - Relative mouse mode uses mouse warping * * By default SDL will use raw input for relative mouse mode */ #define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" /** * \brief Allow mouse click events when clicking to focus an SDL window * * This variable can be set to the following values: * "0" - Ignore mouse clicks that activate a window * "1" - Generate events for mouse clicks that activate a window * * By default SDL will ignore mouse clicks that activate a window */ #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" /** * \brief A variable controlling whether touch events should generate synthetic mouse events * * This variable can be set to the following values: * "0" - Touch events will not generate mouse events * "1" - Touch events will generate mouse events * * By default SDL will generate mouse events for touch events */ #define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * */ #define SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS "SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS" /** * \brief A variable controlling whether the idle timer is disabled on iOS. * * When an iOS app does not receive touches for some time, the screen is * dimmed automatically. For games where the accelerometer is the only input * this is problematic. This functionality can be disabled by setting this * hint. * * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() * accomplish the same thing on iOS. They should be preferred over this hint. * * This variable can be set to the following values: * "0" - Enable idle timer * "1" - Disable idle timer */ #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** * \brief A variable controlling which orientations are allowed on iOS. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. * * This variable is a space delimited list of the following values: * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" */ #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" /** * \brief A variable controlling whether controllers used with the Apple TV * generate UI events. * * When UI events are generated by controller input, the app will be * backgrounded when the Apple TV remote's menu button is pressed, and when the * pause or B buttons on gamepads are pressed. * * More information about properly making use of controllers for the Apple TV * can be found here: * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ * * This variable can be set to the following values: * "0" - Controller input does not generate UI events (the default). * "1" - Controller input generates UI events. */ #define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" /** * \brief A variable controlling whether the Apple TV remote's joystick axes * will automatically match the rotation of the remote. * * This variable can be set to the following values: * "0" - Remote orientation does not affect joystick axes (the default). * "1" - Joystick axes are based on the orientation of the remote. */ #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** * \brief A variable controlling whether the home indicator bar on iPhone X * should be hidden. * * This variable can be set to the following values: * "0" - The indicator bar is not hidden (default for windowed applications) * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) */ #define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" /** * \brief A variable controlling whether the Android / iOS built-in * accelerometer should be listed as a joystick device. * * This variable can be set to the following values: * "0" - The accelerometer is not listed as a joystick * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" /** * \brief A variable controlling whether the Android / tvOS remotes * should be listed as joystick devices, instead of sending keyboard events. * * This variable can be set to the following values: * "0" - Remotes send enter/escape/arrow key events * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). */ #define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices * * The variable can be set to the following values: * "0" - Disable XInput detection (only uses direct input) * "1" - Enable XInput detection (the default) */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * * This hint is for backwards compatibility only and will be removed in SDL 2.1 * * The default value is "0". This hint must be set before SDL_Init() */ #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" /** * \brief A variable that lets you manually hint extra gamecontroller db entries. * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * * This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) * You can update mappings after the system is initialized with SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" /** * \brief A variable containing a list of devices to skip when scanning for game controllers. * * The format of the string is a comma separated list of USB VID/PID pairs * in hexadecimal form, e.g. * * 0xAAAA/0xBBBB,0xCCCC/0xDDDD * * The variable can also take the form of @file, in which case the named * file will be loaded and interpreted as the value of the variable. */ #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" /** * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. * * The format of the string is a comma separated list of USB VID/PID pairs * in hexadecimal form, e.g. * * 0xAAAA/0xBBBB,0xCCCC/0xDDDD * * The variable can also take the form of @file, in which case the named * file will be loaded and interpreted as the value of the variable. */ #define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. * * The variable can be set to the following values: * "0" - Disable joystick & gamecontroller input events when the * application is in the background. * "1" - Enable joystick & gamecontroller input events when the * application is in the background. * * The default value is "0". This hint may be set at any time. */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" * * This variable can be set to the following values: * "0" - don't allow topmost * "1" - allow topmost */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" /** * \brief A variable that controls the timer resolution, in milliseconds. * * The higher resolution the timer, the more frequently the CPU services * timer interrupts, and the more precise delays are, but this takes up * power and CPU time. This hint is only used on Windows 7 and earlier. * * See this blog post for more information: * http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution-megawatts-wasted/ * * If this variable is set to "0", the system timer resolution is not set. * * The default value is "1". This hint may be set at any time. */ #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" /** * \brief A variable describing the content orientation on QtWayland-based platforms. * * On QtWayland platforms, windows are rotated client-side to allow for custom * transitions. In order to correctly position overlays (e.g. volume bar) and * gestures (e.g. events view, close/minimize gestures), the system needs to * know in which orientation the application is currently drawing its contents. * * This does not cause the window to be rotated or resized, the application * needs to take care of drawing the content in the right orientation (the * framebuffer is always in portrait mode). * * This variable can be one of the following values: * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" */ #define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" /** * \brief Flags to set on QtWayland windows to integrate with the native window manager. * * On QtWayland platforms, this hint controls the flags to set on the windows. * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. * * This variable is a space-separated list of the following values (empty = no flags): * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" */ #define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" /** * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size * * Use this hint in case you need to set SDL's threads stack size to other than the default. * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). * Support for this hint is currently available only in the pthread, Windows, and PSP backend. */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" /** * \brief If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and iOS) */ #define SDL_HINT_VIDEO_HIGHDPI_DISABLED "SDL_VIDEO_HIGHDPI_DISABLED" /** * \brief A variable that determines whether ctrl+click should generate a right-click event on Mac * * If present, holding ctrl while left clicking will generate a right click * event when on Mac. */ #define SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK "SDL_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK" /** * \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries * * SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. It * can use two different sets of binaries, those compiled by the user from source * or those provided by the Chrome browser. In the later case, these binaries require * that SDL loads a DLL providing the shader compiler. * * This variable can be set to the following values: * "d3dcompiler_46.dll" - default, best for Vista or later. * "d3dcompiler_43.dll" - for XP support. * "none" - do not load any library, useful if you compiled ANGLE from source and included the compiler in your binaries. * */ #define SDL_HINT_VIDEO_WIN_D3DCOMPILER "SDL_VIDEO_WIN_D3DCOMPILER" /** * \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p"). * * If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* it is set to has * SDL_WINDOW_OPENGL set (and running on WGL only, currently), then two things will occur on the newly * created SDL_Window: * * 1. Its pixel format will be set to the same pixel format as this SDL_Window. This is * needed for example when sharing an OpenGL context across multiple windows. * * 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it can be used for * OpenGL rendering. * * This variable can be set to the following values: * The address (as a string "%p") of the SDL_Window* that new windows created with SDL_CreateWindowFrom() should * share a pixel format with. */ #define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT" /** * \brief A URL to a WinRT app's privacy policy * * All network-enabled WinRT apps must make a privacy policy available to its * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be * be available in the Windows Settings charm, as accessed from within the app. * SDL provides code to add a URL-based link there, which can point to the app's * privacy policy. * * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL * before calling any SDL_Init() functions. The contents of the hint should * be a valid URL. For example, "http://www.example.com". * * The default value is "", which will prevent SDL from adding a privacy policy * link to the Settings charm. This hint should only be set during app init. * * The label text of an app's "Privacy Policy" link may be customized via another * hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. * * Please note that on Windows Phone, Microsoft does not provide standard UI * for displaying a privacy policy link, and as such, SDL_HINT_WINRT_PRIVACY_POLICY_URL * will not get used on that platform. Network-enabled phone apps should display * their privacy policy through some other, in-app means. */ #define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL" /** \brief Label text for a WinRT app's privacy policy link * * Network-enabled WinRT apps must include a privacy policy. On Windows 8, 8.1, and RT, * Microsoft mandates that this policy be available via the Windows Settings charm. * SDL provides code to add a link there, with its label text being set via the * optional hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. * * Please note that a privacy policy's contents are not set via this hint. A separate * hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the actual text of the * policy. * * The contents of this hint should be encoded as a UTF8 string. * * The default value is "Privacy Policy". This hint should only be set during app * initialization, preferably before any calls to SDL_Init(). * * For additional information on linking to a privacy policy, see the documentation for * SDL_HINT_WINRT_PRIVACY_POLICY_URL. */ #define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL" /** \brief Allows back-button-press events on Windows Phone to be marked as handled * * Windows Phone devices typically feature a Back button. When pressed, * the OS will emit back-button-press events, which apps are expected to * handle in an appropriate manner. If apps do not explicitly mark these * events as 'Handled', then the OS will invoke its default behavior for * unhandled back-button-press events, which on Windows Phone 8 and 8.1 is to * terminate the app (and attempt to switch to the previous app, or to the * device's home screen). * * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL * to mark back-button-press events as Handled, if and when one is sent to * the app. * * Internally, Windows Phone sends back button events as parameters to * special back-button-press callback functions. Apps that need to respond * to back-button-press events are expected to register one or more * callback functions for such, shortly after being launched (during the * app's initialization phase). After the back button is pressed, the OS * will invoke these callbacks. If the app's callback(s) do not explicitly * mark the event as handled by the time they return, or if the app never * registers one of these callback, the OS will consider the event * un-handled, and it will apply its default back button behavior (terminate * the app). * * SDL registers its own back-button-press callback with the Windows Phone * OS. This callback will emit a pair of SDL key-press events (SDL_KEYDOWN * and SDL_KEYUP), each with a scancode of SDL_SCANCODE_AC_BACK, after which * it will check the contents of the hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. * If the hint's value is set to "1", the back button event's Handled * property will get set to 'true'. If the hint's value is set to something * else, or if it is unset, SDL will leave the event's Handled property * alone. (By default, the OS sets this property to 'false', to note.) * * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a * back button is pressed, or can set it in direct-response to a back button * being pressed. * * In order to get notified when a back button is pressed, SDL apps should * register a callback function with SDL_AddEventWatch(), and have it listen * for SDL_KEYDOWN events that have a scancode of SDL_SCANCODE_AC_BACK. * (Alternatively, SDL_KEYUP events can be listened-for. Listening for * either event type is suitable.) Any value of SDL_HINT_WINRT_HANDLE_BACK_BUTTON * set by such a callback, will be applied to the OS' current * back-button-press event. * * More details on back button behavior in Windows Phone apps can be found * at the following page, on Microsoft's developer site: * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx */ #define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON" /** * \brief A variable that dictates policy for fullscreen Spaces on Mac OS X. * * This hint only applies to Mac OS X. * * The variable can be set to the following values: * "0" - Disable Spaces support (FULLSCREEN_DESKTOP won't use them and * SDL_WINDOW_RESIZABLE windows won't offer the "fullscreen" * button on their titlebars). * "1" - Enable Spaces support (FULLSCREEN_DESKTOP will use them and * SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" * button on their titlebars). * * The default value is "1". Spaces are disabled regardless of this hint if * the OS isn't at least Mac OS X Lion (10.7). This hint must be set before * any windows are created. */ #define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES" /** * \brief When set don't force the SDL app to become a foreground process * * This hint only applies to Mac OS X. * */ #define SDL_HINT_MAC_BACKGROUND_APP "SDL_MAC_BACKGROUND_APP" /** * \brief Android APK expansion main file version. Should be a string number like "1", "2" etc. * * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. * * If both hints were set then SDL_RWFromFile() will look into expansion files * after a given relative path was not found in the internal storage and assets. * * By default this hint is not set and the APK expansion files are not searched. */ #define SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION" /** * \brief Android APK expansion patch file version. Should be a string number like "1", "2" etc. * * Must be set together with SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. * * If both hints were set then SDL_RWFromFile() will look into expansion files * after a given relative path was not found in the internal storage and assets. * * By default this hint is not set and the APK expansion files are not searched. */ #define SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION "SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION" /** * \brief A variable to control whether certain IMEs should handle text editing internally instead of sending SDL_TEXTEDITING events. * * The variable can be set to the following values: * "0" - SDL_TEXTEDITING events are sent, and it is the application's * responsibility to render the text from these events and * differentiate it somehow from committed text. (default) * "1" - If supported by the IME then SDL_TEXTEDITING events are not sent, * and text that is being composed will be rendered in its own UI. */ #define SDL_HINT_IME_INTERNAL_EDITING "SDL_IME_INTERNAL_EDITING" /** * \brief A variable to control whether mouse and touch events are to be treated together or separately * * The variable can be set to the following values: * "0" - Mouse events will be handled as touch events, and touch will raise fake mouse * events. This is the behaviour of SDL <= 2.0.3. (default) * "1" - Mouse events will be handled separately from pure touch events. * * The value of this hint is used at runtime, so it can be changed at any time. */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" /** * \brief A variable to control whether the return key on the soft keyboard * should hide the soft keyboard on Android and iOS. * * The variable can be set to the following values: * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) * "1" - The return key will hide the keyboard. * * The value of this hint is used at runtime, so it can be changed at any time. */ #define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" /** * \brief override the binding element for keyboard inputs for Emscripten builds * * This hint only applies to the emscripten platform * * The variable can be one of * "#window" - The javascript window object (this is the default) * "#document" - The javascript document object * "#screen" - the javascript window.screen object * "#canvas" - the WebGL canvas element * any other string without a leading # sign applies to the element on the page with that ID. */ #define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT" /** * \brief Tell SDL not to catch the SIGINT or SIGTERM signals. * * This hint only applies to Unix-like platforms. * * The variable can be set to the following values: * "0" - SDL will install a SIGINT and SIGTERM handler, and when it * catches a signal, convert it into an SDL_QUIT event. * "1" - SDL will not install a signal handler at all. */ #define SDL_HINT_NO_SIGNAL_HANDLERS "SDL_NO_SIGNAL_HANDLERS" /** * \brief Tell SDL not to generate window-close events for Alt+F4 on Windows. * * The variable can be set to the following values: * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ #define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. * * The bitmap header version 4 is required for proper alpha channel support and * SDL will use it when required. Should this not be desired, this hint can * force the use of the 40 byte header version which is supported everywhere. * * The variable can be set to the following values: * "0" - Surfaces with a colorkey or an alpha channel are saved to a * 32-bit BMP file with an alpha mask. SDL will use the bitmap * header version 4 and set the alpha mask accordingly. * "1" - Surfaces with a colorkey or an alpha channel are saved to a * 32-bit BMP file without an alpha mask. The alpha channel data * will be in the file, but applications are going to ignore it. * * The default value is "0". */ #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" /** * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. * The 0x406D1388 Exception is a trick used to inform Visual Studio of a * thread's name, but it tends to cause problems with other debuggers, * and the .NET runtime. Note that SDL 2.0.6 and later will still use * the (safer) SetThreadDescription API, introduced in the Windows 10 * Creators Update, if available. * * The variable can be set to the following values: * "0" - SDL will raise the 0x406D1388 Exception to name threads. * This is the default behavior of SDL <= 2.0.4. * "1" - SDL will not raise this exception, and threads will be unnamed. (default) * This is necessary with .NET languages or debuggers that aren't Visual Studio. */ #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" /** * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI * * Also known as Z-order. The variable can take a negative or positive value. * The default is 10000. */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" /** * \brief Tell the video driver that we only want a double buffer. * * By default, most lowlevel 2D APIs will use a triple buffer scheme that * wastes no CPU time on waiting for vsync after issuing a flip, but * introduces a frame of latency. On the other hand, using a double buffer * scheme instead is recommended for cases where low latency is an important * factor because we save a whole frame of latency. * We do so by waiting for vsync immediately after issuing a flip, usually just * after eglSwapBuffers call in the backend's *_SwapWindow function. * * Since it's driver-specific, it's only supported where possible and * implemented. Currently supported the following drivers: * - KMSDRM (kmsdrm) * - Raspberry Pi (raspberrypi) */ #define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" /** * \brief A variable controlling what driver to use for OpenGL ES contexts. * * On some platforms, currently Windows and X11, OpenGL drivers may support * creating contexts with an OpenGL ES profile. By default SDL uses these * profiles, when available, otherwise it attempts to load an OpenGL ES * library, e.g. that provided by the ANGLE project. This variable controls * whether SDL follows this default behaviour or will always load an * OpenGL ES library. * * Circumstances where this is useful include * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, * or emulator, e.g. those from ARM, Imagination or Qualcomm. * - Resolving OpenGL ES function addresses at link time by linking with * the OpenGL ES library instead of querying them at run time with * SDL_GL_GetProcAddress(). * * Caution: for an application to work with the default behaviour across * different OpenGL drivers it must query the OpenGL ES function * addresses at run time using SDL_GL_GetProcAddress(). * * This variable is ignored on most platforms because OpenGL ES is native * or not supported. * * This variable can be set to the following values: * "0" - Use ES profile of OpenGL, if available. (Default when not set.) * "1" - Load OpenGL ES library using the default library names. * */ #define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" /** * \brief A variable controlling speed/quality tradeoff of audio resampling. * * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) * to handle audio resampling. There are different resampling modes available * that produce different levels of quality, using more CPU. * * If this hint isn't specified to a valid setting, or libsamplerate isn't * available, SDL will use the default, internal resampling algorithm. * * Note that this is currently only applicable to resampling audio that is * being written to a device for playback or audio being read from a device * for capture. SDL_AudioCVT always uses the default resampler (although this * might change for SDL 2.1). * * This hint is currently only checked at audio subsystem initialization. * * This variable can be set to the following values: * * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) * "1" or "fast" - Use fast, slightly higher quality resampling, if available * "2" or "medium" - Use medium quality resampling, if available * "3" or "best" - Use high quality resampling, if available */ #define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" /** * \brief A variable controlling the audio category on iOS and Mac OS X * * This variable can be set to the following values: * * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) * "playback" - Use the AVAudioSessionCategoryPlayback category * * For more information, see Apple's documentation: * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html */ #define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" /** * \brief An enumeration of hint priorities */ typedef enum { SDL_HINT_DEFAULT, SDL_HINT_NORMAL, SDL_HINT_OVERRIDE } SDL_HintPriority; /** * \brief Set a hint with a specific priority * * The priority controls the behavior when setting a hint that already * has a value. Hints will replace existing hints of their priority and * lower. Environment variables are considered to have override priority. * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority); /** * \brief Set a hint with normal priority * * \return SDL_TRUE if the hint was set, SDL_FALSE otherwise */ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, const char *value); /** * \brief Get a hint * * \return The string value of a hint variable. */ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); /** * \brief Get a hint * * \return The boolean value of a hint variable. */ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); /** * \brief type definition of the hint callback function. */ typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); /** * \brief Add a function to watch a particular hint * * \param name The hint to watch * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); /** * \brief Remove a function watching a particular hint * * \param name The hint being watched * \param callback The function being called when the hint value changes * \param userdata A pointer being passed to the callback function */ extern DECLSPEC void SDLCALL SDL_DelHintCallback(const char *name, SDL_HintCallback callback, void *userdata); /** * \brief Clear all hints * * This function is called during SDL_Quit() to free stored hints. */ extern DECLSPEC void SDLCALL SDL_ClearHints(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_hints_h_ */ /* vi: set ts=4 sw=4 expandtab: */
42,803
C
40.841642
174
0.705558
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_bits.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_bits.h * * Functions for fiddling with bits and bitmasks. */ #ifndef SDL_bits_h_ #define SDL_bits_h_ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \file SDL_bits.h */ /** * Get the index of the most significant bit. Result is undefined when called * with 0. This operation can also be stated as "count leading zeroes" and * "log base 2". * * \return Index of the most significant bit, or -1 if the value is 0. */ #if defined(__WATCOMC__) && defined(__386__) extern _inline int _SDL_clz_watcom (Uint32); #pragma aux _SDL_clz_watcom = \ "bsr eax, eax" \ "xor eax, 31" \ parm [eax] nomemory \ value [eax] \ modify exact [eax] nomemory; #endif SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* Count Leading Zeroes builtin in GCC. * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html */ if (x == 0) { return -1; } return 31 - __builtin_clz(x); #elif defined(__WATCOMC__) && defined(__386__) if (x == 0) { return -1; } return 31 - _SDL_clz_watcom(x); #else /* Based off of Bit Twiddling Hacks by Sean Eron Anderson * <[email protected]>, released in the public domain. * http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog */ const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; const int S[] = {1, 2, 4, 8, 16}; int msbIndex = 0; int i; if (x == 0) { return -1; } for (i = 4; i >= 0; i--) { if (x & b[i]) { x >>= S[i]; msbIndex |= S[i]; } } return msbIndex; #endif } /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_bits_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,945
C
25.070796
82
0.632258
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_stdinc.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_stdinc.h * * This is a general header that includes C language support. */ #ifndef SDL_stdinc_h_ #define SDL_stdinc_h_ #include "SDL_config.h" #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_STDIO_H #include <stdio.h> #endif #if defined(STDC_HEADERS) # include <stdlib.h> # include <stddef.h> # include <stdarg.h> #else # if defined(HAVE_STDLIB_H) # include <stdlib.h> # elif defined(HAVE_MALLOC_H) # include <malloc.h> # endif # if defined(HAVE_STDDEF_H) # include <stddef.h> # endif # if defined(HAVE_STDARG_H) # include <stdarg.h> # endif #endif #ifdef HAVE_STRING_H # if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) # include <memory.h> # endif # include <string.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_WCHAR_H # include <wchar.h> #endif #if defined(HAVE_INTTYPES_H) # include <inttypes.h> #elif defined(HAVE_STDINT_H) # include <stdint.h> #endif #ifdef HAVE_CTYPE_H # include <ctype.h> #endif #ifdef HAVE_MATH_H # if defined(__WINRT__) /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on WinRT. See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx for more information. */ # define _USE_MATH_DEFINES # endif # include <math.h> #endif #ifdef HAVE_FLOAT_H # include <float.h> #endif /** * The number of elements in an array. */ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_TABLESIZE(table) SDL_arraysize(table) /** * Macro useful for building other macros with strings in them * * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n") */ #define SDL_STRINGIFY_ARG(arg) #arg /** * \name Cast operators * * Use proper C++ casts when compiled as C++ to be compatible with the option * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). */ /* @{ */ #ifdef __cplusplus #define SDL_reinterpret_cast(type, expression) reinterpret_cast<type>(expression) #define SDL_static_cast(type, expression) static_cast<type>(expression) #define SDL_const_cast(type, expression) const_cast<type>(expression) #else #define SDL_reinterpret_cast(type, expression) ((type)(expression)) #define SDL_static_cast(type, expression) ((type)(expression)) #define SDL_const_cast(type, expression) ((type)(expression)) #endif /* @} *//* Cast operators */ /* Define a four character code as a Uint32 */ #define SDL_FOURCC(A, B, C, D) \ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (C))) << 16) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (D))) << 24)) /** * \name Basic data types */ /* @{ */ #ifdef __CC_ARM /* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ #define SDL_FALSE 0 #define SDL_TRUE 1 typedef int SDL_bool; #else typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; #endif /** * \brief A signed 8-bit integer type. */ #define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ #define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ #define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ #define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ #define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ #define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ #define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ #define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ #define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ #define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ #define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ #define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ #define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ #define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ #define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ #define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ typedef uint64_t Uint64; /* @} *//* Basic data types */ /* Make sure we have macros for printing 64 bit values. * <stdint.h> should define these but this is not true all platforms. * (for example win32) */ #ifndef SDL_PRIs64 #ifdef PRIs64 #define SDL_PRIs64 PRIs64 #elif defined(__WIN32__) #define SDL_PRIs64 "I64d" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIs64 "ld" #else #define SDL_PRIs64 "lld" #endif #endif #ifndef SDL_PRIu64 #ifdef PRIu64 #define SDL_PRIu64 PRIu64 #elif defined(__WIN32__) #define SDL_PRIu64 "I64u" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIu64 "lu" #else #define SDL_PRIu64 "llu" #endif #endif #ifndef SDL_PRIx64 #ifdef PRIx64 #define SDL_PRIx64 PRIx64 #elif defined(__WIN32__) #define SDL_PRIx64 "I64x" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIx64 "lx" #else #define SDL_PRIx64 "llx" #endif #endif #ifndef SDL_PRIX64 #ifdef PRIX64 #define SDL_PRIX64 PRIX64 #elif defined(__WIN32__) #define SDL_PRIX64 "I64X" #elif defined(__LINUX__) && defined(__LP64__) #define SDL_PRIX64 "lX" #else #define SDL_PRIX64 "llX" #endif #endif /* Annotations to help code analysis tools */ #ifdef SDL_DISABLE_ANALYZE_MACROS #define SDL_IN_BYTECAP(x) #define SDL_INOUT_Z_CAP(x) #define SDL_OUT_Z_CAP(x) #define SDL_OUT_CAP(x) #define SDL_OUT_BYTECAP(x) #define SDL_OUT_Z_BYTECAP(x) #define SDL_PRINTF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) #else #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #include <sal.h> #define SDL_IN_BYTECAP(x) _In_bytecount_(x) #define SDL_INOUT_Z_CAP(x) _Inout_z_cap_(x) #define SDL_OUT_Z_CAP(x) _Out_z_cap_(x) #define SDL_OUT_CAP(x) _Out_cap_(x) #define SDL_OUT_BYTECAP(x) _Out_bytecap_(x) #define SDL_OUT_Z_BYTECAP(x) _Out_z_bytecap_(x) #define SDL_PRINTF_FORMAT_STRING _Printf_format_string_ #define SDL_SCANF_FORMAT_STRING _Scanf_format_string_impl_ #else #define SDL_IN_BYTECAP(x) #define SDL_INOUT_Z_CAP(x) #define SDL_OUT_Z_CAP(x) #define SDL_OUT_CAP(x) #define SDL_OUT_BYTECAP(x) #define SDL_OUT_Z_BYTECAP(x) #define SDL_PRINTF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING #endif #if defined(__GNUC__) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) #else #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ /** \endcond */ /* Check to make sure enums are the size of ints, for structure packing. For both Watcom C/C++ and Borland C/C++ the compiler option that makes enums having the size of an int must be enabled. This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11). */ /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS #if !defined(__ANDROID__) /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */ typedef enum { DUMMY_ENUM_VALUE } SDL_DUMMY_ENUM; SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); #endif #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ /** \endcond */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif #if defined(HAVE_ALLOCA) && !defined(alloca) # if defined(HAVE_ALLOCA_H) # include <alloca.h> # elif defined(__GNUC__) # define alloca __builtin_alloca # elif defined(_MSC_VER) # include <malloc.h> # define alloca _alloca # elif defined(__WATCOMC__) # include <malloc.h> # elif defined(__BORLANDC__) # include <malloc.h> # elif defined(__DMC__) # include <stdlib.h> # elif defined(__AIX__) #pragma alloca # elif defined(__MRC__) void *alloca(unsigned); # else char *alloca(); # endif #endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) #else #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) #define SDL_stack_free(data) SDL_free(data) #endif extern DECLSPEC void *SDLCALL SDL_malloc(size_t size); extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); typedef void *(SDLCALL *SDL_malloc_func)(size_t size); typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); typedef void (SDLCALL *SDL_free_func)(void *mem); /** * \brief Get the current set of SDL memory functions */ extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, SDL_calloc_func *calloc_func, SDL_realloc_func *realloc_func, SDL_free_func *free_func); /** * \brief Replace SDL's memory allocation functions with a custom set * * \note If you are replacing SDL's memory functions, you should call * SDL_GetNumAllocations() and be very careful if it returns non-zero. * That means that your free function will be called with memory * allocated by the previous memory allocation functions. */ extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func); /** * \brief Get the number of outstanding (unfreed) allocations */ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)); extern DECLSPEC int SDLCALL SDL_abs(int x); /* !!! FIXME: these have side effects. You probably shouldn't use them. */ /* !!! FIXME: Maybe we do forceinline functions of SDL_mini, SDL_minf, etc? */ #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) #define SDL_max(x, y) (((x) > (y)) ? (x) : (y)) extern DECLSPEC int SDLCALL SDL_isdigit(int x); extern DECLSPEC int SDLCALL SDL_isspace(int x); extern DECLSPEC int SDLCALL SDL_toupper(int x); extern DECLSPEC int SDLCALL SDL_tolower(int x); extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len); #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) /* Note that memset() is a byte assignment and this is a 32-bit assignment, so they're not directly equivalent. */ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) { #if defined(__GNUC__) && defined(i386) int u0, u1, u2; __asm__ __volatile__ ( "cld \n\t" "rep ; stosl \n\t" : "=&D" (u0), "=&a" (u1), "=&c" (u2) : "0" (dst), "1" (val), "2" (SDL_static_cast(Uint32, dwords)) : "memory" ); #else size_t _n = (dwords + 3) / 4; Uint32 *_p = SDL_static_cast(Uint32 *, dst); Uint32 _val = (val); if (dwords == 0) return; switch (dwords % 4) { case 0: do { *_p++ = _val; /* fallthrough */ case 3: *_p++ = _val; /* fallthrough */ case 2: *_p++ = _val; /* fallthrough */ case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif } extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes); extern DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); extern DECLSPEC char *SDLCALL SDL_strdup(const char *str); extern DECLSPEC char *SDLCALL SDL_strrev(char *str); extern DECLSPEC char *SDLCALL SDL_strupr(char *str); extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ltoa(long value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); extern DECLSPEC int SDLCALL SDL_atoi(const char *str); extern DECLSPEC double SDLCALL SDL_atof(const char *str); extern DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); extern DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen); extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3); extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap); #ifndef HAVE_M_PI #ifndef M_PI #define M_PI 3.14159265358979323846264338327950288 /**< pi */ #endif #endif extern DECLSPEC double SDLCALL SDL_acos(double x); extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); extern DECLSPEC float SDLCALL SDL_floorf(float x); extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); extern DECLSPEC float SDLCALL SDL_logf(float x); extern DECLSPEC double SDLCALL SDL_log10(double x); extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); extern DECLSPEC float SDLCALL SDL_sqrtf(float x); extern DECLSPEC double SDLCALL SDL_tan(double x); extern DECLSPEC float SDLCALL SDL_tanf(float x); /* The SDL implementation of iconv() returns these error codes */ #define SDL_ICONV_ERROR (size_t)-1 #define SDL_ICONV_E2BIG (size_t)-2 #define SDL_ICONV_EILSEQ (size_t)-3 #define SDL_ICONV_EINVAL (size_t)-4 /* SDL_iconv_* are now always real symbols/types, not macros or inlined. */ typedef struct _SDL_iconv_t *SDL_iconv_t; extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode); extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd); extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * inbytesleft, char **outbuf, size_t * outbytesleft); /** * This function converts a string between encodings in one pass, returning a * string that must be freed with SDL_free() or NULL on error. */ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft); #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) /* force builds using Clang's static analysis tools to use literal C runtime here, since there are possibly tests that are ineffective otherwise. */ #if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) #define SDL_malloc malloc #define SDL_calloc calloc #define SDL_realloc realloc #define SDL_free free #define SDL_memset memset #define SDL_memcpy memcpy #define SDL_memmove memmove #define SDL_memcmp memcmp #define SDL_strlen strlen #define SDL_strlcpy strlcpy #define SDL_strlcat strlcat #define SDL_strdup strdup #define SDL_strchr strchr #define SDL_strrchr strrchr #define SDL_strstr strstr #define SDL_strcmp strcmp #define SDL_strncmp strncmp #define SDL_strcasecmp strcasecmp #define SDL_strncasecmp strncasecmp #define SDL_sscanf sscanf #define SDL_vsscanf vsscanf #define SDL_snprintf snprintf #define SDL_vsnprintf vsnprintf #endif SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_BYTECAP(dwords*4) const void *src, size_t dwords) { return SDL_memcpy(dst, src, dwords * 4); } /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_stdinc_h_ */ /* vi: set ts=4 sw=4 expandtab: */
21,999
C
35.30363
164
0.689077
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_endian.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_endian.h * * Functions for reading and writing endian-specific values */ #ifndef SDL_endian_h_ #define SDL_endian_h_ #include "SDL_stdinc.h" /** * \name The two types of endianness */ /* @{ */ #define SDL_LIL_ENDIAN 1234 #define SDL_BIG_ENDIAN 4321 /* @} */ #ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */ #ifdef __linux__ #include <endian.h> #define SDL_BYTEORDER __BYTE_ORDER #else /* __linux__ */ #if defined(__hppa__) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ (defined(__MIPS__) && defined(__MISPEB__)) || \ defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \ defined(__sparc__) #define SDL_BYTEORDER SDL_BIG_ENDIAN #else #define SDL_BYTEORDER SDL_LIL_ENDIAN #endif #endif /* __linux__ */ #endif /* !SDL_BYTEORDER */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \file SDL_endian.h */ #if defined(__GNUC__) && defined(__i386__) && \ !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */) SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("xchgb %b0,%h0": "=Q"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { int result; __asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x)); return (Uint16)result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #elif defined(__WATCOMC__) && defined(__386__) extern _inline Uint16 SDL_Swap16(Uint16); #pragma aux SDL_Swap16 = \ "xchg al, ah" \ parm [ax] \ modify [ax]; #else SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) { return SDL_static_cast(Uint16, ((x << 8) | (x >> 8))); } #endif #if defined(__GNUC__) && defined(__i386__) SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswap %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && defined(__x86_64__) SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("bswapl %0": "=r"(x):"0"(x)); return x; } #elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { Uint32 result; __asm__("rlwimi %0,%2,24,16,23": "=&r"(result):"0"(x >> 24), "r"(x)); __asm__("rlwimi %0,%2,8,8,15": "=&r"(result):"0"(result), "r"(x)); __asm__("rlwimi %0,%2,24,0,7": "=&r"(result):"0"(result), "r"(x)); return result; } #elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__)) && !defined(__mcoldfire__) SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } #elif defined(__WATCOMC__) && defined(__386__) extern _inline Uint32 SDL_Swap32(Uint32); #ifndef __SW_3 /* 486+ */ #pragma aux SDL_Swap32 = \ "bswap eax" \ parm [eax] \ modify [eax]; #else /* 386-only */ #pragma aux SDL_Swap32 = \ "xchg al, ah" \ "ror eax, 16" \ "xchg al, ah" \ parm [eax] \ modify [eax]; #endif #else SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) { return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x >> 24))); } #endif #if defined(__GNUC__) && defined(__i386__) SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { union { struct { Uint32 a, b; } s; Uint64 u; } v; v.u = x; __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a), "1"(v.s. b)); return v.u; } #elif defined(__GNUC__) && defined(__x86_64__) SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { __asm__("bswapq %0": "=r"(x):"0"(x)); return x; } #else SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x) { Uint32 hi, lo; /* Separate into high and low 32-bit values and swap them */ lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x >>= 32; hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF); x = SDL_Swap32(lo); x <<= 32; x |= SDL_Swap32(hi); return (x); } #endif SDL_FORCE_INLINE float SDL_SwapFloat(float x) { union { float f; Uint32 ui32; } swapper; swapper.f = x; swapper.ui32 = SDL_Swap32(swapper.ui32); return swapper.f; } /** * \name Swap to native * Byteswap item from the specified endianness to the native endianness. */ /* @{ */ #if SDL_BYTEORDER == SDL_LIL_ENDIAN #define SDL_SwapLE16(X) (X) #define SDL_SwapLE32(X) (X) #define SDL_SwapLE64(X) (X) #define SDL_SwapFloatLE(X) (X) #define SDL_SwapBE16(X) SDL_Swap16(X) #define SDL_SwapBE32(X) SDL_Swap32(X) #define SDL_SwapBE64(X) SDL_Swap64(X) #define SDL_SwapFloatBE(X) SDL_SwapFloat(X) #else #define SDL_SwapLE16(X) SDL_Swap16(X) #define SDL_SwapLE32(X) SDL_Swap32(X) #define SDL_SwapLE64(X) SDL_Swap64(X) #define SDL_SwapFloatLE(X) SDL_SwapFloat(X) #define SDL_SwapBE16(X) (X) #define SDL_SwapBE32(X) (X) #define SDL_SwapBE64(X) (X) #define SDL_SwapFloatBE(X) (X) #endif /* @} *//* Swap to native */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_endian_h_ */ /* vi: set ts=4 sw=4 expandtab: */
6,451
C
23.720306
98
0.600837
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_keycode.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_keycode.h * * Defines constants which identify keyboard keys and modifiers. */ #ifndef SDL_keycode_h_ #define SDL_keycode_h_ #include "SDL_stdinc.h" #include "SDL_scancode.h" /** * \brief The SDL virtual key representation. * * Values of this type are used to represent keyboard keys using the current * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. * * A special exception is the number keys at the top of the keyboard which * always map to SDLK_0...SDLK_9, regardless of layout. */ typedef Sint32 SDL_Keycode; #define SDLK_SCANCODE_MASK (1<<30) #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) enum { SDLK_UNKNOWN = 0, SDLK_RETURN = '\r', SDLK_ESCAPE = '\033', SDLK_BACKSPACE = '\b', SDLK_TAB = '\t', SDLK_SPACE = ' ', SDLK_EXCLAIM = '!', SDLK_QUOTEDBL = '"', SDLK_HASH = '#', SDLK_PERCENT = '%', SDLK_DOLLAR = '$', SDLK_AMPERSAND = '&', SDLK_QUOTE = '\'', SDLK_LEFTPAREN = '(', SDLK_RIGHTPAREN = ')', SDLK_ASTERISK = '*', SDLK_PLUS = '+', SDLK_COMMA = ',', SDLK_MINUS = '-', SDLK_PERIOD = '.', SDLK_SLASH = '/', SDLK_0 = '0', SDLK_1 = '1', SDLK_2 = '2', SDLK_3 = '3', SDLK_4 = '4', SDLK_5 = '5', SDLK_6 = '6', SDLK_7 = '7', SDLK_8 = '8', SDLK_9 = '9', SDLK_COLON = ':', SDLK_SEMICOLON = ';', SDLK_LESS = '<', SDLK_EQUALS = '=', SDLK_GREATER = '>', SDLK_QUESTION = '?', SDLK_AT = '@', /* Skip uppercase letters */ SDLK_LEFTBRACKET = '[', SDLK_BACKSLASH = '\\', SDLK_RIGHTBRACKET = ']', SDLK_CARET = '^', SDLK_UNDERSCORE = '_', SDLK_BACKQUOTE = '`', SDLK_a = 'a', SDLK_b = 'b', SDLK_c = 'c', SDLK_d = 'd', SDLK_e = 'e', SDLK_f = 'f', SDLK_g = 'g', SDLK_h = 'h', SDLK_i = 'i', SDLK_j = 'j', SDLK_k = 'k', SDLK_l = 'l', SDLK_m = 'm', SDLK_n = 'n', SDLK_o = 'o', SDLK_p = 'p', SDLK_q = 'q', SDLK_r = 'r', SDLK_s = 's', SDLK_t = 't', SDLK_u = 'u', SDLK_v = 'v', SDLK_w = 'w', SDLK_x = 'x', SDLK_y = 'y', SDLK_z = 'z', SDLK_CAPSLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CAPSLOCK), SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12), SDLK_PRINTSCREEN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRINTSCREEN), SDLK_SCROLLLOCK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SCROLLLOCK), SDLK_PAUSE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAUSE), SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), SDLK_DELETE = '\177', SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), SDLK_NUMLOCKCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_NUMLOCKCLEAR), SDLK_KP_DIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DIVIDE), SDLK_KP_MULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MULTIPLY), SDLK_KP_MINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MINUS), SDLK_KP_PLUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUS), SDLK_KP_ENTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_ENTER), SDLK_KP_1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_1), SDLK_KP_2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_2), SDLK_KP_3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_3), SDLK_KP_4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_4), SDLK_KP_5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_5), SDLK_KP_6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_6), SDLK_KP_7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_7), SDLK_KP_8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_8), SDLK_KP_9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_9), SDLK_KP_0 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_0), SDLK_KP_PERIOD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERIOD), SDLK_APPLICATION = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APPLICATION), SDLK_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_POWER), SDLK_KP_EQUALS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALS), SDLK_F13 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F13), SDLK_F14 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F14), SDLK_F15 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F15), SDLK_F16 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F16), SDLK_F17 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F17), SDLK_F18 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F18), SDLK_F19 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F19), SDLK_F20 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F20), SDLK_F21 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F21), SDLK_F22 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F22), SDLK_F23 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F23), SDLK_F24 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F24), SDLK_EXECUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXECUTE), SDLK_HELP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HELP), SDLK_MENU = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MENU), SDLK_SELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SELECT), SDLK_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_STOP), SDLK_AGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AGAIN), SDLK_UNDO = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UNDO), SDLK_CUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CUT), SDLK_COPY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COPY), SDLK_PASTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PASTE), SDLK_FIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_FIND), SDLK_MUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MUTE), SDLK_VOLUMEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEUP), SDLK_VOLUMEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_VOLUMEDOWN), SDLK_KP_COMMA = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COMMA), SDLK_KP_EQUALSAS400 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EQUALSAS400), SDLK_ALTERASE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ALTERASE), SDLK_SYSREQ = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SYSREQ), SDLK_CANCEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CANCEL), SDLK_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEAR), SDLK_PRIOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PRIOR), SDLK_RETURN2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RETURN2), SDLK_SEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SEPARATOR), SDLK_OUT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OUT), SDLK_OPER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_OPER), SDLK_CLEARAGAIN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CLEARAGAIN), SDLK_CRSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CRSEL), SDLK_EXSEL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EXSEL), SDLK_KP_00 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_00), SDLK_KP_000 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_000), SDLK_THOUSANDSSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_THOUSANDSSEPARATOR), SDLK_DECIMALSEPARATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DECIMALSEPARATOR), SDLK_CURRENCYUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYUNIT), SDLK_CURRENCYSUBUNIT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CURRENCYSUBUNIT), SDLK_KP_LEFTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTPAREN), SDLK_KP_RIGHTPAREN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTPAREN), SDLK_KP_LEFTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LEFTBRACE), SDLK_KP_RIGHTBRACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_RIGHTBRACE), SDLK_KP_TAB = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_TAB), SDLK_KP_BACKSPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BACKSPACE), SDLK_KP_A = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_A), SDLK_KP_B = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_B), SDLK_KP_C = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_C), SDLK_KP_D = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_D), SDLK_KP_E = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_E), SDLK_KP_F = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_F), SDLK_KP_XOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_XOR), SDLK_KP_POWER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_POWER), SDLK_KP_PERCENT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PERCENT), SDLK_KP_LESS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_LESS), SDLK_KP_GREATER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_GREATER), SDLK_KP_AMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AMPERSAND), SDLK_KP_DBLAMPERSAND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLAMPERSAND), SDLK_KP_VERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_VERTICALBAR), SDLK_KP_DBLVERTICALBAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DBLVERTICALBAR), SDLK_KP_COLON = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_COLON), SDLK_KP_HASH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HASH), SDLK_KP_SPACE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_SPACE), SDLK_KP_AT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_AT), SDLK_KP_EXCLAM = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_EXCLAM), SDLK_KP_MEMSTORE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSTORE), SDLK_KP_MEMRECALL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMRECALL), SDLK_KP_MEMCLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMCLEAR), SDLK_KP_MEMADD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMADD), SDLK_KP_MEMSUBTRACT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMSUBTRACT), SDLK_KP_MEMMULTIPLY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMMULTIPLY), SDLK_KP_MEMDIVIDE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_MEMDIVIDE), SDLK_KP_PLUSMINUS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_PLUSMINUS), SDLK_KP_CLEAR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEAR), SDLK_KP_CLEARENTRY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_CLEARENTRY), SDLK_KP_BINARY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_BINARY), SDLK_KP_OCTAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_OCTAL), SDLK_KP_DECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_DECIMAL), SDLK_KP_HEXADECIMAL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KP_HEXADECIMAL), SDLK_LCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LCTRL), SDLK_LSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LSHIFT), SDLK_LALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LALT), SDLK_LGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LGUI), SDLK_RCTRL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RCTRL), SDLK_RSHIFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RSHIFT), SDLK_RALT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT), SDLK_RGUI = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI), SDLK_MODE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE), SDLK_AUDIONEXT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT), SDLK_AUDIOPREV = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV), SDLK_AUDIOSTOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP), SDLK_AUDIOPLAY = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY), SDLK_AUDIOMUTE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE), SDLK_MEDIASELECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT), SDLK_WWW = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW), SDLK_MAIL = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL), SDLK_CALCULATOR = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR), SDLK_COMPUTER = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER), SDLK_AC_SEARCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH), SDLK_AC_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME), SDLK_AC_BACK = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK), SDLK_AC_FORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_FORWARD), SDLK_AC_STOP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP), SDLK_AC_REFRESH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH), SDLK_AC_BOOKMARKS = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS), SDLK_BRIGHTNESSDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN), SDLK_BRIGHTNESSUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP), SDLK_DISPLAYSWITCH = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH), SDLK_KBDILLUMTOGGLE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE), SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) }; /** * \brief Enumeration of valid key mods (possibly OR'd together). */ typedef enum { KMOD_NONE = 0x0000, KMOD_LSHIFT = 0x0001, KMOD_RSHIFT = 0x0002, KMOD_LCTRL = 0x0040, KMOD_RCTRL = 0x0080, KMOD_LALT = 0x0100, KMOD_RALT = 0x0200, KMOD_LGUI = 0x0400, KMOD_RGUI = 0x0800, KMOD_NUM = 0x1000, KMOD_CAPS = 0x2000, KMOD_MODE = 0x4000, KMOD_RESERVED = 0x8000 } SDL_Keymod; #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) #endif /* SDL_keycode_h_ */ /* vi: set ts=4 sw=4 expandtab: */
15,262
C
42.608571
82
0.690473
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_atomic.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_atomic.h * * Atomic operations. * * IMPORTANT: * If you are not an expert in concurrent lockless programming, you should * only be using the atomic lock and reference counting functions in this * file. In all other cases you should be protecting your data structures * with full mutexes. * * The list of "safe" functions to use are: * SDL_AtomicLock() * SDL_AtomicUnlock() * SDL_AtomicIncRef() * SDL_AtomicDecRef() * * Seriously, here be dragons! * ^^^^^^^^^^^^^^^^^^^^^^^^^^^ * * You can find out a little more about lockless programming and the * subtle issues that can arise here: * http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx * * There's also lots of good information here: * http://www.1024cores.net/home/lock-free-algorithms * http://preshing.com/ * * These operations may or may not actually be implemented using * processor specific atomic operations. When possible they are * implemented as true processor specific atomic operations. When that * is not possible the are implemented using locks that *do* use the * available atomic operations. * * All of the atomic operations that modify memory are full memory barriers. */ #ifndef SDL_atomic_h_ #define SDL_atomic_h_ #include "SDL_stdinc.h" #include "SDL_platform.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \name SDL AtomicLock * * The atomic locks are efficient spinlocks using CPU instructions, * but are vulnerable to starvation and can spin forever if a thread * holding a lock has been terminated. For this reason you should * minimize the code executed inside an atomic lock and never do * expensive things like API or system calls while holding them. * * The atomic locks are not safe to lock recursively. * * Porting Note: * The spin lock functions and type are required and can not be * emulated because they are used in the atomic emulation code. */ /* @{ */ typedef int SDL_SpinLock; /** * \brief Try to lock a spin lock by setting it to a non-zero value. * * \param lock Points to the lock. * * \return SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already held. */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock); /** * \brief Lock a spin lock by setting it to a non-zero value. * * \param lock Points to the lock. */ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock); /** * \brief Unlock a spin lock by setting it to 0. Always returns immediately * * \param lock Points to the lock. */ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); /* @} *//* SDL AtomicLock */ /** * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ #if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") #elif defined(__WATCOMC__) extern _inline void SDL_CompilerBarrier (void); #pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; #else #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } #endif /** * Memory barriers are designed to prevent reads and writes from being * reordered by the compiler and being seen out of order on multi-core CPUs. * * A typical pattern would be for thread A to write some data and a flag, * and for thread B to read the flag and get the data. In this case you * would insert a release barrier between writing the data and the flag, * guaranteeing that the data write completes no later than the flag is * written, and you would insert an acquire barrier between reading the * flag and reading the data, to ensure that all the reads associated * with the flag have completed. * * In this pattern you should always see a release barrier paired with * an acquire barrier and you should gate the data reads/writes with a * single flag variable. * * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") #elif defined(__GNUC__) && defined(__aarch64__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ #define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() #define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #endif /* __thumb__ */ #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory") #endif /* __GNUC__ && __arm__ */ #else #if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */ #include <mbarrier.h> #define SDL_MemoryBarrierRelease() __machine_rel_barrier() #define SDL_MemoryBarrierAcquire() __machine_acq_barrier() #else /* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */ #define SDL_MemoryBarrierRelease() SDL_CompilerBarrier() #define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier() #endif #endif /** * \brief A type representing an atomic integer value. It is a struct * so people don't accidentally use numeric operations on it. */ typedef struct { int value; } SDL_atomic_t; /** * \brief Set an atomic variable to a new value if it is currently an old value. * * \return SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. * * \note If you don't know what this function is for, you shouldn't use it! */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval); /** * \brief Set an atomic variable to a value. * * \return The previous value of the atomic variable. */ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v); /** * \brief Get the value of an atomic variable */ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a); /** * \brief Add to an atomic variable. * * \return The previous value of the atomic variable. * * \note This same style can be used for any number operation */ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v); /** * \brief Increment an atomic variable used as a reference count. */ #ifndef SDL_AtomicIncRef #define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) #endif /** * \brief Decrement an atomic variable used as a reference count. * * \return SDL_TRUE if the variable reached zero after decrementing, * SDL_FALSE otherwise */ #ifndef SDL_AtomicDecRef #define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) #endif /** * \brief Set a pointer to a new value if it is currently an old value. * * \return SDL_TRUE if the pointer was set, SDL_FALSE otherwise. * * \note If you don't know what this function is for, you shouldn't use it! */ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval); /** * \brief Set a pointer to a value atomically. * * \return The previous value of the pointer. */ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v); /** * \brief Get the value of a pointer atomically. */ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_atomic_h_ */ /* vi: set ts=4 sw=4 expandtab: */
10,031
C
35.086331
200
0.700429
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_timer.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_timer_h_ #define SDL_timer_h_ /** * \file SDL_timer.h * * Header for the SDL time management routines. */ #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Get the number of milliseconds since the SDL library initialization. * * \note This value wraps if the program runs for more than ~49 days. */ extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); /** * \brief Compare SDL ticks values, and return true if A has passed B * * e.g. if you want to wait 100 ms, you could do this: * Uint32 timeout = SDL_GetTicks() + 100; * while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { * ... do work until timeout has elapsed * } */ #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) /** * \brief Get the current value of the high resolution counter */ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void); /** * \brief Get the count per second of the high resolution counter */ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void); /** * \brief Wait a specified number of milliseconds before returning. */ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); /** * Function prototype for the timer callback function. * * The callback function is passed the current timer interval and returns * the next timer interval. If the returned value is the same as the one * passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is cancelled. */ typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); /** * Definition of the timer ID type. */ typedef int SDL_TimerID; /** * \brief Add a new timer to the pool of timers already running. * * \return A timer ID, or 0 when an error occurs. */ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param); /** * \brief Remove a timer knowing its ID. * * \return A boolean value indicating success or failure. * * \warning It is not safe to remove a timer multiple times. */ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_timer_h_ */ /* vi: set ts=4 sw=4 expandtab: */
3,454
C
28.784483
78
0.69861
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_opengles2_gl2.h
#ifndef __gl2_h_ #define __gl2_h_ /* $Revision: 20555 $ on $Date:: 2013-02-12 14:32:47 -0800 #$ */ /*#include <GLES2/gl2platform.h>*/ #ifdef __cplusplus extern "C" { #endif /* * This document is licensed under the SGI Free Software B License Version * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . */ /*------------------------------------------------------------------------- * Data type definitions *-----------------------------------------------------------------------*/ typedef void GLvoid; typedef char GLchar; typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef khronos_int8_t GLbyte; typedef short GLshort; typedef int GLint; typedef int GLsizei; typedef khronos_uint8_t GLubyte; typedef unsigned short GLushort; typedef unsigned int GLuint; typedef khronos_float_t GLfloat; typedef khronos_float_t GLclampf; typedef khronos_int32_t GLfixed; /* GL types for handling large vertex buffer objects */ typedef khronos_intptr_t GLintptr; typedef khronos_ssize_t GLsizeiptr; /* OpenGL ES core versions */ #define GL_ES_VERSION_2_0 1 /* ClearBufferMask */ #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 /* Boolean */ #define GL_FALSE 0 #define GL_TRUE 1 /* BeginMode */ #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 #define GL_LINE_STRIP 0x0003 #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 /* AlphaFunction (not supported in ES20) */ /* GL_NEVER */ /* GL_LESS */ /* GL_EQUAL */ /* GL_LEQUAL */ /* GL_GREATER */ /* GL_NOTEQUAL */ /* GL_GEQUAL */ /* GL_ALWAYS */ /* BlendingFactorDest */ #define GL_ZERO 0 #define GL_ONE 1 #define GL_SRC_COLOR 0x0300 #define GL_ONE_MINUS_SRC_COLOR 0x0301 #define GL_SRC_ALPHA 0x0302 #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 /* BlendingFactorSrc */ /* GL_ZERO */ /* GL_ONE */ #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 /* GL_SRC_ALPHA */ /* GL_ONE_MINUS_SRC_ALPHA */ /* GL_DST_ALPHA */ /* GL_ONE_MINUS_DST_ALPHA */ /* BlendEquationSeparate */ #define GL_FUNC_ADD 0x8006 #define GL_BLEND_EQUATION 0x8009 #define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ #define GL_BLEND_EQUATION_ALPHA 0x883D /* BlendSubtract */ #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B /* Separate Blend Functions */ #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA #define GL_BLEND_SRC_ALPHA 0x80CB #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 /* Buffer Objects */ #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 #define GL_STREAM_DRAW 0x88E0 #define GL_STATIC_DRAW 0x88E4 #define GL_DYNAMIC_DRAW 0x88E8 #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 /* CullFaceMode */ #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_FRONT_AND_BACK 0x0408 /* DepthFunction */ /* GL_NEVER */ /* GL_LESS */ /* GL_EQUAL */ /* GL_LEQUAL */ /* GL_GREATER */ /* GL_NOTEQUAL */ /* GL_GEQUAL */ /* GL_ALWAYS */ /* EnableCap */ #define GL_TEXTURE_2D 0x0DE1 #define GL_CULL_FACE 0x0B44 #define GL_BLEND 0x0BE2 #define GL_DITHER 0x0BD0 #define GL_STENCIL_TEST 0x0B90 #define GL_DEPTH_TEST 0x0B71 #define GL_SCISSOR_TEST 0x0C11 #define GL_POLYGON_OFFSET_FILL 0x8037 #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_COVERAGE 0x80A0 /* ErrorCode */ #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_OUT_OF_MEMORY 0x0505 /* FrontFaceDirection */ #define GL_CW 0x0900 #define GL_CCW 0x0901 /* GetPName */ #define GL_LINE_WIDTH 0x0B21 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E #define GL_CULL_FACE_MODE 0x0B45 #define GL_FRONT_FACE 0x0B46 #define GL_DEPTH_RANGE 0x0B70 #define GL_DEPTH_WRITEMASK 0x0B72 #define GL_DEPTH_CLEAR_VALUE 0x0B73 #define GL_DEPTH_FUNC 0x0B74 #define GL_STENCIL_CLEAR_VALUE 0x0B91 #define GL_STENCIL_FUNC 0x0B92 #define GL_STENCIL_FAIL 0x0B94 #define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 #define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 #define GL_STENCIL_REF 0x0B97 #define GL_STENCIL_VALUE_MASK 0x0B93 #define GL_STENCIL_WRITEMASK 0x0B98 #define GL_STENCIL_BACK_FUNC 0x8800 #define GL_STENCIL_BACK_FAIL 0x8801 #define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 #define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 #define GL_STENCIL_BACK_REF 0x8CA3 #define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #define GL_VIEWPORT 0x0BA2 #define GL_SCISSOR_BOX 0x0C10 /* GL_SCISSOR_TEST */ #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_UNPACK_ALIGNMENT 0x0CF5 #define GL_PACK_ALIGNMENT 0x0D05 #define GL_MAX_TEXTURE_SIZE 0x0D33 #define GL_MAX_VIEWPORT_DIMS 0x0D3A #define GL_SUBPIXEL_BITS 0x0D50 #define GL_RED_BITS 0x0D52 #define GL_GREEN_BITS 0x0D53 #define GL_BLUE_BITS 0x0D54 #define GL_ALPHA_BITS 0x0D55 #define GL_DEPTH_BITS 0x0D56 #define GL_STENCIL_BITS 0x0D57 #define GL_POLYGON_OFFSET_UNITS 0x2A00 /* GL_POLYGON_OFFSET_FILL */ #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB /* GetTextureParameter */ /* GL_TEXTURE_MAG_FILTER */ /* GL_TEXTURE_MIN_FILTER */ /* GL_TEXTURE_WRAP_S */ /* GL_TEXTURE_WRAP_T */ #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 /* HintMode */ #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 /* HintTarget */ #define GL_GENERATE_MIPMAP_HINT 0x8192 /* DataType */ #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 #define GL_UNSIGNED_SHORT 0x1403 #define GL_INT 0x1404 #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_FIXED 0x140C /* PixelFormat */ #define GL_DEPTH_COMPONENT 0x1902 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 #define GL_LUMINANCE 0x1909 #define GL_LUMINANCE_ALPHA 0x190A /* PixelType */ /* GL_UNSIGNED_BYTE */ #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 /* Shaders */ #define GL_FRAGMENT_SHADER 0x8B30 #define GL_VERTEX_SHADER 0x8B31 #define GL_MAX_VERTEX_ATTRIBS 0x8869 #define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB #define GL_MAX_VARYING_VECTORS 0x8DFC #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C #define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 #define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD #define GL_SHADER_TYPE 0x8B4F #define GL_DELETE_STATUS 0x8B80 #define GL_LINK_STATUS 0x8B82 #define GL_VALIDATE_STATUS 0x8B83 #define GL_ATTACHED_SHADERS 0x8B85 #define GL_ACTIVE_UNIFORMS 0x8B86 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 #define GL_ACTIVE_ATTRIBUTES 0x8B89 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A #define GL_SHADING_LANGUAGE_VERSION 0x8B8C #define GL_CURRENT_PROGRAM 0x8B8D /* StencilFunction */ #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 #define GL_LEQUAL 0x0203 #define GL_GREATER 0x0204 #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 /* StencilOp */ /* GL_ZERO */ #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 #define GL_DECR 0x1E03 #define GL_INVERT 0x150A #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 /* StringName */ #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 /* TextureMagFilter */ #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 /* TextureMinFilter */ /* GL_NEAREST */ /* GL_LINEAR */ #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 /* TextureParameterName */ #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 /* TextureTarget */ /* GL_TEXTURE_2D */ #define GL_TEXTURE 0x1702 #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C /* TextureUnit */ #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 #define GL_TEXTURE3 0x84C3 #define GL_TEXTURE4 0x84C4 #define GL_TEXTURE5 0x84C5 #define GL_TEXTURE6 0x84C6 #define GL_TEXTURE7 0x84C7 #define GL_TEXTURE8 0x84C8 #define GL_TEXTURE9 0x84C9 #define GL_TEXTURE10 0x84CA #define GL_TEXTURE11 0x84CB #define GL_TEXTURE12 0x84CC #define GL_TEXTURE13 0x84CD #define GL_TEXTURE14 0x84CE #define GL_TEXTURE15 0x84CF #define GL_TEXTURE16 0x84D0 #define GL_TEXTURE17 0x84D1 #define GL_TEXTURE18 0x84D2 #define GL_TEXTURE19 0x84D3 #define GL_TEXTURE20 0x84D4 #define GL_TEXTURE21 0x84D5 #define GL_TEXTURE22 0x84D6 #define GL_TEXTURE23 0x84D7 #define GL_TEXTURE24 0x84D8 #define GL_TEXTURE25 0x84D9 #define GL_TEXTURE26 0x84DA #define GL_TEXTURE27 0x84DB #define GL_TEXTURE28 0x84DC #define GL_TEXTURE29 0x84DD #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 /* TextureWrapMode */ #define GL_REPEAT 0x2901 #define GL_CLAMP_TO_EDGE 0x812F #define GL_MIRRORED_REPEAT 0x8370 /* Uniform Types */ #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 #define GL_INT_VEC2 0x8B53 #define GL_INT_VEC3 0x8B54 #define GL_INT_VEC4 0x8B55 #define GL_BOOL 0x8B56 #define GL_BOOL_VEC2 0x8B57 #define GL_BOOL_VEC3 0x8B58 #define GL_BOOL_VEC4 0x8B59 #define GL_FLOAT_MAT2 0x8B5A #define GL_FLOAT_MAT3 0x8B5B #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_CUBE 0x8B60 /* Vertex Arrays */ #define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 #define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 #define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 #define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 #define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A #define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F /* Read Format */ #define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B /* Shader Source */ #define GL_COMPILE_STATUS 0x8B81 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_SHADER_COMPILER 0x8DFA /* Shader Binary */ #define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 /* Shader Precision-Specified Types */ #define GL_LOW_FLOAT 0x8DF0 #define GL_MEDIUM_FLOAT 0x8DF1 #define GL_HIGH_FLOAT 0x8DF2 #define GL_LOW_INT 0x8DF3 #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 /* Framebuffer Object. */ #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGB565 0x8D62 #define GL_DEPTH_COMPONENT16 0x81A5 #define GL_STENCIL_INDEX8 0x8D48 #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 #define GL_RENDERBUFFER_RED_SIZE 0x8D50 #define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 #define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 #define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 #define GL_NONE 0 #define GL_FRAMEBUFFER_COMPLETE 0x8CD5 #define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 #define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 #define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 /*------------------------------------------------------------------------- * GL core functions. *-----------------------------------------------------------------------*/ GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); GL_APICALL void GL_APIENTRY glClearStencil (GLint s); GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); GL_APICALL void GL_APIENTRY glDisable (GLenum cap); GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); GL_APICALL void GL_APIENTRY glEnable (GLenum cap); GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); GL_APICALL void GL_APIENTRY glFinish (void); GL_APICALL void GL_APIENTRY glFlush (void); GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL GLenum GL_APIENTRY glGetError (void); GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); #ifdef __cplusplus } #endif #endif /* __gl2_h_ */
31,876
C
50.249196
206
0.631133
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_keyboard.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_keyboard.h * * Include file for SDL keyboard event handling */ #ifndef SDL_keyboard_h_ #define SDL_keyboard_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_keycode.h" #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The SDL keysym structure, used in key events. * * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event. */ typedef struct SDL_Keysym { SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */ Uint16 mod; /**< current key modifiers */ Uint32 unused; } SDL_Keysym; /* Function prototypes */ /** * \brief Get the window which currently has keyboard focus. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); /** * \brief Get a snapshot of the current state of the keyboard. * * \param numkeys if non-NULL, receives the length of the returned array. * * \return An array of key states. Indexes into this array are obtained by using ::SDL_Scancode values. * * \b Example: * \code * const Uint8 *state = SDL_GetKeyboardState(NULL); * if ( state[SDL_SCANCODE_RETURN] ) { * printf("<RETURN> is pressed.\n"); * } * \endcode */ extern DECLSPEC const Uint8 *SDLCALL SDL_GetKeyboardState(int *numkeys); /** * \brief Get the current key modifier state for the keyboard. */ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void); /** * \brief Set the current key modifier state for the keyboard. * * \note This does not change the keyboard state, only the key modifier flags. */ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); /** * \brief Get the key code corresponding to the given scancode according * to the current keyboard layout. * * See ::SDL_Keycode for details. * * \sa SDL_GetKeyName() */ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode); /** * \brief Get the scancode corresponding to the given key code according to the * current keyboard layout. * * See ::SDL_Scancode for details. * * \sa SDL_GetScancodeName() */ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key); /** * \brief Get a human-readable name for a scancode. * * \return A pointer to the name for the scancode. * If the scancode doesn't have a name, this function returns * an empty string (""). * * \sa SDL_Scancode */ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode); /** * \brief Get a scancode from a human-readable name * * \return scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized * * \sa SDL_Scancode */ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); /** * \brief Get a human-readable name for a key. * * \return A pointer to a UTF-8 string that stays valid at least until the next * call to this function. If you need it around any longer, you must * copy it. If the key doesn't have a name, this function returns an * empty string (""). * * \sa SDL_Keycode */ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); /** * \brief Get a key code from a human-readable name * * \return key code, or SDLK_UNKNOWN if the name wasn't recognized * * \sa SDL_Keycode */ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); /** * \brief Start accepting Unicode text input events. * This function will show the on-screen keyboard if supported. * * \sa SDL_StopTextInput() * \sa SDL_SetTextInputRect() * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC void SDLCALL SDL_StartTextInput(void); /** * \brief Return whether or not Unicode text input events are enabled. * * \sa SDL_StartTextInput() * \sa SDL_StopTextInput() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void); /** * \brief Stop receiving any text input events. * This function will hide the on-screen keyboard if supported. * * \sa SDL_StartTextInput() * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC void SDLCALL SDL_StopTextInput(void); /** * \brief Set the rectangle used to type Unicode text inputs. * This is used as a hint for IME and on-screen keyboard placement. * * \sa SDL_StartTextInput() */ extern DECLSPEC void SDLCALL SDL_SetTextInputRect(SDL_Rect *rect); /** * \brief Returns whether the platform has some screen keyboard support. * * \return SDL_TRUE if some keyboard support is available else SDL_FALSE. * * \note Not all screen keyboard functions are supported on all platforms. * * \sa SDL_IsScreenKeyboardShown() */ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); /** * \brief Returns whether the screen keyboard is shown for given window. * * \param window The window for which screen keyboard should be queried. * * \return SDL_TRUE if screen keyboard is shown else SDL_FALSE. * * \sa SDL_HasScreenKeyboardSupport() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */
6,437
C
28.53211
104
0.701569
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_compare.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_compare.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* Defines comparison functions (i.e. for surfaces). */ #ifndef SDL_test_compare_h_ #define SDL_test_compare_h_ #include "SDL.h" #include "SDL_test_images.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Compares a surface and with reference image data for equality * * \param surface Surface used in comparison * \param referenceSurface Test Surface used in comparison * \param allowable_error Allowable difference (=sum of squared difference for each RGB component) in blending accuracy. * * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. */ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_compare_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,163
C
29.914285
184
0.736477
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_assert.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_assert_h_ #define SDL_assert_h_ #include "SDL_config.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif #ifndef SDL_ASSERT_LEVEL #ifdef SDL_DEFAULT_ASSERT_LEVEL #define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL #elif defined(_DEBUG) || defined(DEBUG) || \ (defined(__GNUC__) && !defined(__OPTIMIZE__)) #define SDL_ASSERT_LEVEL 2 #else #define SDL_ASSERT_LEVEL 1 #endif #endif /* SDL_ASSERT_LEVEL */ /* These are macros and not first class functions so that the debugger breaks on the assertion line and not in some random guts of SDL, and so each assert can have unique static variables associated with it. */ #if defined(_MSC_VER) /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() #elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) #elif defined(__386__) && defined(__WATCOMC__) #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } #elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #include <signal.h> #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else /* How do we trigger breakpoints on this platform? */ #define SDL_TriggerBreakpoint() #endif #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ #elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" #endif #define SDL_FILE __FILE__ #define SDL_LINE __LINE__ /* sizeof (x) makes the compiler still parse the expression even without assertions enabled, so the code is always checked at compile time, but doesn't actually generate code for it, so there are no side effects or expensive checks at run time, just the constant size of what x WOULD be, which presumably gets optimized out as unused. This also solves the problem of... int somevalue = blah(); SDL_assert(somevalue == 1); ...which would cause compiles to complain that somevalue is unused if we disable assertions. */ /* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking this condition isn't constant. And looks like an owl's face! */ #ifdef _MSC_VER /* stupid /W4 warnings. */ #define SDL_NULL_WHILE_LOOP_CONDITION (0,0) #else #define SDL_NULL_WHILE_LOOP_CONDITION (0) #endif #define SDL_disabled_assert(condition) \ do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) typedef enum { SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */ SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */ SDL_ASSERTION_ABORT, /**< Terminate the program. */ SDL_ASSERTION_IGNORE, /**< Ignore the assert. */ SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */ } SDL_AssertState; typedef struct SDL_AssertData { int always_ignore; unsigned int trigger_count; const char *condition; const char *filename; int linenum; const char *function; const struct SDL_AssertData *next; } SDL_AssertData; #if (SDL_ASSERT_LEVEL > 0) /* Never call this directly. Use the SDL_assert* macros. */ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *, const char *, const char *, int) #if defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) /* this tells Clang's static analysis that we're a custom assert function, and that the analyzer should assume the condition was always true past this SDL_assert test. */ __attribute__((analyzer_noreturn)) #endif #endif ; /* the do {} while(0) avoids dangling else problems: if (x) SDL_assert(y); else blah(); ... without the do/while, the "else" could attach to this macro's "if". We try to handle just the minimum we need here in a macro...the loop, the static vars, and break points. The heavy lifting is handled in SDL_ReportAssertion(), in SDL_assert.c. */ #define SDL_enabled_assert(condition) \ do { \ while ( !(condition) ) { \ static struct SDL_AssertData sdl_assert_data = { \ 0, 0, #condition, 0, 0, 0, 0 \ }; \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ continue; /* go again. */ \ } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \ SDL_TriggerBreakpoint(); \ } \ break; /* not retrying. */ \ } \ } while (SDL_NULL_WHILE_LOOP_CONDITION) #endif /* enabled assertions support code */ /* Enable various levels of assertions. */ #if SDL_ASSERT_LEVEL == 0 /* assertions disabled */ # define SDL_assert(condition) SDL_disabled_assert(condition) # define SDL_assert_release(condition) SDL_disabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 1 /* release settings. */ # define SDL_assert(condition) SDL_disabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 2 /* normal settings. */ # define SDL_assert(condition) SDL_enabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_disabled_assert(condition) #elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */ # define SDL_assert(condition) SDL_enabled_assert(condition) # define SDL_assert_release(condition) SDL_enabled_assert(condition) # define SDL_assert_paranoid(condition) SDL_enabled_assert(condition) #else # error Unknown assertion level. #endif /* this assertion is never disabled at any level. */ #define SDL_assert_always(condition) SDL_enabled_assert(condition) typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( const SDL_AssertData* data, void* userdata); /** * \brief Set an application-defined assertion handler. * * This allows an app to show its own assertion UI and/or force the * response to an assertion failure. If the app doesn't provide this, SDL * will try to do the right thing, popping up a system-specific GUI dialog, * and probably minimizing any fullscreen windows. * * This callback may fire from any thread, but it runs wrapped in a mutex, so * it will only fire from one thread at a time. * * Setting the callback to NULL restores SDL's original internal handler. * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * * Return SDL_AssertState value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. */ extern DECLSPEC void SDLCALL SDL_SetAssertionHandler( SDL_AssertionHandler handler, void *userdata); /** * \brief Get the default assertion handler. * * This returns the function pointer that is called by default when an * assertion is triggered. This is an internal function provided by SDL, * that is used for assertions when SDL_SetAssertionHandler() hasn't been * used to provide a different function. * * \return The default SDL_AssertionHandler that is called when an assert triggers. */ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void); /** * \brief Get the current assertion handler. * * This returns the function pointer that is called when an assertion is * triggered. This is either the value last passed to * SDL_SetAssertionHandler(), or if no application-specified function is * set, is equivalent to calling SDL_GetDefaultAssertionHandler(). * * \param puserdata Pointer to a void*, which will store the "userdata" * pointer that was passed to SDL_SetAssertionHandler(). * This value will always be NULL for the default handler. * If you don't care about this data, it is safe to pass * a NULL pointer to this function to ignore it. * \return The SDL_AssertionHandler that is called when an assert triggers. */ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata); /** * \brief Get a list of all assertion failures. * * Get all assertions triggered since last call to SDL_ResetAssertionReport(), * or the start of the program. * * The proper way to examine this data looks something like this: * * <code> * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); * item = item->next; * } * </code> * * \return List of all assertions. * \sa SDL_ResetAssertionReport */ extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void); /** * \brief Reset the list of all assertion failures. * * Reset list of all assertions triggered. * * \sa SDL_GetAssertionReport */ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); /* these had wrong naming conventions until 2.0.4. Please update your app! */ #define SDL_assert_state SDL_AssertState #define SDL_assert_data SDL_AssertData /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */
11,045
C
36.828767
127
0.680489
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_clipboard.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_clipboard.h * * Include file for SDL clipboard handling */ #ifndef SDL_clipboard_h_ #define SDL_clipboard_h_ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Function prototypes */ /** * \brief Put UTF-8 text into the clipboard * * \sa SDL_GetClipboardText() */ extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text); /** * \brief Get UTF-8 text from the clipboard, which must be freed with SDL_free() * * \sa SDL_SetClipboardText() */ extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * \brief Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty * * \sa SDL_GetClipboardText() */ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */
1,966
C
26.319444
109
0.728891
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_error.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_error.h * * Simple error message routines for SDL. */ #ifndef SDL_error_h_ #define SDL_error_h_ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Public functions */ /* SDL_SetError() unconditionally returns -1. */ extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); extern DECLSPEC const char *SDLCALL SDL_GetError(void); extern DECLSPEC void SDLCALL SDL_ClearError(void); /** * \name Internal error functions * * \internal * Private error reporting function - used internally. */ /* @{ */ #define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) #define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED) #define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param)) typedef enum { SDL_ENOMEM, SDL_EFREAD, SDL_EFWRITE, SDL_EFSEEK, SDL_UNSUPPORTED, SDL_LASTERROR } SDL_errorcode; /* SDL_Error() unconditionally returns -1. */ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); /* @} *//* Internal error functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_error_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,271
C
28.506493
114
0.719066
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ #ifndef SDL_test_h_ #define SDL_test_h_ #include "SDL.h" #include "SDL_test_assert.h" #include "SDL_test_common.h" #include "SDL_test_compare.h" #include "SDL_test_crc32.h" #include "SDL_test_font.h" #include "SDL_test_fuzzer.h" #include "SDL_test_harness.h" #include "SDL_test_images.h" #include "SDL_test_log.h" #include "SDL_test_md5.h" #include "SDL_test_memory.h" #include "SDL_test_random.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Global definitions */ /* * Note: Maximum size of SDLTest log message is less than SDL's limit * to ensure we can fit additional information such as the timestamp. */ #define SDLTEST_MAX_LOGMESSAGE_LENGTH 3584 /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,000
C
27.585714
76
0.7245
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_video.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_video.h * * Header file for SDL video functions. */ #ifndef SDL_video_h_ #define SDL_video_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" #include "SDL_rect.h" #include "SDL_surface.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The structure that defines a display mode * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() * \sa SDL_GetDesktopDisplayMode() * \sa SDL_GetCurrentDisplayMode() * \sa SDL_GetClosestDisplayMode() * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ typedef struct { Uint32 format; /**< pixel format */ int w; /**< width, in screen coordinates */ int h; /**< height, in screen coordinates */ int refresh_rate; /**< refresh rate (or zero for unspecified) */ void *driverdata; /**< driver-specific data, initialize to 0 */ } SDL_DisplayMode; /** * \brief The type used to identify a window * * \sa SDL_CreateWindow() * \sa SDL_CreateWindowFrom() * \sa SDL_DestroyWindow() * \sa SDL_GetWindowData() * \sa SDL_GetWindowFlags() * \sa SDL_GetWindowGrab() * \sa SDL_GetWindowPosition() * \sa SDL_GetWindowSize() * \sa SDL_GetWindowTitle() * \sa SDL_HideWindow() * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() * \sa SDL_RaiseWindow() * \sa SDL_RestoreWindow() * \sa SDL_SetWindowData() * \sa SDL_SetWindowFullscreen() * \sa SDL_SetWindowGrab() * \sa SDL_SetWindowIcon() * \sa SDL_SetWindowPosition() * \sa SDL_SetWindowSize() * \sa SDL_SetWindowBordered() * \sa SDL_SetWindowResizable() * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ typedef struct SDL_Window SDL_Window; /** * \brief The flags on a window * * \sa SDL_GetWindowFlags() */ typedef enum { /* !!! FIXME: change this to name = (1<<x). */ SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ SDL_WINDOW_SHOWN = 0x00000004, /**< window is visible */ SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. On macOS NSHighResolutionCapable must be set true in the application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */ } SDL_WindowFlags; /** * \brief Used to indicate that you don't care what the window position is. */ #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u #define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X)) #define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0) #define SDL_WINDOWPOS_ISUNDEFINED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK) /** * \brief Used to indicate that the window position should be centered. */ #define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u #define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X)) #define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0) #define SDL_WINDOWPOS_ISCENTERED(X) \ (((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK) /** * \brief Event subtype for window events */ typedef enum { SDL_WINDOWEVENT_NONE, /**< Never used */ SDL_WINDOWEVENT_SHOWN, /**< Window has been shown */ SDL_WINDOWEVENT_HIDDEN, /**< Window has been hidden */ SDL_WINDOWEVENT_EXPOSED, /**< Window has been exposed and should be redrawn */ SDL_WINDOWEVENT_MOVED, /**< Window has been moved to data1, data2 */ SDL_WINDOWEVENT_RESIZED, /**< Window has been resized to data1xdata2 */ SDL_WINDOWEVENT_SIZE_CHANGED, /**< The window size has changed, either as a result of an API call or through the system or user changing the window size. */ SDL_WINDOWEVENT_MINIMIZED, /**< Window has been minimized */ SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size and position */ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */ SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */ SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ } SDL_WindowEventID; /** * \brief An opaque handle to an OpenGL context. */ typedef void *SDL_GLContext; /** * \brief OpenGL configuration attributes */ typedef enum { SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE, SDL_GL_ALPHA_SIZE, SDL_GL_BUFFER_SIZE, SDL_GL_DOUBLEBUFFER, SDL_GL_DEPTH_SIZE, SDL_GL_STENCIL_SIZE, SDL_GL_ACCUM_RED_SIZE, SDL_GL_ACCUM_GREEN_SIZE, SDL_GL_ACCUM_BLUE_SIZE, SDL_GL_ACCUM_ALPHA_SIZE, SDL_GL_STEREO, SDL_GL_MULTISAMPLEBUFFERS, SDL_GL_MULTISAMPLESAMPLES, SDL_GL_ACCELERATED_VISUAL, SDL_GL_RETAINED_BACKING, SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION, SDL_GL_CONTEXT_EGL, SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, SDL_GL_CONTEXT_RELEASE_BEHAVIOR, SDL_GL_CONTEXT_RESET_NOTIFICATION, SDL_GL_CONTEXT_NO_ERROR } SDL_GLattr; typedef enum { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ } SDL_GLprofile; typedef enum { SDL_GL_CONTEXT_DEBUG_FLAG = 0x0001, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = 0x0002, SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG = 0x0004, SDL_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 } SDL_GLcontextFlag; typedef enum { SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE = 0x0000, SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 } SDL_GLcontextReleaseFlag; typedef enum { SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 } SDL_GLContextResetNotification; /* Function prototypes */ /** * \brief Get the number of video drivers compiled into SDL * * \sa SDL_GetVideoDriver() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDrivers(void); /** * \brief Get the name of a built in video driver. * * \note The video drivers are presented in the order in which they are * normally checked during initialization. * * \sa SDL_GetNumVideoDrivers() */ extern DECLSPEC const char *SDLCALL SDL_GetVideoDriver(int index); /** * \brief Initialize the video subsystem, optionally specifying a video driver. * * \param driver_name Initialize a specific driver by name, or NULL for the * default video driver. * * \return 0 on success, -1 on error * * This function initializes the video subsystem; setting up a connection * to the window manager, etc, and determines the available display modes * and pixel formats, but does not initialize a window or graphics mode. * * \sa SDL_VideoQuit() */ extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name); /** * \brief Shuts down the video subsystem. * * This function closes all windows, and restores the original video mode. * * \sa SDL_VideoInit() */ extern DECLSPEC void SDLCALL SDL_VideoQuit(void); /** * \brief Returns the name of the currently initialized video driver. * * \return The name of the current video driver or NULL if no driver * has been initialized * * \sa SDL_GetNumVideoDrivers() * \sa SDL_GetVideoDriver() */ extern DECLSPEC const char *SDLCALL SDL_GetCurrentVideoDriver(void); /** * \brief Returns the number of available video displays. * * \sa SDL_GetDisplayBounds() */ extern DECLSPEC int SDLCALL SDL_GetNumVideoDisplays(void); /** * \brief Get the name of a display in UTF-8 encoding * * \return The name of a display, or NULL for an invalid display index. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); /** * \brief Get the desktop area represented by a display, with the primary * display located at 0,0 * * \return 0 on success, or -1 if the index is out of range. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); /** * \brief Get the dots/pixels-per-inch for a display * * \note Diagonal, horizontal and vertical DPI can all be optionally * returned if the parameter is non-NULL. * * \return 0 on success, or -1 if no DPI information is available or the index is out of range. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); /** * \brief Get the usable desktop area represented by a display, with the * primary display located at 0,0 * * This is the same area as SDL_GetDisplayBounds() reports, but with portions * reserved by the system removed. For example, on Mac OS X, this subtracts * the area occupied by the menu bar and dock. * * Setting a window to be fullscreen generally bypasses these unusable areas, * so these are good guidelines for the maximum space available to a * non-fullscreen window. * * \return 0 on success, or -1 if the index is out of range. * * \sa SDL_GetDisplayBounds() * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); /** * \brief Returns the number of available display modes. * * \sa SDL_GetDisplayMode() */ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); /** * \brief Fill in information about a specific display mode. * * \note The display modes are sorted in this priority: * \li bits per pixel -> more colors to fewer colors * \li width -> largest to smallest * \li height -> largest to smallest * \li refresh rate -> highest to lowest * * \sa SDL_GetNumDisplayModes() */ extern DECLSPEC int SDLCALL SDL_GetDisplayMode(int displayIndex, int modeIndex, SDL_DisplayMode * mode); /** * \brief Fill in information about the desktop display mode. */ extern DECLSPEC int SDLCALL SDL_GetDesktopDisplayMode(int displayIndex, SDL_DisplayMode * mode); /** * \brief Fill in information about the current display mode. */ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_DisplayMode * mode); /** * \brief Get the closest match to the requested display mode. * * \param displayIndex The index of display from which mode should be queried. * \param mode The desired display mode * \param closest A pointer to a display mode to be filled in with the closest * match of the available display modes. * * \return The passed in value \c closest, or NULL if no matching video mode * was available. * * The available display modes are scanned, and \c closest is filled in with the * closest mode matching the requested mode and returned. The mode format and * refresh_rate default to the desktop mode if they are 0. The modes are * scanned with size being first priority, format being second priority, and * finally checking the refresh_rate. If all the available modes are too * small, then NULL is returned. * * \sa SDL_GetNumDisplayModes() * \sa SDL_GetDisplayMode() */ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest); /** * \brief Get the display index associated with a window. * * \return the display index of the display containing the center of the * window, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayIndex(SDL_Window * window); /** * \brief Set the display mode used when a fullscreen window is visible. * * By default the window's dimensions and the desktop format and refresh rate * are used. * * \param window The window for which the display mode should be set. * \param mode The mode to use, or NULL for the default mode. * * \return 0 on success, or -1 if setting the display mode failed. * * \sa SDL_GetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ extern DECLSPEC int SDLCALL SDL_SetWindowDisplayMode(SDL_Window * window, const SDL_DisplayMode * mode); /** * \brief Fill in information about the display mode used when a fullscreen * window is visible. * * \sa SDL_SetWindowDisplayMode() * \sa SDL_SetWindowFullscreen() */ extern DECLSPEC int SDLCALL SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode); /** * \brief Get the pixel format associated with the window. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); /** * \brief Create a window with the specified position, dimensions, and flags. * * \param title The title of the window, in UTF-8 encoding. * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param w The width of the window, in screen coordinates. * \param h The height of the window, in screen coordinates. * \param flags The flags for the window, a mask of any of the following: * ::SDL_WINDOW_FULLSCREEN, ::SDL_WINDOW_OPENGL, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. * * \return The created window, or NULL if window creation failed. * * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size * in pixels may differ from its size in screen coordinates on platforms with * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the * drawable size in pixels. * * If the window is created with any of the SDL_WINDOW_OPENGL or * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). * * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. * * \note On non-Apple devices, SDL requires you to either not link to the * Vulkan loader or link to a dynamic library version. This limitation * may be removed in a future version of SDL. * * \sa SDL_DestroyWindow() * \sa SDL_GL_LoadLibrary() * \sa SDL_Vulkan_LoadLibrary() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags); /** * \brief Create an SDL window from an existing native window. * * \param data A pointer to driver-dependent window creation data * * \return The created window, or NULL if window creation failed. * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowFrom(const void *data); /** * \brief Get the numeric ID of a window, for logging purposes. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowID(SDL_Window * window); /** * \brief Get a window from a stored ID, or NULL if it doesn't exist. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetWindowFromID(Uint32 id); /** * \brief Get the window flags. */ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowFlags(SDL_Window * window); /** * \brief Set the title of a window, in UTF-8 format. * * \sa SDL_GetWindowTitle() */ extern DECLSPEC void SDLCALL SDL_SetWindowTitle(SDL_Window * window, const char *title); /** * \brief Get the title of a window, in UTF-8 format. * * \sa SDL_SetWindowTitle() */ extern DECLSPEC const char *SDLCALL SDL_GetWindowTitle(SDL_Window * window); /** * \brief Set the icon for a window. * * \param window The window for which the icon should be set. * \param icon The icon for the window. */ extern DECLSPEC void SDLCALL SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon); /** * \brief Associate an arbitrary named pointer with a window. * * \param window The window to associate with the pointer. * \param name The name of the pointer. * \param userdata The associated pointer. * * \return The previous value associated with 'name' * * \note The name is case-sensitive. * * \sa SDL_GetWindowData() */ extern DECLSPEC void* SDLCALL SDL_SetWindowData(SDL_Window * window, const char *name, void *userdata); /** * \brief Retrieve the data pointer associated with a window. * * \param window The window to query. * \param name The name of the pointer. * * \return The value associated with 'name' * * \sa SDL_SetWindowData() */ extern DECLSPEC void *SDLCALL SDL_GetWindowData(SDL_Window * window, const char *name); /** * \brief Set the position of a window. * * \param window The window to reposition. * \param x The x coordinate of the window in screen coordinates, or * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. * \param y The y coordinate of the window in screen coordinates, or * ::SDL_WINDOWPOS_CENTERED or ::SDL_WINDOWPOS_UNDEFINED. * * \note The window coordinate origin is the upper left of the display. * * \sa SDL_GetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_SetWindowPosition(SDL_Window * window, int x, int y); /** * \brief Get the position of a window. * * \param window The window to query. * \param x Pointer to variable for storing the x position, in screen * coordinates. May be NULL. * \param y Pointer to variable for storing the y position, in screen * coordinates. May be NULL. * * \sa SDL_SetWindowPosition() */ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, int *x, int *y); /** * \brief Set the size of a window's client area. * * \param window The window to resize. * \param w The width of the window, in screen coordinates. Must be >0. * \param h The height of the window, in screen coordinates. Must be >0. * * \note Fullscreen windows automatically match the size of the display mode, * and you should use SDL_SetWindowDisplayMode() to change their size. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_GetWindowSize() * \sa SDL_SetWindowDisplayMode() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); /** * \brief Get the size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the width, in screen * coordinates. May be NULL. * \param h Pointer to variable for storing the height, in screen * coordinates. May be NULL. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with * high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); /** * \brief Get the size of a window's borders (decorations) around the client area. * * \param window The window to query. * \param top Pointer to variable for storing the size of the top border. NULL is permitted. * \param left Pointer to variable for storing the size of the left border. NULL is permitted. * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. * \param right Pointer to variable for storing the size of the right border. NULL is permitted. * * \return 0 on success, or -1 if getting this information is not supported. * * \note if this function fails (returns -1), the size values will be * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as * if the window in question was borderless. */ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right); /** * \brief Set the minimum size of a window's client area. * * \param window The window to set a new minimum size. * \param min_w The minimum width of the window, must be >0 * \param min_h The minimum height of the window, must be >0 * * \note You can't change the minimum size of a fullscreen window, it * automatically matches the size of the display mode. * * \sa SDL_GetWindowMinimumSize() * \sa SDL_SetWindowMaximumSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h); /** * \brief Get the minimum size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the minimum width, may be NULL * \param h Pointer to variable for storing the minimum height, may be NULL * * \sa SDL_GetWindowMaximumSize() * \sa SDL_SetWindowMinimumSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowMinimumSize(SDL_Window * window, int *w, int *h); /** * \brief Set the maximum size of a window's client area. * * \param window The window to set a new maximum size. * \param max_w The maximum width of the window, must be >0 * \param max_h The maximum height of the window, must be >0 * * \note You can't change the maximum size of a fullscreen window, it * automatically matches the size of the display mode. * * \sa SDL_GetWindowMaximumSize() * \sa SDL_SetWindowMinimumSize() */ extern DECLSPEC void SDLCALL SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h); /** * \brief Get the maximum size of a window's client area. * * \param window The window to query. * \param w Pointer to variable for storing the maximum width, may be NULL * \param h Pointer to variable for storing the maximum height, may be NULL * * \sa SDL_GetWindowMinimumSize() * \sa SDL_SetWindowMaximumSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, int *w, int *h); /** * \brief Set the border state of a window. * * This will add or remove the window's SDL_WINDOW_BORDERLESS flag and * add or remove the border from the actual window. This is a no-op if the * window's border already matches the requested state. * * \param window The window of which to change the border state. * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. * * \note You can't change the border state of a fullscreen window. * * \sa SDL_GetWindowFlags() */ extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered); /** * \brief Set the user-resizable state of a window. * * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and * allow/disallow user resizing of the window. This is a no-op if the * window's resizable state already matches the requested state. * * \param window The window of which to change the resizable state. * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. * * \note You can't change the resizable state of a fullscreen window. * * \sa SDL_GetWindowFlags() */ extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window, SDL_bool resizable); /** * \brief Show a window. * * \sa SDL_HideWindow() */ extern DECLSPEC void SDLCALL SDL_ShowWindow(SDL_Window * window); /** * \brief Hide a window. * * \sa SDL_ShowWindow() */ extern DECLSPEC void SDLCALL SDL_HideWindow(SDL_Window * window); /** * \brief Raise a window above other windows and set the input focus. */ extern DECLSPEC void SDLCALL SDL_RaiseWindow(SDL_Window * window); /** * \brief Make a window as large as possible. * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MaximizeWindow(SDL_Window * window); /** * \brief Minimize a window to an iconic representation. * * \sa SDL_RestoreWindow() */ extern DECLSPEC void SDLCALL SDL_MinimizeWindow(SDL_Window * window); /** * \brief Restore the size and position of a minimized or maximized window. * * \sa SDL_MaximizeWindow() * \sa SDL_MinimizeWindow() */ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window); /** * \brief Set a window's fullscreen state. * * \return 0 on success, or -1 if setting the display mode failed. * * \sa SDL_SetWindowDisplayMode() * \sa SDL_GetWindowDisplayMode() */ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags); /** * \brief Get the SDL surface associated with the window. * * \return The window's framebuffer surface, or NULL on error. * * A new surface will be created with the optimal format for the window, * if necessary. This surface will be freed when the window is destroyed. * * \note You may not combine this with 3D or the rendering API on this window. * * \sa SDL_UpdateWindowSurface() * \sa SDL_UpdateWindowSurfaceRects() */ extern DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window * window); /** * \brief Copy the window surface to the screen. * * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() * \sa SDL_UpdateWindowSurfaceRects() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); /** * \brief Copy a number of rectangles on the window surface to the screen. * * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() * \sa SDL_UpdateWindowSurface() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, int numrects); /** * \brief Set a window's input grab mode. * * \param window The window for which the input grab mode should be set. * \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input. * * If the caller enables a grab while another window is currently grabbed, * the other window loses its grab in favor of the caller's window. * * \sa SDL_GetWindowGrab() */ extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed); /** * \brief Get a window's input grab mode. * * \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise. * * \sa SDL_SetWindowGrab() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window); /** * \brief Get the window that currently has an input grab enabled. * * \return This returns the window if input is grabbed, and NULL otherwise. * * \sa SDL_SetWindowGrab() */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void); /** * \brief Set the brightness (gamma correction) for a window. * * \return 0 on success, or -1 if setting the brightness isn't supported. * * \sa SDL_GetWindowBrightness() * \sa SDL_SetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float brightness); /** * \brief Get the brightness (gamma correction) for a window. * * \return The last brightness value passed to SDL_SetWindowBrightness() * * \sa SDL_SetWindowBrightness() */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); /** * \brief Set the opacity for a window * * \param window The window which will be made transparent or opaque * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be * clamped internally between 0.0f and 1.0f. * * \return 0 on success, or -1 if setting the opacity isn't supported. * * \sa SDL_GetWindowOpacity() */ extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); /** * \brief Get the opacity of a window. * * If transparency isn't supported on this platform, opacity will be reported * as 1.0f without error. * * \param window The window in question. * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) * * \return 0 on success, or -1 on error (invalid window, etc). * * \sa SDL_SetWindowOpacity() */ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); /** * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) * * \param modal_window The window that should be modal * \param parent_window The parent window * * \return 0 on success, or -1 otherwise. */ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); /** * \brief Explicitly sets input focus to the window. * * You almost certainly want SDL_RaiseWindow() instead of this function. Use * this with caution, as you might give focus to a window that's completely * obscured by other windows. * * \param window The window that should get the input focus * * \return 0 on success, or -1 otherwise. * \sa SDL_RaiseWindow() */ extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); /** * \brief Set the gamma ramp for a window. * * \param window The window for which the gamma ramp should be set. * \param red The translation table for the red channel, or NULL. * \param green The translation table for the green channel, or NULL. * \param blue The translation table for the blue channel, or NULL. * * \return 0 on success, or -1 if gamma ramps are unsupported. * * Set the gamma translation table for the red, green, and blue channels * of the video hardware. Each table is an array of 256 16-bit quantities, * representing a mapping between the input and output for that channel. * The input is the index into the array, and the output is the 16-bit * gamma value at that index, scaled to the output color precision. * * \sa SDL_GetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue); /** * \brief Get the gamma ramp for a window. * * \param window The window from which the gamma ramp should be queried. * \param red A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the red channel, or NULL. * \param green A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the green channel, or NULL. * \param blue A pointer to a 256 element array of 16-bit quantities to hold * the translation table for the blue channel, or NULL. * * \return 0 on success, or -1 if gamma ramps are unsupported. * * \sa SDL_SetWindowGammaRamp() */ extern DECLSPEC int SDLCALL SDL_GetWindowGammaRamp(SDL_Window * window, Uint16 * red, Uint16 * green, Uint16 * blue); /** * \brief Possible return values from the SDL_HitTest callback. * * \sa SDL_HitTest */ typedef enum { SDL_HITTEST_NORMAL, /**< Region is normal. No special properties. */ SDL_HITTEST_DRAGGABLE, /**< Region can drag entire window. */ SDL_HITTEST_RESIZE_TOPLEFT, SDL_HITTEST_RESIZE_TOP, SDL_HITTEST_RESIZE_TOPRIGHT, SDL_HITTEST_RESIZE_RIGHT, SDL_HITTEST_RESIZE_BOTTOMRIGHT, SDL_HITTEST_RESIZE_BOTTOM, SDL_HITTEST_RESIZE_BOTTOMLEFT, SDL_HITTEST_RESIZE_LEFT } SDL_HitTestResult; /** * \brief Callback used for hit-testing. * * \sa SDL_SetWindowHitTest */ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, const SDL_Point *area, void *data); /** * \brief Provide a callback that decides if a window region has special properties. * * Normally windows are dragged and resized by decorations provided by the * system window manager (a title bar, borders, etc), but for some apps, it * makes sense to drag them from somewhere else inside the window itself; for * example, one might have a borderless window that wants to be draggable * from any part, or simulate its own title bar, etc. * * This function lets the app provide a callback that designates pieces of * a given window as special. This callback is run during event processing * if we need to tell the OS to treat a region of the window specially; the * use of this callback is known as "hit testing." * * Mouse input may not be delivered to your application if it is within * a special area; the OS will often apply that input to moving the window or * resizing the window and not deliver it to the application. * * Specifying NULL for a callback disables hit-testing. Hit-testing is * disabled by default. * * Platforms that don't support this functionality will return -1 * unconditionally, even if you're attempting to disable hit-testing. * * Your callback may fire at any time, and its firing does not indicate any * specific behavior (for example, on Windows, this certainly might fire * when the OS is deciding whether to drag your window, but it fires for lots * of other reasons, too, some unrelated to anything you probably care about * _and when the mouse isn't actually at the location it is testing_). * Since this can fire at any time, you should try to keep your callback * efficient, devoid of allocations, etc. * * \param window The window to set hit-testing on. * \param callback The callback to call when doing a hit-test. * \param callback_data An app-defined void pointer passed to the callback. * \return 0 on success, -1 on error (including unsupported). */ extern DECLSPEC int SDLCALL SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *callback_data); /** * \brief Destroy a window. */ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** * \brief Returns whether the screensaver is currently enabled (default off). * * \sa SDL_EnableScreenSaver() * \sa SDL_DisableScreenSaver() */ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenSaverEnabled(void); /** * \brief Allow the screen to be blanked by a screensaver * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_DisableScreenSaver() */ extern DECLSPEC void SDLCALL SDL_EnableScreenSaver(void); /** * \brief Prevent the screen from being blanked by a screensaver * * \sa SDL_IsScreenSaverEnabled() * \sa SDL_EnableScreenSaver() */ extern DECLSPEC void SDLCALL SDL_DisableScreenSaver(void); /** * \name OpenGL support functions */ /* @{ */ /** * \brief Dynamically load an OpenGL library. * * \param path The platform dependent OpenGL library name, or NULL to open the * default OpenGL library. * * \return 0 on success, or -1 if the library couldn't be loaded. * * This should be done after initializing the video driver, but before * creating any OpenGL windows. If no OpenGL library is loaded, the default * library will be loaded upon creation of the first OpenGL window. * * \note If you do this, you need to retrieve all of the GL functions used in * your program from the dynamic library using SDL_GL_GetProcAddress(). * * \sa SDL_GL_GetProcAddress() * \sa SDL_GL_UnloadLibrary() */ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path); /** * \brief Get the address of an OpenGL function. */ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); /** * \brief Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). * * \sa SDL_GL_LoadLibrary() */ extern DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); /** * \brief Return true if an OpenGL extension is supported for the current * context. */ extern DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); /** * \brief Reset all previously set OpenGL context attributes to their default values */ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. * * \return 0 on success, or -1 if the attribute could not be set. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. * * \return 0 on success, or -1 if the attribute could not be retrieved. * The integer at \c value will be modified in either case. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); /** * \brief Create an OpenGL context for use with an OpenGL window, and make it * current. * * \sa SDL_GL_DeleteContext() */ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window * window); /** * \brief Set up an OpenGL context for rendering into an OpenGL window. * * \note The context must have been created with a compatible window. */ extern DECLSPEC int SDLCALL SDL_GL_MakeCurrent(SDL_Window * window, SDL_GLContext context); /** * \brief Get the currently active OpenGL window. */ extern DECLSPEC SDL_Window* SDLCALL SDL_GL_GetCurrentWindow(void); /** * \brief Get the currently active OpenGL context. */ extern DECLSPEC SDL_GLContext SDLCALL SDL_GL_GetCurrentContext(void); /** * \brief Get the size of a window's underlying drawable in pixels (for use * with glViewport). * * \param window Window from which the drawable size should be queried * \param w Pointer to variable for storing the width in pixels, may be NULL * \param h Pointer to variable for storing the height in pixels, may be NULL * * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ extern DECLSPEC void SDLCALL SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h); /** * \brief Set the swap interval for the current OpenGL context. * * \param interval 0 for immediate updates, 1 for updates synchronized with the * vertical retrace. If the system supports it, you may * specify -1 to allow late swaps to happen immediately * instead of waiting for the next retrace. * * \return 0 on success, or -1 if setting the swap interval is not supported. * * \sa SDL_GL_GetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_SetSwapInterval(int interval); /** * \brief Get the swap interval for the current OpenGL context. * * \return 0 if there is no vertical retrace synchronization, 1 if the buffer * swap is synchronized with the vertical retrace, and -1 if late * swaps happen immediately instead of waiting for the next retrace. * If the system can't determine the swap interval, or there isn't a * valid current context, this will return 0 as a safe default. * * \sa SDL_GL_SetSwapInterval() */ extern DECLSPEC int SDLCALL SDL_GL_GetSwapInterval(void); /** * \brief Swap the OpenGL buffers for a window, if double-buffering is * supported. */ extern DECLSPEC void SDLCALL SDL_GL_SwapWindow(SDL_Window * window); /** * \brief Delete an OpenGL context. * * \sa SDL_GL_CreateContext() */ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); /* @} *//* OpenGL support functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_video_h_ */ /* vi: set ts=4 sw=4 expandtab: */
45,433
C
35.3472
143
0.656879
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_mouse.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_mouse.h * * Include file for SDL mouse event handling. */ #ifndef SDL_mouse_h_ #define SDL_mouse_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** * \brief Cursor types for SDL_CreateSystemCursor(). */ typedef enum { SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ SDL_SYSTEM_CURSOR_WAIT, /**< Wait */ SDL_SYSTEM_CURSOR_CROSSHAIR, /**< Crosshair */ SDL_SYSTEM_CURSOR_WAITARROW, /**< Small wait cursor (or Wait if not available) */ SDL_SYSTEM_CURSOR_SIZENWSE, /**< Double arrow pointing northwest and southeast */ SDL_SYSTEM_CURSOR_SIZENESW, /**< Double arrow pointing northeast and southwest */ SDL_SYSTEM_CURSOR_SIZEWE, /**< Double arrow pointing west and east */ SDL_SYSTEM_CURSOR_SIZENS, /**< Double arrow pointing north and south */ SDL_SYSTEM_CURSOR_SIZEALL, /**< Four pointed arrow pointing north, south, east, and west */ SDL_SYSTEM_CURSOR_NO, /**< Slashed circle or crossbones */ SDL_SYSTEM_CURSOR_HAND, /**< Hand */ SDL_NUM_SYSTEM_CURSORS } SDL_SystemCursor; /** * \brief Scroll direction types for the Scroll event */ typedef enum { SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */ SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */ } SDL_MouseWheelDirection; /* Function prototypes */ /** * \brief Get the window which currently has mouse focus. */ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void); /** * \brief Retrieve the current state of the mouse. * * The current button state is returned as a button bitmask, which can * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse cursor position relative to the focus window for the currently * selected mouse. You can pass NULL for either x or y. */ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y); /** * \brief Get the current state of the mouse, in relation to the desktop * * This works just like SDL_GetMouseState(), but the coordinates will be * reported relative to the top-left of the desktop. This can be useful if * you need to track the mouse outside of a specific window and * SDL_CaptureMouse() doesn't fit your needs. For example, it could be * useful if you need to track the mouse while dragging a window, where * coordinates relative to a window might not be in sync at all times. * * \note SDL_GetMouseState() returns the mouse position as SDL understands * it from the last pump of the event queue. This function, however, * queries the OS for the current mouse position, and as such, might * be a slightly less efficient function. Unless you know what you're * doing and have a good reason to use this function, you probably want * SDL_GetMouseState() instead. * * \param x Returns the current X coord, relative to the desktop. Can be NULL. * \param y Returns the current Y coord, relative to the desktop. Can be NULL. * \return The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros. * * \sa SDL_GetMouseState */ extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y); /** * \brief Retrieve the relative state of the mouse. * * The current button state is returned as a button bitmask, which can * be tested using the SDL_BUTTON(X) macros, and x and y are set to the * mouse deltas since the last call to SDL_GetRelativeMouseState(). */ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y); /** * \brief Moves the mouse to the given position within the window. * * \param window The window to move the mouse into, or NULL for the current mouse focus * \param x The x coordinate within the window * \param y The y coordinate within the window * * \note This function generates a mouse motion event */ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, int x, int y); /** * \brief Moves the mouse to the given position in global screen space. * * \param x The x coordinate * \param y The y coordinate * \return 0 on success, -1 on error (usually: unsupported by a platform). * * \note This function generates a mouse motion event */ extern DECLSPEC int SDLCALL SDL_WarpMouseGlobal(int x, int y); /** * \brief Set relative mouse mode. * * \param enabled Whether or not to enable relative mode * * \return 0 on success, or -1 if relative mode is not supported. * * While the mouse is in relative mode, the cursor is hidden, and the * driver will try to report continuous motion in the current window. * Only relative motion events will be delivered, the mouse position * will not change. * * \note This function will flush any pending mouse motion. * * \sa SDL_GetRelativeMouseMode() */ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled); /** * \brief Capture the mouse, to track input outside an SDL window. * * \param enabled Whether or not to enable capturing * * Capturing enables your app to obtain mouse events globally, instead of * just within your window. Not all video targets support this function. * When capturing is enabled, the current window will get all mouse events, * but unlike relative mode, no change is made to the cursor and it is * not restrained to your window. * * This function may also deny mouse input to other windows--both those in * your application and others on the system--so you should use this * function sparingly, and in small bursts. For example, you might want to * track the mouse while the user is dragging something, until the user * releases a mouse button. It is not recommended that you capture the mouse * for long periods of time, such as the entire time your app is running. * * While captured, mouse events still report coordinates relative to the * current (foreground) window, but those coordinates may be outside the * bounds of the window (including negative values). Capturing is only * allowed for the foreground window. If the window loses focus while * capturing, the capture will be disabled automatically. * * While capturing is enabled, the current window will have the * SDL_WINDOW_MOUSE_CAPTURE flag set. * * \return 0 on success, or -1 if not supported. */ extern DECLSPEC int SDLCALL SDL_CaptureMouse(SDL_bool enabled); /** * \brief Query whether relative mouse mode is enabled. * * \sa SDL_SetRelativeMouseMode() */ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void); /** * \brief Create a cursor, using the specified bitmap data and * mask (in MSB format). * * The cursor width must be a multiple of 8 bits. * * The cursor is created in black and white according to the following: * <table> * <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr> * <tr><td> 0 </td><td> 1 </td><td> White </td></tr> * <tr><td> 1 </td><td> 1 </td><td> Black </td></tr> * <tr><td> 0 </td><td> 0 </td><td> Transparent </td></tr> * <tr><td> 1 </td><td> 0 </td><td> Inverted color if possible, black * if not. </td></tr> * </table> * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data, const Uint8 * mask, int w, int h, int hot_x, int hot_y); /** * \brief Create a color cursor. * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y); /** * \brief Create a system cursor. * * \sa SDL_FreeCursor() */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id); /** * \brief Set the active cursor. */ extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor * cursor); /** * \brief Return the active cursor. */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); /** * \brief Return the default cursor. */ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); /** * \brief Frees a cursor created with SDL_CreateCursor() or similar functions. * * \sa SDL_CreateCursor() * \sa SDL_CreateColorCursor() * \sa SDL_CreateSystemCursor() */ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); /** * \brief Toggle whether or not the cursor is shown. * * \param toggle 1 to show the cursor, 0 to hide it, -1 to query the current * state. * * \return 1 if the cursor is shown, or 0 if the cursor is hidden. */ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); /** * Used as a mask when testing buttons in buttonstate. * - Button 1: Left mouse button * - Button 2: Middle mouse button * - Button 3: Right mouse button */ #define SDL_BUTTON(X) (1 << ((X)-1)) #define SDL_BUTTON_LEFT 1 #define SDL_BUTTON_MIDDLE 2 #define SDL_BUTTON_RIGHT 3 #define SDL_BUTTON_X1 4 #define SDL_BUTTON_X2 5 #define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) #define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) #define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) #define SDL_BUTTON_X1MASK SDL_BUTTON(SDL_BUTTON_X1) #define SDL_BUTTON_X2MASK SDL_BUTTON(SDL_BUTTON_X2) /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */
10,924
C
35.056105
102
0.676218
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_test_common.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_test_common.h * * Include file for SDL test framework. * * This code is a part of the SDL2_test library, not the main SDL library. */ /* Ported from original test\common.h file. */ #ifndef SDL_test_common_h_ #define SDL_test_common_h_ #include "SDL.h" #if defined(__PSP__) #define DEFAULT_WINDOW_WIDTH 480 #define DEFAULT_WINDOW_HEIGHT 272 #else #define DEFAULT_WINDOW_WIDTH 640 #define DEFAULT_WINDOW_HEIGHT 480 #endif #define VERBOSE_VIDEO 0x00000001 #define VERBOSE_MODES 0x00000002 #define VERBOSE_RENDER 0x00000004 #define VERBOSE_EVENT 0x00000008 #define VERBOSE_AUDIO 0x00000010 typedef struct { /* SDL init flags */ char **argv; Uint32 flags; Uint32 verbose; /* Video info */ const char *videodriver; int display; const char *window_title; const char *window_icon; Uint32 window_flags; int window_x; int window_y; int window_w; int window_h; int window_minW; int window_minH; int window_maxW; int window_maxH; int logical_w; int logical_h; float scale; int depth; int refresh_rate; int num_windows; SDL_Window **windows; /* Renderer info */ const char *renderdriver; Uint32 render_flags; SDL_bool skip_renderer; SDL_Renderer **renderers; SDL_Texture **targets; /* Audio info */ const char *audiodriver; SDL_AudioSpec audiospec; /* GL settings */ int gl_red_size; int gl_green_size; int gl_blue_size; int gl_alpha_size; int gl_buffer_size; int gl_depth_size; int gl_stencil_size; int gl_double_buffer; int gl_accum_red_size; int gl_accum_green_size; int gl_accum_blue_size; int gl_accum_alpha_size; int gl_stereo; int gl_multisamplebuffers; int gl_multisamplesamples; int gl_retained_backing; int gl_accelerated; int gl_major_version; int gl_minor_version; int gl_debug; int gl_profile_mask; } SDLTest_CommonState; #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* Function prototypes */ /** * \brief Parse command line parameters and create common state. * * \param argv Array of command line parameters * \param flags Flags indicating which subsystem to initialize (i.e. SDL_INIT_VIDEO | SDL_INIT_AUDIO) * * \returns Returns a newly allocated common state object. */ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); /** * \brief Process one common argument. * * \param state The common state describing the test window to create. * \param index The index of the argument to process in argv[]. * * \returns The number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. */ int SDLTest_CommonArg(SDLTest_CommonState * state, int index); /** * \brief Returns common usage information * * \param state The common state describing the test window to create. * * \returns String with usage information */ const char *SDLTest_CommonUsage(SDLTest_CommonState * state); /** * \brief Open test window. * * \param state The common state describing the test window to create. * * \returns True if initialization succeeded, false otherwise */ SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); /** * \brief Common event handler for test windows. * * \param state The common state used to create test window. * \param event The event to handle. * \param done Flag indicating we are done. * */ void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); /** * \brief Close test window. * * \param state The common state used to create test window. * */ void SDLTest_CommonQuit(SDLTest_CommonState * state); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_test_common_h_ */ /* vi: set ts=4 sw=4 expandtab: */
4,906
C
24.962963
116
0.700163
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_opengles2.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_opengles2.h * * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. */ #include "SDL_config.h" #ifndef _MSC_VER #ifdef __IPHONEOS__ #include <OpenGLES/ES2/gl.h> #include <OpenGLES/ES2/glext.h> #else #include <GLES2/gl2platform.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> #endif #else /* _MSC_VER */ /* OpenGL ES2 headers for Visual Studio */ #include "SDL_opengles2_khrplatform.h" #include "SDL_opengles2_gl2platform.h" #include "SDL_opengles2_gl2.h" #include "SDL_opengles2_gl2ext.h" #endif /* _MSC_VER */ #ifndef APIENTRY #define APIENTRY GL_APIENTRY #endif
1,552
C
28.301886
76
0.740979
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_power.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_power_h_ #define SDL_power_h_ /** * \file SDL_power.h * * Header for the SDL power management routines. */ #include "SDL_stdinc.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief The basic state for the system's power supply. */ typedef enum { SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */ SDL_POWERSTATE_CHARGING, /**< Plugged in, charging battery */ SDL_POWERSTATE_CHARGED /**< Plugged in, battery charged */ } SDL_PowerState; /** * \brief Get the current power supply details. * * \param secs Seconds of battery life left. You can pass a NULL here if * you don't care. Will return -1 if we can't determine a * value, or we're not running on a battery. * * \param pct Percentage of battery life left, between 0 and 100. You can * pass a NULL here if you don't care. Will return -1 if we * can't determine a value, or we're not running on a battery. * * \return The state of the battery (if any). */ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_power_h_ */ /* vi: set ts=4 sw=4 expandtab: */
2,463
C
31.421052
79
0.691433
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_rwops.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_rwops.h * * This file provides a general interface for SDL to read and write * data streams. It can easily be extended to files, memory, etc. */ #ifndef SDL_rwops_h_ #define SDL_rwops_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /* RWops Types */ #define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ #define SDL_RWOPS_WINFILE 1U /**< Win32 file */ #define SDL_RWOPS_STDFILE 2U /**< Stdio file */ #define SDL_RWOPS_JNIFILE 3U /**< Android asset */ #define SDL_RWOPS_MEMORY 4U /**< Memory stream */ #define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. */ typedef struct SDL_RWops { /** * Return the size of the file in this rwops, or -1 if unknown */ Sint64 (SDLCALL * size) (struct SDL_RWops * context); /** * Seek to \c offset relative to \c whence, one of stdio's whence values: * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END * * \return the final offset in the data stream, or -1 on error. */ Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset, int whence); /** * Read up to \c maxnum objects each of size \c size from the data * stream to the area pointed at by \c ptr. * * \return the number of objects read, or 0 at error or end of file. */ size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr, size_t size, size_t maxnum); /** * Write exactly \c num objects each of size \c size from the area * pointed at by \c ptr to data stream. * * \return the number of objects written, or 0 at error or end of file. */ size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr, size_t size, size_t num); /** * Close and free an allocated SDL_RWops structure. * * \return 0 if successful or -1 on write error when flushing data. */ int (SDLCALL * close) (struct SDL_RWops * context); Uint32 type; union { #if defined(__ANDROID__) struct { void *fileNameRef; void *inputStreamRef; void *readableByteChannelRef; void *readMethod; void *assetFileDescriptorRef; long position; long size; long offset; int fd; } androidio; #elif defined(__WIN32__) struct { SDL_bool append; void *h; struct { void *data; size_t size; size_t left; } buffer; } windowsio; #endif #ifdef HAVE_STDIO_H struct { SDL_bool autoclose; FILE *fp; } stdio; #endif struct { Uint8 *base; Uint8 *here; Uint8 *stop; } mem; struct { void *data1; void *data2; } unknown; } hidden; } SDL_RWops; /** * \name RWFrom functions * * Functions to create SDL_RWops structures from various data streams. */ /* @{ */ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFile(const char *file, const char *mode); #ifdef HAVE_STDIO_H extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose); #else extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp, SDL_bool autoclose); #endif extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size); extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromConstMem(const void *mem, int size); /* @} *//* RWFrom functions */ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); #define RW_SEEK_SET 0 /**< Seek from the beginning of data */ #define RW_SEEK_CUR 1 /**< Seek relative to current read point */ #define RW_SEEK_END 2 /**< Seek relative to the end of data */ /** * \name Read/write macros * * Macros to easily read and write from an SDL_RWops structure. */ /* @{ */ #define SDL_RWsize(ctx) (ctx)->size(ctx) #define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) #define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR) #define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) #define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) #define SDL_RWclose(ctx) (ctx)->close(ctx) /* @} *//* Read/write macros */ /** * Load all the data from an SDL data stream. * * The data is allocated with a zero byte at the end (null terminated) * * If \c datasize is not NULL, it is filled with the size of the data read. * * If \c freesrc is non-zero, the stream will be closed after being read. * * The data should be freed with SDL_free(). * * \return the data, or NULL if there was an error. */ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc); /** * Load an entire file. * * Convenience macro. */ #define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) /** * \name Read endian functions * * Read an item of the specified endianness and return in native format. */ /* @{ */ extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src); extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src); extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src); extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src); extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src); extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src); /* @} *//* Read endian functions */ /** * \name Write endian functions * * Write an item of native format to the specified endianness. */ /* @{ */ extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value); extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value); extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); /* @} *//* Write endian functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_rwops_h_ */ /* vi: set ts=4 sw=4 expandtab: */
7,951
C
30.184314
95
0.618035
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_shape.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_shape_h_ #define SDL_shape_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" #include "SDL_rect.h" #include "SDL_surface.h" #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** \file SDL_shape.h * * Header file for the shaped window API. */ #define SDL_NONSHAPEABLE_WINDOW -1 #define SDL_INVALID_SHAPE_ARGUMENT -2 #define SDL_WINDOW_LACKS_SHAPE -3 /** * \brief Create a window that can be shaped with the specified position, dimensions, and flags. * * \param title The title of the window, in UTF-8 encoding. * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or * ::SDL_WINDOWPOS_UNDEFINED. * \param w The width of the window. * \param h The height of the window. * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: * ::SDL_WINDOW_OPENGL, ::SDL_WINDOW_INPUT_GRABBED, * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_RESIZABLE, * ::SDL_WINDOW_MAXIMIZED, ::SDL_WINDOW_MINIMIZED, * ::SDL_WINDOW_BORDERLESS is always set, and ::SDL_WINDOW_FULLSCREEN is always unset. * * \return The window created, or NULL if window creation failed. * * \sa SDL_DestroyWindow() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); /** * \brief Return whether the given window is a shaped window. * * \param window The window to query for being shaped. * * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. * * \sa SDL_CreateShapedWindow */ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); /** \brief An enum denoting the specific type of contents present in an SDL_WindowShapeParams union. */ typedef enum { /** \brief The default mode, a binarized alpha cutoff of 1. */ ShapeModeDefault, /** \brief A binarized alpha cutoff with a given integer value. */ ShapeModeBinarizeAlpha, /** \brief A binarized alpha cutoff with a given integer value, but with the opposite comparison. */ ShapeModeReverseBinarizeAlpha, /** \brief A color key is applied. */ ShapeModeColorKey } WindowShapeMode; #define SDL_SHAPEMODEALPHA(mode) (mode == ShapeModeDefault || mode == ShapeModeBinarizeAlpha || mode == ShapeModeReverseBinarizeAlpha) /** \brief A union containing parameters for shaped windows. */ typedef union { /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ Uint8 binarizationCutoff; SDL_Color colorKey; } SDL_WindowShapeParams; /** \brief A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents. */ typedef struct SDL_WindowShapeMode { /** \brief The mode of these window-shape parameters. */ WindowShapeMode mode; /** \brief Window-shape parameters. */ SDL_WindowShapeParams parameters; } SDL_WindowShapeMode; /** * \brief Set the shape and parameters of a shaped window. * * \param window The shaped window whose parameters should be set. * \param shape A surface encoding the desired shape for the window. * \param shape_mode The parameters to set for the shaped window. * * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW * if the SDL_Window given does not reference a valid shaped window. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode. */ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); /** * \brief Get the shape parameters of a shaped window. * * \param window The shaped window whose parameters should be retrieved. * \param shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape. * * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if * the SDL_Window given is a shapeable window currently lacking a shape. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape */ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_WindowShapeMode *shape_mode); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_shape_h_ */
5,681
C
38.186207
152
0.718711
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_gamecontroller.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_gamecontroller.h * * Include file for SDL game controller event handling */ #ifndef SDL_gamecontroller_h_ #define SDL_gamecontroller_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_rwops.h" #include "SDL_joystick.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \file SDL_gamecontroller.h * * In order to use these functions, SDL_Init() must have been called * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system * for game controllers, and load appropriate drivers. * * If you would like to receive controller updates while the application * is in the background, you should set the following hint before calling * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ /** * The gamecontroller structure used to identify an SDL game controller */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; typedef enum { SDL_CONTROLLER_BINDTYPE_NONE = 0, SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_AXIS, SDL_CONTROLLER_BINDTYPE_HAT } SDL_GameControllerBindType; /** * Get the SDL joystick layer binding for this controller button/axis mapping */ typedef struct SDL_GameControllerButtonBind { SDL_GameControllerBindType bindType; union { int button; int axis; struct { int hat; int hat_mask; } hat; } value; } SDL_GameControllerButtonBind; /** * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; * for (int i = 0; i < nJoysticks; i++) { * if (SDL_IsGameController(i)) { * nGameControllers++; * } * } * * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: * guid,name,mappings * * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. * Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. * The mapping format for joystick is: * bX - a joystick button, index X * hX.Y - hat X with value Y * aX - axis X of the joystick * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ /** * Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() * A community sourced database of controllers is available at https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt * * If \c freerw is non-zero, the stream will be closed after being read. * * \return number of mappings added, -1 on error */ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() * * Convenience macro. */ #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) /** * Add or update an existing mapping configuration * * \return 1 if mapping is added, 0 if updated, -1 on error */ extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); /** * Get the number of mappings installed * * \return the number of mappings */ extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); /** * Get the mapping at a particular index. * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. */ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); /** * Get a mapping string for a GUID * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); /** * Get a mapping string for an open GameController * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. * If no name can be found, this function returns NULL. */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. * This index is not the value which will identify this controller in future * controller events. The joystick's instance id (::SDL_JoystickID) will be * used there instead. * * \return A controller identifier, or NULL if an error occurred. */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_index); /** * Return the SDL_GameController associated with an instance id. */ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid); /** * Return the name for this currently opened controller */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); /** * Get the USB vendor ID of an opened controller, if available. * If the vendor ID isn't available this function returns 0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); /** * Get the USB product ID of an opened controller, if available. * If the product ID isn't available this function returns 0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); /** * Get the product version of an opened controller, if available. * If the product version isn't available this function returns 0. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. */ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameController *gamecontroller); /** * Get the underlying joystick object used by a controller */ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameController *gamecontroller); /** * Enable/disable controller event polling. * * If controller events are disabled, you must call SDL_GameControllerUpdate() * yourself and check the state of the controller when you want controller * information. * * The state can be one of ::SDL_QUERY, ::SDL_ENABLE or ::SDL_IGNORE. */ extern DECLSPEC int SDLCALL SDL_GameControllerEventState(int state); /** * Update the current state of the open game controllers. * * This is called automatically by the event loop if any game controller * events are enabled. */ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller * * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, * and are centered within ~8000 of zero, though advanced UI will allow users to set * or autodetect the dead zone, which varies between controllers. * * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. */ typedef enum { SDL_CONTROLLER_AXIS_INVALID = -1, SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_LEFTY, SDL_CONTROLLER_AXIS_RIGHTX, SDL_CONTROLLER_AXIS_RIGHTY, SDL_CONTROLLER_AXIS_TRIGGERLEFT, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, SDL_CONTROLLER_AXIS_MAX } SDL_GameControllerAxis; /** * turn this string into a axis mapping */ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); /** * turn this axis enum into a string mapping */ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis); /** * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); /** * Get the current state of an axis control on a game controller. * * The state is a value ranging from -32768 to 32767 (except for the triggers, * which range from 0 to 32767). * * The axis indices start at index 0. */ extern DECLSPEC Sint16 SDLCALL SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); /** * The list of buttons available from a controller */ typedef enum { SDL_CONTROLLER_BUTTON_INVALID = -1, SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_X, SDL_CONTROLLER_BUTTON_Y, SDL_CONTROLLER_BUTTON_BACK, SDL_CONTROLLER_BUTTON_GUIDE, SDL_CONTROLLER_BUTTON_START, SDL_CONTROLLER_BUTTON_LEFTSTICK, SDL_CONTROLLER_BUTTON_RIGHTSTICK, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_MAX } SDL_GameControllerButton; /** * turn this string into a button mapping */ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFromString(const char *pchString); /** * turn this button enum into a string mapping */ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_GameControllerButton button); /** * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); /** * Get the current state of a button on a game controller. * * The button indices start at index 0. */ extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); /** * Close a controller previously opened with SDL_GameControllerOpen(). */ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecontroller); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_gamecontroller_h_ */ /* vi: set ts=4 sw=4 expandtab: */
12,233
C
32.702479
279
0.735306
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/begin_code.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file begin_code.h * * This file sets things up for C dynamic library function definitions, * static inlined functions, and structures aligned at 4-byte alignment. * If you don't like ugly C preprocessor code, don't look at this file. :) */ /* This shouldn't be nested -- included it around code only. */ #ifdef _begin_code_h #error Nested inclusion of begin_code.h #endif #define _begin_code_h #ifndef SDL_DEPRECATED # if (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) # else # define SDL_DEPRECATED # endif #endif #ifndef SDL_UNUSED # ifdef __GNUC__ # define SDL_UNUSED __attribute__((unused)) # else # define SDL_UNUSED # endif #endif /* Some compilers use a special export keyword */ #ifndef DECLSPEC # if defined(__WIN32__) || defined(__WINRT__) # ifdef __BORLANDC__ # ifdef BUILD_SDL # define DECLSPEC # else # define DECLSPEC __declspec(dllimport) # endif # else # define DECLSPEC __declspec(dllexport) # endif # elif defined(__OS2__) # ifdef BUILD_SDL # define DECLSPEC __declspec(dllexport) # else # define DECLSPEC # endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) # else # define DECLSPEC # endif # endif #endif /* By default SDL uses the C calling convention */ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl #elif defined(__OS2__) || defined(__EMX__) #define SDLCALL _System # if defined (__GNUC__) && !defined(_System) # define _System /* for old EMX/GCC compat. */ # endif #else #define SDLCALL #endif #endif /* SDLCALL */ /* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */ #ifdef __SYMBIAN32__ #undef DECLSPEC #define DECLSPEC #endif /* __SYMBIAN32__ */ /* Force structure packing at 4 byte alignment. This is necessary if the header is included in code which has structure packing set to an alternate value, say for loading structures from disk. The packing is reset to the previous value in close_code.h */ #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef _MSC_VER #pragma warning(disable: 4103) #endif #ifdef __BORLANDC__ #pragma nopackwarning #endif #ifdef _M_X64 /* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */ #pragma pack(push,8) #else #pragma pack(push,4) #endif #endif /* Compiler needs structure packing set */ #ifndef SDL_INLINE #if defined(__GNUC__) #define SDL_INLINE __inline__ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ defined(__DECC) || defined(__CC_ARM) #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline #endif #else #define SDL_INLINE inline #ifndef __inline__ #define __inline__ inline #endif #endif #endif /* SDL_INLINE not defined */ #ifndef SDL_FORCE_INLINE #if defined(_MSC_VER) #define SDL_FORCE_INLINE __forceinline #elif ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) ) #define SDL_FORCE_INLINE __attribute__((always_inline)) static __inline__ #else #define SDL_FORCE_INLINE static SDL_INLINE #endif #endif /* SDL_FORCE_INLINE not defined */ #ifndef SDL_NORETURN #if defined(__GNUC__) #define SDL_NORETURN __attribute__((noreturn)) #elif defined(_MSC_VER) #define SDL_NORETURN __declspec(noreturn) #else #define SDL_NORETURN #endif #endif /* SDL_NORETURN not defined */ /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #endif /* NULL */ #endif /* ! Mac OS X - breaks precompiled headers */
4,731
C
27.166667
79
0.689918
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_mutex.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef SDL_mutex_h_ #define SDL_mutex_h_ /** * \file SDL_mutex.h * * Functions to provide thread synchronization primitives. */ #include "SDL_stdinc.h" #include "SDL_error.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * Synchronization functions which can time out return this value * if they time out. */ #define SDL_MUTEX_TIMEDOUT 1 /** * This is the timeout value which corresponds to never time out. */ #define SDL_MUTEX_MAXWAIT (~(Uint32)0) /** * \name Mutex functions */ /* @{ */ /* The SDL mutex structure, defined in SDL_sysmutex.c */ struct SDL_mutex; typedef struct SDL_mutex SDL_mutex; /** * Create a mutex, initialized unlocked. */ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void); /** * Lock the mutex. * * \return 0, or -1 on error. */ #define SDL_mutexP(m) SDL_LockMutex(m) extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex); /** * Try to lock the mutex * * \return 0, SDL_MUTEX_TIMEDOUT, or -1 on error */ extern DECLSPEC int SDLCALL SDL_TryLockMutex(SDL_mutex * mutex); /** * Unlock the mutex. * * \return 0, or -1 on error. * * \warning It is an error to unlock a mutex that has not been locked by * the current thread, and doing so results in undefined behavior. */ #define SDL_mutexV(m) SDL_UnlockMutex(m) extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex); /** * Destroy a mutex. */ extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex * mutex); /* @} *//* Mutex functions */ /** * \name Semaphore functions */ /* @{ */ /* The SDL semaphore structure, defined in SDL_syssem.c */ struct SDL_semaphore; typedef struct SDL_semaphore SDL_sem; /** * Create a semaphore, initialized with value, returns NULL on failure. */ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value); /** * Destroy a semaphore. */ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem); /** * This function suspends the calling thread until the semaphore pointed * to by \c sem has a positive count. It then atomically decreases the * semaphore count. */ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem); /** * Non-blocking variant of SDL_SemWait(). * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait would * block, and -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem); /** * Variant of SDL_SemWait() with a timeout in milliseconds. * * \return 0 if the wait succeeds, ::SDL_MUTEX_TIMEDOUT if the wait does not * succeed in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem * sem, Uint32 ms); /** * Atomically increases the semaphore's count (not blocking). * * \return 0, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem); /** * Returns the current count of the semaphore. */ extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem * sem); /* @} *//* Semaphore functions */ /** * \name Condition variable functions */ /* @{ */ /* The SDL condition variable structure, defined in SDL_syscond.c */ struct SDL_cond; typedef struct SDL_cond SDL_cond; /** * Create a condition variable. * * Typical use of condition variables: * * Thread A: * SDL_LockMutex(lock); * while ( ! condition ) { * SDL_CondWait(cond, lock); * } * SDL_UnlockMutex(lock); * * Thread B: * SDL_LockMutex(lock); * ... * condition = true; * ... * SDL_CondSignal(cond); * SDL_UnlockMutex(lock); * * There is some discussion whether to signal the condition variable * with the mutex locked or not. There is some potential performance * benefit to unlocking first on some platforms, but there are some * potential race conditions depending on how your code is structured. * * In general it's safer to signal the condition variable while the * mutex is locked. */ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void); /** * Destroy a condition variable. */ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond); /** * Restart one of the threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond); /** * Restart all threads that are waiting on the condition variable. * * \return 0 or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond); /** * Wait on the condition variable, unlocking the provided mutex. * * \warning The mutex must be locked before entering this function! * * The mutex is re-locked once the condition variable is signaled. * * \return 0 when it is signaled, or -1 on error. */ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex); /** * Waits for at most \c ms milliseconds, and returns 0 if the condition * variable is signaled, ::SDL_MUTEX_TIMEDOUT if the condition is not * signaled in the allotted time, and -1 on error. * * \warning On some platforms this function is implemented by looping with a * delay of 1 ms, and so should be avoided if possible. */ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms); /* @} *//* Condition variable functions */ /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_mutex_h_ */ /* vi: set ts=4 sw=4 expandtab: */
6,665
C
25.452381
78
0.686572
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/sources/thirdparty/sdl2/SDL2/SDL_render.h
/* Simple DirectMedia Layer Copyright (C) 1997-2018 Sam Lantinga <[email protected]> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /** * \file SDL_render.h * * Header file for SDL 2D rendering functions. * * This API supports the following features: * * single pixel points * * single pixel lines * * filled rectangles * * texture images * * The primitives may be drawn in opaque, blended, or additive modes. * * The texture images may be drawn in opaque, blended, or additive modes. * They can have an additional color tint or alpha modulation applied to * them, and may also be stretched with linear interpolation. * * This API is designed to accelerate simple 2D operations. You may * want more functionality such as polygons and particle effects and * in that case you should use SDL's OpenGL/Direct3D support or one * of the many good 3D engines. * * These functions must be called from the main thread. * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ #ifndef SDL_render_h_ #define SDL_render_h_ #include "SDL_stdinc.h" #include "SDL_rect.h" #include "SDL_video.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { #endif /** * \brief Flags used when creating a rendering context */ typedef enum { SDL_RENDERER_SOFTWARE = 0x00000001, /**< The renderer is a software fallback */ SDL_RENDERER_ACCELERATED = 0x00000002, /**< The renderer uses hardware acceleration */ SDL_RENDERER_PRESENTVSYNC = 0x00000004, /**< Present is synchronized with the refresh rate */ SDL_RENDERER_TARGETTEXTURE = 0x00000008 /**< The renderer supports rendering to texture */ } SDL_RendererFlags; /** * \brief Information on the capabilities of a render driver or context. */ typedef struct SDL_RendererInfo { const char *name; /**< The name of the renderer */ Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 texture_formats[16]; /**< The available texture formats */ int max_texture_width; /**< The maximum texture width */ int max_texture_height; /**< The maximum texture height */ } SDL_RendererInfo; /** * \brief The access pattern allowed for a texture. */ typedef enum { SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */ SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */ SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */ } SDL_TextureAccess; /** * \brief The texture channel modulation used in SDL_RenderCopy(). */ typedef enum { SDL_TEXTUREMODULATE_NONE = 0x00000000, /**< No modulation */ SDL_TEXTUREMODULATE_COLOR = 0x00000001, /**< srcC = srcC * color */ SDL_TEXTUREMODULATE_ALPHA = 0x00000002 /**< srcA = srcA * alpha */ } SDL_TextureModulate; /** * \brief Flip constants for SDL_RenderCopyEx */ typedef enum { SDL_FLIP_NONE = 0x00000000, /**< Do not flip */ SDL_FLIP_HORIZONTAL = 0x00000001, /**< flip horizontally */ SDL_FLIP_VERTICAL = 0x00000002 /**< flip vertically */ } SDL_RendererFlip; /** * \brief A structure representing rendering state */ struct SDL_Renderer; typedef struct SDL_Renderer SDL_Renderer; /** * \brief An efficient driver-specific representation of pixel data */ struct SDL_Texture; typedef struct SDL_Texture SDL_Texture; /* Function prototypes */ /** * \brief Get the number of 2D rendering drivers available for the current * display. * * A render driver is a set of code that handles rendering and texture * management on a particular display. Normally there is only one, but * some drivers may have several available with different capabilities. * * \sa SDL_GetRenderDriverInfo() * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void); /** * \brief Get information about a specific 2D rendering driver for the current * display. * * \param index The index of the driver to query information about. * \param info A pointer to an SDL_RendererInfo struct to be filled with * information on the rendering driver. * * \return 0 on success, -1 if the index was out of range. * * \sa SDL_CreateRenderer() */ extern DECLSPEC int SDLCALL SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info); /** * \brief Create a window and default renderer * * \param width The width of the window * \param height The height of the window * \param window_flags The flags used to create the window * \param window A pointer filled with the window, or NULL on error * \param renderer A pointer filled with the renderer, or NULL on error * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer( int width, int height, Uint32 window_flags, SDL_Window **window, SDL_Renderer **renderer); /** * \brief Create a 2D rendering context for a window. * * \param window The window where rendering is displayed. * \param index The index of the rendering driver to initialize, or -1 to * initialize the first one supporting the requested flags. * \param flags ::SDL_RendererFlags. * * \return A valid rendering context or NULL if there was an error. * * \sa SDL_CreateSoftwareRenderer() * \sa SDL_GetRendererInfo() * \sa SDL_DestroyRenderer() */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags); /** * \brief Create a 2D software rendering context for a surface. * * \param surface The surface where rendering is done. * * \return A valid rendering context or NULL if there was an error. * * \sa SDL_CreateRenderer() * \sa SDL_DestroyRenderer() */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface * surface); /** * \brief Get the renderer associated with a window. */ extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window); /** * \brief Get information about a rendering context. */ extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer, SDL_RendererInfo * info); /** * \brief Get the output size in pixels of a rendering context. */ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h); /** * \brief Create a texture for a rendering context. * * \param renderer The renderer. * \param format The format of the texture. * \param access One of the enumerated values in ::SDL_TextureAccess. * \param w The width of the texture in pixels. * \param h The height of the texture in pixels. * * \return The created texture is returned, or NULL if no rendering context was * active, the format was unsupported, or the width or height were out * of range. * * \note The contents of the texture are not defined at creation. * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int h); /** * \brief Create a texture from an existing surface. * * \param renderer The renderer. * \param surface The surface containing pixel data used to fill the texture. * * \return The created texture is returned, or NULL on error. * * \note The surface is not modified or freed by this function. * * \sa SDL_QueryTexture() * \sa SDL_DestroyTexture() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface); /** * \brief Query the attributes of a texture * * \param texture A texture to be queried. * \param format A pointer filled in with the raw format of the texture. The * actual format may differ, but pixel transfers will use this * format. * \param access A pointer filled in with the actual access to the texture. * \param w A pointer filled in with the width of the texture in pixels. * \param h A pointer filled in with the height of the texture in pixels. * * \return 0 on success, or -1 if the texture is not valid. */ extern DECLSPEC int SDLCALL SDL_QueryTexture(SDL_Texture * texture, Uint32 * format, int *access, int *w, int *h); /** * \brief Set an additional color value used in render copy operations. * * \param texture The texture to update. * \param r The red color value multiplied into copy operations. * \param g The green color value multiplied into copy operations. * \param b The blue color value multiplied into copy operations. * * \return 0 on success, or -1 if the texture is not valid or color modulation * is not supported. * * \sa SDL_GetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b); /** * \brief Get the additional color value used in render copy operations. * * \param texture The texture to query. * \param r A pointer filled in with the current red color value. * \param g A pointer filled in with the current green color value. * \param b A pointer filled in with the current blue color value. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureColorMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b); /** * \brief Set an additional alpha value used in render copy operations. * * \param texture The texture to update. * \param alpha The alpha value multiplied into copy operations. * * \return 0 on success, or -1 if the texture is not valid or alpha modulation * is not supported. * * \sa SDL_GetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha); /** * \brief Get the additional alpha value used in render copy operations. * * \param texture The texture to query. * \param alpha A pointer filled in with the current alpha value. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureAlphaMod() */ extern DECLSPEC int SDLCALL SDL_GetTextureAlphaMod(SDL_Texture * texture, Uint8 * alpha); /** * \brief Set the blend mode used for texture copy operations. * * \param texture The texture to update. * \param blendMode ::SDL_BlendMode to use for texture blending. * * \return 0 on success, or -1 if the texture is not valid or the blend mode is * not supported. * * \note If the blend mode is not supported, the closest supported mode is * chosen. * * \sa SDL_GetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode); /** * \brief Get the blend mode used for texture copy operations. * * \param texture The texture to query. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 if the texture is not valid. * * \sa SDL_SetTextureBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode *blendMode); /** * \brief Update the given texture rectangle with new pixel data. * * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param pixels The raw pixel data in the format of the texture. * \param pitch The number of bytes in a row of pixel data, including padding between lines. * * The pixel data must be in the format of the texture. The pixel format can be * queried with SDL_QueryTexture. * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. */ extern DECLSPEC int SDLCALL SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); /** * \brief Update a rectangle within a planar YV12 or IYUV texture with new pixel data. * * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. * \param Yplane The raw pixel data for the Y plane. * \param Ypitch The number of bytes between rows of pixel data for the Y plane. * \param Uplane The raw pixel data for the U plane. * \param Upitch The number of bytes between rows of pixel data for the U plane. * \param Vplane The raw pixel data for the V plane. * \param Vpitch The number of bytes between rows of pixel data for the V plane. * * \return 0 on success, or -1 if the texture is not valid. * * \note You can use SDL_UpdateTexture() as long as your pixel data is * a contiguous block of Y and U/V planes in the proper order, but * this function is available if your pixel data is not contiguous. */ extern DECLSPEC int SDLCALL SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch); /** * \brief Lock a portion of the texture for write-only pixel access. * * \param texture The texture to lock for access, which was created with * ::SDL_TEXTUREACCESS_STREAMING. * \param rect A pointer to the rectangle to lock for access. If the rect * is NULL, the entire texture will be locked. * \param pixels This is filled in with a pointer to the locked pixels, * appropriately offset by the locked area. * \param pitch This is filled in with the pitch of the locked pixels. * * \return 0 on success, or -1 if the texture is not valid or was not created with ::SDL_TEXTUREACCESS_STREAMING. * * \sa SDL_UnlockTexture() */ extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture * texture, const SDL_Rect * rect, void **pixels, int *pitch); /** * \brief Unlock a texture, uploading the changes to video memory, if needed. * * \sa SDL_LockTexture() */ extern DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture * texture); /** * \brief Determines whether a window supports the use of render targets * * \param renderer The renderer that will be checked * * \return SDL_TRUE if supported, SDL_FALSE if not. */ extern DECLSPEC SDL_bool SDLCALL SDL_RenderTargetSupported(SDL_Renderer *renderer); /** * \brief Set a texture as the current rendering target. * * \param renderer The renderer. * \param texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target * * \return 0 on success, or -1 on error * * \sa SDL_GetRenderTarget() */ extern DECLSPEC int SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture); /** * \brief Get the current render target or NULL for the default render target. * * \return The current render target * * \sa SDL_SetRenderTarget() */ extern DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *renderer); /** * \brief Set device independent resolution for rendering * * \param renderer The renderer for which resolution should be set. * \param w The width of the logical resolution * \param h The height of the logical resolution * * This function uses the viewport and scaling functionality to allow a fixed logical * resolution for rendering, regardless of the actual output resolution. If the actual * output resolution doesn't have the same aspect ratio the output rendering will be * centered within the output display. * * If the output display is a window, mouse events in the window will be filtered * and scaled so they seem to arrive within the logical resolution. * * \note If this function results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. * * \sa SDL_RenderGetLogicalSize() * \sa SDL_RenderSetScale() * \sa SDL_RenderSetViewport() */ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, int w, int h); /** * \brief Get device independent resolution for rendering * * \param renderer The renderer from which resolution should be queried. * \param w A pointer filled with the width of the logical resolution * \param h A pointer filled with the height of the logical resolution * * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); /** * \brief Set whether to force integer scales for resolution-independent rendering * * \param renderer The renderer for which integer scaling should be set. * \param enable Enable or disable integer scaling * * This function restricts the logical viewport to integer values - that is, when * a resolution is between two multiples of a logical size, the viewport size is * rounded down to the lower multiple. * * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable); /** * \brief Get whether integer scales are forced for resolution-independent rendering * * \param renderer The renderer from which integer scaling should be queried. * * \sa SDL_RenderSetIntegerScale() */ extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer); /** * \brief Set the drawing area for rendering on the current target. * * \param renderer The renderer for which the drawing area should be set. * \param rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target. * * The x,y of the viewport rect represents the origin for rendering. * * \return 0 on success, or -1 on error * * \note If the window associated with the renderer is resized, the viewport is automatically reset. * * \sa SDL_RenderGetViewport() * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC int SDLCALL SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Get the drawing area for the current target. * * \sa SDL_RenderSetViewport() */ extern DECLSPEC void SDLCALL SDL_RenderGetViewport(SDL_Renderer * renderer, SDL_Rect * rect); /** * \brief Set the clip rectangle for the current target. * * \param renderer The renderer for which clip rectangle should be set. * \param rect A pointer to the rectangle to set as the clip rectangle, or * NULL to disable clipping. * * \return 0 on success, or -1 on error * * \sa SDL_RenderGetClipRect() */ extern DECLSPEC int SDLCALL SDL_RenderSetClipRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Get the clip rectangle for the current target. * * \param renderer The renderer from which clip rectangle should be queried. * \param rect A pointer filled in with the current clip rectangle, or * an empty rectangle if clipping is disabled. * * \sa SDL_RenderSetClipRect() */ extern DECLSPEC void SDLCALL SDL_RenderGetClipRect(SDL_Renderer * renderer, SDL_Rect * rect); /** * \brief Get whether clipping is enabled on the given renderer. * * \param renderer The renderer from which clip state should be queried. * * \sa SDL_RenderGetClipRect() */ extern DECLSPEC SDL_bool SDLCALL SDL_RenderIsClipEnabled(SDL_Renderer * renderer); /** * \brief Set the drawing scale for rendering on the current target. * * \param renderer The renderer for which the drawing scale should be set. * \param scaleX The horizontal scaling factor * \param scaleY The vertical scaling factor * * The drawing coordinates are scaled by the x/y scaling factors * before they are used by the renderer. This allows resolution * independent drawing with a single coordinate system. * * \note If this results in scaling or subpixel drawing by the * rendering backend, it will be handled using the appropriate * quality hints. For best results use integer scaling factors. * * \sa SDL_RenderGetScale() * \sa SDL_RenderSetLogicalSize() */ extern DECLSPEC int SDLCALL SDL_RenderSetScale(SDL_Renderer * renderer, float scaleX, float scaleY); /** * \brief Get the drawing scale for the current target. * * \param renderer The renderer from which drawing scale should be queried. * \param scaleX A pointer filled in with the horizontal scaling factor * \param scaleY A pointer filled in with the vertical scaling factor * * \sa SDL_RenderSetScale() */ extern DECLSPEC void SDLCALL SDL_RenderGetScale(SDL_Renderer * renderer, float *scaleX, float *scaleY); /** * \brief Set the color used for drawing operations (Rect, Line and Clear). * * \param renderer The renderer for which drawing color should be set. * \param r The red value used to draw on the rendering target. * \param g The green value used to draw on the rendering target. * \param b The blue value used to draw on the rendering target. * \param a The alpha value used to draw on the rendering target, usually * ::SDL_ALPHA_OPAQUE (255). * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_SetRenderDrawColor(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /** * \brief Get the color used for drawing operations (Rect, Line and Clear). * * \param renderer The renderer from which drawing color should be queried. * \param r A pointer to the red value used to draw on the rendering target. * \param g A pointer to the green value used to draw on the rendering target. * \param b A pointer to the blue value used to draw on the rendering target. * \param a A pointer to the alpha value used to draw on the rendering target, * usually ::SDL_ALPHA_OPAQUE (255). * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_GetRenderDrawColor(SDL_Renderer * renderer, Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a); /** * \brief Set the blend mode used for drawing operations (Fill and Line). * * \param renderer The renderer for which blend mode should be set. * \param blendMode ::SDL_BlendMode to use for blending. * * \return 0 on success, or -1 on error * * \note If the blend mode is not supported, the closest supported mode is * chosen. * * \sa SDL_GetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); /** * \brief Get the blend mode used for drawing operations. * * \param renderer The renderer from which blend mode should be queried. * \param blendMode A pointer filled in with the current blend mode. * * \return 0 on success, or -1 on error * * \sa SDL_SetRenderDrawBlendMode() */ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode *blendMode); /** * \brief Clear the current rendering target with the drawing color * * This function clears the entire rendering target, ignoring the viewport and * the clip rectangle. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer); /** * \brief Draw a point on the current rendering target. * * \param renderer The renderer which should draw a point. * \param x The x coordinate of the point. * \param y The y coordinate of the point. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y); /** * \brief Draw multiple points on the current rendering target. * * \param renderer The renderer which should draw multiple points. * \param points The points to draw * \param count The number of points to draw * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count); /** * \brief Draw a line on the current rendering target. * * \param renderer The renderer which should draw a line. * \param x1 The x coordinate of the start point. * \param y1 The y coordinate of the start point. * \param x2 The x coordinate of the end point. * \param y2 The y coordinate of the end point. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2); /** * \brief Draw a series of connected lines on the current rendering target. * * \param renderer The renderer which should draw multiple lines. * \param points The points along the lines * \param count The number of points, drawing count-1 lines * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count); /** * \brief Draw a rectangle on the current rendering target. * * \param renderer The renderer which should draw a rectangle. * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Draw some number of rectangles on the current rendering target. * * \param renderer The renderer which should draw multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); /** * \brief Fill a rectangle on the current rendering target with the drawing color. * * \param renderer The renderer which should fill a rectangle. * \param rect A pointer to the destination rectangle, or NULL for the entire * rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer, const SDL_Rect * rect); /** * \brief Fill some number of rectangles on the current rendering target with the drawing color. * * \param renderer The renderer which should fill multiple rectangles. * \param rects A pointer to an array of destination rectangles. * \param count The number of rectangles. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count); /** * \brief Copy a portion of the texture to the current rendering target. * * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect); /** * \brief Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center * * \param renderer The renderer which should copy parts of a texture. * \param texture The source texture. * \param srcrect A pointer to the source rectangle, or NULL for the entire * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * * \return 0 on success, or -1 on error */ extern DECLSPEC int SDLCALL SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip); /** * \brief Read pixels from the current rendering target. * * \param renderer The renderer from which pixels should be read. * \param rect A pointer to the rectangle to read, or NULL for the entire * render target. * \param format The desired format of the pixel data, or 0 to use the format * of the rendering target * \param pixels A pointer to be filled in with the pixel data * \param pitch The pitch of the pixels parameter. * * \return 0 on success, or -1 if pixel reading is not supported. * * \warning This is a very slow operation, and should not be used frequently. */ extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void *pixels, int pitch); /** * \brief Update the screen with rendering performed. */ extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer); /** * \brief Destroy the specified texture. * * \sa SDL_CreateTexture() * \sa SDL_CreateTextureFromSurface() */ extern DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture * texture); /** * \brief Destroy the rendering context for a window and free associated * textures. * * \sa SDL_CreateRenderer() */ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer); /** * \brief Bind the texture to the current OpenGL/ES/ES2 context for use with * OpenGL instructions. * * \param texture The SDL texture to bind * \param texw A pointer to a float that will be filled with the texture width * \param texh A pointer to a float that will be filled with the texture height * * \return 0 on success, or -1 if the operation is not supported */ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw, float *texh); /** * \brief Unbind a texture from the current OpenGL/ES/ES2 context. * * \param texture The SDL texture to unbind * * \return 0 on success, or -1 if the operation is not supported */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); /** * \brief Get the CAMetalLayer associated with the given Metal renderer * * \param renderer The renderer to query * * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer * * \sa SDL_RenderGetMetalCommandEncoder() */ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); /** * \brief Get the Metal command encoder for the current frame * * \param renderer The renderer to query * * \return id<MTLRenderCommandEncoder> on success, or NULL if the renderer isn't a Metal renderer * * \sa SDL_RenderGetMetalLayer() */ extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" #endif /* SDL_render_h_ */ /* vi: set ts=4 sw=4 expandtab: */
35,405
C
36.98927
164
0.64361
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/semu/xr/openxr/openxr.py
from typing import Union, Callable import os import sys import ctypes import cv2 import numpy import numpy as np if __name__ != "__main__": import pxr import omni from pxr import UsdGeom, Gf, Usd from omni.syntheticdata import sensors, _syntheticdata else: class pxr: class Gf: Vec3d = lambda x,y,z: (x,y,z) Quatd = lambda w,x,y,z: (w,x,y,z) class Usd: Prim = None class UsdGeom: pass class Sdf: Path = None Gf = pxr.Gf # constants XR_KHR_OPENGL_ENABLE_EXTENSION_NAME = "XR_KHR_opengl_enable" XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME = "XR_KHR_opengl_es_enable" XR_KHR_VULKAN_ENABLE_EXTENSION_NAME = "XR_KHR_vulkan_enable" XR_KHR_D3D11_ENABLE_EXTENSION_NAME = "XR_KHR_D3D11_enable" XR_KHR_D3D12_ENABLE_EXTENSION_NAME = "XR_KHR_D3D12_enable" XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY = 1 XR_FORM_FACTOR_HANDHELD_DISPLAY = 2 XR_ENVIRONMENT_BLEND_MODE_OPAQUE = 1 XR_ENVIRONMENT_BLEND_MODE_ADDITIVE = 2 XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND = 3 XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO = 1 XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO = 2 XR_REFERENCE_SPACE_TYPE_VIEW = 1 # +Y up, +X to the right, and -Z forward XR_REFERENCE_SPACE_TYPE_LOCAL = 2 # +Y up, +X to the right, and -Z forward XR_REFERENCE_SPACE_TYPE_STAGE = 3 # +Y up, and the X and Z axes aligned with the rectangle edges XR_ACTION_TYPE_BOOLEAN_INPUT = 1 XR_ACTION_TYPE_FLOAT_INPUT = 2 XR_ACTION_TYPE_VECTOR2F_INPUT = 3 XR_ACTION_TYPE_POSE_INPUT = 4 XR_ACTION_TYPE_VIBRATION_OUTPUT = 100 XR_NO_DURATION = 0 XR_INFINITE_DURATION = 2**32 XR_MIN_HAPTIC_DURATION = -1 XR_FREQUENCY_UNSPECIFIED = 0 def acquire_openxr_interface(disable_openxr: bool = False): return OpenXR(disable_openxr) def release_openxr_interface(xr): if xr is not None: xr.destroy() xr = None # structures (ctypes) XrActionType = ctypes.c_int XrStructureType = ctypes.c_int class XrQuaternionf(ctypes.Structure): _fields_ = [('x', ctypes.c_float), ('y', ctypes.c_float), ('z', ctypes.c_float), ('w', ctypes.c_float)] class XrVector3f(ctypes.Structure): _fields_ = [('x', ctypes.c_float), ('y', ctypes.c_float), ('z', ctypes.c_float)] class XrPosef(ctypes.Structure): _fields_ = [('orientation', XrQuaternionf), ('position', XrVector3f)] class XrFovf(ctypes.Structure): _fields_ = _fields_ = [('angleLeft', ctypes.c_float), ('angleRight', ctypes.c_float), ('angleUp', ctypes.c_float), ('angleDown', ctypes.c_float)] class XrView(ctypes.Structure): _fields_ = [('type', XrStructureType), ('next', ctypes.c_void_p), ('pose', XrPosef), ('fov', XrFovf)] class XrViewConfigurationView(ctypes.Structure): _fields_ = [('type', XrStructureType), ('next', ctypes.c_void_p), ('recommendedImageRectWidth', ctypes.c_uint32), ('maxImageRectWidth', ctypes.c_uint32), ('recommendedImageRectHeight', ctypes.c_uint32), ('maxImageRectHeight', ctypes.c_uint32), ('recommendedSwapchainSampleCount', ctypes.c_uint32), ('maxSwapchainSampleCount', ctypes.c_uint32)] class ActionState(ctypes.Structure): _fields_ = [('type', XrActionType), ('path', ctypes.c_char_p), ('isActive', ctypes.c_bool), ('stateBool', ctypes.c_bool), ('stateFloat', ctypes.c_float), ('stateVectorX', ctypes.c_float), ('stateVectorY', ctypes.c_float)] class ActionPoseState(ctypes.Structure): _fields_ = [('type', XrActionType), ('path', ctypes.c_char_p), ('isActive', ctypes.c_bool), ('pose', XrPosef)] class OpenXR: def __init__(self, disable_openxr: bool = False) -> None: self._disable_openxr = disable_openxr if self._disable_openxr: print("[WARNING] Extension launched with OpenXR support disabled") self._lib = None self._app = None self._graphics = None self._use_ctypes = False # views self._prim_left = None self._prim_right = None self._frame_left = None self._frame_right = None self._viewport_window_left = None self._viewport_window_right = None self._meters_per_unit = 1.0 self._reference_position = Gf.Vec3d(0, 0, 0) self._reference_rotation = Gf.Vec3d(0, 0, 0) self._rectification_quat_left = Gf.Quatd(1, 0, 0, 0) self._rectification_quat_right = Gf.Quatd(1, 0, 0, 0) self._viewport_interface = None self._transform_fit = None self._transform_flip = None # callbacks self._callback_action_events = {} self._callback_action_pose_events = {} self._callback_middle_render = None self._callback_render = None def init(self, graphics: str = "OpenGL", use_ctypes: bool = False) -> bool: """ Init OpenXR application by loading the related libraries Parameters ---------- graphics: str OpenXR graphics API supported by the runtime (OpenGL, OpenGLES, Vulkan, D3D11, D3D12). Note: At the moment only OpenGL is available use_ctypes: bool, optional If true, use ctypes as C/C++ interface instead of pybind11 (default) Returns ------- bool True if initialization was successful, otherwise False """ # get viewport interface try: self._viewport_interface = omni.kit.viewport.get_viewport_interface() except Exception as e: print("[INFO] Using legacy viewport interface") self._viewport_interface = omni.kit.viewport_legacy.get_viewport_interface() # TODO: what about no graphic API (only controllers for example)? self._use_ctypes = use_ctypes # graphics API if graphics in ["OpenGL", XR_KHR_OPENGL_ENABLE_EXTENSION_NAME]: self._graphics = XR_KHR_OPENGL_ENABLE_EXTENSION_NAME elif graphics in ["OpenGLES", XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME]: self._graphics = XR_KHR_OPENGL_ES_ENABLE_EXTENSION_NAME raise NotImplementedError("OpenGLES graphics API is not implemented yet") elif graphics in ["Vulkan", XR_KHR_VULKAN_ENABLE_EXTENSION_NAME]: self._graphics = XR_KHR_VULKAN_ENABLE_EXTENSION_NAME raise NotImplementedError("Vulkan graphics API is not implemented yet") elif graphics in ["D3D11", XR_KHR_D3D11_ENABLE_EXTENSION_NAME]: self._graphics = XR_KHR_D3D11_ENABLE_EXTENSION_NAME raise NotImplementedError("D3D11 graphics API is not implemented yet") elif graphics in ["D3D12", XR_KHR_D3D12_ENABLE_EXTENSION_NAME]: self._graphics = XR_KHR_D3D12_ENABLE_EXTENSION_NAME raise NotImplementedError("D3D12 graphics API is not implemented yet") else: raise ValueError("Invalid graphics API ({}). Valid graphics APIs are OpenGL, OpenGLES, Vulkan, D3D11, D3D12".format(graphics)) # libraries path if __name__ == "__main__": extension_path = os.getcwd()[:os.getcwd().find("/semu/xr/openxr")] else: extension_path = __file__[:__file__.find("/semu/xr/openxr")] if self._disable_openxr: return True try: # ctypes if self._use_ctypes: ctypes.PyDLL(os.path.join(extension_path, "bin", "libGL.so"), mode = ctypes.RTLD_GLOBAL) ctypes.PyDLL(os.path.join(extension_path, "bin", "libSDL2.so"), mode = ctypes.RTLD_GLOBAL) ctypes.PyDLL(os.path.join(extension_path, "bin", "libopenxr_loader.so"), mode = ctypes.RTLD_GLOBAL) self._lib = ctypes.PyDLL(os.path.join(extension_path, "bin", "xrlib_c.so"), mode = ctypes.RTLD_GLOBAL) self._app = self._lib.openXrApplication() print("[INFO] OpenXR initialized using ctypes interface") # pybind11 else: sys.setdlopenflags(os.RTLD_GLOBAL | os.RTLD_LAZY) sys.path.append(os.path.join(extension_path, "bin")) # change cwd tmp_dir= os.getcwd() os.chdir(extension_path) #import library import xrlib_p #restore cwd os.chdir(tmp_dir) self._lib = xrlib_p self._app = xrlib_p.OpenXrApplication() print("[INFO] OpenXR initialized using pybind11 interface") except Exception as e: print("[ERROR] OpenXR initialization:", e) return False return True def destroy(self) -> bool: """ Destroy OpenXR application Returns ------- bool True if destruction was successful, otherwise False """ if self._app is not None: if self._use_ctypes: return bool(self._lib.destroy(self._app)) else: return self._app.destroy() self._lib = None self._app = None return True def is_session_running(self) -> bool: """ OpenXR session's running status Returns ------- bool Return True if the OpenXR session is running, False otherwise """ if self._disable_openxr: return True if self._use_ctypes: return bool(self._lib.isSessionRunning(self._app)) else: return self._app.isSessionRunning() def create_instance(self, application_name: str = "Omniverse (XR)", engine_name: str = "", api_layers: list = [], extensions: list = []) -> bool: """ Create an OpenXR instance to allow communication with an OpenXR runtime OpenXR internal function calls: - xrEnumerateApiLayerProperties - xrEnumerateInstanceExtensionProperties - xrCreateInstance Parameters ---------- application_name: str, optional Name of the OpenXR application (default: 'Omniverse (VR)') engine_name: str, optional Name of the engine (if any) used to create the application (empty by default) api_layers: list of str, optional [API layers](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#api-layers) to be inserted between the OpenXR application and the runtime implementation. extensions: list of str, optional [Extensions](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#extensions) to be loaded. Note: At the moment only the graphic extensions are configured. Note: The graphics API selected during initialization (init) is automatically included in the extensions to be loaded. Returns ------- bool True if the instance has been created successfully, otherwise False """ if self._disable_openxr: return True if self._graphics not in extensions: extensions += [self._graphics] if self._use_ctypes: # format API layes requested_api_layers = (ctypes.c_char_p * len(api_layers))() requested_api_layers[:] = [layer.encode('utf-8') for layer in api_layers] # format extensions requested_extensions = (ctypes.c_char_p * len(extensions))() requested_extensions[:] = [extension.encode('utf-8') for extension in extensions] return bool(self._lib.createInstance(self._app, ctypes.create_string_buffer(application_name.encode('utf-8')), ctypes.create_string_buffer(engine_name.encode('utf-8')), requested_api_layers, len(api_layers), requested_extensions, len(extensions))) else: return self._app.createInstance(application_name, engine_name, api_layers, extensions) def get_system(self, form_factor: int = 1, blend_mode: int = 1, view_configuration_type: int = 2) -> bool: """ Obtain the system represented by a collection of related devices at runtime OpenXR internal function calls: - xrGetSystem - xrGetInstanceProperties - xrGetSystemProperties - xrEnumerateViewConfigurations - xrGetViewConfigurationProperties - xrEnumerateViewConfigurationViews - xrEnumerateEnvironmentBlendModes - xrCreateActionSet (actionSetName: 'actionset', localizedActionSetName: 'localized_actionset') Parameters ---------- form_factor: {XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, XR_FORM_FACTOR_HANDHELD_DISPLAY}, optional Desired [form factor](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#form_factor_description) from XrFormFactor enum (default: XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY) blend_mode: {XR_ENVIRONMENT_BLEND_MODE_OPAQUE, XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND}, optional Desired environment [blend mode](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#environment_blend_mode) from XrEnvironmentBlendMode enum (default: XR_ENVIRONMENT_BLEND_MODE_OPAQUE) view_configuration_type: {XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO}, optional Primary [view configuration](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#view_configurations) type from XrViewConfigurationType enum (default: XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO) Returns ------- bool True if the system has been obtained successfully, otherwise False """ # check form_factor if not form_factor in [XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, XR_FORM_FACTOR_HANDHELD_DISPLAY]: raise ValueError("Invalid form factor ({}). Valid form factors are XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY ({}), XR_FORM_FACTOR_HANDHELD_DISPLAY ({})" \ .format(form_factor, XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, XR_FORM_FACTOR_HANDHELD_DISPLAY)) # check blend_mode if not blend_mode in [XR_ENVIRONMENT_BLEND_MODE_OPAQUE, XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND]: raise ValueError("Invalid blend mode ({}). Valid blend modes are XR_ENVIRONMENT_BLEND_MODE_OPAQUE ({}), XR_ENVIRONMENT_BLEND_MODE_ADDITIVE ({}), XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND ({})" \ .format(blend_mode, XR_ENVIRONMENT_BLEND_MODE_OPAQUE, XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND)) # check view_configuration_type if not view_configuration_type in [XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO]: raise ValueError("Invalid view configuration type ({}). Valid view configuration types are XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO ({}), XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO ({})" \ .format(view_configuration_type, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO)) if self._disable_openxr: return True if self._use_ctypes: return bool(self._lib.getSystem(self._app, form_factor, blend_mode, view_configuration_type)) else: return self._app.getSystem(form_factor, blend_mode, view_configuration_type) def create_session(self) -> bool: """ Create an OpenXR session that represents an application's intention to display XR content OpenXR internal function calls: - xrCreateSession - xrEnumerateReferenceSpaces - xrCreateReferenceSpace - xrGetReferenceSpaceBoundsRect - xrSuggestInteractionProfileBindings - xrAttachSessionActionSets - xrCreateActionSpace - xrEnumerateSwapchainFormats - xrCreateSwapchain - xrEnumerateSwapchainImages Returns ------- bool True if the session has been created successfully, otherwise False """ if self._disable_openxr: return True if self._use_ctypes: return bool(self._lib.createSession(self._app)) else: return self._app.createSession() def poll_events(self) -> bool: """ [Event polling](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#event-polling) and processing OpenXR internal function calls: - xrPollEvent - xrBeginSession - xrEndSession Returns ------- bool False if the running session needs to end (due to the user closing or switching the application, etc.), otherwise False """ if self._disable_openxr: return True if self._use_ctypes: exit_loop = ctypes.c_bool(False) result = bool(self._lib.pollEvents(self._app, ctypes.byref(exit_loop))) return result and not exit_loop.value else: result = self._app.pollEvents() return result[0] and not result[1] def poll_actions(self) -> bool: """ [Action](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_action_overview) polling OpenXR internal function calls: - xrSyncActions - xrGetActionStateBoolean - xrGetActionStateFloat - xrGetActionStateVector2f - xrGetActionStatePose Returns ------- bool True if there is no error during polling, otherwise False """ if self._disable_openxr: return True if self._use_ctypes: requested_action_states = (ActionState * len(self._callback_action_events.keys()))() result = bool(self._lib.pollActions(self._app, requested_action_states, len(requested_action_states))) for state in requested_action_states: value = None if not state.type: break if state.type == XR_ACTION_TYPE_BOOLEAN_INPUT: value = state.stateBool elif state.type == XR_ACTION_TYPE_FLOAT_INPUT: value = state.stateFloat elif state.type == XR_ACTION_TYPE_VECTOR2F_INPUT: value = (state.stateVectorX, state.stateVectorY) elif state.type == XR_ACTION_TYPE_POSE_INPUT: continue elif state.type == XR_ACTION_TYPE_VIBRATION_OUTPUT: continue self._callback_action_events[state.path.decode("utf-8")](state.path.decode("utf-8"), value) return result else: result = self._app.pollActions() for state in result[1]: value = None if state["type"] == XR_ACTION_TYPE_BOOLEAN_INPUT: value = state["stateBool"] elif state["type"] == XR_ACTION_TYPE_FLOAT_INPUT: value = state["stateFloat"] elif state["type"] == XR_ACTION_TYPE_VECTOR2F_INPUT: value = (state["stateVectorX"], state["stateVectorY"]) elif state["type"] == XR_ACTION_TYPE_POSE_INPUT: continue elif state["type"] == XR_ACTION_TYPE_VIBRATION_OUTPUT: continue self._callback_action_events[state["path"]](state["path"], value) return result[0] def render_views(self, reference_space: int = 2) -> bool: """ Present rendered images to the user's views according to the selected reference space OpenXR internal function calls: - xrWaitFrame - xrBeginFrame - xrLocateSpace - xrLocateViews - xrAcquireSwapchainImage - xrWaitSwapchainImage - xrReleaseSwapchainImage - xrEndFrame Parameters ---------- reference_space: {XR_REFERENCE_SPACE_TYPE_VIEW, XR_REFERENCE_SPACE_TYPE_LOCAL, XR_REFERENCE_SPACE_TYPE_STAGE}, optional Desired [reference space](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#reference-spaces) type from XrReferenceSpaceType enum used to render the images (default: XR_REFERENCE_SPACE_TYPE_LOCAL) Returns ------- bool True if there is no error during rendering, otherwise False """ if self._callback_render is None: print("[INFO] No callback has been established for rendering events. Internal callback will be used") self.subscribe_render_event() if self._disable_openxr: # test sensor reading if self._viewport_window_left is not None: frame_left = sensors.get_rgb(self._viewport_window_left) cv2.imshow("frame_left {}".format(frame_left.shape), frame_left) cv2.waitKey(1) if self._viewport_window_right is not None: frame_right = sensors.get_rgb(self._viewport_window_right) cv2.imshow("frame_right {}".format(frame_right.shape), frame_right) cv2.waitKey(1) return True if self._use_ctypes: requested_action_pose_states = (ActionPoseState * len(self._callback_action_pose_events.keys()))() result = bool(self._lib.renderViews(self._app, reference_space, requested_action_pose_states, len(requested_action_pose_states))) for state in requested_action_pose_states: value = None if state.type == XR_ACTION_TYPE_POSE_INPUT and state.isActive: value = (Gf.Vec3d(state.pose.position.x, -state.pose.position.z, state.pose.position.y) / self._meters_per_unit, Gf.Quatd(state.pose.orientation.w, state.pose.orientation.x, state.pose.orientation.y, state.pose.orientation.z)) self._callback_action_pose_events[state.path.decode("utf-8")](state.path.decode("utf-8"), value) return result else: result = self._app.renderViews(reference_space) for state in result[1]: value = None if state["type"] == XR_ACTION_TYPE_POSE_INPUT and state["isActive"]: value = (Gf.Vec3d(state["pose"]["position"]["x"], -state["pose"]["position"]["z"], state["pose"]["position"]["y"]) / self._meters_per_unit, Gf.Quatd(state["pose"]["orientation"]["w"], state["pose"]["orientation"]["x"], state["pose"]["orientation"]["y"], state["pose"]["orientation"]["z"])) self._callback_action_pose_events[state["path"]](state["path"], value) return result[0] # action utilities def subscribe_action_event(self, path: str, callback: Union[Callable[[str, object], None], None] = None, action_type: Union[int, None] = None, reference_space: Union[int, None] = 2) -> bool: """ Create an action given a path and subscribe a callback function to the update event of this action If action_type is None the action type will be automatically defined by parsing the last segment of the path according to the following policy: - XR_ACTION_TYPE_BOOLEAN_INPUT: /click, /touch - XR_ACTION_TYPE_FLOAT_INPUT: /value, /force - XR_ACTION_TYPE_VECTOR2F_INPUT: /x, /y - XR_ACTION_TYPE_POSE_INPUT: /pose - XR_ACTION_TYPE_VIBRATION_OUTPUT: /haptic, /haptic_left, /haptic_right, /haptic_left_trigger, /haptic_right_trigger The callback function (a callable object) should have only the following 2 parameters: - path: str The complete path (user path and subpath) of the action that invokes the callback - value: bool, float, tuple(float, float), tuple(pxr.Gf.Vec3d, pxr.Gf.Quatd) The current state of the action according to its type - XR_ACTION_TYPE_BOOLEAN_INPUT: bool - XR_ACTION_TYPE_FLOAT_INPUT: float - XR_ACTION_TYPE_VECTOR2F_INPUT (x, y): tuple(float, float) - XR_ACTION_TYPE_POSE_INPUT (position (in stage unit), rotation as quaternion): tuple(pxr.Gf.Vec3d, pxr.Gf.Quatd) XR_ACTION_TYPE_VIBRATION_OUTPUT actions will not invoke their callback function. In this case the callback must be None XR_ACTION_TYPE_POSE_INPUT also specifies, through the definition of the reference_space parameter, the reference space used to retrieve the pose The collection of available paths corresponds to the following [interaction profiles](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-interaction-profiles): - [Khronos Simple Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_khronos_simple_controller_profile) - [Google Daydream Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_google_daydream_controller_profile) - [HTC Vive Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_htc_vive_controller_profile) - [HTC Vive Pro](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_htc_vive_pro_profile) - [Microsoft Mixed Reality Motion Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_microsoft_mixed_reality_motion_controller_profile) - [Microsoft Xbox Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_microsoft_xbox_controller_profile) - [Oculus Go Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_oculus_go_controller_profile) - [Oculus Touch Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_oculus_touch_controller_profile) - [Valve Index Controller](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_valve_index_controller_profile) OpenXR internal function calls: - xrCreateAction Parameters ---------- path: str Complete [path](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-reserved) (user path and subpath) referring to the action callback: callable object (2 parameters) or None for XR_ACTION_TYPE_VIBRATION_OUTPUT Callback invoked when the state of the action changes action_type: {XR_ACTION_TYPE_BOOLEAN_INPUT, XR_ACTION_TYPE_FLOAT_INPUT, XR_ACTION_TYPE_VECTOR2F_INPUT, XR_ACTION_TYPE_POSE_INPUT, XR_ACTION_TYPE_VIBRATION_OUTPUT} or None, optional Action [type](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrActionType) from XrActionType enum (default: None) reference_space: {XR_REFERENCE_SPACE_TYPE_VIEW, XR_REFERENCE_SPACE_TYPE_LOCAL, XR_REFERENCE_SPACE_TYPE_STAGE}, optional Desired [reference space](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#reference-spaces) type from XrReferenceSpaceType enum used to retrieve the pose (default: XR_REFERENCE_SPACE_TYPE_LOCAL) Returns ------- bool True if there is no error during action creation, otherwise False """ if action_type is None: if path.split("/")[-1] in ["click", "touch"]: action_type = XR_ACTION_TYPE_BOOLEAN_INPUT elif path.split("/")[-1] in ["value", "force"]: action_type = XR_ACTION_TYPE_FLOAT_INPUT elif path.split("/")[-1] in ["x", "y"]: action_type = XR_ACTION_TYPE_VECTOR2F_INPUT elif path.split("/")[-1] in ["pose"]: action_type = XR_ACTION_TYPE_POSE_INPUT elif path.split("/")[-1] in ["haptic", "haptic_left", "haptic_right", "haptic_left_trigger", "haptic_right_trigger"]: action_type = XR_ACTION_TYPE_VIBRATION_OUTPUT else: raise ValueError("The action type cannot be retrieved from the path {}".format(path)) if callback is None and action_type != XR_ACTION_TYPE_VIBRATION_OUTPUT: raise ValueError("The callback was not defined") self._callback_action_events[path] = callback if action_type == XR_ACTION_TYPE_POSE_INPUT: self._callback_action_pose_events[path] = callback if self._disable_openxr: return True if self._use_ctypes: return bool(self._lib.addAction(self._app, ctypes.create_string_buffer(path.encode('utf-8')), action_type, reference_space)) else: return self._app.addAction(path, action_type, reference_space) def apply_haptic_feedback(self, path: str, haptic_feedback: dict = {}) -> bool: """ Apply a [haptic feedback](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_output_actions_and_haptics) to a device defined by a path (user path and subpath) OpenXR internal function calls: - xrApplyHapticFeedback Parameters ---------- path: str Complete [path](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-reserved) (user path and subpath) referring to the action haptic_feedback: dict A python dictionary containing the field names and value of a XrHapticBaseHeader-based structure. Note: At the moment the only haptics type supported is the unextended OpenXR [XrHapticVibration](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrHapticVibration) Returns ------- bool True if there is no error during the haptic feedback application, otherwise False """ amplitude = haptic_feedback.get("amplitude", 0.5) duration = haptic_feedback.get("duration", XR_MIN_HAPTIC_DURATION) frequency = haptic_feedback.get("frequency", XR_FREQUENCY_UNSPECIFIED) if self._disable_openxr: return True if self._use_ctypes: amplitude = ctypes.c_float(amplitude) duration = ctypes.c_int64(duration) frequency = ctypes.c_float(frequency) return bool(self._lib.applyHapticFeedback(self._app, ctypes.create_string_buffer(path.encode('utf-8')), amplitude, duration, frequency)) else: return self._app.applyHapticFeedback(path, amplitude, duration, frequency) def stop_haptic_feedback(self, path: str) -> bool: """ Stop a [haptic feedback](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#_output_actions_and_haptics) applied to a device defined by a path (user path and subpath) OpenXR internal function calls: - xrStopHapticFeedback Parameters ---------- path: str Complete [path](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#semantic-path-reserved) (user path and subpath) referring to the action Returns ------- bool True if there is no error during the haptic feedback stop, otherwise False """ if self._disable_openxr: return True if self._use_ctypes: return bool(self._lib.stopHapticFeedback(self._app, ctypes.create_string_buffer(path.encode('utf-8')))) else: return self._app.stopHapticFeedback(path) # view utilities def setup_mono_view(self, camera: Union[str, pxr.Sdf.Path, pxr.Usd.Prim] = "/OpenXR/Cameras/camera", camera_properties: dict = {"focalLength": 10}) -> None: """ Setup Omniverse viewport and camera for monoscopic rendering This method obtains the viewport window for the given camera. If the viewport window does not exist, a new one is created and the camera is set as active. If the given camera does not exist, a new camera is created with the same path and set to the recommended resolution of the display device Parameters ---------- camera: str, pxr.Sdf.Path or pxr.Usd.Prim, optional Omniverse camera prim or path (default: '/OpenXR/Cameras/camera') camera_properties: dict Dictionary containing the [camera properties](https://docs.omniverse.nvidia.com/app_create/prod_materials-and-rendering/cameras.html#camera-properties) supported by the Omniverse kit to be set (default: {"focalLength": 10}) """ self.setup_stereo_view(camera, None, camera_properties) def setup_stereo_view(self, left_camera: Union[str, pxr.Sdf.Path, pxr.Usd.Prim] = "/OpenXR/Cameras/left_camera", right_camera: Union[str, pxr.Sdf.Path, pxr.Usd.Prim, None] = "/OpenXR/Cameras/right_camera", camera_properties: dict = {"focalLength": 10}) -> None: """ Setup Omniverse viewports and cameras for stereoscopic rendering This method obtains the viewport window for each camera. If the viewport window does not exist, a new one is created and the camera is set as active. If the given cameras do not exist, new cameras are created with the same path and set to the recommended resolution of the display device Parameters ---------- left_camera: str, pxr.Sdf.Path or pxr.Usd.Prim, optional Omniverse left camera prim or path (default: '/OpenXR/Cameras/left_camera') right_camera: str, pxr.Sdf.Path or pxr.Usd.Prim, optional Omniverse right camera prim or path (default: '/OpenXR/Cameras/right_camera') camera_properties: dict Dictionary containing the [camera properties](https://docs.omniverse.nvidia.com/app_create/prod_materials-and-rendering/cameras.html#camera-properties) supported by the Omniverse kit to be set (default: {"focalLength": 10}) """ def get_or_create_vieport_window(camera, teleport=True, window_size=(400, 300), resolution=(1280, 720)): window = None camera = str(camera.GetPath() if type(camera) is Usd.Prim else camera) # get viewport window for interface in self._viewport_interface.get_instance_list(): w = self._viewport_interface.get_viewport_window(interface) if camera == w.get_active_camera(): window = w # check visibility if not w.is_visible(): w.set_visible(True) break # create viewport window if not exist if window is None: window = self._viewport_interface.get_viewport_window(self._viewport_interface.create_instance()) window.set_window_size(*window_size) window.set_active_camera(camera) window.set_texture_resolution(*resolution) if teleport: window.set_camera_position(camera, 1.0, 1.0, 1.0, True) window.set_camera_target(camera, 0.0, 0.0, 0.0, True) return window stage = omni.usd.get_context().get_stage() # left camera teleport_camera = False self._prim_left = None if type(left_camera) is Usd.Prim: self._prim_left = left_camera elif stage.GetPrimAtPath(left_camera).IsValid(): self._prim_left = stage.GetPrimAtPath(left_camera) else: teleport_camera = True self._prim_left = stage.DefinePrim(omni.usd.get_stage_next_free_path(stage, left_camera, False), "Camera") self._viewport_window_left = get_or_create_vieport_window(self._prim_left, teleport=teleport_camera) # right camera teleport_camera = False self._prim_right = None if right_camera is not None: if type(right_camera) is Usd.Prim: self._prim_right = right_camera elif stage.GetPrimAtPath(right_camera).IsValid(): self._prim_right = stage.GetPrimAtPath(right_camera) else: teleport_camera = True self._prim_right = stage.DefinePrim(omni.usd.get_stage_next_free_path(stage, right_camera, False), "Camera") self._viewport_window_right = get_or_create_vieport_window(self._prim_right, teleport=teleport_camera) # set recommended resolution resolutions = self.get_recommended_resolutions() if len(resolutions) and self._viewport_window_left is not None: self._viewport_window_left.set_texture_resolution(*resolutions[0]) if len(resolutions) == 2 and self._viewport_window_right is not None: self._viewport_window_right.set_texture_resolution(*resolutions[1]) # set camera properties for property in camera_properties: self._prim_left.GetAttribute(property).Set(camera_properties[property]) if right_camera is not None: self._prim_right.GetAttribute(property).Set(camera_properties[property]) # enable sensors if self._viewport_window_left is not None: sensors.enable_sensors(self._viewport_window_left, [_syntheticdata.SensorType.Rgb]) if self._viewport_window_right is not None: sensors.enable_sensors(self._viewport_window_right, [_syntheticdata.SensorType.Rgb]) def get_recommended_resolutions(self) -> tuple: """ Get the recommended resolution of the display device Returns ------- tuple Tuple containing the recommended resolutions (width, height) of each device view. If the tuple length is 2, index 0 represents the left eye and index 1 represents the right eye """ if self._disable_openxr: return ([512, 512], [1024, 1024]) if self._use_ctypes: num_views = self._lib.getViewConfigurationViewsSize(self._app) views = (XrViewConfigurationView * num_views)() if self._lib.getViewConfigurationViews(self._app, views, num_views): return [(view.recommendedImageRectWidth, view.recommendedImageRectHeight) for view in views] else: return tuple([]) else: return tuple([(view["recommendedImageRectWidth"], view["recommendedImageRectHeight"]) for view in self._app.getViewConfigurationViews()]) def set_reference_system_pose(self, position: Union[pxr.Gf.Vec3d, None] = None, rotation: Union[pxr.Gf.Vec3d, None] = None) -> None: """ Set the pose of the origin of the reference system Parameters ---------- position: pxr.Gf.Vec3d or None, optional Cartesian position (in stage unit) (default: None) rotation: pxr.Gf.Vec3d or None, optional Rotation (in degress) on each axis (default: None) """ self._reference_position = position self._reference_rotation = rotation def set_stereo_rectification(self, x: float = 0, y: float = 0, z: float = 0) -> None: """ Set the angle (in radians) of the rotation axes for stereoscopic view rectification Parameters ---------- x: float, optional Angle (in radians) of the X-axis (default: 0) y: float, optional Angle (in radians) of the Y-axis (default: 0) x: float, optional Angle (in radians) of the Z-axis (default: 0) """ self._rectification_quat_left = pxr.Gf.Quatd(1, 0, 0, 0) self._rectification_quat_right = pxr.Gf.Quatd(1, 0, 0, 0) if x: # w,x,y,z = cos(a/2), sin(a/2), 0, 0 self._rectification_quat_left *= pxr.Gf.Quatd(np.cos(x/2), np.sin(x/2), 0, 0) self._rectification_quat_right *= pxr.Gf.Quatd(np.cos(-x/2), np.sin(-x/2), 0, 0) if y: # w,x,y,z = cos(a/2), 0, sin(a/2), 0 self._rectification_quat_left *= pxr.Gf.Quatd(np.cos(y/2), 0, np.sin(y/2), 0) self._rectification_quat_right *= pxr.Gf.Quatd(np.cos(-y/2), 0, np.sin(-y/2), 0) if z: # w,x,y,z = cos(a/2), 0, 0, sin(a/2) self._rectification_quat_left *= pxr.Gf.Quatd(np.cos(z/2), 0, 0, np.sin(z/2)) self._rectification_quat_right *= pxr.Gf.Quatd(np.cos(-z/2), 0, 0, np.sin(-z/2)) def set_meters_per_unit(self, meters_per_unit: float): """ Specify the meters per unit to be applied to transformations E.g. 1 meter: 1.0, 1 centimeter: 0.01 Parameters ---------- meters_per_unit: float Meters per unit """ assert meters_per_unit != 0 self._meters_per_unit = meters_per_unit def set_frame_transformations(self, fit: bool = False, flip: Union[int, tuple, None] = None) -> None: """ Specify the transformations to be applied to the rendered images Parameters ---------- fit: bool, optional Adjust each rendered image to the recommended resolution of the display device by cropping and scaling the image from its center (default: False) OpenCV.resize method with INTER_LINEAR interpolation will be used to scale the image to the recommended resolution flip: int, tuple or None, optional Flip each image around vertical (0), horizontal (1), or both axes (0,1) (default: None) """ self._transform_fit = fit self._transform_flip = flip def teleport_prim(self, prim: pxr.Usd.Prim, position: pxr.Gf.Vec3d, rotation: pxr.Gf.Quatd, reference_position: Union[pxr.Gf.Vec3d, None] = None, reference_rotation: Union[pxr.Gf.Vec3d, None] = None) -> None: """ Teleport the prim specified by the given transformation (position and rotation) Parameters ---------- prim: pxr.Usd.Prim Target prim position: pxr.Gf.Vec3d Cartesian position (in stage unit) used to transform the prim rotation: pxr.Gf.Quatd Rotation (as quaternion) used to transform the prim reference_position: pxr.Gf.Vec3d or None, optional Cartesian position (in stage unit) used as reference system (default: None) reference_rotation: pxr.Gf.Vec3d or None, optional Rotation (in degress) on each axis used as reference system (default: None) """ properties = prim.GetPropertyNames() # reference position if reference_position is not None: if "xformOp:translate" in properties or "xformOp:translation" in properties: prim.GetAttribute("xformOp:translate").Set(reference_position + position) else: print("[INFO] Create UsdGeom.XformOp.TypeTranslate for", prim.GetPath()) UsdGeom.Xformable(prim).AddXformOp(UsdGeom.XformOp.TypeTranslate, UsdGeom.XformOp.PrecisionDouble, "").Set(reference_position + position) else: if "xformOp:translate" in properties or "xformOp:translation" in properties: prim.GetAttribute("xformOp:translate").Set(position) else: print("[INFO] Create UsdGeom.XformOp.TypeTranslate for", prim.GetPath()) UsdGeom.Xformable(prim).AddXformOp(UsdGeom.XformOp.TypeTranslate, UsdGeom.XformOp.PrecisionDouble, "").Set(position) # reference rotation if reference_rotation is not None: if "xformOp:rotate" in properties: prim.GetAttribute("xformOp:rotate").Set(reference_rotation) elif "xformOp:rotateXYZ" in properties: try: prim.GetAttribute("xformOp:rotateXYZ").Set(reference_rotation) except: prim.GetAttribute("xformOp:rotateXYZ").Set(Gf.Vec3f(reference_rotation)) else: print("[INFO] Create UsdGeom.XformOp.TypeRotateXYZ for", prim.GetPath()) UsdGeom.Xformable(prim).AddXformOp(UsdGeom.XformOp.TypeRotateXYZ, UsdGeom.XformOp.PrecisionDouble, "").Set(reference_rotation) # transform transform_matrix = Gf.Matrix4d() transform_matrix.SetIdentity() # transform_matrix.SetTranslateOnly(position) transform_matrix.SetRotateOnly(Gf.Rotation(rotation)) if "xformOp:transform" in properties: prim.GetAttribute("xformOp:transform").Set(transform_matrix) else: print("[INFO] Create UsdGeom.XformOp.TypeTransform for", prim.GetPath()) UsdGeom.Xformable(prim).AddXformOp(UsdGeom.XformOp.TypeTransform, UsdGeom.XformOp.PrecisionDouble, "").Set(transform_matrix) def subscribe_render_event(self, callback=None) -> None: """ Subscribe a callback function to the render event The callback function (a callable object) should have only the following 3 parameters: - num_views: int The number of views to render: mono (1), stereo (2) - views: tuple of XrView structure A [XrView](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrView) structure contains the view pose and projection state necessary to render a image. The length of the tuple corresponds to the number of views (if the tuple length is 2, index 0 represents the left eye and index 1 represents the right eye) - configuration_views: tuple of XrViewConfigurationView structure A [XrViewConfigurationView](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrViewConfigurationView) structure specifies properties related to rendering of a view (e.g. the optimal width and height to be used when rendering the view). The length of the tuple corresponds to the number of views (if the tuple length is 2, index 0 represents the left eye and index 1 represents the right eye) The callback function must call the set_frames function to pass to the selected graphics API the image or images to be rendered If the callback is None, an internal callback will be used to render the views. This internal callback updates the pose of the cameras according to the specified reference system, gets the images from the previously configured viewports and invokes the set_frames function to render the views. Parameters ---------- callback: callable object (3 parameters) or None, optional Callback invoked on each render event (default: None) """ def _middle_callback(num_views, views, configuration_views): _views = [] for v in views: tmp = XrView() tmp.type = v["type"] tmp.next = None tmp.pose = XrPosef() tmp.pose.position.x = v["pose"]["position"]["x"] tmp.pose.position.y = v["pose"]["position"]["y"] tmp.pose.position.z = v["pose"]["position"]["z"] tmp.pose.orientation.x = v["pose"]["orientation"]["x"] tmp.pose.orientation.y = v["pose"]["orientation"]["y"] tmp.pose.orientation.z = v["pose"]["orientation"]["z"] tmp.pose.orientation.w = v["pose"]["orientation"]["w"] tmp.fov = XrFovf() tmp.fov.angleLeft = v["fov"]["angleLeft"] tmp.fov.angleRight = v["fov"]["angleRight"] tmp.fov.angleUp = v["fov"]["angleUp"] tmp.fov.angleDown = v["fov"]["angleDown"] _views.append(tmp) _configuration_views = [] for v in configuration_views: tmp = XrViewConfigurationView() tmp.type = v["type"] tmp.next = None tmp.recommendedImageRectWidth = v["recommendedImageRectWidth"] tmp.recommendedImageRectHeight = v["recommendedImageRectHeight"] tmp.maxImageRectWidth = v["maxImageRectWidth"] tmp.maxImageRectHeight = v["maxImageRectHeight"] tmp.recommendedSwapchainSampleCount = v["recommendedSwapchainSampleCount"] tmp.maxSwapchainSampleCount = v["maxSwapchainSampleCount"] _configuration_views.append(tmp) self._callback_render(num_views, _views, _configuration_views) def _internal_render(num_views, views, configuration_views): # teleport left camera position = views[0].pose.position rotation = views[0].pose.orientation position = Gf.Vec3d(position.x, -position.z, position.y) / self._meters_per_unit rotation = Gf.Quatd(rotation.w, rotation.x, rotation.y, rotation.z) * self._rectification_quat_left self.teleport_prim(self._prim_left, position, rotation, self._reference_position, self._reference_rotation) # teleport right camera if num_views == 2: position = views[1].pose.position rotation = views[1].pose.orientation position = Gf.Vec3d(position.x, -position.z, position.y) / self._meters_per_unit rotation = Gf.Quatd(rotation.w, rotation.x, rotation.y, rotation.z) * self._rectification_quat_right self.teleport_prim(self._prim_right, position, rotation, self._reference_position, self._reference_rotation) # set frames try: frame_left = sensors.get_rgb(self._viewport_window_left) frame_right = sensors.get_rgb(self._viewport_window_right) if num_views == 2 else None self.set_frames(configuration_views, frame_left, frame_right) except Exception as e: print("[ERROR]", str(e)) self._callback_render = callback if callback is None: self._callback_render = _internal_render if self._disable_openxr: return if self._use_ctypes: self._callback_middle_render = ctypes.CFUNCTYPE(None, ctypes.c_int, ctypes.POINTER(XrView), ctypes.POINTER(XrViewConfigurationView))(self._callback_render) self._lib.setRenderCallback(self._app, self._callback_middle_render) else: self._callback_middle_render = _middle_callback self._app.setRenderCallback(self._callback_middle_render) def set_frames(self, configuration_views: list, left: numpy.ndarray, right: numpy.ndarray = None) -> bool: """ Pass to the selected graphics API the images to be rendered in the views In the case of stereoscopic devices, the parameters left and right represent the left eye and right eye respectively. To pass an image to the graphic API of monoscopic devices only the parameter left should be used (the parameter right must be None) This function will apply to each image the transformations defined by the set_frame_transformations function if they were specified Parameters ---------- configuration_views: tuple of XrViewConfigurationView structure A [XrViewConfigurationView](https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrViewConfigurationView) structure specifies properties related to rendering of a view (e.g. the optimal width and height to be used when rendering the view) left: numpy.ndarray RGB or RGBA image (numpy.uint8) right: numpy.ndarray or None RGB or RGBA image (numpy.uint8) Returns ------- bool True if there is no error during the passing to the selected graphics API, otherwise False """ use_rgba = True if left.shape[2] == 4 else False if self._disable_openxr: return True if self._use_ctypes: self._frame_left = self._transform(configuration_views[0], left) if right is None: return bool(self._lib.setFrames(self._app, self._frame_left.shape[1], self._frame_left.shape[0], self._frame_left.ctypes.data_as(ctypes.c_void_p), 0, 0, None, use_rgba)) else: self._frame_right = self._transform(configuration_views[1], right) return bool(self._lib.setFrames(self._app, self._frame_left.shape[1], self._frame_left.shape[0], self._frame_left.ctypes.data_as(ctypes.c_void_p), self._frame_right.shape[1], self._frame_right.shape[0], self._frame_right.ctypes.data_as(ctypes.c_void_p), use_rgba)) else: self._frame_left = self._transform(configuration_views[0], left) if right is None: return self._app.setFrames(self._frame_left, np.array(None), use_rgba) else: self._frame_right = self._transform(configuration_views[1], right) return self._app.setFrames(self._frame_left, self._frame_right, use_rgba) def _transform(self, configuration_view: XrViewConfigurationView, frame: np.ndarray) -> np.ndarray: transformed = False if self._transform_flip is not None: transformed = True frame = np.flip(frame, axis=self._transform_flip) if self._transform_fit: transformed = True current_ratio = frame.shape[1] / frame.shape[0] recommended_ratio = configuration_view.recommendedImageRectWidth / configuration_view.recommendedImageRectHeight recommended_size = (configuration_view.recommendedImageRectWidth, configuration_view.recommendedImageRectHeight) if current_ratio > recommended_ratio: m = int(abs(recommended_ratio * frame.shape[0] - frame.shape[1]) / 2) frame = cv2.resize(frame[:, m:-m] if m else frame, recommended_size, interpolation=cv2.INTER_LINEAR) else: m = int(abs(frame.shape[1] / recommended_ratio - frame.shape[0]) / 2) frame = cv2.resize(frame[m:-m, :] if m else frame, recommended_size, interpolation=cv2.INTER_LINEAR) return np.array(frame, copy=True) if transformed else frame if __name__ == "__main__": import cv2 import time import argparse parser = argparse.ArgumentParser() parser.add_argument('--ctypes', default=False, action="store_true", help='use ctypes instead of pybind11') args = parser.parse_args() _xr = acquire_openxr_interface() _xr.init(use_ctypes=args.ctypes) ready = False end = False def callback_action_pose(path, value): print(path, value) return def callback_action(path, value): if path in ["/user/hand/left/input/menu/click", "/user/hand/right/input/menu/click"]: # print(path, value) print(_xr.apply_haptic_feedback("/user/hand/left/output/haptic", {"duration": 1000000})) print(_xr.apply_haptic_feedback("/user/hand/right/output/haptic", {"duration": 1000000})) if _xr.create_instance(): if _xr.get_system(): _xr.subscribe_action_event("/user/head/input/volume_up/click", callback=callback_action) _xr.subscribe_action_event("/user/head/input/volume_down/click", callback=callback_action) _xr.subscribe_action_event("/user/head/input/mute_mic/click", callback=callback_action) _xr.subscribe_action_event("/user/hand/left/input/trigger/value", callback=callback_action) _xr.subscribe_action_event("/user/hand/right/input/trigger/value", callback=callback_action) _xr.subscribe_action_event("/user/hand/left/input/menu/click", callback=callback_action) _xr.subscribe_action_event("/user/hand/right/input/menu/click", callback=callback_action) _xr.subscribe_action_event("/user/hand/left/input/grip/pose", callback=callback_action_pose, reference_space=XR_REFERENCE_SPACE_TYPE_LOCAL) _xr.subscribe_action_event("/user/hand/right/input/grip/pose", callback=callback_action_pose, reference_space=XR_REFERENCE_SPACE_TYPE_LOCAL) _xr.subscribe_action_event("/user/hand/left/output/haptic", callback=callback_action) _xr.subscribe_action_event("/user/hand/right/output/haptic", callback=callback_action) if _xr.create_session(): ready = True else: print("[ERROR]:", "createSession") else: print("[ERROR]:", "getSystem") else: print("[ERROR]:", "createInstance") if ready: cap = cv2.VideoCapture("/home/argus/Videos/xr/xr/sample.mp4") def callback_render(num_views, views, configuration_views): pass # global end # ret, frame = cap.read() # if ret: # if num_views == 2: # frame1 = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) # _xr.set_frames(configuration_views, frame, frame1) # # show frame # k = 0.25 # frame = cv2.resize(np.hstack((frame, frame1)), (int(2*k*frame.shape[1]), int(k*frame.shape[0]))) # cv2.imshow('frame', frame) # if cv2.waitKey(1) & 0xFF == ord('q'): # exit() # else: # end = True _xr.subscribe_render_event(callback_render) # while(cap.isOpened() or not end): for i in range(10000000): if _xr.poll_events(): if _xr.is_session_running(): if not _xr.poll_actions(): print("[ERROR]:", "pollActions") break if not _xr.render_views(): print("[ERROR]:", "renderViews") break else: print("wait for is_session_running()") time.sleep(0.1) else: break print("END")
58,615
Python
47.928214
301
0.61387
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/semu/xr/openxr/scripts/extension.py
import gc import carb import omni.ext try: import cv2 except: omni.kit.pipapi.install("opencv-python") try: from .. import _openxr as _openxr except: print(">>>> [DEVELOPMENT] import openxr") from .. import openxr as _openxr __all__ = ["Extension", "_openxr"] class Extension(omni.ext.IExt): def on_startup(self, ext_id): # get extension settings self._settings = carb.settings.get_settings() disable_openxr = self._settings.get("/exts/semu.xr.openxr/disable_openxr") self._xr = _openxr.acquire_openxr_interface(disable_openxr=disable_openxr) def on_shutdown(self): _openxr.release_openxr_interface(self._xr) gc.collect()
703
Python
24.142856
82
0.657183
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/semu/xr/openxr/tests/__init__.py
from .test_openxr import *
27
Python
12.999994
26
0.740741
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/semu/xr/openxr/tests/test_openxr.py
# NOTE: # omni.kit.test - std python's unittest module with additional wrapping to add suport for async/await tests # For most things refer to unittest docs: https://docs.python.org/3/library/unittest.html import omni.kit.test # Import extension python module we are testing with absolute import path, as if we are external user (other extension) from semu.xr.openxr import _openxr import cv2 import time import numpy as np # Having a test class dervived from omni.kit.test.AsyncTestCase declared on the root of module will make it auto-discoverable by omni.kit.test class TestOpenXR(omni.kit.test.AsyncTestCaseFailOnLogError): # Before running each test async def setUp(self): pass # After running each test async def tearDown(self): pass def render(self, num_frames, width, height, color): self._frame = np.ones((height, width, 3), dtype=np.uint8) self._frame = cv2.circle(self._frame, (int(width / 2), int(height / 2)), int(np.min([width, height]) / 4), color, int(0.05 * np.min([width, height]))) self._frame = cv2.circle(self._frame, (int(width / 3), int(height / 3)), int(0.1 * np.min([width, height])), color, -1) start_time = time.clock() for i in range(num_frames): if self._xr.poll_events(): if self._xr.is_session_running(): if not self._xr.poll_actions(): print("[ERROR]:", "pollActions") return if not self._xr.render_views(): print("[ERROR]:", "renderViews") return end_time = time.clock() delta = end_time - start_time print("----------") print("FPS: {} ({} frames / {} seconds)".format(num_frames / delta, num_frames, delta)) print("RESOLUTION: {} x {}".format(self._frame.shape[1], self._frame.shape[0])) # Actual test, notice it is "async" function, so "await" can be used if needed async def test_openxr(self): self._xr = _openxr.acquire_openxr_interface() self._xr.init() ready = False if self._xr.create_instance(): if self._xr.get_system(): if self._xr.create_action_set(): if self._xr.create_session(): ready = True else: print("[ERROR]:", "createSession") else: print("[ERROR]:", "createActionSet") else: print("[ERROR]:", "getSystem") else: print("[ERROR]:", "createInstance") if ready: for i in range(1000): if self._xr.poll_events(): if self._xr.is_session_running(): if not self._xr.poll_actions(): print("[ERROR]:", "pollActions") break # if ready: # def callback_render(num_views, views, configuration_views): # self._xr.set_frames(configuration_views, self._frame, self._frame, self._transform) # self._xr.subscribe_render_event(callback_render) # num_frames = 100 # print("") # print("transform = True") # self._transform = True # self.render(num_frames=num_frames, width=1560, height=1732, color=(255,0,0)) # self.render(num_frames=num_frames, width=1280, height=720, color=(0,255,0)) # self.render(num_frames=num_frames, width=500, height=500, color=(0,0,255)) # print("") # print("transform = False") # self._transform = False # self.render(num_frames=num_frames, width=1560, height=1732, color=(255,0,0)) # self.render(num_frames=num_frames, width=1280, height=720, color=(0,255,0)) # self.render(num_frames=num_frames, width=500, height=500, color=(0,0,255)) # print("") # _openxr.release_openxr_interface(self._xr) # self._xr = None
4,250
Python
40.271844
142
0.527529
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/semu/xr/openxr_ui/scripts/extension.py
import math import weakref import pxr import omni import carb import omni.ext import omni.ui as ui from pxr import UsdGeom from omni.kit.menu.utils import add_menu_items, remove_menu_items, MenuItemDescription from semu.xr.openxr import _openxr class Extension(omni.ext.IExt): def on_startup(self, ext_id): # get extension settings self._settings = carb.settings.get_settings() self._disable_openxr = self._settings.get("/exts/semu.xr.openxr/disable_openxr") self._window = None self._menu_items = [MenuItemDescription(name="OpenXR UI", onclick_fn=lambda a=weakref.proxy(self): a._menu_callback())] add_menu_items(self._menu_items, "Add-ons") self._xr = None self._ready = False self._timeline = omni.timeline.get_timeline_interface() self._physx_subs = omni.physx.get_physx_interface().subscribe_physics_step_events(self._on_simulation_step) def on_shutdown(self): self._physx_subs = None remove_menu_items(self._menu_items, "Add-ons") self._window = None def _get_reference_space(self): reference_space = [_openxr.XR_REFERENCE_SPACE_TYPE_VIEW, _openxr.XR_REFERENCE_SPACE_TYPE_LOCAL, _openxr.XR_REFERENCE_SPACE_TYPE_STAGE] return reference_space[self._xr_settings_reference_space.model.get_item_value_model().as_int] def _get_origin_pose(self): space_origin_position = [self._xr_settings_space_origin_position.model.get_item_value_model(i).as_float for i in self._xr_settings_space_origin_position.model.get_item_children()] space_origin_rotation = [self._xr_settings_space_origin_rotation.model.get_item_value_model(i).as_int for i in self._xr_settings_space_origin_rotation.model.get_item_children()] return {"position": pxr.Gf.Vec3d(*space_origin_position), "rotation": pxr.Gf.Vec3d(*space_origin_rotation)} def _get_frame_transformations(self): transform_fit = self._xr_settings_transform_fit.model.get_value_as_bool() transform_flip = [None, 0, 1, (0,1)] transform_flip = transform_flip[self._xr_settings_transform_flip.model.get_item_value_model().as_int] return {"fit": transform_fit, "flip": transform_flip} def _get_stereo_rectification(self): return [self._xr_settings_stereo_rectification.model.get_item_value_model(i).as_float * math.pi / 180.0 for i in self._xr_settings_stereo_rectification.model.get_item_children()] def _menu_callback(self): self._build_ui() def _on_start_openxr(self): # get parameters from ui graphics = [_openxr.XR_KHR_OPENGL_ENABLE_EXTENSION_NAME] graphics = graphics[self._xr_settings_graphics_api.model.get_item_value_model().as_int] form_factor = [_openxr.XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY, _openxr.XR_FORM_FACTOR_HANDHELD_DISPLAY] form_factor = form_factor[self._xr_settings_form_factor.model.get_item_value_model().as_int] blend_mode = [_openxr.XR_ENVIRONMENT_BLEND_MODE_OPAQUE, _openxr.XR_ENVIRONMENT_BLEND_MODE_ADDITIVE, _openxr.XR_ENVIRONMENT_BLEND_MODE_ALPHA_BLEND] blend_mode = blend_mode[self._xr_settings_blend_mode.model.get_item_value_model().as_int] view_configuration_type = [_openxr.XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO, _openxr.XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO] view_configuration_type = view_configuration_type[self._xr_settings_view_configuration_type.model.get_item_value_model().as_int] # disable static parameters ui self._xr_settings_graphics_api.enabled = False self._xr_settings_form_factor.enabled = False self._xr_settings_blend_mode.enabled = False self._xr_settings_view_configuration_type.enabled = False if self._xr is None: self._xr = _openxr.acquire_openxr_interface(disable_openxr=self._disable_openxr) if not self._xr.init(graphics=graphics, use_ctypes=False): print("[ERROR] OpenXR.init with graphics: {}".format(graphics)) # set stage unit stage = omni.usd.get_context().get_stage() self._xr.set_meters_per_unit(UsdGeom.GetStageMetersPerUnit(stage)) # setup OpenXR application using default and ui parameters if self._xr.create_instance(): if self._xr.get_system(form_factor=form_factor, blend_mode=blend_mode, view_configuration_type=view_configuration_type): # create session and define interaction profiles if self._xr.create_session(): # setup cameras and viewports and prepare rendering using the internal callback if view_configuration_type == _openxr.XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO: self._xr.setup_mono_view() elif view_configuration_type == _openxr.XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO: self._xr.setup_stereo_view() # enable/disable buttons self._ui_start_xr.enabled = False self._ui_stop_xr.enabled = True # play self._timeline.play() self._ready = True return else: print("[ERROR] OpenXR.create_session") else: print("[ERROR] OpenXR.get_system with form_factor: {}, blend_mode: {}, view_configuration_type: {}".format(form_factor, blend_mode, view_configuration_type)) else: print("[ERROR] OpenXR.create_instance") self._on_stop_openxr() def _on_stop_openxr(self): self._ready = False _openxr.release_openxr_interface(self._xr) self._xr = None # enable static parameters ui self._xr_settings_graphics_api.enabled = True self._xr_settings_form_factor.enabled = True self._xr_settings_blend_mode.enabled = True self._xr_settings_view_configuration_type.enabled = True # enable/disable buttons self._ui_start_xr.enabled = True self._ui_stop_xr.enabled = False def _on_simulation_step(self, step): if self._ready and self._xr is not None: # origin self._xr.set_reference_system_pose(**self._get_origin_pose()) # transformation and rectification self._xr.set_stereo_rectification(*self._get_stereo_rectification()) self._xr.set_frame_transformations(**self._get_frame_transformations()) # action and rendering loop if not self._xr.poll_events(): self._on_stop_openxr() return if self._xr.is_session_running(): if not self._xr.poll_actions(): self._on_stop_openxr() return if not self._xr.render_views(self._get_reference_space()): self._on_stop_openxr() return def _build_ui(self): if not self._window: self._window = ui.Window(title="OpenXR UI", width=300, height=375, visible=True, dockPreference=ui.DockPreference.LEFT_BOTTOM) with self._window.frame: with ui.VStack(): ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Graphics API:", width=85, tooltip="OpenXR graphics API supported by the runtime") self._xr_settings_graphics_api = ui.ComboBox(0, "OpenGL") ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Form factor:", width=80, tooltip="XrFormFactor enum. HEAD_MOUNTED_DISPLAY: the tracked display is attached to the user's head. HANDHELD_DISPLAY: the tracked display is held in the user's hand, independent from the user's head") self._xr_settings_form_factor = ui.ComboBox(0, "Head Mounted Display", "Handheld Display") ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Blend mode:", width=80, tooltip="XrEnvironmentBlendMode enum. OPAQUE: display the composition layers with no view of the physical world behind them. ADDITIVE: additively blend the composition layers with the real world behind the display. ALPHA BLEND: alpha-blend the composition layers with the real world behind the display") self._xr_settings_blend_mode = ui.ComboBox(0, "Opaque", "Additive", "Alpha blend") ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("View configuration type:", width=145, tooltip="XrViewConfigurationType enum. MONO: one primary display (e.g. an AR phone's screen). STEREO: two primary displays, which map to a left-eye and right-eye view") self._xr_settings_view_configuration_type = ui.ComboBox(1, "Mono", "Stereo") ui.Spacer(height=5) ui.Separator(height=1, width=0) ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Space origin:", width=85) ui.Spacer(height=5) with ui.HStack(height=0): ui.Label(" |-- Position (in stage unit):", width=165, tooltip="Cartesian position (in stage unit) used as reference origin") self._xr_settings_space_origin_position = ui.MultiFloatDragField(0.0, 0.0, 0.0, step=0.1) ui.Spacer(height=5) with ui.HStack(height=0): ui.Label(" |-- Rotation (XYZ):", width=110, tooltip="Rotation (in degress) on each axis used as reference origin") self._xr_settings_space_origin_rotation = ui.MultiIntDragField(0, 0, 0, min=-180, max=180) ui.Spacer(height=5) with ui.HStack(height=0): style = {"Tooltip": {"width": 50, "word-wrap": "break-word"}} ui.Label("Reference space (views):", width=145, tooltip="XrReferenceSpaceType enum. VIEW: track the view origin for the primary viewer. LOCAL: establish a world-locked origin. STAGE: runtime-defined space that can be walked around on", style=style) self._xr_settings_reference_space = ui.ComboBox(1, "View", "Local", "Stage") ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Stereo rectification (x,y,z):", width=150, tooltip="Angle (in degrees) on each rotation axis for stereoscopic rectification") self._xr_settings_stereo_rectification = ui.MultiFloatDragField(0.0, 0.0, 0.0, min=-10, max=10, step=0.1) ui.Spacer(height=5) with ui.HStack(height=0): ui.Label("Frame transformations:") ui.Spacer(height=5) with ui.HStack(height=0): ui.Label(" |-- Fit:", width=45, tooltip="Adjust each rendered image to the recommended resolution of the display device by cropping and scaling the image from its center") self._xr_settings_transform_fit = ui.CheckBox() ui.Spacer(height=5) with ui.HStack(height=0): ui.Label(" |-- Flip:", width=45, tooltip="Flip each image with respect to its view") self._xr_settings_transform_flip = ui.ComboBox(0, "None", "Vertical", "Horizontal", "Both") ui.Spacer(height=5) ui.Separator(height=1, width=0) ui.Spacer(height=5) with ui.HStack(height=0): self._ui_start_xr = ui.Button("Start OpenXR", height=0, clicked_fn=self._on_start_openxr) self._ui_stop_xr = ui.Button("Stop OpenXR", height=0, clicked_fn=self._on_stop_openxr) self._ui_stop_xr.enabled = False
12,268
Python
55.800926
361
0.593332
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/config/extension.toml
[core] reloadable = true order = 0 [package] version = "0.0.4-beta" category = "Other" feature = false app = false title = "OpenXR (compact binding)" description = "OpenXR compact binding for Omniverse" authors = ["Toni-SM"] repository = "https://github.com/Toni-SM/semu.xr.openxr" keywords = ["OpenXR", "XR", "VR", "AR"] changelog = "docs/CHANGELOG.md" readme = "docs/README.md" preview_image = "data/preview.png" icon = "data/icon.png" [package.target] config = ["release"] platform = ["linux-x86_64"] python = ["py37", "cp37"] [dependencies] "omni.ui" = {} "omni.physx" = {} "omni.kit.uiapp" = {} "omni.kit.pipapi" = {} "omni.syntheticdata" = {} "omni.kit.menu.utils" = {} "omni.kit.window.viewport" = {} [[python.module]] name = "semu.xr.openxr" [[python.module]] name = "semu.xr.openxr_ui" [[python.module]] name = "semu.xr.openxr.tests" [python.pipapi] requirements = ["opencv-python"] use_online_index = true [settings] exts."semu.xr.openxr".disable_openxr = false
980
TOML
19.020408
56
0.668367
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.0.4-beta] - 2022-09-14 ### Added - Add `set_meters_per_unit` method for specifying the unit factor to be applied to transformations ### Changed - Use float input field for getting the reference position from UI ## [0.0.3-beta] - 2022-09-09 ### Added - Add `disable_openxr` flag to configuration settings for testing the extension ### Fixed - Enable RGB sensors when setting up mono/stereo views ## [0.0.2-beta] - 2022-05-22 ### Added - Source code (src folder) ### Changed - Rename the extension to `semu.xr.openxr` ## [0.0.1-beta] - 2021-10-01 ### Added - Create OpenXR compact binding with OpenGL support
716
Markdown
23.724137
98
0.702514
Toni-SM/semu.xr.openxr/src/semu.xr.openxr/docs/README.md
# semu.xr.openxr This extension provides a compact python binding (on top of the open standard OpenXR for augmented reality (AR) and virtual reality (VR)) to create extended reality applications taking advantage of NVIDIA Omniverse rendering capabilities Visit https://github.com/Toni-SM/semu.xr.openxr to read more about its use
333
Markdown
46.714279
237
0.804805
omniverse-code/kit/gsl/README.packman.md
* Package: gsl * Version: 3.1.0.1 * From: ssh://[email protected]:12051/omniverse/externals/gsl.git * Branch: master * Commit: 5e0543eb9d231a0d3ccd7f5789aa51d1c896f6ae * Time: Fri Nov 06 14:03:26 2020 * Computername: KPICOTT-LT * Packman: 5.13.2
257
Markdown
27.666664
76
0.750973
omniverse-code/kit/gsl/appveyor.yml
shallow_clone: true platform: - x86 - x64 configuration: - Debug - Release image: - Visual Studio 2017 - Visual Studio 2019 environment: NINJA_TAG: v1.8.2 NINJA_SHA512: 9B9CE248240665FCD6404B989F3B3C27ED9682838225E6DC9B67B551774F251E4FF8A207504F941E7C811E7A8BE1945E7BCB94472A335EF15E23A0200A32E6D5 NINJA_PATH: C:\Tools\ninja\ninja-%NINJA_TAG% VCVAR2017: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat' VCVAR2019: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat' matrix: - GSL_CXX_STANDARD: 14 USE_TOOLSET: MSVC USE_GENERATOR: MSBuild - GSL_CXX_STANDARD: 17 USE_TOOLSET: MSVC USE_GENERATOR: MSBuild - GSL_CXX_STANDARD: 14 USE_TOOLSET: LLVM USE_GENERATOR: Ninja - GSL_CXX_STANDARD: 17 USE_TOOLSET: LLVM USE_GENERATOR: Ninja cache: - C:\cmake-3.14.4-win32-x86 - C:\Tools\ninja install: - ps: | if (![IO.File]::Exists("$env:NINJA_PATH\ninja.exe")) { Start-FileDownload ` "https://github.com/ninja-build/ninja/releases/download/$env:NINJA_TAG/ninja-win.zip" $hash = (Get-FileHash ninja-win.zip -Algorithm SHA512).Hash if ($env:NINJA_SHA512 -eq $hash) { 7z e -y -bso0 ninja-win.zip -o"$env:NINJA_PATH" } else { Write-Warning "Ninja download hash changed!"; Write-Output "$hash" } } if ([IO.File]::Exists("$env:NINJA_PATH\ninja.exe")) { $env:PATH = "$env:NINJA_PATH;$env:PATH" } else { Write-Warning "Failed to find ninja.exe in expected location." } if ($env:USE_TOOLSET -ne "LLVM") { if (![IO.File]::Exists("C:\cmake-3.14.0-win32-x86\bin\cmake.exe")) { Start-FileDownload 'https://cmake.org/files/v3.14/cmake-3.14.4-win32-x86.zip' 7z x -y -bso0 cmake-3.14.4-win32-x86.zip -oC:\ } $env:PATH="C:\cmake-3.14.4-win32-x86\bin;$env:PATH" } before_build: - ps: | if ("$env:USE_GENERATOR" -eq "Ninja") { $GeneratorFlags = '-k 10' $Architecture = $env:PLATFORM if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") { $env:VCVARSALL = "`"$env:VCVAR2017`" $Architecture" } else { $env:VCVARSALL = "`"$env:VCVAR2019`" $Architecture" } $env:CMakeGenFlags = "-G Ninja -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD" } else { $GeneratorFlags = '/m /v:minimal' if ("$env:APPVEYOR_BUILD_WORKER_IMAGE" -eq "Visual Studio 2017") { $Generator = 'Visual Studio 15 2017' } else { $Generator = 'Visual Studio 16 2019' } if ("$env:PLATFORM" -eq "x86") { $Architecture = "Win32" } else { $Architecture = "x64" } if ("$env:USE_TOOLSET" -eq "LLVM") { $env:CMakeGenFlags = "-G `"$Generator`" -A $Architecture -T llvm -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD" } else { $env:CMakeGenFlags = "-G `"$Generator`" -A $Architecture -DGSL_CXX_STANDARD=$env:GSL_CXX_STANDARD" } } if ("$env:USE_TOOLSET" -eq "LLVM") { $env:CC = "clang-cl" $env:CXX = "clang-cl" if ("$env:PLATFORM" -eq "x86") { $env:CFLAGS = "-m32"; $env:CXXFLAGS = "-m32"; } else { $env:CFLAGS = "-m64"; $env:CXXFLAGS = "-m64"; } } $env:CMakeBuildFlags = "--config $env:CONFIGURATION -- $GeneratorFlags" - mkdir build - cd build - if %USE_GENERATOR%==Ninja (call %VCVARSALL%) - echo %CMakeGenFlags% - cmake .. %CMakeGenFlags% build_script: - echo %CMakeBuildFlags% - cmake --build . %CMakeBuildFlags% test_script: - ctest -j2 deploy: off
3,759
YAML
31.695652
144
0.592445
omniverse-code/kit/gsl/README.md
# GSL: Guidelines Support Library [![Build Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL) [![Build status](https://ci.appveyor.com/api/projects/status/github/Microsoft/GSL?svg=true)](https://ci.appveyor.com/project/neilmacintosh/GSL) The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org). This repo contains Microsoft's implementation of GSL. The library includes types like `span<T>`, `string_span`, `owner<>` and others. The entire implementation is provided inline in the headers under the [gsl](./include/gsl) directory. The implementation generally assumes a platform that implements C++14 support. While some types have been broken out into their own headers (e.g. [gsl/span](./include/gsl/span)), it is simplest to just include [gsl/gsl](./include/gsl/gsl) and gain access to the entire library. > NOTE: We encourage contributions that improve or refine any of the types in this library as well as ports to other platforms. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more information about contributing. # Project Code of Conduct This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. # Usage of Third Party Libraries This project makes use of the [Google Test](https://github.com/google/googletest) testing library. Please see the [ThirdPartyNotices.txt](./ThirdPartyNotices.txt) file for details regarding the licensing of Google Test. # Quick Start ## Supported Compilers The GSL officially supports the current and previous major release of MSVC, GCC, Clang, and XCode's Apple-Clang. See our latest test results for the most up-to-date list of supported configurations. Compiler |Toolset Versions Currently Tested| Build Status :------- |:--|------------: XCode |11.4 & 10.3 | [![Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL) GCC |9 & 8| [![Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL) Clang |11 & 10| [![Status](https://travis-ci.org/Microsoft/GSL.svg?branch=master)](https://travis-ci.org/Microsoft/GSL) Visual Studio with MSVC | VS2017 (15.9) & VS2019 (16.4) | [![Status](https://ci.appveyor.com/api/projects/status/github/Microsoft/GSL?svg=true)](https://ci.appveyor.com/project/neilmacintosh/GSL) Visual Studio with LLVM | VS2017 (Clang 9) & VS2019 (Clang 10) | [![Status](https://ci.appveyor.com/api/projects/status/github/Microsoft/GSL?svg=true)](https://ci.appveyor.com/project/neilmacintosh/GSL) Note: For `gsl::byte` to work correctly with Clang and GCC you might have to use the ` -fno-strict-aliasing` compiler option. --- If you successfully port GSL to another platform, we would love to hear from you! - Submit an issue specifying the platform and target. - Consider contributing your changes by filing a pull request with any necessary changes. - If at all possible, add a CI/CD step and add the button to the table below! Target | CI/CD Status :------- | -----------: iOS | ![CI](https://github.com/microsoft/GSL/workflows/CI/badge.svg) Android | ![CI](https://github.com/microsoft/GSL/workflows/CI/badge.svg) Note: These CI/CD steps are run with each pull request, however failures in them are non-blocking. ## Building the tests To build the tests, you will require the following: * [CMake](http://cmake.org), version 3.1.3 (3.2.3 for AppleClang) or later to be installed and in your PATH. These steps assume the source code of this repository has been cloned into a directory named `c:\GSL`. 1. Create a directory to contain the build outputs for a particular architecture (we name it c:\GSL\build-x86 in this example). cd GSL md build-x86 cd build-x86 2. Configure CMake to use the compiler of your choice (you can see a list by running `cmake --help`). cmake -G "Visual Studio 15 2017" c:\GSL 3. Build the test suite (in this case, in the Debug configuration, Release is another good choice). cmake --build . --config Debug 4. Run the test suite. ctest -C Debug All tests should pass - indicating your platform is fully supported and you are ready to use the GSL types! ## Building GSL - Using vcpkg You can download and install GSL using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager: git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install vcpkg install ms-gsl The GSL port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. ## Using the libraries As the types are entirely implemented inline in headers, there are no linking requirements. You can copy the [gsl](./include/gsl) directory into your source tree so it is available to your compiler, then include the appropriate headers in your program. Alternatively set your compiler's *include path* flag to point to the GSL development folder (`c:\GSL\include` in the example above) or installation folder (after running the install). Eg. MSVC++ /I c:\GSL\include GCC/clang -I$HOME/dev/GSL/include Include the library using: #include <gsl/gsl> ## Usage in CMake The library provides a Config file for CMake, once installed it can be found via find_package(Microsoft.GSL CONFIG) Which, when successful, will add library target called `Microsoft.GSL::GSL` which you can use via the usual `target_link_libraries` mechanism. ## Debugging visualization support For Visual Studio users, the file [GSL.natvis](./GSL.natvis) in the root directory of the repository can be added to your project if you would like more helpful visualization of GSL types in the Visual Studio debugger than would be offered by default.
6,291
Markdown
50.154471
332
0.750437
omniverse-code/kit/gsl/PACKAGE-LICENSES/gsl-LICENSE.md
Copyright (c) 2015 Microsoft Corporation. All rights reserved. This code is licensed under the MIT License (MIT). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,156
Markdown
51.590907
81
0.792388
omniverse-code/kit/exts/omni.kit.material.library/docs/index.rst
omni.kit.material.library ########################### Material Library .. toctree:: :maxdepth: 1 CHANGELOG Python API Reference ********************* .. automodule:: omni.kit.material.library :platform: Windows-x86_64, Linux-x86_64 :members: :undoc-members: :imported-members: :exclude-members: chain :noindex: omni.usd._impl.utils.PrimCaching
383
reStructuredText
14.359999
46
0.597911
omniverse-code/kit/exts/omni.kit.window.imageviewer/config/extension.toml
[package] version = "1.0.6" category = "Internal" feature = true title = "Image Viewer" description="Adds context menu in the Content Browser that allows to view images." authors = ["NVIDIA"] changelog = "docs/CHANGELOG.md" preview_image = "data/preview.png" icon = "data/icon.png" readme = "docs/README.md" [dependencies] "omni.ui" = {} "omni.kit.widget.imageview" = {} "omni.kit.window.content_browser" = { optional=true } "omni.kit.test" = {} "omni.usd.libs" = {} [[python.module]] name = "omni.kit.window.imageviewer" # Additional python module with tests, to make them discoverable by test system. [[python.module]] name = "omni.kit.window.imageviewer.tests" [[test]] args = ["--/app/window/dpiScaleOverride=1.0", "--/app/window/scaleToMonitor=false"] dependencies = [ "omni.kit.mainwindow", "omni.kit.renderer.capture", ] pythonTests.unreliable = [ "*test_general" # OM-49017 ]
902
TOML
23.405405
83
0.695122
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/imageviewer.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import omni.kit.widget.imageview as imageview import omni.ui as ui from .singleton import singleton @singleton class ViewerWindows: """This object keeps all the Image Viewper windows""" def __init__(self): self.__windows = {} def open_window(self, filepath: str) -> ui.Window: """Open ImageViewer window with the image file opened in it""" if filepath in self.__windows: window = self.__windows[filepath] window.visible = True else: window = ImageViewer(filepath) # When window is closed, remove it from the list window.set_visibility_changed_fn(lambda _, f=filepath: self.close(f)) self.__windows[filepath] = window return window def close(self, filepath): """Close and remove spacific window""" del self.__windows[filepath] def close_all(self): """Close and remove all windows""" self.__windows = {} class ImageViewer(ui.Window): """The window with Image Viewer""" def __init__(self, filename: str, **kwargs): if "width" not in kwargs: kwargs["width"] = 640 if "height" not in kwargs: kwargs["height"] = 480 super().__init__(filename, **kwargs) self.frame.set_style({"Window": {"background_color": 0xFF000000, "border_width": 0}}) self.frame.set_build_fn(self.__build_window) self.__filename = filename def __build_window(self): """Called to build the widgets of the window""" # For now it's only one single widget imageview.ImageView(self.__filename, smooth_zoom=True, style={"ImageView": {"background_color": 0xFF000000}}) def destroy(self): pass
2,181
Python
33.093749
117
0.644658
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/imageviewer_utils.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import omni.kit.app def is_extension_loaded(extansion_name: str) -> bool: """ Returns True if the extension with the given name is loaded. """ def is_ext(ext_id: str, extension_name: str) -> bool: id_name = omni.ext.get_extension_name(ext_id) return id_name == extension_name app = omni.kit.app.get_app_interface() ext_manager = app.get_extension_manager() extensions = ext_manager.get_extensions() loaded = next((ext for ext in extensions if is_ext(ext["id"], extansion_name) and ext["enabled"]), None) return bool(loaded)
1,015
Python
35.285713
108
0.721182
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/content_menu.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from .imageviewer import ViewerWindows from .imageviewer_utils import is_extension_loaded def content_available(): """ Returns True if the extension "omni.kit.window.content_browser" is loaded. """ return is_extension_loaded("omni.kit.window.content_browser") class ContentMenu: """ When this object is alive, Content Browser has the additional context menu with the items that allow to view image files. """ def __init__(self, version: int = 2): if version != 2: raise RuntimeError("Only version 2 is supported") content_window = self._get_content_window() if content_window: view_menu_name = "Show Image" self.__view_menu_subscription = content_window.add_file_open_handler( view_menu_name, lambda file_path: self._on_show_triggered(view_menu_name, file_path), self._is_show_visible, ) else: self.__view_menu_subscription = None def _get_content_window(self): try: import omni.kit.window.content_browser as content except ImportError: return None return content.get_content_window() def _is_show_visible(self, content_url): """True if we can show the menu item View Image""" # List of available formats: carb/source/plugins/carb.imaging/Imaging.cpp return any( content_url.endswith(f".{ext}") for ext in ["bmp", "dds", "exr", "gif", "hdr", "jpeg", "jpg", "png", "psd", "svg", "tga"] ) def _on_show_triggered(self, menu, value): """Start watching for the layer and run the editor""" ViewerWindows().open_window(value) def destroy(self): """Stop all watchers and remove the menu from the content browser""" if self.__view_menu_subscription: content_window = self._get_content_window() if content_window: content_window.delete_file_open_handler(self.__view_menu_subscription) self.__view_menu_subscription = None ViewerWindows().close_all()
2,572
Python
36.289855
101
0.640747
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/imageviewer_extension.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import omni.ext from .content_menu import content_available from .content_menu import ContentMenu class ImageViewerExtension(omni.ext.IExt): def __init__(self): super().__init__() self.__imageviewer = None self.__extensions_subscription = None # noqa: PLW0238 self.__content_menu = None def on_startup(self, ext_id): # Setup a callback when any extension is loaded/unloaded app = omni.kit.app.get_app_interface() ext_manager = app.get_extension_manager() self.__extensions_subscription = ( # noqa: PLW0238 ext_manager.get_change_event_stream().create_subscription_to_pop( self._on_event, name="omni.kit.window.imageviewer" ) ) self.__content_menu = None self._on_event(None) def _on_event(self, event): """Called when any extension is loaded/unloaded""" if self.__content_menu: if not content_available(): self.__content_menu.destroy() self.__content_menu = None else: if content_available(): self.__content_menu = ContentMenu() def on_shutdown(self): if self.__imageviewer: self.__imageviewer.destroy() self.__imageviewer = None self.__extensions_subscription = None # noqa: PLW0238 if self.__content_menu: self.__content_menu.destroy() self.__content_menu = None
1,922
Python
33.963636
77
0.632154
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/singleton.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # def singleton(class_): """A singleton decorator""" instances = {} def getinstance(*args, **kwargs): if class_ not in instances: instances[class_] = class_(*args, **kwargs) return instances[class_] return getinstance
697
Python
32.238094
76
0.725968
omniverse-code/kit/exts/omni.kit.window.imageviewer/omni/kit/window/imageviewer/tests/imageviewer_test.py
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from pathlib import Path from omni.ui.tests.test_base import OmniUiTest import omni.kit import omni.ui as ui from ..imageviewer import ViewerWindows class TestImageViewer(OmniUiTest): # Before running each test async def setUp(self): await super().setUp() extension_path = omni.kit.app.get_app().get_extension_manager().get_extension_path_by_module(__name__) self._golden_img_dir = Path(extension_path).joinpath("data").joinpath("tests").absolute() # After running each test async def tearDown(self): self._golden_img_dir = None await super().tearDown() async def test_general(self): window = await self.create_test_window() # noqa: PLW0612, F841 await omni.kit.app.get_app().next_update_async() viewer = ViewerWindows().open_window(f"{self._golden_img_dir.joinpath('lenna.png')}") viewer.flags = ui.WINDOW_FLAGS_NO_SCROLLBAR | ui.WINDOW_FLAGS_NO_TITLE_BAR | ui.WINDOW_FLAGS_NO_RESIZE viewer.position_x = 0 viewer.position_y = 0 viewer.width = 256 viewer.height = 256 # One frame to show the window and another to build the frame # And a dozen frames more to let the asset load for _ in range(20): await omni.kit.app.get_app().next_update_async() await self.finalize_test(golden_img_dir=self._golden_img_dir)
1,817
Python
36.10204
110
0.693451
omniverse-code/kit/exts/omni.kit.window.imageviewer/docs/CHANGELOG.md
# Changelog The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.0.6] - 2022-06-17 ### Changed - Properly linted ## [1.0.5] - 2021-09-20 ### Changed - Fixed unittest path to golden image. ## [1.0.4] - 2021-08-18 ### Changed - Fixed console_browser leak ## [1.0.3] - 2020-12-08 ### Added - Description, preview image and icon ### Changed - Fixed crash on exit ## [1.0.2] - 2020-11-25 ### Changed - Pasting an image URL into the content window's browser bar or double clicking opens the file. ## [1.0.1] - 2020-11-12 ### Changed - Fixed exception in Create ## [1.0.0] - 2020-07-19 ### Added - Adds context menu in the Content Browser
674
Markdown
18.852941
95
0.655786
omniverse-code/kit/exts/omni.kit.window.imageviewer/docs/README.md
# Image Viewer [omni.kit.window.imageviewer] It's The extension that can display stored graphical images in a new window. It can handle various graphics file formats.
168
Markdown
32.799993
76
0.797619
omniverse-code/kit/exts/omni.kit.window.audiorecorder/config/extension.toml
[package] title = "Kit Audio Recorder Window" category = "Audio" version = "1.0.1" description = "A simple audio recorder window" detailedDescription = """This adds a window for recording audio to file from an audio capture device. """ preview_image = "data/preview.png" authors = ["NVIDIA"] keywords = ["audio", "capture", "recording"] [dependencies] "omni.kit.audiodeviceenum" = {} "omni.audiorecorder" = {} "omni.ui" = {} "omni.kit.window.content_browser" = { optional=true } "omni.kit.window.filepicker" = {} "omni.kit.pip_archive" = {} "omni.usd" = {} "omni.kit.menu.utils" = {} [python.pipapi] requirements = ["numpy"] [[python.module]] name = "omni.kit.window.audiorecorder" [[test]] args = [ "--/renderer/enabled=pxr", "--/renderer/active=pxr", "--/renderer/multiGpu/enabled=false", "--/renderer/multiGpu/autoEnable=false", # Disable mGPU with PXR due to OM-51026, OM-53611 "--/renderer/multiGpu/maxGpuCount=1", "--/app/asyncRendering=false", "--/app/window/dpiScaleOverride=1.0", "--/app/window/scaleToMonitor=false", "--no-window", # Use the null device backend. # We need this to ensure the captured data is consistent. # We could use the capture test patterns mode, but there's no way to # synchronize the image capture with the audio capture right now, so we'll # have to just capture silence. "--/audio/deviceBackend=null", # needed for the UI test stuff "--/app/menu/legacy_mode=false", ] dependencies = [ "omni.hydra.pxr", "omni.kit.mainwindow", "omni.kit.ui_test", "carb.audio", ] stdoutFailPatterns.exclude = [ "*" # I don't want these but OmniUiTest forces me to use them ]
1,690
TOML
25.841269
94
0.666864
omniverse-code/kit/exts/omni.kit.window.audiorecorder/omni/kit/window/audiorecorder/__init__.py
from .audio_recorder_window import *
37
Python
17.999991
36
0.783784
omniverse-code/kit/exts/omni.kit.window.audiorecorder/omni/kit/window/audiorecorder/audio_recorder_window.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import carb.audio import omni.audiorecorder import omni.kit.ui import omni.ui import threading import time import re import asyncio from typing import Callable from omni.kit.window.filepicker import FilePickerDialog class AudioRecorderWindowExtension(omni.ext.IExt): """Audio Recorder Window Extension""" class ComboModel(omni.ui.AbstractItemModel): class ComboItem(omni.ui.AbstractItem): def __init__(self, text): super().__init__() self.model = omni.ui.SimpleStringModel(text) def __init__(self): super().__init__() self._options = [ ["16 bit PCM", carb.audio.SampleFormat.PCM16], ["24 bit PCM", carb.audio.SampleFormat.PCM24], ["32 bit PCM", carb.audio.SampleFormat.PCM32], ["float PCM", carb.audio.SampleFormat.PCM_FLOAT], ["Vorbis", carb.audio.SampleFormat.VORBIS], ["FLAC", carb.audio.SampleFormat.FLAC], ["Opus", carb.audio.SampleFormat.OPUS], ] self._current_index = omni.ui.SimpleIntModel() self._current_index.add_value_changed_fn(lambda a: self._item_changed(None)) self._items = [AudioRecorderWindowExtension.ComboModel.ComboItem(text) for (text, value) in self._options] def get_item_children(self, item): return self._items def get_item_value_model(self, item, column_id): if item is None: return self._current_index return item.model def set_value(self, value): for i in range(0, len(self._options)): if self._options[i][1] == value: self._current_index.as_int = i break def get_value(self): return self._options[self._current_index.as_int][1] class FieldModel(omni.ui.AbstractValueModel): def __init__(self): super(AudioRecorderWindowExtension.FieldModel, self).__init__() self._value = "" def get_value_as_string(self): return self._value def begin_edit(self): pass def set_value(self, value): self._value = value self._value_changed() def end_edit(self): pass def get_value(self): return self._value def _choose_file_clicked(self): # pragma: no cover dialog = FilePickerDialog( "Select File", apply_button_label="Select", click_apply_handler=lambda filename, dirname: self._on_file_pick(dialog, filename, dirname), ) dialog.show() def _on_file_pick(self, dialog: FilePickerDialog, filename: str, dirname: str): # pragma: no cover path = "" if dirname: path = f"{dirname}/{filename}" elif filename: path = filename dialog.hide() self._file_field.model.set_value(path) def _menu_callback(self, a, b): self._window.visible = not self._window.visible def _read_callback(self, data): # pragma: no cover self._display_buffer[self._display_buffer_index] = data self._display_buffer_index = (self._display_buffer_index + 1) % self._display_len buf = [] for i in range(self._display_len): buf += self._display_buffer[(self._display_buffer_index + i) % self._display_len] width = 512 height = 128 img = omni.audiorecorder.draw_waveform_from_blob_int16( input=buf, channels=1, width=width, height=height, fg_color=[0.89, 0.54, 0.14, 1.0], bg_color=[0.0, 0.0, 0.0, 0.0], ) self._waveform_image_provider.set_bytes_data(img, [width, height]) def _close_error_window(self): self._error_window.visible = False def _record_clicked(self): if self._recording: self._record_button.set_style({"image_url": "resources/glyphs/audio_record.svg"}) self._recorder.stop_recording() self._recording = False else: result = self._recorder.begin_recording_int16( filename=self._file_field_model.get_value(), callback=self._read_callback, output_format=self._format_model.get_value(), buffer_length=200, period=25, length_type=carb.audio.UnitType.MILLISECONDS, ) if result: self._record_button.set_style({"image_url": "resources/glyphs/timeline_stop.svg"}) self._recording = True else: # pragma: no cover self._error_window = omni.ui.Window( "Audio Recorder Error", width=400, height=0, flags=omni.ui.WINDOW_FLAGS_NO_DOCKING ) with self._error_window.frame: with omni.ui.VStack(): with omni.ui.HStack(): omni.ui.Spacer() self._error_window_label = omni.ui.Label( "Failed to start recording. The file path may be incorrect or the device may be inaccessible.", word_wrap=True, width=380, alignment=omni.ui.Alignment.CENTER, ) omni.ui.Spacer() with omni.ui.HStack(): omni.ui.Spacer() self._error_window_ok_button = omni.ui.Button( width=64, height=32, clicked_fn=self._close_error_window, text="ok" ) omni.ui.Spacer() def _stop_clicked(self): pass def _create_tooltip(self, text): """Create a tooltip in a fixed style""" with omni.ui.VStack(width=400): omni.ui.Label(text, word_wrap=True) def on_startup(self): self._display_len = 8 self._display_buffer = [[0] for i in range(self._display_len)] self._display_buffer_index = 0 # self._ticker_pos = 0; self._recording = False self._recorder = omni.audiorecorder.create_audio_recorder() self._window = omni.ui.Window("Audio Recorder", width=600, height=240) with self._window.frame: with omni.ui.VStack(height=0, spacing=8): # file dialogue with omni.ui.HStack(): omni.ui.Button( width=32, height=32, clicked_fn=self._choose_file_clicked, style={"image_url": "resources/glyphs/folder.svg"}, ) self._file_field_model = AudioRecorderWindowExtension.FieldModel() self._file_field = omni.ui.StringField(self._file_field_model, height=32) # waveform with omni.ui.HStack(height=128): omni.ui.Spacer() self._waveform_image_provider = omni.ui.ByteImageProvider() self._waveform_image = omni.ui.ImageWithProvider( self._waveform_image_provider, width=omni.ui.Percent(95), height=omni.ui.Percent(100), fill_policy=omni.ui.IwpFillPolicy.IWP_STRETCH, ) omni.ui.Spacer() # buttons with omni.ui.HStack(): with omni.ui.ZStack(): omni.ui.Spacer() self._anim_label = omni.ui.Label("", alignment=omni.ui.Alignment.CENTER) with omni.ui.VStack(): omni.ui.Spacer() self._format_model = AudioRecorderWindowExtension.ComboModel() self._format = omni.ui.ComboBox( self._format_model, height=0, tooltip_fn=lambda: self._create_tooltip( "The format for the output file." + "The PCM formats will output as a WAVE file (.wav)." + "FLAC will output as a FLAC file (.flac)." + "Vorbis and Opus will output as an Ogg file (.ogg/.oga)." ), ) omni.ui.Spacer() self._record_button = omni.ui.Button( width=32, height=32, clicked_fn=self._record_clicked, style={"image_url": "resources/glyphs/audio_record.svg"}, ) omni.ui.Spacer() # add a callback to open the window self._menuEntry = omni.kit.ui.get_editor_menu().add_item("Window/Audio Recorder", self._menu_callback) self._window.visible = False def on_shutdown(self): # pragma: no cover self._recorder = None self._window = None self._menuEntry = None
9,750
Python
38.477733
127
0.521436
omniverse-code/kit/exts/omni.kit.window.audiorecorder/omni/kit/window/audiorecorder/tests/__init__.py
from .test_audiorecorder_window import * # pragma: no cover
61
Python
29.999985
60
0.754098
omniverse-code/kit/exts/omni.kit.window.audiorecorder/omni/kit/window/audiorecorder/tests/test_audiorecorder_window.py
## Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## import omni.kit.app import omni.kit.test import omni.ui as ui import omni.usd import omni.timeline import carb.tokens import carb.audio from omni.ui.tests.test_base import OmniUiTest from omni.kit import ui_test #from omni.ui_query import OmniUIQuery import pathlib import asyncio import tempfile import os import platform class TestAudioRecorderWindow(OmniUiTest): # pragma: no cover async def _dock_window(self, win): await self.docked_test_window( window=win._window, width=600, height=240) #def _dump_ui_tree(self, root): # print("DUMP UI TREE START") # #windows = omni.ui.Workspace.get_windows() # #children = [windows[0].frame] # children = [root.frame] # print(str(dir(root.frame))) # def recurse(children, path=""): # for c in children: # name = path + "/" + type(c).__name__ # print(name) # if isinstance(c, omni.ui.ComboBox): # print(str(dir(c))) # recurse(omni.ui.Inspector.get_children(c), name) # recurse(children) # print("DUMP UI TREE END") # Before running each test async def setUp(self): await super().setUp() extension_path = carb.tokens.get_tokens_interface().resolve("${omni.kit.window.audiorecorder}") self._test_path = pathlib.Path(extension_path).joinpath("data").joinpath("tests").absolute() self._golden_img_dir = self._test_path.joinpath("golden") # open the dropdown window_menu = omni.kit.ui_test.get_menubar().find_menu("Window") self.assertIsNotNone(window_menu) await window_menu.click() # click the Audio Recorder entry to open it rec_menu = omni.kit.ui_test.get_menubar().find_menu("Audio Recorder") self.assertIsNotNone(rec_menu) await rec_menu.click() #self._dump_ui_tree(omni.kit.ui_test.find("Audio Recorder").window) # After running each test async def tearDown(self): await super().tearDown() self._rec = None async def _test_just_opened(self): win = omni.kit.ui_test.find("Audio Recorder") self.assertIsNotNone(win) await self._dock_window(win) await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="test_just_opened.png") async def _test_recording(self): # wait for docking to finish. To prevent ui_test getting widgets as while window is being rebuilt await ui_test.human_delay(50) iface = carb.audio.acquire_data_interface() self.assertIsNotNone(iface) win = omni.kit.ui_test.find("Audio Recorder") self.assertIsNotNone(win) file_name_textbox = win.find("**/StringField[*]") self.assertIsNotNone(file_name_textbox) record_button = win.find("**/HStack[2]/Button[0]") self.assertIsNotNone(record_button) with tempfile.TemporaryDirectory() as temp_dir: path = os.path.join(temp_dir, "test.wav") # type our file path into the textbox await file_name_textbox.click() await file_name_textbox.input(str(path)) # the user hit the record button await record_button.click() await asyncio.sleep(1.0) # change the text in the textbox so we'll have something constant # for the image comparison await file_name_textbox.input("soundstorm_song.wav") await self._dock_window(win) await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="test_recording.png") # wait for docking to finish. To prevent ui_test getting widgets as while window is being rebuilt await ui_test.human_delay(50) # grab these again just in case window docking broke it win = omni.kit.ui_test.find("Audio Recorder") self.assertIsNotNone(win) record_button = win.find("**/HStack[2]/Button[0]") self.assertIsNotNone(record_button) # the user hit the stop button await record_button.click() await self._dock_window(win) await self.finalize_test(golden_img_dir=self._golden_img_dir, golden_img_name="test_stopped.png") # wait for docking to finish. To prevent ui_test getting widgets as while window is being rebuilt await ui_test.human_delay(50) # grab these again just in case window docking broke it win = omni.kit.ui_test.find("Audio Recorder") self.assertIsNotNone(win) file_name_textbox = win.find("**/StringField[*]") self.assertIsNotNone(file_name_textbox) record_button = win.find("**/HStack[2]/Button[0]") self.assertIsNotNone(record_button) format_combobox = win.find("**/ComboBox[*]") self.assertIsNotNone(format_combobox) # analyze the data sound = iface.create_sound_from_file(path, streaming=True) self.assertIsNotNone(sound) fmt = sound.get_format() self.assertEqual(fmt.format, carb.audio.SampleFormat.PCM16) pcm = sound.get_buffer_as_int16() for i in range(len(pcm)): self.assertEqual(pcm[i], 0); sound = None # close it # try again with a different format # FIXME: We should not be manipulating the model directly, but ui_test # doesn't have a way to find any of the box item to click on, # and ComboBoxes don't respond to keyboard input either. format_combobox.model.set_value(carb.audio.SampleFormat.VORBIS) path2 = os.path.join(temp_dir, "test.oga") await file_name_textbox.input(str(path2)) # the user hit the record button await record_button.click() await asyncio.sleep(1.0) # the user hit the stop button await record_button.click() # analyze the data sound = iface.create_sound_from_file(str(path2), streaming=True) self.assertIsNotNone(sound) fmt = sound.get_format() self.assertEqual(fmt.format, carb.audio.SampleFormat.VORBIS) pcm = sound.get_buffer_as_int16() for i in range(len(pcm)): self.assertEqual(pcm[i], 0); sound = None # close it async def test_all(self): await self._test_just_opened() await self._test_recording()
7,060
Python
34.129353
111
0.616856
omniverse-code/kit/exts/omni.command.usd/config/extension.toml
[package] title = "Command USD" description = "Usefull command for USD." category = "Internal" version = "1.0.2" readme = "docs/README.md" changelog="docs/CHANGELOG.md" preview_image = "data/preview.png" icon = "data/icon.png" [[python.module]] name = "omni.command.usd" [dependencies] "omni.kit.commands" = {} "omni.usd" = {}
329
TOML
18.411764
40
0.68693
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/__init__.py
from .commands.usd_commands import *
37
Python
17.999991
36
0.783784
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/commands/__init__.py
from .usd_commands import * from .parenting_commands import *
62
Python
19.999993
33
0.774194
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/commands/parenting_commands.py
import omni.kit.commands import omni.usd from typing import List from pxr import Sdf class ParentPrimsCommand(omni.kit.commands.Command): def __init__( self, parent_path: str, child_paths: List[str], on_move_fn: callable = None, keep_world_transform: bool = True ): """ Move prims into children of "parent" primitives undoable **Command**. Args: parent_path: prim path to become parent of child_paths child_paths: prim paths to become children of parent_prim keep_world_transform: If it needs to keep the world transform after parenting. """ self._parent_path = parent_path self._child_paths = child_paths.copy() self._on_move_fn = on_move_fn self._keep_world_transform = keep_world_transform def do(self): with omni.kit.undo.group(): for path in self._child_paths: path_to = self._parent_path + "/" + Sdf.Path(path).name omni.kit.commands.execute( "MovePrim", path_from=path, path_to=path_to, on_move_fn=self._on_move_fn, destructive=False, keep_world_transform=self._keep_world_transform ) def undo(self): pass class UnparentPrimsCommand(omni.kit.commands.Command): def __init__( self, paths: List[str], on_move_fn: callable = None, keep_world_transform: bool = True ): """ Move prims into "/" primitives undoable **Command**. Args: paths: prim path to become parent of child_paths keep_world_transform: If it needs to keep the world transform after parenting. """ self._paths = paths.copy() self._on_move_fn = on_move_fn self._keep_world_transform = keep_world_transform def do(self): with omni.kit.undo.group(): for path in self._paths: path_to = "/" + Sdf.Path(path).name omni.kit.commands.execute( "MovePrim", path_from=path, path_to=path_to, on_move_fn=self._on_move_fn, destructive=False, keep_world_transform=self._keep_world_transform ) def undo(self): pass omni.kit.commands.register_all_commands_in_module(__name__)
2,518
Python
29.349397
90
0.53892
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/commands/usd_commands.py
import omni.kit.commands import omni.usd from typing import List from pxr import Sdf class TogglePayLoadLoadSelectedPrimsCommand(omni.kit.commands.Command): def __init__(self, selected_paths: List[str]): """ Toggles the load/unload payload of the selected primitives undoable **Command**. Args: selected_paths: Old selected prim paths. """ self._stage = omni.usd.get_context().get_stage() self._selected_paths = selected_paths.copy() def _toggle_load(self): for selected_path in self._selected_paths: selected_prim = self._stage.GetPrimAtPath(selected_path) if selected_prim.IsLoaded(): selected_prim.Unload() else: selected_prim.Load() def do(self): self._toggle_load() def undo(self): self._toggle_load() class SetPayLoadLoadSelectedPrimsCommand(omni.kit.commands.Command): def __init__(self, selected_paths: List[str], value: bool): """ Set the load/unload payload of the selected primitives undoable **Command**. Args: selected_paths: Old selected prim paths. value: True = load, False = unload """ self._stage = omni.usd.get_context().get_stage() self._selected_paths = selected_paths.copy() self._processed_path = set() self._value = value self._is_undo = False def _set_load(self): if self._is_undo: paths = self._processed_path else: paths = self._selected_paths for selected_path in paths: selected_prim = self._stage.GetPrimAtPath(selected_path) if (selected_prim.IsLoaded() and self._value) or (not selected_prim.IsLoaded() and not self._value): if selected_path in self._processed_path: self._processed_path.remove(selected_path) continue if self._value: selected_prim.Load() else: selected_prim.Unload() self._processed_path.add(selected_path) def do(self): self._set_load() def undo(self): self._is_undo = True self._value = not self._value self._set_load() self._value = not self._value self._processed_path = set() self._is_undo = False omni.kit.commands.register_all_commands_in_module(__name__)
2,457
Python
29.725
112
0.582825
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/tests/__init__.py
from .test_command_usd import *
32
Python
15.499992
31
0.75
omniverse-code/kit/exts/omni.command.usd/omni/command/usd/tests/test_command_usd.py
import carb import omni.kit.test import omni.kit.undo import omni.kit.commands import omni.usd from pxr import Sdf, Usd def get_stage_default_prim_path(stage): if stage.HasDefaultPrim(): return stage.GetDefaultPrim().GetPath() else: return Sdf.Path.absoluteRootPath class TestCommandUsd(omni.kit.test.AsyncTestCase): async def test_toggle_payload_selected(self): carb.log_info("Test TogglePayLoadLoadSelectedPrimsCommand") await omni.usd.get_context().new_stage_async() usd_context = omni.usd.get_context() selection = usd_context.get_selection() stage = usd_context.get_stage() default_prim_path = get_stage_default_prim_path(stage) payload1 = Usd.Stage.CreateInMemory("payload1.usd") payload1.DefinePrim("/payload1/scope1", "Xform") payload1.DefinePrim("/payload1/scope1/xform", "Cube") payload2 = Usd.Stage.CreateInMemory("payload2.usd") payload2.DefinePrim("/payload2/scope2", "Xform") payload2.DefinePrim("/payload2/scope2/xform", "Cube") payload3 = Usd.Stage.CreateInMemory("payload3.usd") payload3.DefinePrim("/payload3/scope3", "Xform") payload3.DefinePrim("/payload3/scope3/xform", "Cube") payload4 = Usd.Stage.CreateInMemory("payload4.usd") payload4.DefinePrim("/payload4/scope4", "Xform") payload4.DefinePrim("/payload4/scope4/xform", "Cube") ps1 = stage.DefinePrim(default_prim_path.AppendChild("payload1"), "Xform") ps1.GetPayloads().AddPayload( Sdf.Payload(payload1.GetRootLayer().identifier, "/payload1")) ps2 = stage.DefinePrim(default_prim_path.AppendChild("payload2"), "Xform") ps2.GetPayloads().AddPayload( Sdf.Payload(payload2.GetRootLayer().identifier, "/payload2")) ps3 = stage.DefinePrim(default_prim_path.AppendChild("payload3"), "Xform") ps3.GetPayloads().AddPayload( Sdf.Payload(payload3.GetRootLayer().identifier, "/payload3")) ps4 = stage.DefinePrim(ps3.GetPath().AppendChild("payload4"), "Xform") ps4.GetPayloads().AddPayload( Sdf.Payload(payload4.GetRootLayer().identifier, "/payload4")) # unload everything stage.Unload() self.assertTrue(not ps1.IsLoaded()) self.assertTrue(not ps2.IsLoaded()) self.assertTrue(not ps3.IsLoaded()) self.assertTrue(not ps4.IsLoaded()) # if nothing selected, payload state should not change. selection.clear_selected_prim_paths() paths = selection.get_selected_prim_paths() omni.kit.commands.execute("TogglePayLoadLoadSelectedPrims", selected_paths=paths) self.assertTrue(not ps1.IsLoaded()) self.assertTrue(not ps2.IsLoaded()) self.assertTrue(not ps3.IsLoaded()) self.assertTrue(not ps4.IsLoaded()) # load payload1 selection.set_selected_prim_paths( [ ps1.GetPath().pathString ], False, ) paths = selection.get_selected_prim_paths() omni.kit.commands.execute("TogglePayLoadLoadSelectedPrims", selected_paths=paths) self.assertTrue(ps1.IsLoaded()) # unload payload1 omni.kit.commands.execute("TogglePayLoadLoadSelectedPrims", selected_paths=paths) self.assertTrue(not ps1.IsLoaded()) # load payload1, 2 and 3. 4 will load selection.set_selected_prim_paths( [ ps1.GetPath().pathString, ps2.GetPath().pathString, ps3.GetPath().pathString, ], False, ) paths = selection.get_selected_prim_paths() omni.kit.commands.execute("TogglePayLoadLoadSelectedPrims", selected_paths=paths) self.assertTrue(ps1.IsLoaded()) self.assertTrue(ps2.IsLoaded()) self.assertTrue(ps3.IsLoaded()) self.assertTrue(ps4.IsLoaded()) # unload 4 selection.set_selected_prim_paths( [ ps4.GetPath().pathString ], False, ) paths = selection.get_selected_prim_paths() omni.kit.commands.execute("TogglePayLoadLoadSelectedPrims", selected_paths=paths) self.assertTrue(not ps4.IsLoaded()) # undo omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # redo omni.kit.undo.redo() self.assertTrue(not ps4.IsLoaded()) async def test_set_payload_selected(self): carb.log_info("Test SetPayLoadLoadSelectedPrimsCommand") await omni.usd.get_context().new_stage_async() usd_context = omni.usd.get_context() selection = usd_context.get_selection() stage = usd_context.get_stage() default_prim_path = get_stage_default_prim_path(stage) payload1 = Usd.Stage.CreateInMemory("payload1.usd") payload1.DefinePrim("/payload1/scope1", "Xform") payload1.DefinePrim("/payload1/scope1/xform", "Cube") payload2 = Usd.Stage.CreateInMemory("payload2.usd") payload2.DefinePrim("/payload2/scope2", "Xform") payload2.DefinePrim("/payload2/scope2/xform", "Cube") payload3 = Usd.Stage.CreateInMemory("payload3.usd") payload3.DefinePrim("/payload3/scope3", "Xform") payload3.DefinePrim("/payload3/scope3/xform", "Cube") payload4 = Usd.Stage.CreateInMemory("payload4.usd") payload4.DefinePrim("/payload4/scope4", "Xform") payload4.DefinePrim("/payload4/scope4/xform", "Cube") ps1 = stage.DefinePrim(default_prim_path.AppendChild("payload1"), "Xform") ps1.GetPayloads().AddPayload( Sdf.Payload(payload1.GetRootLayer().identifier, "/payload1")) ps2 = stage.DefinePrim(default_prim_path.AppendChild("payload2"), "Xform") ps2.GetPayloads().AddPayload( Sdf.Payload(payload2.GetRootLayer().identifier, "/payload2")) ps3 = stage.DefinePrim(default_prim_path.AppendChild("payload3"), "Xform") ps3.GetPayloads().AddPayload( Sdf.Payload(payload3.GetRootLayer().identifier, "/payload3")) ps4 = stage.DefinePrim(ps3.GetPath().AppendChild("payload4"), "Xform") ps4.GetPayloads().AddPayload( Sdf.Payload(payload4.GetRootLayer().identifier, "/payload4")) # unload everything stage.Unload() self.assertTrue(not ps1.IsLoaded()) self.assertTrue(not ps2.IsLoaded()) self.assertTrue(not ps3.IsLoaded()) self.assertTrue(not ps4.IsLoaded()) # if nothing selected, payload state should not change. selection.clear_selected_prim_paths() paths = selection.get_selected_prim_paths() omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) self.assertTrue(not ps1.IsLoaded()) self.assertTrue(not ps2.IsLoaded()) self.assertTrue(not ps3.IsLoaded()) self.assertTrue(not ps4.IsLoaded()) # load payload1 selection.set_selected_prim_paths( [ ps1.GetPath().pathString ], False, ) paths = selection.get_selected_prim_paths() omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) self.assertTrue(ps1.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) self.assertTrue(ps1.IsLoaded()) # unload payload1 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) self.assertTrue(not ps1.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) self.assertTrue(not ps1.IsLoaded()) # load payload1, 2 and 3. 4 will load selection.set_selected_prim_paths( [ ps1.GetPath().pathString, ps2.GetPath().pathString, ps3.GetPath().pathString, ], False, ) paths = selection.get_selected_prim_paths() omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) self.assertTrue(ps1.IsLoaded()) self.assertTrue(ps2.IsLoaded()) self.assertTrue(ps3.IsLoaded()) self.assertTrue(ps4.IsLoaded()) selection.set_selected_prim_paths( [ ps4.GetPath().pathString ], False, ) paths = selection.get_selected_prim_paths() # reload 4 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) self.assertTrue(ps4.IsLoaded()) # unload 4 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) self.assertTrue(not ps4.IsLoaded()) # undo omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # redo omni.kit.undo.redo() self.assertTrue(not ps4.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) self.assertTrue(not ps4.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) self.assertTrue(not ps4.IsLoaded()) omni.kit.undo.undo() self.assertTrue(not ps4.IsLoaded()) omni.kit.undo.redo() self.assertTrue(not ps4.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) # -1 self.assertTrue(ps4.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) # 0 self.assertTrue(ps4.IsLoaded()) omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) omni.kit.undo.redo() self.assertTrue(ps4.IsLoaded()) omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) # 1 self.assertTrue(not ps4.IsLoaded()) # 1 omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # 0 omni.kit.undo.redo() self.assertTrue(not ps4.IsLoaded()) # 1 omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # 0 # triple undo omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) # 2 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) # 3 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=False) # 4 omni.kit.commands.execute("SetPayLoadLoadSelectedPrims", selected_paths=paths, value=True) # 5 self.assertTrue(ps4.IsLoaded()) # 5 omni.kit.undo.undo() self.assertTrue(not ps4.IsLoaded()) # 4 omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # 3 omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # 2 # more undo omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # 0 omni.kit.undo.undo() self.assertTrue(ps4.IsLoaded()) # -1
11,219
Python
39.215054
104
0.635618
omniverse-code/kit/exts/omni.command.usd/docs/CHANGELOG.md
## [1.0.2] - 2022-11-10 ### Removed - Removed dependency on omni.kit.test ## [1.0.1] - 2021-03-15 ### Changed - Added "ParentPrimsCommand" and "UnparentPrimsCommand" ## [0.1.0] - 2021-02-17 ### Changed - Add "TogglePayLoadLoadSelectedPrimsCommand" and "SetPayLoadLoadSelectedPrimsCommand"
292
Markdown
21.53846
86
0.708904
omniverse-code/kit/exts/omni.command.usd/docs/README.md
# Command USD [omni.command.usd] Usefull command for USD.
58
Markdown
18.66666
32
0.758621
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/style.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["welcome_widget_style"] from omni.ui import color as cl from omni.ui import constant as fl from omni.ui import url import omni.kit.app import omni.ui as ui import pathlib EXTENSION_FOLDER_PATH = pathlib.Path( omni.kit.app.get_app().get_extension_manager().get_extension_path_by_module(__name__) ) # Pre-defined constants. It's possible to change them runtime. cl.welcome_widget_attribute_bg = cl("#1f2124") cl.welcome_widget_attribute_fg = cl("#0f1115") cl.welcome_widget_hovered = cl("#FFFFFF") cl.welcome_widget_text = cl("#CCCCCC") fl.welcome_widget_attr_hspacing = 10 fl.welcome_widget_attr_spacing = 1 fl.welcome_widget_group_spacing = 2 url.welcome_widget_icon_closed = f"{EXTENSION_FOLDER_PATH}/data/closed.svg" url.welcome_widget_icon_opened = f"{EXTENSION_FOLDER_PATH}/data/opened.svg" # The main style dict welcome_widget_style = { "Label::attribute_name": { "alignment": ui.Alignment.RIGHT_CENTER, "margin_height": fl.welcome_widget_attr_spacing, "margin_width": fl.welcome_widget_attr_hspacing, }, "Label::title": {"alignment": ui.Alignment.CENTER, "color": cl.welcome_widget_text, "font_size": 30}, "Label::attribute_name:hovered": {"color": cl.welcome_widget_hovered}, "Label::collapsable_name": {"alignment": ui.Alignment.LEFT_CENTER}, "Slider::attribute_int:hovered": {"color": cl.welcome_widget_hovered}, "Slider": { "background_color": cl.welcome_widget_attribute_bg, "draw_mode": ui.SliderDrawMode.HANDLE, }, "Slider::attribute_float": { "draw_mode": ui.SliderDrawMode.FILLED, "secondary_color": cl.welcome_widget_attribute_fg, }, "Slider::attribute_float:hovered": {"color": cl.welcome_widget_hovered}, "Slider::attribute_vector:hovered": {"color": cl.welcome_widget_hovered}, "Slider::attribute_color:hovered": {"color": cl.welcome_widget_hovered}, "CollapsableFrame::group": {"margin_height": fl.welcome_widget_group_spacing}, "Image::collapsable_opened": {"color": cl.welcome_widget_text, "image_url": url.welcome_widget_icon_opened}, "Image::collapsable_closed": {"color": cl.welcome_widget_text, "image_url": url.welcome_widget_icon_closed}, }
2,636
Python
43.694915
112
0.715478
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/extension.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["WelcomeWindowExtension"] import asyncio import carb import omni.ext import omni.ui as ui from typing import Optional class WelcomeWindowExtension(omni.ext.IExt): """The entry point for Welcome Window""" WINDOW_NAME = "Welcome Window" # MENU_PATH = f"Window/{WINDOW_NAME}" def on_startup(self): self.__window: Optional["WelcomeWindow"] = None self.__widget: Optional["WelcomeWidget"] = None self.__render_loading: Optional["ViewportReady"] = None self.show_welcome(True) def on_shutdown(self): self._menu = None if self.__window: self.__window.destroy() self.__window = None if self.__widget: self.__widget.destroy() self.__widget = None def show_welcome(self, visible: bool): in_viewport = carb.settings.get_settings().get("/exts/omni.kit.window.welcome/embedInViewport") if in_viewport and not self.__window: self.__show_widget(visible) else: self.__show_window(visible) if not visible and self.__render_loading: self.__render_loading = None def __get_buttons(self) -> dict: return { "Create Empty Scene": self.__create_empty_scene, "Open Last Saved Scene": None, "Browse Scenes": None } def __destroy_object(self, object): # Hide it immediately object.visible = False # And destroy it in the future async def destroy_object(object): await omni.kit.app.get_app().next_update_async() object.destroy() asyncio.ensure_future(destroy_object(object)) def __show_window(self, visible: bool): if visible and self.__window is None: from .window import WelcomeWindow self.__window = WelcomeWindow(WelcomeWindowExtension.WINDOW_NAME, width=500, height=300, buttons=self.__get_buttons()) elif self.__window and not visible: self.__destroy_object(self.__window) self.__window = None elif self.__window: self.__window.visible = True def __show_widget(self, visible: bool): if visible and self.__widget is None: async def add_to_viewport(): try: from omni.kit.viewport.utility import get_active_viewport_window from .widget import WelcomeWidget viewport_window = get_active_viewport_window() with viewport_window.get_frame("omni.kit.window.welcome"): self.__widget = WelcomeWidget(self.__get_buttons(), add_background=True) except (ImportError, AttributeError): # Fallback to Welcome window self.__show_window(visible) asyncio.ensure_future(add_to_viewport()) elif self.__widget and not visible: self.__destroy_object(self.__widget) self.__widget = None elif self.__widget: self.__widget.visible = True def __button_clicked(self): self.show_welcome(False) def __create_empty_scene(self, renderer: Optional[str] = None): self.__button_clicked() settings = carb.settings.get_settings() ext_manager = omni.kit.app.get_app().get_extension_manager() if renderer is None: renderer = settings.get("/exts/omni.app.setup/backgroundRendererLoad/renderer") if not renderer: return ext_manager.set_extension_enabled_immediate("omni.kit.viewport.bundle", True) if renderer == "iray": ext_manager.set_extension_enabled_immediate(f"omni.hydra.rtx", True) ext_manager.set_extension_enabled_immediate(f"omni.hydra.{renderer}", True) else: ext_manager.set_extension_enabled_immediate(f"omni.kit.viewport.{renderer}", True) async def _new_stage_async(): if settings.get("/exts/omni.kit.window.welcome/showRenderLoading"): from .render_loading import start_render_loading_ui self.__render_loading = start_render_loading_ui(ext_manager, renderer) await omni.kit.app.get_app().next_update_async() import omni.kit.stage_templates as stage_templates stage_templates.new_stage(template=None) await omni.kit.app.get_app().next_update_async() from omni.kit.viewport.utility import get_active_viewport get_active_viewport().set_hd_engine(renderer) asyncio.ensure_future(_new_stage_async())
5,066
Python
37.097744
130
0.617055
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/render_loading.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["start_render_loading_ui"] def start_render_loading_ui(ext_manager, renderer: str): import carb import time time_begin = time.time() carb.settings.get_settings().set("/exts/omni.kit.viewport.ready/startup/enabled", False) ext_manager.set_extension_enabled_immediate("omni.kit.viewport.ready", True) from omni.kit.viewport.ready.viewport_ready import ViewportReady, ViewportReadyDelegate class TimerDelegate(ViewportReadyDelegate): def __init__(self, time_begin): super().__init__() self.__timer_start = time.time() self.__vp_ready_cost = self.__timer_start - time_begin @property def font_size(self) -> float: return 48 @property def message(self) -> str: rtx_mode = { "RaytracedLighting": "Real-Time", "PathTracing": "Interactive (Path Tracing)", "LightspeedAperture": "Aperture (Game Path Tracer)" }.get(carb.settings.get_settings().get("/rtx/rendermode"), "Real-Time") renderer_label = { "rtx": f"RTX - {rtx_mode}", "iray": "RTX - Accurate (Iray)", "pxr": "Pixar Storm", "index": "RTX - Scientific (IndeX)" }.get(renderer, renderer) return f"Waiting for {renderer_label} to start" def on_complete(self): rtx_load_time = time.time() - self.__timer_start super().on_complete() print(f"Time until pixel: {rtx_load_time}") print(f"ViewportReady cost: {self.__vp_ready_cost}") return ViewportReady(TimerDelegate(time_begin))
2,121
Python
37.581817
92
0.619991
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/widget.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["WelcomeWidget"] import carb import omni.kit.app import omni.ui as ui from typing import Callable, Optional class WelcomeWidget(): """The class that represents the window""" def __init__(self, buttons: dict, style: Optional[dict] = None, button_size: Optional[tuple] = None, add_background: bool = False): if style is None: from .style import welcome_widget_style style = welcome_widget_style if button_size is None: button_size = (150, 100) self.__add_background = add_background # Save the button_size for later use self.__buttons = buttons self.__button_size = button_size # Create the top-level ui.Frame self.__frame: ui.Frame = ui.Frame() # Apply the style to all the widgets of this window self.__frame.style = style # Set the function that is called to build widgets when the window is visible self.__frame.set_build_fn(self.create_ui) def destroy(self): # It will destroy all the children if self.__frame: self.__frame.destroy() self.__frame = None def create_label(self): ui.Label("Select Stage", name="title") def create_button(self, label: str, width: float, height: float, clicked_fn: Callable): ui.Button(label, width=width, height=height, clicked_fn=clicked_fn) def create_buttons(self, width: float, height: float): for label, clicked_fn in self.__buttons.items(): self.create_button(label, width=width, height=height, clicked_fn=clicked_fn) def create_background(self): bg_color = carb.settings.get_settings().get('/exts/omni.kit.viewport.ready/background_color') if bg_color: omni.ui.Rectangle(style={"background_color": bg_color}) def create_ui(self): with ui.ZStack(): if self.__add_background: self.create_background() with ui.HStack(): ui.Spacer(width=20) with ui.VStack(): ui.Spacer() self.create_label() ui.Spacer(height=20) with ui.HStack(height=100): ui.Spacer() self.create_buttons(self.__button_size[0], self.__button_size[1]) ui.Spacer() ui.Spacer() ui.Spacer(width=20) @property def visible(self): return self.__frame.visible if self.__frame else None @visible.setter def visible(self, visible: bool): if self.__frame: self.__frame.visible = visible elif visible: import carb carb.log_error("Cannot make WelcomeWidget visible after it was destroyed")
3,244
Python
36.29885
135
0.608508
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/window.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["WelcomeWindow"] from .widget import WelcomeWidget from typing import Optional import omni.ui as ui class WelcomeWindow(ui.Window): """The class that represents the window""" def __init__(self, title: str, buttons: dict, *args, **kwargs): super().__init__(title, *args, **kwargs) self.__buttons = buttons self.__widget: Optional[WelcomeWidget] = None # Set the function that is called to build widgets when the window is visible self.frame.set_build_fn(self.__build_fn) def __destroy_widget(self): if self.__widget: self.__widget.destroy() self.__widget = None def __build_fn(self): # Destroy any existing WelcomeWidget self.__destroy_widget() # Add the Welcomwidget self.__widget = WelcomeWidget(self.__buttons) def destroy(self): # It will destroy all the children self.__destroy_widget() super().destroy() @property def wlcome_widget(self): return self.__widget
1,477
Python
31.130434
85
0.668246
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/tests/test_widget.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["TestWidget"] from omni.kit.window.welcome.widget import WelcomeWidget import omni.kit.app import omni.kit.test import omni.ui as ui class TestWidget(omni.kit.test.AsyncTestCase): async def test_general(self): """Create a widget and make sure there are no errors""" window = ui.Window("Test") with window.frame: WelcomeWidget(buttons={}) await omni.kit.app.get_app().next_update_async()
879
Python
32.846153
76
0.737201
omniverse-code/kit/exts/omni.kit.window.welcome/omni/kit/window/welcome/tests/test_window.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # __all__ = ["TestWindow"] from omni.kit.window.welcome.window import WelcomeWindow import omni.kit.app import omni.kit.test class TestWindow(omni.kit.test.AsyncTestCase): async def test_general(self): """Create a window and make sure there are no errors""" window = WelcomeWindow("Welcome Window Test", buttons={}) await omni.kit.app.get_app().next_update_async()
823
Python
36.454544
76
0.755772
omniverse-code/kit/exts/omni.kit.widget.search_delegate/omni/kit/widget/search_delegate/delegate.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import abc class SearchDelegate: def __init__(self): self._search_dir = None @property def visible(self): return True # pragma: no cover @property def enabled(self): """Enable/disable Widget""" return True # pragma: no cover @property def search_dir(self): return self._search_dir # pragma: no cover @search_dir.setter def search_dir(self, search_dir: str): self._search_dir = search_dir # pragma: no cover @abc.abstractmethod def build_ui(self): pass # pragma: no cover @abc.abstractmethod def destroy(self): pass # pragma: no cover
1,098
Python
26.474999
76
0.678506
omniverse-code/kit/exts/omni.kit.widget.search_delegate/omni/kit/widget/search_delegate/style.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import carb import omni.ui as ui from pathlib import Path try: THEME = carb.settings.get_settings().get_as_string("/persistent/app/window/uiStyle") except Exception: THEME = None finally: THEME = THEME or "NvidiaDark" CURRENT_PATH = Path(__file__).parent.absolute() ICON_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath(f"icons/{THEME}") THUMBNAIL_PATH = CURRENT_PATH.parent.parent.parent.parent.joinpath("data").joinpath("thumbnails") def get_style(): if THEME == "NvidiaLight": BACKGROUND_COLOR = 0xFF535354 BACKGROUND_SELECTED_COLOR = 0xFF6E6E6E BACKGROUND_HOVERED_COLOR = 0xFF6E6E6E BACKGROUND_DISABLED_COLOR = 0xFF666666 TEXT_COLOR = 0xFF8D760D TEXT_HINT_COLOR = 0xFFD6D6D6 SEARCH_BORDER_COLOR = 0xFFC9974C SEARCH_HOVER_COLOR = 0xFFB8B8B8 SEARCH_CLOSE_COLOR = 0xFF858585 SEARCH_TEXT_BACKGROUND_COLOR = 0xFFD9D4BC else: BACKGROUND_COLOR = 0xFF23211F BACKGROUND_SELECTED_COLOR = 0xFF8A8777 BACKGROUND_HOVERED_COLOR = 0xFF3A3A3A BACKGROUND_DISABLED_COLOR = 0xFF666666 TEXT_COLOR = 0xFF9E9E9E TEXT_HINT_COLOR = 0xFF4A4A4A SEARCH_BORDER_COLOR = 0xFFC9974C SEARCH_HOVER_COLOR = 0xFF3A3A3A SEARCH_CLOSE_COLOR = 0xFF858585 SEARCH_TEXT_BACKGROUND_COLOR = 0xFFD9D4BC style = { "Button": { "background_color": BACKGROUND_COLOR, "selected_color": BACKGROUND_SELECTED_COLOR, "color": TEXT_COLOR, "margin": 0, "padding": 0 }, "Button:hovered": {"background_color": BACKGROUND_HOVERED_COLOR}, "Button.Label": {"color": TEXT_COLOR}, "Field": {"background_color": 0x0, "selected_color": BACKGROUND_SELECTED_COLOR, "color": TEXT_COLOR, "alignment": ui.Alignment.LEFT_CENTER}, "Label": {"background_color": 0x0, "color": TEXT_COLOR}, "Rectangle": {"background_color": 0x0}, "SearchField": { "background_color": 0, "border_radius": 0, "border_width": 0, "background_selected_color": BACKGROUND_COLOR, "margin": 0, "padding": 4, "alignment": ui.Alignment.LEFT_CENTER, }, "SearchField.Frame": { "background_color": BACKGROUND_COLOR, "border_radius": 0.0, "border_color": 0, "border_width": 2, }, "SearchField.Frame:selected": { "background_color": BACKGROUND_COLOR, "border_radius": 0, "border_color": SEARCH_BORDER_COLOR, "border_width": 2, }, "SearchField.Frame:disabled": { "background_color": BACKGROUND_DISABLED_COLOR, }, "SearchField.Hint": {"color": TEXT_HINT_COLOR}, "SearchField.Button": {"background_color": 0x0, "margin_width": 2, "padding": 4}, "SearchField.Button.Image": {"color": TEXT_HINT_COLOR}, "SearchField.Clear": {"background_color": 0x0, "padding": 4}, "SearchField.Clear:hovered": {"background_color": SEARCH_HOVER_COLOR}, "SearchField.Clear.Image": {"image_url": f"{ICON_PATH}/close.svg", "color": SEARCH_CLOSE_COLOR}, "SearchField.Word": {"background_color": SEARCH_TEXT_BACKGROUND_COLOR}, "SearchField.Word.Label": {"color": TEXT_COLOR}, "SearchField.Word.Button": {"background_color": 0, "padding": 2}, "SearchField.Word.Button.Image": {"image_url": f"{ICON_PATH}/close.svg", "color": TEXT_COLOR}, } return style
4,013
Python
39.959183
148
0.62771
omniverse-code/kit/exts/omni.kit.widget.search_delegate/omni/kit/widget/search_delegate/model.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # import omni.ui as ui import omni.client from typing import Dict from datetime import datetime from omni.kit.widget.filebrowser import FileBrowserModel, FileBrowserItem, find_thumbnails_for_files_async from omni.kit.widget.filebrowser.model import FileBrowserItemFields from omni.kit.search_core import AbstractSearchModel, AbstractSearchItem class SearchResultsItem(FileBrowserItem): _thumbnail_dict: Dict = {} def __init__(self, path: str, fields: FileBrowserItemFields, is_folder: bool = False): super().__init__(path, fields, is_folder=is_folder) class _RedirectModel(ui.AbstractValueModel): def __init__(self, search_model, field): super().__init__() self._search_model = search_model self._field = field def get_value_as_string(self): return str(self._search_model[self._field]) def set_value(self, value): pass async def get_custom_thumbnails_for_folder_async(self) -> Dict: """ Returns the thumbnail dictionary for this (folder) item. Returns: Dict: With children url's as keys, and url's to thumbnail files as values. """ if not self.is_folder: return {} # Files in the root folder only file_urls = [] for _, item in self.children.items(): if item.is_folder or item.path in self._thumbnail_dict: # Skip if folder or thumbnail previously found pass else: file_urls.append(item.path) thumbnail_dict = await find_thumbnails_for_files_async(file_urls) for url, thumbnail_url in thumbnail_dict.items(): if url and thumbnail_url: self._thumbnail_dict[url] = thumbnail_url return self._thumbnail_dict class SearchResultsItemFactory: @staticmethod def create_item(search_item: AbstractSearchItem) -> SearchResultsItem: if not search_item: return None access = omni.client.AccessFlags.READ | omni.client.AccessFlags.WRITE fields = FileBrowserItemFields(search_item.name, search_item.date, search_item.size, access) item = SearchResultsItem(search_item.path, fields, is_folder=search_item.is_folder) item._models = ( SearchResultsItem._RedirectModel(search_item, "name"), SearchResultsItem._RedirectModel(search_item, "date"), SearchResultsItem._RedirectModel(search_item, "size"), ) return item @staticmethod def create_group_item(name: str, path: str) -> SearchResultsItem: access = omni.client.AccessFlags.READ | omni.client.AccessFlags.WRITE fields = FileBrowserItemFields(name, datetime.now(), 0, access) item = SearchResultsItem(path, fields, is_folder=True) return item class SearchResultsModel(FileBrowserModel): def __init__(self, search_model: AbstractSearchModel, **kwargs): super().__init__(**kwargs) self._root = SearchResultsItemFactory.create_group_item("Search Results", "search_results://") self._search_model = search_model # Circular dependency self._dirty_item_subscription = self._search_model.subscribe_item_changed(self.__on_item_changed) def destroy(self): # Remove circular dependency self._dirty_item_subscription = None if self._search_model: self._search_model.destroy() self._search_model = None def get_item_children(self, item: SearchResultsItem) -> [SearchResultsItem]: if self._search_model is None or item is not None: return [] # OM-92499: Skip populate for empty search model items if not self._root.populated and self._search_model.items: for search_item in self._search_model.items: self._root.add_child(SearchResultsItemFactory.create_item(search_item)) self._root.populated = True children = list(self._root.children.values()) if self._filter_fn: return list(filter(self._filter_fn, children)) else: return children def __on_item_changed(self, item): self._item_changed(item)
4,673
Python
37.95
106
0.657822
omniverse-code/kit/exts/omni.kit.widget.search_delegate/omni/kit/widget/search_delegate/widget.py
# Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this software and related documentation without an express # license agreement from NVIDIA CORPORATION is strictly prohibited. # from omni import ui from carb import log_warn from typing import Callable, List from omni.kit.search_core import SearchEngineRegistry from .delegate import SearchDelegate from .model import SearchResultsModel from .style import get_style, ICON_PATH class SearchWordButton: """ Represents a search word widget, combined with a label to show the word and a close button to remove it. Args: word (str): String of word. Keyword args: on_close_fn (callable): Function called when close button clicked. Function signure: void on_close_fn(widget: SearchWordButton) """ def __init__(self, word: str, on_close_fn: callable = None): self._container = ui.ZStack(width=0) with self._container: with ui.VStack(): ui.Spacer(height=5) ui.Rectangle(style_type_name_override="SearchField.Word") ui.Spacer(height=5) with ui.HStack(): ui.Spacer(width=3) ui.Label(word, width=0, style_type_name_override="SearchField.Word.Label") ui.Spacer(width=3) ui.Button( image_width=8, style_type_name_override="SearchField.Word.Button", clicked_fn=lambda: on_close_fn(self) if on_close_fn is not None else None, identifier="search_word_button", ) @property def visible(self) -> None: """Widget visibility""" return self._container.visible @visible.setter def visible(self, value: bool) -> None: self._container.visible = value class SearchField(SearchDelegate): """ A search field to input search words Args: callback (callable): Function called after search done. Function signature: void callback(model: SearchResultsModel) Keyword Args: width (Optional[ui.Length]): Widget widthl. Default None, means auto. height (Optional[ui.Length]): Widget height. Default ui.Pixel(26). Use None for auto. subscribe_edit_changed (bool): True to retreive on_search_fn called when input changed. Default False only retreive on_search_fn called when input ended. show_tokens (bool): Default True to show tokens if end edit. Do nothing if False. Properties: visible (bool): Widget visibility. enabled (bool): Enable/Disable widget. """ SEARCH_IMAGE_SIZE = 16 CLOSE_IMAGE_SIZE = 12 def __init__(self, callback: Callable, **kwargs): super().__init__(**kwargs) self._callback = callback self._container_args = {"style": get_style()} if kwargs.get("width") is not None: self._container_args["width"] = kwargs.get("width") self._container_args["height"] = kwargs.get("height", ui.Pixel(26)) self._subscribe_edit_changed = kwargs.get("subscribe_edit_changed", False) self._show_tokens = kwargs.get("show_tokens", True) self._search_field: ui.StringField = None self._search_engine = None self._search_engine_menu = None self._search_words: List[str] = [] self._in_searching = False self._search_label = None # OM-76011:subscribe to engine changed self.__search_engine_changed_sub = SearchEngineRegistry().subscribe_engines_changed(self._on_search_engines_changed) @property def visible(self): """ Widget visibility """ return self._container.visible @visible.setter def visible(self, value): self._container.visible = value @property def enabled(self): """ Enable/disable Widget """ return self._container.enabled @enabled.setter def enabled(self, value): self._container.enabled = value if value: self._search_label.text = "Search" else: self._search_label.text = "Search disabled. Please install a search extension." @property def search_dir(self): return self._search_dir @search_dir.setter def search_dir(self, search_dir: str): dir_changed = search_dir != self._search_dir self._search_dir = search_dir if self._in_searching and dir_changed: self.search(self._search_words) def build_ui(self): self._container = ui.ZStack(**self._container_args) with self._container: # background self._background = ui.Rectangle(style_type_name_override="SearchField.Frame") with ui.HStack(): with ui.VStack(width=0): # Search "magnifying glass" button search_button = ui.Button( image_url=f"{ICON_PATH}/search.svg", image_width=SearchField.SEARCH_IMAGE_SIZE, image_height=SearchField.SEARCH_IMAGE_SIZE, style_type_name_override="SearchField.Button", identifier="show_engine_menu", ) search_button.set_clicked_fn( lambda b=search_button: self._show_engine_menu( b.screen_position_x, b.screen_position_y + b.computed_height ) ) with ui.HStack(): with ui.ZStack(): with ui.HStack(): # Individual word widgets if self._show_tokens: self._words_container = ui.HStack() self._build_search_words() # String field to accept user input, here ui.Spacer for border of SearchField.Frame with ui.VStack(): ui.Spacer() with ui.HStack(height=0): self._search_field = ui.StringField( ui.SimpleStringModel(), mouse_double_clicked_fn=lambda x, y, btn, m: self._convert_words_to_string(), style_type_name_override="SearchField", ) ui.Spacer() self._hint_container = ui.HStack(spacing=4) with self._hint_container: # Hint label self._search_label = ui.Label("Search", width=275, style_type_name_override="SearchField.Hint") # Close icon with ui.VStack(width=20): ui.Spacer(height=2) self._clear_button = ui.Button( image_width=SearchField.CLOSE_IMAGE_SIZE, style_type_name_override="SearchField.Clear", clicked_fn=self._on_clear_clicked, ) ui.Spacer(height=2) ui.Spacer(width=2) self._clear_button.visible = False self._sub_begin_edit = self._search_field.model.subscribe_begin_edit_fn(self._on_begin_edit) self._sub_end_edit = self._search_field.model.subscribe_end_edit_fn(self._on_end_edit) if self._subscribe_edit_changed: self._sub_text_edit = self._search_field.model.subscribe_value_changed_fn(self._on_text_edit) else: self._sub_text_edit = None # check on init for if we have available search engines self._on_search_engines_changed() def destroy(self): self._callback = None self._search_field = None self._sub_begin_edit = None self._sub_end_edit = None self._sub_text_edit = None self._background = None self._hint_container = None self._clear_button = None self._search_label = None self._container = None self.__search_engine_changed_sub = None def _show_engine_menu(self, x, y): self._search_engine_menu = ui.Menu("Engines") search_names = SearchEngineRegistry().get_available_search_names(self._search_dir) if not search_names: return # TODO: We need to have predefined default search if self._search_engine is None or self._search_engine not in search_names: self._search_engine = search_names[0] def set_current_engine(engine_name): self._search_engine = engine_name with self._search_engine_menu: for name in search_names: ui.MenuItem( name, checkable=True, checked=self._search_engine == name, triggered_fn=lambda n=name: set_current_engine(n), ) self._search_engine_menu.show_at(x, y) def _get_search_words(self) -> List[str]: # Split the input string to words and filter invalid search_string = self._search_field.model.get_value_as_string() search_words = [word for word in search_string.split(" ") if word] if len(search_words) == 0: return None elif len(search_words) == 1 and search_words[0] == "": # If empty input, regard as clear return None else: return search_words def _on_begin_edit(self, model): self._set_in_searching(True) def _on_end_edit(self, model: ui.AbstractValueModel) -> None: search_words = self._get_search_words() if search_words is None: # Filter empty(hidden) word filter_words = [word for word in self._search_words if word] if len(filter_words) == 0: self._set_in_searching(False) else: if self._show_tokens: self._search_words.extend(search_words) self._build_search_words() self._search_field.model.set_value("") else: self._search_words = search_words self.search(self._search_words) def _on_text_edit(self, model: ui.AbstractValueModel) -> None: new_search_words = self._get_search_words() if new_search_words is not None: # Add current input to search words search_words = [] search_words.extend(self._search_words) search_words.extend(new_search_words) self._search_words = search_words self.search(self._search_words) def _convert_words_to_string(self) -> None: if self._show_tokens: # convert existing search words back to string filter_words = [word for word in self._search_words if word] seperator = " " self._search_words = [] self._build_search_words() original_string = seperator.join(filter_words) # Append current input input_string = self._search_field.model.get_value_as_string() if input_string: original_string = original_string + seperator + input_string self._search_field.model.set_value(original_string) def _on_clear_clicked(self) -> None: # Update UI self._set_in_searching(False) self._search_field.model.set_value("") self._search_words.clear() self._build_search_words() # Notification self.search(None) def _set_in_searching(self, in_searching: bool) -> None: self._in_searching = in_searching # Background outline self._background.selected = in_searching # Show/Hide hint frame (search icon and hint lable) self._hint_container.visible = not in_searching # Show/Hide close image self._clear_button.visible = in_searching def _build_search_words(self): if self._show_tokens: self._words_container.clear() if len(self._search_words) == 0: return with self._words_container: ui.Spacer(width=4) for index, word in enumerate(self._search_words): if word: SearchWordButton(word, on_close_fn=lambda widget, idx=index: self._hide_search_word(idx, widget)) def _hide_search_word(self, index: int, widget: SearchWordButton) -> None: # Here cannot remove the widget since this function is called by the widget # So just set invisible and change to empty word # It will be removed later if clear or edit end. widget.visible = False if index >= 0 and index < len(self._search_words): self._search_words[index] = "" self.search(self._search_words) def search(self, search_words: List[str]): """ Search using selected search engine. Args: search_words (List[str]): List of search terms. """ # TODO: We need to have predefined default search if self._search_engine is None: search_names = SearchEngineRegistry().get_search_names() self._search_engine = search_names[0] if search_names else None if self._search_engine: SearchModel = SearchEngineRegistry().get_search_model(self._search_engine) else: log_warn("No search engines registered! Please import a search extension.") return if not SearchModel: log_warn(f"Search engine '{self._search_engine}' not found.") return search_words = [word for word in search_words or [] if word] # Filter empty(hidden) word if len(search_words) > 0: search_results = SearchModel(search_text=" ".join(search_words), current_dir=self._search_dir) model = SearchResultsModel(search_results) else: model = None if self._callback: self._callback(model) def _on_search_engines_changed(self): search_names = SearchEngineRegistry().get_search_names() self.enabled = bool(search_names)
14,675
Python
38.772358
161
0.567564
omniverse-code/kit/exts/omni.kit.widget.search_delegate/omni/kit/widget/search_delegate/tests/test_search_field.py
## Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. ## ## NVIDIA CORPORATION and its licensors retain all intellectual property ## and proprietary rights in and to this software, related documentation ## and any modifications thereto. Any use, reproduction, disclosure or ## distribution of this software and related documentation without an express ## license agreement from NVIDIA CORPORATION is strictly prohibited. ## from unittest.mock import patch, MagicMock import omni.kit.ui_test as ui_test from omni.kit.ui_test.query import MenuRef from omni.ui.tests.test_base import OmniUiTest from omni.kit.search_core import AbstractSearchModel, AbstractSearchItem, SearchEngineRegistry from ..widget import SearchField from ..model import SearchResultsModel class MockSearchEngineRegistry(MagicMock): def get_search_names(): return "test_search" def get_search_model(_: str): return MockSearchModel class MockSearchItem(AbstractSearchItem): def __init__(self, name: str, path: str): super().__init__() self._name = name self._path = path @property def name(self): return self._name @property def path(self): return self._path class MockSearchModel(AbstractSearchModel): def __init__(self, search_text: str, current_dir: str): super().__init__() self._items = [] search_words = search_text.split(" ") # Return mock results from input search text for search_word in search_words: name = f"{search_word}.usd" self._items.append(MockSearchItem(name, f"{current_dir}/{name}")) @property def items(self): return self._items class TestSearchField(OmniUiTest): async def setUp(self): self._search_results = None async def tearDown(self): if self._search_results: self._search_results.destroy() self._search_results = None def _on_search(self, search_results: SearchResultsModel): self._search_results = search_results async def test_search_succeeds(self): """Testing search function successfully returns search results""" window = await self.create_test_window() with window.frame: under_test = SearchField(self._on_search) under_test.build_ui() search_words = ["foo", "bar"] with patch("omni.kit.widget.search_delegate.widget.SearchEngineRegistry", return_value=MockSearchEngineRegistry): under_test.search_dir = "C:/my_search_dir" under_test.search(search_words) # Assert the the search generated the expected results results = self._search_results.get_item_children(None) self.assertEqual( [f"{under_test.search_dir}/{w}.usd" for w in search_words], [result.path for result in results] ) for result in results: thumbnail = await result.get_custom_thumbnails_for_folder_async() self.assertEqual(thumbnail, {}) self.assertTrue(under_test.visible) under_test.destroy() async def test_setting_search_dir_triggers_search(self): """Testing that when done editing the search field, executes the search""" window = await self.create_test_window() mock_search = MagicMock() with window.frame: with patch.object(SearchField, "search") as mock_search: under_test = SearchField(None) under_test.build_ui() # Procedurally set search directory and search field search_words = ["foo", "bar"] under_test.search_dir = "C:/my_search_dir" under_test._on_begin_edit(None) under_test._search_field.model.set_value(" ".join(search_words)) under_test._on_end_edit(None) # Assert that the search is executed mock_search.assert_called_once_with(search_words) under_test.destroy() async def test_engine_menu(self): window = await self.create_test_window(block_devices=False) with window.frame: under_test = SearchField(None) under_test.build_ui() self._subscription = SearchEngineRegistry().register_search_model("TEST_SEARCH", MockSearchModel) window_ref = ui_test.WindowRef(window, "") button_ref = window_ref.find_all("**/Button[*].identifier=='show_engine_menu'")[0] await button_ref.click() self.assertTrue(under_test.enabled) self.assertIsNotNone(under_test._search_engine_menu) self.assertTrue(under_test._search_engine_menu.shown) menu_ref = MenuRef(under_test._search_engine_menu, "") menu_items = menu_ref.find_all("**/") self.assertEqual(len(menu_items), 1) self.assertEqual(menu_items[0].widget.text, "TEST_SEARCH") under_test.destroy() self._subscription = None async def test_edit_search(self): window = await self.create_test_window(block_devices=False) with window.frame: under_test = SearchField(self._on_search) under_test.build_ui() self._subscription = SearchEngineRegistry().register_search_model("TEST_SEARCH", MockSearchModel) search_words = ["foo", "bar"] under_test.search_dir = "C:/my_search_dir" under_test._on_begin_edit(None) under_test._search_field.model.set_value(" ".join(search_words)) under_test._on_end_edit(None) results = self._search_results.get_item_children(None) self.assertEqual(len(results), 2) # Remove first search window_ref = ui_test.WindowRef(window, "") close_ref = window_ref.find_all(f"**/Button[*].identifier=='search_word_button'")[0] await close_ref.click() results = self._search_results.get_item_children(None) self.assertEqual(len(results), 1) # Clear search await self.wait_n_updates() clear_ref = ui_test.WidgetRef(under_test._clear_button, "", window=window) await clear_ref.click() self.assertIsNone(self._search_results) self._subscription = None under_test.destroy()
6,247
Python
36.190476
121
0.639187
omniverse-code/kit/exts/omni.kit.widget.search_delegate/docs/index.rst
omni.kit.widget.search_delegate ############################### Base module that provides a search widget for searching the file system .. toctree:: :maxdepth: 1 CHANGELOG .. automodule:: omni.kit.widget.search_delegate :platform: Windows-x86_64, Linux-x86_64 :members: :show-inheritance: :undoc-members: .. autoclass:: SearchField :members:
382
reStructuredText
18.149999
71
0.628272
omniverse-code/kit/exts/omni.graph/config/extension.toml
[package] title = "OmniGraph Python" version = "1.50.2" category = "Graph" readme = "docs/README.md" description = "Contains the implementation of the OmniGraph core (Python Support)." preview_image = "data/preview.png" repository = "" keywords = ["kit", "omnigraph", "core"] # Main Python module, available as "import omni.graph.core" [[python.module]] name = "omni.graph.core" # Other extensions on which this one relies [dependencies] "omni.graph.core" = {} "omni.graph.tools" = {} "omni.kit.test" = {} "omni.kit.commands" = {} "omni.kit.usd_undo" = {} "omni.usd" = {} "omni.client" = {} "omni.kit.async_engine" = {} "omni.kit.stage_templates" = {} "omni.kit.pip_archive" = {} [python.pipapi] requirements = ["numpy"] # SWIPAT filed under: http://nvbugs/3193231 [[test]] stdoutFailPatterns.exclude = [ "*Ignore this error/warning*", ] pyCoverageFilter = ["omni.graph"] # Restrict coverage to omni.graph only [documentation] deps = [ ["kit-sdk", "_build/docs/kit-sdk/latest"], # WAR to include omni.graph.core refs until that workflow is moved ] pages = [ "docs/Overview.md", "docs/commands.rst", "docs/omni.graph.core.bindings.rst", "docs/autonode.rst", "docs/controller.rst", "docs/running_one_script.rst", "docs/runtimeInitialize.rst", "docs/testing.rst", "docs/CHANGELOG.md", ]
1,335
TOML
24.207547
113
0.669663
omniverse-code/kit/exts/omni.graph/omni/graph/core/_omni_graph_core.pyi
"""pybind11 omni.graph.core bindings""" from __future__ import annotations import omni.graph.core._omni_graph_core import typing import carb.events._events import numpy import omni.core._core import omni.graph.core._omni_graph_core._internal import omni.graph.core._omni_graph_core._og_unstable import omni.inspect._omni_inspect _Shape = typing.Tuple[int, ...] __all__ = [ "ACCORDING_TO_CONTEXT_GRAPH_INDEX", "APPLIED_SCHEMA", "ASSET", "AUTHORING_GRAPH_INDEX", "Attribute", "AttributeData", "AttributePortType", "AttributeRole", "AttributeType", "BOOL", "BUNDLE", "BaseDataType", "BucketId", "BundleChangeType", "COLOR", "CONNECTION", "ComputeGraph", "ConnectionInfo", "ConnectionType", "DOUBLE", "ERROR", "EXECUTION", "ExecutionAttributeState", "ExtendedAttributeType", "FLOAT", "FRAME", "FileFormatVersion", "Graph", "GraphBackingType", "GraphContext", "GraphEvaluationMode", "GraphEvent", "GraphPipelineStage", "GraphRegistry", "GraphRegistryEvent", "HALF", "IBundle2", "IBundleChanges", "IBundleFactory", "IBundleFactory2", "IConstBundle2", "INFO", "INSTANCING_GRAPH_TARGET_PATH", "INT", "INT64", "INodeCategories", "ISchedulingHints", "ISchedulingHints2", "IVariable", "MATRIX", "MemoryType", "NONE", "NORMAL", "Node", "NodeEvent", "NodeType", "OBJECT_ID", "OmniGraphBindingError", "PATH", "POSITION", "PRIM", "PRIM_TYPE_NAME", "PtrToPtrKind", "QUATERNION", "RELATIONSHIP", "Severity", "TAG", "TARGET", "TEXCOORD", "TEXT", "TIMECODE", "TOKEN", "TRANSFORM", "Type", "UCHAR", "UINT", "UINT64", "UNKNOWN", "VECTOR", "WARNING", "acquire_interface", "attach", "deregister_node_type", "deregister_post_load_file_format_upgrade_callback", "deregister_pre_load_file_format_upgrade_callback", "detach", "eAccessLocation", "eAccessType", "eComputeRule", "ePurityStatus", "eThreadSafety", "eVariableScope", "get_all_graphs", "get_all_graphs_and_subgraphs", "get_bundle_tree_factory_interface", "get_compute_graph_contexts", "get_global_orchestration_graphs", "get_global_orchestration_graphs_in_pipeline_stage", "get_graph_by_path", "get_graphs_in_pipeline_stage", "get_node_by_path", "get_node_categories_interface", "get_node_type", "get_registered_nodes", "is_global_graph_prim", "on_shutdown", "register_node_type", "register_post_load_file_format_upgrade_callback", "register_pre_load_file_format_upgrade_callback", "register_python_node", "release_interface", "set_test_failure", "shutdown_compute_graph", "test_failure_count", "update" ] class Attribute(): """ An attribute, defining a data type and value that belongs to a node """ def __bool__(self) -> bool: ... def __eq__(self, arg0: Attribute) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... def connect(self, path: Attribute, modify_usd: bool) -> bool: """ Connects this attribute with another attribute. Assumes regular connection type. Args: path (omni.graph.core.Attribute): The destination attr modify_usd (bool): Whether to create USD. Returns: bool: True for success, False for fail """ @staticmethod def connectEx(*args, **kwargs) -> typing.Any: """ Connects this attribute with another attribute. Allows for different connection types. Args: info (omni.graph.core.ConnectionInfo): The ConnectionInfo object that contains both the attribute and the connection type modify_usd (bool): Whether to modify the underlying USD with this connection Returns: bool: True for success, False for fail """ def connectPrim(self, path: str, modify_usd: bool, write: bool) -> bool: """ Connects this attribute to a prim that can represent a bundle connection or just a plain prim relationship Args: path (str): The path to the prim modify_usd (bool): Whether to modify USD. write (bool): Whether this connection represents a bundle Returns: bool: True for success, False for fail """ def deprecation_message(self) -> str: """ Gets the deprecation message on an attribute, if it is deprecated. Typically this message gives guidance as to what the user should do instead of using the deprecated attribute. Returns: str: The message associated with a deprecated attribute """ def disconnect(self, attribute: Attribute, modify_usd: bool) -> bool: """ Disconnects this attribute from another attribute. Args: attribute (omni.graph.core.Attribute): The destination attribute of the connection to remove modify_usd (bool): Whether to modify USD Returns: bool: True for success, False for fail """ def disconnectPrim(self, path: str, modify_usd: bool, write: bool) -> bool: """ Disconnects this attribute to a prim that can represent a bundle connection or just a plain prim relationship Args: path (str): The path to the prim modify_usd (bool): Whether to modify USD. write (bool): Whether this connection represents a bundle Returns: bool: True for success, False for fail """ @staticmethod def ensure_port_type_in_name(name: str, port_type: AttributePortType, is_bundle: bool) -> str: """ Return the attribute name with the port type namespace prepended if it isn't already present. Args: name (str): The attribute name, with or without the port prefix port_type (omni.graph.core.AttributePortType): The port type of the attribute is_bundle (bool): true if the attribute name is to be used in a bundle. Note that colon is an illegal character in bundled attributes so an underscore is used instead. Returns: str: The name with the proper prefix for the given port type """ def get(self, on_gpu: bool = False, instance: int = 18446744073709551614) -> object: """ Get the value of the attribute Args: on_gpu (bool): Is the data to be retrieved from the GPU? instance (int): an instance index when getting value on an instantiated graph Returns: Any: Value of the attribute's data """ def get_all_metadata(self) -> dict: """ Gets the attribute's metadata Returns: dict[str,str]: A dictionary of name:value metadata on the attribute """ @staticmethod def get_array(*args, **kwargs) -> typing.Any: """ Gets the value of an array attribute Args: on_gpu (bool): Is the data to be retrieved from the GPU? get_for_write (bool): Should the data be retrieved for writing? reserved_element_count (int): If the data is to be retrieved for writing, preallocate this many elements instance (int): an instance index when getting value on an instantiated graph Returns: list[Any]: Value of the array attribute's data """ @staticmethod def get_attribute_data(*args, **kwargs) -> typing.Any: """ Get the AttributeData object that can access the attribute's data Args: instance (int): an instance index when getting value on an instantiated graph Returns: omni.graph.core.AttributeData: The underlying attribute data accessor object for this attribute """ def get_disable_dynamic_downstream_work(self) -> bool: """ Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute. Note you also have to call setDynamicDownstreamControl on the node to enable this feature. See setDynamicDownstreamControl on INode for further information. Returns: bool: True if downstream nodes are disabled in dynamic scheduling, False otherwise """ def get_downstream_connection_count(self) -> int: """ Gets the number of downstream connections to this attribute Returns: int: the number of downstream connections on this attribute. """ def get_downstream_connections(self) -> typing.List[Attribute]: """ Gets the list of downstream connections to this attribute Returns: list[omni.graph.core.Attribute]: The list of downstream connections for this attribute. """ @staticmethod def get_downstream_connections_info(*args, **kwargs) -> typing.Any: """ Returns the list of downstream connections for this attribute, with detailed connection information such as the connection type. Returns: list[omni.graph.core.ConnectionInfo]: A list of the downstream ConnectionInfo objects """ def get_extended_type(self) -> ExtendedAttributeType: """ Get the extended type of the attribute Returns: omni.graph.core.ExtendedAttributeType: Extended type of the attribute data object """ def get_handle(self) -> int: """ Get a handle to the attribute Returns: int: An opaque handle to the attribute """ def get_metadata(self, key: str) -> str: """ Returns the metadata value for the given key. Args: key: (str) The metadata keyword Returns: str: Metadata value for the given keyword, or None if it is not defined """ def get_metadata_count(self) -> int: """ Gets the number of metadata values on the attribute Returns: int: the number of metadata values currently defined on the attribute. """ def get_name(self) -> str: """ Get the attribute's name Returns: str: The name of the current attribute. """ @staticmethod def get_node(*args, **kwargs) -> typing.Any: """ Gets the node to which this attribute belongs Returns: omni.graph.core.Node: The node associated with the attribute """ def get_path(self) -> str: """ Get the path to the attribute Returns: str: The full path to the attribute, including the node path. """ def get_port_type(self) -> AttributePortType: """ Gets the attribute's port type (input, output, or state) Returns: omni.graph.core.AttributePortType: The port type of the attribute. """ @staticmethod def get_port_type_from_name(name: str) -> AttributePortType: """ Parse the port type from the given attribute name if present. The port type is indicated by a prefix seperated by a colon or underscore in the case of bundled attributes. Args: name The attribute name Returns: omni.graph.core.AttributePortType: The port type indicated by the attribute prefix if present. AttributePortType.UNKNOWN if there is no recognized prefix. """ @staticmethod def get_resolved_type(*args, **kwargs) -> typing.Any: """ Get the resolved type of the attribute Returns: omni.graph.core.Type: Resolved type of the attribute data object, or the hardcoded type for regular attributes """ def get_type_name(self) -> str: """ Get the name of the attribute's type Returns: str: The type name of the current attribute. """ def get_union_types(self) -> object: """ Get the list of types accepted by a union attribute Returns: list[str]: The list of accepted types for the attribute if it is an extended union type, else None """ def get_upstream_connection_count(self) -> int: """ Gets the number of upstream connections to this attribute Returns: int: the number of upstream connections on this attribute. """ def get_upstream_connections(self) -> typing.List[Attribute]: """ Gets the list of upstream connections to this attribute Returns: list[omni.graph.core.Attribute]: The list of upstream connections for this attribute. """ @staticmethod def get_upstream_connections_info(*args, **kwargs) -> typing.Any: """ Returns the list of upstream connections for this attribute, with detailed connection information such as the connection type. Returns: list[omni.graph.core.ConnectionInfo]: A list of the upstream ConnectionInfo objects """ def is_array(self) -> bool: """ Checks if the attribute is an array type. Returns: bool: True if the attribute data type is an array """ def is_compatible(self, attribute: Attribute) -> bool: """ Checks to see if this attribute is compatible with another one, in particular the data types they use Args: attribute (omni.graph.core.Attribute): Attribute for which compatibility is to be checked Returns: bool: True if this attribute is compatible with "attribute" """ def is_connected(self, attribute: Attribute) -> bool: """ Checks to see if this attribute has a connection to another attribute Args: attribute (Attribute): Attribute for which the connection is to be checked Returns: bool: True if this attribute is connected to another, either as source or destination """ def is_deprecated(self) -> bool: """ Checks whether an attribute is deprecated. Deprecated attributes should not be used as they will be removed in a future version. Returns: bool: True if the attribute is deprecated """ def is_dynamic(self) -> bool: """ Checks to see if an attribute is dynamic Returns: bool: True if the current attribute is a dynamic attribute (not in the node type definition). """ def is_runtime_constant(self) -> bool: """ Checks is this attribute is a runtime constant. Runtime constants will keep the same value every frame, for every instance. This property can be taken advantage of in vectorized compute. Returns: bool: True if the attribute is a runtime constant """ def is_valid(self) -> bool: """ Checks if the current attribute is valid. Returns: bool: True if the attribute reference points to a valid attribute object """ def register_value_changed_callback(self, func: object) -> None: """ Registers a function that will be invoked when the value of the given attribute changes. Note that an attribute can have one and only one callback. Subsequent calls will replace previously set callbacks. Passing None for the function argument will clear the existing callback. Args: func (callable): A function with one argument representing the attribute that changed. """ @staticmethod def remove_port_type_from_name(name: str, is_bundle: bool) -> str: """ Find the attribute name with the port type removed if it is present. For example "inputs:attr" becomes "attr" Args: name (str): The attribute name, with or without the port prefix is_bundle (bool): True if the attribute name is to be used in a bundle. Note that colon is an illegal character in bundled attributes so an underscore is used instead. Returns: str: The name with the port type prefix removed """ def set(self, value: object, on_gpu: bool = False, instance: int = 18446744073709551614) -> bool: """ Sets the value of the attribute's data Args: value (Any): New value of the attribute's data on_gpu (bool): Is the data to be set on the GPU? instance (int): an instance index when setting value on an instantiated graph Returns: bool: True if the value was successfully set """ def set_default(self, value: object, on_gpu: bool = False) -> bool: """ Sets the default value of the attribute's data (value when not connected) Args: value (Any): New value of the default attribute's data on_gpu (bool): Is the data to be set on the GPU? Returns: bool: True if the value was successfully set """ def set_disable_dynamic_downstream_work(self, disable: bool) -> None: """ Where we have dynamic scheduling, downstream nodes can have their execution disabled by turning on the flag in the upstream attribute. Note you also have to call setDynamicDownstreamControl on the node to enable this feature. This function allows you to set the flag on the attribute that will disable the downstream node. See setDynamicDownstreamControl on INode for further information. Args: disable (bool): Whether to disable downstream connected nodes in dynamic scheduling. """ def set_metadata(self, key: str, value: str) -> bool: """ Sets the metadata value for the given key Args: key (str): The metadata keyword value (str): The value of the metadata """ @staticmethod def set_resolved_type(*args, **kwargs) -> typing.Any: """ Sets the resolved type for the extended attribute. Only valid for attributes with union/any extended types, who's type has not yet been resolved. Should only be called from on_connection_type_resolve() callback. This operation is async and may fail if the type cannot be resolved as requested. Args: resolved_type (omni.graph.core.Type): The type to resolve the attribute to """ def update_attribute_value(self, update_immediately: bool) -> bool: """ Requests the value of an attribute. In the cases of lazy evaluation systems, this generates the "pull" that causes the attribute to update its value. Args: update_immediately (bool): Whether to update the attribute value immediately. If True, the function will block until the attribute is update and then return. If False, the attribute will be updated in the next update loop. Returns: Any: The value of the attribute """ @staticmethod def write_complete(attributes: typing.Sequence) -> None: """ Warn the framework that writing to the provided attributes is done, so it can trigger callbacks attached to them Args: attributes (list[omni.graph.core.Attribute]): List of attributes that are done writing """ @property def gpu_ptr_kind(self) -> omni::fabric::PtrToPtrKind: """ Defines the memory space that GPU array data pointers live in :type: omni::fabric::PtrToPtrKind """ @gpu_ptr_kind.setter def gpu_ptr_kind(self, arg1: omni::fabric::PtrToPtrKind) -> None: """ Defines the memory space that GPU array data pointers live in """ @property def is_optional_for_compute(self) -> bool: """ Flag that is set when an attribute need not be valid for compute() to happen. bool: :type: bool """ @is_optional_for_compute.setter def is_optional_for_compute(self, arg1: bool) -> None: """ Flag that is set when an attribute need not be valid for compute() to happen. bool: """ resolved_prefix = '__resolved_' pass class AttributeData(): """ Reference to data defining an attribute's value """ def __bool__(self) -> bool: ... def __eq__(self, arg0: AttributeData) -> bool: ... def __hash__(self) -> int: ... def as_read_only(self) -> AttributeData: """ Returns read-only variant of the attribute data. Returns: AttributeData: Read-only variant of the attribute data. """ def copy_data(self, rhs: AttributeData) -> bool: """ Copies the AttributeData data into this object's data. Args: rhs (omni.graph.core.AttributeData): Attribute data to be copied - must be the same type as the current object to work Returns: bool: True if the data was successfully copied, else False. """ def cpu_valid(self) -> bool: """ Returns whether this attribute data object is currently valid on the cpu. Returns: bool: True if the data represented by this object currently has a valid value in CPU memory """ def get(self, on_gpu: bool = False) -> object: """ Gets the current value of the attribute data Args: on_gpu (bool): Is the data to be retrieved from the GPU? Returns: Any: Value of the attribute data """ @staticmethod def get_array(*args, **kwargs) -> typing.Any: """ Gets the current value of the attribute data. Args: on_gpu (bool): Is the data to be retrieved from the GPU? get_for_write (bool): Should the data be retrieved for writing? reserved_element_count (int): If the data is to be retrieved for writing, preallocate this many elements Returns: Any: Value of the array attribute data """ def get_extended_type(self) -> ExtendedAttributeType: """ Returns the extended type of the current attribute data. Returns: omni.graph.core.ExtendedAttributeType: Extended type of the attribute data object """ def get_name(self) -> str: """ Returns the name of the current attribute data. Returns: str: Name of the attribute data object """ def get_resolved_type(self) -> Type: """ Returns the resolved type of the extended attribute data. Only valid for attributes with union/any extended types. Returns: omni.graph.core.Type: Resolved type of the attribute data object """ def get_type(self) -> Type: """ Returns the type of the current attribute data. Returns: omni.graph.core.Type: Type of the attribute data object """ def gpu_valid(self) -> bool: """ Returns whether this attribute data object is currently valid on the gpu. Returns: bool: True if the data represented by this object currently has a valid value in GPU memory """ def is_read_only(self) -> bool: """ Returns whether this attribute data object is read-only or not. Returns: bool: True if the data represented by this object is read-only """ def is_valid(self) -> bool: """ Returns whether this attribute data object is valid or not. Returns: bool: True if the data represented by this object is valid """ def resize(self, element_count: int) -> bool: """ Sets the number of elements in the array represented by this object. Args: element_count (int): Number of elements to reserve in the array Returns: bool: True if the array was resized, False if not (e.g. if the attribute data was not an array type) """ def set(self, value: object, on_gpu: bool = False) -> bool: """ Sets the value of the attribute data Args: value (Any): New value of the attribute data on_gpu (bool): Is the data to be set on the GPU? Returns: bool: True if the value was successfully set """ def size(self) -> int: """ Returns the size of the data represented by this object (1 if it's not an array). Returns: int: Number of elements in the data """ @property def gpu_ptr_kind(self) -> PtrToPtrKind: """ Defines the memory space that GPU array data pointers live in :type: PtrToPtrKind """ @gpu_ptr_kind.setter def gpu_ptr_kind(self, arg1: PtrToPtrKind) -> None: """ Defines the memory space that GPU array data pointers live in """ pass class AttributePortType(): """ Port side of the attribute on its node Members: ATTRIBUTE_PORT_TYPE_INPUT : Deprecated: use og.AttributePortType.INPUT ATTRIBUTE_PORT_TYPE_OUTPUT : Deprecated: use og.AttributePortType.OUTPUT ATTRIBUTE_PORT_TYPE_STATE : Deprecated: use og.AttributePortType.STATE ATTRIBUTE_PORT_TYPE_UNKNOWN : Deprecated: use og.AttributePortType.UNKNOWN INPUT : Attribute is an input OUTPUT : Attribute is an output STATE : Attribute is state UNKNOWN : Attribute port type is unknown """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ATTRIBUTE_PORT_TYPE_INPUT: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT: 0> ATTRIBUTE_PORT_TYPE_OUTPUT: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT: 1> ATTRIBUTE_PORT_TYPE_STATE: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_STATE: 2> ATTRIBUTE_PORT_TYPE_UNKNOWN: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_UNKNOWN: 3> INPUT: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT: 0> OUTPUT: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT: 1> STATE: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_STATE: 2> UNKNOWN: omni.graph.core._omni_graph_core.AttributePortType # value = <AttributePortType.ATTRIBUTE_PORT_TYPE_UNKNOWN: 3> __members__: dict # value = {'ATTRIBUTE_PORT_TYPE_INPUT': <AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT: 0>, 'ATTRIBUTE_PORT_TYPE_OUTPUT': <AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT: 1>, 'ATTRIBUTE_PORT_TYPE_STATE': <AttributePortType.ATTRIBUTE_PORT_TYPE_STATE: 2>, 'ATTRIBUTE_PORT_TYPE_UNKNOWN': <AttributePortType.ATTRIBUTE_PORT_TYPE_UNKNOWN: 3>, 'INPUT': <AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT: 0>, 'OUTPUT': <AttributePortType.ATTRIBUTE_PORT_TYPE_OUTPUT: 1>, 'STATE': <AttributePortType.ATTRIBUTE_PORT_TYPE_STATE: 2>, 'UNKNOWN': <AttributePortType.ATTRIBUTE_PORT_TYPE_UNKNOWN: 3>} pass class AttributeRole(): """ Interpretation applied to the attribute data Members: APPLIED_SCHEMA : Data is to be interpreted as an applied schema BUNDLE : Data is to be interpreted as an OmniGraph Bundle COLOR : Data is to be interpreted as RGB or RGBA color EXECUTION : Data is to be interpreted as an Action Graph execution pin FRAME : Data is to be interpreted as a 4x4 matrix representing a reference frame MATRIX : Data is to be interpreted as a square matrix of values NONE : Data has no special role NORMAL : Data is to be interpreted as a normal vector OBJECT_ID : Data is to be interpreted as a unique object identifier PATH : Data is to be interpreted as a path to a USD element POSITION : Data is to be interpreted as a position or point vector PRIM_TYPE_NAME : Data is to be interpreted as the name of a prim type QUATERNION : Data is to be interpreted as a rotational quaternion TARGET : Data is to be interpreted as a relationship target path TEXCOORD : Data is to be interpreted as texture coordinates TEXT : Data is to be interpreted as a text string TIMECODE : Data is to be interpreted as a time code TRANSFORM : Deprecated VECTOR : Data is to be interpreted as a simple vector UNKNOWN : Data role is currently unknown """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ APPLIED_SCHEMA: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.APPLIED_SCHEMA: 11> BUNDLE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.BUNDLE: 16> COLOR: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.COLOR: 4> EXECUTION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.EXECUTION: 13> FRAME: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.FRAME: 8> MATRIX: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.MATRIX: 14> NONE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.NONE: 0> NORMAL: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.NORMAL: 2> OBJECT_ID: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.OBJECT_ID: 15> PATH: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.PATH: 17> POSITION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.POSITION: 3> PRIM_TYPE_NAME: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.PRIM_TYPE_NAME: 12> QUATERNION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.QUATERNION: 6> TARGET: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TARGET: 20> TEXCOORD: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TEXCOORD: 5> TEXT: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TEXT: 10> TIMECODE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TIMECODE: 9> TRANSFORM: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TRANSFORM: 7> UNKNOWN: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.UNKNOWN: 21> VECTOR: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.VECTOR: 1> __members__: dict # value = {'APPLIED_SCHEMA': <AttributeRole.APPLIED_SCHEMA: 11>, 'BUNDLE': <AttributeRole.BUNDLE: 16>, 'COLOR': <AttributeRole.COLOR: 4>, 'EXECUTION': <AttributeRole.EXECUTION: 13>, 'FRAME': <AttributeRole.FRAME: 8>, 'MATRIX': <AttributeRole.MATRIX: 14>, 'NONE': <AttributeRole.NONE: 0>, 'NORMAL': <AttributeRole.NORMAL: 2>, 'OBJECT_ID': <AttributeRole.OBJECT_ID: 15>, 'PATH': <AttributeRole.PATH: 17>, 'POSITION': <AttributeRole.POSITION: 3>, 'PRIM_TYPE_NAME': <AttributeRole.PRIM_TYPE_NAME: 12>, 'QUATERNION': <AttributeRole.QUATERNION: 6>, 'TARGET': <AttributeRole.TARGET: 20>, 'TEXCOORD': <AttributeRole.TEXCOORD: 5>, 'TEXT': <AttributeRole.TEXT: 10>, 'TIMECODE': <AttributeRole.TIMECODE: 9>, 'TRANSFORM': <AttributeRole.TRANSFORM: 7>, 'VECTOR': <AttributeRole.VECTOR: 1>, 'UNKNOWN': <AttributeRole.UNKNOWN: 21>} pass class AttributeType(): """ Utilities for operating with the attribute data type class omni.graph.core.Type and related types """ @staticmethod def base_data_size(type: Type) -> int: """ Figure out how much space a base data type occupies in memory inside Fabric. This will not necessarily be the same as the space occupied by the Python data, which is only transient. Multiply by the tuple count and the array element count to get the full size of any given piece of data. Args: type (omni.graph.core.Type): The type object whose base data type size is to be found Returns: int: Number of bytes one instance of the base data type occupies in Fabric """ @staticmethod def get_unions() -> dict: """ Returns a dictionary containing the names and contents of the ogn attribute union types. Returns: dict[str, list[str]]: Dictionary that maps the attribute union names to list of associated ogn types """ @staticmethod def is_legal_ogn_type(type: Type) -> bool: """ Check to see if the type combination has a legal representation in OGN. Args: type (omni.graph.core.Type): The type object to be checked Returns: bool: True if the type represents a legal OGN type, otherwise False """ @staticmethod def sdf_type_name_from_type(type: Type) -> object: """ Given an attribute type find the corresponding SDF type name for it, None if there is none, e.g. a 'bundle' Args: type (omni.graph.core.Type): The type to be converted Returns: str: The SDF type name of the type, or None if there is no corresponding SDF type """ @staticmethod def type_from_ogn_type_name(ogn_type_name: str) -> Type: """ Parse an OGN attribute type name into the corresponding omni.graph.core.Type description. Args: ogn_type_name (str): The OGN-style attribute type name to be converted Returns: omni.graph.core.Type: Type corresponding to the attribute type name in OGN format. Type object will be the unknown type if the type name could be be parsed. """ @staticmethod def type_from_sdf_type_name(sdf_type_name: str) -> Type: """ Parse an SDF attribute type name into the corresponding omni.graph.core.Type description. Note that SDF types are not capable of representing some of the valid types - use typeFromOgnTypeName() for a more comprehensive type name description. Args: sdf_type_name (str): The SDF-style attribute type name to be converted Returns: omni.graph.core.Type: Type corresponding to the attribute type name in SDF format. Type object will be the unknown type if the type name could be be parsed. """ pass class BaseDataType(): """ Basic data type for attribute data Members: ASSET : Data represents an Asset BOOL : Data is a boolean CONNECTION : Data is a special value representing a connection DOUBLE : Data is a double precision floating point value FLOAT : Data is a single precision floating point value HALF : Data is a half precision floating point value INT : Data is a 32-bit integer INT64 : Data is a 64-bit integer PRIM : Data is a reference to a USD prim RELATIONSHIP : Data is a relationship to a USD prim TAG : Data is a special Fabric tag TOKEN : Data is a reference to a unique shared string UCHAR : Data is an 8-bit unsigned character UINT : Data is a 32-bit unsigned integer UINT64 : Data is a 64-bit unsigned integer UNKNOWN : Data type is currently unknown """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ASSET: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.ASSET: 12> BOOL: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.BOOL: 1> CONNECTION: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.CONNECTION: 14> DOUBLE: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.DOUBLE: 9> FLOAT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.FLOAT: 8> HALF: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.HALF: 7> INT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.INT: 3> INT64: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.INT64: 5> PRIM: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.PRIM: 13> RELATIONSHIP: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.RELATIONSHIP: 11> TAG: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.TAG: 15> TOKEN: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.TOKEN: 10> UCHAR: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UCHAR: 2> UINT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UINT: 4> UINT64: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UINT64: 6> UNKNOWN: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UNKNOWN: 0> __members__: dict # value = {'ASSET': <BaseDataType.ASSET: 12>, 'BOOL': <BaseDataType.BOOL: 1>, 'CONNECTION': <BaseDataType.CONNECTION: 14>, 'DOUBLE': <BaseDataType.DOUBLE: 9>, 'FLOAT': <BaseDataType.FLOAT: 8>, 'HALF': <BaseDataType.HALF: 7>, 'INT': <BaseDataType.INT: 3>, 'INT64': <BaseDataType.INT64: 5>, 'PRIM': <BaseDataType.PRIM: 13>, 'RELATIONSHIP': <BaseDataType.RELATIONSHIP: 11>, 'TAG': <BaseDataType.TAG: 15>, 'TOKEN': <BaseDataType.TOKEN: 10>, 'UCHAR': <BaseDataType.UCHAR: 2>, 'UINT': <BaseDataType.UINT: 4>, 'UINT64': <BaseDataType.UINT64: 6>, 'UNKNOWN': <BaseDataType.UNKNOWN: 0>} pass class BucketId(): """ Internal Use - Unique identifier of the bucket of Fabric data """ def __init__(self, id: int) -> None: """ Set up the initial value of the bucket id Args: id (int): Unique identifier of a bucket of Fabric data """ @property def id(self) -> int: """ Internal Use - Unique identifier of a bucket of Fabric data :type: int """ @id.setter def id(self, arg0: int) -> None: """ Internal Use - Unique identifier of a bucket of Fabric data """ pass class BundleChangeType(): """ Enumeration representing the type of change that occurred in a bundle. This enumeration is used to identify the kind of modification that has taken place in a bundle or attribute. It's used as the return type for functions that check bundles and attributes, signaling whether those have been modified or not. Members: NONE : Indicates that no change has occurred in the bundle. MODIFIED : Indicates that the bundle has been modified. """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ MODIFIED: omni.graph.core._omni_graph_core.BundleChangeType # value = <BundleChangeType.MODIFIED: 1> NONE: omni.graph.core._omni_graph_core.BundleChangeType # value = <BundleChangeType.NONE: 0> __members__: dict # value = {'NONE': <BundleChangeType.NONE: 0>, 'MODIFIED': <BundleChangeType.MODIFIED: 1>} pass class ComputeGraph(): """ Main OmniGraph interface registered with the extension system """ pass class ConnectionInfo(): """ Attribute and connection type in a given graph connection """ def __init__(self, attr: Attribute, connection_type: ConnectionType) -> None: """ Set up the connection info data Args: attr (omni.graph.core.Attribute): Attribute in the connection connection_type (omni.graph.core.ConnectionType): Type of connection """ @property def attr(self) -> Attribute: """ Attribute being connected :type: Attribute """ @attr.setter def attr(self, arg0: Attribute) -> None: """ Attribute being connected """ @property def connection_type(self) -> ConnectionType: """ Type of connection :type: ConnectionType """ @connection_type.setter def connection_type(self, arg0: ConnectionType) -> None: """ Type of connection """ pass class ConnectionType(): """ Type of connection) Members: CONNECTION_TYPE_REGULAR : Normal connection CONNECTION_TYPE_DATA_ONLY : Connection only represents data access, not execution flow CONNECTION_TYPE_EXECUTION : Connection only represents execution flow, not data access """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ CONNECTION_TYPE_DATA_ONLY: omni.graph.core._omni_graph_core.ConnectionType # value = <ConnectionType.CONNECTION_TYPE_DATA_ONLY: 1> CONNECTION_TYPE_EXECUTION: omni.graph.core._omni_graph_core.ConnectionType # value = <ConnectionType.CONNECTION_TYPE_EXECUTION: 2> CONNECTION_TYPE_REGULAR: omni.graph.core._omni_graph_core.ConnectionType # value = <ConnectionType.CONNECTION_TYPE_REGULAR: 0> __members__: dict # value = {'CONNECTION_TYPE_REGULAR': <ConnectionType.CONNECTION_TYPE_REGULAR: 0>, 'CONNECTION_TYPE_DATA_ONLY': <ConnectionType.CONNECTION_TYPE_DATA_ONLY: 1>, 'CONNECTION_TYPE_EXECUTION': <ConnectionType.CONNECTION_TYPE_EXECUTION: 2>} pass class ExecutionAttributeState(): """ Current execution state of an attribute [DEPRECATED: See omni.graph.action.IActionGraph] Members: DISABLED : Execution is disabled ENABLED : Execution is enabled ENABLED_AND_PUSH : Output attribute connection is enabled and the node is pushed to the evaluation stack LATENT_PUSH : Push this node as a latent event for the current entry point LATENT_FINISH : Output attribute connection is enabled and the latent state is finished for this node """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ DISABLED: omni.graph.core._omni_graph_core.ExecutionAttributeState # value = <ExecutionAttributeState.DISABLED: 0> ENABLED: omni.graph.core._omni_graph_core.ExecutionAttributeState # value = <ExecutionAttributeState.ENABLED: 1> ENABLED_AND_PUSH: omni.graph.core._omni_graph_core.ExecutionAttributeState # value = <ExecutionAttributeState.ENABLED_AND_PUSH: 2> LATENT_FINISH: omni.graph.core._omni_graph_core.ExecutionAttributeState # value = <ExecutionAttributeState.LATENT_FINISH: 4> LATENT_PUSH: omni.graph.core._omni_graph_core.ExecutionAttributeState # value = <ExecutionAttributeState.LATENT_PUSH: 3> __members__: dict # value = {'DISABLED': <ExecutionAttributeState.DISABLED: 0>, 'ENABLED': <ExecutionAttributeState.ENABLED: 1>, 'ENABLED_AND_PUSH': <ExecutionAttributeState.ENABLED_AND_PUSH: 2>, 'LATENT_PUSH': <ExecutionAttributeState.LATENT_PUSH: 3>, 'LATENT_FINISH': <ExecutionAttributeState.LATENT_FINISH: 4>} pass class ExtendedAttributeType(): """ Extended attribute type, if any Members: EXTENDED_ATTR_TYPE_REGULAR : Deprecated: use og.ExtendedAttributeType.REGULAR EXTENDED_ATTR_TYPE_UNION : Deprecated: use og.ExtendedAttributeType.UNION EXTENDED_ATTR_TYPE_ANY : Deprecated: use og.ExtendedAttributeType.ANY REGULAR : Attribute has a fixed data type UNION : Attribute has a list of allowable types of data ANY : Attribute can take any type of data """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ANY: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_ANY: 2> EXTENDED_ATTR_TYPE_ANY: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_ANY: 2> EXTENDED_ATTR_TYPE_REGULAR: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR: 0> EXTENDED_ATTR_TYPE_UNION: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION: 1> REGULAR: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR: 0> UNION: omni.graph.core._omni_graph_core.ExtendedAttributeType # value = <ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION: 1> __members__: dict # value = {'EXTENDED_ATTR_TYPE_REGULAR': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR: 0>, 'EXTENDED_ATTR_TYPE_UNION': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION: 1>, 'EXTENDED_ATTR_TYPE_ANY': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_ANY: 2>, 'REGULAR': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR: 0>, 'UNION': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION: 1>, 'ANY': <ExtendedAttributeType.EXTENDED_ATTR_TYPE_ANY: 2>} pass class FileFormatVersion(): """ Version number for the OmniGraph file format """ def __eq__(self, arg0: FileFormatVersion) -> bool: ... def __gt__(self, arg0: FileFormatVersion) -> bool: ... def __init__(self, major_version: int, minor_version: int) -> None: """ Set up the values defining the file format version Args: major_version (int): Major version, introduces incompatibilities minor_version (int): Minor version, introduces compatible changes only """ def __lt__(self, arg0: FileFormatVersion) -> bool: ... def __neq__(self, arg0: FileFormatVersion) -> bool: ... def __str__(self) -> str: ... @property def majorVersion(self) -> int: """ Major version, introduces incompatibilities :type: int """ @majorVersion.setter def majorVersion(self, arg0: int) -> None: """ Major version, introduces incompatibilities """ @property def minorVersion(self) -> int: """ Minor version, introduces compatible changes only :type: int """ @minorVersion.setter def minorVersion(self, arg0: int) -> None: """ Minor version, introduces compatible changes only """ __hash__ = None pass class Graph(): """ Object containing everything necessary to execute a connected set of nodes. """ def __bool__(self) -> bool: ... def __eq__(self, arg0: Graph) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... def change_pipeline_stage(self, newPipelineStage: GraphPipelineStage) -> None: """ Change the pipeline stage that this graph is in (simulation, pre-render, post-render, on-demand) Args: newPipelineStage (omni.graph.core.GraphPipelineStage): The new pipeline stage of the graph """ def create_graph_as_node(self, name: str, path: str, evaluator: str, is_global_graph: bool, is_backed_by_usd: bool, backing_type: GraphBackingType, pipeline_stage: GraphPipelineStage, evaluation_mode: GraphEvaluationMode = GraphEvaluationMode.GRAPH_EVALUATION_MODE_AUTOMATIC) -> Node: """ Creates a graph that is wrapped by a node in the current graph. Args: name (str): The name of the node path (str): The path to the graph evaluator (str): The name of the evaluator to use for the graph is_global_graph (bool): Whether this is a global graph is_backed_by_usd (bool): Whether the constructs are to be backed by USD backing_type (omni.graph.core.GraphBackingType): The kind of cache backing this graph pipeline_stage (omni.graph.core.GraphPipelineStage): What stage in the pipeline the global graph is at (simulation, pre-render, post-render) evaluation_mode (omni.graph.core.GraphEvaluationMode): What mode to use when evaluating the graph Returns: omni.graph.core.Node: Node wrapping the graph that was created """ def create_node(self, path: str, node_type: str, use_usd: bool) -> Node: """ Given the path to the node and the type of the node, creates a node of that type at that path. Args: path (str): The path to the node node_type (str): The type of the node use_usd (bool): Whether or not to create the USD backing for the node Returns: omni.graph.core.Node: The newly created node """ def create_subgraph(self, subgraphPath: str, evaluator: str = '', createUsd: bool = True) -> Graph: """ Given the path to the subgraph, create the subgraph at that path. Args: subgraphPath (str): The path to the subgraph evaluator (str): The evaluator type createUsd (bool): Whether or not to create the USD backing for the node Returns: omni.graph.core.Graph: Subgraph object created for the given path. """ @staticmethod def create_variable(*args, **kwargs) -> typing.Any: """ Creates a variable on the graph. Args: name (str): The name of the variable type (omni.graph.core.Type): The type of the variable to create. Returns: omni.graph.core.IVariable: A reference to the newly created variable, or None if the variable could not be created. """ def deregister_error_status_change_callback(self, status_change_handle: int) -> None: """ De-registers the error status change callback to be invoked when the error status of nodes change during evaluation. Args: status_change_handle (int): The handle that was returned during the register_error_status_change_callback call """ def destroy_node(self, node_path: str, update_usd: bool) -> bool: """ Given the path to the node, destroys the node at that path. Args: node_path (str): The path to the node update_usd (bool): Whether or not to destroy the USD backing for the node Returns: bool: True if the node was successfully destroyed """ def evaluate(self) -> None: """ Tick the graph by causing it to evaluate. """ def find_variable(self, name: str) -> IVariable: """ Find the variable with the given name in the graph. Args: name (str): The name of the variable to find. Returns: omni.graph.core.IVariable | None: The variable with the given name, or None if not found. """ @staticmethod def get_context(*args, **kwargs) -> typing.Any: """ Gets the context associated to the graph Returns: omni.graph.core.GraphContext: The context associated to the graph """ @staticmethod def get_default_graph_context(*args, **kwargs) -> typing.Any: """ Gets the default context associated with this graph Returns: omni.graph.core.GraphContext: The default graph context associated with this graph. """ def get_evaluator_name(self) -> str: """ Gets the name of the evaluator being used on this graph Returns: str: The name of the graph evaluator (dirty_push, push, execution) """ def get_event_stream(self) -> carb.events._events.IEventStream: """ Get the event stream the graph uses for notification of changes. Returns: carb.events.IEventStream: Event stream to monitor for graph changes """ def get_graph_backing_type(self) -> GraphBackingType: """ Gets the data type backing this graph Returns: omni.graph.core.GraphBackingType: Returns the type of data structure backing this graph """ def get_handle(self) -> int: """ Gets a unique handle identifier for this graph Returns: int: Unique handle identifier for this graph """ def get_instance_count(self) -> int: """ Gets the number of instances this graph has Returns: int: The number of instances the graph has (0 if the graph is standalone). """ def get_node(self, path: str) -> Node: """ Given a path to the node, returns the object for the node. Args: path (str): The path to the node Returns: omni.graph.core.Node: Node object for the given path, None if it does not exist """ def get_nodes(self) -> typing.List[Node]: """ Gets the list of nodes currently in this graph Returns: list[omni.graph.core.Node]: The nodes in this graph. """ def get_owning_compound_node(self) -> Node: """ Returns the compound node for which this graph is the compound subgraph of. Returns: (og.Node) If this graph is a compound graph, the owning compound node. Otherwise, this an invalid node is returned. """ def get_parent_graph(self) -> object: """ Gets the immediate parent graph of this graph Returns: omni.graph.core.Graph | None: The immediate parent graph of this graph (may be None) """ def get_path_to_graph(self) -> str: """ Gets the path to this graph Returns: str: The path to this graph (may be empty). """ def get_pipeline_stage(self) -> GraphPipelineStage: """ Gets the pipeline stage to which this graph belongs Returns: omni.graph.core.PipelineStage: The type of pipeline stage of this graph (simulation, pre-render, post-render) """ def get_subgraph(self, path: str) -> Graph: """ Gets the subgraph living at the given path below this graph Args: path (str): Path to the subgraph to find Returns: omni.graph.core.Graph | None: Subgraph at the path, or None if not found """ def get_subgraphs(self) -> typing.List[Graph]: """ Gets the list of subgraphs under this graph Returns: list[omni.graph.core.Graph]: List of graphs that are subgraphs of this graph """ def get_variables(self) -> typing.List[IVariable]: """ Returns the list of variables defined on the graph. Returns: list[omni.graph.core.IVariable]: The current list of variables on the graph. """ def inspect(self, inspector: omni.inspect._omni_inspect.IInspector) -> bool: """ Runs the inspector on the graph Args: inspector (omni.inspect.Inspector): The inspector to run Returns: bool: True if the inspector was successfully run on the graph, False if it is not supported """ def is_auto_instanced(self) -> bool: """ Returns whether this graph is an auto instance or not. An auto instance is a graph that got merged as an instance with all other similar graphs in the stage. Returns: bool: True if this graph is an auto instance """ def is_compound_graph(self) -> bool: """ Returns whether this graph is a compound graph. A compound graph is subgraph that controlled by a compound node. Returns: bool: True if this graph is a compound graph """ def is_disabled(self) -> bool: """ Checks to see if the graph is disabled Returns: bool: True if this graph object is disabled. """ def is_valid(self) -> bool: """ Checks to see if the graph object is valid Returns: bool: True if this graph object is valid. """ def register_error_status_change_callback(self, callback: object) -> int: """ Registers a callback to be invoked after graph evaluation for all the nodes whose error status changed during the evaluation. The callback receives a list of the nodes whose error status changed. Args: callback (callable): The callback function Returns: int: A handle that can be used for deregistration. Note the calling module is responsible for deregistration of the callback in all circumstances, including where the extension is hot-reloaded. """ def reload_from_stage(self) -> None: """ Force the graph to reload by deleting it and re-parsing from the stage. This is potentially destructive if you have internal state information in any nodes. """ def reload_settings(self) -> None: """ Reload the graph settings. """ def remove_variable(self, variable: IVariable) -> bool: """ Removes the given variable from the graph. Args: variable (omni.graph.core.IVariable): The variable to remove. Returns: bool: True if the variable was successfully removed, False otherwise. """ def rename_node(self, path: str, new_path: str) -> bool: """ Given the path to the node, renames the node at that path. Args: path (str): The path to the node new_path (str): The new path Returns: bool: True if the node was successfully renamed """ def rename_subgraph(self, path: str, new_path: str) -> bool: """ Renames the path of a subgraph Args: path (str): Path to the subgraph being renamed new_path (str): New path for the subgraph """ def set_auto_instancing_allowed(self, arg0: bool) -> bool: """ Allows (or not) this graph to be an auto-instance, ie. to be executed vectorized as an instance amongst all other identical graph Args: allowed (bool): Whether this graph is allowed to be an auto instance. Returns: bool: Whether this graph was allowed to be an auto instance before this call. """ def set_disabled(self, disable: bool) -> None: """ Sets whether this graph object is to be disabled or not. Args: disable (bool): True if the graph is to be disabled """ def set_usd_notice_handling_enabled(self, enable: bool) -> None: """ Sets whether this graph object has USD notice handling enabled. Args: enable (bool): True to enable USD notice handling, False to disable. """ def usd_notice_handling_enabled(self) -> bool: """ Checks whether this graph has USD notice handling enabled. Returns: bool: True if USD notice handling is enabled on this graph. """ @property def evaluation_mode(self) -> GraphEvaluationMode: """ omni.graph.core.GraphEvaluationMode: The evaluation mode sets how the graph will be evaluated. GRAPH_EVALUATION_MODE_AUTOMATIC - Evaluate the graph in Standalone mode when there are no relationships to it, otherwise it will be evaluated in Instanced mode. GRAPH_EVALUATION_MODE_STANDALONE - Evaluates the graph with the graph Prim as the graph target, and ignore Prims with relationships to the graph Prim. Use this mode when constructing self-contained graphs that evaluate independently. GRAPH_EVALUATION_MODE_INSTANCED - Evaluates only when the graph there are relationships from OmniGraphAPI interfaces. Each Prim with a relationship to the graph Prim will cause an evaluation, with the Graph Target set to path of Prim with the OmniGraphAPI interface. Use this mode when the graph represents as an asset or template that can be applied to multiple Prims. :type: GraphEvaluationMode """ @evaluation_mode.setter def evaluation_mode(self, arg1: GraphEvaluationMode) -> None: """ omni.graph.core.GraphEvaluationMode: The evaluation mode sets how the graph will be evaluated. GRAPH_EVALUATION_MODE_AUTOMATIC - Evaluate the graph in Standalone mode when there are no relationships to it, otherwise it will be evaluated in Instanced mode. GRAPH_EVALUATION_MODE_STANDALONE - Evaluates the graph with the graph Prim as the graph target, and ignore Prims with relationships to the graph Prim. Use this mode when constructing self-contained graphs that evaluate independently. GRAPH_EVALUATION_MODE_INSTANCED - Evaluates only when the graph there are relationships from OmniGraphAPI interfaces. Each Prim with a relationship to the graph Prim will cause an evaluation, with the Graph Target set to path of Prim with the OmniGraphAPI interface. Use this mode when the graph represents as an asset or template that can be applied to multiple Prims. """ pass class GraphBackingType(): """ Location of the data backing the graph Members: GRAPH_BACKING_TYPE_FLATCACHE_SHARED : Deprecated: Use GRAPH_BACKING_TYPE_FABRIC_SHARED GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY : Deprecated: Use GRAPH_BACKING_TYPE_FABRIC_WITH_HISTORY GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY : Deprecated: Use GRAPH_BACKING_TYPE_FABRIC_WITHOUT_HISTORY GRAPH_BACKING_TYPE_FABRIC_SHARED : Data is a regular Fabric instance GRAPH_BACKING_TYPE_FABRIC_WITH_HISTORY : Data is a Fabric instance without any history GRAPH_BACKING_TYPE_FABRIC_WITHOUT_HISTORY : Data is a Fabric instance with a ring buffer of history GRAPH_BACKING_TYPE_NONE : No data is stored for the graph GRAPH_BACKING_TYPE_UNKNOWN : The data backing is not currently known """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ GRAPH_BACKING_TYPE_FABRIC_SHARED: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_SHARED: 0> GRAPH_BACKING_TYPE_FABRIC_WITHOUT_HISTORY: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY: 2> GRAPH_BACKING_TYPE_FABRIC_WITH_HISTORY: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY: 1> GRAPH_BACKING_TYPE_FLATCACHE_SHARED: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_SHARED: 0> GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY: 2> GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY: 1> GRAPH_BACKING_TYPE_NONE: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_NONE: 4> GRAPH_BACKING_TYPE_UNKNOWN: omni.graph.core._omni_graph_core.GraphBackingType # value = <GraphBackingType.GRAPH_BACKING_TYPE_UNKNOWN: 3> __members__: dict # value = {'GRAPH_BACKING_TYPE_FLATCACHE_SHARED': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_SHARED: 0>, 'GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY: 1>, 'GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY: 2>, 'GRAPH_BACKING_TYPE_FABRIC_SHARED': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_SHARED: 0>, 'GRAPH_BACKING_TYPE_FABRIC_WITH_HISTORY': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITH_HISTORY: 1>, 'GRAPH_BACKING_TYPE_FABRIC_WITHOUT_HISTORY': <GraphBackingType.GRAPH_BACKING_TYPE_FLATCACHE_WITHOUT_HISTORY: 2>, 'GRAPH_BACKING_TYPE_NONE': <GraphBackingType.GRAPH_BACKING_TYPE_NONE: 4>, 'GRAPH_BACKING_TYPE_UNKNOWN': <GraphBackingType.GRAPH_BACKING_TYPE_UNKNOWN: 3>} pass class GraphContext(): """ Execution context for a graph """ def __bool__(self) -> bool: ... def __eq__(self, arg0: GraphContext) -> bool: ... def __hash__(self) -> int: ... def get_attribute_as_bool(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> bool: """ get_attribute_as_bool is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_boolarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[bool]: """ get_attribute_as_boolarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_double(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> float: """ get_attribute_as_double is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_doublearray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float64]: """ get_attribute_as_doublearray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_float(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> float: """ get_attribute_as_float is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_floatarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float32]: """ get_attribute_as_floatarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_half(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> float: """ get_attribute_as_half is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_halfarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float32]: """ get_attribute_as_halfarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_int(self, arg0: Attribute, arg1: bool, arg2: bool, arg3: int) -> int: """ get_attribute_as_int is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_int64(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> int: """ get_attribute_as_int64 is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_int64array(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.int64]: """ get_attribute_as_int64array is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_intarray(self, arg0: Attribute, arg1: bool, arg2: bool, arg3: int) -> numpy.ndarray[numpy.int32]: """ get_attribute_as_intarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_nested_doublearray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float64]: """ get_attribute_as_nested_doublearray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_nested_floatarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float32]: """ get_attribute_as_nested_floatarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_nested_halfarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.float32]: """ get_attribute_as_nested_halfarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_nested_intarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.int32]: """ get_attribute_as_nested_intarray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_string(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> str: """ get_attribute_as_string is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uchar(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> int: """ get_attribute_as_uchar is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uchararray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.uint8]: """ get_attribute_as_uchararray is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uint(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> int: """ get_attribute_as_uint is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uint64(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> int: """ get_attribute_as_uint64 is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uint64array(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.uint64]: """ get_attribute_as_uint64array is deprecated. Use og.Controller.get() instead. """ def get_attribute_as_uintarray(self, attribute: Attribute, getDefault: bool = False, write: bool = False, writeElemCount: int = 0) -> numpy.ndarray[numpy.uint32]: """ get_attribute_as_uintarray is deprecated. Use og.Controller.get() instead. """ def get_bundle(self, path: str) -> IBundle2: """ Get the bundle object as read-write. Args: path (str): the path to the bundle Returns: omni.graph.core.IBundle2: The bundle object at the path, None if there isn't one """ def get_elapsed_time(self) -> float: """ Returns the time between last evaluation of the graph and "now" Returns: float: the elapsed time """ @staticmethod @typing.overload def get_elem_count(*args, **kwargs) -> typing.Any: """ get_elem_count is deprecated. Use og.Controller.get_array_size() instead. get_elem_count is deprecated. Use og.Controller.get_array_size() instead. """ @typing.overload def get_elem_count(self, arg0: Attribute) -> int: ... def get_frame(self) -> float: """ Returns the global playback time in frames Returns: float: the global playback time in frames """ def get_graph(self) -> Graph: """ Gets the graph associated with this graph context Returns: omni.graph.core.Graph: The graph associated with this graph context. """ def get_graph_target(self, index: int = 18446744073709551614) -> str: """ Get the Prim path of the graph target. The graph target is defined as the parent Prim of the compute graph, except during instancing - where OmniGraph executes a graph once for each Prim. In the case of instancing, the graph target will change at each execution to be the path of the instance. If this is called outside of graph execution, the path of the graph Prim is returned, or an empty token if the graph does not have a Prim associated with it. Args: index (int): The index of instance to fetch. By default, the graph context index is used. Returns: str: The prim path of the current graph target. """ @typing.overload def get_input_bundle(self, path: str) -> IConstBundle2: """ Get the bundle object as read only. Args: path (str): the path to the bundle Returns: omni.graph.core.IBundle2: The bundle object at the path, None if there isn't one Get a bundle object that is an input attribute. Args: node (omni.graph.core.Node): the node on which the bundle can be found attribute_name (str): the name of the input attribute instance (int): an instance index when getting value on an instantiated graph Returns: omni.graph.core.IConstBundle2: The bundle object at the path, None if there isn't one """ @typing.overload def get_input_bundle(self, node: Node, attribute_name: str, instance: int = 18446744073709551614) -> IConstBundle2: ... def get_input_target_bundles(self, node: Node, attribute_name: str, instance: int = 18446744073709551614) -> typing.List[IConstBundle2]: """ Get all input targets in the relationship with the given name on the specified compute node. The targets are returned as bundle objects. Args: node (omni.graph.core.Node): the node on which the input targets can be found attribute_name (str): the name of the relationship attribute instance (int): an instance index when getting value on an instantiated graph Returns: list[omni.graph.core.IConstBundle2]: The list of input targets, as bundle objects. """ def get_is_playing(self) -> bool: """ Returns the state of global playback Returns: bool: True if playback has started, False is playback is stopped """ @typing.overload def get_output_bundle(self, path: str) -> IBundle2: """ Get a bundle object that is an output attribute. Args: path (str): the path to the bundle Returns: omni.graph.core.IBundle2: The bundle object at the path, None if there isn't one Get a bundle object that is an output attribute. Args: node (omni.graph.core.Node): the node on which the bundle can be found attribute_name (str): the name of the output attribute instance (int): an instance index when getting value on an instantiated graph Returns: omni.graph.core.IBundle2: The bundle object at the path, None if there isn't one """ @typing.overload def get_output_bundle(self, node: Node, attribute_name: str, instance: int = 18446744073709551614) -> IBundle2: ... def get_time(self) -> float: """ Returns the global playback time Returns: float: the global playback time in seconds """ def get_time_since_start(self) -> float: """ Returns the elapsed time since the app started Returns: float: the number of seconds since the app started in seconds """ def inspect(self, inspector: omni.inspect._omni_inspect.IInspector) -> bool: """ Runs the inspector on the graph context Args: inspector (omni.inspect.Inspector): The inspector to run Returns: bool: True if the inspector was successfully run on the context, False if it is not supported """ def is_valid(self) -> bool: """ Checks to see if this graph context object is valid Returns: bool: True if this object is valid """ def set_bool_attribute(self, arg0: bool, arg1: Attribute) -> None: """ set_bool_attribute is deprecated. Use og.Controller.set() instead. """ def set_boolarray_attribute(self, arg0: typing.List[bool], arg1: Attribute) -> None: """ set_boolarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_double_attribute(self, arg0: float, arg1: Attribute) -> None: """ set_double_attribute is deprecated. Use og.Controller.set() instead. """ def set_double_matrix_attribute(self, arg0: typing.List[float], arg1: Attribute) -> None: """ set_double_matrix_attribute is deprecated. Use og.Controller.set() instead. """ def set_doublearray_attribute(self, arg0: typing.List[float], arg1: Attribute) -> None: """ set_doublearray_attribute is deprecated. Use og.Controller.set() instead. """ def set_float_attribute(self, arg0: float, arg1: Attribute) -> None: """ set_float_attribute is deprecated. Use og.Controller.set() instead. """ def set_floatarray_attribute(self, arg0: typing.List[float], arg1: Attribute) -> None: """ set_floatarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_half_attribute(self, arg0: float, arg1: Attribute) -> None: """ set_half_attribute is deprecated. Use og.Controller.set() instead. """ def set_halfarray_attribute(self, arg0: typing.List[float], arg1: Attribute) -> None: """ set_halfarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_int64_attribute(self, arg0: int, arg1: Attribute) -> None: """ set_int64_attribute is deprecated. Use og.Controller.set() instead. """ def set_int64array_attribute(self, arg0: typing.List[int], arg1: Attribute) -> None: """ set_int64array_attribute is deprecated. Use og.Controller.set() instead. """ def set_int_attribute(self, arg0: int, arg1: Attribute) -> None: """ set_int_attribute is deprecated. Use og.Controller.set() instead. """ def set_intarray_attribute(self, arg0: typing.List[int], arg1: Attribute) -> None: """ set_intarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_nested_doublearray_attribute(self, arg0: typing.List[typing.List[float]], arg1: Attribute) -> None: """ set_nested_doublearray_attribute is deprecated. Use og.Controller.set() instead. """ def set_nested_floatarray_attribute(self, arg0: typing.List[typing.List[float]], arg1: Attribute) -> None: """ set_nested_floatarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_nested_halfarray_attribute(self, arg0: typing.List[typing.List[float]], arg1: Attribute) -> None: """ set_nested_halfarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_nested_intarray_attribute(self, arg0: typing.List[typing.List[int]], arg1: Attribute) -> None: """ set_nested_intarray_attribute is deprecated. Use og.Controller.set() instead. """ def set_string_attribute(self, arg0: str, arg1: Attribute) -> None: """ set_string_attribute is deprecated. Use og.Controller.set() instead. """ def set_uchar_attribute(self, arg0: int, arg1: Attribute) -> None: """ set_uchar_attribute is deprecated. Use og.Controller.set() instead. """ def set_uchararray_attribute(self, arg0: typing.List[int], arg1: Attribute) -> None: """ set_uchararray_attribute is deprecated. Use og.Controller.set() instead. """ def set_uint64_attribute(self, arg0: int, arg1: Attribute) -> None: """ set_uint64_attribute is deprecated. Use og.Controller.set() instead. """ def set_uint64array_attribute(self, arg0: typing.List[int], arg1: Attribute) -> None: """ set_uint64array_attribute is deprecated. Use og.Controller.set() instead. """ def set_uint_attribute(self, arg0: int, arg1: Attribute) -> None: """ set_uint_attribute is deprecated. Use og.Controller.set() instead. """ def set_uintarray_attribute(self, arg0: typing.List[int], arg1: Attribute) -> None: """ set_uintarray_attribute is deprecated. Use og.Controller.set() instead. """ @staticmethod def write_bucket_to_backing(*args, **kwargs) -> typing.Any: """ Forces the given bucket to be written to the backing storage. Raises ValueError if the bucket could not be found. Args: bucket_id (int): The bucket id of the bucket to be written """ pass class GraphEvaluationMode(): """ How the graph evaluation is scheduled Members: GRAPH_EVALUATION_MODE_AUTOMATIC : Evaluation is scheduled based on graph type GRAPH_EVALUATION_MODE_STANDALONE : Evaluation is scheduled as a single graph GRAPH_EVALUATION_MODE_INSTANCED : Evaluation is scheduled by instances """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ GRAPH_EVALUATION_MODE_AUTOMATIC: omni.graph.core._omni_graph_core.GraphEvaluationMode # value = <GraphEvaluationMode.GRAPH_EVALUATION_MODE_AUTOMATIC: 0> GRAPH_EVALUATION_MODE_INSTANCED: omni.graph.core._omni_graph_core.GraphEvaluationMode # value = <GraphEvaluationMode.GRAPH_EVALUATION_MODE_INSTANCED: 2> GRAPH_EVALUATION_MODE_STANDALONE: omni.graph.core._omni_graph_core.GraphEvaluationMode # value = <GraphEvaluationMode.GRAPH_EVALUATION_MODE_STANDALONE: 1> __members__: dict # value = {'GRAPH_EVALUATION_MODE_AUTOMATIC': <GraphEvaluationMode.GRAPH_EVALUATION_MODE_AUTOMATIC: 0>, 'GRAPH_EVALUATION_MODE_STANDALONE': <GraphEvaluationMode.GRAPH_EVALUATION_MODE_STANDALONE: 1>, 'GRAPH_EVALUATION_MODE_INSTANCED': <GraphEvaluationMode.GRAPH_EVALUATION_MODE_INSTANCED: 2>} pass class GraphEvent(): """ Graph modification event. Members: CREATE_VARIABLE : Variable was created REMOVE_VARIABLE : Variable was removed VARIABLE_TYPE_CHANGE : Variable type was changed """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ CREATE_VARIABLE: omni.graph.core._omni_graph_core.GraphEvent # value = <GraphEvent.CREATE_VARIABLE: 0> REMOVE_VARIABLE: omni.graph.core._omni_graph_core.GraphEvent # value = <GraphEvent.REMOVE_VARIABLE: 1> VARIABLE_TYPE_CHANGE: omni.graph.core._omni_graph_core.GraphEvent # value = <GraphEvent.VARIABLE_TYPE_CHANGE: 5> __members__: dict # value = {'CREATE_VARIABLE': <GraphEvent.CREATE_VARIABLE: 0>, 'REMOVE_VARIABLE': <GraphEvent.REMOVE_VARIABLE: 1>, 'VARIABLE_TYPE_CHANGE': <GraphEvent.VARIABLE_TYPE_CHANGE: 5>} pass class GraphPipelineStage(): """ Pipeline stage in which the graph lives Members: GRAPH_PIPELINE_STAGE_SIMULATION : The regular evaluation stage GRAPH_PIPELINE_STAGE_PRERENDER : The stage that evaluates just before rendering GRAPH_PIPELINE_STAGE_POSTRENDER : The stage that evaluates just after rendering GRAPH_PIPELINE_STAGE_ONDEMAND : The stage evaluating only when requested GRAPH_PIPELINE_STAGE_UNKNOWN : The stage is not currently known """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ GRAPH_PIPELINE_STAGE_ONDEMAND: omni.graph.core._omni_graph_core.GraphPipelineStage # value = <GraphPipelineStage.GRAPH_PIPELINE_STAGE_ONDEMAND: 200> GRAPH_PIPELINE_STAGE_POSTRENDER: omni.graph.core._omni_graph_core.GraphPipelineStage # value = <GraphPipelineStage.GRAPH_PIPELINE_STAGE_POSTRENDER: 30> GRAPH_PIPELINE_STAGE_PRERENDER: omni.graph.core._omni_graph_core.GraphPipelineStage # value = <GraphPipelineStage.GRAPH_PIPELINE_STAGE_PRERENDER: 20> GRAPH_PIPELINE_STAGE_SIMULATION: omni.graph.core._omni_graph_core.GraphPipelineStage # value = <GraphPipelineStage.GRAPH_PIPELINE_STAGE_SIMULATION: 10> GRAPH_PIPELINE_STAGE_UNKNOWN: omni.graph.core._omni_graph_core.GraphPipelineStage # value = <GraphPipelineStage.GRAPH_PIPELINE_STAGE_UNKNOWN: 100> __members__: dict # value = {'GRAPH_PIPELINE_STAGE_SIMULATION': <GraphPipelineStage.GRAPH_PIPELINE_STAGE_SIMULATION: 10>, 'GRAPH_PIPELINE_STAGE_PRERENDER': <GraphPipelineStage.GRAPH_PIPELINE_STAGE_PRERENDER: 20>, 'GRAPH_PIPELINE_STAGE_POSTRENDER': <GraphPipelineStage.GRAPH_PIPELINE_STAGE_POSTRENDER: 30>, 'GRAPH_PIPELINE_STAGE_ONDEMAND': <GraphPipelineStage.GRAPH_PIPELINE_STAGE_ONDEMAND: 200>, 'GRAPH_PIPELINE_STAGE_UNKNOWN': <GraphPipelineStage.GRAPH_PIPELINE_STAGE_UNKNOWN: 100>} pass class GraphRegistry(): """ Manager of the node types registered to OmniGraph. """ def __init__(self) -> None: ... def get_event_stream(self) -> carb.events._events.IEventStream: """ Get the event stream for the graph registry change notification. The events that are raised are specified by GraphRegistryEvent. The payload for the added and removed events is the name of the node type being added or removed, and uses the key "node_type". Returns: carb.events.IEventStream: Event stream to monitor for graph registry changes """ def get_node_type_version(self, node_type_name: str) -> int: """ Finds the version number of the given node type. Args: node_type_name (str): Name of the node type to check Returns: int: Version number registered for the node type, None if it is not registered """ def inspect(self, inspector: omni.inspect._omni_inspect.IInspector) -> bool: """ Runs the inspector on the graph registry Args: inspector (omni.inspect.Inspector): The inspector to run Returns: bool: True if the inspector was successfully run on the graph registry, False if it is not supported """ pass class GraphRegistryEvent(): """ Graph Registry modification event. Members: NODE_TYPE_ADDED : Node type was registered NODE_TYPE_REMOVED : Node type was deregistered NODE_TYPE_NAMESPACE_CHANGED : Namespace of a node type changed NODE_TYPE_CATEGORY_CHANGED : Category of a node type changed """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ NODE_TYPE_ADDED: omni.graph.core._omni_graph_core.GraphRegistryEvent # value = <GraphRegistryEvent.NODE_TYPE_ADDED: 0> NODE_TYPE_CATEGORY_CHANGED: omni.graph.core._omni_graph_core.GraphRegistryEvent # value = <GraphRegistryEvent.NODE_TYPE_CATEGORY_CHANGED: 3> NODE_TYPE_NAMESPACE_CHANGED: omni.graph.core._omni_graph_core.GraphRegistryEvent # value = <GraphRegistryEvent.NODE_TYPE_NAMESPACE_CHANGED: 2> NODE_TYPE_REMOVED: omni.graph.core._omni_graph_core.GraphRegistryEvent # value = <GraphRegistryEvent.NODE_TYPE_REMOVED: 1> __members__: dict # value = {'NODE_TYPE_ADDED': <GraphRegistryEvent.NODE_TYPE_ADDED: 0>, 'NODE_TYPE_REMOVED': <GraphRegistryEvent.NODE_TYPE_REMOVED: 1>, 'NODE_TYPE_NAMESPACE_CHANGED': <GraphRegistryEvent.NODE_TYPE_NAMESPACE_CHANGED: 2>, 'NODE_TYPE_CATEGORY_CHANGED': <GraphRegistryEvent.NODE_TYPE_CATEGORY_CHANGED: 3>} pass class IBundle2(_IBundle2, IConstBundle2, _IConstBundle2, omni.core._core.IObject): """ Provide read write access to recursive bundles. """ def __bool__(self) -> bool: ... @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod def add_attribute(*args, **kwargs) -> typing.Any: """ DEPRECATED - use create_attribute() instead. """ @staticmethod def add_attributes(*args, **kwargs) -> typing.Any: """ DEPRECATED - use create_attributes() instead. """ def clear(self) -> None: """ DEPRECATED - use clear_contents() instead """ def clear_contents(self, bundle_metadata: bool = True, attributes: bool = True, child_bundles: bool = True) -> int: """ Removes all attributes and child bundles from this bundle, but keeps the bundle itself. Args: bundle_metadata (bool): Clears bundle metadata in this bundle. attributes (bool): Clears attributes in this bundle. child_bundles (bool): Clears child bundles in this bundle. Returns: omni.core.Result: Success if successfully cleared. """ @staticmethod def copy_attribute(*args, **kwargs) -> typing.Any: """ Create new attribute by copying existing one, including its data. Created attribute is owned by this bundle. Args: attribute (omni.graph.core.AttributeData): Attribute whose data type is to be copied. overwrite (bool): Overwrite existing attribute in this bundle. Returns: omni.graph.core.AttributeData: Copied attribute. Create new attribute by copying existing one, including its data. Created attribute is owned by this bundle. Args: name (str): The new name for copied attribute. attribute (omni.graph.core.AttributeData): Attribute whose data type is to be copied. overwrite (bool): Overwrite existing attribute in this bundle. Returns: omni.graph.core.AttributeData: Copied attribute. """ @staticmethod def copy_attributes(*args, **kwargs) -> typing.Any: """ Create new attributes by copying existing ones, including their data. Names of new attributes are taken from source attributes. Created attributes are owned by this bundle. Args: attributes (list[omni.graph.core.AttributeData]): Attributes whose data type is to be copied. overwrite (bool): Overwrite existing attributes in this bundle. Returns: list[omni.graph.core.AttributeData]: A list of copied attributes.\ Create new attributes by copying existing ones, including their data, with possibility of giving them new names. Created attributes are owned by this bundle. Args: names (list[str]): Names for the new attributes. attributes (list[omni.graph.core.AttributeData]): Attributes whose data type is to be copied. overwrite (bool): Overwrite existing attributes in this bundle. Returns: list[omni.graph.core.AttributeData]: A list of copied attributes. """ def copy_bundle(self, source_bundle: IConstBundle2, overwrite: bool = True) -> None: """ Copy bundle data and metadata from the source bundle to this bundle. Args: source_bundle (omni.graph.core.IConstBundle2): Bundle whose data is to be copied. overwrite (bool): Overwrite existing content of the bundle. """ @typing.overload def copy_child_bundle(self, bundle: IConstBundle2, name: typing.Optional[str] = None) -> IBundle2: """ Create new child bundle by copying existing one, with possibility of giving child a new name. Created bundle is owned by this bundle. Args: bundle (omni.graph.core.IConstBundle2): Bundle whose data is to be copied. name (str): Name of new child. Returns: omni.graph.core.IBundle2: Newly copied bundle. Create new child bundle by copying existing one, with possibility of giving child a new name. Created bundle is owned by this bundle. Args: name (str): Name of new child. bundle (omni.graph.core.IConstBundle2): Bundle whose data is to be copied. Returns: omni.graph.core.IBundle2: Newly copied bundle. """ @typing.overload def copy_child_bundle(self, name: str, bundle: IConstBundle2) -> IBundle2: ... @typing.overload def copy_child_bundles(self, bundles: typing.List[IConstBundle2], names: typing.Optional[typing.List[str]] = None) -> typing.List[IBundle2]: """ Create new child bundles by copying existing ones, with possibility of giving children new names. Created bundles are owned by this bundle. Args: bundles (list[omni.graph.core.IConstBundle2]): Bundles whose data is to be copied. names (list[str]): Names of new children. Returns: list[omni.graph.core.IBundle2]: Newly copied bundles. Create new child bundles by copying existing ones, with possibility of giving children new names. Created bundles are owned by this bundle. Args: names (list[str]): Names of new children. bundles (list[omni.graph.core.IConstBundle2]): Bundles whose data is to be copied. Returns: list[omni.graph.core.IBundle2]: Newly copied bundles. """ @typing.overload def copy_child_bundles(self, names: typing.List[str], bundles: typing.List[IConstBundle2]) -> typing.List[IBundle2]: ... @staticmethod def create_attribute(*args, **kwargs) -> typing.Any: """ Creates attribute based on provided name and type. Created attribute is owned by this bundle. Args: name (str): Name of the attribute. type (omni.graph.core.Type): Type of the attribute. element_count (int): Number of elements in the array. Returns: omni.graph.core.AttributeData: Newly created attribute. """ @staticmethod def create_attribute_like(*args, **kwargs) -> typing.Any: """ Use input attribute as pattern to create attribute in this bundle. The name and type are taken from pattern attribute, data is not copied. Created attribute is owned by this bundle. Args: pattern_attribute (omni.graph.core.AttributeData): Attribute whose name and type is to be used to create new attribute. Returns: omni.graph.core.AttributeData: Newly created attribute. """ @staticmethod def create_attribute_metadata(*args, **kwargs) -> typing.Any: """ Create attribute metadata fields. Args: attribute (str): Name of the attribute. field_names (list[str]): Names of new metadata field. field_types (list[omni.graph.core.Type]): Types of new metadata field. element_count (int): Number of elements in the arrray. Returns: list[omni.graph.core.AttributeData]: Newly created metadata fields. Create attribute metadata field. Args: attribute (str): Name of the attribute. field_name (str): Name of new metadata field. field_type (omni.graph.core.Type): Type of new metadata field. Returns: omni.graph.core.AttributeData: Newly created metadata field. """ @staticmethod def create_attributes(*args, **kwargs) -> typing.Any: """ Creates attributes based on provided names and types. Created attributes are owned by this bundle. Args: names (list[str]): Names of the attributes. types (list[omni.graph.core.Type]): Types of the attributes. Returns: list[omni.graph.core.AttributeData]: A list of created attributes. """ @staticmethod def create_attributes_like(*args, **kwargs) -> typing.Any: """ Use input attributes as pattern to create attributes in this bundle. Names and types for new attributes are taken from pattern attributes, data is not copied. Created attributes are owned by this bundle. Args: pattern_attributes (list[omni.graph.core.AttributeData]): Attributes whose name and type is to be used to create new attributes. Returns: list[omni.graph.core.AttributeData]: A list of newly created attributes. """ @staticmethod def create_bundle_metadata(*args, **kwargs) -> typing.Any: """ Creates bundle metadata fields based on provided names and types. Created fields are owned by this bundle. Args: field_names (list[str]): Names of the fields. field_types (list[omni.graph.core.Type]): Types of the fields. element_count (int): Number of elements in the arrray. Returns: list[omni.graph.core.AttributeData]: A list of created fields. Creates bundle metadata field based on provided name and type. Created field are owned by this bundle. Args: field_name (str): Name of the field. field_type (omni.graph.core.Type): Type of the field. Returns: omni.graph.core.AttributeData: Created field. """ def create_child_bundle(self, path: str) -> IBundle2: """ Creates immediate child bundle under specified path in this bundle. Created bundle is owned by this bundle. This method does not work recursively. Only immediate child can be created. Args: path (str): New child path in this bundle. Returns: omni.graph.core.IBundle2: Created child bundle. """ def create_child_bundles(self, paths: typing.List[str]) -> typing.List[IBundle2]: """ Creates immediate child bundles under specified paths in this bundle. Created bundles are owned by this bundle. This method does not work recursively. Only immediate children can be created. Args: paths (list[str]): New children paths in this bundle. Returns: list[omni.graph.core.IBundle2]: A list of created child bundles. """ @staticmethod def get_attribute_by_name(*args, **kwargs) -> typing.Any: """ DEPRECATED - use get_attribute_by_name(name) instead Searches for attribute in this bundle by using attribute name. Args: name (str): Attribute name to search for. Returns: omni.graph.core.AttributeData: An attribute. If attribute is not found then invalid attribute is returned. """ def get_attribute_data(self, write: bool = False) -> list: """ DEPRECATED - use get_attributes() instead """ def get_attribute_data_count(self) -> int: """ DEPRECATED - use get_attribute_count() instead """ @staticmethod def get_attribute_metadata_by_name(*args, **kwargs) -> typing.Any: """ Search for metadata fields for the attribute by using field names. Args: attribute (str): Name of the attribute. field_names (list[str]): Attribute metadata fields to be searched for. Returns: list[omni.graph.core.AttributeData]: Array of metadata fields in the attribute. Search for metadata field for the attribute by using field name. Args: attribute (str): Name of the attribute. field_name (str): Attribute metadata field to be searched for. Returns: omni.graph.core.AttributeData: Metadata fields in the attribute. """ def get_attribute_names_and_types(self) -> tuple: """ DEPRECATED - use get_attribute_names() or get_attribute_types() instead """ @staticmethod def get_attributes(*args, **kwargs) -> typing.Any: """ Searches for attributes in this bundle by using attribute names. Args: names (list[str]): Attribute names to search for. Returns: list[omni.graph.core.AttributeData]: A list of found attributes. """ @staticmethod def get_attributes_by_name(*args, **kwargs) -> typing.Any: """ Searches for attributes in this bundle by using attribute names. Args: names (list[str]): Attribute names to search for. Returns: list[omni.graph.core.AttributeData]: A list of found attributes. """ @staticmethod def get_bundle_metadata_by_name(*args, **kwargs) -> typing.Any: """ Search for field handles in this bundle by using field names. Args: field_names (list[str]): Bundle metadata fields to be searched for. Returns: list[omni.graph.core.AttributeData]: Metadata fields in this bundle. Search for field handle in this bundle by using field name. Args: field_name (str): Bundle metadata fields to be searched for. Returns: omni.graph.core.AttributeData: Metadata field in this bundle. """ def get_child_bundle(self, index: int) -> IBundle2: """ Get the child bundle by index. Args: index (int): Child bundle index in range [0, child_bundle_count). Returns: omni.graph.core.IBundle2: Child bundle under the index. If bundle index is out of range, then invalid bundle is returned. """ def get_child_bundle_by_name(self, name: str) -> IBundle2: """ Lookup for child under specified name. Args: path (str): Name to child bundle in this bundle. Returns: omni.graph.core.IBundle2: Child bundle in this bundle. If child does not exist under the path, then invalid bundle is returned. """ def get_child_bundles(self) -> typing.List[IBundle2]: """ Get all child bundle handles in this bundle. Returns: list[omni.graph.core.IBundle2]: A list of all child bundles in this bundle. """ def get_child_bundles_by_name(self, names: typing.List[str]) -> typing.List[IBundle2]: """ Lookup for children under specified names. Args: names (list[str]): Names of child bundles in this bundle. Returns: list[omni.graph.core.IBundle2]: A list of found child bundles in this bundle. """ def get_metadata_storage(self) -> IBundle2: """ DEPRECATED - DO NOT USE """ def get_parent_bundle(self) -> IBundle2: """ Get the parent of this bundle Returns: omni.graph.core.IBundle2: The parent of this bundle, or invalid bundle if there is no parent. """ def get_prim_path(self) -> str: """ DEPRECATED - use get_path() instead """ @staticmethod def insert_attribute(*args, **kwargs) -> typing.Any: """ DEPRECATED - use copy_attribute() instead """ def insert_bundle(self, bundle_to_copy: IConstBundle2) -> None: """ DEPRECATED - use copy_bundle() instead. """ def is_read_only(self) -> bool: """ Returns if this interface is read-only. """ def is_valid(self) -> bool: """ DEPRECATED - use bool cast instead """ @staticmethod def link_attribute(*args, **kwargs) -> typing.Any: """ Adds an attribute to this bundle as link with names taken from target attribute. Added attribute is a link to other attribute that is part of another bundle. The link is owned by this bundle, but target of the link is not. Removing link from this bundle does not destroy the data link points to. Args: target_attribute (omni.graph.core.AttributeData): Attribute whose data is to be added. Returns: omni.graph.core.AttributeData: Attribute that is a link. Adds an attribute to this bundle as link with custom name. Added attribute is a link to other attribute that is part of another bundle. The link is owned by this bundle, but target of the link is not. Removing link from this bundle does not destroy the data link points to. Args: link_name (str): Name for new link. target_attribute (omni.graph.core.AttributeData): Attribute whose data is to be added. Returns: omni.graph.core.AttributeData: Attribute that is a link. """ @staticmethod def link_attributes(*args, **kwargs) -> typing.Any: """ Adds a set of attributes to this bundle as links with names taken from target attributes. Added attributes are links to other attributes that are part of another bundle. The links are owned by this bundle, but targets of the links are not. Removing links from this bundle does not destroy the data links point to. Args: target_attributes (list[omni.graph.core.AttributeData]): Attributes whose data is to be added. Returns: list[omni.graph.core.AttributeData]: A list of attributes that are links. Adds a set of attributes to this bundle as links with custom names. Added attributes are links to other attributes that are part of another bundle. The links are owned by this bundle, but targets of the links are not. Removing links from this bundle does not destroy the data links point to. Args: link_names (list[str]): target_attributes (list[omni.graph.core.AttributeData]): Attributes whose data is to be added. Returns: list[omni.graph.core.AttributeData]: A list of attributes that are links. """ @typing.overload def link_child_bundle(self, name: str, bundle: IConstBundle2) -> IBundle2: """ Link a bundle as child in current bundle, under given name. Args: name (str): The name under which the child bundle should be linked bundle (omni.graph.core.IConstBundle2): The bundle to link Returns: omni.graph.core.IBundle2: The linked bundle. Link a bundle as child in current bundle. Args: bundle (omni.graph.core.IConstBundle2): The bundle to link Returns: omni.graph.core.IBundle2: The linked bundle. """ @typing.overload def link_child_bundle(self, bundle: IConstBundle2) -> IBundle2: ... @typing.overload def link_child_bundles(self, names: typing.List[str], bundles: typing.List[IConstBundle2]) -> typing.List[IBundle2]: """ Link a set of bundles as child in current bundle, under given names. Args: names (list[str]): The names under which the child bundles should be linked bundles (list[omni.graph.core.IConstBundle2]): The bundles to link Returns: list[omni.graph.core.IBundle2]: The list of created bundles. Link a set of bundles as child in current bundle. Args: bundles (list[omni.graph.core.IConstBundle2]): The bundles to link Returns: list[omni.graph.core.IBundle2]: The list of created bundles. """ @typing.overload def link_child_bundles(self, bundles: typing.List[IConstBundle2]) -> typing.List[IBundle2]: ... def remove_all_attributes(self) -> int: """ Remove all attributes from this bundle. Returns: int: Number of attributes successfully removed. """ def remove_all_child_bundles(self) -> int: """ Remove all child bundles from this bundle. Only empty bundles can be removed. Returns: int: Number of child bundles successfully removed. """ @typing.overload def remove_attribute(self, name: str) -> None: """ DEPRECATED - use remove_attribute_by_name() instead. Looks up the attribute and if it is part of this bundle then remove it. Attribute handle that is not part of this bundle is ignored. Args: attribute (omni.graph.core.AttributeData): Attribute whose data is to be removed. Returns: omni.core.Result: Success if successfully removed. """ @staticmethod @typing.overload def remove_attribute(*args, **kwargs) -> typing.Any: ... @typing.overload def remove_attribute_metadata(self, attribute: str, field_names: typing.List[str]) -> int: """ Remove attribute metadata fields. Args: attribute (str): Name of the attribute. field_names (list[str]): Names of the fields to be removed. Returns: int: Number of fields successfully removed. Remove attribute metadata field. Args: attribute (str): Name of the attribute. field_name (str): Name of the field to be removed. Returns: omni.core.Result: Success if successfully removed. """ @typing.overload def remove_attribute_metadata(self, attribute: str, field_name: str) -> int: ... @typing.overload def remove_attributes(self, names: typing.List[str]) -> None: """ DEPRECATED - use remove_attributes_by_name() instead. Looks up the attributes and if they are part of this bundle then remove them. Attribute handles that are not part of this bundle are ignored. Args: attributes (list[omni.graph.core.AttributeData]): Attributes whose data is to be removed. Returns: int: number of removed attributes """ @staticmethod @typing.overload def remove_attributes(*args, **kwargs) -> typing.Any: ... def remove_attributes_by_name(self, names: typing.List[str]) -> int: """ Looks up the attributes by names and remove their data and metadata. Args: names (list[str]): Names of the attributes whose data is to be removed. Returns: omni.core.Result: Success if successfully removed. """ @typing.overload def remove_bundle_metadata(self, field_names: typing.List[str]) -> int: """ Looks up bundle metadata fields and if they are part of this bundle metadata then remove them. Fields that are not part of this bundle are ignored. Args: field_names (list[str]): Names of the fields whose data is to be removed. Returns: int: Number of fields successfully removed. Looks up bundle metadata field and if it is part of this bundle metadata then remove it. Field that is not part of this bundle is ignored. Args: field_name (str): Name of the field whose data is to be removed. Returns: omni.core.Result: Success if successfully removed. """ @typing.overload def remove_bundle_metadata(self, field_name: str) -> int: ... def remove_child_bundle(self, bundle: IConstBundle2) -> int: """ Looks up the bundle and if it is child of the bundle then remove it. Bundle handle that is not child of this bundle is ignored. Only empty bundle can be removed. Args: bundle (omni.graph.core.IConstBundle2): bundle to be removed. Returns: omni.core.Result: Success if successfully removed. """ def remove_child_bundles(self, bundles: typing.List[IConstBundle2]) -> int: """ Looks up the bundles and if they are children of the bundle then remove them. Bundle handles that are not children of this bundle are ignored. Only empty bundles can be removed. Args: bundles (list[omni.graph.core.IConstBundle2]): Bundles to be removed. Returns: int: Number of child bundles successfully removed. """ def remove_child_bundles_by_name(self, names: typing.List[str]) -> int: """ Looks up child bundles by name and remove their data and metadata. Args: names (list[str]): Names of the child bundles to be removed. Returns: omni.core.Result: Success if successfully removed. """ pass class IBundleChanges(_IBundleChanges, omni.core._core.IObject): """ Interface for monitoring and handling changes in bundles and attributes. The IBundleChanges_abi is an interface that provides methods for checking whether bundles and attributes have been modified, and cleaning them if they have been modified. This is particularly useful in scenarios where it's crucial to track changes and maintain the state of bundles and attributes. This interface provides several methods for checking and cleaning modifications, each catering to different use cases such as handling single bundles, multiple bundles, attributes, or specific attributes of a single bundle. The methods of this interface return a BundleChangeType enumeration that indicates whether the checked entity (bundle or attribute) has been modified. """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod @typing.overload def activate_change_tracking(*args, **kwargs) -> typing.Any: """ @brief Activate tracking for specific bundle on its attributes and children. @param handle to the specific bundles to enable change tracking. @return An omni::core::Result indicating the success of the operation. Activates the change tracking system for a bundle. This method controls the change tracking system of a bundle. It's only applicable for read-write bundles. Args: bundle: A bundle to activate change tracking system for. """ @typing.overload def activate_change_tracking(self, bundle: IBundle2) -> None: ... def clear_changes(self) -> int: """ Clears all recorded changes. This method is used to clear or reset all the recorded changes of the bundles and attributes. It can be used when the changes have been processed and need to be discarded. An omni::core::Result indicating the success of the operation. """ @staticmethod def create(*args, **kwargs) -> typing.Any: ... @staticmethod @typing.overload def deactivate_change_tracking(*args, **kwargs) -> typing.Any: """ @brief Deactivate tracking for specific bundle on its attributes and children. @param handle to the specific bundles to enable change tracking. @return An omni::core::Result indicating the success of the operation. Deactivates the change tracking system for a bundle. This method controls the change tracking system of a bundle. It's only applicable for read-write bundles. Args: bundle: A bundle to deactivate change tracking system for. """ @typing.overload def deactivate_change_tracking(self, bundle: IBundle2) -> None: ... @typing.overload def get_change(self, bundle: IConstBundle2) -> BundleChangeType: """ Retrieves the change status of a list of bundles. This method is used to check if any of the provided bundles or their contents have been modified. Args: bundles: A list of the bundles to check for modifications. Returns: list[omni.graph.core.BundleChangeType]: A list filled with BundleChangeType values for each bundle. Retrieves the change status of a specific attribute. This method is used to check if a specific attribute has been modified. Args: attribute: The specific attribute to check for modifications. Returns: omni.graph.core.BundleChangeType: A BundleChangeType value indicating the type of change (if any) that has occurred to the attribute. """ @staticmethod @typing.overload def get_change(*args, **kwargs) -> typing.Any: ... @typing.overload def get_changes(self, bundles: typing.List[IConstBundle2]) -> typing.List[BundleChangeType]: """ Retrieves the change status of a list of bundles. This method is used to check if any of the bundles in the provided list or their contents have been modified. Args: bundles: A list of the bundles to check for modifications. Returns: list[omni.graph.core.BundleChangeType]: A list filled with BundleChangeType values for each bundle. Retrieves the change status of a list of attributes. This method is used to check if any of the attributes in the provided list have been modified. Args: attributes: A list of attributes to check for modifications. Returns: list[omni.graph.core.BundleChangeType]: A list filled with BundleChangeType values for each attribute. Retrieves the change status for a list of bundles and attributes. This method is used to check if any of the bundles or attributes in the provided list have been modified. If an entry in the list is neither a bundle nor an attribute, its change status will be marked as None. Args: entries: A list of bundles and attributes to check for modifications. Returns: list[omni.graph.core.BundleChangeType]: A list filled with BundleChangeType values for each entry in the provided list. """ @staticmethod @typing.overload def get_changes(*args, **kwargs) -> typing.Any: ... @typing.overload def get_changes(self, entries: typing.Sequence) -> typing.List[BundleChangeType]: ... pass class IBundleFactory2(_IBundleFactory2, IBundleFactory, _IBundleFactory, omni.core._core.IObject): """ IBundleFactory version 2. The version 2 allows to retrieve instances of IBundle instances from paths. """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod def get_bundle_from_path(*args, **kwargs) -> typing.Any: """ Get read write IBundle interface from path. Args: context (omni.graph.core.GraphContext): The context where bundles belong to. path (str): Location of the bundle. Returns: omni.graph.core.IBundle2: Bundle instance. """ @staticmethod def get_const_bundle_from_path(*args, **kwargs) -> typing.Any: """ Get read only IBundle interface from path. Args: context (omni.graph.core.GraphContext): The context where bundles belong to. path (str): Location of the bundle. Returns: omni.graph.core.IConstBundle2: Bundle instance. """ pass class IBundleFactory(_IBundleFactory, omni.core._core.IObject): """ Interface to create new bundles """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod def create(*args, **kwargs) -> typing.Any: """ Creates an interface object for bundle factories Returns: omni.graph.core.IBundleFactory2: Created instance of bundle factory. """ @staticmethod def create_bundle(*args, **kwargs) -> typing.Any: """ Create bundle at given path. Args: context (omni.graph.core.GraphContext): The context where bundles are created. path (str): Location for new bundle. Returns: omni.graph.core.IBundle2: Bundle instance. """ @staticmethod def create_bundles(*args, **kwargs) -> typing.Any: """ Create bundles at given paths. Args: context (omni.graph.core.GraphContext): The context where bundles are created. paths (list[str]): Locations for new bundles. Returns: list[omni.graph.core.IBundle2]: A list of bundle instances. """ @staticmethod def get_bundle(*args, **kwargs) -> typing.Any: """ DEPRECATED - no conversion is required DEPRECATED - no conversion is required """ @staticmethod def get_bundles(*args, **kwargs) -> typing.Any: """ DEPRECATED - no conversion is required DEPRECATED - no conversion is required """ pass class IConstBundle2(_IConstBundle2, omni.core._core.IObject): """ Provide read only access to recursive bundles. """ def __bool__(self) -> bool: """ Returns: bool: True if this bundle is valid, False otherwise. """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod def add_attribute(*args, **kwargs) -> typing.Any: """ DEPRECATED - use create_attribute() instead. """ @staticmethod def add_attributes(*args, **kwargs) -> typing.Any: """ DEPRECATED - use create_attributes() instead. """ def clear(self) -> None: """ DEPRECATED - use clear_contents() instead """ @staticmethod def get_attribute_by_name(*args, **kwargs) -> typing.Any: """ DEPRECATED - use get_attribute_by_name(name) instead Searches for attribute in this bundle by using attribute name. Args: name (str): Attribute name to search for. Returns: omni.graph.core.AttributeData: An attribute. If attribute is not found then invalid attribute is returned. """ def get_attribute_count(self) -> int: """ Get the number of attributes in this bundle Returns: int: Number of attributes in this bundle. """ def get_attribute_data(self, write: bool = False) -> list: """ DEPRECATED - use get_attributes() instead """ def get_attribute_data_count(self) -> int: """ DEPRECATED - use get_attribute_count() instead """ @staticmethod def get_attribute_metadata_by_name(*args, **kwargs) -> typing.Any: """ Search for metadata fields for the attribute by using field names. Args: attribute (str): Name of the attribute. field_names (list[str]): Attribute metadata fields to be searched for. Returns: list[omni.graph.core.AttributeData]: Array of metadata fields in the attribute. Search for metadata field for the attribute by using field name. Args: attribute (str): Name of the attribute. field_name (str): Attribute metadata field to be searched for. Returns: omni.graph.core.AttributeData: Metadata fields in the attribute. """ def get_attribute_metadata_count(self, attribute: str) -> int: """ Gets the number of metadata fields in an attribute within the bundle Args: attribute (str): Name of the attribute to count metadata for. Returns: int: Number of metadata fields in the attribute. """ def get_attribute_metadata_names(self, attribute: str) -> typing.List[str]: """ Get names of all metadata fields in the attribute. Args: attribute (str): Name of the attribute. Returns: list[str]: Array of names in the attribute. """ @staticmethod def get_attribute_metadata_types(*args, **kwargs) -> typing.Any: """ Get types of all metadata fields in the attribute. Args: attribute (string): Name of the attribute. Returns: list[omni.graph.core.Type]: Array of types in the attribute. """ def get_attribute_names(self) -> typing.List[str]: """ Get the names of all attributes in this bundle. Returns: list[str]: A list of the names. """ def get_attribute_names_and_types(self) -> tuple: """ DEPRECATED - use get_attribute_names() or get_attribute_types() instead """ @staticmethod def get_attribute_types(*args, **kwargs) -> typing.Any: """ Get the types of all attributes in this bundle. Returns: list[omni.graph.core.Type]: A list of the types. """ @staticmethod def get_attributes(*args, **kwargs) -> typing.Any: """ Get all attributes in this bundle. Returns: list[omni.graph.core.AttributeData]: A list of all attributes in this bundle. """ @staticmethod def get_attributes_by_name(*args, **kwargs) -> typing.Any: """ Searches for attributes in this bundle by using attribute names. Args: names (list[str]): Attribute names to search for. Returns: list[omni.graph.core.AttributeData]: A list of found attributes. """ @staticmethod def get_bundle_metadata_by_name(*args, **kwargs) -> typing.Any: """ Search for field handles in this bundle by using field names. Args: field_names (list[str]): Bundle metadata fields to be searched for. Returns: list[omni.graph.core.AttributeData]: Metadata fields in this bundle. Search for field handle in this bundle by using field name. Args: field_name (str): Bundle metadata fields to be searched for. Returns: omni.graph.core.AttributeData: Metadata field in this bundle. """ def get_bundle_metadata_count(self) -> int: """ Get the number of metadata entries Returns: int: Number of metadata fields in this bundle. """ def get_bundle_metadata_names(self) -> typing.List[str]: """ Get the names of all metadata fields in this bundle. Returns: list[str]: Array of names in this bundle. """ @staticmethod def get_bundle_metadata_types(*args, **kwargs) -> typing.Any: """ Get the types of all metadata fields in this bundle. Returns: list[omni.graph.core.Type]: Array of types in this bundle. """ def get_child_bundle(self, index: int) -> IConstBundle2: """ Get the child bundle by index. Args: index (int): Child bundle index in range [0, child_bundle_count). Returns: omni.graph.core.IConstBundle2: Child bundle under the index. If bundle index is out of range, then invalid bundle is returned. """ def get_child_bundle_by_name(self, path: str) -> IConstBundle2: """ Lookup for child under specified path. Args: path (str): Path to child bundle in this bundle. Returns: omni.graph.core.IConstBundle2: Child bundle in this bundle. If child does not exist under the path, then invalid bundle is returned. """ def get_child_bundle_count(self) -> int: """ Get the number of child bundles Returns: int: Number of child bundles in this bundle. """ def get_child_bundles(self) -> typing.List[IConstBundle2]: """ Get all child bundle handles in this bundle. Returns: list[omni.graph.core.IConstBundle2]: A list of all child bundles in this bundle. """ def get_child_bundles_by_name(self, names: typing.List[str]) -> typing.List[IConstBundle2]: """ Lookup for children under specified names. Args: names (list[str]): Names to child bundles in this bundle. Returns: list[omni.graph.core.IConstBundle2]: A list of found child bundles in this bundle. """ @staticmethod def get_context(*args, **kwargs) -> typing.Any: """ Get the context used by this bundle Returns: omni.graph.core.GraphContext: The context of this bundle. """ def get_metadata_storage(self) -> IConstBundle2: """ Get access to metadata storage that contains all metadata information Returns: list[omni.graph.core.IBundle2]: List of bundles with the metadata information """ def get_name(self) -> str: """ Get the name of the bundle Returns: str: The name of this bundle. """ def get_parent_bundle(self) -> IConstBundle2: """ Get the parent bundle Returns: omni.graph.core.IConstBundle2: The parent of this bundle, or invalid bundle if there is no parent. """ def get_path(self) -> str: """ Get the path to this bundle Returns: str: The path to this bundle. """ def get_prim_path(self) -> str: """ DEPRECATED - use get_path() instead """ @staticmethod def insert_attribute(*args, **kwargs) -> typing.Any: """ DEPRECATED - use copy_attribute() instead """ def insert_bundle(self, bundle_to_copy: IConstBundle2) -> None: """ DEPRECATED - use copy_bundle() instead. """ def is_read_only(self) -> bool: """ Returns if this interface is read-only. """ def is_valid(self) -> bool: """ DEPRECATED - use bool cast instead """ def remove_attribute(self, name: str) -> None: """ DEPRECATED - use remove_attribute_by_name() instead. """ def remove_attributes(self, names: typing.List[str]) -> None: """ DEPRECATED - use remove_attributes_by_name() instead. """ @property def valid(self) -> bool: """ :type: bool """ pass class INodeCategories(_INodeCategories, omni.core._core.IObject): """ Interface to the list of categories that a node type can belong to """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... def define_category(self, category_name: str, category_description: str) -> bool: """ Define a new category @param[in] categoryName Name of the new category @param[in] categoryDescription Description of the category @return false if there was already a category with the given name """ @staticmethod def get_all_categories() -> object: """ Get the list of available categories and their descriptions. Returns: dict[str,str]: Dictionary with categories as a name:description dictionary if it succeeded, else None """ @staticmethod def get_node_categories(node_id: object) -> object: """ Return the list of categories that have been applied to the node. Args: node_id (str | Node): The node, or path to the node, whose categories are to be found Returns: list[str]: A list of category names applied to the node if it succeeded, else None """ @staticmethod def get_node_type_categories(node_type_id: object) -> object: """ Return the list of categories that have been applied to the node type. Args: node_type_id (str | NodeType): The node type, or name of the node type, whose categories are to be found Returns: list[str]: A list of category names applied to the node type if it succeeded, else None """ def remove_category(self, category_name: str) -> bool: """ Remove an existing category, mainly to manage the ones created by a node type for itself @param[in] categoryName Name of the category to remove @return false if there was no category with the given name """ @property def category_count(self) -> int: """ :type: int """ pass class ISchedulingHints2(_ISchedulingHints2, ISchedulingHints, _ISchedulingHints, omni.core._core.IObject): """ Interface extension for ISchedulingHints that adds a new "pure" hint """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @typing.overload def __init__(self, arg0: ISchedulingHints) -> None: ... @property def purity_status(self) -> ePurityStatus: """ :type: ePurityStatus """ @purity_status.setter def purity_status(self, arg1: ePurityStatus) -> None: pass pass class ISchedulingHints(_ISchedulingHints, omni.core._core.IObject): """ Interface to the list of scheduling hints that can be applied to a node type """ @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... def get_data_access(self, data_type: eAccessLocation) -> eAccessType: """ Get the type of access the node has for a given data type @param[in] dataType Type of data for which access type is being modified @returns Value of the access type flag """ def inspect(self, inspector: omni.inspect._omni_inspect.IInspector) -> bool: """ Runs the inspector on the scheduling hints. @param[in] inspector The inspector class @return true if the inspection ran successfully, false if the inspection type is not supported """ def set_data_access(self, data_type: eAccessLocation, new_access_type: eAccessType) -> None: """ Set the flag describing how a node accesses particular data in its compute _abi (defaults to no access). Setting any of these flags will, in most cases, automatically mark the node as "not threadsafe". One current exception to this is allowing a node to be both threadsafe and a writer to USD, since such behavior can be achieved if delayed writebacks (e.g. "registerForUSDWriteBack") are utilized in the node's compute method. @param[in] dataType Type of data for which access type is being modified @param[in] newAccessType New value of the access type flag """ @property def compute_rule(self) -> eComputeRule: """ :type: eComputeRule """ @compute_rule.setter def compute_rule(self, arg1: eComputeRule) -> None: pass @property def thread_safety(self) -> eThreadSafety: """ :type: eThreadSafety """ @thread_safety.setter def thread_safety(self, arg1: eThreadSafety) -> None: pass pass class IVariable(_IVariable, omni.core._core.IObject): """ Object that contains a value that is local to a graph, available from anywhere in the graph """ def __bool__(self) -> bool: ... @typing.overload def __init__(self, arg0: omni.core._core.IObject) -> None: ... @typing.overload def __init__(self) -> None: ... @staticmethod def get(*args, **kwargs) -> typing.Any: """ Get the value of a variable Args: graph_context (omni.graph.core.GraphContext): The GraphContext object to get the variable value from. instance_path (str): Optional path to the prim instance to fetch the variable value for. By default this will fetch the variable value from the graph prim. Returns: Any: Value of the variable """ @staticmethod def get_array(*args, **kwargs) -> typing.Any: """ Get the value of an array variable Args: graph_context (omni.graph.core.GraphContext): The GraphContext object to get the variable value from. get_for_write (bool): Should the data be retrieved for writing? reserved_element_count (int): If the data is to be retrieved for writing, preallocate this many elements instance_path (str): Optional path to the prim instance to fetch the variable value for. By default this will fetch the variable value from the graph prim. Returns: Any: Value of the array variable """ @staticmethod def set(*args, **kwargs) -> typing.Any: """ Sets the value of a variable Args: graph_context (omni.graph.core.GraphContext): The GraphContext object to store the variable value. on_gpu (bool): Is the data to be set on the GPU? instance_path (str): Optional path to the prim instance to set the variable value on. By default this will set the variable value on the graph prim. Returns: bool: True if the value was successfully set """ @staticmethod def set_type(*args, **kwargs) -> typing.Any: """ Changes the type of a variable. Changing the type of a variable may remove the variable's default value. Args: variable_type (omni.graph.core.Type): The type to switch the variable to. Returns: bool: True if the type was successfully changed. """ @property def category(self) -> str: """ :type: str """ @category.setter def category(self, arg1: str) -> None: pass @property def display_name(self) -> str: """ :type: str """ @display_name.setter def display_name(self, arg1: str) -> None: pass @property def name(self) -> str: """ :type: str """ @property def scope(self) -> eVariableScope: """ :type: eVariableScope """ @scope.setter def scope(self, arg1: eVariableScope) -> None: pass @property def source_path(self) -> str: """ :type: str """ @property def tooltip(self) -> str: """ :type: str """ @tooltip.setter def tooltip(self, arg1: str) -> None: pass @property def type(self) -> omni::graph::core::Py_Type: """ Gets the data type of the variable. Returns: omni.graph.core.Type: The data type of the variable. :type: omni::graph::core::Py_Type """ @property def valid(self) -> bool: """ :type: bool """ pass class MemoryType(): """ Default memory location for an attribute or node's data Members: CPU : The memory is on the CPU by default CUDA : The memory is on the GPU by default ANY : The memory does not have any default device """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ANY: omni.graph.core._omni_graph_core.MemoryType # value = <MemoryType.ANY: 2> CPU: omni.graph.core._omni_graph_core.MemoryType # value = <MemoryType.CPU: 0> CUDA: omni.graph.core._omni_graph_core.MemoryType # value = <MemoryType.CUDA: 1> __members__: dict # value = {'CPU': <MemoryType.CPU: 0>, 'CUDA': <MemoryType.CUDA: 1>, 'ANY': <MemoryType.ANY: 2>} pass class Node(): """ An element of execution within a graph, containing attributes and connected to other nodes """ def __bool__(self) -> bool: ... def __eq__(self, arg0: Node) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... def _do_not_use(self) -> bool: """ Temporary internal function - do not use """ def clear_old_compute_messages(self) -> int: """ Clears all compute messages logged for the node prior to its most recent evaluation. Messages logged during the most recent evaluation remain untouched. Normally this will be called during graph evaluation so it is of little use unless you're writing your own evaluation manager. Returns: int: The number of messages that were deleted. """ @staticmethod def create_attribute(*args, **kwargs) -> typing.Any: """ Creates an attribute with the specified name, type, and port type and returns success state. Args: attributeName (str): Name of the attribute. attributeType (omni.graph.core.Type): Type of the attribute. portType (omni.graph.core.AttributePortType): The port type of the attribute, defaults to omni.graph.core.AttributePortType.ATTRIBUTE_PORT_TYPE_INPUT value (Any): The initial value to set on the attribute, default is None extendedType (omni.graph.core.ExtendedAttributeType): The extended type of the attribute, defaults to omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_REGULAR unionTypes (str): Comma-separated list of union types if the extended type is omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION, defaults to empty string for non-union types. Returns: bool: True if the creation was successful, else False """ def deregister_on_connected_callback(self, callback: int) -> None: """ De-registers the on_connected callback to be invoked when attributes connect. Args: callback (callable): The handle that was returned during the register_on_connected_callback call """ def deregister_on_disconnected_callback(self, callback: int) -> None: """ De-registers the on_disconnected callback to be invoked when attributes disconnect. Args: callback (callable): The handle that was returned during the register_on_disconnected_callback call """ def deregister_on_path_changed_callback(self, callback: int) -> None: """ Deregisters the on_path_changed callback to be invoked when anything changes in the stage. [DEPRECATED] Args: callback (callable): The handle that was returned during the register_on_path_changed_callback call """ def get_attribute(self, name: str) -> Attribute: """ Given the name of an attribute returns an attribute object to it. Args: name (str): The name of the attribute Returns: omni.graph.core.Attribute: Attribute with the given name, or None if it does not exist on the node """ def get_attribute_exists(self, name: str) -> bool: """ Given an attribute name, returns whether this attribute exists or not. Args: name (str): The name of the attribute Returns: bool: True if the attribute exists on this node, else False """ def get_attributes(self) -> typing.List[Attribute]: """ Returns the list of attributes on this node. """ @staticmethod def get_backing_bucket_id(*args, **kwargs) -> typing.Any: """ Finds this node's bucket id within the backing store. The id is only valid until the next modification of the backing store, so do not hold on to it. Returns: int: The bucket id, raises ValueError if the look up fails. """ @staticmethod def get_compound_graph_instance(*args, **kwargs) -> typing.Any: """ Returns a handle to the associated sub-graph, if the given node is a compound node. Returns: omni.graph.core.Graph: The subgraph """ def get_compute_count(self) -> int: """ Returns the number of times this node's compute() has been called. The counter has a limited range and will eventually roll over to 0, so a higher count cannot be assumed to represent a more recent compute than an older one. Returns: int: Number of times this node's compute() has been called since the counter last rolled over to 0. """ @staticmethod def get_compute_messages(*args, **kwargs) -> typing.Any: """ Returns a list of the compute messages currently logged for the node at a specific severity. Args: severity (omni.graph.core.Severity): Severity level of the message. Returns: list[str]: The list of messages, may be empty. """ def get_dynamic_downstream_control(self) -> bool: """ Check if the downstream nodes are influenced by this node Returns: bool: True if the current node can influence the execution of downstream nodes in dynamic scheduling """ def get_event_stream(self) -> carb.events._events.IEventStream: """ Get the event stream the node uses for notification of changes. Returns: carb.events.IEventStream: Event stream to monitor for node changes """ @staticmethod def get_graph(*args, **kwargs) -> typing.Any: """ Get the graph to which this node belongs Returns: omni.graph.core.Graph: Graph associated with the current node. The returned graph will be invalid if the node is not valid. """ def get_handle(self) -> int: """ Get an opaque handle to the node Returns: int: a unique handle to the node """ @staticmethod def get_node_type(*args, **kwargs) -> typing.Any: """ Gets the node type of this node Returns: omni.graph.core.NodeType: The node type from which this node was created. """ def get_prim_path(self) -> str: """ Returns the path to the prim currently backing the node. """ def get_type_name(self) -> str: """ Get the node type name Returns: str: The type name of the node. """ @staticmethod def get_wrapped_graph(*args, **kwargs) -> typing.Any: """ Get the graph wrapped by this node Returns: omni.graph.core.Graph: The graph wrapped by the current node, if any. The returned graph will be invalid if the node does not wrap a graph or is invalid. """ def increment_compute_count(self) -> int: """ Increments the node's compute counter. This method is provided primarily for debugging and experimental uses and should not normally be used by end-users. Returns: int: The new compute counter. This may be zero if the counter has just rolled over. """ def is_backed_by_usd(self) -> bool: """ Check if the node is back by USD or not Returns: bool: True if the current node is by an USD prim on the stage. """ def is_compound_node(self) -> bool: """ Returns whether this node is a compound node. A compound node is a node that has a node type that is defined by an OmniGraph. Returns: bool: True if this node is a compound node, False otherwise. """ def is_disabled(self) -> bool: """ Check if the node is currently disabled Returns: bool: True if the node is disabled. """ def is_valid(self) -> bool: """ Check the validity of the node Returns: bool: True if the node is valid. """ @staticmethod def log_compute_message(*args, **kwargs) -> typing.Any: """ Logs a compute message of a given severity for the node. This method is intended to be used from within the compute() method of a node to alert the user to any problems or issues with the node's most recent evaluation. They are accumulated until the next successful evaluation at which point they are cleared. If duplicate messages are logged, with the same severity level, only one is stored. Args: severity (omni.graph.core.Severity): Severity level of the message. message (str): The message. Returns: bool: True if the message has already been logged, else False """ def node_id(self) -> int: """ Returns a unique identifier value for this node. Returns: int: Unique identifier value for the node - not persistent through file save and load """ def register_on_connected_callback(self, callback: object) -> int: """ Registers a callback to be invoked when the node has attributes connected. The callback takes 2 parameters: the attributes from and attribute to of the connection. Args: callback (callable): The callback function Returns: int: A handle that could be used for deregistration. """ def register_on_disconnected_callback(self, callback: object) -> int: """ Registers a callback to be invoked when the node has attributes disconnected. The callback takes 2 parameters: the attributes from and attribute to of the disconnection. Args: callback (callable): The callback function Returns: A handle identifying the callback that can be used for deregistration. """ def register_on_path_changed_callback(self, callback: object) -> int: """ Registers a callback to be invoked when a path changes in the stage. The callback takes 1 parameter: a list of the paths that were changed. [DEPRECATED] Args: callback (callable): The callback function Returns: A handle identifying the callback that can be used for deregistration. """ def remove_attribute(self, attributeName: str) -> bool: """ Removes an attribute with the specified name and type and returns success state. Args: attributeName (str): Name of the attribute. Returns: bool: True if the removal was successful, False if the attribute was not found """ def request_compute(self) -> bool: """ Requests a compute of this node Returns: bool: True if the request was successful, False if there was an error """ def resolve_coupled_attributes(self, attributesArray: typing.List[Attribute]) -> bool: """ Resolves attribute types given a set of attributes which are fully type coupled. For example if node 'Increment' has one input attribute 'a' and one output attribute 'b' and the types of 'a' and 'b' should always match. If the input is resolved then this function will resolve the output to the same type. It will also take into consideration available conversions on the input size. The type of the first (resolved) provided attribute will be used to resolve others or select appropriate conversions Note that input attribute types are never inferred from output attribute types. This function should only be called from the INodeType function 'on_connection_type_resolve' Args: attributesArray (list[omni.graph.core.Attribute]): Array of attributes to be resolved as a coupled group Returns: bool: True if successful, False otherwise, usually due to mismatched or missing resolved types """ @staticmethod def resolve_partially_coupled_attributes(*args, **kwargs) -> typing.Any: """ Resolves attribute types given a set of attributes, that can have differing tuple counts and/or array depth, and differing but convertible base data type. The three input buffers are tied together, holding the attribute, the tuple count, and the array depth of the types to be coupled. This function will solve base type conversion by targeting the first provided type in the list, for all other ones that require it. For example if node 'makeTuple2' has two input attributes 'a' and 'b' and one output 'c' and we want to resolve any float connection to the types 'a':float, 'b':float, 'c':float[2] (convertible base types and different tuple counts) then the input buffers would contain: attrsBuf = [a, b, c] tuplesBuf = [1, 1, 2] arrayDepthsBuf = [0, 0, 0] rolesBuf = [AttributeRole::eNone, AttributeRole::eNone, AttributeRole::eNone] This is worth noting that 'b' could be of any type convertible to float. But since the first provided attribute is 'a', the type of 'a' will be used to propagate the type resolution. Note that input attribute types are never inferred from output attribute types. This function should only be called from the INodeType function 'on_connection_type_resolve' Args: attributesArray (list[omni.graph.core.Attribute]): Array of attributes to be resolved as a coupled group tuplesArray (list[int]): Array of tuple count desired for each corresponding attribute. Any value of None indicates the found tuple count is to be used when resolving. arraySizesArray (list[int]): Array of array depth desired for each corresponding attribute. Any value of None indicates the found array depth is to be used when resolving. rolesArray (list[omni.graph.core.AttributeRole]): Array of role desired for each corresponding attribute. Any value of AttributeRole::eUnknown/None indicates the found role is to be used when resolving. Returns: bool: True if successful, False otherwise, usually due to mismatched or missing resolved types """ def set_compute_incomplete(self) -> None: """ Informs the system that compute is incomplete for this frame. In lazy evaluation systems, this node will be scheduled on the next frame since it still has more work to do. """ def set_disabled(self, disabled: bool) -> None: """ Sets whether the node is disabled or not. Args: disabled (bool): True for disabled, False for not. """ def set_dynamic_downstream_control(self, control: bool) -> None: """ Sets whether the current node can influence the execution of downstream nodes in dynamic scheduling Args: control (bool): True for being able to disable downstream nodes, False otherwise """ pass class NodeEvent(): """ Node modification event. Members: CREATE_ATTRIBUTE : Attribute was created REMOVE_ATTRIBUTE : Attribute was removed ATTRIBUTE_TYPE_RESOLVE : Extended attribute type was resolved """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ATTRIBUTE_TYPE_RESOLVE: omni.graph.core._omni_graph_core.NodeEvent # value = <NodeEvent.ATTRIBUTE_TYPE_RESOLVE: 2> CREATE_ATTRIBUTE: omni.graph.core._omni_graph_core.NodeEvent # value = <NodeEvent.CREATE_ATTRIBUTE: 0> REMOVE_ATTRIBUTE: omni.graph.core._omni_graph_core.NodeEvent # value = <NodeEvent.REMOVE_ATTRIBUTE: 1> __members__: dict # value = {'CREATE_ATTRIBUTE': <NodeEvent.CREATE_ATTRIBUTE: 0>, 'REMOVE_ATTRIBUTE': <NodeEvent.REMOVE_ATTRIBUTE: 1>, 'ATTRIBUTE_TYPE_RESOLVE': <NodeEvent.ATTRIBUTE_TYPE_RESOLVE: 2>} pass class NodeType(): """ Definition of a node's interface and structure """ def __bool__(self) -> bool: """ Returns whether the current node type is valid. """ def __eq__(self, arg0: NodeType) -> bool: """ Returns whether two node type objects refer to the same underlying node type implementation. """ def add_extended_input(self, name: str, type: str, is_required: bool, extended_type: ExtendedAttributeType) -> None: """ Adds an extended input type to this node type. Every node of this node type would then have this input. Args: name (str): The name of the input type (str): Extra information for the type - for union types, this is a list of types of this union, comma separated For example, "double,float" is_required (bool): Whether the input is required or not extended_type (omni.graph.core.ExtendedAttributeType): The kind of extended attribute this is e.g. omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION """ def add_extended_output(self, name: str, type: str, is_required: bool, extended_type: ExtendedAttributeType) -> None: """ Adds an extended output type to this node type. Every node of this node type would then have this output. Args: name (str): The name of the output type (str): Extra information for the type - for union types, this is a list of types of this union, comma separated For example, "double,float" is_required (bool): Whether the output is required or not extended_type (omni.graph.core.ExtendedAttributeType): The kind of extended attribute this is e.g. omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION """ def add_extended_state(self, name: str, type: str, is_required: bool, extended_type: ExtendedAttributeType) -> None: """ Adds an extended state type to this node type. Every node of this node type would then have this state. Args: name (str): The name of the state attribute type (str): Extra information for the type - for union types, this is a list of types of this union, comma separated For example, "double,float" is_required (bool): Whether the state attribute is required or not extended_type (omni.graph.core.ExtendedAttributeType): The kind of extended attribute this is e.g. omni.graph.core.ExtendedAttributeType.EXTENDED_ATTR_TYPE_UNION """ def add_input(self, name: str, type: str, is_required: bool, default_value: object = None) -> None: """ Adds an input to this node type. Every node of this node type would then have this input. Args: name (str): The name of the input type (str): The type name of the input is_required (bool): Whether the input is required or not default_value (any): Default value for the attribute if it is not explicitly set (None means no default) """ def add_output(self, name: str, type: str, is_required: bool, default_value: object = None) -> None: """ Adds an output to this node type. Every node of this node type would then have this output. Args: name (str): The name of the output type (str): The type name of the output is_required (bool): Whether the output is required or not default_value (any): Default value for the attribute if it is not explicitly set (None means no default) """ def add_state(self, name: str, type: str, is_required: bool, default_value: object = None) -> None: """ Adds an state to this node type. Every node of this node type would then have this state. Args: name (str): The name of the state type (str): The type name of the state is_required (bool): Whether the state is required or not default_value (any): Default value for the attribute if it is not explicitly set (None means no default) """ def get_all_categories(self) -> list: """ Gets the node type's categories Returns: list[str]: A list of all categories associated with this node type """ def get_all_metadata(self) -> dict: """ Gets the node type's metadata Returns: dict[str,str]: A dictionary of name:value metadata on the node type """ def get_all_subnode_types(self) -> dict: """ Finds all subnode types of the current node type. Returns: dict[str, omni.graph.core.NodeType]: Dictionary of type_name:type_object for all subnode types of this one """ def get_metadata(self, key: str) -> str: """ Returns the metadata value for the given key. Args: key (str): The metadata keyword Returns: str | None: Metadata value for the given keyword, or None if it is not defined """ def get_metadata_count(self) -> int: """ Gets the number of metadata values set on the node type Returns: int: The number of metadata values currently defined on the node type. """ def get_node_type(self) -> str: """ Get this node type's name Returns: str: The name of this node type. """ def get_path(self) -> str: """ Gets the path to the node type definition Returns: str: The path to the node type prim. For compound node definitions, this is path on the stage to the OmniGraphSchema.OmniGraphCompoundNodeType object that defines the compound. For other node types, the path returned is unique, but does not represent a valid Prim on the stage. """ def get_scheduling_hints(self) -> ISchedulingHints: """ Gets the set of scheduling hints currently set on the node type. Returns: omni.graph.core.ISchedulingHints: The scheduling hints for this node type """ def has_state(self) -> bool: """ Checks to see if instantiations of the node type has internal state Returns: bool: True if nodes of this type will have internal state data, False if not. """ def inspect(self, inspector: omni.inspect._omni_inspect.IInspector) -> bool: """ Runs the inspector on the node type Args: inspector (omni.inspect.Inspector): The inspector to run Returns: bool: True if the inspector was successfully run on the node type, False if it is not supported """ def is_compound_node_type(self) -> bool: """ Checks to see if this node type defines a compound node type Returns: bool: True if this node type is a compound node type, meaning its implementation is defined by an OmniGraph """ def is_valid(self) -> bool: """ Checks to see if this object is valid Returns: bool: True if this node type object is valid. """ def set_has_state(self, has_state: bool) -> None: """ Sets the boolean indicating a node has state. Args: has_state (bool): Whether the node has state or not """ def set_metadata(self, key: str, value: str) -> bool: """ Sets the metadata value for the given key. Args: key (str): The metadata keyword value (str): The value of the metadata """ def set_scheduling_hints(self, scheduling_hints: ISchedulingHints) -> None: """ Modify the scheduling hints defined on the node type. Args: scheduling_hints (omni.graph.core.ISchedulingHints): New set of scheduling hints for the node type """ __hash__ = None pass class OmniGraphBindingError(Exception, BaseException): pass class PtrToPtrKind(): """ Memory type for the pointer to a GPU data array Members: NA : Memory is CPU or type is not an array CPU : Pointers to GPU arrays live on the CPU GPU : Pointers to GPU arrays live on the GPU """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ CPU: omni.graph.core._omni_graph_core.PtrToPtrKind # value = <PtrToPtrKind.CPU: 1> GPU: omni.graph.core._omni_graph_core.PtrToPtrKind # value = <PtrToPtrKind.NA: 0> NA: omni.graph.core._omni_graph_core.PtrToPtrKind # value = <PtrToPtrKind.NA: 0> __members__: dict # value = {'NA': <PtrToPtrKind.NA: 0>, 'CPU': <PtrToPtrKind.CPU: 1>, 'GPU': <PtrToPtrKind.NA: 0>} pass class Severity(): """ Severity level of the log message Members: INFO : Message is informational only WARNING : Message is regarding a recoverable unexpected situation ERROR : Message is regarding an unrecoverable unexpected situation """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ ERROR: omni.graph.core._omni_graph_core.Severity # value = <Severity.ERROR: 2> INFO: omni.graph.core._omni_graph_core.Severity # value = <Severity.INFO: 0> WARNING: omni.graph.core._omni_graph_core.Severity # value = <Severity.WARNING: 1> __members__: dict # value = {'INFO': <Severity.INFO: 0>, 'WARNING': <Severity.WARNING: 1>, 'ERROR': <Severity.ERROR: 2>} pass class Type(): """ Full definition of the data type owned by an attribute """ def __eq__(self, arg0: Type) -> bool: ... def __getstate__(self) -> tuple: ... def __hash__(self) -> int: ... def __init__(self, base_type: BaseDataType, tuple_count: int = 1, array_depth: int = 0, role: AttributeRole = AttributeRole.NONE) -> None: ... def __ne__(self, arg0: Type) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, arg0: tuple) -> None: ... def __str__(self) -> str: ... def get_base_type_name(self) -> str: """ Gets the name of this type's base data type Returns: str: Name of just the base data type of this type, e.g. "float" """ def get_ogn_type_name(self) -> str: """ Gets the OGN-style name of this type Returns: str: Name of this type in OGN format, which differs slightly from the USD format, e.g. "float[3]" """ def get_role_name(self) -> str: """ Gets the name of the role of this type Returns: str: Name of just the role of this type, e.g. "color" """ def get_type_name(self) -> str: """ Gets the name of this data type Returns: str: Name of this type, e.g. "float3" """ def is_compatible_raw_data(self, type_to_compare: Type) -> bool: """ Does a role-insensitive comparison with the given Type. For example double[3] != pointd[3], but they are compatible and so this function would return True. Args: type_to_compare (omni.graph.core.Type): Type to compare for compatibility Returns: bool: True if the given type is compatible with this type """ def is_matrix_type(self) -> bool: """ Checks if the type one of the matrix types, whose tuples are interpreted as a square array Returns: bool: True if this type is one of the matrix types """ @property def array_depth(self) -> int: """ (int) Zero for a single value, one for an array. :type: int """ @array_depth.setter def array_depth(self, arg1: int) -> None: """ (int) Zero for a single value, one for an array. """ @property def base_type(self) -> BaseDataType: """ (omni.graph.core.BaseDataType) Base type of the attribute. :type: BaseDataType """ @base_type.setter def base_type(self, arg1: BaseDataType) -> None: """ (omni.graph.core.BaseDataType) Base type of the attribute. """ @property def role(self) -> AttributeRole: """ (omni.graph.core.AttributeRole) The semantic role of the type. :type: AttributeRole """ @role.setter def role(self, arg1: AttributeRole) -> None: """ (omni.graph.core.AttributeRole) The semantic role of the type. """ @property def tuple_count(self) -> int: """ (int) Number of components in each tuple. 1 for a single value (scalar), 3 for a point3d, etc. :type: int """ @tuple_count.setter def tuple_count(self, arg1: int) -> None: """ (int) Number of components in each tuple. 1 for a single value (scalar), 3 for a point3d, etc. """ pass class _IBundle2(IConstBundle2, _IConstBundle2, omni.core._core.IObject): pass class _IBundleChanges(omni.core._core.IObject): pass class _IBundleFactory2(IBundleFactory, _IBundleFactory, omni.core._core.IObject): pass class _IBundleFactory(omni.core._core.IObject): pass class _IConstBundle2(omni.core._core.IObject): pass class _INodeCategories(omni.core._core.IObject): pass class _ISchedulingHints2(ISchedulingHints, _ISchedulingHints, omni.core._core.IObject): pass class _ISchedulingHints(omni.core._core.IObject): pass class _IVariable(omni.core._core.IObject): pass class eAccessLocation(): """ What type of non-attribute data does this node access Members: E_USD : Accesses the USD stage data E_GLOBAL : Accesses data that is not part of the node or node type E_STATIC : Accesses data that is shared by every instance of a particular node type E_TOPOLOGY : Accesses information on the topology of the graph to which the node belongs """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_GLOBAL: omni.graph.core._omni_graph_core.eAccessLocation # value = <eAccessLocation.E_GLOBAL: 1> E_STATIC: omni.graph.core._omni_graph_core.eAccessLocation # value = <eAccessLocation.E_STATIC: 2> E_TOPOLOGY: omni.graph.core._omni_graph_core.eAccessLocation # value = <eAccessLocation.E_TOPOLOGY: 3> E_USD: omni.graph.core._omni_graph_core.eAccessLocation # value = <eAccessLocation.E_USD: 0> __members__: dict # value = {'E_USD': <eAccessLocation.E_USD: 0>, 'E_GLOBAL': <eAccessLocation.E_GLOBAL: 1>, 'E_STATIC': <eAccessLocation.E_STATIC: 2>, 'E_TOPOLOGY': <eAccessLocation.E_TOPOLOGY: 3>} pass class eAccessType(): """ How does the node access the data described by the enum eAccessLocation Members: E_NONE : There is no access to data of the associated type E_READ : There is only read access to data of the associated type E_WRITE : There is only write access to data of the associated type E_READ_WRITE : There is both read and write access to data of the associated type """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_NONE: omni.graph.core._omni_graph_core.eAccessType # value = <eAccessType.E_NONE: 0> E_READ: omni.graph.core._omni_graph_core.eAccessType # value = <eAccessType.E_READ: 1> E_READ_WRITE: omni.graph.core._omni_graph_core.eAccessType # value = <eAccessType.E_READ_WRITE: 3> E_WRITE: omni.graph.core._omni_graph_core.eAccessType # value = <eAccessType.E_WRITE: 2> __members__: dict # value = {'E_NONE': <eAccessType.E_NONE: 0>, 'E_READ': <eAccessType.E_READ: 1>, 'E_WRITE': <eAccessType.E_WRITE: 2>, 'E_READ_WRITE': <eAccessType.E_READ_WRITE: 3>} pass class eComputeRule(): """ How the node is allowed to be computed Members: E_DEFAULT : Nodes are computed according to the default evaluator rules E_ON_REQUEST : The evaluator may skip computing this node until explicitly requested with INode::requestCompute """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_DEFAULT: omni.graph.core._omni_graph_core.eComputeRule # value = <eComputeRule.E_DEFAULT: 0> E_ON_REQUEST: omni.graph.core._omni_graph_core.eComputeRule # value = <eComputeRule.E_ON_REQUEST: 1> __members__: dict # value = {'E_DEFAULT': <eComputeRule.E_DEFAULT: 0>, 'E_ON_REQUEST': <eComputeRule.E_ON_REQUEST: 1>} pass class ePurityStatus(): """ The purity of the node implementation. For some context, a "pure" node is one whose initialize, compute, and release methods are entirely deterministic, i.e. they will always produce the same output attribute values for a given set of input attribute values, and do not access, rely on, or otherwise mutate data external to the node's scope Members: E_IMPURE : Node is assumed to not be pure E_PURE : Node can be considered pure if explicitly specified by the node author """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_IMPURE: omni.graph.core._omni_graph_core.ePurityStatus # value = <ePurityStatus.E_IMPURE: 0> E_PURE: omni.graph.core._omni_graph_core.ePurityStatus # value = <ePurityStatus.E_PURE: 1> __members__: dict # value = {'E_IMPURE': <ePurityStatus.E_IMPURE: 0>, 'E_PURE': <ePurityStatus.E_PURE: 1>} pass class eThreadSafety(): """ How thread safe is the node during evaluation Members: E_SAFE : Nodes can be evaluated in multiple threads safely E_UNSAFE : Nodes cannot be evaluated in multiple threads safely E_UNKNOWN : The thread safety status of the node type is unknown """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_SAFE: omni.graph.core._omni_graph_core.eThreadSafety # value = <eThreadSafety.E_SAFE: 0> E_UNKNOWN: omni.graph.core._omni_graph_core.eThreadSafety # value = <eThreadSafety.E_UNKNOWN: 2> E_UNSAFE: omni.graph.core._omni_graph_core.eThreadSafety # value = <eThreadSafety.E_UNSAFE: 1> __members__: dict # value = {'E_SAFE': <eThreadSafety.E_SAFE: 0>, 'E_UNSAFE': <eThreadSafety.E_UNSAFE: 1>, 'E_UNKNOWN': <eThreadSafety.E_UNKNOWN: 2>} pass class eVariableScope(): """ Scope in which the variable has been made available Members: E_PRIVATE : Variable is accessible only to its graph E_READ_ONLY : Variable can be read by other graphs E_PUBLIC : Variable can be read/written by other graphs """ def __eq__(self, other: object) -> bool: ... def __getstate__(self) -> int: ... def __hash__(self) -> int: ... def __index__(self) -> int: ... def __init__(self, value: int) -> None: ... def __int__(self) -> int: ... def __ne__(self, other: object) -> bool: ... def __repr__(self) -> str: ... def __setstate__(self, state: int) -> None: ... @property def name(self) -> str: """ :type: str """ @property def value(self) -> int: """ :type: int """ E_PRIVATE: omni.graph.core._omni_graph_core.eVariableScope # value = <eVariableScope.E_PRIVATE: 0> E_PUBLIC: omni.graph.core._omni_graph_core.eVariableScope # value = <eVariableScope.E_PUBLIC: 2> E_READ_ONLY: omni.graph.core._omni_graph_core.eVariableScope # value = <eVariableScope.E_READ_ONLY: 1> __members__: dict # value = {'E_PRIVATE': <eVariableScope.E_PRIVATE: 0>, 'E_READ_ONLY': <eVariableScope.E_READ_ONLY: 1>, 'E_PUBLIC': <eVariableScope.E_PUBLIC: 2>} pass def _commit_output_attributes_data(python_commit_db: dict) -> None: """ For internal use only. Batch commit of attribute values Args: python_commit_db : Dictionary of attributes as keys and data as values """ def _prefetch_input_attributes_data(python_prefetch_db: list) -> list: """ For internal use only. Args: python_prefetch_db : List of attributes Returns: list[Any]: Prefetched attribute values """ def acquire_interface(plugin_name: str = None, library_path: str = None) -> ComputeGraph: pass def attach(stage_id: int, mps: float) -> None: """ Attach the graph to a particular stage. Args: stage_id (int): The stage id of the stage to attach to mps (float): the meters per second setting for the stage """ def deregister_node_type(name: str) -> bool: """ Deregisters a python subnode type with OmniGraph. Args: name (str): Name of the Python node type being deregistered Returns: bool: True if the deregistration was successful, else False """ def deregister_post_load_file_format_upgrade_callback(postload_handle: int) -> None: """ De-registers the postload callback to be invoked when the file format version changes. Args: postload_handle (int): The handle that was returned during the register_post_load_file_format_upgrade_callback call """ def deregister_pre_load_file_format_upgrade_callback(preload_handle: int) -> None: """ De-registers the preload callback to be invoked when the file format version changes. Args: preload_handle (int): The handle that was returned during the register_pre_load_file_format_upgrade_callback call """ def detach() -> None: """ Detaches the graph from the currently attached stage. """ def get_all_graphs() -> typing.List[Graph]: """ Get all of the top-level non-orchestration graphs Returns: list[omni.graph.core.Graph]: A list of the top level graphs (non-orchestration) in OmniGraph. """ def get_all_graphs_and_subgraphs() -> typing.List[Graph]: """ Get all of the non-orchestration graphs Returns: list[omni.graph.core.Graph]: A list of the (non-orchestration) in OmniGraph. """ def get_bundle_tree_factory_interface() -> IBundleFactory: """ Gets an object that can interface with an IBundleFactory Returns: omni.graph.core.IBundleFactory: Object that can interface with the bundle tree """ def get_compute_graph_contexts() -> typing.List[GraphContext]: """ Gets all of the current graph contexts Returns: list[omni.graph.core.GraphContext]: A list of all graph contexts in OmniGraph. """ def get_global_orchestration_graphs() -> typing.List[Graph]: """ Gets the global orchestration graphs Returns: list[omni.graph.core.Graph]: A list of the global orchestration graphs that house all other graphs. """ def get_global_orchestration_graphs_in_pipeline_stage(pipeline_stage: GraphPipelineStage) -> typing.List[Graph]: """ Returns a list of the global orchestration graphs that house all other graphs for a given pipeline stage. Args: pipeline_stage (omni.graph.core.GraphPipelineStage): The pipeline stage in question Returns: list[omni.graph.core.Graph]: A list of the global orchestration graphs in the given pipeline stage """ def get_graph_by_path(path: str) -> object: """ Finds the graph with the given path. Args: path (str): The path of the graph. For example "/World/PushGraph" Returns: omni.graph.core.Graph: The matching graph, or None if it was not found. """ def get_graphs_in_pipeline_stage(pipeline_stage: GraphPipelineStage) -> typing.List[Graph]: """ Returns a list of the non-orchestration graphs for a given pipeline stage (simulation, pre-render, post-render) Args: pipeline_stage (omni.graph.core.GraphPipelineStage): The pipeline stage in question Returns: list[omni.graph.core.Graph]: The list of graphs belonging to the pipeline stage """ def get_node_by_path(path: str) -> object: """ Get a node that lives at a given path Args: path (str): Path at which to find the node Returns: omni.graph.core.Node: The node corresponding to a node path in OmniGraph, None if no node was found at that path. """ def get_node_categories_interface() -> INodeCategories: """ Gets an object for accessing the node categories Returns: omni.graph.core.INodeCategories: Object that can interface with the category data """ def get_node_type(node_type_name: str) -> NodeType: """ Returns the registered node type object with the given name. Args: node_type_name (str): Name of the registered NodeType to find and return Returns: omni.graph.core.NodeType: NodeType object registered with the given name, None if it is not registered """ def get_registered_nodes() -> typing.List[str]: """ Get the currently registered node type names Returns: list[str]: The list of names of node types currently registered """ def is_global_graph_prim(prim_path: str) -> bool: """ Determines if the prim path passed in represents a prim that is backing a global graph Args: prim_path (str): The path to the prim in question Returns: bool: True if the prim path represents a prim that is backing a global graph, False otherwise """ def on_shutdown() -> None: """ For internal use only. Called to allow the Python API to clean up prior to the extension being unloaded. """ def register_node_type(name: object, version: int) -> None: """ Registers a new python subnode type with OmniGraph. Args: name (str): Name of the Python node type being registered version (int): Version number of the Python node type being registered """ def register_post_load_file_format_upgrade_callback(callback: object) -> int: """ Registers a callback to be invoked when the file format version changes. Happens after the file has already been parsed and stage attached to. The callback takes 3 parameters: the old file format version, the new file format version, and the affected graph object. Args: callback (callable): The callback function Returns: int: A handle that could be used for deregistration. Note the calling module is responsible for deregistration of the callback in all circumstances, including where the extension is hot-reloaded. """ def register_pre_load_file_format_upgrade_callback(callback: object) -> int: """ Registers a callback to be invoked when the file format version changes. Happens before the file has already been parsed and stage attached to. The callback takes 3 parameters: the old file format version, the new file format version, and a graph object (always invalid since the graph has not been created yet). Args: callback (callable): The callback function Returns: int: A handle that could be used for deregistration. Note the calling module is responsible for deregistration of the callback in all circumstances, including where the extension is hot-reloaded. """ def register_python_node() -> None: """ Registers the unique Python node type with OmniGraph. This houses all of the Python node implementations as subtypes. """ def release_interface(arg0: ComputeGraph) -> None: pass def set_test_failure(has_failure: bool) -> None: """ Sets or clears a generic test failure. Args: has_failure (bool): If True then increment the test failure count, else clear it. """ def shutdown_compute_graph() -> None: """ Shuts down the compute graph. All data not backed by USD will be lost. """ def test_failure_count() -> int: """ Gets the number of active test failures Returns: int: The number of currently active test failures. """ def update(current_time: float, elapsed_time: float) -> None: """ Ticks the graph with the current time and elapsed time. Args: current_time (float): The current time elapsed_time (float): The elapsed time since the last tick """ ACCORDING_TO_CONTEXT_GRAPH_INDEX = 18446744073709551614 APPLIED_SCHEMA: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.APPLIED_SCHEMA: 11> ASSET: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.ASSET: 12> AUTHORING_GRAPH_INDEX = 18446744073709551615 BOOL: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.BOOL: 1> BUNDLE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.BUNDLE: 16> COLOR: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.COLOR: 4> CONNECTION: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.CONNECTION: 14> DOUBLE: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.DOUBLE: 9> ERROR: omni.graph.core._omni_graph_core.Severity # value = <Severity.ERROR: 2> EXECUTION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.EXECUTION: 13> FLOAT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.FLOAT: 8> FRAME: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.FRAME: 8> HALF: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.HALF: 7> INFO: omni.graph.core._omni_graph_core.Severity # value = <Severity.INFO: 0> INSTANCING_GRAPH_TARGET_PATH = '_OMNI_GRAPH_TARGET' INT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.INT: 3> INT64: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.INT64: 5> MATRIX: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.MATRIX: 14> NONE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.NONE: 0> NORMAL: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.NORMAL: 2> OBJECT_ID: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.OBJECT_ID: 15> PATH: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.PATH: 17> POSITION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.POSITION: 3> PRIM: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.PRIM: 13> PRIM_TYPE_NAME: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.PRIM_TYPE_NAME: 12> QUATERNION: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.QUATERNION: 6> RELATIONSHIP: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.RELATIONSHIP: 11> TAG: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.TAG: 15> TARGET: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TARGET: 20> TEXCOORD: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TEXCOORD: 5> TEXT: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TEXT: 10> TIMECODE: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TIMECODE: 9> TOKEN: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.TOKEN: 10> TRANSFORM: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.TRANSFORM: 7> UCHAR: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UCHAR: 2> UINT: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UINT: 4> UINT64: omni.graph.core._omni_graph_core.BaseDataType # value = <BaseDataType.UINT64: 6> UNKNOWN: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.UNKNOWN: 21> VECTOR: omni.graph.core._omni_graph_core.AttributeRole # value = <AttributeRole.VECTOR: 1> WARNING: omni.graph.core._omni_graph_core.Severity # value = <Severity.WARNING: 1> _internal = omni.graph.core._omni_graph_core._internal _og_unstable = omni.graph.core._omni_graph_core._og_unstable
198,295
unknown
37.729687
838
0.62404
omniverse-code/kit/exts/omni.graph/omni/graph/core/commands.py
import traceback import omni.graph.tools as __ogt from ._impl.commands import * # noqa: F401,PLW0401,PLW0614 _trace = "".join(traceback.format_stack()) __ogt.DeprecatedImport(f"Import 'omni.graph.core as og; help(og.cmds)' to access the OmniGraph commands\n{_trace}")
272
Python
29.33333
115
0.735294
omniverse-code/kit/exts/omni.graph/omni/graph/core/__init__.py
""" This file contains the interfaces that external Python scripts can use. Import this file and use the APIs exposed below. To get documentation on this module and methods import this file into a Python interpreter and run dir/help, like this: .. code-block:: python import omni.graph.core as og help(og.get_graph_by_path) """ # fmt: off # isort: off import omni.core # noqa: F401 (Required for proper resolution of ONI wrappers) # Get the bindings into the module from . import _omni_graph_core # noqa: F401,PLW0406 from ._omni_graph_core import * from ._impl.extension import _PublicExtension # noqa: F401 from ._impl.autonode.type_definitions import ( Color3d, Color3f, Color3h, Color4d, Color4f, Color4h, Double, Double2, Double3, Double4, Float, Float2, Float3, Float4, Half, Half2, Half3, Half4, Int, Int2, Int3, Int4, Matrix2d, Matrix3d, Matrix4d, Normal3d, Normal3f, Normal3h, Point3d, Point3f, Point3h, Quatd, Quatf, Quath, TexCoord2d, TexCoord2f, TexCoord2h, TexCoord3d, TexCoord3f, TexCoord3h, Timecode, Token, TypeRegistry, UChar, UInt, Vector3d, Vector3f, Vector3h, ) from ._impl.attribute_types import get_port_type_namespace from ._impl.attribute_values import AttributeDataValueHelper from ._impl.attribute_values import AttributeValueHelper from ._impl.attribute_values import WrappedArrayType from ._impl.bundles import Bundle from ._impl.bundles import BundleContainer from ._impl.bundles import BundleContents from ._impl.bundles import BundleChanges from ._impl.commands import cmds from ._impl.controller import Controller from ._impl.data_typing import data_shape_from_type from ._impl.data_typing import DataWrapper from ._impl.data_typing import Device from ._impl.data_view import DataView from ._impl.database import Database from ._impl.database import DynamicAttributeAccess from ._impl.database import DynamicAttributeInterface from ._impl.database import PerNodeKeys from ._impl.dtypes import Dtype from ._impl.errors import OmniGraphError from ._impl.errors import OmniGraphValueError from ._impl.errors import ReadOnlyError from ._impl.extension_information import ExtensionInformation from ._impl.graph_controller import GraphController from ._impl.inspection import OmniGraphInspector from ._impl.node_controller import NodeController from ._impl.object_lookup import ObjectLookup from ._impl.runtime import RuntimeAttribute from ._impl.settings import Settings from ._impl.threadsafety_test_utils import ThreadsafetyTestUtils from ._impl.traversal import traverse_downstream_graph from ._impl.traversal import traverse_upstream_graph from ._impl.type_resolution import resolve_base_coupled from ._impl.type_resolution import resolve_fully_coupled from ._impl.utils import attribute_value_as_usd from ._impl.utils import get_graph_settings from ._impl.utils import get_kit_version from ._impl.utils import GraphSettings from ._impl.utils import in_compute from ._impl.utils import is_attribute_plain_data from ._impl.utils import is_in_compute from ._impl.utils import python_value_as_usd from ._impl.utils import TypedValue from . import autonode from . import typing from . import _unstable # ============================================================================================================== # These are symbols that should technically be prefaced with an underscore because they are used internally but # not part of the public API but that would cause a lot of refactoring work so for now they are just added to the # module contents but not the module exports. # _ _ _____ _____ _____ ______ _ _ # | | | |_ _| __ \| __ \| ____| \ | | # | |__| | | | | | | | | | | |__ | \| | # | __ | | | | | | | | | | __| | . ` | # | | | |_| |_| |__| | |__| | |____| |\ | # |_| |_|_____|_____/|_____/|______|_| \_| # from ._impl.generate_ogn import generate_ogn_from_node from ._impl.registration import PythonNodeRegistration from ._impl.utils import load_example_file from ._impl.utils import remove_attributes_if from ._impl.utils import sync_to_usd # ============================================================================================================== # Soft-deprecated imports. Kept around for backward compatibility for one version. # _____ ______ _____ _____ ______ _____ _______ ______ _____ # | __ \ | ____|| __ \ | __ \ | ____|/ ____| /\ |__ __|| ____|| __ \ # | | | || |__ | |__) || |__) || |__ | | / \ | | | |__ | | | | # | | | || __| | ___/ | _ / | __| | | / /\ \ | | | __| | | | | # | |__| || |____ | | | | \ \ | |____| |____ / ____ \ | | | |____ | |__| | # |_____/ |______||_| |_| \_\|______|\_____|/_/ \_\|_| |______||_____/ # from omni.graph.tools import RenamedClass as __RenamedClass # pylint: disable=wrong-import-order from omni.graph.tools.ogn import MetadataKeys as __MetadataKeys # pylint: disable=wrong-import-order MetadataKeys = __RenamedClass(__MetadataKeys, "MetadataKeys", "MetadataKeys has moved to omni.graph.tools.ogn") # Ready for deletion, once omni.graph.window has removed its usage - OM-96121 def get_global_container_graphs() -> list[_omni_graph_core.Graph]: import carb carb.log_warn("get_global_container_graphs() has been deprecated - use get_global_orchestration_graphs() instead") return _omni_graph_core.get_global_orchestration_graphs() # ============================================================================================================== # The bindings may have internal (single-underscore prefix) and external symbols. To be consistent with our export # rules the internal symbols will be part of the module but not part of the published __all__ list, and the external # symbols will be in both. __bindings = [] for __bound_name in dir(_omni_graph_core): # TODO: Right now the bindings and the core both define the same object type so they both can't be exported # here so remove it from the bindings and it will be dealt with later. if __bound_name in ["Bundle"]: continue if not __bound_name.startswith("__"): if not __bound_name.startswith("_"): __bindings.append(__bound_name) globals()[__bound_name] = getattr(_omni_graph_core, __bound_name) __all__ = __bindings + [ "attribute_value_as_usd", "AttributeDataValueHelper", "AttributeValueHelper", "autonode", "Bundle", "BundleContainer", "BundleContents", "BundleChanges", "cmds", "Controller", "data_shape_from_type", "Database", "DataView", "DataWrapper", "Device", "Dtype", "DynamicAttributeAccess", "DynamicAttributeInterface", "ExtensionInformation", "get_graph_settings", "get_kit_version", "get_port_type_namespace", "GraphController", "GraphSettings", "in_compute", "is_attribute_plain_data", "is_in_compute", "MetadataKeys", "NodeController", "ObjectLookup", "OmniGraphError", "OmniGraphInspector", "OmniGraphValueError", "PerNodeKeys", "python_value_as_usd", "ReadOnlyError", "resolve_base_coupled", "resolve_fully_coupled", "RuntimeAttribute", "Settings", "ThreadsafetyTestUtils", "TypedValue", "typing", "WrappedArrayType", "traverse_downstream_graph", "traverse_upstream_graph", "Color3d", "Color3f", "Color3h", "Color4d", "Color4f", "Color4h", "Double", "Double2", "Double3", "Double4", "Float", "Float2", "Float3", "Float4", "Half", "Half2", "Half3", "Half4", "Int", "Int2", "Int3", "Int4", "Matrix2d", "Matrix3d", "Matrix4d", "Normal3d", "Normal3f", "Normal3h", "Point3d", "Point3f", "Point3h", "Quatd", "Quatf", "Quath", "TexCoord2d", "TexCoord2f", "TexCoord2h", "TexCoord3d", "TexCoord3f", "TexCoord3h", "Timecode", "Token", "TypeRegistry", "UChar", "UInt", "Vector3d", "Vector3f", "Vector3h", ] _HIDDEN = [ "generate_ogn_from_node", "get_global_container_graphs", "PythonNodeRegistration", "load_example_file", "register_ogn_nodes", "remove_attributes_if", "sync_to_usd", ] # isort: on # fmt: on
8,492
Python
29.117021
119
0.606689
omniverse-code/kit/exts/omni.graph/omni/graph/core/setup.py
from setuptools import setup from torch.utils.cpp_extension import BuildExtension, CUDAExtension setup( name="torch_wrap", ext_modules=[CUDAExtension("torch_wrap", ["Py_WrapTensor.cpp"])], cmdclass={"build_ext": BuildExtension}, )
244
Python
26.222219
69
0.733607
omniverse-code/kit/exts/omni.graph/omni/graph/core/autonode.py
"""AutoNode - module for decorating code to populate it into OmniGraph nodes. Allows generating nodes by decorating free functions, classes and modules by adding `@AutoFunc()` or `@AutoClass()` to the declaration of the class. Generating code relies on function signatures provided by python's type annotations, therefore the module only supports native python types with `__annotations__`. CPython classes need need to be wrapped for now. """ from ._impl.autonode.autonode import ( AutoClass, AutoFunc, register_autonode_type_extension, unregister_autonode_type_extension, ) from ._impl.autonode.event import IEventStream from ._impl.autonode.type_definitions import ( AutoNodeDefinitionGenerator, AutoNodeDefinitionWrapper, AutoNodeTypeConversion, ) __all__ = [ "AutoClass", "AutoFunc", "AutoNodeDefinitionGenerator", "AutoNodeDefinitionWrapper", "AutoNodeTypeConversion", "IEventStream", "register_autonode_type_extension", "unregister_autonode_type_extension", ]
1,030
Python
31.218749
119
0.750485