mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
* Adjustment: Update Bullet version to 3.24.
This commit is contained in:
parent
35de012ee7
commit
4a3f31df2a
6148 changed files with 2112532 additions and 56873 deletions
158
Engine/lib/bullet/examples/ThirdPartyLibs/glad/EGL/eglplatform.h
Normal file
158
Engine/lib/bullet/examples/ThirdPartyLibs/glad/EGL/eglplatform.h
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2016 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: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
|
||||
*
|
||||
* 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>
|
||||
|
||||
typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
typedef HWND EGLNativeWindowType;
|
||||
|
||||
#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__) || defined(ANDROID)
|
||||
|
||||
struct ANativeWindow;
|
||||
struct egl_native_pixmap_t;
|
||||
|
||||
typedef struct ANativeWindow* EGLNativeWindowType;
|
||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||
typedef void* EGLNativeDisplayType;
|
||||
|
||||
#elif defined(__unix__) || defined(__APPLE__)
|
||||
|
||||
#if defined(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 */
|
||||
|
||||
#elif __HAIKU__
|
||||
#include <kernel/image.h>
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef khronos_uintptr_t EGLNativePixmapType;
|
||||
typedef khronos_uintptr_t EGLNativeWindowType;
|
||||
|
||||
#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;
|
||||
|
||||
/* C++ / C typecast macros for special EGL handle values */
|
||||
#if defined(__cplusplus)
|
||||
#define EGL_CAST(type, value) (static_cast<type>(value))
|
||||
#else
|
||||
#define EGL_CAST(type, value) ((type)(value))
|
||||
#endif
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
283
Engine/lib/bullet/examples/ThirdPartyLibs/glad/KHR/khrplatform.h
Normal file
283
Engine/lib/bullet/examples/ThirdPartyLibs/glad/KHR/khrplatform.h
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
#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: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
|
||||
*
|
||||
* 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__)
|
||||
#define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined(__SYMBIAN32__)
|
||||
#define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
#define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#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_ */
|
||||
61
Engine/lib/bullet/examples/ThirdPartyLibs/glad/LICENSE.txt
Normal file
61
Engine/lib/bullet/examples/ThirdPartyLibs/glad/LICENSE.txt
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2020 David Herberth
|
||||
|
||||
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.
|
||||
|
||||
|
||||
The Khronos Specifications:
|
||||
|
||||
Copyright (c) 2013-2020 The Khronos Group Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
The EGL Specification and various headers:
|
||||
|
||||
Copyright (c) 2007-2016 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.
|
||||
460
Engine/lib/bullet/examples/ThirdPartyLibs/glad/egl.c
Normal file
460
Engine/lib/bullet/examples/ThirdPartyLibs/glad/egl.c
Normal file
|
|
@ -0,0 +1,460 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glad/egl.h>
|
||||
|
||||
#ifndef GLAD_IMPL_UTIL_C_
|
||||
#define GLAD_IMPL_UTIL_C_
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy_s(dest, len, source, len - 1);
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy(dest, source, len);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf_s
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf
|
||||
#endif
|
||||
|
||||
#endif /* GLAD_IMPL_UTIL_C_ */
|
||||
|
||||
int GLAD_EGL_VERSION_1_0;
|
||||
int GLAD_EGL_VERSION_1_1;
|
||||
int GLAD_EGL_VERSION_1_2;
|
||||
int GLAD_EGL_VERSION_1_3;
|
||||
int GLAD_EGL_VERSION_1_4;
|
||||
int GLAD_EGL_VERSION_1_5;
|
||||
int GLAD_EGL_EXT_platform_device;
|
||||
int GLAD_EGL_EXT_platform_base;
|
||||
int GLAD_EGL_NV_device_cuda;
|
||||
int GLAD_EGL_EXT_device_enumeration;
|
||||
int GLAD_EGL_EXT_device_query;
|
||||
int GLAD_EGL_EXT_device_base;
|
||||
int GLAD_EGL_NV_cuda_event;
|
||||
|
||||
PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
|
||||
PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
|
||||
PFNEGLGETERRORPROC glad_eglGetError;
|
||||
PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
|
||||
PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
|
||||
PFNEGLQUERYAPIPROC glad_eglQueryAPI;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
|
||||
PFNEGLQUERYDISPLAYATTRIBKHRPROC glad_eglQueryDisplayAttribKHR;
|
||||
PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
|
||||
PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
|
||||
PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
|
||||
PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
|
||||
PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
|
||||
PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
|
||||
PFNEGLBINDAPIPROC glad_eglBindAPI;
|
||||
PFNEGLWAITNATIVEPROC glad_eglWaitNative;
|
||||
PFNEGLTERMINATEPROC glad_eglTerminate;
|
||||
PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
|
||||
PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
|
||||
PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
|
||||
PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
|
||||
PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
|
||||
PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
|
||||
PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
|
||||
PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
|
||||
PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
|
||||
PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
|
||||
PFNEGLQUERYSTRINGPROC glad_eglQueryString;
|
||||
PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
|
||||
PFNEGLWAITSYNCPROC glad_eglWaitSync;
|
||||
PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
|
||||
PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
|
||||
PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
|
||||
PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
|
||||
PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
|
||||
PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
|
||||
PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
|
||||
PFNEGLINITIALIZEPROC glad_eglInitialize;
|
||||
PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
|
||||
PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
|
||||
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
|
||||
PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
|
||||
PFNEGLCREATESYNCPROC glad_eglCreateSync;
|
||||
PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
|
||||
PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
|
||||
PFNEGLWAITGLPROC glad_eglWaitGL;
|
||||
PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
|
||||
PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
|
||||
PFNEGLWAITCLIENTPROC glad_eglWaitClient;
|
||||
PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
|
||||
|
||||
static void load_EGL_VERSION_1_0(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_VERSION_1_0) return;
|
||||
eglCreatePbufferSurface = (PFNEGLCREATEPBUFFERSURFACEPROC)load("eglCreatePbufferSurface", userptr);
|
||||
eglGetError = (PFNEGLGETERRORPROC)load("eglGetError", userptr);
|
||||
eglGetProcAddress = (PFNEGLGETPROCADDRESSPROC)load("eglGetProcAddress", userptr);
|
||||
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)load("eglGetCurrentDisplay", userptr);
|
||||
eglQueryContext = (PFNEGLQUERYCONTEXTPROC)load("eglQueryContext", userptr);
|
||||
eglSwapBuffers = (PFNEGLSWAPBUFFERSPROC)load("eglSwapBuffers", userptr);
|
||||
eglCreateContext = (PFNEGLCREATECONTEXTPROC)load("eglCreateContext", userptr);
|
||||
eglChooseConfig = (PFNEGLCHOOSECONFIGPROC)load("eglChooseConfig", userptr);
|
||||
eglWaitNative = (PFNEGLWAITNATIVEPROC)load("eglWaitNative", userptr);
|
||||
eglTerminate = (PFNEGLTERMINATEPROC)load("eglTerminate", userptr);
|
||||
eglCopyBuffers = (PFNEGLCOPYBUFFERSPROC)load("eglCopyBuffers", userptr);
|
||||
eglGetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC)load("eglGetConfigAttrib", userptr);
|
||||
eglGetCurrentSurface = (PFNEGLGETCURRENTSURFACEPROC)load("eglGetCurrentSurface", userptr);
|
||||
eglCreatePixmapSurface = (PFNEGLCREATEPIXMAPSURFACEPROC)load("eglCreatePixmapSurface", userptr);
|
||||
eglGetDisplay = (PFNEGLGETDISPLAYPROC)load("eglGetDisplay", userptr);
|
||||
eglQueryString = (PFNEGLQUERYSTRINGPROC)load("eglQueryString", userptr);
|
||||
eglDestroyContext = (PFNEGLDESTROYCONTEXTPROC)load("eglDestroyContext", userptr);
|
||||
eglCreateWindowSurface = (PFNEGLCREATEWINDOWSURFACEPROC)load("eglCreateWindowSurface", userptr);
|
||||
eglInitialize = (PFNEGLINITIALIZEPROC)load("eglInitialize", userptr);
|
||||
eglDestroySurface = (PFNEGLDESTROYSURFACEPROC)load("eglDestroySurface", userptr);
|
||||
eglMakeCurrent = (PFNEGLMAKECURRENTPROC)load("eglMakeCurrent", userptr);
|
||||
eglWaitGL = (PFNEGLWAITGLPROC)load("eglWaitGL", userptr);
|
||||
eglQuerySurface = (PFNEGLQUERYSURFACEPROC)load("eglQuerySurface", userptr);
|
||||
eglGetConfigs = (PFNEGLGETCONFIGSPROC)load("eglGetConfigs", userptr);
|
||||
}
|
||||
static void load_EGL_VERSION_1_1(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_VERSION_1_1) return;
|
||||
eglReleaseTexImage = (PFNEGLRELEASETEXIMAGEPROC)load("eglReleaseTexImage", userptr);
|
||||
eglSurfaceAttrib = (PFNEGLSURFACEATTRIBPROC)load("eglSurfaceAttrib", userptr);
|
||||
eglBindTexImage = (PFNEGLBINDTEXIMAGEPROC)load("eglBindTexImage", userptr);
|
||||
eglSwapInterval = (PFNEGLSWAPINTERVALPROC)load("eglSwapInterval", userptr);
|
||||
}
|
||||
static void load_EGL_VERSION_1_2(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_VERSION_1_2) return;
|
||||
eglBindAPI = (PFNEGLBINDAPIPROC)load("eglBindAPI", userptr);
|
||||
eglQueryAPI = (PFNEGLQUERYAPIPROC)load("eglQueryAPI", userptr);
|
||||
eglWaitClient = (PFNEGLWAITCLIENTPROC)load("eglWaitClient", userptr);
|
||||
eglCreatePbufferFromClientBuffer = (PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)load("eglCreatePbufferFromClientBuffer", userptr);
|
||||
eglReleaseThread = (PFNEGLRELEASETHREADPROC)load("eglReleaseThread", userptr);
|
||||
}
|
||||
static void load_EGL_VERSION_1_4(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_VERSION_1_4) return;
|
||||
eglGetCurrentContext = (PFNEGLGETCURRENTCONTEXTPROC)load("eglGetCurrentContext", userptr);
|
||||
}
|
||||
static void load_EGL_VERSION_1_5(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_VERSION_1_5) return;
|
||||
eglDestroySync = (PFNEGLDESTROYSYNCPROC)load("eglDestroySync", userptr);
|
||||
eglCreateImage = (PFNEGLCREATEIMAGEPROC)load("eglCreateImage", userptr);
|
||||
eglGetPlatformDisplay = (PFNEGLGETPLATFORMDISPLAYPROC)load("eglGetPlatformDisplay", userptr);
|
||||
eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)load("eglDestroyImage", userptr);
|
||||
eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)load("eglClientWaitSync", userptr);
|
||||
eglWaitSync = (PFNEGLWAITSYNCPROC)load("eglWaitSync", userptr);
|
||||
eglCreateSync = (PFNEGLCREATESYNCPROC)load("eglCreateSync", userptr);
|
||||
eglGetSyncAttrib = (PFNEGLGETSYNCATTRIBPROC)load("eglGetSyncAttrib", userptr);
|
||||
eglCreatePlatformWindowSurface = (PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)load("eglCreatePlatformWindowSurface", userptr);
|
||||
eglCreatePlatformPixmapSurface = (PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)load("eglCreatePlatformPixmapSurface", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_platform_base(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_EXT_platform_base) return;
|
||||
eglCreatePlatformWindowSurfaceEXT = (PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)load("eglCreatePlatformWindowSurfaceEXT", userptr);
|
||||
eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)load("eglGetPlatformDisplayEXT", userptr);
|
||||
eglCreatePlatformPixmapSurfaceEXT = (PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)load("eglCreatePlatformPixmapSurfaceEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_device_enumeration(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_EXT_device_enumeration) return;
|
||||
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_device_query(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_EXT_device_query) return;
|
||||
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
|
||||
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
|
||||
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
|
||||
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC)load("eglQueryDisplayAttribKHR", userptr);
|
||||
}
|
||||
static void load_EGL_EXT_device_base(GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
if (!GLAD_EGL_EXT_device_base) return;
|
||||
eglQueryDisplayAttribEXT = (PFNEGLQUERYDISPLAYATTRIBEXTPROC)load("eglQueryDisplayAttribEXT", userptr);
|
||||
eglQueryDevicesEXT = (PFNEGLQUERYDEVICESEXTPROC)load("eglQueryDevicesEXT", userptr);
|
||||
eglQueryDeviceStringEXT = (PFNEGLQUERYDEVICESTRINGEXTPROC)load("eglQueryDeviceStringEXT", userptr);
|
||||
eglQueryDeviceAttribEXT = (PFNEGLQUERYDEVICEATTRIBEXTPROC)load("eglQueryDeviceAttribEXT", userptr);
|
||||
eglQueryDisplayAttribKHR = (PFNEGLQUERYDISPLAYATTRIBKHRPROC)load("eglQueryDisplayAttribKHR", userptr);
|
||||
}
|
||||
|
||||
static int get_exts(EGLDisplay display, const char **extensions)
|
||||
{
|
||||
*extensions = eglQueryString(display, EGL_EXTENSIONS);
|
||||
|
||||
return extensions != NULL;
|
||||
}
|
||||
|
||||
static int has_ext(const char *extensions, const char *ext)
|
||||
{
|
||||
const char *loc;
|
||||
const char *terminator;
|
||||
if (extensions == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
loc = strstr(extensions, ext);
|
||||
if (loc == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
terminator = loc + strlen(ext);
|
||||
if ((loc == extensions || *(loc - 1) == ' ') &&
|
||||
(*terminator == ' ' || *terminator == '\0'))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
extensions = terminator;
|
||||
}
|
||||
}
|
||||
|
||||
static GLADapiproc glad_egl_get_proc_from_userptr(const char *name, void *userptr)
|
||||
{
|
||||
return (GLAD_GNUC_EXTENSION(GLADapiproc(*)(const char *name)) userptr)(name);
|
||||
}
|
||||
|
||||
static int find_extensionsEGL(EGLDisplay display)
|
||||
{
|
||||
const char *extensions;
|
||||
if (!get_exts(display, &extensions)) return 0;
|
||||
|
||||
GLAD_EGL_EXT_platform_device = has_ext(extensions, "EGL_EXT_platform_device");
|
||||
GLAD_EGL_EXT_platform_base = has_ext(extensions, "EGL_EXT_platform_base");
|
||||
GLAD_EGL_NV_device_cuda = has_ext(extensions, "EGL_NV_device_cuda");
|
||||
GLAD_EGL_EXT_device_enumeration = has_ext(extensions, "EGL_EXT_device_enumeration");
|
||||
GLAD_EGL_EXT_device_query = has_ext(extensions, "EGL_EXT_device_query");
|
||||
GLAD_EGL_EXT_device_base = has_ext(extensions, "EGL_EXT_device_base");
|
||||
GLAD_EGL_NV_cuda_event = has_ext(extensions, "EGL_NV_cuda_event");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int find_coreEGL(EGLDisplay display)
|
||||
{
|
||||
int major, minor;
|
||||
const char *version;
|
||||
|
||||
if (display == NULL)
|
||||
{
|
||||
display = EGL_NO_DISPLAY; /* this is usually NULL, better safe than sorry */
|
||||
}
|
||||
if (display == EGL_NO_DISPLAY)
|
||||
{
|
||||
display = eglGetCurrentDisplay();
|
||||
}
|
||||
if (display == EGL_NO_DISPLAY)
|
||||
{
|
||||
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
}
|
||||
if (display == EGL_NO_DISPLAY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
version = eglQueryString(display, EGL_VERSION);
|
||||
(void)eglGetError();
|
||||
|
||||
if (version == NULL)
|
||||
{
|
||||
major = 1;
|
||||
minor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor);
|
||||
}
|
||||
|
||||
GLAD_EGL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||
GLAD_EGL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||
GLAD_EGL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||
GLAD_EGL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||
GLAD_EGL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||
GLAD_EGL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
|
||||
|
||||
return GLAD_MAKE_VERSION(major, minor);
|
||||
}
|
||||
|
||||
int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr)
|
||||
{
|
||||
int version;
|
||||
eglGetDisplay = (PFNEGLGETDISPLAYPROC)load("eglGetDisplay", userptr);
|
||||
eglGetCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC)load("eglGetCurrentDisplay", userptr);
|
||||
eglQueryString = (PFNEGLQUERYSTRINGPROC)load("eglQueryString", userptr);
|
||||
eglGetError = (PFNEGLGETERRORPROC)load("eglGetError", userptr);
|
||||
if (eglGetDisplay == NULL || eglGetCurrentDisplay == NULL || eglQueryString == NULL || eglGetError == NULL) return 0;
|
||||
|
||||
version = find_coreEGL(display);
|
||||
if (!version) return 0;
|
||||
load_EGL_VERSION_1_0(load, userptr);
|
||||
load_EGL_VERSION_1_1(load, userptr);
|
||||
load_EGL_VERSION_1_2(load, userptr);
|
||||
load_EGL_VERSION_1_4(load, userptr);
|
||||
load_EGL_VERSION_1_5(load, userptr);
|
||||
|
||||
if (!find_extensionsEGL(display)) return 0;
|
||||
load_EGL_EXT_platform_base(load, userptr);
|
||||
load_EGL_EXT_device_enumeration(load, userptr);
|
||||
load_EGL_EXT_device_query(load, userptr);
|
||||
load_EGL_EXT_device_base(load, userptr);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
int gladLoadEGL(EGLDisplay display, GLADloadfunc load)
|
||||
{
|
||||
return gladLoadEGLUserPtr(display, glad_egl_get_proc_from_userptr, GLAD_GNUC_EXTENSION(void *) load);
|
||||
}
|
||||
|
||||
#ifdef GLAD_EGL
|
||||
|
||||
#ifndef GLAD_LOADER_LIBRARY_C_
|
||||
#define GLAD_LOADER_LIBRARY_C_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
static void *glad_get_dlopen_handle(const char *lib_names[], int length)
|
||||
{
|
||||
void *handle = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; ++i)
|
||||
{
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
#if GLAD_PLATFORM_UWP
|
||||
size_t buffer_size = (strlen(lib_names[i]) + 1) * sizeof(WCHAR);
|
||||
LPWSTR buffer = (LPWSTR)malloc(buffer_size);
|
||||
if (buffer != NULL)
|
||||
{
|
||||
int ret = MultiByteToWideChar(CP_ACP, 0, lib_names[i], -1, buffer, buffer_size);
|
||||
if (ret != 0)
|
||||
{
|
||||
handle = (void *)LoadPackagedLibrary(buffer, 0);
|
||||
}
|
||||
free((void *)buffer);
|
||||
}
|
||||
#else
|
||||
handle = (void *)LoadLibraryA(lib_names[i]);
|
||||
#endif
|
||||
#else
|
||||
handle = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
|
||||
#endif
|
||||
if (handle != NULL)
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void glad_close_dlopen_handle(void *handle)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
FreeLibrary((HMODULE)handle);
|
||||
#else
|
||||
dlclose(handle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static GLADapiproc glad_dlsym_handle(void *handle, const char *name)
|
||||
{
|
||||
if (handle == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
return (GLADapiproc)GetProcAddress((HMODULE)handle, name);
|
||||
#else
|
||||
return GLAD_GNUC_EXTENSION(GLADapiproc) dlsym(handle, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* GLAD_LOADER_LIBRARY_C_ */
|
||||
|
||||
struct _glad_egl_userptr
|
||||
{
|
||||
void *handle;
|
||||
PFNEGLGETPROCADDRESSPROC get_proc_address_ptr;
|
||||
};
|
||||
|
||||
static GLADapiproc glad_egl_get_proc(const char *name, void *vuserptr)
|
||||
{
|
||||
struct _glad_egl_userptr userptr = *(struct _glad_egl_userptr *)vuserptr;
|
||||
GLADapiproc result = NULL;
|
||||
|
||||
result = glad_dlsym_handle(userptr.handle, name);
|
||||
if (result == NULL)
|
||||
{
|
||||
result = GLAD_GNUC_EXTENSION(GLADapiproc) userptr.get_proc_address_ptr(name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void *_egl_handle = NULL;
|
||||
|
||||
int gladLoaderLoadEGL(EGLDisplay display)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
static const char *NAMES[] = {"libEGL.dylib"};
|
||||
#elif GLAD_PLATFORM_WIN32
|
||||
static const char *NAMES[] = {"libEGL.dll", "EGL.dll"};
|
||||
#else
|
||||
static const char *NAMES[] = {"libEGL.so.1", "libEGL.so"};
|
||||
#endif
|
||||
|
||||
int version = 0;
|
||||
int did_load = 0;
|
||||
struct _glad_egl_userptr userptr;
|
||||
|
||||
if (_egl_handle == NULL)
|
||||
{
|
||||
_egl_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
|
||||
did_load = _egl_handle != NULL;
|
||||
}
|
||||
|
||||
if (_egl_handle != NULL)
|
||||
{
|
||||
userptr.handle = _egl_handle;
|
||||
userptr.get_proc_address_ptr = (PFNEGLGETPROCADDRESSPROC)glad_dlsym_handle(_egl_handle, "eglGetProcAddress");
|
||||
if (userptr.get_proc_address_ptr != NULL)
|
||||
{
|
||||
version = gladLoadEGLUserPtr(display, glad_egl_get_proc, &userptr);
|
||||
}
|
||||
|
||||
if (!version && did_load)
|
||||
{
|
||||
glad_close_dlopen_handle(_egl_handle);
|
||||
_egl_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void gladLoaderUnloadEGL()
|
||||
{
|
||||
if (_egl_handle != NULL)
|
||||
{
|
||||
glad_close_dlopen_handle(_egl_handle);
|
||||
_egl_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GLAD_EGL */
|
||||
2590
Engine/lib/bullet/examples/ThirdPartyLibs/glad/gl.c
Normal file
2590
Engine/lib/bullet/examples/ThirdPartyLibs/glad/gl.c
Normal file
File diff suppressed because it is too large
Load diff
541
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/egl.h
Normal file
541
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/egl.h
Normal file
|
|
@ -0,0 +1,541 @@
|
|||
/**
|
||||
* Loader generated by glad 0.1.11a0 on Wed Jun 13 07:59:54 2018
|
||||
*
|
||||
* Generator: C/C++
|
||||
* Specification: egl
|
||||
* Extensions: 7
|
||||
*
|
||||
* APIs:
|
||||
* - egl=1.5
|
||||
*
|
||||
* Options:
|
||||
* - HEADER_ONLY = False
|
||||
* - DEBUG = False
|
||||
* - MX = False
|
||||
* - LOADER = True
|
||||
* - MX_GLOBAL = False
|
||||
* - ALIAS = False
|
||||
*
|
||||
* Commandline:
|
||||
* --api='egl=1.5' --extensions='EGL_EXT_platform_device,EGL_EXT_platform_base,EGL_NV_device_cuda,EGL_EXT_device_enumeration,EGL_EXT_device_query,EGL_EXT_device_base,EGL_NV_cuda_event' c --loader
|
||||
*
|
||||
* Online:
|
||||
* http://glad2.dav1d.de/#merge=off&api=egl%3D1.5&extensions=EGL_EXT_platform_device%2CEGL_EXT_platform_base%2CEGL_NV_device_cuda%2CEGL_EXT_device_enumeration%2CEGL_EXT_device_query%2CEGL_EXT_device_base%2CEGL_NV_cuda_event&generator=c&header_only=off&debug=off&mx=off&loader=on&mx_global=off&alias=off
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GLAD_EGL_H_
|
||||
#define GLAD_EGL_H_
|
||||
|
||||
#define GLAD_EGL
|
||||
#define GLAD_OPTION_EGL_LOADER
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifndef GLAD_PLATFORM_H_
|
||||
#define GLAD_PLATFORM_H_
|
||||
|
||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)
|
||||
#define GLAD_PLATFORM_WIN32 1
|
||||
#else
|
||||
#define GLAD_PLATFORM_WIN32 0
|
||||
#endif
|
||||
|
||||
#ifndef GLAD_PLATFORM_UWP
|
||||
#if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
|
||||
#ifdef __has_include
|
||||
#if __has_include(<winapifamily.h>)
|
||||
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
|
||||
#endif
|
||||
#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
|
||||
#define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
|
||||
#include <winapifamily.h>
|
||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
|
||||
#define GLAD_PLATFORM_UWP 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GLAD_PLATFORM_UWP
|
||||
#define GLAD_PLATFORM_UWP 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define GLAD_GNUC_EXTENSION __extension__
|
||||
#else
|
||||
#define GLAD_GNUC_EXTENSION
|
||||
#endif
|
||||
|
||||
#ifndef GLAD_API_CALL
|
||||
#if defined(GLAD_API_CALL_EXPORT)
|
||||
#if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
|
||||
#if defined(GLAD_API_CALL_EXPORT_BUILD)
|
||||
#if defined(__GNUC__)
|
||||
#define GLAD_API_CALL __attribute__((dllexport)) extern
|
||||
#else
|
||||
#define GLAD_API_CALL __declspec(dllexport) extern
|
||||
#endif
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define GLAD_API_CALL __attribute__((dllimport)) extern
|
||||
#else
|
||||
#define GLAD_API_CALL __declspec(dllimport) extern
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
|
||||
#define GLAD_API_CALL __attribute__((visibility("default"))) extern
|
||||
#else
|
||||
#define GLAD_API_CALL extern
|
||||
#endif
|
||||
#else
|
||||
#define GLAD_API_CALL extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef APIENTRY
|
||||
#define GLAD_API_PTR APIENTRY
|
||||
#elif GLAD_PLATFORM_WIN32
|
||||
#define GLAD_API_PTR __stdcall
|
||||
#else
|
||||
#define GLAD_API_PTR
|
||||
#endif
|
||||
|
||||
#define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
|
||||
#define GLAD_VERSION_MAJOR(version) (version / 10000)
|
||||
#define GLAD_VERSION_MINOR(version) (version % 10000)
|
||||
|
||||
typedef void (*GLADapiproc)(void);
|
||||
|
||||
typedef GLADapiproc (*GLADloadfunc)(const char *name);
|
||||
typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr);
|
||||
|
||||
typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
|
||||
typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
|
||||
|
||||
#endif /* GLAD_PLATFORM_H_ */
|
||||
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SYNC_TYPE 0x30F7
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_PBUFFER_BIT 0x0001
|
||||
#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_CONTEXT_LOST 0x300E
|
||||
#define EGL_BUFFER_PRESERVED 0x3094
|
||||
#define EGL_GL_COLORSPACE_LINEAR EGL_COLORSPACE_LINEAR
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_GL_RENDERBUFFER 0x30B9
|
||||
#define EGL_UNSIGNALED 0x30F3
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_GL_TEXTURE_2D 0x30B1
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_SYNC_CONDITION 0x30F8
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
#define EGL_PIXMAP_BIT 0x0002
|
||||
#define EGL_SLOW_CONFIG 0x3050
|
||||
#define EGL_CL_EVENT_HANDLE 0x309C
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_VG_COLORSPACE_sRGB EGL_COLORSPACE_sRGB
|
||||
#define EGL_IMAGE_PRESERVED 0x30D2
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_OPENVG_BIT 0x0002
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_DEVICE_EXT 0x322C
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_NO_CONTEXT EGL_CAST(EGLContext, 0)
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F
|
||||
#define EGL_NO_RESET_NOTIFICATION 0x31BE
|
||||
#define EGL_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_OPENGL_ES_BIT 0x0001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
|
||||
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay, 0)
|
||||
#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT, 0)
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
|
||||
#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
|
||||
#define EGL_CUDA_DEVICE_NV 0x323A
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
|
||||
#define EGL_COLORSPACE EGL_VG_COLORSPACE
|
||||
#define EGL_SYNC_CUDA_EVENT_NV 0x323C
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
#define EGL_NO_IMAGE EGL_CAST(EGLImage, 0)
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType, 0)
|
||||
#define EGL_SIGNALED 0x30F2
|
||||
#define EGL_GL_COLORSPACE 0x309D
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_TRANSPARENT_RGB 0x3052
|
||||
#define EGL_SYNC_FENCE 0x30F9
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
|
||||
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFF
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
#define EGL_WINDOW_BIT 0x0004
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_VG_COLORSPACE_LINEAR EGL_COLORSPACE_LINEAR
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_CONDITION_SATISFIED 0x30F6
|
||||
#define EGL_SYNC_CL_EVENT 0x30FE
|
||||
#define EGL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_NONE 0x3038
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_PLATFORM_DEVICE_EXT 0x313F
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_BAD_DEVICE_EXT 0x322B
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_GL_TEXTURE_3D 0x30B2
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
|
||||
#define EGL_SYNC_STATUS 0x30F1
|
||||
#define EGL_TRUE 1
|
||||
#define EGL_TIMEOUT_EXPIRED 0x30F5
|
||||
#define EGL_NO_SURFACE EGL_CAST(EGLSurface, 0)
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
|
||||
#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
|
||||
#define EGL_UNKNOWN EGL_CAST(EGLint, -1)
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
|
||||
#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_CONTEXT_MAJOR_VERSION EGL_CONTEXT_CLIENT_VERSION
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
||||
#define EGL_READ 0x305A
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_RGB_BUFFER 0x308E
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_CONTEXT_MINOR_VERSION 0x30FB
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_BUFFER_DESTROYED 0x3095
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_OPENGL_BIT 0x0008
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENGL_ES3_BIT 0x00000040
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
#define EGL_GL_TEXTURE_LEVEL 0x30BC
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_NO_SYNC EGL_CAST(EGLSync, 0)
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_DONT_CARE EGL_CAST(EGLint, -1)
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
|
||||
#define EGL_GL_COLORSPACE_SRGB EGL_COLORSPACE_sRGB
|
||||
#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
struct AHardwareBuffer;
|
||||
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef unsigned int EGLenum;
|
||||
typedef intptr_t EGLAttribKHR;
|
||||
typedef intptr_t EGLAttrib;
|
||||
typedef void *EGLClientBuffer;
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLContext;
|
||||
typedef void *EGLDeviceEXT;
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLImage;
|
||||
typedef void *EGLImageKHR;
|
||||
typedef void *EGLLabelKHR;
|
||||
typedef void *EGLObjectKHR;
|
||||
typedef void *EGLOutputLayerEXT;
|
||||
typedef void *EGLOutputPortEXT;
|
||||
typedef void *EGLStreamKHR;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLSync;
|
||||
typedef void *EGLSyncKHR;
|
||||
typedef void *EGLSyncNV;
|
||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
typedef khronos_utime_nanoseconds_t EGLTime;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
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);
|
||||
struct EGLClientPixmapHI
|
||||
{
|
||||
void *pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
typedef void(GLAD_API_PTR *EGLDEBUGPROCKHR)(EGLenum error, const char *command, EGLint messageType, EGLLabelKHR threadLabel, EGLLabelKHR objectLabel, const char *message);
|
||||
|
||||
#define EGL_VERSION_1_0 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_0;
|
||||
#define EGL_VERSION_1_1 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_1;
|
||||
#define EGL_VERSION_1_2 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_2;
|
||||
#define EGL_VERSION_1_3 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_3;
|
||||
#define EGL_VERSION_1_4 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_4;
|
||||
#define EGL_VERSION_1_5 1
|
||||
GLAD_API_CALL int GLAD_EGL_VERSION_1_5;
|
||||
#define EGL_EXT_platform_device 1
|
||||
GLAD_API_CALL int GLAD_EGL_EXT_platform_device;
|
||||
#define EGL_EXT_platform_base 1
|
||||
GLAD_API_CALL int GLAD_EGL_EXT_platform_base;
|
||||
#define EGL_NV_device_cuda 1
|
||||
GLAD_API_CALL int GLAD_EGL_NV_device_cuda;
|
||||
#define EGL_EXT_device_enumeration 1
|
||||
GLAD_API_CALL int GLAD_EGL_EXT_device_enumeration;
|
||||
#define EGL_EXT_device_query 1
|
||||
GLAD_API_CALL int GLAD_EGL_EXT_device_query;
|
||||
#define EGL_EXT_device_base 1
|
||||
GLAD_API_CALL int GLAD_EGL_EXT_device_base;
|
||||
#define EGL_NV_cuda_event 1
|
||||
GLAD_API_CALL int GLAD_EGL_NV_cuda_event;
|
||||
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDEVICESEXTPROC)(EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPBUFFERSURFACEPROC)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
typedef EGLint(GLAD_API_PTR *PFNEGLGETERRORPROC)(void);
|
||||
typedef __eglMustCastToProperFunctionPointerType(GLAD_API_PTR *PFNEGLGETPROCADDRESSPROC)(const char *procname);
|
||||
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETCURRENTDISPLAYPROC)(void);
|
||||
typedef EGLenum(GLAD_API_PTR *PFNEGLQUERYAPIPROC)(void);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBKHRPROC)(EGLDisplay dpy, EGLint name, EGLAttrib *value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYSYNCPROC)(EGLDisplay dpy, EGLSync sync);
|
||||
typedef EGLImage(GLAD_API_PTR *PFNEGLCREATEIMAGEPROC)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLContext(GLAD_API_PTR *PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLBINDAPIPROC)(EGLenum api);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITNATIVEPROC)(EGLint engine);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLTERMINATEPROC)(EGLDisplay dpy);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLRELEASETHREADPROC)(void);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETCONFIGATTRIBPROC)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLGETCURRENTSURFACEPROC)(EGLint readdraw);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLCOPYBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDEVICEATTRIBEXTPROC)(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPIXMAPSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLBINDTEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETPLATFORMDISPLAYPROC)(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
||||
typedef EGLDisplay(GLAD_API_PTR *PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
|
||||
typedef const char *(GLAD_API_PTR *PFNEGLQUERYSTRINGPROC)(EGLDisplay dpy, EGLint name);
|
||||
typedef EGLint(GLAD_API_PTR *PFNEGLCLIENTWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITSYNCPROC)(EGLDisplay dpy, EGLSync sync, EGLint flags);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYIMAGEPROC)(EGLDisplay dpy, EGLImage image);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLRELEASETEXIMAGEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYDISPLAYATTRIBEXTPROC)(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
|
||||
typedef const char *(GLAD_API_PTR *PFNEGLQUERYDEVICESTRINGEXTPROC)(EGLDeviceEXT device, EGLint name);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
typedef EGLContext(GLAD_API_PTR *PFNEGLGETCURRENTCONTEXTPROC)(void);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
|
||||
typedef EGLSync(GLAD_API_PTR *PFNEGLCREATESYNCPROC)(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETSYNCATTRIBPROC)(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLSURFACEATTRIBPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITGLPROC)(void);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLQUERYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLGETCONFIGSPROC)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLBoolean(GLAD_API_PTR *PFNEGLWAITCLIENTPROC)(void);
|
||||
typedef EGLSurface(GLAD_API_PTR *PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
GLAD_API_CALL PFNEGLQUERYDEVICESEXTPROC glad_eglQueryDevicesEXT;
|
||||
#define eglQueryDevicesEXT glad_eglQueryDevicesEXT
|
||||
GLAD_API_CALL PFNEGLCREATEPBUFFERSURFACEPROC glad_eglCreatePbufferSurface;
|
||||
#define eglCreatePbufferSurface glad_eglCreatePbufferSurface
|
||||
GLAD_API_CALL PFNEGLGETERRORPROC glad_eglGetError;
|
||||
#define eglGetError glad_eglGetError
|
||||
GLAD_API_CALL PFNEGLGETPROCADDRESSPROC glad_eglGetProcAddress;
|
||||
#define eglGetProcAddress glad_eglGetProcAddress
|
||||
GLAD_API_CALL PFNEGLGETCURRENTDISPLAYPROC glad_eglGetCurrentDisplay;
|
||||
#define eglGetCurrentDisplay glad_eglGetCurrentDisplay
|
||||
GLAD_API_CALL PFNEGLQUERYAPIPROC glad_eglQueryAPI;
|
||||
#define eglQueryAPI glad_eglQueryAPI
|
||||
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC glad_eglCreatePlatformPixmapSurface;
|
||||
#define eglCreatePlatformPixmapSurface glad_eglCreatePlatformPixmapSurface
|
||||
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBKHRPROC glad_eglQueryDisplayAttribKHR;
|
||||
#define eglQueryDisplayAttribKHR glad_eglQueryDisplayAttribKHR
|
||||
GLAD_API_CALL PFNEGLDESTROYSYNCPROC glad_eglDestroySync;
|
||||
#define eglDestroySync glad_eglDestroySync
|
||||
GLAD_API_CALL PFNEGLCREATEIMAGEPROC glad_eglCreateImage;
|
||||
#define eglCreateImage glad_eglCreateImage
|
||||
GLAD_API_CALL PFNEGLQUERYCONTEXTPROC glad_eglQueryContext;
|
||||
#define eglQueryContext glad_eglQueryContext
|
||||
GLAD_API_CALL PFNEGLSWAPBUFFERSPROC glad_eglSwapBuffers;
|
||||
#define eglSwapBuffers glad_eglSwapBuffers
|
||||
GLAD_API_CALL PFNEGLCREATECONTEXTPROC glad_eglCreateContext;
|
||||
#define eglCreateContext glad_eglCreateContext
|
||||
GLAD_API_CALL PFNEGLCHOOSECONFIGPROC glad_eglChooseConfig;
|
||||
#define eglChooseConfig glad_eglChooseConfig
|
||||
GLAD_API_CALL PFNEGLBINDAPIPROC glad_eglBindAPI;
|
||||
#define eglBindAPI glad_eglBindAPI
|
||||
GLAD_API_CALL PFNEGLWAITNATIVEPROC glad_eglWaitNative;
|
||||
#define eglWaitNative glad_eglWaitNative
|
||||
GLAD_API_CALL PFNEGLTERMINATEPROC glad_eglTerminate;
|
||||
#define eglTerminate glad_eglTerminate
|
||||
GLAD_API_CALL PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC glad_eglCreatePlatformPixmapSurfaceEXT;
|
||||
#define eglCreatePlatformPixmapSurfaceEXT glad_eglCreatePlatformPixmapSurfaceEXT
|
||||
GLAD_API_CALL PFNEGLRELEASETHREADPROC glad_eglReleaseThread;
|
||||
#define eglReleaseThread glad_eglReleaseThread
|
||||
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEPROC glad_eglCreatePlatformWindowSurface;
|
||||
#define eglCreatePlatformWindowSurface glad_eglCreatePlatformWindowSurface
|
||||
GLAD_API_CALL PFNEGLGETCONFIGATTRIBPROC glad_eglGetConfigAttrib;
|
||||
#define eglGetConfigAttrib glad_eglGetConfigAttrib
|
||||
GLAD_API_CALL PFNEGLGETCURRENTSURFACEPROC glad_eglGetCurrentSurface;
|
||||
#define eglGetCurrentSurface glad_eglGetCurrentSurface
|
||||
GLAD_API_CALL PFNEGLCOPYBUFFERSPROC glad_eglCopyBuffers;
|
||||
#define eglCopyBuffers glad_eglCopyBuffers
|
||||
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYEXTPROC glad_eglGetPlatformDisplayEXT;
|
||||
#define eglGetPlatformDisplayEXT glad_eglGetPlatformDisplayEXT
|
||||
GLAD_API_CALL PFNEGLQUERYDEVICEATTRIBEXTPROC glad_eglQueryDeviceAttribEXT;
|
||||
#define eglQueryDeviceAttribEXT glad_eglQueryDeviceAttribEXT
|
||||
GLAD_API_CALL PFNEGLCREATEPIXMAPSURFACEPROC glad_eglCreatePixmapSurface;
|
||||
#define eglCreatePixmapSurface glad_eglCreatePixmapSurface
|
||||
GLAD_API_CALL PFNEGLBINDTEXIMAGEPROC glad_eglBindTexImage;
|
||||
#define eglBindTexImage glad_eglBindTexImage
|
||||
GLAD_API_CALL PFNEGLGETPLATFORMDISPLAYPROC glad_eglGetPlatformDisplay;
|
||||
#define eglGetPlatformDisplay glad_eglGetPlatformDisplay
|
||||
GLAD_API_CALL PFNEGLGETDISPLAYPROC glad_eglGetDisplay;
|
||||
#define eglGetDisplay glad_eglGetDisplay
|
||||
GLAD_API_CALL PFNEGLQUERYSTRINGPROC glad_eglQueryString;
|
||||
#define eglQueryString glad_eglQueryString
|
||||
GLAD_API_CALL PFNEGLCLIENTWAITSYNCPROC glad_eglClientWaitSync;
|
||||
#define eglClientWaitSync glad_eglClientWaitSync
|
||||
GLAD_API_CALL PFNEGLWAITSYNCPROC glad_eglWaitSync;
|
||||
#define eglWaitSync glad_eglWaitSync
|
||||
GLAD_API_CALL PFNEGLDESTROYIMAGEPROC glad_eglDestroyImage;
|
||||
#define eglDestroyImage glad_eglDestroyImage
|
||||
GLAD_API_CALL PFNEGLRELEASETEXIMAGEPROC glad_eglReleaseTexImage;
|
||||
#define eglReleaseTexImage glad_eglReleaseTexImage
|
||||
GLAD_API_CALL PFNEGLQUERYDISPLAYATTRIBEXTPROC glad_eglQueryDisplayAttribEXT;
|
||||
#define eglQueryDisplayAttribEXT glad_eglQueryDisplayAttribEXT
|
||||
GLAD_API_CALL PFNEGLDESTROYCONTEXTPROC glad_eglDestroyContext;
|
||||
#define eglDestroyContext glad_eglDestroyContext
|
||||
GLAD_API_CALL PFNEGLQUERYDEVICESTRINGEXTPROC glad_eglQueryDeviceStringEXT;
|
||||
#define eglQueryDeviceStringEXT glad_eglQueryDeviceStringEXT
|
||||
GLAD_API_CALL PFNEGLCREATEWINDOWSURFACEPROC glad_eglCreateWindowSurface;
|
||||
#define eglCreateWindowSurface glad_eglCreateWindowSurface
|
||||
GLAD_API_CALL PFNEGLGETCURRENTCONTEXTPROC glad_eglGetCurrentContext;
|
||||
#define eglGetCurrentContext glad_eglGetCurrentContext
|
||||
GLAD_API_CALL PFNEGLINITIALIZEPROC glad_eglInitialize;
|
||||
#define eglInitialize glad_eglInitialize
|
||||
GLAD_API_CALL PFNEGLDESTROYSURFACEPROC glad_eglDestroySurface;
|
||||
#define eglDestroySurface glad_eglDestroySurface
|
||||
GLAD_API_CALL PFNEGLMAKECURRENTPROC glad_eglMakeCurrent;
|
||||
#define eglMakeCurrent glad_eglMakeCurrent
|
||||
GLAD_API_CALL PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC glad_eglCreatePlatformWindowSurfaceEXT;
|
||||
#define eglCreatePlatformWindowSurfaceEXT glad_eglCreatePlatformWindowSurfaceEXT
|
||||
GLAD_API_CALL PFNEGLSWAPINTERVALPROC glad_eglSwapInterval;
|
||||
#define eglSwapInterval glad_eglSwapInterval
|
||||
GLAD_API_CALL PFNEGLCREATESYNCPROC glad_eglCreateSync;
|
||||
#define eglCreateSync glad_eglCreateSync
|
||||
GLAD_API_CALL PFNEGLGETSYNCATTRIBPROC glad_eglGetSyncAttrib;
|
||||
#define eglGetSyncAttrib glad_eglGetSyncAttrib
|
||||
GLAD_API_CALL PFNEGLSURFACEATTRIBPROC glad_eglSurfaceAttrib;
|
||||
#define eglSurfaceAttrib glad_eglSurfaceAttrib
|
||||
GLAD_API_CALL PFNEGLWAITGLPROC glad_eglWaitGL;
|
||||
#define eglWaitGL glad_eglWaitGL
|
||||
GLAD_API_CALL PFNEGLQUERYSURFACEPROC glad_eglQuerySurface;
|
||||
#define eglQuerySurface glad_eglQuerySurface
|
||||
GLAD_API_CALL PFNEGLGETCONFIGSPROC glad_eglGetConfigs;
|
||||
#define eglGetConfigs glad_eglGetConfigs
|
||||
GLAD_API_CALL PFNEGLWAITCLIENTPROC glad_eglWaitClient;
|
||||
#define eglWaitClient glad_eglWaitClient
|
||||
GLAD_API_CALL PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC glad_eglCreatePbufferFromClientBuffer;
|
||||
#define eglCreatePbufferFromClientBuffer glad_eglCreatePbufferFromClientBuffer
|
||||
|
||||
GLAD_API_CALL int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void *userptr);
|
||||
GLAD_API_CALL int gladLoadEGL(EGLDisplay display, GLADloadfunc load);
|
||||
|
||||
#ifdef GLAD_EGL
|
||||
|
||||
GLAD_API_CALL int gladLoaderLoadEGL(EGLDisplay display);
|
||||
|
||||
GLAD_API_CALL void gladLoaderUnloadEGL(void);
|
||||
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
5233
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/gl.h
Normal file
5233
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/gl.h
Normal file
File diff suppressed because it is too large
Load diff
1111
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/glx.h
Normal file
1111
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glad/glx.h
Normal file
File diff suppressed because it is too large
Load diff
876
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glx.c
Normal file
876
Engine/lib/bullet/examples/ThirdPartyLibs/glad/glx.c
Normal file
|
|
@ -0,0 +1,876 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glad/glx.h>
|
||||
#ifdef DYNAMIC_LOAD_X11_FUNCTIONS
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
typedef Display* (*PFNXOPENDISPLAY)(_Xconst char* a);
|
||||
typedef Screen* (*PFNXDEFAULTSCREENOFDISPLAY)(Display*);
|
||||
typedef int (*PFNXSCREENNUMBEROFSCREEN)(Screen*);
|
||||
typedef struct
|
||||
{
|
||||
void* library;
|
||||
PFNXOPENDISPLAY XOpenDisplay;
|
||||
PFNXDEFAULTSCREENOFDISPLAY XDefaultScreenOfDisplay;
|
||||
PFNXSCREENNUMBEROFSCREEN XScreenNumberOfScreen;
|
||||
} X11Struct;
|
||||
#ifdef DYNAMIC_LOAD_X11_FUNCTIONS
|
||||
void initX11Struct(X11Struct* x11)
|
||||
{
|
||||
const char* X11_LIBRARY = "libX11.so.6";
|
||||
x11->library = dlopen(X11_LIBRARY, RTLD_LOCAL | RTLD_NOW);
|
||||
if (!x11->library)
|
||||
{
|
||||
fprintf(stderr, "Error opening X11 library %s\n", X11_LIBRARY);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
int missingFunc = 0;
|
||||
missingFunc = ((x11->XOpenDisplay = (PFNXOPENDISPLAY)dlsym(x11->library, "XOpenDisplay")) == NULL) | missingFunc;
|
||||
if (missingFunc)
|
||||
{
|
||||
fprintf(stderr, "Error: missing func XOpenDisplay in %s, exiting!\n", X11_LIBRARY);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
missingFunc = ((x11->XDefaultScreenOfDisplay = (PFNXDEFAULTSCREENOFDISPLAY)dlsym(x11->library, "XDefaultScreenOfDisplay")) == NULL) | missingFunc;
|
||||
if (missingFunc)
|
||||
{
|
||||
fprintf(stderr, "Error: missing func XScreenNumberOfScreen in %s, exiting!\n", X11_LIBRARY);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
missingFunc = ((x11->XScreenNumberOfScreen = (PFNXSCREENNUMBEROFSCREEN)dlsym(x11->library, "XScreenNumberOfScreen")) == NULL) | missingFunc;
|
||||
if (missingFunc)
|
||||
{
|
||||
fprintf(stderr, "Error: missing func XScreenNumberOfScreen in %s, exiting!\n", X11_LIBRARY);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (!missingFunc)
|
||||
{
|
||||
printf("X11 functions dynamically loaded using dlopen/dlsym OK!\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
void initX11Struct(X11Struct* x11)
|
||||
{
|
||||
x11->XOpenDisplay = XOpenDisplay;
|
||||
x11->XDefaultScreenOfDisplay = XDefaultScreenOfDisplay;
|
||||
x11->XScreenNumberOfScreen = XScreenNumberOfScreen;
|
||||
}
|
||||
#endif // DYNAMIC_LOAD_X11_FUNCTIONS
|
||||
|
||||
#ifndef GLAD_IMPL_UTIL_C_
|
||||
#define GLAD_IMPL_UTIL_C_
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy_s(dest, len, source, len - 1);
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_STRNCPY(dest, source, len) strncpy(dest, source, len);
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf_s
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf
|
||||
#endif
|
||||
|
||||
#endif /* GLAD_IMPL_UTIL_C_ */
|
||||
|
||||
int GLAD_GLX_VERSION_1_0;
|
||||
int GLAD_GLX_VERSION_1_1;
|
||||
int GLAD_GLX_VERSION_1_2;
|
||||
int GLAD_GLX_VERSION_1_3;
|
||||
int GLAD_GLX_VERSION_1_4;
|
||||
int GLAD_GLX_MESA_copy_sub_buffer;
|
||||
int GLAD_GLX_EXT_create_context_es_profile;
|
||||
int GLAD_GLX_SGIX_pbuffer;
|
||||
int GLAD_GLX_SGI_make_current_read;
|
||||
int GLAD_GLX_OML_sync_control;
|
||||
int GLAD_GLX_SGIX_hyperpipe;
|
||||
int GLAD_GLX_INTEL_swap_event;
|
||||
int GLAD_GLX_EXT_swap_control;
|
||||
int GLAD_GLX_NV_robustness_video_memory_purge;
|
||||
int GLAD_GLX_MESA_pixmap_colormap;
|
||||
int GLAD_GLX_ARB_fbconfig_float;
|
||||
int GLAD_GLX_EXT_fbconfig_packed_float;
|
||||
int GLAD_GLX_OML_swap_method;
|
||||
int GLAD_GLX_NV_video_capture;
|
||||
int GLAD_GLX_ARB_robustness_application_isolation;
|
||||
int GLAD_GLX_ARB_create_context_robustness;
|
||||
int GLAD_GLX_EXT_visual_rating;
|
||||
int GLAD_GLX_NV_swap_group;
|
||||
int GLAD_GLX_EXT_texture_from_pixmap;
|
||||
int GLAD_GLX_SUN_get_transparent_index;
|
||||
int GLAD_GLX_MESA_release_buffers;
|
||||
int GLAD_GLX_NV_delay_before_swap;
|
||||
int GLAD_GLX_EXT_buffer_age;
|
||||
int GLAD_GLX_MESA_agp_offset;
|
||||
int GLAD_GLX_EXT_visual_info;
|
||||
int GLAD_GLX_SGI_swap_control;
|
||||
int GLAD_GLX_EXT_import_context;
|
||||
int GLAD_GLX_SGI_video_sync;
|
||||
int GLAD_GLX_3DFX_multisample;
|
||||
int GLAD_GLX_ARB_multisample;
|
||||
int GLAD_GLX_EXT_framebuffer_sRGB;
|
||||
int GLAD_GLX_SGI_cushion;
|
||||
int GLAD_GLX_ARB_robustness_share_group_isolation;
|
||||
int GLAD_GLX_SGIX_fbconfig;
|
||||
int GLAD_GLX_NV_copy_buffer;
|
||||
int GLAD_GLX_SGIX_visual_select_group;
|
||||
int GLAD_GLX_EXT_swap_control_tear;
|
||||
int GLAD_GLX_ARB_create_context;
|
||||
int GLAD_GLX_AMD_gpu_association;
|
||||
int GLAD_GLX_MESA_query_renderer;
|
||||
int GLAD_GLX_EXT_create_context_es2_profile;
|
||||
int GLAD_GLX_MESA_swap_control;
|
||||
int GLAD_GLX_SGIX_video_resize;
|
||||
int GLAD_GLX_ARB_context_flush_control;
|
||||
int GLAD_GLX_NV_video_out;
|
||||
int GLAD_GLX_EXT_no_config_context;
|
||||
int GLAD_GLX_SGIS_blended_overlay;
|
||||
int GLAD_GLX_EXT_stereo_tree;
|
||||
int GLAD_GLX_ARB_create_context_no_error;
|
||||
int GLAD_GLX_EXT_libglvnd;
|
||||
int GLAD_GLX_ARB_create_context_profile;
|
||||
int GLAD_GLX_NV_float_buffer;
|
||||
int GLAD_GLX_MESA_set_3dfx_mode;
|
||||
int GLAD_GLX_ARB_framebuffer_sRGB;
|
||||
int GLAD_GLX_ARB_get_proc_address;
|
||||
int GLAD_GLX_SGIS_shared_multisample;
|
||||
int GLAD_GLX_NV_copy_image;
|
||||
int GLAD_GLX_NV_present_video;
|
||||
int GLAD_GLX_SGIX_swap_barrier;
|
||||
int GLAD_GLX_SGIS_multisample;
|
||||
int GLAD_GLX_SGIX_swap_group;
|
||||
int GLAD_GLX_ARB_vertex_buffer_object;
|
||||
int GLAD_GLX_NV_multisample_coverage;
|
||||
|
||||
PFNGLXCUSHIONSGIPROC glad_glXCushionSGI;
|
||||
PFNGLXDESTROYGLXPBUFFERSGIXPROC glad_glXDestroyGLXPbufferSGIX;
|
||||
PFNGLXSENDPBUFFERTOVIDEONVPROC glad_glXSendPbufferToVideoNV;
|
||||
PFNGLXGETPROCADDRESSARBPROC glad_glXGetProcAddressARB;
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glad_glXCreateContextAttribsARB;
|
||||
PFNGLXJOINSWAPGROUPSGIXPROC glad_glXJoinSwapGroupSGIX;
|
||||
PFNGLXSWAPINTERVALEXTPROC glad_glXSwapIntervalEXT;
|
||||
PFNGLXQUERYHYPERPIPECONFIGSGIXPROC glad_glXQueryHyperpipeConfigSGIX;
|
||||
PFNGLXGETGPUINFOAMDPROC glad_glXGetGPUInfoAMD;
|
||||
PFNGLXGETTRANSPARENTINDEXSUNPROC glad_glXGetTransparentIndexSUN;
|
||||
PFNGLXQUERYHYPERPIPENETWORKSGIXPROC glad_glXQueryHyperpipeNetworkSGIX;
|
||||
PFNGLXQUERYGLXPBUFFERSGIXPROC glad_glXQueryGLXPbufferSGIX;
|
||||
PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC glad_glXCreateGLXPixmapWithConfigSGIX;
|
||||
PFNGLXCOPYCONTEXTPROC glad_glXCopyContext;
|
||||
PFNGLXCREATEGLXPBUFFERSGIXPROC glad_glXCreateGLXPbufferSGIX;
|
||||
PFNGLXGETGPUIDSAMDPROC glad_glXGetGPUIDsAMD;
|
||||
PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC glad_glXDeleteAssociatedContextAMD;
|
||||
PFNGLXGETVIDEODEVICENVPROC glad_glXGetVideoDeviceNV;
|
||||
PFNGLXWAITGLPROC glad_glXWaitGL;
|
||||
PFNGLXGETVIDEOSYNCSGIPROC glad_glXGetVideoSyncSGI;
|
||||
PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC glad_glXDestroyHyperpipeConfigSGIX;
|
||||
PFNGLXHYPERPIPECONFIGSGIXPROC glad_glXHyperpipeConfigSGIX;
|
||||
PFNGLXSWAPBUFFERSMSCOMLPROC glad_glXSwapBuffersMscOML;
|
||||
PFNGLXCHOOSEFBCONFIGSGIXPROC glad_glXChooseFBConfigSGIX;
|
||||
PFNGLXWAITVIDEOSYNCSGIPROC glad_glXWaitVideoSyncSGI;
|
||||
PFNGLXWAITFORSBCOMLPROC glad_glXWaitForSbcOML;
|
||||
PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress;
|
||||
PFNGLXGETSWAPINTERVALMESAPROC glad_glXGetSwapIntervalMESA;
|
||||
PFNGLXCHANNELRECTSGIXPROC glad_glXChannelRectSGIX;
|
||||
PFNGLXWAITXPROC glad_glXWaitX;
|
||||
PFNGLXQUERYSERVERSTRINGPROC glad_glXQueryServerString;
|
||||
PFNGLXCREATEGLXPIXMAPPROC glad_glXCreateGLXPixmap;
|
||||
PFNGLXBINDSWAPBARRIERNVPROC glad_glXBindSwapBarrierNV;
|
||||
PFNGLXQUERYRENDERERSTRINGMESAPROC glad_glXQueryRendererStringMESA;
|
||||
PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC glad_glXReleaseVideoCaptureDeviceNV;
|
||||
PFNGLXWAITFORMSCOMLPROC glad_glXWaitForMscOML;
|
||||
PFNGLXCOPYSUBBUFFERMESAPROC glad_glXCopySubBufferMESA;
|
||||
PFNGLXGETCURRENTCONTEXTPROC glad_glXGetCurrentContext;
|
||||
PFNGLXSELECTEVENTPROC glad_glXSelectEvent;
|
||||
PFNGLXSWAPINTERVALSGIPROC glad_glXSwapIntervalSGI;
|
||||
PFNGLXQUERYSWAPGROUPNVPROC glad_glXQuerySwapGroupNV;
|
||||
PFNGLXMAKECURRENTREADSGIPROC glad_glXMakeCurrentReadSGI;
|
||||
PFNGLXQUERYDRAWABLEPROC glad_glXQueryDrawable;
|
||||
PFNGLXCOPYBUFFERSUBDATANVPROC glad_glXCopyBufferSubDataNV;
|
||||
PFNGLXQUERYCONTEXTPROC glad_glXQueryContext;
|
||||
PFNGLXGETCONFIGPROC glad_glXGetConfig;
|
||||
PFNGLXSET3DFXMODEMESAPROC glad_glXSet3DfxModeMESA;
|
||||
PFNGLXGETVIDEOINFONVPROC glad_glXGetVideoInfoNV;
|
||||
PFNGLXISDIRECTPROC glad_glXIsDirect;
|
||||
PFNGLXGETFBCONFIGATTRIBPROC glad_glXGetFBConfigAttrib;
|
||||
PFNGLXGETVISUALFROMFBCONFIGPROC glad_glXGetVisualFromFBConfig;
|
||||
PFNGLXBINDTEXIMAGEEXTPROC glad_glXBindTexImageEXT;
|
||||
PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC glad_glXBlitContextFramebufferAMD;
|
||||
PFNGLXQUERYVERSIONPROC glad_glXQueryVersion;
|
||||
PFNGLXSELECTEVENTSGIXPROC glad_glXSelectEventSGIX;
|
||||
PFNGLXGETMSCRATEOMLPROC glad_glXGetMscRateOML;
|
||||
PFNGLXQUERYRENDERERINTEGERMESAPROC glad_glXQueryRendererIntegerMESA;
|
||||
PFNGLXCREATEWINDOWPROC glad_glXCreateWindow;
|
||||
PFNGLXCOPYIMAGESUBDATANVPROC glad_glXCopyImageSubDataNV;
|
||||
PFNGLXSWAPINTERVALMESAPROC glad_glXSwapIntervalMESA;
|
||||
PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC glad_glXQueryHyperpipeAttribSGIX;
|
||||
PFNGLXBINDVIDEOCAPTUREDEVICENVPROC glad_glXBindVideoCaptureDeviceNV;
|
||||
PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC glad_glXCreateContextWithConfigSGIX;
|
||||
PFNGLXENUMERATEVIDEODEVICESNVPROC glad_glXEnumerateVideoDevicesNV;
|
||||
PFNGLXHYPERPIPEATTRIBSGIXPROC glad_glXHyperpipeAttribSGIX;
|
||||
PFNGLXDESTROYPBUFFERPROC glad_glXDestroyPbuffer;
|
||||
PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC glad_glXNamedCopyBufferSubDataNV;
|
||||
PFNGLXCREATEPBUFFERPROC glad_glXCreatePbuffer;
|
||||
PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC glad_glXQueryCurrentRendererStringMESA;
|
||||
PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC glad_glXQueryHyperpipeBestAttribSGIX;
|
||||
PFNGLXGETFBCONFIGATTRIBSGIXPROC glad_glXGetFBConfigAttribSGIX;
|
||||
PFNGLXQUERYEXTENSIONSSTRINGPROC glad_glXQueryExtensionsString;
|
||||
PFNGLXBINDVIDEODEVICENVPROC glad_glXBindVideoDeviceNV;
|
||||
PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC glad_glXCreateAssociatedContextAMD;
|
||||
PFNGLXQUERYCONTEXTINFOEXTPROC glad_glXQueryContextInfoEXT;
|
||||
PFNGLXGETSELECTEDEVENTPROC glad_glXGetSelectedEvent;
|
||||
PFNGLXGETCURRENTDISPLAYPROC glad_glXGetCurrentDisplay;
|
||||
PFNGLXDESTROYPIXMAPPROC glad_glXDestroyPixmap;
|
||||
PFNGLXGETSELECTEDEVENTSGIXPROC glad_glXGetSelectedEventSGIX;
|
||||
PFNGLXRELEASETEXIMAGEEXTPROC glad_glXReleaseTexImageEXT;
|
||||
PFNGLXUSEXFONTPROC glad_glXUseXFont;
|
||||
PFNGLXGETSYNCVALUESOMLPROC glad_glXGetSyncValuesOML;
|
||||
PFNGLXJOINSWAPGROUPNVPROC glad_glXJoinSwapGroupNV;
|
||||
PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers;
|
||||
PFNGLXDELAYBEFORESWAPNVPROC glad_glXDelayBeforeSwapNV;
|
||||
PFNGLXBINDHYPERPIPESGIXPROC glad_glXBindHyperpipeSGIX;
|
||||
PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC glad_glXLockVideoCaptureDeviceNV;
|
||||
PFNGLXGETCURRENTDISPLAYEXTPROC glad_glXGetCurrentDisplayEXT;
|
||||
PFNGLXGETFBCONFIGSPROC glad_glXGetFBConfigs;
|
||||
PFNGLXGETCURRENTREADDRAWABLEPROC glad_glXGetCurrentReadDrawable;
|
||||
PFNGLXRELEASEVIDEOIMAGENVPROC glad_glXReleaseVideoImageNV;
|
||||
PFNGLXQUERYEXTENSIONPROC glad_glXQueryExtension;
|
||||
PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC glad_glXMakeAssociatedContextCurrentAMD;
|
||||
PFNGLXCHOOSEVISUALPROC glad_glXChooseVisual;
|
||||
PFNGLXDESTROYCONTEXTPROC glad_glXDestroyContext;
|
||||
PFNGLXGETCLIENTSTRINGPROC glad_glXGetClientString;
|
||||
PFNGLXDESTROYGLXPIXMAPPROC glad_glXDestroyGLXPixmap;
|
||||
PFNGLXRESETFRAMECOUNTNVPROC glad_glXResetFrameCountNV;
|
||||
PFNGLXRELEASEVIDEODEVICENVPROC glad_glXReleaseVideoDeviceNV;
|
||||
PFNGLXGETFBCONFIGFROMVISUALSGIXPROC glad_glXGetFBConfigFromVisualSGIX;
|
||||
PFNGLXCREATENEWCONTEXTPROC glad_glXCreateNewContext;
|
||||
PFNGLXMAKECONTEXTCURRENTPROC glad_glXMakeContextCurrent;
|
||||
PFNGLXQUERYMAXSWAPGROUPSNVPROC glad_glXQueryMaxSwapGroupsNV;
|
||||
PFNGLXGETVISUALFROMFBCONFIGSGIXPROC glad_glXGetVisualFromFBConfigSGIX;
|
||||
PFNGLXGETCURRENTDRAWABLEPROC glad_glXGetCurrentDrawable;
|
||||
PFNGLXGETCURRENTREADDRAWABLESGIPROC glad_glXGetCurrentReadDrawableSGI;
|
||||
PFNGLXQUERYFRAMECOUNTNVPROC glad_glXQueryFrameCountNV;
|
||||
PFNGLXGETCONTEXTGPUIDAMDPROC glad_glXGetContextGPUIDAMD;
|
||||
PFNGLXBINDSWAPBARRIERSGIXPROC glad_glXBindSwapBarrierSGIX;
|
||||
PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC glad_glXQueryMaxSwapBarriersSGIX;
|
||||
PFNGLXCREATEGLXPIXMAPMESAPROC glad_glXCreateGLXPixmapMESA;
|
||||
PFNGLXMAKECURRENTPROC glad_glXMakeCurrent;
|
||||
PFNGLXDESTROYWINDOWPROC glad_glXDestroyWindow;
|
||||
PFNGLXBINDVIDEOIMAGENVPROC glad_glXBindVideoImageNV;
|
||||
PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC glad_glXQueryVideoCaptureDeviceNV;
|
||||
PFNGLXQUERYCHANNELDELTASSGIXPROC glad_glXQueryChannelDeltasSGIX;
|
||||
PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC glad_glXEnumerateVideoCaptureDevicesNV;
|
||||
PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC glad_glXCreateAssociatedContextAttribsAMD;
|
||||
PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC glad_glXGetCurrentAssociatedContextAMD;
|
||||
PFNGLXQUERYCHANNELRECTSGIXPROC glad_glXQueryChannelRectSGIX;
|
||||
PFNGLXCREATECONTEXTPROC glad_glXCreateContext;
|
||||
PFNGLXFREECONTEXTEXTPROC glad_glXFreeContextEXT;
|
||||
PFNGLXGETCONTEXTIDEXTPROC glad_glXGetContextIDEXT;
|
||||
PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC glad_glXQueryCurrentRendererIntegerMESA;
|
||||
PFNGLXCHOOSEFBCONFIGPROC glad_glXChooseFBConfig;
|
||||
PFNGLXBINDCHANNELTOWINDOWSGIXPROC glad_glXBindChannelToWindowSGIX;
|
||||
PFNGLXCHANNELRECTSYNCSGIXPROC glad_glXChannelRectSyncSGIX;
|
||||
PFNGLXIMPORTCONTEXTEXTPROC glad_glXImportContextEXT;
|
||||
PFNGLXRELEASEBUFFERSMESAPROC glad_glXReleaseBuffersMESA;
|
||||
PFNGLXCREATEPIXMAPPROC glad_glXCreatePixmap;
|
||||
PFNGLXGETAGPOFFSETMESAPROC glad_glXGetAGPOffsetMESA;
|
||||
|
||||
static void load_GLX_VERSION_1_0(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_VERSION_1_0) return;
|
||||
glXWaitGL = (PFNGLXWAITGLPROC)load("glXWaitGL", userptr);
|
||||
glXWaitX = (PFNGLXWAITXPROC)load("glXWaitX", userptr);
|
||||
glXGetConfig = (PFNGLXGETCONFIGPROC)load("glXGetConfig", userptr);
|
||||
glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion", userptr);
|
||||
glXCreateContext = (PFNGLXCREATECONTEXTPROC)load("glXCreateContext", userptr);
|
||||
glXQueryExtension = (PFNGLXQUERYEXTENSIONPROC)load("glXQueryExtension", userptr);
|
||||
glXGetCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC)load("glXGetCurrentContext", userptr);
|
||||
glXMakeCurrent = (PFNGLXMAKECURRENTPROC)load("glXMakeCurrent", userptr);
|
||||
glXCopyContext = (PFNGLXCOPYCONTEXTPROC)load("glXCopyContext", userptr);
|
||||
glXIsDirect = (PFNGLXISDIRECTPROC)load("glXIsDirect", userptr);
|
||||
glXCreateGLXPixmap = (PFNGLXCREATEGLXPIXMAPPROC)load("glXCreateGLXPixmap", userptr);
|
||||
glXGetCurrentDrawable = (PFNGLXGETCURRENTDRAWABLEPROC)load("glXGetCurrentDrawable", userptr);
|
||||
glXUseXFont = (PFNGLXUSEXFONTPROC)load("glXUseXFont", userptr);
|
||||
glXChooseVisual = (PFNGLXCHOOSEVISUALPROC)load("glXChooseVisual", userptr);
|
||||
glXDestroyContext = (PFNGLXDESTROYCONTEXTPROC)load("glXDestroyContext", userptr);
|
||||
glXDestroyGLXPixmap = (PFNGLXDESTROYGLXPIXMAPPROC)load("glXDestroyGLXPixmap", userptr);
|
||||
glXSwapBuffers = (PFNGLXSWAPBUFFERSPROC)load("glXSwapBuffers", userptr);
|
||||
}
|
||||
static void load_GLX_VERSION_1_1(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_VERSION_1_1) return;
|
||||
glXQueryServerString = (PFNGLXQUERYSERVERSTRINGPROC)load("glXQueryServerString", userptr);
|
||||
glXGetClientString = (PFNGLXGETCLIENTSTRINGPROC)load("glXGetClientString", userptr);
|
||||
glXQueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)load("glXQueryExtensionsString", userptr);
|
||||
}
|
||||
static void load_GLX_VERSION_1_2(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_VERSION_1_2) return;
|
||||
glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)load("glXGetCurrentDisplay", userptr);
|
||||
}
|
||||
static void load_GLX_VERSION_1_3(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_VERSION_1_3) return;
|
||||
glXQueryContext = (PFNGLXQUERYCONTEXTPROC)load("glXQueryContext", userptr);
|
||||
glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)load("glXGetFBConfigs", userptr);
|
||||
glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)load("glXDestroyPixmap", userptr);
|
||||
glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)load("glXCreateNewContext", userptr);
|
||||
glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)load("glXGetCurrentReadDrawable", userptr);
|
||||
glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)load("glXMakeContextCurrent", userptr);
|
||||
glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)load("glXDestroyWindow", userptr);
|
||||
glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)load("glXChooseFBConfig", userptr);
|
||||
glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)load("glXCreatePixmap", userptr);
|
||||
glXSelectEvent = (PFNGLXSELECTEVENTPROC)load("glXSelectEvent", userptr);
|
||||
glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)load("glXGetFBConfigAttrib", userptr);
|
||||
glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)load("glXDestroyPbuffer", userptr);
|
||||
glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)load("glXCreatePbuffer", userptr);
|
||||
glXCreateWindow = (PFNGLXCREATEWINDOWPROC)load("glXCreateWindow", userptr);
|
||||
glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)load("glXGetSelectedEvent", userptr);
|
||||
glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)load("glXQueryDrawable", userptr);
|
||||
glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)load("glXGetVisualFromFBConfig", userptr);
|
||||
}
|
||||
static void load_GLX_VERSION_1_4(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_VERSION_1_4) return;
|
||||
glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)load("glXGetProcAddress", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_copy_sub_buffer(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_copy_sub_buffer) return;
|
||||
glXCopySubBufferMESA = (PFNGLXCOPYSUBBUFFERMESAPROC)load("glXCopySubBufferMESA", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_pbuffer(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_pbuffer) return;
|
||||
glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC)load("glXDestroyGLXPbufferSGIX", userptr);
|
||||
glXQueryGLXPbufferSGIX = (PFNGLXQUERYGLXPBUFFERSGIXPROC)load("glXQueryGLXPbufferSGIX", userptr);
|
||||
glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC)load("glXCreateGLXPbufferSGIX", userptr);
|
||||
glXGetSelectedEventSGIX = (PFNGLXGETSELECTEDEVENTSGIXPROC)load("glXGetSelectedEventSGIX", userptr);
|
||||
glXSelectEventSGIX = (PFNGLXSELECTEVENTSGIXPROC)load("glXSelectEventSGIX", userptr);
|
||||
}
|
||||
static void load_GLX_SGI_make_current_read(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGI_make_current_read) return;
|
||||
glXGetCurrentReadDrawableSGI = (PFNGLXGETCURRENTREADDRAWABLESGIPROC)load("glXGetCurrentReadDrawableSGI", userptr);
|
||||
glXMakeCurrentReadSGI = (PFNGLXMAKECURRENTREADSGIPROC)load("glXMakeCurrentReadSGI", userptr);
|
||||
}
|
||||
static void load_GLX_OML_sync_control(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_OML_sync_control) return;
|
||||
glXWaitForMscOML = (PFNGLXWAITFORMSCOMLPROC)load("glXWaitForMscOML", userptr);
|
||||
glXGetSyncValuesOML = (PFNGLXGETSYNCVALUESOMLPROC)load("glXGetSyncValuesOML", userptr);
|
||||
glXWaitForSbcOML = (PFNGLXWAITFORSBCOMLPROC)load("glXWaitForSbcOML", userptr);
|
||||
glXSwapBuffersMscOML = (PFNGLXSWAPBUFFERSMSCOMLPROC)load("glXSwapBuffersMscOML", userptr);
|
||||
glXGetMscRateOML = (PFNGLXGETMSCRATEOMLPROC)load("glXGetMscRateOML", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_hyperpipe(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_hyperpipe) return;
|
||||
glXQueryHyperpipeBestAttribSGIX = (PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC)load("glXQueryHyperpipeBestAttribSGIX", userptr);
|
||||
glXQueryHyperpipeAttribSGIX = (PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC)load("glXQueryHyperpipeAttribSGIX", userptr);
|
||||
glXDestroyHyperpipeConfigSGIX = (PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC)load("glXDestroyHyperpipeConfigSGIX", userptr);
|
||||
glXHyperpipeConfigSGIX = (PFNGLXHYPERPIPECONFIGSGIXPROC)load("glXHyperpipeConfigSGIX", userptr);
|
||||
glXHyperpipeAttribSGIX = (PFNGLXHYPERPIPEATTRIBSGIXPROC)load("glXHyperpipeAttribSGIX", userptr);
|
||||
glXQueryHyperpipeConfigSGIX = (PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)load("glXQueryHyperpipeConfigSGIX", userptr);
|
||||
glXQueryHyperpipeNetworkSGIX = (PFNGLXQUERYHYPERPIPENETWORKSGIXPROC)load("glXQueryHyperpipeNetworkSGIX", userptr);
|
||||
glXBindHyperpipeSGIX = (PFNGLXBINDHYPERPIPESGIXPROC)load("glXBindHyperpipeSGIX", userptr);
|
||||
}
|
||||
static void load_GLX_EXT_swap_control(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_EXT_swap_control) return;
|
||||
glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)load("glXSwapIntervalEXT", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_pixmap_colormap(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_pixmap_colormap) return;
|
||||
glXCreateGLXPixmapMESA = (PFNGLXCREATEGLXPIXMAPMESAPROC)load("glXCreateGLXPixmapMESA", userptr);
|
||||
}
|
||||
static void load_GLX_NV_video_capture(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_video_capture) return;
|
||||
glXQueryVideoCaptureDeviceNV = (PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC)load("glXQueryVideoCaptureDeviceNV", userptr);
|
||||
glXEnumerateVideoCaptureDevicesNV = (PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC)load("glXEnumerateVideoCaptureDevicesNV", userptr);
|
||||
glXBindVideoCaptureDeviceNV = (PFNGLXBINDVIDEOCAPTUREDEVICENVPROC)load("glXBindVideoCaptureDeviceNV", userptr);
|
||||
glXLockVideoCaptureDeviceNV = (PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC)load("glXLockVideoCaptureDeviceNV", userptr);
|
||||
glXReleaseVideoCaptureDeviceNV = (PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC)load("glXReleaseVideoCaptureDeviceNV", userptr);
|
||||
}
|
||||
static void load_GLX_NV_swap_group(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_swap_group) return;
|
||||
glXQueryFrameCountNV = (PFNGLXQUERYFRAMECOUNTNVPROC)load("glXQueryFrameCountNV", userptr);
|
||||
glXQueryMaxSwapGroupsNV = (PFNGLXQUERYMAXSWAPGROUPSNVPROC)load("glXQueryMaxSwapGroupsNV", userptr);
|
||||
glXResetFrameCountNV = (PFNGLXRESETFRAMECOUNTNVPROC)load("glXResetFrameCountNV", userptr);
|
||||
glXJoinSwapGroupNV = (PFNGLXJOINSWAPGROUPNVPROC)load("glXJoinSwapGroupNV", userptr);
|
||||
glXBindSwapBarrierNV = (PFNGLXBINDSWAPBARRIERNVPROC)load("glXBindSwapBarrierNV", userptr);
|
||||
glXQuerySwapGroupNV = (PFNGLXQUERYSWAPGROUPNVPROC)load("glXQuerySwapGroupNV", userptr);
|
||||
}
|
||||
static void load_GLX_EXT_texture_from_pixmap(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_EXT_texture_from_pixmap) return;
|
||||
glXReleaseTexImageEXT = (PFNGLXRELEASETEXIMAGEEXTPROC)load("glXReleaseTexImageEXT", userptr);
|
||||
glXBindTexImageEXT = (PFNGLXBINDTEXIMAGEEXTPROC)load("glXBindTexImageEXT", userptr);
|
||||
}
|
||||
static void load_GLX_SUN_get_transparent_index(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SUN_get_transparent_index) return;
|
||||
glXGetTransparentIndexSUN = (PFNGLXGETTRANSPARENTINDEXSUNPROC)load("glXGetTransparentIndexSUN", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_release_buffers(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_release_buffers) return;
|
||||
glXReleaseBuffersMESA = (PFNGLXRELEASEBUFFERSMESAPROC)load("glXReleaseBuffersMESA", userptr);
|
||||
}
|
||||
static void load_GLX_NV_delay_before_swap(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_delay_before_swap) return;
|
||||
glXDelayBeforeSwapNV = (PFNGLXDELAYBEFORESWAPNVPROC)load("glXDelayBeforeSwapNV", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_agp_offset(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_agp_offset) return;
|
||||
glXGetAGPOffsetMESA = (PFNGLXGETAGPOFFSETMESAPROC)load("glXGetAGPOffsetMESA", userptr);
|
||||
}
|
||||
static void load_GLX_SGI_swap_control(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGI_swap_control) return;
|
||||
glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)load("glXSwapIntervalSGI", userptr);
|
||||
}
|
||||
static void load_GLX_EXT_import_context(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_EXT_import_context) return;
|
||||
glXGetCurrentDisplayEXT = (PFNGLXGETCURRENTDISPLAYEXTPROC)load("glXGetCurrentDisplayEXT", userptr);
|
||||
glXImportContextEXT = (PFNGLXIMPORTCONTEXTEXTPROC)load("glXImportContextEXT", userptr);
|
||||
glXFreeContextEXT = (PFNGLXFREECONTEXTEXTPROC)load("glXFreeContextEXT", userptr);
|
||||
glXGetContextIDEXT = (PFNGLXGETCONTEXTIDEXTPROC)load("glXGetContextIDEXT", userptr);
|
||||
glXQueryContextInfoEXT = (PFNGLXQUERYCONTEXTINFOEXTPROC)load("glXQueryContextInfoEXT", userptr);
|
||||
}
|
||||
static void load_GLX_SGI_video_sync(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGI_video_sync) return;
|
||||
glXGetVideoSyncSGI = (PFNGLXGETVIDEOSYNCSGIPROC)load("glXGetVideoSyncSGI", userptr);
|
||||
glXWaitVideoSyncSGI = (PFNGLXWAITVIDEOSYNCSGIPROC)load("glXWaitVideoSyncSGI", userptr);
|
||||
}
|
||||
static void load_GLX_SGI_cushion(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGI_cushion) return;
|
||||
glXCushionSGI = (PFNGLXCUSHIONSGIPROC)load("glXCushionSGI", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_fbconfig(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_fbconfig) return;
|
||||
glXGetFBConfigAttribSGIX = (PFNGLXGETFBCONFIGATTRIBSGIXPROC)load("glXGetFBConfigAttribSGIX", userptr);
|
||||
glXCreateGLXPixmapWithConfigSGIX = (PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC)load("glXCreateGLXPixmapWithConfigSGIX", userptr);
|
||||
glXCreateContextWithConfigSGIX = (PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC)load("glXCreateContextWithConfigSGIX", userptr);
|
||||
glXGetVisualFromFBConfigSGIX = (PFNGLXGETVISUALFROMFBCONFIGSGIXPROC)load("glXGetVisualFromFBConfigSGIX", userptr);
|
||||
glXChooseFBConfigSGIX = (PFNGLXCHOOSEFBCONFIGSGIXPROC)load("glXChooseFBConfigSGIX", userptr);
|
||||
glXGetFBConfigFromVisualSGIX = (PFNGLXGETFBCONFIGFROMVISUALSGIXPROC)load("glXGetFBConfigFromVisualSGIX", userptr);
|
||||
}
|
||||
static void load_GLX_NV_copy_buffer(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_copy_buffer) return;
|
||||
glXNamedCopyBufferSubDataNV = (PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC)load("glXNamedCopyBufferSubDataNV", userptr);
|
||||
glXCopyBufferSubDataNV = (PFNGLXCOPYBUFFERSUBDATANVPROC)load("glXCopyBufferSubDataNV", userptr);
|
||||
}
|
||||
static void load_GLX_ARB_create_context(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_ARB_create_context) return;
|
||||
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)load("glXCreateContextAttribsARB", userptr);
|
||||
}
|
||||
static void load_GLX_AMD_gpu_association(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_AMD_gpu_association) return;
|
||||
glXCreateAssociatedContextAttribsAMD = (PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC)load("glXCreateAssociatedContextAttribsAMD", userptr);
|
||||
glXBlitContextFramebufferAMD = (PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC)load("glXBlitContextFramebufferAMD", userptr);
|
||||
glXGetCurrentAssociatedContextAMD = (PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC)load("glXGetCurrentAssociatedContextAMD", userptr);
|
||||
glXGetContextGPUIDAMD = (PFNGLXGETCONTEXTGPUIDAMDPROC)load("glXGetContextGPUIDAMD", userptr);
|
||||
glXMakeAssociatedContextCurrentAMD = (PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC)load("glXMakeAssociatedContextCurrentAMD", userptr);
|
||||
glXGetGPUIDsAMD = (PFNGLXGETGPUIDSAMDPROC)load("glXGetGPUIDsAMD", userptr);
|
||||
glXCreateAssociatedContextAMD = (PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC)load("glXCreateAssociatedContextAMD", userptr);
|
||||
glXDeleteAssociatedContextAMD = (PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC)load("glXDeleteAssociatedContextAMD", userptr);
|
||||
glXGetGPUInfoAMD = (PFNGLXGETGPUINFOAMDPROC)load("glXGetGPUInfoAMD", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_query_renderer(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_query_renderer) return;
|
||||
glXQueryCurrentRendererStringMESA = (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)load("glXQueryCurrentRendererStringMESA", userptr);
|
||||
glXQueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)load("glXQueryCurrentRendererIntegerMESA", userptr);
|
||||
glXQueryRendererStringMESA = (PFNGLXQUERYRENDERERSTRINGMESAPROC)load("glXQueryRendererStringMESA", userptr);
|
||||
glXQueryRendererIntegerMESA = (PFNGLXQUERYRENDERERINTEGERMESAPROC)load("glXQueryRendererIntegerMESA", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_swap_control(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_swap_control) return;
|
||||
glXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)load("glXGetSwapIntervalMESA", userptr);
|
||||
glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)load("glXSwapIntervalMESA", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_video_resize(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_video_resize) return;
|
||||
glXBindChannelToWindowSGIX = (PFNGLXBINDCHANNELTOWINDOWSGIXPROC)load("glXBindChannelToWindowSGIX", userptr);
|
||||
glXChannelRectSyncSGIX = (PFNGLXCHANNELRECTSYNCSGIXPROC)load("glXChannelRectSyncSGIX", userptr);
|
||||
glXQueryChannelDeltasSGIX = (PFNGLXQUERYCHANNELDELTASSGIXPROC)load("glXQueryChannelDeltasSGIX", userptr);
|
||||
glXQueryChannelRectSGIX = (PFNGLXQUERYCHANNELRECTSGIXPROC)load("glXQueryChannelRectSGIX", userptr);
|
||||
glXChannelRectSGIX = (PFNGLXCHANNELRECTSGIXPROC)load("glXChannelRectSGIX", userptr);
|
||||
}
|
||||
static void load_GLX_NV_video_out(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_video_out) return;
|
||||
glXGetVideoInfoNV = (PFNGLXGETVIDEOINFONVPROC)load("glXGetVideoInfoNV", userptr);
|
||||
glXSendPbufferToVideoNV = (PFNGLXSENDPBUFFERTOVIDEONVPROC)load("glXSendPbufferToVideoNV", userptr);
|
||||
glXReleaseVideoImageNV = (PFNGLXRELEASEVIDEOIMAGENVPROC)load("glXReleaseVideoImageNV", userptr);
|
||||
glXBindVideoImageNV = (PFNGLXBINDVIDEOIMAGENVPROC)load("glXBindVideoImageNV", userptr);
|
||||
glXReleaseVideoDeviceNV = (PFNGLXRELEASEVIDEODEVICENVPROC)load("glXReleaseVideoDeviceNV", userptr);
|
||||
glXGetVideoDeviceNV = (PFNGLXGETVIDEODEVICENVPROC)load("glXGetVideoDeviceNV", userptr);
|
||||
}
|
||||
static void load_GLX_MESA_set_3dfx_mode(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_MESA_set_3dfx_mode) return;
|
||||
glXSet3DfxModeMESA = (PFNGLXSET3DFXMODEMESAPROC)load("glXSet3DfxModeMESA", userptr);
|
||||
}
|
||||
static void load_GLX_ARB_get_proc_address(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_ARB_get_proc_address) return;
|
||||
glXGetProcAddressARB = (PFNGLXGETPROCADDRESSARBPROC)load("glXGetProcAddressARB", userptr);
|
||||
}
|
||||
static void load_GLX_NV_copy_image(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_copy_image) return;
|
||||
glXCopyImageSubDataNV = (PFNGLXCOPYIMAGESUBDATANVPROC)load("glXCopyImageSubDataNV", userptr);
|
||||
}
|
||||
static void load_GLX_NV_present_video(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_NV_present_video) return;
|
||||
glXBindVideoDeviceNV = (PFNGLXBINDVIDEODEVICENVPROC)load("glXBindVideoDeviceNV", userptr);
|
||||
glXEnumerateVideoDevicesNV = (PFNGLXENUMERATEVIDEODEVICESNVPROC)load("glXEnumerateVideoDevicesNV", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_swap_barrier(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_swap_barrier) return;
|
||||
glXBindSwapBarrierSGIX = (PFNGLXBINDSWAPBARRIERSGIXPROC)load("glXBindSwapBarrierSGIX", userptr);
|
||||
glXQueryMaxSwapBarriersSGIX = (PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC)load("glXQueryMaxSwapBarriersSGIX", userptr);
|
||||
}
|
||||
static void load_GLX_SGIX_swap_group(GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
if (!GLAD_GLX_SGIX_swap_group) return;
|
||||
glXJoinSwapGroupSGIX = (PFNGLXJOINSWAPGROUPSGIXPROC)load("glXJoinSwapGroupSGIX", userptr);
|
||||
}
|
||||
|
||||
static int has_ext(Display* display, int screen, const char* ext)
|
||||
{
|
||||
const char* terminator;
|
||||
const char* loc;
|
||||
const char* extensions;
|
||||
|
||||
if (!GLAD_GLX_VERSION_1_1)
|
||||
return 0;
|
||||
|
||||
extensions = glXQueryExtensionsString(display, screen);
|
||||
|
||||
if (extensions == NULL || ext == NULL)
|
||||
return 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
loc = strstr(extensions, ext);
|
||||
if (loc == NULL)
|
||||
break;
|
||||
|
||||
terminator = loc + strlen(ext);
|
||||
if ((loc == extensions || *(loc - 1) == ' ') &&
|
||||
(*terminator == ' ' || *terminator == '\0'))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
extensions = terminator;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GLADapiproc glad_glx_get_proc_from_userptr(const char* name, void* userptr)
|
||||
{
|
||||
return (GLAD_GNUC_EXTENSION(GLADapiproc(*)(const char* name)) userptr)(name);
|
||||
}
|
||||
|
||||
static int find_extensionsGLX(Display* display, int screen)
|
||||
{
|
||||
GLAD_GLX_MESA_copy_sub_buffer = has_ext(display, screen, "GLX_MESA_copy_sub_buffer");
|
||||
GLAD_GLX_EXT_create_context_es_profile = has_ext(display, screen, "GLX_EXT_create_context_es_profile");
|
||||
GLAD_GLX_SGIX_pbuffer = has_ext(display, screen, "GLX_SGIX_pbuffer");
|
||||
GLAD_GLX_SGI_make_current_read = has_ext(display, screen, "GLX_SGI_make_current_read");
|
||||
GLAD_GLX_OML_sync_control = has_ext(display, screen, "GLX_OML_sync_control");
|
||||
GLAD_GLX_SGIX_hyperpipe = has_ext(display, screen, "GLX_SGIX_hyperpipe");
|
||||
GLAD_GLX_INTEL_swap_event = has_ext(display, screen, "GLX_INTEL_swap_event");
|
||||
GLAD_GLX_EXT_swap_control = has_ext(display, screen, "GLX_EXT_swap_control");
|
||||
GLAD_GLX_NV_robustness_video_memory_purge = has_ext(display, screen, "GLX_NV_robustness_video_memory_purge");
|
||||
GLAD_GLX_MESA_pixmap_colormap = has_ext(display, screen, "GLX_MESA_pixmap_colormap");
|
||||
GLAD_GLX_ARB_fbconfig_float = has_ext(display, screen, "GLX_ARB_fbconfig_float");
|
||||
GLAD_GLX_EXT_fbconfig_packed_float = has_ext(display, screen, "GLX_EXT_fbconfig_packed_float");
|
||||
GLAD_GLX_OML_swap_method = has_ext(display, screen, "GLX_OML_swap_method");
|
||||
GLAD_GLX_NV_video_capture = has_ext(display, screen, "GLX_NV_video_capture");
|
||||
GLAD_GLX_ARB_robustness_application_isolation = has_ext(display, screen, "GLX_ARB_robustness_application_isolation");
|
||||
GLAD_GLX_ARB_create_context_robustness = has_ext(display, screen, "GLX_ARB_create_context_robustness");
|
||||
GLAD_GLX_EXT_visual_rating = has_ext(display, screen, "GLX_EXT_visual_rating");
|
||||
GLAD_GLX_NV_swap_group = has_ext(display, screen, "GLX_NV_swap_group");
|
||||
GLAD_GLX_EXT_texture_from_pixmap = has_ext(display, screen, "GLX_EXT_texture_from_pixmap");
|
||||
GLAD_GLX_SUN_get_transparent_index = has_ext(display, screen, "GLX_SUN_get_transparent_index");
|
||||
GLAD_GLX_MESA_release_buffers = has_ext(display, screen, "GLX_MESA_release_buffers");
|
||||
GLAD_GLX_NV_delay_before_swap = has_ext(display, screen, "GLX_NV_delay_before_swap");
|
||||
GLAD_GLX_EXT_buffer_age = has_ext(display, screen, "GLX_EXT_buffer_age");
|
||||
GLAD_GLX_MESA_agp_offset = has_ext(display, screen, "GLX_MESA_agp_offset");
|
||||
GLAD_GLX_EXT_visual_info = has_ext(display, screen, "GLX_EXT_visual_info");
|
||||
GLAD_GLX_SGI_swap_control = has_ext(display, screen, "GLX_SGI_swap_control");
|
||||
GLAD_GLX_EXT_import_context = has_ext(display, screen, "GLX_EXT_import_context");
|
||||
GLAD_GLX_SGI_video_sync = has_ext(display, screen, "GLX_SGI_video_sync");
|
||||
GLAD_GLX_3DFX_multisample = has_ext(display, screen, "GLX_3DFX_multisample");
|
||||
GLAD_GLX_ARB_multisample = has_ext(display, screen, "GLX_ARB_multisample");
|
||||
GLAD_GLX_EXT_framebuffer_sRGB = has_ext(display, screen, "GLX_EXT_framebuffer_sRGB");
|
||||
GLAD_GLX_SGI_cushion = has_ext(display, screen, "GLX_SGI_cushion");
|
||||
GLAD_GLX_ARB_robustness_share_group_isolation = has_ext(display, screen, "GLX_ARB_robustness_share_group_isolation");
|
||||
GLAD_GLX_SGIX_fbconfig = has_ext(display, screen, "GLX_SGIX_fbconfig");
|
||||
GLAD_GLX_NV_copy_buffer = has_ext(display, screen, "GLX_NV_copy_buffer");
|
||||
GLAD_GLX_SGIX_visual_select_group = has_ext(display, screen, "GLX_SGIX_visual_select_group");
|
||||
GLAD_GLX_EXT_swap_control_tear = has_ext(display, screen, "GLX_EXT_swap_control_tear");
|
||||
GLAD_GLX_ARB_create_context = has_ext(display, screen, "GLX_ARB_create_context");
|
||||
GLAD_GLX_AMD_gpu_association = has_ext(display, screen, "GLX_AMD_gpu_association");
|
||||
GLAD_GLX_MESA_query_renderer = has_ext(display, screen, "GLX_MESA_query_renderer");
|
||||
GLAD_GLX_EXT_create_context_es2_profile = has_ext(display, screen, "GLX_EXT_create_context_es2_profile");
|
||||
GLAD_GLX_MESA_swap_control = has_ext(display, screen, "GLX_MESA_swap_control");
|
||||
GLAD_GLX_SGIX_video_resize = has_ext(display, screen, "GLX_SGIX_video_resize");
|
||||
GLAD_GLX_ARB_context_flush_control = has_ext(display, screen, "GLX_ARB_context_flush_control");
|
||||
GLAD_GLX_NV_video_out = has_ext(display, screen, "GLX_NV_video_out");
|
||||
GLAD_GLX_EXT_no_config_context = has_ext(display, screen, "GLX_EXT_no_config_context");
|
||||
GLAD_GLX_SGIS_blended_overlay = has_ext(display, screen, "GLX_SGIS_blended_overlay");
|
||||
GLAD_GLX_EXT_stereo_tree = has_ext(display, screen, "GLX_EXT_stereo_tree");
|
||||
GLAD_GLX_ARB_create_context_no_error = has_ext(display, screen, "GLX_ARB_create_context_no_error");
|
||||
GLAD_GLX_EXT_libglvnd = has_ext(display, screen, "GLX_EXT_libglvnd");
|
||||
GLAD_GLX_ARB_create_context_profile = has_ext(display, screen, "GLX_ARB_create_context_profile");
|
||||
GLAD_GLX_NV_float_buffer = has_ext(display, screen, "GLX_NV_float_buffer");
|
||||
GLAD_GLX_MESA_set_3dfx_mode = has_ext(display, screen, "GLX_MESA_set_3dfx_mode");
|
||||
GLAD_GLX_ARB_framebuffer_sRGB = has_ext(display, screen, "GLX_ARB_framebuffer_sRGB");
|
||||
GLAD_GLX_ARB_get_proc_address = has_ext(display, screen, "GLX_ARB_get_proc_address");
|
||||
GLAD_GLX_SGIS_shared_multisample = has_ext(display, screen, "GLX_SGIS_shared_multisample");
|
||||
GLAD_GLX_NV_copy_image = has_ext(display, screen, "GLX_NV_copy_image");
|
||||
GLAD_GLX_NV_present_video = has_ext(display, screen, "GLX_NV_present_video");
|
||||
GLAD_GLX_SGIX_swap_barrier = has_ext(display, screen, "GLX_SGIX_swap_barrier");
|
||||
GLAD_GLX_SGIS_multisample = has_ext(display, screen, "GLX_SGIS_multisample");
|
||||
GLAD_GLX_SGIX_swap_group = has_ext(display, screen, "GLX_SGIX_swap_group");
|
||||
GLAD_GLX_ARB_vertex_buffer_object = has_ext(display, screen, "GLX_ARB_vertex_buffer_object");
|
||||
GLAD_GLX_NV_multisample_coverage = has_ext(display, screen, "GLX_NV_multisample_coverage");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int find_coreGLX(Display** display, int* screen)
|
||||
{
|
||||
X11Struct x11;
|
||||
initX11Struct(&x11);
|
||||
int major = 0, minor = 0;
|
||||
if (*display == NULL)
|
||||
{
|
||||
*display = x11.XOpenDisplay(0);
|
||||
if (*display == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*screen = x11.XScreenNumberOfScreen(x11.XDefaultScreenOfDisplay(*display));
|
||||
}
|
||||
glXQueryVersion(*display, &major, &minor);
|
||||
GLAD_GLX_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||
GLAD_GLX_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||
GLAD_GLX_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||
GLAD_GLX_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||
GLAD_GLX_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||
return GLAD_MAKE_VERSION(major, minor);
|
||||
}
|
||||
|
||||
int gladLoadGLXUserPtr(Display* display, int screen, GLADuserptrloadfunc load, void* userptr)
|
||||
{
|
||||
int version;
|
||||
glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion", userptr);
|
||||
if (glXQueryVersion == NULL) return 0;
|
||||
version = find_coreGLX(&display, &screen);
|
||||
|
||||
load_GLX_VERSION_1_0(load, userptr);
|
||||
load_GLX_VERSION_1_1(load, userptr);
|
||||
load_GLX_VERSION_1_2(load, userptr);
|
||||
load_GLX_VERSION_1_3(load, userptr);
|
||||
load_GLX_VERSION_1_4(load, userptr);
|
||||
|
||||
if (!find_extensionsGLX(display, screen)) return 0;
|
||||
load_GLX_MESA_copy_sub_buffer(load, userptr);
|
||||
load_GLX_SGIX_pbuffer(load, userptr);
|
||||
load_GLX_SGI_make_current_read(load, userptr);
|
||||
load_GLX_OML_sync_control(load, userptr);
|
||||
load_GLX_SGIX_hyperpipe(load, userptr);
|
||||
load_GLX_EXT_swap_control(load, userptr);
|
||||
load_GLX_MESA_pixmap_colormap(load, userptr);
|
||||
load_GLX_NV_video_capture(load, userptr);
|
||||
load_GLX_NV_swap_group(load, userptr);
|
||||
load_GLX_EXT_texture_from_pixmap(load, userptr);
|
||||
load_GLX_SUN_get_transparent_index(load, userptr);
|
||||
load_GLX_MESA_release_buffers(load, userptr);
|
||||
load_GLX_NV_delay_before_swap(load, userptr);
|
||||
load_GLX_MESA_agp_offset(load, userptr);
|
||||
load_GLX_SGI_swap_control(load, userptr);
|
||||
load_GLX_EXT_import_context(load, userptr);
|
||||
load_GLX_SGI_video_sync(load, userptr);
|
||||
load_GLX_SGI_cushion(load, userptr);
|
||||
load_GLX_SGIX_fbconfig(load, userptr);
|
||||
load_GLX_NV_copy_buffer(load, userptr);
|
||||
load_GLX_ARB_create_context(load, userptr);
|
||||
load_GLX_AMD_gpu_association(load, userptr);
|
||||
load_GLX_MESA_query_renderer(load, userptr);
|
||||
load_GLX_MESA_swap_control(load, userptr);
|
||||
load_GLX_SGIX_video_resize(load, userptr);
|
||||
load_GLX_NV_video_out(load, userptr);
|
||||
load_GLX_MESA_set_3dfx_mode(load, userptr);
|
||||
load_GLX_ARB_get_proc_address(load, userptr);
|
||||
load_GLX_NV_copy_image(load, userptr);
|
||||
load_GLX_NV_present_video(load, userptr);
|
||||
load_GLX_SGIX_swap_barrier(load, userptr);
|
||||
load_GLX_SGIX_swap_group(load, userptr);
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
int gladLoadGLX(Display* display, int screen, GLADloadfunc load)
|
||||
{
|
||||
return gladLoadGLXUserPtr(display, screen, glad_glx_get_proc_from_userptr, GLAD_GNUC_EXTENSION(void*) load);
|
||||
}
|
||||
|
||||
#ifdef GLAD_GLX
|
||||
|
||||
#ifndef GLAD_LOADER_LIBRARY_C_
|
||||
#define GLAD_LOADER_LIBRARY_C_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
static void* glad_get_dlopen_handle(const char* lib_names[], int length)
|
||||
{
|
||||
void* handle = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; ++i)
|
||||
{
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
#if GLAD_PLATFORM_UWP
|
||||
size_t buffer_size = (strlen(lib_names[i]) + 1) * sizeof(WCHAR);
|
||||
LPWSTR buffer = (LPWSTR)malloc(buffer_size);
|
||||
if (buffer != NULL)
|
||||
{
|
||||
int ret = MultiByteToWideChar(CP_ACP, 0, lib_names[i], -1, buffer, buffer_size);
|
||||
if (ret != 0)
|
||||
{
|
||||
handle = (void*)LoadPackagedLibrary(buffer, 0);
|
||||
}
|
||||
free((void*)buffer);
|
||||
}
|
||||
#else
|
||||
handle = (void*)LoadLibraryA(lib_names[i]);
|
||||
#endif
|
||||
#else
|
||||
handle = dlopen(lib_names[i], RTLD_LAZY | RTLD_LOCAL);
|
||||
#endif
|
||||
if (handle != NULL)
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void glad_close_dlopen_handle(void* handle)
|
||||
{
|
||||
if (handle != NULL)
|
||||
{
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
FreeLibrary((HMODULE)handle);
|
||||
#else
|
||||
dlclose(handle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static GLADapiproc glad_dlsym_handle(void* handle, const char* name)
|
||||
{
|
||||
if (handle == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if GLAD_PLATFORM_WIN32
|
||||
return (GLADapiproc)GetProcAddress((HMODULE)handle, name);
|
||||
#else
|
||||
return GLAD_GNUC_EXTENSION(GLADapiproc) dlsym(handle, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* GLAD_LOADER_LIBRARY_C_ */
|
||||
|
||||
typedef void*(GLAD_API_PTR* GLADglxprocaddrfunc)(const char*);
|
||||
|
||||
static GLADapiproc glad_glx_get_proc(const char* name, void* userptr)
|
||||
{
|
||||
return GLAD_GNUC_EXTENSION((GLADapiproc(*)(const char* name))userptr)(name);
|
||||
}
|
||||
|
||||
static void* _glx_handle;
|
||||
|
||||
int gladLoaderLoadGLX(Display* display, int screen)
|
||||
{
|
||||
static const char* NAMES[] = {
|
||||
#if defined __CYGWIN__
|
||||
"libGL-1.so",
|
||||
#endif
|
||||
"libGL.so.1",
|
||||
"libGL.so"
|
||||
};
|
||||
|
||||
int version = 0;
|
||||
int did_load = 0;
|
||||
GLADglxprocaddrfunc loader;
|
||||
|
||||
if (_glx_handle == NULL)
|
||||
{
|
||||
_glx_handle = glad_get_dlopen_handle(NAMES, sizeof(NAMES) / sizeof(NAMES[0]));
|
||||
did_load = _glx_handle != NULL;
|
||||
}
|
||||
|
||||
if (_glx_handle != NULL)
|
||||
{
|
||||
loader = (GLADglxprocaddrfunc)glad_dlsym_handle(_glx_handle, "glXGetProcAddressARB");
|
||||
if (loader != NULL)
|
||||
{
|
||||
version = gladLoadGLXUserPtr(display, screen, glad_glx_get_proc, GLAD_GNUC_EXTENSION(void*) loader);
|
||||
}
|
||||
|
||||
if (!version && did_load)
|
||||
{
|
||||
glad_close_dlopen_handle(_glx_handle);
|
||||
_glx_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
void gladLoaderUnloadGLX()
|
||||
{
|
||||
if (_glx_handle != NULL)
|
||||
{
|
||||
glad_close_dlopen_handle(_glx_handle);
|
||||
_glx_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GLAD_GLX */
|
||||
583
Engine/lib/bullet/examples/ThirdPartyLibs/glad/linmath.h
Normal file
583
Engine/lib/bullet/examples/ThirdPartyLibs/glad/linmath.h
Normal file
|
|
@ -0,0 +1,583 @@
|
|||
#ifndef LINMATH_H
|
||||
#define LINMATH_H
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#define LINMATH_H_DEFINE_VEC(n) \
|
||||
typedef float vec##n[n]; \
|
||||
static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < n; ++i) \
|
||||
r[i] = a[i] + b[i]; \
|
||||
} \
|
||||
static inline void vec##n##_sub(vec##n r, vec##n const a, vec##n const b) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < n; ++i) \
|
||||
r[i] = a[i] - b[i]; \
|
||||
} \
|
||||
static inline void vec##n##_scale(vec##n r, vec##n const v, float const s) \
|
||||
{ \
|
||||
int i; \
|
||||
for (i = 0; i < n; ++i) \
|
||||
r[i] = v[i] * s; \
|
||||
} \
|
||||
static inline float vec##n##_mul_inner(vec##n const a, vec##n const b) \
|
||||
{ \
|
||||
float p = 0.; \
|
||||
int i; \
|
||||
for (i = 0; i < n; ++i) \
|
||||
p += b[i] * a[i]; \
|
||||
return p; \
|
||||
} \
|
||||
static inline float vec##n##_len(vec##n const v) \
|
||||
{ \
|
||||
return (float)sqrt(vec##n##_mul_inner(v, v)); \
|
||||
} \
|
||||
static inline void vec##n##_norm(vec##n r, vec##n const v) \
|
||||
{ \
|
||||
float k = 1.f / vec##n##_len(v); \
|
||||
vec##n##_scale(r, v, k); \
|
||||
}
|
||||
|
||||
LINMATH_H_DEFINE_VEC(2)
|
||||
LINMATH_H_DEFINE_VEC(3)
|
||||
LINMATH_H_DEFINE_VEC(4)
|
||||
|
||||
static inline void vec3_mul_cross(vec3 r, vec3 const a, vec3 const b)
|
||||
{
|
||||
r[0] = a[1] * b[2] - a[2] * b[1];
|
||||
r[1] = a[2] * b[0] - a[0] * b[2];
|
||||
r[2] = a[0] * b[1] - a[1] * b[0];
|
||||
}
|
||||
|
||||
static inline void vec3_reflect(vec3 r, vec3 const v, vec3 const n)
|
||||
{
|
||||
float p = 2.f * vec3_mul_inner(v, n);
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
r[i] = v[i] - p * n[i];
|
||||
}
|
||||
|
||||
static inline void vec4_mul_cross(vec4 r, vec4 a, vec4 b)
|
||||
{
|
||||
r[0] = a[1] * b[2] - a[2] * b[1];
|
||||
r[1] = a[2] * b[0] - a[0] * b[2];
|
||||
r[2] = a[0] * b[1] - a[1] * b[0];
|
||||
r[3] = 1.f;
|
||||
}
|
||||
|
||||
static inline void vec4_reflect(vec4 r, vec4 v, vec4 n)
|
||||
{
|
||||
float p = 2.f * vec4_mul_inner(v, n);
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
r[i] = v[i] - p * n[i];
|
||||
}
|
||||
|
||||
typedef vec4 mat4x4[4];
|
||||
static inline void mat4x4_identity(mat4x4 M)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (j = 0; j < 4; ++j)
|
||||
M[i][j] = i == j ? 1.f : 0.f;
|
||||
}
|
||||
static inline void mat4x4_dup(mat4x4 M, mat4x4 N)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (j = 0; j < 4; ++j)
|
||||
M[i][j] = N[i][j];
|
||||
}
|
||||
static inline void mat4x4_row(vec4 r, mat4x4 M, int i)
|
||||
{
|
||||
int k;
|
||||
for (k = 0; k < 4; ++k)
|
||||
r[k] = M[k][i];
|
||||
}
|
||||
static inline void mat4x4_col(vec4 r, mat4x4 M, int i)
|
||||
{
|
||||
int k;
|
||||
for (k = 0; k < 4; ++k)
|
||||
r[k] = M[i][k];
|
||||
}
|
||||
static inline void mat4x4_transpose(mat4x4 M, mat4x4 N)
|
||||
{
|
||||
int i, j;
|
||||
for (j = 0; j < 4; ++j)
|
||||
for (i = 0; i < 4; ++i)
|
||||
M[i][j] = N[j][i];
|
||||
}
|
||||
static inline void mat4x4_add(mat4x4 M, mat4x4 a, mat4x4 b)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
vec4_add(M[i], a[i], b[i]);
|
||||
}
|
||||
static inline void mat4x4_sub(mat4x4 M, mat4x4 a, mat4x4 b)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
vec4_sub(M[i], a[i], b[i]);
|
||||
}
|
||||
static inline void mat4x4_scale(mat4x4 M, mat4x4 a, float k)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
vec4_scale(M[i], a[i], k);
|
||||
}
|
||||
static inline void mat4x4_scale_aniso(mat4x4 M, mat4x4 a, float x, float y, float z)
|
||||
{
|
||||
int i;
|
||||
vec4_scale(M[0], a[0], x);
|
||||
vec4_scale(M[1], a[1], y);
|
||||
vec4_scale(M[2], a[2], z);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
M[3][i] = a[3][i];
|
||||
}
|
||||
}
|
||||
static inline void mat4x4_mul(mat4x4 M, mat4x4 a, mat4x4 b)
|
||||
{
|
||||
mat4x4 temp;
|
||||
int k, r, c;
|
||||
for (c = 0; c < 4; ++c)
|
||||
for (r = 0; r < 4; ++r)
|
||||
{
|
||||
temp[c][r] = 0.f;
|
||||
for (k = 0; k < 4; ++k)
|
||||
temp[c][r] += a[k][r] * b[c][k];
|
||||
}
|
||||
mat4x4_dup(M, temp);
|
||||
}
|
||||
static inline void mat4x4_mul_vec4(vec4 r, mat4x4 M, vec4 v)
|
||||
{
|
||||
int i, j;
|
||||
for (j = 0; j < 4; ++j)
|
||||
{
|
||||
r[j] = 0.f;
|
||||
for (i = 0; i < 4; ++i)
|
||||
r[j] += M[i][j] * v[i];
|
||||
}
|
||||
}
|
||||
static inline void mat4x4_translate(mat4x4 T, float x, float y, float z)
|
||||
{
|
||||
mat4x4_identity(T);
|
||||
T[3][0] = x;
|
||||
T[3][1] = y;
|
||||
T[3][2] = z;
|
||||
}
|
||||
static inline void mat4x4_translate_in_place(mat4x4 M, float x, float y, float z)
|
||||
{
|
||||
vec4 t = {x, y, z, 0};
|
||||
vec4 r;
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
mat4x4_row(r, M, i);
|
||||
M[3][i] += vec4_mul_inner(r, t);
|
||||
}
|
||||
}
|
||||
static inline void mat4x4_from_vec3_mul_outer(mat4x4 M, vec3 a, vec3 b)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (j = 0; j < 4; ++j)
|
||||
M[i][j] = i < 3 && j < 3 ? a[i] * b[j] : 0.f;
|
||||
}
|
||||
static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z, float angle)
|
||||
{
|
||||
float s = sinf(angle);
|
||||
float c = cosf(angle);
|
||||
vec3 u = {x, y, z};
|
||||
|
||||
if (vec3_len(u) > 1e-4)
|
||||
{
|
||||
mat4x4 T, C, S = {{0}};
|
||||
|
||||
vec3_norm(u, u);
|
||||
mat4x4_from_vec3_mul_outer(T, u, u);
|
||||
|
||||
S[1][2] = u[0];
|
||||
S[2][1] = -u[0];
|
||||
S[2][0] = u[1];
|
||||
S[0][2] = -u[1];
|
||||
S[0][1] = u[2];
|
||||
S[1][0] = -u[2];
|
||||
|
||||
mat4x4_scale(S, S, s);
|
||||
|
||||
mat4x4_identity(C);
|
||||
mat4x4_sub(C, C, T);
|
||||
|
||||
mat4x4_scale(C, C, c);
|
||||
|
||||
mat4x4_add(T, T, C);
|
||||
mat4x4_add(T, T, S);
|
||||
|
||||
T[3][3] = 1.;
|
||||
mat4x4_mul(R, M, T);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat4x4_dup(R, M);
|
||||
}
|
||||
}
|
||||
static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle)
|
||||
{
|
||||
float s = sinf(angle);
|
||||
float c = cosf(angle);
|
||||
mat4x4 R = {
|
||||
{1.f, 0.f, 0.f, 0.f},
|
||||
{0.f, c, s, 0.f},
|
||||
{0.f, -s, c, 0.f},
|
||||
{0.f, 0.f, 0.f, 1.f}};
|
||||
mat4x4_mul(Q, M, R);
|
||||
}
|
||||
static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle)
|
||||
{
|
||||
float s = sinf(angle);
|
||||
float c = cosf(angle);
|
||||
mat4x4 R = {
|
||||
{c, 0.f, s, 0.f},
|
||||
{0.f, 1.f, 0.f, 0.f},
|
||||
{-s, 0.f, c, 0.f},
|
||||
{0.f, 0.f, 0.f, 1.f}};
|
||||
mat4x4_mul(Q, M, R);
|
||||
}
|
||||
static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle)
|
||||
{
|
||||
float s = sinf(angle);
|
||||
float c = cosf(angle);
|
||||
mat4x4 R = {
|
||||
{c, s, 0.f, 0.f},
|
||||
{-s, c, 0.f, 0.f},
|
||||
{0.f, 0.f, 1.f, 0.f},
|
||||
{0.f, 0.f, 0.f, 1.f}};
|
||||
mat4x4_mul(Q, M, R);
|
||||
}
|
||||
static inline void mat4x4_invert(mat4x4 T, mat4x4 M)
|
||||
{
|
||||
float idet;
|
||||
float s[6];
|
||||
float c[6];
|
||||
s[0] = M[0][0] * M[1][1] - M[1][0] * M[0][1];
|
||||
s[1] = M[0][0] * M[1][2] - M[1][0] * M[0][2];
|
||||
s[2] = M[0][0] * M[1][3] - M[1][0] * M[0][3];
|
||||
s[3] = M[0][1] * M[1][2] - M[1][1] * M[0][2];
|
||||
s[4] = M[0][1] * M[1][3] - M[1][1] * M[0][3];
|
||||
s[5] = M[0][2] * M[1][3] - M[1][2] * M[0][3];
|
||||
|
||||
c[0] = M[2][0] * M[3][1] - M[3][0] * M[2][1];
|
||||
c[1] = M[2][0] * M[3][2] - M[3][0] * M[2][2];
|
||||
c[2] = M[2][0] * M[3][3] - M[3][0] * M[2][3];
|
||||
c[3] = M[2][1] * M[3][2] - M[3][1] * M[2][2];
|
||||
c[4] = M[2][1] * M[3][3] - M[3][1] * M[2][3];
|
||||
c[5] = M[2][2] * M[3][3] - M[3][2] * M[2][3];
|
||||
|
||||
/* Assumes it is invertible */
|
||||
idet = 1.0f / (s[0] * c[5] - s[1] * c[4] + s[2] * c[3] + s[3] * c[2] - s[4] * c[1] + s[5] * c[0]);
|
||||
|
||||
T[0][0] = (M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet;
|
||||
T[0][1] = (-M[0][1] * c[5] + M[0][2] * c[4] - M[0][3] * c[3]) * idet;
|
||||
T[0][2] = (M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet;
|
||||
T[0][3] = (-M[2][1] * s[5] + M[2][2] * s[4] - M[2][3] * s[3]) * idet;
|
||||
|
||||
T[1][0] = (-M[1][0] * c[5] + M[1][2] * c[2] - M[1][3] * c[1]) * idet;
|
||||
T[1][1] = (M[0][0] * c[5] - M[0][2] * c[2] + M[0][3] * c[1]) * idet;
|
||||
T[1][2] = (-M[3][0] * s[5] + M[3][2] * s[2] - M[3][3] * s[1]) * idet;
|
||||
T[1][3] = (M[2][0] * s[5] - M[2][2] * s[2] + M[2][3] * s[1]) * idet;
|
||||
|
||||
T[2][0] = (M[1][0] * c[4] - M[1][1] * c[2] + M[1][3] * c[0]) * idet;
|
||||
T[2][1] = (-M[0][0] * c[4] + M[0][1] * c[2] - M[0][3] * c[0]) * idet;
|
||||
T[2][2] = (M[3][0] * s[4] - M[3][1] * s[2] + M[3][3] * s[0]) * idet;
|
||||
T[2][3] = (-M[2][0] * s[4] + M[2][1] * s[2] - M[2][3] * s[0]) * idet;
|
||||
|
||||
T[3][0] = (-M[1][0] * c[3] + M[1][1] * c[1] - M[1][2] * c[0]) * idet;
|
||||
T[3][1] = (M[0][0] * c[3] - M[0][1] * c[1] + M[0][2] * c[0]) * idet;
|
||||
T[3][2] = (-M[3][0] * s[3] + M[3][1] * s[1] - M[3][2] * s[0]) * idet;
|
||||
T[3][3] = (M[2][0] * s[3] - M[2][1] * s[1] + M[2][2] * s[0]) * idet;
|
||||
}
|
||||
static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M)
|
||||
{
|
||||
float s = 1.;
|
||||
vec3 h;
|
||||
|
||||
mat4x4_dup(R, M);
|
||||
vec3_norm(R[2], R[2]);
|
||||
|
||||
s = vec3_mul_inner(R[1], R[2]);
|
||||
vec3_scale(h, R[2], s);
|
||||
vec3_sub(R[1], R[1], h);
|
||||
vec3_norm(R[2], R[2]);
|
||||
|
||||
s = vec3_mul_inner(R[1], R[2]);
|
||||
vec3_scale(h, R[2], s);
|
||||
vec3_sub(R[1], R[1], h);
|
||||
vec3_norm(R[1], R[1]);
|
||||
|
||||
s = vec3_mul_inner(R[0], R[1]);
|
||||
vec3_scale(h, R[1], s);
|
||||
vec3_sub(R[0], R[0], h);
|
||||
vec3_norm(R[0], R[0]);
|
||||
}
|
||||
|
||||
static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f)
|
||||
{
|
||||
M[0][0] = 2.f * n / (r - l);
|
||||
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
||||
|
||||
M[1][1] = 2.f * n / (t - b);
|
||||
M[1][0] = M[1][2] = M[1][3] = 0.f;
|
||||
|
||||
M[2][0] = (r + l) / (r - l);
|
||||
M[2][1] = (t + b) / (t - b);
|
||||
M[2][2] = -(f + n) / (f - n);
|
||||
M[2][3] = -1.f;
|
||||
|
||||
M[3][2] = -2.f * (f * n) / (f - n);
|
||||
M[3][0] = M[3][1] = M[3][3] = 0.f;
|
||||
}
|
||||
static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f)
|
||||
{
|
||||
M[0][0] = 2.f / (r - l);
|
||||
M[0][1] = M[0][2] = M[0][3] = 0.f;
|
||||
|
||||
M[1][1] = 2.f / (t - b);
|
||||
M[1][0] = M[1][2] = M[1][3] = 0.f;
|
||||
|
||||
M[2][2] = -2.f / (f - n);
|
||||
M[2][0] = M[2][1] = M[2][3] = 0.f;
|
||||
|
||||
M[3][0] = -(r + l) / (r - l);
|
||||
M[3][1] = -(t + b) / (t - b);
|
||||
M[3][2] = -(f + n) / (f - n);
|
||||
M[3][3] = 1.f;
|
||||
}
|
||||
static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f)
|
||||
{
|
||||
/* NOTE: Degrees are an unhandy unit to work with.
|
||||
* linmath.h uses radians for everything! */
|
||||
float const a = 1.f / (float)tan(y_fov / 2.f);
|
||||
|
||||
m[0][0] = a / aspect;
|
||||
m[0][1] = 0.f;
|
||||
m[0][2] = 0.f;
|
||||
m[0][3] = 0.f;
|
||||
|
||||
m[1][0] = 0.f;
|
||||
m[1][1] = a;
|
||||
m[1][2] = 0.f;
|
||||
m[1][3] = 0.f;
|
||||
|
||||
m[2][0] = 0.f;
|
||||
m[2][1] = 0.f;
|
||||
m[2][2] = -((f + n) / (f - n));
|
||||
m[2][3] = -1.f;
|
||||
|
||||
m[3][0] = 0.f;
|
||||
m[3][1] = 0.f;
|
||||
m[3][2] = -((2.f * f * n) / (f - n));
|
||||
m[3][3] = 0.f;
|
||||
}
|
||||
static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
|
||||
{
|
||||
/* Adapted from Android's OpenGL Matrix.java. */
|
||||
/* See the OpenGL GLUT documentation for gluLookAt for a description */
|
||||
/* of the algorithm. We implement it in a straightforward way: */
|
||||
|
||||
/* TODO: The negation of of can be spared by swapping the order of
|
||||
* operands in the following cross products in the right way. */
|
||||
vec3 f;
|
||||
vec3 s;
|
||||
vec3 t;
|
||||
|
||||
vec3_sub(f, center, eye);
|
||||
vec3_norm(f, f);
|
||||
|
||||
vec3_mul_cross(s, f, up);
|
||||
vec3_norm(s, s);
|
||||
|
||||
vec3_mul_cross(t, s, f);
|
||||
|
||||
m[0][0] = s[0];
|
||||
m[0][1] = t[0];
|
||||
m[0][2] = -f[0];
|
||||
m[0][3] = 0.f;
|
||||
|
||||
m[1][0] = s[1];
|
||||
m[1][1] = t[1];
|
||||
m[1][2] = -f[1];
|
||||
m[1][3] = 0.f;
|
||||
|
||||
m[2][0] = s[2];
|
||||
m[2][1] = t[2];
|
||||
m[2][2] = -f[2];
|
||||
m[2][3] = 0.f;
|
||||
|
||||
m[3][0] = 0.f;
|
||||
m[3][1] = 0.f;
|
||||
m[3][2] = 0.f;
|
||||
m[3][3] = 1.f;
|
||||
|
||||
mat4x4_translate_in_place(m, -eye[0], -eye[1], -eye[2]);
|
||||
}
|
||||
|
||||
typedef float quat[4];
|
||||
static inline void quat_identity(quat q)
|
||||
{
|
||||
q[0] = q[1] = q[2] = 0.f;
|
||||
q[3] = 1.f;
|
||||
}
|
||||
static inline void quat_add(quat r, quat a, quat b)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
r[i] = a[i] + b[i];
|
||||
}
|
||||
static inline void quat_sub(quat r, quat a, quat b)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
r[i] = a[i] - b[i];
|
||||
}
|
||||
static inline void quat_mul(quat r, quat p, quat q)
|
||||
{
|
||||
vec3 w;
|
||||
vec3_mul_cross(r, p, q);
|
||||
vec3_scale(w, p, q[3]);
|
||||
vec3_add(r, r, w);
|
||||
vec3_scale(w, q, p[3]);
|
||||
vec3_add(r, r, w);
|
||||
r[3] = p[3] * q[3] - vec3_mul_inner(p, q);
|
||||
}
|
||||
static inline void quat_scale(quat r, quat v, float s)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
r[i] = v[i] * s;
|
||||
}
|
||||
static inline float quat_inner_product(quat a, quat b)
|
||||
{
|
||||
float p = 0.f;
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
p += b[i] * a[i];
|
||||
return p;
|
||||
}
|
||||
static inline void quat_conj(quat r, quat q)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 3; ++i)
|
||||
r[i] = -q[i];
|
||||
r[3] = q[3];
|
||||
}
|
||||
static inline void quat_rotate(quat r, float angle, vec3 axis)
|
||||
{
|
||||
int i;
|
||||
vec3 v;
|
||||
vec3_scale(v, axis, sinf(angle / 2));
|
||||
for (i = 0; i < 3; ++i)
|
||||
r[i] = v[i];
|
||||
r[3] = cosf(angle / 2);
|
||||
}
|
||||
#define quat_norm vec4_norm
|
||||
static inline void quat_mul_vec3(vec3 r, quat q, vec3 v)
|
||||
{
|
||||
/*
|
||||
* Method by Fabian 'ryg' Giessen (of Farbrausch)
|
||||
t = 2 * cross(q.xyz, v)
|
||||
v' = v + q.w * t + cross(q.xyz, t)
|
||||
*/
|
||||
vec3 t = {q[0], q[1], q[2]};
|
||||
vec3 u = {q[0], q[1], q[2]};
|
||||
|
||||
vec3_mul_cross(t, t, v);
|
||||
vec3_scale(t, t, 2);
|
||||
|
||||
vec3_mul_cross(u, u, t);
|
||||
vec3_scale(t, t, q[3]);
|
||||
|
||||
vec3_add(r, v, t);
|
||||
vec3_add(r, r, u);
|
||||
}
|
||||
static inline void mat4x4_from_quat(mat4x4 M, quat q)
|
||||
{
|
||||
float a = q[3];
|
||||
float b = q[0];
|
||||
float c = q[1];
|
||||
float d = q[2];
|
||||
float a2 = a * a;
|
||||
float b2 = b * b;
|
||||
float c2 = c * c;
|
||||
float d2 = d * d;
|
||||
|
||||
M[0][0] = a2 + b2 - c2 - d2;
|
||||
M[0][1] = 2.f * (b * c + a * d);
|
||||
M[0][2] = 2.f * (b * d - a * c);
|
||||
M[0][3] = 0.f;
|
||||
|
||||
M[1][0] = 2 * (b * c - a * d);
|
||||
M[1][1] = a2 - b2 + c2 - d2;
|
||||
M[1][2] = 2.f * (c * d + a * b);
|
||||
M[1][3] = 0.f;
|
||||
|
||||
M[2][0] = 2.f * (b * d + a * c);
|
||||
M[2][1] = 2.f * (c * d - a * b);
|
||||
M[2][2] = a2 - b2 - c2 + d2;
|
||||
M[2][3] = 0.f;
|
||||
|
||||
M[3][0] = M[3][1] = M[3][2] = 0.f;
|
||||
M[3][3] = 1.f;
|
||||
}
|
||||
|
||||
static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q)
|
||||
{
|
||||
/* XXX: The way this is written only works for othogonal matrices. */
|
||||
/* TODO: Take care of non-orthogonal case. */
|
||||
quat_mul_vec3(R[0], q, M[0]);
|
||||
quat_mul_vec3(R[1], q, M[1]);
|
||||
quat_mul_vec3(R[2], q, M[2]);
|
||||
|
||||
R[3][0] = R[3][1] = R[3][2] = 0.f;
|
||||
R[3][3] = 1.f;
|
||||
}
|
||||
static inline void quat_from_mat4x4(quat q, mat4x4 M)
|
||||
{
|
||||
float r = 0.f;
|
||||
int i;
|
||||
|
||||
int perm[] = {0, 1, 2, 0, 1};
|
||||
int *p = perm;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
float m = M[i][i];
|
||||
if (m < r)
|
||||
continue;
|
||||
m = r;
|
||||
p = &perm[i];
|
||||
}
|
||||
|
||||
r = (float)sqrt(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]]);
|
||||
|
||||
if (r < 1e-6)
|
||||
{
|
||||
q[0] = 1.f;
|
||||
q[1] = q[2] = q[3] = 0.f;
|
||||
return;
|
||||
}
|
||||
|
||||
q[0] = r / 2.f;
|
||||
q[1] = (M[p[0]][p[1]] - M[p[1]][p[0]]) / (2.f * r);
|
||||
q[2] = (M[p[2]][p[0]] - M[p[0]][p[2]]) / (2.f * r);
|
||||
q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]]) / (2.f * r);
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue