diff --git a/CMakeLists.txt b/CMakeLists.txt index e1608021..96ce562d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,43 +1,41 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -cmake_minimum_required(VERSION 3.13) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED True) - -# Variable Caches -set(DAWN_CACHE_TARGET "dawn-target") -set(DAWN_TARGET_NAME "Dawn") - -if(NOT DEFINED DAWN_TARGET) - set(DAWN_TARGET linux-x64-glfw CACHE INTERNAL ${DAWN_CACHE_TARGET}) -endif() - -# Set Common Build Variables -set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}") -set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}") -set(DAWN_SOURCES_DIR "${DAWN_ROOT_DIR}/src") -set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools") -set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets") -set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets") -set(DAWN_GENERATED_DIR "${DAWN_BUILD_DIR}/generated") -set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp") - -# Initialize Project. -project(Dawn - VERSION 1.0.0 - LANGUAGES C CXX -) - -# Add tools -add_subdirectory(tools) - -# Add Libraries -add_subdirectory(lib) - -# Add Project Files +# Copyright (c) 2024 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +cmake_minimum_required(VERSION 3.13) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Variable Caches +set(DAWN_CACHE_TARGET "dawn-target") +set(DAWN_TARGET_NAME "Dawn") + +if(NOT DEFINED DAWN_TARGET) + set(DAWN_TARGET linux-x64-glfw CACHE INTERNAL ${DAWN_CACHE_TARGET}) +endif() + +# Set Common Build Variables +set(DAWN_ROOT_DIR "${CMAKE_SOURCE_DIR}") +set(DAWN_BUILD_DIR "${CMAKE_BINARY_DIR}") +set(DAWN_SOURCES_DIR "${DAWN_ROOT_DIR}/src") +# set(DAWN_TOOLS_DIR "${DAWN_ROOT_DIR}/tools") +# set(DAWN_ASSETS_SOURCE_DIR "${DAWN_ROOT_DIR}/assets") +# set(DAWN_ASSETS_BUILD_DIR "${DAWN_BUILD_DIR}/assets") +set(DAWN_GENERATED_DIR "${DAWN_BUILD_DIR}/generated") +set(DAWN_TEMP_DIR "${DAWN_BUILD_DIR}/temp") + +# Initialize Project. +project(Dawn + VERSION 1.0.0 + LANGUAGES C +) + +# Add tools +# add_subdirectory(tools) + +# Add Libraries +# add_subdirectory(lib) + +# Add Project Files add_subdirectory(src) \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 362069fd..00000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Dawn Project -Simple in code, complex in structure game engine for creating small, fast and -reusable games. \ No newline at end of file diff --git a/assets/dawnrpg/CMakeLists.txt b/assets/dawnrpg/CMakeLists.txt deleted file mode 100644 index 75919a7b..00000000 --- a/assets/dawnrpg/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2024 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -tool_truetype(font_silver "${CMAKE_CURRENT_LIST_DIR}/Silver.ttf") -tool_copy(json_test "${CMAKE_CURRENT_LIST_DIR}/test.json" "${DAWN_ASSETS_BUILD_DIR}/test.json") \ No newline at end of file diff --git a/assets/dawnrpg/Silver.ttf b/assets/dawnrpg/Silver.ttf deleted file mode 100644 index a6cbc52a..00000000 Binary files a/assets/dawnrpg/Silver.ttf and /dev/null differ diff --git a/assets/dawnrpg/test.json b/assets/dawnrpg/test.json deleted file mode 100644 index e34da1c8..00000000 --- a/assets/dawnrpg/test.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Some Map", - "width": 3, - "height": 3, - "depth": 3, - "tiles": [ - 0, 0, 0, - 0, 0, 0, - 0, 0, 0 - ] -} \ No newline at end of file diff --git a/lib/AudioFile b/lib/AudioFile deleted file mode 160000 index 004065d0..00000000 --- a/lib/AudioFile +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 004065d01e9b7338580390d4fdbfbaa46adede4e diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index 2681eb3f..00000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2021 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -include(FetchContent) - -# GLM -FetchContent_Declare( - glm - GIT_REPOSITORY https://github.com/g-truc/glm.git - GIT_TAG bf71a834948186f4097caa076cd2663c69a10e1e -) -FetchContent_MakeAvailable(glm) - -# JSON -FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz) -FetchContent_MakeAvailable(json) - -# GLAD -add_subdirectory(glad) - -# GLFW -FetchContent_Declare(glfw URL https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip) -FetchContent_MakeAvailable(glfw) - -# LibArchive -FetchContent_Declare(libarchive URL https://github.com/libarchive/libarchive/releases/download/v3.7.6/libarchive-3.7.6.tar.xz) -FetchContent_MakeAvailable(libarchive) - -# FreeType -FetchContent_Declare(freetype URL https://psychz.dl.sourceforge.net/project/freetype/freetype2/2.13.3/freetype-2.13.3.tar.xz?viasf=1) -FetchContent_MakeAvailable(freetype) - -# if(DAWN_TARGET_OPENAL) -# set(LIBTYPE "STATIC") -# add_subdirectory(openal-soft) - -# set(BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE) -# set(BUILD_EXAMPLES OFF CACHE BOOL "Build examples" FORCE) -# add_subdirectory(AudioFile) -# endif() \ No newline at end of file diff --git a/lib/glad/CMakeLists.txt b/lib/glad/CMakeLists.txt deleted file mode 100644 index beb7921d..00000000 --- a/lib/glad/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.11) -project(glad) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) - -add_library(${PROJECT_NAME} - src/glad.c -) -target_include_directories(${PROJECT_NAME} - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/include -) \ No newline at end of file diff --git a/lib/glad/include/KHR/khrplatform.h b/lib/glad/include/KHR/khrplatform.h deleted file mode 100644 index dd22d927..00000000 --- a/lib/glad/include/KHR/khrplatform.h +++ /dev/null @@ -1,290 +0,0 @@ -#ifndef __khrplatform_h_ -#define __khrplatform_h_ - -/* -** Copyright (c) 2008-2018 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. - * - * The master copy of khrplatform.h is maintained in the Khronos EGL - * Registry repository at https://github.com/KhronosGroup/EGL-Registry - * The last semantic modification to khrplatform.h was at commit ID: - * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 - * - * 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 filing pull requests or issues on - * the EGL Registry repository linked above. - * - * - * 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 - * 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; - */ - -#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) -# define KHRONOS_STATIC 1 -#endif - -/*------------------------------------------------------------------------- - * Definition of KHRONOS_APICALL - *------------------------------------------------------------------------- - * This precedes the return type of the function in the function prototype. - */ -#if defined(KHRONOS_STATIC) - /* If the preprocessor constant KHRONOS_STATIC is defined, make the - * header compatible with static linking. */ -# define KHRONOS_APICALL -#elif defined(_WIN32) -# 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 - */ -#include -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 - */ -#include -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 -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_ */ diff --git a/lib/glad/include/glad/glad.h b/lib/glad/include/glad/glad.h deleted file mode 100644 index 9288e578..00000000 --- a/lib/glad/include/glad/glad.h +++ /dev/null @@ -1,4068 +0,0 @@ -/* - - OpenGL, OpenGL ES loader generated by glad 0.1.34 on Mon Mar 8 05:39:10 2021. - - Language/Generator: C/C++ - Specification: gl - APIs: gl=4.0, gles2=3.0, gles1=1.0 - Profile: compatibility - Extensions: - - Loader: True - Local files: False - Omit khrplatform: False - Reproducible: False - - Commandline: - --profile="compatibility" --api="gl=4.0,gles2=3.0,gles1=1.0" --generator="c" --spec="gl" --extensions="" - Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.0&api=gles2%3D3.0&api=gles1%3D1.0 -*/ - - -#ifndef __glad_h_ -#define __glad_h_ - -#ifdef __gl_h_ -#error OpenGL header already included, remove this include, glad already provides it -#endif -#define __gl_h_ - -#ifdef __gl2_h_ -#error OpenGL ES 2 header already included, remove this include, glad already provides it -#endif -#define __gl2_h_ - -#ifdef __gl3_h_ -#error OpenGL ES 3 header already included, remove this include, glad already provides it -#endif -#define __gl3_h_ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define APIENTRY __stdcall -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif - -#ifndef GLAPIENTRY -#define GLAPIENTRY APIENTRY -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -struct gladGLversionStruct { - int major; - int minor; -}; - -typedef void* (* GLADloadproc)(const char *name); - -#ifndef GLAPI -# if defined(GLAD_GLAPI_EXPORT) -# if defined(_WIN32) || defined(__CYGWIN__) -# if defined(GLAD_GLAPI_EXPORT_BUILD) -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllexport)) extern -# else -# define GLAPI __declspec(dllexport) extern -# endif -# else -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllimport)) extern -# else -# define GLAPI __declspec(dllimport) extern -# endif -# endif -# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) -# define GLAPI __attribute__ ((visibility ("default"))) extern -# else -# define GLAPI extern -# endif -# else -# define GLAPI extern -# endif -#endif - -GLAPI struct gladGLversionStruct GLVersion; - -GLAPI int gladLoadGL(void); - -GLAPI int gladLoadGLLoader(GLADloadproc); - -GLAPI int gladLoadGLES2Loader(GLADloadproc); - -GLAPI int gladLoadGLES1Loader(GLADloadproc); - -#include -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef void GLvoid; -typedef khronos_int8_t GLbyte; -typedef khronos_uint8_t GLubyte; -typedef khronos_int16_t GLshort; -typedef khronos_uint16_t GLushort; -typedef int GLint; -typedef unsigned int GLuint; -typedef khronos_int32_t GLclampx; -typedef int GLsizei; -typedef khronos_float_t GLfloat; -typedef khronos_float_t GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void *GLeglClientBufferEXT; -typedef void *GLeglImageOES; -typedef char GLchar; -typedef char GLcharARB; -#ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif -typedef khronos_uint16_t GLhalf; -typedef khronos_uint16_t GLhalfARB; -typedef khronos_int32_t GLfixed; -typedef khronos_intptr_t GLintptr; -typedef khronos_intptr_t GLintptrARB; -typedef khronos_ssize_t GLsizeiptr; -typedef khronos_ssize_t GLsizeiptrARB; -typedef khronos_int64_t GLint64; -typedef khronos_int64_t GLint64EXT; -typedef khronos_uint64_t GLuint64; -typedef khronos_uint64_t GLuint64EXT; -typedef struct __GLsync *GLsync; -struct _cl_context; -struct _cl_event; -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); -typedef unsigned short GLhalfNV; -typedef GLintptr GLvdpauSurfaceNV; -typedef void (APIENTRY *GLVULKANPROCNV)(void); -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_VIEWPORT 0x0BA2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F -#define GL_TEXTURE 0x1702 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_REPEAT 0x2901 -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_LOGIC_OP 0x0BF1 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_TEXTURE_COMPONENTS 0x1003 -#define GL_TEXTURE_BORDER 0x1005 -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_COLOR_INDEX 0x1900 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_BITMAP 0x1A00 -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 -#define GL_TEXTURE_ENV 0x2300 -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 -#define GL_CLAMP 0x2900 -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_DOUBLE 0x140A -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_RESCALE_NORMAL 0x803A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_EQUATION 0x8009 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_FUNC_SUBTRACT 0x800A -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_FOG_COORD_SRC 0x8450 -#define GL_FOG_COORD 0x8451 -#define GL_CURRENT_FOG_COORD 0x8453 -#define GL_FOG_COORD_ARRAY_TYPE 0x8454 -#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORD_ARRAY_POINTER 0x8456 -#define GL_FOG_COORD_ARRAY 0x8457 -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC2_ALPHA 0x858A -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_INDEX 0x8222 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B -#define GL_ALPHA_INTEGER 0x8D97 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFF -#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 -#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 -#define GL_LINES_ADJACENCY 0x000A -#define GL_LINE_STRIP_ADJACENCY 0x000B -#define GL_TRIANGLES_ADJACENCY 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D -#define GL_PROGRAM_POINT_SIZE 0x8642 -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 -#define GL_GEOMETRY_SHADER 0x8DD9 -#define GL_GEOMETRY_VERTICES_OUT 0x8916 -#define GL_GEOMETRY_INPUT_TYPE 0x8917 -#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_CONTEXT_PROFILE_MASK 0x9126 -#define GL_DEPTH_CLAMP 0x864F -#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C -#define GL_FIRST_VERTEX_CONVENTION 0x8E4D -#define GL_LAST_VERTEX_CONVENTION 0x8E4E -#define GL_PROVOKING_VERTEX 0x8E4F -#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 -#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_SRC1_COLOR 0x88F9 -#define GL_ONE_MINUS_SRC1_COLOR 0x88FA -#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB -#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 -#define GL_TIME_ELAPSED 0x88BF -#define GL_TIMESTAMP 0x8E28 -#define GL_INT_2_10_10_10_REV 0x8D9F -#define GL_SAMPLE_SHADING 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A -#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B -#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D -#define GL_MAX_VERTEX_STREAMS 0x8E71 -#define GL_DOUBLE_VEC2 0x8FFC -#define GL_DOUBLE_VEC3 0x8FFD -#define GL_DOUBLE_VEC4 0x8FFE -#define GL_DOUBLE_MAT2 0x8F46 -#define GL_DOUBLE_MAT3 0x8F47 -#define GL_DOUBLE_MAT4 0x8F48 -#define GL_DOUBLE_MAT2x3 0x8F49 -#define GL_DOUBLE_MAT2x4 0x8F4A -#define GL_DOUBLE_MAT3x2 0x8F4B -#define GL_DOUBLE_MAT3x4 0x8F4C -#define GL_DOUBLE_MAT4x2 0x8F4D -#define GL_DOUBLE_MAT4x3 0x8F4E -#define GL_ACTIVE_SUBROUTINES 0x8DE5 -#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 -#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48 -#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49 -#define GL_MAX_SUBROUTINES 0x8DE7 -#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8 -#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A -#define GL_COMPATIBLE_SUBROUTINES 0x8E4B -#define GL_PATCHES 0x000E -#define GL_PATCH_VERTICES 0x8E72 -#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 -#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74 -#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75 -#define GL_TESS_GEN_MODE 0x8E76 -#define GL_TESS_GEN_SPACING 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER 0x8E78 -#define GL_TESS_GEN_POINT_MODE 0x8E79 -#define GL_ISOLINES 0x8E7A -#define GL_FRACTIONAL_ODD 0x8E7B -#define GL_FRACTIONAL_EVEN 0x8E7C -#define GL_MAX_PATCH_VERTICES 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1 -#define GL_TESS_EVALUATION_SHADER 0x8E87 -#define GL_TESS_CONTROL_SHADER 0x8E88 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 -#define GL_FIXED 0x140C -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_RGB565 0x8D62 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -#define GL_VERSION_ES_CL_1_0 1 -#define GL_VERSION_ES_CM_1_1 1 -#define GL_VERSION_ES_CL_1_1 1 -#ifndef GL_VERSION_1_0 -#define GL_VERSION_1_0 1 -GLAPI int GLAD_GL_VERSION_1_0; -typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); -GLAPI PFNGLCULLFACEPROC glad_glCullFace; -#define glCullFace glad_glCullFace -typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); -GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; -#define glFrontFace glad_glFrontFace -typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); -GLAPI PFNGLHINTPROC glad_glHint; -#define glHint glad_glHint -typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); -GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; -#define glLineWidth glad_glLineWidth -typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); -GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; -#define glPointSize glad_glPointSize -typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); -GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; -#define glPolygonMode glad_glPolygonMode -typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLSCISSORPROC glad_glScissor; -#define glScissor glad_glScissor -typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); -GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; -#define glTexParameterf glad_glTexParameterf -typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; -#define glTexParameterfv glad_glTexParameterfv -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; -#define glTexParameteri glad_glTexParameteri -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; -#define glTexParameteriv glad_glTexParameteriv -typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; -#define glTexImage1D glad_glTexImage1D -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; -#define glTexImage2D glad_glTexImage2D -typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); -GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; -#define glDrawBuffer glad_glDrawBuffer -typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); -GLAPI PFNGLCLEARPROC glad_glClear; -#define glClear glad_glClear -typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; -#define glClearColor glad_glClearColor -typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); -GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; -#define glClearStencil glad_glClearStencil -typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); -GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; -#define glClearDepth glad_glClearDepth -typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); -GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; -#define glStencilMask glad_glStencilMask -typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GLAPI PFNGLCOLORMASKPROC glad_glColorMask; -#define glColorMask glad_glColorMask -typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); -GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; -#define glDepthMask glad_glDepthMask -typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); -GLAPI PFNGLDISABLEPROC glad_glDisable; -#define glDisable glad_glDisable -typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); -GLAPI PFNGLENABLEPROC glad_glEnable; -#define glEnable glad_glEnable -typedef void (APIENTRYP PFNGLFINISHPROC)(void); -GLAPI PFNGLFINISHPROC glad_glFinish; -#define glFinish glad_glFinish -typedef void (APIENTRYP PFNGLFLUSHPROC)(void); -GLAPI PFNGLFLUSHPROC glad_glFlush; -#define glFlush glad_glFlush -typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; -#define glBlendFunc glad_glBlendFunc -typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); -GLAPI PFNGLLOGICOPPROC glad_glLogicOp; -#define glLogicOp glad_glLogicOp -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; -#define glStencilFunc glad_glStencilFunc -typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; -#define glStencilOp glad_glStencilOp -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); -GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; -#define glDepthFunc glad_glDepthFunc -typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; -#define glPixelStoref glad_glPixelStoref -typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; -#define glPixelStorei glad_glPixelStorei -typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); -GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; -#define glReadBuffer glad_glReadBuffer -typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; -#define glReadPixels glad_glReadPixels -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); -GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; -#define glGetBooleanv glad_glGetBooleanv -typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); -GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; -#define glGetDoublev glad_glGetDoublev -typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); -GLAPI PFNGLGETERRORPROC glad_glGetError; -#define glGetError glad_glGetError -typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); -GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; -#define glGetFloatv glad_glGetFloatv -typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); -GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; -#define glGetIntegerv glad_glGetIntegerv -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); -GLAPI PFNGLGETSTRINGPROC glad_glGetString; -#define glGetString glad_glGetString -typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; -#define glGetTexImage glad_glGetTexImage -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; -#define glGetTexParameterfv glad_glGetTexParameterfv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; -#define glGetTexParameteriv glad_glGetTexParameteriv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; -#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; -#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); -GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; -#define glIsEnabled glad_glIsEnabled -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); -GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; -#define glDepthRange glad_glDepthRange -typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLVIEWPORTPROC glad_glViewport; -#define glViewport glad_glViewport -typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode); -GLAPI PFNGLNEWLISTPROC glad_glNewList; -#define glNewList glad_glNewList -typedef void (APIENTRYP PFNGLENDLISTPROC)(void); -GLAPI PFNGLENDLISTPROC glad_glEndList; -#define glEndList glad_glEndList -typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list); -GLAPI PFNGLCALLLISTPROC glad_glCallList; -#define glCallList glad_glCallList -typedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists); -GLAPI PFNGLCALLLISTSPROC glad_glCallLists; -#define glCallLists glad_glCallLists -typedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); -GLAPI PFNGLDELETELISTSPROC glad_glDeleteLists; -#define glDeleteLists glad_glDeleteLists -typedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range); -GLAPI PFNGLGENLISTSPROC glad_glGenLists; -#define glGenLists glad_glGenLists -typedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base); -GLAPI PFNGLLISTBASEPROC glad_glListBase; -#define glListBase glad_glListBase -typedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode); -GLAPI PFNGLBEGINPROC glad_glBegin; -#define glBegin glad_glBegin -typedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); -GLAPI PFNGLBITMAPPROC glad_glBitmap; -#define glBitmap glad_glBitmap -typedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -GLAPI PFNGLCOLOR3BPROC glad_glColor3b; -#define glColor3b glad_glColor3b -typedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v); -GLAPI PFNGLCOLOR3BVPROC glad_glColor3bv; -#define glColor3bv glad_glColor3bv -typedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -GLAPI PFNGLCOLOR3DPROC glad_glColor3d; -#define glColor3d glad_glColor3d -typedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v); -GLAPI PFNGLCOLOR3DVPROC glad_glColor3dv; -#define glColor3dv glad_glColor3dv -typedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -GLAPI PFNGLCOLOR3FPROC glad_glColor3f; -#define glColor3f glad_glColor3f -typedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v); -GLAPI PFNGLCOLOR3FVPROC glad_glColor3fv; -#define glColor3fv glad_glColor3fv -typedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); -GLAPI PFNGLCOLOR3IPROC glad_glColor3i; -#define glColor3i glad_glColor3i -typedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v); -GLAPI PFNGLCOLOR3IVPROC glad_glColor3iv; -#define glColor3iv glad_glColor3iv -typedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -GLAPI PFNGLCOLOR3SPROC glad_glColor3s; -#define glColor3s glad_glColor3s -typedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v); -GLAPI PFNGLCOLOR3SVPROC glad_glColor3sv; -#define glColor3sv glad_glColor3sv -typedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -GLAPI PFNGLCOLOR3UBPROC glad_glColor3ub; -#define glColor3ub glad_glColor3ub -typedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v); -GLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv; -#define glColor3ubv glad_glColor3ubv -typedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -GLAPI PFNGLCOLOR3UIPROC glad_glColor3ui; -#define glColor3ui glad_glColor3ui -typedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v); -GLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv; -#define glColor3uiv glad_glColor3uiv -typedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -GLAPI PFNGLCOLOR3USPROC glad_glColor3us; -#define glColor3us glad_glColor3us -typedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v); -GLAPI PFNGLCOLOR3USVPROC glad_glColor3usv; -#define glColor3usv glad_glColor3usv -typedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); -GLAPI PFNGLCOLOR4BPROC glad_glColor4b; -#define glColor4b glad_glColor4b -typedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v); -GLAPI PFNGLCOLOR4BVPROC glad_glColor4bv; -#define glColor4bv glad_glColor4bv -typedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); -GLAPI PFNGLCOLOR4DPROC glad_glColor4d; -#define glColor4d glad_glColor4d -typedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v); -GLAPI PFNGLCOLOR4DVPROC glad_glColor4dv; -#define glColor4dv glad_glColor4dv -typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCOLOR4FPROC glad_glColor4f; -#define glColor4f glad_glColor4f -typedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v); -GLAPI PFNGLCOLOR4FVPROC glad_glColor4fv; -#define glColor4fv glad_glColor4fv -typedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); -GLAPI PFNGLCOLOR4IPROC glad_glColor4i; -#define glColor4i glad_glColor4i -typedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v); -GLAPI PFNGLCOLOR4IVPROC glad_glColor4iv; -#define glColor4iv glad_glColor4iv -typedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); -GLAPI PFNGLCOLOR4SPROC glad_glColor4s; -#define glColor4s glad_glColor4s -typedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v); -GLAPI PFNGLCOLOR4SVPROC glad_glColor4sv; -#define glColor4sv glad_glColor4sv -typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; -#define glColor4ub glad_glColor4ub -typedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v); -GLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv; -#define glColor4ubv glad_glColor4ubv -typedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); -GLAPI PFNGLCOLOR4UIPROC glad_glColor4ui; -#define glColor4ui glad_glColor4ui -typedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v); -GLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv; -#define glColor4uiv glad_glColor4uiv -typedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); -GLAPI PFNGLCOLOR4USPROC glad_glColor4us; -#define glColor4us glad_glColor4us -typedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v); -GLAPI PFNGLCOLOR4USVPROC glad_glColor4usv; -#define glColor4usv glad_glColor4usv -typedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag); -GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag; -#define glEdgeFlag glad_glEdgeFlag -typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag); -GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; -#define glEdgeFlagv glad_glEdgeFlagv -typedef void (APIENTRYP PFNGLENDPROC)(void); -GLAPI PFNGLENDPROC glad_glEnd; -#define glEnd glad_glEnd -typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c); -GLAPI PFNGLINDEXDPROC glad_glIndexd; -#define glIndexd glad_glIndexd -typedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c); -GLAPI PFNGLINDEXDVPROC glad_glIndexdv; -#define glIndexdv glad_glIndexdv -typedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c); -GLAPI PFNGLINDEXFPROC glad_glIndexf; -#define glIndexf glad_glIndexf -typedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c); -GLAPI PFNGLINDEXFVPROC glad_glIndexfv; -#define glIndexfv glad_glIndexfv -typedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c); -GLAPI PFNGLINDEXIPROC glad_glIndexi; -#define glIndexi glad_glIndexi -typedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c); -GLAPI PFNGLINDEXIVPROC glad_glIndexiv; -#define glIndexiv glad_glIndexiv -typedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c); -GLAPI PFNGLINDEXSPROC glad_glIndexs; -#define glIndexs glad_glIndexs -typedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c); -GLAPI PFNGLINDEXSVPROC glad_glIndexsv; -#define glIndexsv glad_glIndexsv -typedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); -GLAPI PFNGLNORMAL3BPROC glad_glNormal3b; -#define glNormal3b glad_glNormal3b -typedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v); -GLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv; -#define glNormal3bv glad_glNormal3bv -typedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); -GLAPI PFNGLNORMAL3DPROC glad_glNormal3d; -#define glNormal3d glad_glNormal3d -typedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v); -GLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv; -#define glNormal3dv glad_glNormal3dv -typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); -GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; -#define glNormal3f glad_glNormal3f -typedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v); -GLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv; -#define glNormal3fv glad_glNormal3fv -typedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); -GLAPI PFNGLNORMAL3IPROC glad_glNormal3i; -#define glNormal3i glad_glNormal3i -typedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v); -GLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv; -#define glNormal3iv glad_glNormal3iv -typedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); -GLAPI PFNGLNORMAL3SPROC glad_glNormal3s; -#define glNormal3s glad_glNormal3s -typedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v); -GLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv; -#define glNormal3sv glad_glNormal3sv -typedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d; -#define glRasterPos2d glad_glRasterPos2d -typedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; -#define glRasterPos2dv glad_glRasterPos2dv -typedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f; -#define glRasterPos2f glad_glRasterPos2f -typedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; -#define glRasterPos2fv glad_glRasterPos2fv -typedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y); -GLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i; -#define glRasterPos2i glad_glRasterPos2i -typedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; -#define glRasterPos2iv glad_glRasterPos2iv -typedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s; -#define glRasterPos2s glad_glRasterPos2s -typedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; -#define glRasterPos2sv glad_glRasterPos2sv -typedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d; -#define glRasterPos3d glad_glRasterPos3d -typedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; -#define glRasterPos3dv glad_glRasterPos3dv -typedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f; -#define glRasterPos3f glad_glRasterPos3f -typedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; -#define glRasterPos3fv glad_glRasterPos3fv -typedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i; -#define glRasterPos3i glad_glRasterPos3i -typedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; -#define glRasterPos3iv glad_glRasterPos3iv -typedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s; -#define glRasterPos3s glad_glRasterPos3s -typedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; -#define glRasterPos3sv glad_glRasterPos3sv -typedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d; -#define glRasterPos4d glad_glRasterPos4d -typedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; -#define glRasterPos4dv glad_glRasterPos4dv -typedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f; -#define glRasterPos4f glad_glRasterPos4f -typedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; -#define glRasterPos4fv glad_glRasterPos4fv -typedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i; -#define glRasterPos4i glad_glRasterPos4i -typedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; -#define glRasterPos4iv glad_glRasterPos4iv -typedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s; -#define glRasterPos4s glad_glRasterPos4s -typedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; -#define glRasterPos4sv glad_glRasterPos4sv -typedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); -GLAPI PFNGLRECTDPROC glad_glRectd; -#define glRectd glad_glRectd -typedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2); -GLAPI PFNGLRECTDVPROC glad_glRectdv; -#define glRectdv glad_glRectdv -typedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); -GLAPI PFNGLRECTFPROC glad_glRectf; -#define glRectf glad_glRectf -typedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2); -GLAPI PFNGLRECTFVPROC glad_glRectfv; -#define glRectfv glad_glRectfv -typedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); -GLAPI PFNGLRECTIPROC glad_glRecti; -#define glRecti glad_glRecti -typedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2); -GLAPI PFNGLRECTIVPROC glad_glRectiv; -#define glRectiv glad_glRectiv -typedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); -GLAPI PFNGLRECTSPROC glad_glRects; -#define glRects glad_glRects -typedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2); -GLAPI PFNGLRECTSVPROC glad_glRectsv; -#define glRectsv glad_glRectsv -typedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s); -GLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d; -#define glTexCoord1d glad_glTexCoord1d -typedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; -#define glTexCoord1dv glad_glTexCoord1dv -typedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s); -GLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f; -#define glTexCoord1f glad_glTexCoord1f -typedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; -#define glTexCoord1fv glad_glTexCoord1fv -typedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s); -GLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i; -#define glTexCoord1i glad_glTexCoord1i -typedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; -#define glTexCoord1iv glad_glTexCoord1iv -typedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s); -GLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s; -#define glTexCoord1s glad_glTexCoord1s -typedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; -#define glTexCoord1sv glad_glTexCoord1sv -typedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); -GLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d; -#define glTexCoord2d glad_glTexCoord2d -typedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; -#define glTexCoord2dv glad_glTexCoord2dv -typedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); -GLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f; -#define glTexCoord2f glad_glTexCoord2f -typedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; -#define glTexCoord2fv glad_glTexCoord2fv -typedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t); -GLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i; -#define glTexCoord2i glad_glTexCoord2i -typedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; -#define glTexCoord2iv glad_glTexCoord2iv -typedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); -GLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s; -#define glTexCoord2s glad_glTexCoord2s -typedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; -#define glTexCoord2sv glad_glTexCoord2sv -typedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); -GLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d; -#define glTexCoord3d glad_glTexCoord3d -typedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; -#define glTexCoord3dv glad_glTexCoord3dv -typedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); -GLAPI PFNGLTEXCOORD3FPROC glad_glTexCoord3f; -#define glTexCoord3f glad_glTexCoord3f -typedef void (APIENTRYP PFNGLTEXCOORD3FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; -#define glTexCoord3fv glad_glTexCoord3fv -typedef void (APIENTRYP PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); -GLAPI PFNGLTEXCOORD3IPROC glad_glTexCoord3i; -#define glTexCoord3i glad_glTexCoord3i -typedef void (APIENTRYP PFNGLTEXCOORD3IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; -#define glTexCoord3iv glad_glTexCoord3iv -typedef void (APIENTRYP PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); -GLAPI PFNGLTEXCOORD3SPROC glad_glTexCoord3s; -#define glTexCoord3s glad_glTexCoord3s -typedef void (APIENTRYP PFNGLTEXCOORD3SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; -#define glTexCoord3sv glad_glTexCoord3sv -typedef void (APIENTRYP PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI PFNGLTEXCOORD4DPROC glad_glTexCoord4d; -#define glTexCoord4d glad_glTexCoord4d -typedef void (APIENTRYP PFNGLTEXCOORD4DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; -#define glTexCoord4dv glad_glTexCoord4dv -typedef void (APIENTRYP PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI PFNGLTEXCOORD4FPROC glad_glTexCoord4f; -#define glTexCoord4f glad_glTexCoord4f -typedef void (APIENTRYP PFNGLTEXCOORD4FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; -#define glTexCoord4fv glad_glTexCoord4fv -typedef void (APIENTRYP PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); -GLAPI PFNGLTEXCOORD4IPROC glad_glTexCoord4i; -#define glTexCoord4i glad_glTexCoord4i -typedef void (APIENTRYP PFNGLTEXCOORD4IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; -#define glTexCoord4iv glad_glTexCoord4iv -typedef void (APIENTRYP PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI PFNGLTEXCOORD4SPROC glad_glTexCoord4s; -#define glTexCoord4s glad_glTexCoord4s -typedef void (APIENTRYP PFNGLTEXCOORD4SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; -#define glTexCoord4sv glad_glTexCoord4sv -typedef void (APIENTRYP PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLVERTEX2DPROC glad_glVertex2d; -#define glVertex2d glad_glVertex2d -typedef void (APIENTRYP PFNGLVERTEX2DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX2DVPROC glad_glVertex2dv; -#define glVertex2dv glad_glVertex2dv -typedef void (APIENTRYP PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLVERTEX2FPROC glad_glVertex2f; -#define glVertex2f glad_glVertex2f -typedef void (APIENTRYP PFNGLVERTEX2FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX2FVPROC glad_glVertex2fv; -#define glVertex2fv glad_glVertex2fv -typedef void (APIENTRYP PFNGLVERTEX2IPROC)(GLint x, GLint y); -GLAPI PFNGLVERTEX2IPROC glad_glVertex2i; -#define glVertex2i glad_glVertex2i -typedef void (APIENTRYP PFNGLVERTEX2IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX2IVPROC glad_glVertex2iv; -#define glVertex2iv glad_glVertex2iv -typedef void (APIENTRYP PFNGLVERTEX2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLVERTEX2SPROC glad_glVertex2s; -#define glVertex2s glad_glVertex2s -typedef void (APIENTRYP PFNGLVERTEX2SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX2SVPROC glad_glVertex2sv; -#define glVertex2sv glad_glVertex2sv -typedef void (APIENTRYP PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLVERTEX3DPROC glad_glVertex3d; -#define glVertex3d glad_glVertex3d -typedef void (APIENTRYP PFNGLVERTEX3DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX3DVPROC glad_glVertex3dv; -#define glVertex3dv glad_glVertex3dv -typedef void (APIENTRYP PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLVERTEX3FPROC glad_glVertex3f; -#define glVertex3f glad_glVertex3f -typedef void (APIENTRYP PFNGLVERTEX3FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX3FVPROC glad_glVertex3fv; -#define glVertex3fv glad_glVertex3fv -typedef void (APIENTRYP PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLVERTEX3IPROC glad_glVertex3i; -#define glVertex3i glad_glVertex3i -typedef void (APIENTRYP PFNGLVERTEX3IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX3IVPROC glad_glVertex3iv; -#define glVertex3iv glad_glVertex3iv -typedef void (APIENTRYP PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLVERTEX3SPROC glad_glVertex3s; -#define glVertex3s glad_glVertex3s -typedef void (APIENTRYP PFNGLVERTEX3SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX3SVPROC glad_glVertex3sv; -#define glVertex3sv glad_glVertex3sv -typedef void (APIENTRYP PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLVERTEX4DPROC glad_glVertex4d; -#define glVertex4d glad_glVertex4d -typedef void (APIENTRYP PFNGLVERTEX4DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX4DVPROC glad_glVertex4dv; -#define glVertex4dv glad_glVertex4dv -typedef void (APIENTRYP PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLVERTEX4FPROC glad_glVertex4f; -#define glVertex4f glad_glVertex4f -typedef void (APIENTRYP PFNGLVERTEX4FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX4FVPROC glad_glVertex4fv; -#define glVertex4fv glad_glVertex4fv -typedef void (APIENTRYP PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLVERTEX4IPROC glad_glVertex4i; -#define glVertex4i glad_glVertex4i -typedef void (APIENTRYP PFNGLVERTEX4IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX4IVPROC glad_glVertex4iv; -#define glVertex4iv glad_glVertex4iv -typedef void (APIENTRYP PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLVERTEX4SPROC glad_glVertex4s; -#define glVertex4s glad_glVertex4s -typedef void (APIENTRYP PFNGLVERTEX4SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX4SVPROC glad_glVertex4sv; -#define glVertex4sv glad_glVertex4sv -typedef void (APIENTRYP PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble *equation); -GLAPI PFNGLCLIPPLANEPROC glad_glClipPlane; -#define glClipPlane glad_glClipPlane -typedef void (APIENTRYP PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); -GLAPI PFNGLCOLORMATERIALPROC glad_glColorMaterial; -#define glColorMaterial glad_glColorMaterial -typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLFOGFPROC glad_glFogf; -#define glFogf glad_glFogf -typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLFOGFVPROC glad_glFogfv; -#define glFogfv glad_glFogfv -typedef void (APIENTRYP PFNGLFOGIPROC)(GLenum pname, GLint param); -GLAPI PFNGLFOGIPROC glad_glFogi; -#define glFogi glad_glFogi -typedef void (APIENTRYP PFNGLFOGIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLFOGIVPROC glad_glFogiv; -#define glFogiv glad_glFogiv -typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTFPROC glad_glLightf; -#define glLightf glad_glLightf -typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTFVPROC glad_glLightfv; -#define glLightfv glad_glLightfv -typedef void (APIENTRYP PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); -GLAPI PFNGLLIGHTIPROC glad_glLighti; -#define glLighti glad_glLighti -typedef void (APIENTRYP PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint *params); -GLAPI PFNGLLIGHTIVPROC glad_glLightiv; -#define glLightiv glad_glLightiv -typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; -#define glLightModelf glad_glLightModelf -typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; -#define glLightModelfv glad_glLightModelfv -typedef void (APIENTRYP PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); -GLAPI PFNGLLIGHTMODELIPROC glad_glLightModeli; -#define glLightModeli glad_glLightModeli -typedef void (APIENTRYP PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLLIGHTMODELIVPROC glad_glLightModeliv; -#define glLightModeliv glad_glLightModeliv -typedef void (APIENTRYP PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); -GLAPI PFNGLLINESTIPPLEPROC glad_glLineStipple; -#define glLineStipple glad_glLineStipple -typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); -GLAPI PFNGLMATERIALFPROC glad_glMaterialf; -#define glMaterialf glad_glMaterialf -typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); -GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; -#define glMaterialfv glad_glMaterialfv -typedef void (APIENTRYP PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); -GLAPI PFNGLMATERIALIPROC glad_glMateriali; -#define glMateriali glad_glMateriali -typedef void (APIENTRYP PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint *params); -GLAPI PFNGLMATERIALIVPROC glad_glMaterialiv; -#define glMaterialiv glad_glMaterialiv -typedef void (APIENTRYP PFNGLPOLYGONSTIPPLEPROC)(const GLubyte *mask); -GLAPI PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; -#define glPolygonStipple glad_glPolygonStipple -typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); -GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; -#define glShadeModel glad_glShadeModel -typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); -GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; -#define glTexEnvf glad_glTexEnvf -typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; -#define glTexEnvfv glad_glTexEnvfv -typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; -#define glTexEnvi glad_glTexEnvi -typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; -#define glTexEnviv glad_glTexEnviv -typedef void (APIENTRYP PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); -GLAPI PFNGLTEXGENDPROC glad_glTexGend; -#define glTexGend glad_glTexGend -typedef void (APIENTRYP PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble *params); -GLAPI PFNGLTEXGENDVPROC glad_glTexGendv; -#define glTexGendv glad_glTexGendv -typedef void (APIENTRYP PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); -GLAPI PFNGLTEXGENFPROC glad_glTexGenf; -#define glTexGenf glad_glTexGenf -typedef void (APIENTRYP PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXGENFVPROC glad_glTexGenfv; -#define glTexGenfv glad_glTexGenfv -typedef void (APIENTRYP PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); -GLAPI PFNGLTEXGENIPROC glad_glTexGeni; -#define glTexGeni glad_glTexGeni -typedef void (APIENTRYP PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint *params); -GLAPI PFNGLTEXGENIVPROC glad_glTexGeniv; -#define glTexGeniv glad_glTexGeniv -typedef void (APIENTRYP PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat *buffer); -GLAPI PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; -#define glFeedbackBuffer glad_glFeedbackBuffer -typedef void (APIENTRYP PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint *buffer); -GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer; -#define glSelectBuffer glad_glSelectBuffer -typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode); -GLAPI PFNGLRENDERMODEPROC glad_glRenderMode; -#define glRenderMode glad_glRenderMode -typedef void (APIENTRYP PFNGLINITNAMESPROC)(void); -GLAPI PFNGLINITNAMESPROC glad_glInitNames; -#define glInitNames glad_glInitNames -typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name); -GLAPI PFNGLLOADNAMEPROC glad_glLoadName; -#define glLoadName glad_glLoadName -typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token); -GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough; -#define glPassThrough glad_glPassThrough -typedef void (APIENTRYP PFNGLPOPNAMEPROC)(void); -GLAPI PFNGLPOPNAMEPROC glad_glPopName; -#define glPopName glad_glPopName -typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name); -GLAPI PFNGLPUSHNAMEPROC glad_glPushName; -#define glPushName glad_glPushName -typedef void (APIENTRYP PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCLEARACCUMPROC glad_glClearAccum; -#define glClearAccum glad_glClearAccum -typedef void (APIENTRYP PFNGLCLEARINDEXPROC)(GLfloat c); -GLAPI PFNGLCLEARINDEXPROC glad_glClearIndex; -#define glClearIndex glad_glClearIndex -typedef void (APIENTRYP PFNGLINDEXMASKPROC)(GLuint mask); -GLAPI PFNGLINDEXMASKPROC glad_glIndexMask; -#define glIndexMask glad_glIndexMask -typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value); -GLAPI PFNGLACCUMPROC glad_glAccum; -#define glAccum glad_glAccum -typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(void); -GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib; -#define glPopAttrib glad_glPopAttrib -typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask); -GLAPI PFNGLPUSHATTRIBPROC glad_glPushAttrib; -#define glPushAttrib glad_glPushAttrib -typedef void (APIENTRYP PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -GLAPI PFNGLMAP1DPROC glad_glMap1d; -#define glMap1d glad_glMap1d -typedef void (APIENTRYP PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -GLAPI PFNGLMAP1FPROC glad_glMap1f; -#define glMap1f glad_glMap1f -typedef void (APIENTRYP PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -GLAPI PFNGLMAP2DPROC glad_glMap2d; -#define glMap2d glad_glMap2d -typedef void (APIENTRYP PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -GLAPI PFNGLMAP2FPROC glad_glMap2f; -#define glMap2f glad_glMap2f -typedef void (APIENTRYP PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); -GLAPI PFNGLMAPGRID1DPROC glad_glMapGrid1d; -#define glMapGrid1d glad_glMapGrid1d -typedef void (APIENTRYP PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); -GLAPI PFNGLMAPGRID1FPROC glad_glMapGrid1f; -#define glMapGrid1f glad_glMapGrid1f -typedef void (APIENTRYP PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); -GLAPI PFNGLMAPGRID2DPROC glad_glMapGrid2d; -#define glMapGrid2d glad_glMapGrid2d -typedef void (APIENTRYP PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); -GLAPI PFNGLMAPGRID2FPROC glad_glMapGrid2f; -#define glMapGrid2f glad_glMapGrid2f -typedef void (APIENTRYP PFNGLEVALCOORD1DPROC)(GLdouble u); -GLAPI PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; -#define glEvalCoord1d glad_glEvalCoord1d -typedef void (APIENTRYP PFNGLEVALCOORD1DVPROC)(const GLdouble *u); -GLAPI PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; -#define glEvalCoord1dv glad_glEvalCoord1dv -typedef void (APIENTRYP PFNGLEVALCOORD1FPROC)(GLfloat u); -GLAPI PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; -#define glEvalCoord1f glad_glEvalCoord1f -typedef void (APIENTRYP PFNGLEVALCOORD1FVPROC)(const GLfloat *u); -GLAPI PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; -#define glEvalCoord1fv glad_glEvalCoord1fv -typedef void (APIENTRYP PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); -GLAPI PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; -#define glEvalCoord2d glad_glEvalCoord2d -typedef void (APIENTRYP PFNGLEVALCOORD2DVPROC)(const GLdouble *u); -GLAPI PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; -#define glEvalCoord2dv glad_glEvalCoord2dv -typedef void (APIENTRYP PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); -GLAPI PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; -#define glEvalCoord2f glad_glEvalCoord2f -typedef void (APIENTRYP PFNGLEVALCOORD2FVPROC)(const GLfloat *u); -GLAPI PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; -#define glEvalCoord2fv glad_glEvalCoord2fv -typedef void (APIENTRYP PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); -GLAPI PFNGLEVALMESH1PROC glad_glEvalMesh1; -#define glEvalMesh1 glad_glEvalMesh1 -typedef void (APIENTRYP PFNGLEVALPOINT1PROC)(GLint i); -GLAPI PFNGLEVALPOINT1PROC glad_glEvalPoint1; -#define glEvalPoint1 glad_glEvalPoint1 -typedef void (APIENTRYP PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); -GLAPI PFNGLEVALMESH2PROC glad_glEvalMesh2; -#define glEvalMesh2 glad_glEvalMesh2 -typedef void (APIENTRYP PFNGLEVALPOINT2PROC)(GLint i, GLint j); -GLAPI PFNGLEVALPOINT2PROC glad_glEvalPoint2; -#define glEvalPoint2 glad_glEvalPoint2 -typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); -GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; -#define glAlphaFunc glad_glAlphaFunc -typedef void (APIENTRYP PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); -GLAPI PFNGLPIXELZOOMPROC glad_glPixelZoom; -#define glPixelZoom glad_glPixelZoom -typedef void (APIENTRYP PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; -#define glPixelTransferf glad_glPixelTransferf -typedef void (APIENTRYP PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; -#define glPixelTransferi glad_glPixelTransferi -typedef void (APIENTRYP PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat *values); -GLAPI PFNGLPIXELMAPFVPROC glad_glPixelMapfv; -#define glPixelMapfv glad_glPixelMapfv -typedef void (APIENTRYP PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint *values); -GLAPI PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; -#define glPixelMapuiv glad_glPixelMapuiv -typedef void (APIENTRYP PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort *values); -GLAPI PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; -#define glPixelMapusv glad_glPixelMapusv -typedef void (APIENTRYP PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); -GLAPI PFNGLCOPYPIXELSPROC glad_glCopyPixels; -#define glCopyPixels glad_glCopyPixels -typedef void (APIENTRYP PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLDRAWPIXELSPROC glad_glDrawPixels; -#define glDrawPixels glad_glDrawPixels -typedef void (APIENTRYP PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble *equation); -GLAPI PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; -#define glGetClipPlane glad_glGetClipPlane -typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); -GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; -#define glGetLightfv glad_glGetLightfv -typedef void (APIENTRYP PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint *params); -GLAPI PFNGLGETLIGHTIVPROC glad_glGetLightiv; -#define glGetLightiv glad_glGetLightiv -typedef void (APIENTRYP PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble *v); -GLAPI PFNGLGETMAPDVPROC glad_glGetMapdv; -#define glGetMapdv glad_glGetMapdv -typedef void (APIENTRYP PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat *v); -GLAPI PFNGLGETMAPFVPROC glad_glGetMapfv; -#define glGetMapfv glad_glGetMapfv -typedef void (APIENTRYP PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint *v); -GLAPI PFNGLGETMAPIVPROC glad_glGetMapiv; -#define glGetMapiv glad_glGetMapiv -typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); -GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; -#define glGetMaterialfv glad_glGetMaterialfv -typedef void (APIENTRYP PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint *params); -GLAPI PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; -#define glGetMaterialiv glad_glGetMaterialiv -typedef void (APIENTRYP PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat *values); -GLAPI PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; -#define glGetPixelMapfv glad_glGetPixelMapfv -typedef void (APIENTRYP PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint *values); -GLAPI PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; -#define glGetPixelMapuiv glad_glGetPixelMapuiv -typedef void (APIENTRYP PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort *values); -GLAPI PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; -#define glGetPixelMapusv glad_glGetPixelMapusv -typedef void (APIENTRYP PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte *mask); -GLAPI PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; -#define glGetPolygonStipple glad_glGetPolygonStipple -typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; -#define glGetTexEnvfv glad_glGetTexEnvfv -typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; -#define glGetTexEnviv glad_glGetTexEnviv -typedef void (APIENTRYP PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble *params); -GLAPI PFNGLGETTEXGENDVPROC glad_glGetTexGendv; -#define glGetTexGendv glad_glGetTexGendv -typedef void (APIENTRYP PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; -#define glGetTexGenfv glad_glGetTexGenfv -typedef void (APIENTRYP PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; -#define glGetTexGeniv glad_glGetTexGeniv -typedef GLboolean (APIENTRYP PFNGLISLISTPROC)(GLuint list); -GLAPI PFNGLISLISTPROC glad_glIsList; -#define glIsList glad_glIsList -typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI PFNGLFRUSTUMPROC glad_glFrustum; -#define glFrustum glad_glFrustum -typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void); -GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; -#define glLoadIdentity glad_glLoadIdentity -typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; -#define glLoadMatrixf glad_glLoadMatrixf -typedef void (APIENTRYP PFNGLLOADMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; -#define glLoadMatrixd glad_glLoadMatrixd -typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); -GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; -#define glMatrixMode glad_glMatrixMode -typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; -#define glMultMatrixf glad_glMultMatrixf -typedef void (APIENTRYP PFNGLMULTMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd; -#define glMultMatrixd glad_glMultMatrixd -typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI PFNGLORTHOPROC glad_glOrtho; -#define glOrtho glad_glOrtho -typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(void); -GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix; -#define glPopMatrix glad_glPopMatrix -typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(void); -GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix; -#define glPushMatrix glad_glPushMatrix -typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLROTATEDPROC glad_glRotated; -#define glRotated glad_glRotated -typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLROTATEFPROC glad_glRotatef; -#define glRotatef glad_glRotatef -typedef void (APIENTRYP PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLSCALEDPROC glad_glScaled; -#define glScaled glad_glScaled -typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLSCALEFPROC glad_glScalef; -#define glScalef glad_glScalef -typedef void (APIENTRYP PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLTRANSLATEDPROC glad_glTranslated; -#define glTranslated glad_glTranslated -typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; -#define glTranslatef glad_glTranslatef -#endif -#ifndef GL_VERSION_1_1 -#define GL_VERSION_1_1 1 -GLAPI int GLAD_GL_VERSION_1_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; -#define glDrawArrays glad_glDrawArrays -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); -GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; -#define glDrawElements glad_glDrawElements -typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); -GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; -#define glGetPointerv glad_glGetPointerv -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; -#define glPolygonOffset glad_glPolygonOffset -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; -#define glCopyTexImage1D glad_glCopyTexImage1D -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; -#define glCopyTexImage2D glad_glCopyTexImage2D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; -#define glCopyTexSubImage1D glad_glCopyTexSubImage1D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; -#define glCopyTexSubImage2D glad_glCopyTexSubImage2D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; -#define glTexSubImage1D glad_glTexSubImage1D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; -#define glTexSubImage2D glad_glTexSubImage2D -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; -#define glBindTexture glad_glBindTexture -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); -GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; -#define glDeleteTextures glad_glDeleteTextures -typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); -GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; -#define glGenTextures glad_glGenTextures -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); -GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; -#define glIsTexture glad_glIsTexture -typedef void (APIENTRYP PFNGLARRAYELEMENTPROC)(GLint i); -GLAPI PFNGLARRAYELEMENTPROC glad_glArrayElement; -#define glArrayElement glad_glArrayElement -typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; -#define glColorPointer glad_glColorPointer -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; -#define glDisableClientState glad_glDisableClientState -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void *pointer); -GLAPI PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; -#define glEdgeFlagPointer glad_glEdgeFlagPointer -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; -#define glEnableClientState glad_glEnableClientState -typedef void (APIENTRYP PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLINDEXPOINTERPROC glad_glIndexPointer; -#define glIndexPointer glad_glIndexPointer -typedef void (APIENTRYP PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void *pointer); -GLAPI PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; -#define glInterleavedArrays glad_glInterleavedArrays -typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; -#define glNormalPointer glad_glNormalPointer -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; -#define glTexCoordPointer glad_glTexCoordPointer -typedef void (APIENTRYP PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXPOINTERPROC glad_glVertexPointer; -#define glVertexPointer glad_glVertexPointer -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint *textures, GLboolean *residences); -GLAPI PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; -#define glAreTexturesResident glad_glAreTexturesResident -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint *textures, const GLfloat *priorities); -GLAPI PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; -#define glPrioritizeTextures glad_glPrioritizeTextures -typedef void (APIENTRYP PFNGLINDEXUBPROC)(GLubyte c); -GLAPI PFNGLINDEXUBPROC glad_glIndexub; -#define glIndexub glad_glIndexub -typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c); -GLAPI PFNGLINDEXUBVPROC glad_glIndexubv; -#define glIndexubv glad_glIndexubv -typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(void); -GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; -#define glPopClientAttrib glad_glPopClientAttrib -typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); -GLAPI PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; -#define glPushClientAttrib glad_glPushClientAttrib -#endif -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -GLAPI int GLAD_GL_VERSION_1_2; -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; -#define glDrawRangeElements glad_glDrawRangeElements -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; -#define glTexImage3D glad_glTexImage3D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; -#define glTexSubImage3D glad_glTexSubImage3D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; -#define glCopyTexSubImage3D glad_glCopyTexSubImage3D -#endif -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -GLAPI int GLAD_GL_VERSION_1_3; -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; -#define glActiveTexture glad_glActiveTexture -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); -GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; -#define glSampleCoverage glad_glSampleCoverage -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; -#define glCompressedTexImage3D glad_glCompressedTexImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; -#define glCompressedTexImage2D glad_glCompressedTexImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; -#define glCompressedTexImage1D glad_glCompressedTexImage1D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; -#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; -#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; -#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); -GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; -#define glGetCompressedTexImage glad_glGetCompressedTexImage -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; -#define glClientActiveTexture glad_glClientActiveTexture -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); -GLAPI PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; -#define glMultiTexCoord1d glad_glMultiTexCoord1d -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; -#define glMultiTexCoord1dv glad_glMultiTexCoord1dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); -GLAPI PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; -#define glMultiTexCoord1f glad_glMultiTexCoord1f -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; -#define glMultiTexCoord1fv glad_glMultiTexCoord1fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); -GLAPI PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; -#define glMultiTexCoord1i glad_glMultiTexCoord1i -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; -#define glMultiTexCoord1iv glad_glMultiTexCoord1iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); -GLAPI PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; -#define glMultiTexCoord1s glad_glMultiTexCoord1s -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; -#define glMultiTexCoord1sv glad_glMultiTexCoord1sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); -GLAPI PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; -#define glMultiTexCoord2d glad_glMultiTexCoord2d -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; -#define glMultiTexCoord2dv glad_glMultiTexCoord2dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); -GLAPI PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; -#define glMultiTexCoord2f glad_glMultiTexCoord2f -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; -#define glMultiTexCoord2fv glad_glMultiTexCoord2fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); -GLAPI PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; -#define glMultiTexCoord2i glad_glMultiTexCoord2i -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; -#define glMultiTexCoord2iv glad_glMultiTexCoord2iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); -GLAPI PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; -#define glMultiTexCoord2s glad_glMultiTexCoord2s -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; -#define glMultiTexCoord2sv glad_glMultiTexCoord2sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; -#define glMultiTexCoord3d glad_glMultiTexCoord3d -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; -#define glMultiTexCoord3dv glad_glMultiTexCoord3dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; -#define glMultiTexCoord3f glad_glMultiTexCoord3f -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; -#define glMultiTexCoord3fv glad_glMultiTexCoord3fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); -GLAPI PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; -#define glMultiTexCoord3i glad_glMultiTexCoord3i -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; -#define glMultiTexCoord3iv glad_glMultiTexCoord3iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; -#define glMultiTexCoord3s glad_glMultiTexCoord3s -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; -#define glMultiTexCoord3sv glad_glMultiTexCoord3sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; -#define glMultiTexCoord4d glad_glMultiTexCoord4d -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; -#define glMultiTexCoord4dv glad_glMultiTexCoord4dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; -#define glMultiTexCoord4f glad_glMultiTexCoord4f -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; -#define glMultiTexCoord4fv glad_glMultiTexCoord4fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; -#define glMultiTexCoord4i glad_glMultiTexCoord4i -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; -#define glMultiTexCoord4iv glad_glMultiTexCoord4iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; -#define glMultiTexCoord4s glad_glMultiTexCoord4s -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; -#define glMultiTexCoord4sv glad_glMultiTexCoord4sv -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; -#define glLoadTransposeMatrixf glad_glLoadTransposeMatrixf -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; -#define glLoadTransposeMatrixd glad_glLoadTransposeMatrixd -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; -#define glMultTransposeMatrixf glad_glMultTransposeMatrixf -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; -#define glMultTransposeMatrixd glad_glMultTransposeMatrixd -#endif -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -GLAPI int GLAD_GL_VERSION_1_4; -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; -#define glBlendFuncSeparate glad_glBlendFuncSeparate -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; -#define glMultiDrawArrays glad_glMultiDrawArrays -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; -#define glMultiDrawElements glad_glMultiDrawElements -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; -#define glPointParameterf glad_glPointParameterf -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; -#define glPointParameterfv glad_glPointParameterfv -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; -#define glPointParameteri glad_glPointParameteri -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; -#define glPointParameteriv glad_glPointParameteriv -typedef void (APIENTRYP PFNGLFOGCOORDFPROC)(GLfloat coord); -GLAPI PFNGLFOGCOORDFPROC glad_glFogCoordf; -#define glFogCoordf glad_glFogCoordf -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC)(const GLfloat *coord); -GLAPI PFNGLFOGCOORDFVPROC glad_glFogCoordfv; -#define glFogCoordfv glad_glFogCoordfv -typedef void (APIENTRYP PFNGLFOGCOORDDPROC)(GLdouble coord); -GLAPI PFNGLFOGCOORDDPROC glad_glFogCoordd; -#define glFogCoordd glad_glFogCoordd -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC)(const GLdouble *coord); -GLAPI PFNGLFOGCOORDDVPROC glad_glFogCoorddv; -#define glFogCoorddv glad_glFogCoorddv -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; -#define glFogCoordPointer glad_glFogCoordPointer -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -GLAPI PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; -#define glSecondaryColor3b glad_glSecondaryColor3b -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte *v); -GLAPI PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; -#define glSecondaryColor3bv glad_glSecondaryColor3bv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -GLAPI PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; -#define glSecondaryColor3d glad_glSecondaryColor3d -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble *v); -GLAPI PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; -#define glSecondaryColor3dv glad_glSecondaryColor3dv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -GLAPI PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; -#define glSecondaryColor3f glad_glSecondaryColor3f -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat *v); -GLAPI PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; -#define glSecondaryColor3fv glad_glSecondaryColor3fv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); -GLAPI PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; -#define glSecondaryColor3i glad_glSecondaryColor3i -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC)(const GLint *v); -GLAPI PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; -#define glSecondaryColor3iv glad_glSecondaryColor3iv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -GLAPI PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; -#define glSecondaryColor3s glad_glSecondaryColor3s -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC)(const GLshort *v); -GLAPI PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; -#define glSecondaryColor3sv glad_glSecondaryColor3sv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -GLAPI PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; -#define glSecondaryColor3ub glad_glSecondaryColor3ub -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte *v); -GLAPI PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; -#define glSecondaryColor3ubv glad_glSecondaryColor3ubv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -GLAPI PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; -#define glSecondaryColor3ui glad_glSecondaryColor3ui -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint *v); -GLAPI PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; -#define glSecondaryColor3uiv glad_glSecondaryColor3uiv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -GLAPI PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; -#define glSecondaryColor3us glad_glSecondaryColor3us -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC)(const GLushort *v); -GLAPI PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; -#define glSecondaryColor3usv glad_glSecondaryColor3usv -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; -#define glSecondaryColorPointer glad_glSecondaryColorPointer -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; -#define glWindowPos2d glad_glWindowPos2d -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC)(const GLdouble *v); -GLAPI PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; -#define glWindowPos2dv glad_glWindowPos2dv -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; -#define glWindowPos2f glad_glWindowPos2f -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC)(const GLfloat *v); -GLAPI PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; -#define glWindowPos2fv glad_glWindowPos2fv -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); -GLAPI PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; -#define glWindowPos2i glad_glWindowPos2i -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC)(const GLint *v); -GLAPI PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; -#define glWindowPos2iv glad_glWindowPos2iv -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; -#define glWindowPos2s glad_glWindowPos2s -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC)(const GLshort *v); -GLAPI PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; -#define glWindowPos2sv glad_glWindowPos2sv -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; -#define glWindowPos3d glad_glWindowPos3d -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC)(const GLdouble *v); -GLAPI PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; -#define glWindowPos3dv glad_glWindowPos3dv -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; -#define glWindowPos3f glad_glWindowPos3f -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC)(const GLfloat *v); -GLAPI PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; -#define glWindowPos3fv glad_glWindowPos3fv -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; -#define glWindowPos3i glad_glWindowPos3i -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC)(const GLint *v); -GLAPI PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; -#define glWindowPos3iv glad_glWindowPos3iv -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; -#define glWindowPos3s glad_glWindowPos3s -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC)(const GLshort *v); -GLAPI PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; -#define glWindowPos3sv glad_glWindowPos3sv -typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; -#define glBlendColor glad_glBlendColor -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); -GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; -#define glBlendEquation glad_glBlendEquation -#endif -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -GLAPI int GLAD_GL_VERSION_1_5; -typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); -GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; -#define glGenQueries glad_glGenQueries -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); -GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; -#define glDeleteQueries glad_glDeleteQueries -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); -GLAPI PFNGLISQUERYPROC glad_glIsQuery; -#define glIsQuery glad_glIsQuery -typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); -GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; -#define glBeginQuery glad_glBeginQuery -typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); -GLAPI PFNGLENDQUERYPROC glad_glEndQuery; -#define glEndQuery glad_glEndQuery -typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; -#define glGetQueryiv glad_glGetQueryiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); -GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; -#define glGetQueryObjectiv glad_glGetQueryObjectiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); -GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; -#define glGetQueryObjectuiv glad_glGetQueryObjectuiv -typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; -#define glBindBuffer glad_glBindBuffer -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); -GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; -#define glDeleteBuffers glad_glDeleteBuffers -typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); -GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; -#define glGenBuffers glad_glGenBuffers -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); -GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; -#define glIsBuffer glad_glIsBuffer -typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; -#define glBufferData glad_glBufferData -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; -#define glBufferSubData glad_glBufferSubData -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); -GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; -#define glGetBufferSubData glad_glGetBufferSubData -typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); -GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; -#define glMapBuffer glad_glMapBuffer -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); -GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; -#define glUnmapBuffer glad_glUnmapBuffer -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; -#define glGetBufferParameteriv glad_glGetBufferParameteriv -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); -GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; -#define glGetBufferPointerv glad_glGetBufferPointerv -#endif -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -GLAPI int GLAD_GL_VERSION_2_0; -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); -GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; -#define glBlendEquationSeparate glad_glBlendEquationSeparate -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); -GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; -#define glDrawBuffers glad_glDrawBuffers -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; -#define glStencilOpSeparate glad_glStencilOpSeparate -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; -#define glStencilFuncSeparate glad_glStencilFuncSeparate -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); -GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; -#define glStencilMaskSeparate glad_glStencilMaskSeparate -typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); -GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; -#define glAttachShader glad_glAttachShader -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); -GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; -#define glBindAttribLocation glad_glBindAttribLocation -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); -GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; -#define glCompileShader glad_glCompileShader -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); -GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; -#define glCreateProgram glad_glCreateProgram -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); -GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; -#define glCreateShader glad_glCreateShader -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); -GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; -#define glDeleteProgram glad_glDeleteProgram -typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); -GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; -#define glDeleteShader glad_glDeleteShader -typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); -GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; -#define glDetachShader glad_glDetachShader -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); -GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; -#define glDisableVertexAttribArray glad_glDisableVertexAttribArray -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); -GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; -#define glEnableVertexAttribArray glad_glEnableVertexAttribArray -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; -#define glGetActiveAttrib glad_glGetActiveAttrib -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; -#define glGetActiveUniform glad_glGetActiveUniform -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; -#define glGetAttachedShaders glad_glGetAttachedShaders -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; -#define glGetAttribLocation glad_glGetAttribLocation -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); -GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; -#define glGetProgramiv glad_glGetProgramiv -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; -#define glGetProgramInfoLog glad_glGetProgramInfoLog -typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); -GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; -#define glGetShaderiv glad_glGetShaderiv -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; -#define glGetShaderInfoLog glad_glGetShaderInfoLog -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; -#define glGetShaderSource glad_glGetShaderSource -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; -#define glGetUniformLocation glad_glGetUniformLocation -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); -GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; -#define glGetUniformfv glad_glGetUniformfv -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); -GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; -#define glGetUniformiv glad_glGetUniformiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); -GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; -#define glGetVertexAttribdv glad_glGetVertexAttribdv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); -GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; -#define glGetVertexAttribfv glad_glGetVertexAttribfv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); -GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; -#define glGetVertexAttribiv glad_glGetVertexAttribiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); -GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; -#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); -GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; -#define glIsProgram glad_glIsProgram -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); -GLAPI PFNGLISSHADERPROC glad_glIsShader; -#define glIsShader glad_glIsShader -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); -GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; -#define glLinkProgram glad_glLinkProgram -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; -#define glShaderSource glad_glShaderSource -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); -GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; -#define glUseProgram glad_glUseProgram -typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); -GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; -#define glUniform1f glad_glUniform1f -typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); -GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; -#define glUniform2f glad_glUniform2f -typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; -#define glUniform3f glad_glUniform3f -typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; -#define glUniform4f glad_glUniform4f -typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); -GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; -#define glUniform1i glad_glUniform1i -typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); -GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; -#define glUniform2i glad_glUniform2i -typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); -GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; -#define glUniform3i glad_glUniform3i -typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; -#define glUniform4i glad_glUniform4i -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; -#define glUniform1fv glad_glUniform1fv -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; -#define glUniform2fv glad_glUniform2fv -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; -#define glUniform3fv glad_glUniform3fv -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; -#define glUniform4fv glad_glUniform4fv -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; -#define glUniform1iv glad_glUniform1iv -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; -#define glUniform2iv glad_glUniform2iv -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; -#define glUniform3iv glad_glUniform3iv -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; -#define glUniform4iv glad_glUniform4iv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; -#define glUniformMatrix2fv glad_glUniformMatrix2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; -#define glUniformMatrix3fv glad_glUniformMatrix3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; -#define glUniformMatrix4fv glad_glUniformMatrix4fv -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); -GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; -#define glValidateProgram glad_glValidateProgram -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); -GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; -#define glVertexAttrib1d glad_glVertexAttrib1d -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; -#define glVertexAttrib1dv glad_glVertexAttrib1dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); -GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; -#define glVertexAttrib1f glad_glVertexAttrib1f -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; -#define glVertexAttrib1fv glad_glVertexAttrib1fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); -GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; -#define glVertexAttrib1s glad_glVertexAttrib1s -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; -#define glVertexAttrib1sv glad_glVertexAttrib1sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); -GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; -#define glVertexAttrib2d glad_glVertexAttrib2d -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; -#define glVertexAttrib2dv glad_glVertexAttrib2dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); -GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; -#define glVertexAttrib2f glad_glVertexAttrib2f -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; -#define glVertexAttrib2fv glad_glVertexAttrib2fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); -GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; -#define glVertexAttrib2s glad_glVertexAttrib2s -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; -#define glVertexAttrib2sv glad_glVertexAttrib2sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; -#define glVertexAttrib3d glad_glVertexAttrib3d -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; -#define glVertexAttrib3dv glad_glVertexAttrib3dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; -#define glVertexAttrib3f glad_glVertexAttrib3f -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; -#define glVertexAttrib3fv glad_glVertexAttrib3fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; -#define glVertexAttrib3s glad_glVertexAttrib3s -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; -#define glVertexAttrib3sv glad_glVertexAttrib3sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; -#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; -#define glVertexAttrib4Niv glad_glVertexAttrib4Niv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; -#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; -#define glVertexAttrib4Nub glad_glVertexAttrib4Nub -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; -#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; -#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; -#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; -#define glVertexAttrib4bv glad_glVertexAttrib4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; -#define glVertexAttrib4d glad_glVertexAttrib4d -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; -#define glVertexAttrib4dv glad_glVertexAttrib4dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; -#define glVertexAttrib4f glad_glVertexAttrib4f -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; -#define glVertexAttrib4fv glad_glVertexAttrib4fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; -#define glVertexAttrib4iv glad_glVertexAttrib4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; -#define glVertexAttrib4s glad_glVertexAttrib4s -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; -#define glVertexAttrib4sv glad_glVertexAttrib4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; -#define glVertexAttrib4ubv glad_glVertexAttrib4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; -#define glVertexAttrib4uiv glad_glVertexAttrib4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; -#define glVertexAttrib4usv glad_glVertexAttrib4usv -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; -#define glVertexAttribPointer glad_glVertexAttribPointer -#endif -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -GLAPI int GLAD_GL_VERSION_2_1; -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; -#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; -#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; -#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; -#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; -#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; -#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv -#endif -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -GLAPI int GLAD_GL_VERSION_3_0; -typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; -#define glColorMaski glad_glColorMaski -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); -GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; -#define glGetBooleani_v glad_glGetBooleani_v -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); -GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; -#define glGetIntegeri_v glad_glGetIntegeri_v -typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); -GLAPI PFNGLENABLEIPROC glad_glEnablei; -#define glEnablei glad_glEnablei -typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); -GLAPI PFNGLDISABLEIPROC glad_glDisablei; -#define glDisablei glad_glDisablei -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); -GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; -#define glIsEnabledi glad_glIsEnabledi -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); -GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; -#define glBeginTransformFeedback glad_glBeginTransformFeedback -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); -GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; -#define glEndTransformFeedback glad_glEndTransformFeedback -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; -#define glBindBufferRange glad_glBindBufferRange -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); -GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; -#define glBindBufferBase glad_glBindBufferBase -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; -#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; -#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); -GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; -#define glClampColor glad_glClampColor -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); -GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; -#define glBeginConditionalRender glad_glBeginConditionalRender -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); -GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; -#define glEndConditionalRender glad_glEndConditionalRender -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; -#define glVertexAttribIPointer glad_glVertexAttribIPointer -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); -GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; -#define glGetVertexAttribIiv glad_glGetVertexAttribIiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); -GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; -#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); -GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; -#define glVertexAttribI1i glad_glVertexAttribI1i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); -GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; -#define glVertexAttribI2i glad_glVertexAttribI2i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); -GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; -#define glVertexAttribI3i glad_glVertexAttribI3i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; -#define glVertexAttribI4i glad_glVertexAttribI4i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); -GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; -#define glVertexAttribI1ui glad_glVertexAttribI1ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); -GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; -#define glVertexAttribI2ui glad_glVertexAttribI2ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; -#define glVertexAttribI3ui glad_glVertexAttribI3ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; -#define glVertexAttribI4ui glad_glVertexAttribI4ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; -#define glVertexAttribI1iv glad_glVertexAttribI1iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; -#define glVertexAttribI2iv glad_glVertexAttribI2iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; -#define glVertexAttribI3iv glad_glVertexAttribI3iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; -#define glVertexAttribI4iv glad_glVertexAttribI4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; -#define glVertexAttribI1uiv glad_glVertexAttribI1uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; -#define glVertexAttribI2uiv glad_glVertexAttribI2uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; -#define glVertexAttribI3uiv glad_glVertexAttribI3uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; -#define glVertexAttribI4uiv glad_glVertexAttribI4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; -#define glVertexAttribI4bv glad_glVertexAttribI4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; -#define glVertexAttribI4sv glad_glVertexAttribI4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; -#define glVertexAttribI4ubv glad_glVertexAttribI4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; -#define glVertexAttribI4usv glad_glVertexAttribI4usv -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); -GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; -#define glGetUniformuiv glad_glGetUniformuiv -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); -GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; -#define glBindFragDataLocation glad_glBindFragDataLocation -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; -#define glGetFragDataLocation glad_glGetFragDataLocation -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); -GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; -#define glUniform1ui glad_glUniform1ui -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); -GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; -#define glUniform2ui glad_glUniform2ui -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; -#define glUniform3ui glad_glUniform3ui -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; -#define glUniform4ui glad_glUniform4ui -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; -#define glUniform1uiv glad_glUniform1uiv -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; -#define glUniform2uiv glad_glUniform2uiv -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; -#define glUniform3uiv glad_glUniform3uiv -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; -#define glUniform4uiv glad_glUniform4uiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; -#define glTexParameterIiv glad_glTexParameterIiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); -GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; -#define glTexParameterIuiv glad_glTexParameterIuiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; -#define glGetTexParameterIiv glad_glGetTexParameterIiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); -GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; -#define glGetTexParameterIuiv glad_glGetTexParameterIuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; -#define glClearBufferiv glad_glClearBufferiv -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; -#define glClearBufferuiv glad_glClearBufferuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; -#define glClearBufferfv glad_glClearBufferfv -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; -#define glClearBufferfi glad_glClearBufferfi -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); -GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; -#define glGetStringi glad_glGetStringi -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); -GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; -#define glIsRenderbuffer glad_glIsRenderbuffer -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); -GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; -#define glBindRenderbuffer glad_glBindRenderbuffer -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); -GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; -#define glDeleteRenderbuffers glad_glDeleteRenderbuffers -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); -GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; -#define glGenRenderbuffers glad_glGenRenderbuffers -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; -#define glRenderbufferStorage glad_glRenderbufferStorage -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; -#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); -GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; -#define glIsFramebuffer glad_glIsFramebuffer -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; -#define glBindFramebuffer glad_glBindFramebuffer -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); -GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; -#define glDeleteFramebuffers glad_glDeleteFramebuffers -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); -GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; -#define glGenFramebuffers glad_glGenFramebuffers -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); -GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; -#define glCheckFramebufferStatus glad_glCheckFramebufferStatus -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; -#define glFramebufferTexture1D glad_glFramebufferTexture1D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; -#define glFramebufferTexture2D glad_glFramebufferTexture2D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; -#define glFramebufferTexture3D glad_glFramebufferTexture3D -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; -#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; -#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); -GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; -#define glGenerateMipmap glad_glGenerateMipmap -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; -#define glBlitFramebuffer glad_glBlitFramebuffer -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; -#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; -#define glFramebufferTextureLayer glad_glFramebufferTextureLayer -typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; -#define glMapBufferRange glad_glMapBufferRange -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); -GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; -#define glFlushMappedBufferRange glad_glFlushMappedBufferRange -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); -GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; -#define glBindVertexArray glad_glBindVertexArray -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); -GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; -#define glDeleteVertexArrays glad_glDeleteVertexArrays -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); -GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; -#define glGenVertexArrays glad_glGenVertexArrays -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); -GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; -#define glIsVertexArray glad_glIsVertexArray -#endif -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -GLAPI int GLAD_GL_VERSION_3_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; -#define glDrawArraysInstanced glad_glDrawArraysInstanced -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; -#define glDrawElementsInstanced glad_glDrawElementsInstanced -typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); -GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; -#define glTexBuffer glad_glTexBuffer -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); -GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; -#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; -#define glCopyBufferSubData glad_glCopyBufferSubData -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; -#define glGetUniformIndices glad_glGetUniformIndices -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; -#define glGetActiveUniformsiv glad_glGetActiveUniformsiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; -#define glGetActiveUniformName glad_glGetActiveUniformName -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); -GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; -#define glGetUniformBlockIndex glad_glGetUniformBlockIndex -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; -#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; -#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; -#define glUniformBlockBinding glad_glUniformBlockBinding -#endif -#ifndef GL_VERSION_3_2 -#define GL_VERSION_3_2 1 -GLAPI int GLAD_GL_VERSION_3_2; -typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex; -#define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); -GLAPI PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex; -#define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); -GLAPI PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex; -#define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); -GLAPI PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex; -#define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex -typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC)(GLenum mode); -GLAPI PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex; -#define glProvokingVertex glad_glProvokingVertex -typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); -GLAPI PFNGLFENCESYNCPROC glad_glFenceSync; -#define glFenceSync glad_glFenceSync -typedef GLboolean (APIENTRYP PFNGLISSYNCPROC)(GLsync sync); -GLAPI PFNGLISSYNCPROC glad_glIsSync; -#define glIsSync glad_glIsSync -typedef void (APIENTRYP PFNGLDELETESYNCPROC)(GLsync sync); -GLAPI PFNGLDELETESYNCPROC glad_glDeleteSync; -#define glDeleteSync glad_glDeleteSync -typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync; -#define glClientWaitSync glad_glClientWaitSync -typedef void (APIENTRYP PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -GLAPI PFNGLWAITSYNCPROC glad_glWaitSync; -#define glWaitSync glad_glWaitSync -typedef void (APIENTRYP PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 *data); -GLAPI PFNGLGETINTEGER64VPROC glad_glGetInteger64v; -#define glGetInteger64v glad_glGetInteger64v -typedef void (APIENTRYP PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei *length, GLint *values); -GLAPI PFNGLGETSYNCIVPROC glad_glGetSynciv; -#define glGetSynciv glad_glGetSynciv -typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 *data); -GLAPI PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v; -#define glGetInteger64i_v glad_glGetInteger64i_v -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 *params); -GLAPI PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v; -#define glGetBufferParameteri64v glad_glGetBufferParameteri64v -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); -GLAPI PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture; -#define glFramebufferTexture glad_glFramebufferTexture -typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GLAPI PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample; -#define glTexImage2DMultisample glad_glTexImage2DMultisample -typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -GLAPI PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample; -#define glTexImage3DMultisample glad_glTexImage3DMultisample -typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat *val); -GLAPI PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv; -#define glGetMultisamplefv glad_glGetMultisamplefv -typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); -GLAPI PFNGLSAMPLEMASKIPROC glad_glSampleMaski; -#define glSampleMaski glad_glSampleMaski -#endif -#ifndef GL_VERSION_3_3 -#define GL_VERSION_3_3 1 -GLAPI int GLAD_GL_VERSION_3_3; -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); -GLAPI PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed; -#define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed -typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex; -#define glGetFragDataIndex glad_glGetFragDataIndex -typedef void (APIENTRYP PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint *samplers); -GLAPI PFNGLGENSAMPLERSPROC glad_glGenSamplers; -#define glGenSamplers glad_glGenSamplers -typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint *samplers); -GLAPI PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers; -#define glDeleteSamplers glad_glDeleteSamplers -typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC)(GLuint sampler); -GLAPI PFNGLISSAMPLERPROC glad_glIsSampler; -#define glIsSampler glad_glIsSampler -typedef void (APIENTRYP PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); -GLAPI PFNGLBINDSAMPLERPROC glad_glBindSampler; -#define glBindSampler glad_glBindSampler -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); -GLAPI PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri; -#define glSamplerParameteri glad_glSamplerParameteri -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint *param); -GLAPI PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv; -#define glSamplerParameteriv glad_glSamplerParameteriv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); -GLAPI PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf; -#define glSamplerParameterf glad_glSamplerParameterf -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat *param); -GLAPI PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv; -#define glSamplerParameterfv glad_glSamplerParameterfv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint *param); -GLAPI PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv; -#define glSamplerParameterIiv glad_glSamplerParameterIiv -typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint *param); -GLAPI PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv; -#define glSamplerParameterIuiv glad_glSamplerParameterIuiv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint *params); -GLAPI PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv; -#define glGetSamplerParameteriv glad_glGetSamplerParameteriv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint *params); -GLAPI PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv; -#define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat *params); -GLAPI PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv; -#define glGetSamplerParameterfv glad_glGetSamplerParameterfv -typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint *params); -GLAPI PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv; -#define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv -typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); -GLAPI PFNGLQUERYCOUNTERPROC glad_glQueryCounter; -#define glQueryCounter glad_glQueryCounter -typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 *params); -GLAPI PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v; -#define glGetQueryObjecti64v glad_glGetQueryObjecti64v -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 *params); -GLAPI PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v; -#define glGetQueryObjectui64v glad_glGetQueryObjectui64v -typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); -GLAPI PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor; -#define glVertexAttribDivisor glad_glVertexAttribDivisor -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui; -#define glVertexAttribP1ui glad_glVertexAttribP1ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv; -#define glVertexAttribP1uiv glad_glVertexAttribP1uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui; -#define glVertexAttribP2ui glad_glVertexAttribP2ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv; -#define glVertexAttribP2uiv glad_glVertexAttribP2uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui; -#define glVertexAttribP3ui glad_glVertexAttribP3ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv; -#define glVertexAttribP3uiv glad_glVertexAttribP3uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -GLAPI PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui; -#define glVertexAttribP4ui glad_glVertexAttribP4ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value); -GLAPI PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv; -#define glVertexAttribP4uiv glad_glVertexAttribP4uiv -typedef void (APIENTRYP PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); -GLAPI PFNGLVERTEXP2UIPROC glad_glVertexP2ui; -#define glVertexP2ui glad_glVertexP2ui -typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint *value); -GLAPI PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv; -#define glVertexP2uiv glad_glVertexP2uiv -typedef void (APIENTRYP PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); -GLAPI PFNGLVERTEXP3UIPROC glad_glVertexP3ui; -#define glVertexP3ui glad_glVertexP3ui -typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint *value); -GLAPI PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv; -#define glVertexP3uiv glad_glVertexP3uiv -typedef void (APIENTRYP PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); -GLAPI PFNGLVERTEXP4UIPROC glad_glVertexP4ui; -#define glVertexP4ui glad_glVertexP4ui -typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint *value); -GLAPI PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv; -#define glVertexP4uiv glad_glVertexP4uiv -typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); -GLAPI PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui; -#define glTexCoordP1ui glad_glTexCoordP1ui -typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint *coords); -GLAPI PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv; -#define glTexCoordP1uiv glad_glTexCoordP1uiv -typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); -GLAPI PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui; -#define glTexCoordP2ui glad_glTexCoordP2ui -typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint *coords); -GLAPI PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv; -#define glTexCoordP2uiv glad_glTexCoordP2uiv -typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); -GLAPI PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui; -#define glTexCoordP3ui glad_glTexCoordP3ui -typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint *coords); -GLAPI PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv; -#define glTexCoordP3uiv glad_glTexCoordP3uiv -typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); -GLAPI PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui; -#define glTexCoordP4ui glad_glTexCoordP4ui -typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint *coords); -GLAPI PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv; -#define glTexCoordP4uiv glad_glTexCoordP4uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); -GLAPI PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui; -#define glMultiTexCoordP1ui glad_glMultiTexCoordP1ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); -GLAPI PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv; -#define glMultiTexCoordP1uiv glad_glMultiTexCoordP1uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); -GLAPI PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui; -#define glMultiTexCoordP2ui glad_glMultiTexCoordP2ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); -GLAPI PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv; -#define glMultiTexCoordP2uiv glad_glMultiTexCoordP2uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); -GLAPI PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui; -#define glMultiTexCoordP3ui glad_glMultiTexCoordP3ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); -GLAPI PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv; -#define glMultiTexCoordP3uiv glad_glMultiTexCoordP3uiv -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); -GLAPI PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui; -#define glMultiTexCoordP4ui glad_glMultiTexCoordP4ui -typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint *coords); -GLAPI PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv; -#define glMultiTexCoordP4uiv glad_glMultiTexCoordP4uiv -typedef void (APIENTRYP PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); -GLAPI PFNGLNORMALP3UIPROC glad_glNormalP3ui; -#define glNormalP3ui glad_glNormalP3ui -typedef void (APIENTRYP PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint *coords); -GLAPI PFNGLNORMALP3UIVPROC glad_glNormalP3uiv; -#define glNormalP3uiv glad_glNormalP3uiv -typedef void (APIENTRYP PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); -GLAPI PFNGLCOLORP3UIPROC glad_glColorP3ui; -#define glColorP3ui glad_glColorP3ui -typedef void (APIENTRYP PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint *color); -GLAPI PFNGLCOLORP3UIVPROC glad_glColorP3uiv; -#define glColorP3uiv glad_glColorP3uiv -typedef void (APIENTRYP PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); -GLAPI PFNGLCOLORP4UIPROC glad_glColorP4ui; -#define glColorP4ui glad_glColorP4ui -typedef void (APIENTRYP PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint *color); -GLAPI PFNGLCOLORP4UIVPROC glad_glColorP4uiv; -#define glColorP4uiv glad_glColorP4uiv -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); -GLAPI PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui; -#define glSecondaryColorP3ui glad_glSecondaryColorP3ui -typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint *color); -GLAPI PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv; -#define glSecondaryColorP3uiv glad_glSecondaryColorP3uiv -#endif -#ifndef GL_VERSION_4_0 -#define GL_VERSION_4_0 1 -GLAPI int GLAD_GL_VERSION_4_0; -typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC)(GLfloat value); -GLAPI PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading; -#define glMinSampleShading glad_glMinSampleShading -typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC)(GLuint buf, GLenum mode); -GLAPI PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi; -#define glBlendEquationi glad_glBlendEquationi -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC)(GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GLAPI PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei; -#define glBlendEquationSeparatei glad_glBlendEquationSeparatei -typedef void (APIENTRYP PFNGLBLENDFUNCIPROC)(GLuint buf, GLenum src, GLenum dst); -GLAPI PFNGLBLENDFUNCIPROC glad_glBlendFunci; -#define glBlendFunci glad_glBlendFunci -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GLAPI PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei; -#define glBlendFuncSeparatei glad_glBlendFuncSeparatei -typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC)(GLenum mode, const void *indirect); -GLAPI PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect; -#define glDrawArraysIndirect glad_glDrawArraysIndirect -typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC)(GLenum mode, GLenum type, const void *indirect); -GLAPI PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect; -#define glDrawElementsIndirect glad_glDrawElementsIndirect -typedef void (APIENTRYP PFNGLUNIFORM1DPROC)(GLint location, GLdouble x); -GLAPI PFNGLUNIFORM1DPROC glad_glUniform1d; -#define glUniform1d glad_glUniform1d -typedef void (APIENTRYP PFNGLUNIFORM2DPROC)(GLint location, GLdouble x, GLdouble y); -GLAPI PFNGLUNIFORM2DPROC glad_glUniform2d; -#define glUniform2d glad_glUniform2d -typedef void (APIENTRYP PFNGLUNIFORM3DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLUNIFORM3DPROC glad_glUniform3d; -#define glUniform3d glad_glUniform3d -typedef void (APIENTRYP PFNGLUNIFORM4DPROC)(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLUNIFORM4DPROC glad_glUniform4d; -#define glUniform4d glad_glUniform4d -typedef void (APIENTRYP PFNGLUNIFORM1DVPROC)(GLint location, GLsizei count, const GLdouble *value); -GLAPI PFNGLUNIFORM1DVPROC glad_glUniform1dv; -#define glUniform1dv glad_glUniform1dv -typedef void (APIENTRYP PFNGLUNIFORM2DVPROC)(GLint location, GLsizei count, const GLdouble *value); -GLAPI PFNGLUNIFORM2DVPROC glad_glUniform2dv; -#define glUniform2dv glad_glUniform2dv -typedef void (APIENTRYP PFNGLUNIFORM3DVPROC)(GLint location, GLsizei count, const GLdouble *value); -GLAPI PFNGLUNIFORM3DVPROC glad_glUniform3dv; -#define glUniform3dv glad_glUniform3dv -typedef void (APIENTRYP PFNGLUNIFORM4DVPROC)(GLint location, GLsizei count, const GLdouble *value); -GLAPI PFNGLUNIFORM4DVPROC glad_glUniform4dv; -#define glUniform4dv glad_glUniform4dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv; -#define glUniformMatrix2dv glad_glUniformMatrix2dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv; -#define glUniformMatrix3dv glad_glUniformMatrix3dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv; -#define glUniformMatrix4dv glad_glUniformMatrix4dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv; -#define glUniformMatrix2x3dv glad_glUniformMatrix2x3dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv; -#define glUniformMatrix2x4dv glad_glUniformMatrix2x4dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv; -#define glUniformMatrix3x2dv glad_glUniformMatrix3x2dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv; -#define glUniformMatrix3x4dv glad_glUniformMatrix3x4dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv; -#define glUniformMatrix4x2dv glad_glUniformMatrix4x2dv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); -GLAPI PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv; -#define glUniformMatrix4x3dv glad_glUniformMatrix4x3dv -typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC)(GLuint program, GLint location, GLdouble *params); -GLAPI PFNGLGETUNIFORMDVPROC glad_glGetUniformdv; -#define glGetUniformdv glad_glGetUniformdv -typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)(GLuint program, GLenum shadertype, const GLchar *name); -GLAPI PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation; -#define glGetSubroutineUniformLocation glad_glGetSubroutineUniformLocation -typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC)(GLuint program, GLenum shadertype, const GLchar *name); -GLAPI PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex; -#define glGetSubroutineIndex glad_glGetSubroutineIndex -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); -GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv; -#define glGetActiveSubroutineUniformiv glad_glGetActiveSubroutineUniformiv -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName; -#define glGetActiveSubroutineUniformName glad_glGetActiveSubroutineUniformName -typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC)(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GLAPI PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName; -#define glGetActiveSubroutineName glad_glGetActiveSubroutineName -typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC)(GLenum shadertype, GLsizei count, const GLuint *indices); -GLAPI PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv; -#define glUniformSubroutinesuiv glad_glUniformSubroutinesuiv -typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC)(GLenum shadertype, GLint location, GLuint *params); -GLAPI PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv; -#define glGetUniformSubroutineuiv glad_glGetUniformSubroutineuiv -typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC)(GLuint program, GLenum shadertype, GLenum pname, GLint *values); -GLAPI PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv; -#define glGetProgramStageiv glad_glGetProgramStageiv -typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC)(GLenum pname, GLint value); -GLAPI PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri; -#define glPatchParameteri glad_glPatchParameteri -typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC)(GLenum pname, const GLfloat *values); -GLAPI PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv; -#define glPatchParameterfv glad_glPatchParameterfv -typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC)(GLenum target, GLuint id); -GLAPI PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback; -#define glBindTransformFeedback glad_glBindTransformFeedback -typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC)(GLsizei n, const GLuint *ids); -GLAPI PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks; -#define glDeleteTransformFeedbacks glad_glDeleteTransformFeedbacks -typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC)(GLsizei n, GLuint *ids); -GLAPI PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks; -#define glGenTransformFeedbacks glad_glGenTransformFeedbacks -typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC)(GLuint id); -GLAPI PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback; -#define glIsTransformFeedback glad_glIsTransformFeedback -typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC)(void); -GLAPI PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback; -#define glPauseTransformFeedback glad_glPauseTransformFeedback -typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC)(void); -GLAPI PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback; -#define glResumeTransformFeedback glad_glResumeTransformFeedback -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC)(GLenum mode, GLuint id); -GLAPI PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback; -#define glDrawTransformFeedback glad_glDrawTransformFeedback -typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)(GLenum mode, GLuint id, GLuint stream); -GLAPI PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream; -#define glDrawTransformFeedbackStream glad_glDrawTransformFeedbackStream -typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC)(GLenum target, GLuint index, GLuint id); -GLAPI PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed; -#define glBeginQueryIndexed glad_glBeginQueryIndexed -typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC)(GLenum target, GLuint index); -GLAPI PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed; -#define glEndQueryIndexed glad_glEndQueryIndexed -typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC)(GLenum target, GLuint index, GLenum pname, GLint *params); -GLAPI PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv; -#define glGetQueryIndexediv glad_glGetQueryIndexediv -#endif -#ifndef GL_ES_VERSION_2_0 -#define GL_ES_VERSION_2_0 1 -GLAPI int GLAD_GL_ES_VERSION_2_0; -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d); -GLAPI PFNGLCLEARDEPTHFPROC glad_glClearDepthf; -#define glClearDepthf glad_glClearDepthf -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); -GLAPI PFNGLDEPTHRANGEFPROC glad_glDepthRangef; -#define glDepthRangef glad_glDepthRangef -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; -#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void); -GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; -#define glReleaseShaderCompiler glad_glReleaseShaderCompiler -typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); -GLAPI PFNGLSHADERBINARYPROC glad_glShaderBinary; -#define glShaderBinary glad_glShaderBinary -#endif -#ifndef GL_ES_VERSION_3_0 -#define GL_ES_VERSION_3_0 1 -GLAPI int GLAD_GL_ES_VERSION_3_0; -typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GLAPI PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary; -#define glGetProgramBinary glad_glGetProgramBinary -typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC)(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -GLAPI PFNGLPROGRAMBINARYPROC glad_glProgramBinary; -#define glProgramBinary glad_glProgramBinary -typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC)(GLuint program, GLenum pname, GLint value); -GLAPI PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri; -#define glProgramParameteri glad_glProgramParameteri -typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments); -GLAPI PFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer; -#define glInvalidateFramebuffer glad_glInvalidateFramebuffer -typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC)(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer; -#define glInvalidateSubFramebuffer glad_glInvalidateSubFramebuffer -typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLTEXSTORAGE2DPROC glad_glTexStorage2D; -#define glTexStorage2D glad_glTexStorage2D -typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GLAPI PFNGLTEXSTORAGE3DPROC glad_glTexStorage3D; -#define glTexStorage3D glad_glTexStorage3D -typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC)(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint *params); -GLAPI PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ; -#define glGetInternalformativ glad_glGetInternalformativ -#endif -#ifndef GL_VERSION_ES_CM_1_0 -#define GL_VERSION_ES_CM_1_0 1 -GLAPI int GLAD_GL_VERSION_ES_CM_1_0; -typedef void (APIENTRYP PFNGLCLIPPLANEFPROC)(GLenum p, const GLfloat *eqn); -GLAPI PFNGLCLIPPLANEFPROC glad_glClipPlanef; -#define glClipPlanef glad_glClipPlanef -typedef void (APIENTRYP PFNGLFRUSTUMFPROC)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -GLAPI PFNGLFRUSTUMFPROC glad_glFrustumf; -#define glFrustumf glad_glFrustumf -typedef void (APIENTRYP PFNGLGETCLIPPLANEFPROC)(GLenum plane, GLfloat *equation); -GLAPI PFNGLGETCLIPPLANEFPROC glad_glGetClipPlanef; -#define glGetClipPlanef glad_glGetClipPlanef -typedef void (APIENTRYP PFNGLORTHOFPROC)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -GLAPI PFNGLORTHOFPROC glad_glOrthof; -#define glOrthof glad_glOrthof -typedef void (APIENTRYP PFNGLALPHAFUNCXPROC)(GLenum func, GLfixed ref); -GLAPI PFNGLALPHAFUNCXPROC glad_glAlphaFuncx; -#define glAlphaFuncx glad_glAlphaFuncx -typedef void (APIENTRYP PFNGLCLEARCOLORXPROC)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI PFNGLCLEARCOLORXPROC glad_glClearColorx; -#define glClearColorx glad_glClearColorx -typedef void (APIENTRYP PFNGLCLEARDEPTHXPROC)(GLfixed depth); -GLAPI PFNGLCLEARDEPTHXPROC glad_glClearDepthx; -#define glClearDepthx glad_glClearDepthx -typedef void (APIENTRYP PFNGLCLIPPLANEXPROC)(GLenum plane, const GLfixed *equation); -GLAPI PFNGLCLIPPLANEXPROC glad_glClipPlanex; -#define glClipPlanex glad_glClipPlanex -typedef void (APIENTRYP PFNGLCOLOR4XPROC)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -GLAPI PFNGLCOLOR4XPROC glad_glColor4x; -#define glColor4x glad_glColor4x -typedef void (APIENTRYP PFNGLDEPTHRANGEXPROC)(GLfixed n, GLfixed f); -GLAPI PFNGLDEPTHRANGEXPROC glad_glDepthRangex; -#define glDepthRangex glad_glDepthRangex -typedef void (APIENTRYP PFNGLFOGXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLFOGXPROC glad_glFogx; -#define glFogx glad_glFogx -typedef void (APIENTRYP PFNGLFOGXVPROC)(GLenum pname, const GLfixed *param); -GLAPI PFNGLFOGXVPROC glad_glFogxv; -#define glFogxv glad_glFogxv -typedef void (APIENTRYP PFNGLFRUSTUMXPROC)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI PFNGLFRUSTUMXPROC glad_glFrustumx; -#define glFrustumx glad_glFrustumx -typedef void (APIENTRYP PFNGLGETCLIPPLANEXPROC)(GLenum plane, GLfixed *equation); -GLAPI PFNGLGETCLIPPLANEXPROC glad_glGetClipPlanex; -#define glGetClipPlanex glad_glGetClipPlanex -typedef void (APIENTRYP PFNGLGETFIXEDVPROC)(GLenum pname, GLfixed *params); -GLAPI PFNGLGETFIXEDVPROC glad_glGetFixedv; -#define glGetFixedv glad_glGetFixedv -typedef void (APIENTRYP PFNGLGETLIGHTXVPROC)(GLenum light, GLenum pname, GLfixed *params); -GLAPI PFNGLGETLIGHTXVPROC glad_glGetLightxv; -#define glGetLightxv glad_glGetLightxv -typedef void (APIENTRYP PFNGLGETMATERIALXVPROC)(GLenum face, GLenum pname, GLfixed *params); -GLAPI PFNGLGETMATERIALXVPROC glad_glGetMaterialxv; -#define glGetMaterialxv glad_glGetMaterialxv -typedef void (APIENTRYP PFNGLGETTEXENVXVPROC)(GLenum target, GLenum pname, GLfixed *params); -GLAPI PFNGLGETTEXENVXVPROC glad_glGetTexEnvxv; -#define glGetTexEnvxv glad_glGetTexEnvxv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVPROC)(GLenum target, GLenum pname, GLfixed *params); -GLAPI PFNGLGETTEXPARAMETERXVPROC glad_glGetTexParameterxv; -#define glGetTexParameterxv glad_glGetTexParameterxv -typedef void (APIENTRYP PFNGLLIGHTMODELXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLLIGHTMODELXPROC glad_glLightModelx; -#define glLightModelx glad_glLightModelx -typedef void (APIENTRYP PFNGLLIGHTMODELXVPROC)(GLenum pname, const GLfixed *param); -GLAPI PFNGLLIGHTMODELXVPROC glad_glLightModelxv; -#define glLightModelxv glad_glLightModelxv -typedef void (APIENTRYP PFNGLLIGHTXPROC)(GLenum light, GLenum pname, GLfixed param); -GLAPI PFNGLLIGHTXPROC glad_glLightx; -#define glLightx glad_glLightx -typedef void (APIENTRYP PFNGLLIGHTXVPROC)(GLenum light, GLenum pname, const GLfixed *params); -GLAPI PFNGLLIGHTXVPROC glad_glLightxv; -#define glLightxv glad_glLightxv -typedef void (APIENTRYP PFNGLLINEWIDTHXPROC)(GLfixed width); -GLAPI PFNGLLINEWIDTHXPROC glad_glLineWidthx; -#define glLineWidthx glad_glLineWidthx -typedef void (APIENTRYP PFNGLLOADMATRIXXPROC)(const GLfixed *m); -GLAPI PFNGLLOADMATRIXXPROC glad_glLoadMatrixx; -#define glLoadMatrixx glad_glLoadMatrixx -typedef void (APIENTRYP PFNGLMATERIALXPROC)(GLenum face, GLenum pname, GLfixed param); -GLAPI PFNGLMATERIALXPROC glad_glMaterialx; -#define glMaterialx glad_glMaterialx -typedef void (APIENTRYP PFNGLMATERIALXVPROC)(GLenum face, GLenum pname, const GLfixed *param); -GLAPI PFNGLMATERIALXVPROC glad_glMaterialxv; -#define glMaterialxv glad_glMaterialxv -typedef void (APIENTRYP PFNGLMULTMATRIXXPROC)(const GLfixed *m); -GLAPI PFNGLMULTMATRIXXPROC glad_glMultMatrixx; -#define glMultMatrixx glad_glMultMatrixx -typedef void (APIENTRYP PFNGLMULTITEXCOORD4XPROC)(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); -GLAPI PFNGLMULTITEXCOORD4XPROC glad_glMultiTexCoord4x; -#define glMultiTexCoord4x glad_glMultiTexCoord4x -typedef void (APIENTRYP PFNGLNORMAL3XPROC)(GLfixed nx, GLfixed ny, GLfixed nz); -GLAPI PFNGLNORMAL3XPROC glad_glNormal3x; -#define glNormal3x glad_glNormal3x -typedef void (APIENTRYP PFNGLORTHOXPROC)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -GLAPI PFNGLORTHOXPROC glad_glOrthox; -#define glOrthox glad_glOrthox -typedef void (APIENTRYP PFNGLPOINTPARAMETERXPROC)(GLenum pname, GLfixed param); -GLAPI PFNGLPOINTPARAMETERXPROC glad_glPointParameterx; -#define glPointParameterx glad_glPointParameterx -typedef void (APIENTRYP PFNGLPOINTPARAMETERXVPROC)(GLenum pname, const GLfixed *params); -GLAPI PFNGLPOINTPARAMETERXVPROC glad_glPointParameterxv; -#define glPointParameterxv glad_glPointParameterxv -typedef void (APIENTRYP PFNGLPOINTSIZEXPROC)(GLfixed size); -GLAPI PFNGLPOINTSIZEXPROC glad_glPointSizex; -#define glPointSizex glad_glPointSizex -typedef void (APIENTRYP PFNGLPOLYGONOFFSETXPROC)(GLfixed factor, GLfixed units); -GLAPI PFNGLPOLYGONOFFSETXPROC glad_glPolygonOffsetx; -#define glPolygonOffsetx glad_glPolygonOffsetx -typedef void (APIENTRYP PFNGLROTATEXPROC)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLROTATEXPROC glad_glRotatex; -#define glRotatex glad_glRotatex -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEXPROC)(GLclampx value, GLboolean invert); -GLAPI PFNGLSAMPLECOVERAGEXPROC glad_glSampleCoveragex; -#define glSampleCoveragex glad_glSampleCoveragex -typedef void (APIENTRYP PFNGLSCALEXPROC)(GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLSCALEXPROC glad_glScalex; -#define glScalex glad_glScalex -typedef void (APIENTRYP PFNGLTEXENVXPROC)(GLenum target, GLenum pname, GLfixed param); -GLAPI PFNGLTEXENVXPROC glad_glTexEnvx; -#define glTexEnvx glad_glTexEnvx -typedef void (APIENTRYP PFNGLTEXENVXVPROC)(GLenum target, GLenum pname, const GLfixed *params); -GLAPI PFNGLTEXENVXVPROC glad_glTexEnvxv; -#define glTexEnvxv glad_glTexEnvxv -typedef void (APIENTRYP PFNGLTEXPARAMETERXPROC)(GLenum target, GLenum pname, GLfixed param); -GLAPI PFNGLTEXPARAMETERXPROC glad_glTexParameterx; -#define glTexParameterx glad_glTexParameterx -typedef void (APIENTRYP PFNGLTEXPARAMETERXVPROC)(GLenum target, GLenum pname, const GLfixed *params); -GLAPI PFNGLTEXPARAMETERXVPROC glad_glTexParameterxv; -#define glTexParameterxv glad_glTexParameterxv -typedef void (APIENTRYP PFNGLTRANSLATEXPROC)(GLfixed x, GLfixed y, GLfixed z); -GLAPI PFNGLTRANSLATEXPROC glad_glTranslatex; -#define glTranslatex glad_glTranslatex -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lib/glad/src/glad.c b/lib/glad/src/glad.c deleted file mode 100644 index 4a8a604e..00000000 --- a/lib/glad/src/glad.c +++ /dev/null @@ -1,2522 +0,0 @@ -/* - - OpenGL, OpenGL ES loader generated by glad 0.1.34 on Mon Mar 8 05:39:10 2021. - - Language/Generator: C/C++ - Specification: gl - APIs: gl=4.0, gles2=3.0, gles1=1.0 - Profile: compatibility - Extensions: - - Loader: True - Local files: False - Omit khrplatform: False - Reproducible: False - - Commandline: - --profile="compatibility" --api="gl=4.0,gles2=3.0,gles1=1.0" --generator="c" --spec="gl" --extensions="" - Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D4.0&api=gles2%3D3.0&api=gles1%3D1.0 -*/ - -#include -#include -#include -#include - -static void* get_proc(const char *namez); - -#if defined(_WIN32) || defined(__CYGWIN__) -#ifndef _WINDOWS_ -#undef APIENTRY -#endif -#include -static HMODULE libGL; - -typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); -static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; - -#ifdef _MSC_VER -#ifdef __has_include - #if __has_include() - #define HAVE_WINAPIFAMILY 1 - #endif -#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ - #define HAVE_WINAPIFAMILY 1 -#endif -#endif - -#ifdef HAVE_WINAPIFAMILY - #include - #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) - #define IS_UWP 1 - #endif -#endif - -static -int open_gl(void) { -#ifndef IS_UWP - libGL = LoadLibraryW(L"opengl32.dll"); - if(libGL != NULL) { - void (* tmp)(void); - tmp = (void(*)(void)) GetProcAddress(libGL, "wglGetProcAddress"); - gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp; - return gladGetProcAddressPtr != NULL; - } -#endif - - return 0; -} - -static -void close_gl(void) { - if(libGL != NULL) { - FreeLibrary((HMODULE) libGL); - libGL = NULL; - } -} -#else -#include -static void* libGL; - -#if !defined(__APPLE__) && !defined(__HAIKU__) -typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); -static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; -#endif - -static -int open_gl(void) { -#ifdef __APPLE__ - static const char *NAMES[] = { - "../Frameworks/OpenGL.framework/OpenGL", - "/Library/Frameworks/OpenGL.framework/OpenGL", - "/System/Library/Frameworks/OpenGL.framework/OpenGL", - "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" - }; -#else - static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; -#endif - - unsigned int index = 0; - for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { - libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); - - if(libGL != NULL) { -#if defined(__APPLE__) || defined(__HAIKU__) - return 1; -#else - gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, - "glXGetProcAddressARB"); - return gladGetProcAddressPtr != NULL; -#endif - } - } - - return 0; -} - -static -void close_gl(void) { - if(libGL != NULL) { - dlclose(libGL); - libGL = NULL; - } -} -#endif - -static -void* get_proc(const char *namez) { - void* result = NULL; - if(libGL == NULL) return NULL; - -#if !defined(__APPLE__) && !defined(__HAIKU__) - if(gladGetProcAddressPtr != NULL) { - result = gladGetProcAddressPtr(namez); - } -#endif - if(result == NULL) { -#if defined(_WIN32) || defined(__CYGWIN__) - result = (void*)GetProcAddress((HMODULE) libGL, namez); -#else - result = dlsym(libGL, namez); -#endif - } - - return result; -} - -int gladLoadGL(void) { - int status = 0; - - if(open_gl()) { - status = gladLoadGLLoader(&get_proc); - close_gl(); - } - - return status; -} - -struct gladGLversionStruct GLVersion = { 0, 0 }; - -#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) -#define _GLAD_IS_SOME_NEW_VERSION 1 -#endif - -static int max_loaded_major; -static int max_loaded_minor; - -static const char *exts = NULL; -static int num_exts_i = 0; -static char **exts_i = NULL; - -static int get_exts(void) { -#ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { -#endif - exts = (const char *)glGetString(GL_EXTENSIONS); -#ifdef _GLAD_IS_SOME_NEW_VERSION - } else { - unsigned int index; - - num_exts_i = 0; - glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); - if (num_exts_i > 0) { - exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i)); - } - - if (exts_i == NULL) { - return 0; - } - - for(index = 0; index < (unsigned)num_exts_i; index++) { - const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); - size_t len = strlen(gl_str_tmp); - - char *local_str = (char*)malloc((len+1) * sizeof(char)); - if(local_str != NULL) { - memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char)); - } - exts_i[index] = local_str; - } - } -#endif - return 1; -} - -static void free_exts(void) { - if (exts_i != NULL) { - int index; - for(index = 0; index < num_exts_i; index++) { - free((char *)exts_i[index]); - } - free((void *)exts_i); - exts_i = NULL; - } -} - -static int has_ext(const char *ext) { -#ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { -#endif - const char *extensions; - const char *loc; - const char *terminator; - extensions = exts; - if(extensions == NULL || ext == 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; - } -#ifdef _GLAD_IS_SOME_NEW_VERSION - } else { - int index; - if(exts_i == NULL) return 0; - for(index = 0; index < num_exts_i; index++) { - const char *e = exts_i[index]; - - if(exts_i[index] != NULL && strcmp(e, ext) == 0) { - return 1; - } - } - } -#endif - - return 0; -} -int GLAD_GL_VERSION_1_0 = 0; -int GLAD_GL_VERSION_1_1 = 0; -int GLAD_GL_VERSION_1_2 = 0; -int GLAD_GL_VERSION_1_3 = 0; -int GLAD_GL_VERSION_1_4 = 0; -int GLAD_GL_VERSION_1_5 = 0; -int GLAD_GL_VERSION_2_0 = 0; -int GLAD_GL_VERSION_2_1 = 0; -int GLAD_GL_VERSION_3_0 = 0; -int GLAD_GL_VERSION_3_1 = 0; -int GLAD_GL_VERSION_3_2 = 0; -int GLAD_GL_VERSION_3_3 = 0; -int GLAD_GL_VERSION_4_0 = 0; -int GLAD_GL_ES_VERSION_2_0 = 0; -int GLAD_GL_ES_VERSION_3_0 = 0; -int GLAD_GL_VERSION_ES_CM_1_0 = 0; -PFNGLACCUMPROC glad_glAccum = NULL; -PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; -PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; -PFNGLALPHAFUNCXPROC glad_glAlphaFuncx = NULL; -PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; -PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; -PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; -PFNGLBEGINPROC glad_glBegin = NULL; -PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL; -PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; -PFNGLBEGINQUERYINDEXEDPROC glad_glBeginQueryIndexed = NULL; -PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL; -PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; -PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; -PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL; -PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL; -PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL; -PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL; -PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; -PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; -PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL; -PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; -PFNGLBINDTRANSFORMFEEDBACKPROC glad_glBindTransformFeedback = NULL; -PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL; -PFNGLBITMAPPROC glad_glBitmap = NULL; -PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; -PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; -PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; -PFNGLBLENDEQUATIONSEPARATEIPROC glad_glBlendEquationSeparatei = NULL; -PFNGLBLENDEQUATIONIPROC glad_glBlendEquationi = NULL; -PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; -PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; -PFNGLBLENDFUNCSEPARATEIPROC glad_glBlendFuncSeparatei = NULL; -PFNGLBLENDFUNCIPROC glad_glBlendFunci = NULL; -PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; -PFNGLBUFFERDATAPROC glad_glBufferData = NULL; -PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; -PFNGLCALLLISTPROC glad_glCallList = NULL; -PFNGLCALLLISTSPROC glad_glCallLists = NULL; -PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; -PFNGLCLAMPCOLORPROC glad_glClampColor = NULL; -PFNGLCLEARPROC glad_glClear = NULL; -PFNGLCLEARACCUMPROC glad_glClearAccum = NULL; -PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL; -PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL; -PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL; -PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL; -PFNGLCLEARCOLORPROC glad_glClearColor = NULL; -PFNGLCLEARCOLORXPROC glad_glClearColorx = NULL; -PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; -PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL; -PFNGLCLEARDEPTHXPROC glad_glClearDepthx = NULL; -PFNGLCLEARINDEXPROC glad_glClearIndex = NULL; -PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; -PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL; -PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL; -PFNGLCLIPPLANEPROC glad_glClipPlane = NULL; -PFNGLCLIPPLANEFPROC glad_glClipPlanef = NULL; -PFNGLCLIPPLANEXPROC glad_glClipPlanex = NULL; -PFNGLCOLOR3BPROC glad_glColor3b = NULL; -PFNGLCOLOR3BVPROC glad_glColor3bv = NULL; -PFNGLCOLOR3DPROC glad_glColor3d = NULL; -PFNGLCOLOR3DVPROC glad_glColor3dv = NULL; -PFNGLCOLOR3FPROC glad_glColor3f = NULL; -PFNGLCOLOR3FVPROC glad_glColor3fv = NULL; -PFNGLCOLOR3IPROC glad_glColor3i = NULL; -PFNGLCOLOR3IVPROC glad_glColor3iv = NULL; -PFNGLCOLOR3SPROC glad_glColor3s = NULL; -PFNGLCOLOR3SVPROC glad_glColor3sv = NULL; -PFNGLCOLOR3UBPROC glad_glColor3ub = NULL; -PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL; -PFNGLCOLOR3UIPROC glad_glColor3ui = NULL; -PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL; -PFNGLCOLOR3USPROC glad_glColor3us = NULL; -PFNGLCOLOR3USVPROC glad_glColor3usv = NULL; -PFNGLCOLOR4BPROC glad_glColor4b = NULL; -PFNGLCOLOR4BVPROC glad_glColor4bv = NULL; -PFNGLCOLOR4DPROC glad_glColor4d = NULL; -PFNGLCOLOR4DVPROC glad_glColor4dv = NULL; -PFNGLCOLOR4FPROC glad_glColor4f = NULL; -PFNGLCOLOR4FVPROC glad_glColor4fv = NULL; -PFNGLCOLOR4IPROC glad_glColor4i = NULL; -PFNGLCOLOR4IVPROC glad_glColor4iv = NULL; -PFNGLCOLOR4SPROC glad_glColor4s = NULL; -PFNGLCOLOR4SVPROC glad_glColor4sv = NULL; -PFNGLCOLOR4UBPROC glad_glColor4ub = NULL; -PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL; -PFNGLCOLOR4UIPROC glad_glColor4ui = NULL; -PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL; -PFNGLCOLOR4USPROC glad_glColor4us = NULL; -PFNGLCOLOR4USVPROC glad_glColor4usv = NULL; -PFNGLCOLOR4XPROC glad_glColor4x = NULL; -PFNGLCOLORMASKPROC glad_glColorMask = NULL; -PFNGLCOLORMASKIPROC glad_glColorMaski = NULL; -PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL; -PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL; -PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL; -PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL; -PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL; -PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL; -PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; -PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; -PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; -PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; -PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL; -PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL; -PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; -PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; -PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; -PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; -PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; -PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; -PFNGLCREATESHADERPROC glad_glCreateShader = NULL; -PFNGLCULLFACEPROC glad_glCullFace = NULL; -PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; -PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; -PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; -PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; -PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; -PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; -PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL; -PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; -PFNGLDELETESYNCPROC glad_glDeleteSync = NULL; -PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; -PFNGLDELETETRANSFORMFEEDBACKSPROC glad_glDeleteTransformFeedbacks = NULL; -PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL; -PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; -PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; -PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; -PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; -PFNGLDEPTHRANGEXPROC glad_glDepthRangex = NULL; -PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; -PFNGLDISABLEPROC glad_glDisable = NULL; -PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL; -PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; -PFNGLDISABLEIPROC glad_glDisablei = NULL; -PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; -PFNGLDRAWARRAYSINDIRECTPROC glad_glDrawArraysIndirect = NULL; -PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL; -PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; -PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; -PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; -PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL; -PFNGLDRAWELEMENTSINDIRECTPROC glad_glDrawElementsIndirect = NULL; -PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL; -PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL; -PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL; -PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; -PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL; -PFNGLDRAWTRANSFORMFEEDBACKPROC glad_glDrawTransformFeedback = NULL; -PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glad_glDrawTransformFeedbackStream = NULL; -PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL; -PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL; -PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL; -PFNGLENABLEPROC glad_glEnable = NULL; -PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; -PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; -PFNGLENABLEIPROC glad_glEnablei = NULL; -PFNGLENDPROC glad_glEnd = NULL; -PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL; -PFNGLENDLISTPROC glad_glEndList = NULL; -PFNGLENDQUERYPROC glad_glEndQuery = NULL; -PFNGLENDQUERYINDEXEDPROC glad_glEndQueryIndexed = NULL; -PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL; -PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; -PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; -PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; -PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL; -PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL; -PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL; -PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL; -PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL; -PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL; -PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL; -PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL; -PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; -PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; -PFNGLFENCESYNCPROC glad_glFenceSync = NULL; -PFNGLFINISHPROC glad_glFinish = NULL; -PFNGLFLUSHPROC glad_glFlush = NULL; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL; -PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL; -PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL; -PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL; -PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL; -PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL; -PFNGLFOGFPROC glad_glFogf = NULL; -PFNGLFOGFVPROC glad_glFogfv = NULL; -PFNGLFOGIPROC glad_glFogi = NULL; -PFNGLFOGIVPROC glad_glFogiv = NULL; -PFNGLFOGXPROC glad_glFogx = NULL; -PFNGLFOGXVPROC glad_glFogxv = NULL; -PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; -PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL; -PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL; -PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; -PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL; -PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; -PFNGLFRONTFACEPROC glad_glFrontFace = NULL; -PFNGLFRUSTUMPROC glad_glFrustum = NULL; -PFNGLFRUSTUMFPROC glad_glFrustumf = NULL; -PFNGLFRUSTUMXPROC glad_glFrustumx = NULL; -PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; -PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; -PFNGLGENLISTSPROC glad_glGenLists = NULL; -PFNGLGENQUERIESPROC glad_glGenQueries = NULL; -PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; -PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL; -PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; -PFNGLGENTRANSFORMFEEDBACKSPROC glad_glGenTransformFeedbacks = NULL; -PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL; -PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; -PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; -PFNGLGETACTIVESUBROUTINENAMEPROC glad_glGetActiveSubroutineName = NULL; -PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glad_glGetActiveSubroutineUniformName = NULL; -PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glad_glGetActiveSubroutineUniformiv = NULL; -PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; -PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL; -PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL; -PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL; -PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; -PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; -PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL; -PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; -PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL; -PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; -PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; -PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; -PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; -PFNGLGETCLIPPLANEFPROC glad_glGetClipPlanef = NULL; -PFNGLGETCLIPPLANEXPROC glad_glGetClipPlanex = NULL; -PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; -PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; -PFNGLGETERRORPROC glad_glGetError = NULL; -PFNGLGETFIXEDVPROC glad_glGetFixedv = NULL; -PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; -PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL; -PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; -PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL; -PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL; -PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL; -PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; -PFNGLGETINTERNALFORMATIVPROC glad_glGetInternalformativ = NULL; -PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL; -PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL; -PFNGLGETLIGHTXVPROC glad_glGetLightxv = NULL; -PFNGLGETMAPDVPROC glad_glGetMapdv = NULL; -PFNGLGETMAPFVPROC glad_glGetMapfv = NULL; -PFNGLGETMAPIVPROC glad_glGetMapiv = NULL; -PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL; -PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL; -PFNGLGETMATERIALXVPROC glad_glGetMaterialxv = NULL; -PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL; -PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL; -PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; -PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; -PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; -PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; -PFNGLGETPROGRAMBINARYPROC glad_glGetProgramBinary = NULL; -PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; -PFNGLGETPROGRAMSTAGEIVPROC glad_glGetProgramStageiv = NULL; -PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; -PFNGLGETQUERYINDEXEDIVPROC glad_glGetQueryIndexediv = NULL; -PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL; -PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; -PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL; -PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; -PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; -PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; -PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL; -PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL; -PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL; -PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL; -PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; -PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat = NULL; -PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; -PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; -PFNGLGETSTRINGPROC glad_glGetString = NULL; -PFNGLGETSTRINGIPROC glad_glGetStringi = NULL; -PFNGLGETSUBROUTINEINDEXPROC glad_glGetSubroutineIndex = NULL; -PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glad_glGetSubroutineUniformLocation = NULL; -PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL; -PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; -PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; -PFNGLGETTEXENVXVPROC glad_glGetTexEnvxv = NULL; -PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL; -PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL; -PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL; -PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; -PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; -PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; -PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL; -PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL; -PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; -PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; -PFNGLGETTEXPARAMETERXVPROC glad_glGetTexParameterxv = NULL; -PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL; -PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL; -PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL; -PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; -PFNGLGETUNIFORMSUBROUTINEUIVPROC glad_glGetUniformSubroutineuiv = NULL; -PFNGLGETUNIFORMDVPROC glad_glGetUniformdv = NULL; -PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; -PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; -PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL; -PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL; -PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL; -PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; -PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; -PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; -PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; -PFNGLHINTPROC glad_glHint = NULL; -PFNGLINDEXMASKPROC glad_glIndexMask = NULL; -PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL; -PFNGLINDEXDPROC glad_glIndexd = NULL; -PFNGLINDEXDVPROC glad_glIndexdv = NULL; -PFNGLINDEXFPROC glad_glIndexf = NULL; -PFNGLINDEXFVPROC glad_glIndexfv = NULL; -PFNGLINDEXIPROC glad_glIndexi = NULL; -PFNGLINDEXIVPROC glad_glIndexiv = NULL; -PFNGLINDEXSPROC glad_glIndexs = NULL; -PFNGLINDEXSVPROC glad_glIndexsv = NULL; -PFNGLINDEXUBPROC glad_glIndexub = NULL; -PFNGLINDEXUBVPROC glad_glIndexubv = NULL; -PFNGLINITNAMESPROC glad_glInitNames = NULL; -PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; -PFNGLINVALIDATEFRAMEBUFFERPROC glad_glInvalidateFramebuffer = NULL; -PFNGLINVALIDATESUBFRAMEBUFFERPROC glad_glInvalidateSubFramebuffer = NULL; -PFNGLISBUFFERPROC glad_glIsBuffer = NULL; -PFNGLISENABLEDPROC glad_glIsEnabled = NULL; -PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL; -PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; -PFNGLISLISTPROC glad_glIsList = NULL; -PFNGLISPROGRAMPROC glad_glIsProgram = NULL; -PFNGLISQUERYPROC glad_glIsQuery = NULL; -PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; -PFNGLISSAMPLERPROC glad_glIsSampler = NULL; -PFNGLISSHADERPROC glad_glIsShader = NULL; -PFNGLISSYNCPROC glad_glIsSync = NULL; -PFNGLISTEXTUREPROC glad_glIsTexture = NULL; -PFNGLISTRANSFORMFEEDBACKPROC glad_glIsTransformFeedback = NULL; -PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL; -PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; -PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; -PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL; -PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL; -PFNGLLIGHTMODELXPROC glad_glLightModelx = NULL; -PFNGLLIGHTMODELXVPROC glad_glLightModelxv = NULL; -PFNGLLIGHTFPROC glad_glLightf = NULL; -PFNGLLIGHTFVPROC glad_glLightfv = NULL; -PFNGLLIGHTIPROC glad_glLighti = NULL; -PFNGLLIGHTIVPROC glad_glLightiv = NULL; -PFNGLLIGHTXPROC glad_glLightx = NULL; -PFNGLLIGHTXVPROC glad_glLightxv = NULL; -PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL; -PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; -PFNGLLINEWIDTHXPROC glad_glLineWidthx = NULL; -PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; -PFNGLLISTBASEPROC glad_glListBase = NULL; -PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL; -PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL; -PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL; -PFNGLLOADMATRIXXPROC glad_glLoadMatrixx = NULL; -PFNGLLOADNAMEPROC glad_glLoadName = NULL; -PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL; -PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL; -PFNGLLOGICOPPROC glad_glLogicOp = NULL; -PFNGLMAP1DPROC glad_glMap1d = NULL; -PFNGLMAP1FPROC glad_glMap1f = NULL; -PFNGLMAP2DPROC glad_glMap2d = NULL; -PFNGLMAP2FPROC glad_glMap2f = NULL; -PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; -PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL; -PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; -PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; -PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; -PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL; -PFNGLMATERIALFPROC glad_glMaterialf = NULL; -PFNGLMATERIALFVPROC glad_glMaterialfv = NULL; -PFNGLMATERIALIPROC glad_glMateriali = NULL; -PFNGLMATERIALIVPROC glad_glMaterialiv = NULL; -PFNGLMATERIALXPROC glad_glMaterialx = NULL; -PFNGLMATERIALXVPROC glad_glMaterialxv = NULL; -PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL; -PFNGLMINSAMPLESHADINGPROC glad_glMinSampleShading = NULL; -PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; -PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; -PFNGLMULTMATRIXXPROC glad_glMultMatrixx = NULL; -PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; -PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; -PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; -PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; -PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL; -PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; -PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; -PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; -PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL; -PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL; -PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL; -PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL; -PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL; -PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL; -PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL; -PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL; -PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL; -PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL; -PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL; -PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL; -PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL; -PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL; -PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL; -PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL; -PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL; -PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL; -PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL; -PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL; -PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL; -PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL; -PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL; -PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL; -PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL; -PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL; -PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL; -PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL; -PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL; -PFNGLMULTITEXCOORD4XPROC glad_glMultiTexCoord4x = NULL; -PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL; -PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL; -PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL; -PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL; -PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL; -PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL; -PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL; -PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL; -PFNGLNEWLISTPROC glad_glNewList = NULL; -PFNGLNORMAL3BPROC glad_glNormal3b = NULL; -PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL; -PFNGLNORMAL3DPROC glad_glNormal3d = NULL; -PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL; -PFNGLNORMAL3FPROC glad_glNormal3f = NULL; -PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL; -PFNGLNORMAL3IPROC glad_glNormal3i = NULL; -PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL; -PFNGLNORMAL3SPROC glad_glNormal3s = NULL; -PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL; -PFNGLNORMAL3XPROC glad_glNormal3x = NULL; -PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL; -PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL; -PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL; -PFNGLORTHOPROC glad_glOrtho = NULL; -PFNGLORTHOFPROC glad_glOrthof = NULL; -PFNGLORTHOXPROC glad_glOrthox = NULL; -PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL; -PFNGLPATCHPARAMETERFVPROC glad_glPatchParameterfv = NULL; -PFNGLPATCHPARAMETERIPROC glad_glPatchParameteri = NULL; -PFNGLPAUSETRANSFORMFEEDBACKPROC glad_glPauseTransformFeedback = NULL; -PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL; -PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL; -PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL; -PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; -PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; -PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL; -PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL; -PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL; -PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; -PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; -PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; -PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; -PFNGLPOINTPARAMETERXPROC glad_glPointParameterx = NULL; -PFNGLPOINTPARAMETERXVPROC glad_glPointParameterxv = NULL; -PFNGLPOINTSIZEPROC glad_glPointSize = NULL; -PFNGLPOINTSIZEXPROC glad_glPointSizex = NULL; -PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; -PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; -PFNGLPOLYGONOFFSETXPROC glad_glPolygonOffsetx = NULL; -PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL; -PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL; -PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL; -PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL; -PFNGLPOPNAMEPROC glad_glPopName = NULL; -PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL; -PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL; -PFNGLPROGRAMBINARYPROC glad_glProgramBinary = NULL; -PFNGLPROGRAMPARAMETERIPROC glad_glProgramParameteri = NULL; -PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL; -PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL; -PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL; -PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL; -PFNGLPUSHNAMEPROC glad_glPushName = NULL; -PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL; -PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL; -PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL; -PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL; -PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL; -PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL; -PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL; -PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL; -PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL; -PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL; -PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL; -PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL; -PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL; -PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL; -PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL; -PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL; -PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL; -PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL; -PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL; -PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL; -PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL; -PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL; -PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL; -PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL; -PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL; -PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; -PFNGLREADPIXELSPROC glad_glReadPixels = NULL; -PFNGLRECTDPROC glad_glRectd = NULL; -PFNGLRECTDVPROC glad_glRectdv = NULL; -PFNGLRECTFPROC glad_glRectf = NULL; -PFNGLRECTFVPROC glad_glRectfv = NULL; -PFNGLRECTIPROC glad_glRecti = NULL; -PFNGLRECTIVPROC glad_glRectiv = NULL; -PFNGLRECTSPROC glad_glRects = NULL; -PFNGLRECTSVPROC glad_glRectsv = NULL; -PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler = NULL; -PFNGLRENDERMODEPROC glad_glRenderMode = NULL; -PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; -PFNGLRESUMETRANSFORMFEEDBACKPROC glad_glResumeTransformFeedback = NULL; -PFNGLROTATEDPROC glad_glRotated = NULL; -PFNGLROTATEFPROC glad_glRotatef = NULL; -PFNGLROTATEXPROC glad_glRotatex = NULL; -PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; -PFNGLSAMPLECOVERAGEXPROC glad_glSampleCoveragex = NULL; -PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL; -PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL; -PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL; -PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL; -PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL; -PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL; -PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL; -PFNGLSCALEDPROC glad_glScaled = NULL; -PFNGLSCALEFPROC glad_glScalef = NULL; -PFNGLSCALEXPROC glad_glScalex = NULL; -PFNGLSCISSORPROC glad_glScissor = NULL; -PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL; -PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL; -PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL; -PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL; -PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL; -PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL; -PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL; -PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL; -PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL; -PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL; -PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL; -PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL; -PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL; -PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL; -PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL; -PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL; -PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL; -PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL; -PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; -PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; -PFNGLSHADEMODELPROC glad_glShadeModel = NULL; -PFNGLSHADERBINARYPROC glad_glShaderBinary = NULL; -PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; -PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; -PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; -PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; -PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; -PFNGLSTENCILOPPROC glad_glStencilOp = NULL; -PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; -PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL; -PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL; -PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL; -PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL; -PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL; -PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL; -PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL; -PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL; -PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL; -PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL; -PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL; -PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL; -PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL; -PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL; -PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL; -PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL; -PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL; -PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL; -PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL; -PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL; -PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL; -PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL; -PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL; -PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL; -PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL; -PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL; -PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL; -PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL; -PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL; -PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL; -PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL; -PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL; -PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL; -PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL; -PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL; -PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL; -PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL; -PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL; -PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL; -PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL; -PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL; -PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL; -PFNGLTEXENVFPROC glad_glTexEnvf = NULL; -PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL; -PFNGLTEXENVIPROC glad_glTexEnvi = NULL; -PFNGLTEXENVIVPROC glad_glTexEnviv = NULL; -PFNGLTEXENVXPROC glad_glTexEnvx = NULL; -PFNGLTEXENVXVPROC glad_glTexEnvxv = NULL; -PFNGLTEXGENDPROC glad_glTexGend = NULL; -PFNGLTEXGENDVPROC glad_glTexGendv = NULL; -PFNGLTEXGENFPROC glad_glTexGenf = NULL; -PFNGLTEXGENFVPROC glad_glTexGenfv = NULL; -PFNGLTEXGENIPROC glad_glTexGeni = NULL; -PFNGLTEXGENIVPROC glad_glTexGeniv = NULL; -PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; -PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; -PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL; -PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; -PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL; -PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL; -PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL; -PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; -PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; -PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; -PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; -PFNGLTEXPARAMETERXPROC glad_glTexParameterx = NULL; -PFNGLTEXPARAMETERXVPROC glad_glTexParameterxv = NULL; -PFNGLTEXSTORAGE2DPROC glad_glTexStorage2D = NULL; -PFNGLTEXSTORAGE3DPROC glad_glTexStorage3D = NULL; -PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; -PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; -PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; -PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL; -PFNGLTRANSLATEDPROC glad_glTranslated = NULL; -PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; -PFNGLTRANSLATEXPROC glad_glTranslatex = NULL; -PFNGLUNIFORM1DPROC glad_glUniform1d = NULL; -PFNGLUNIFORM1DVPROC glad_glUniform1dv = NULL; -PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; -PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; -PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; -PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; -PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL; -PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL; -PFNGLUNIFORM2DPROC glad_glUniform2d = NULL; -PFNGLUNIFORM2DVPROC glad_glUniform2dv = NULL; -PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; -PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; -PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; -PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; -PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL; -PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL; -PFNGLUNIFORM3DPROC glad_glUniform3d = NULL; -PFNGLUNIFORM3DVPROC glad_glUniform3dv = NULL; -PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; -PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; -PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; -PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; -PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL; -PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL; -PFNGLUNIFORM4DPROC glad_glUniform4d = NULL; -PFNGLUNIFORM4DVPROC glad_glUniform4dv = NULL; -PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; -PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; -PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; -PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; -PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL; -PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL; -PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL; -PFNGLUNIFORMMATRIX2DVPROC glad_glUniformMatrix2dv = NULL; -PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; -PFNGLUNIFORMMATRIX2X3DVPROC glad_glUniformMatrix2x3dv = NULL; -PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; -PFNGLUNIFORMMATRIX2X4DVPROC glad_glUniformMatrix2x4dv = NULL; -PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; -PFNGLUNIFORMMATRIX3DVPROC glad_glUniformMatrix3dv = NULL; -PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; -PFNGLUNIFORMMATRIX3X2DVPROC glad_glUniformMatrix3x2dv = NULL; -PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; -PFNGLUNIFORMMATRIX3X4DVPROC glad_glUniformMatrix3x4dv = NULL; -PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; -PFNGLUNIFORMMATRIX4DVPROC glad_glUniformMatrix4dv = NULL; -PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; -PFNGLUNIFORMMATRIX4X2DVPROC glad_glUniformMatrix4x2dv = NULL; -PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; -PFNGLUNIFORMMATRIX4X3DVPROC glad_glUniformMatrix4x3dv = NULL; -PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; -PFNGLUNIFORMSUBROUTINESUIVPROC glad_glUniformSubroutinesuiv = NULL; -PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; -PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; -PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; -PFNGLVERTEX2DPROC glad_glVertex2d = NULL; -PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; -PFNGLVERTEX2FPROC glad_glVertex2f = NULL; -PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL; -PFNGLVERTEX2IPROC glad_glVertex2i = NULL; -PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL; -PFNGLVERTEX2SPROC glad_glVertex2s = NULL; -PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL; -PFNGLVERTEX3DPROC glad_glVertex3d = NULL; -PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL; -PFNGLVERTEX3FPROC glad_glVertex3f = NULL; -PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL; -PFNGLVERTEX3IPROC glad_glVertex3i = NULL; -PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL; -PFNGLVERTEX3SPROC glad_glVertex3s = NULL; -PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL; -PFNGLVERTEX4DPROC glad_glVertex4d = NULL; -PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL; -PFNGLVERTEX4FPROC glad_glVertex4f = NULL; -PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL; -PFNGLVERTEX4IPROC glad_glVertex4i = NULL; -PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL; -PFNGLVERTEX4SPROC glad_glVertex4s = NULL; -PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; -PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; -PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; -PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; -PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; -PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; -PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; -PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; -PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; -PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; -PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; -PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; -PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; -PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; -PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; -PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; -PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; -PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; -PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; -PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; -PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; -PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; -PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; -PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; -PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; -PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; -PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; -PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; -PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; -PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; -PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; -PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; -PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; -PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; -PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; -PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; -PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; -PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL; -PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL; -PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL; -PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL; -PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL; -PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL; -PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL; -PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL; -PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL; -PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL; -PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL; -PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL; -PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL; -PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL; -PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL; -PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL; -PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL; -PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL; -PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL; -PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL; -PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL; -PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL; -PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL; -PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL; -PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL; -PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL; -PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL; -PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL; -PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL; -PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL; -PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; -PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL; -PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL; -PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL; -PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL; -PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL; -PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL; -PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; -PFNGLVIEWPORTPROC glad_glViewport = NULL; -PFNGLWAITSYNCPROC glad_glWaitSync = NULL; -PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL; -PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL; -PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL; -PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL; -PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL; -PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL; -PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL; -PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL; -PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL; -PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL; -PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL; -PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL; -PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; -PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; -PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; -PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; -static void load_GL_VERSION_1_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_0) return; - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); - glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); - glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); - glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); - glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); - glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); - glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); - glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); - glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); - glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); - glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); - glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); - glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); - glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); - glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); - glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); - glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); - glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); - glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); - glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); - glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); - glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); - glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); - glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); - glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); - glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); - glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); - glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); - glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); - glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); - glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); - glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); - glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); - glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); - glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); - glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); - glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); - glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); - glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); - glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); - glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); - glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); - glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); - glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); - glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); - glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); - glad_glEnd = (PFNGLENDPROC)load("glEnd"); - glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); - glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); - glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); - glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); - glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); - glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); - glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); - glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); - glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); - glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); - glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); - glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); - glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); - glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); - glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); - glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); - glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); - glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); - glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); - glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); - glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); - glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); - glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); - glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); - glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); - glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); - glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); - glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); - glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); - glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); - glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); - glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); - glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); - glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); - glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); - glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); - glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); - glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); - glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); - glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); - glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); - glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); - glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); - glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); - glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); - glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); - glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); - glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); - glad_glRects = (PFNGLRECTSPROC)load("glRects"); - glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); - glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); - glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); - glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); - glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); - glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); - glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); - glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); - glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); - glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); - glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); - glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); - glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); - glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); - glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); - glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); - glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); - glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); - glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); - glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); - glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); - glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); - glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); - glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); - glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); - glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); - glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); - glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); - glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); - glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); - glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); - glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); - glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); - glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); - glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); - glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); - glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); - glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); - glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); - glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); - glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); - glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); - glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); - glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); - glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); - glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); - glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); - glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); - glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); - glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); - glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); - glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); - glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); - glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); - glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); - glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); - glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); - glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); - glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); - glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); - glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); - glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); - glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); - glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); - glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); - glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); - glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); - glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); - glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); - glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); - glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); - glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); - glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); - glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); - glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); - glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); - glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); - glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); - glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); - glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); - glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); - glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); - glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); - glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); - glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); - glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); - glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); - glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); - glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); - glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); - glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); - glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); - glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); - glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); - glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); - glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); - glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); - glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); - glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); - glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); - glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); - glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); - glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); - glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); - glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); - glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); - glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); - glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); - glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); - glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); - glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); - glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); - glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); - glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); - glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); - glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); - glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); - glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); - glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); - glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); - glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); - glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); - glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); - glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); - glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); - glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); - glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); - glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); - glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); - glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); - glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); - glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); - glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); - glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); - glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); - glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); - glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); - glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); - glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); - glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); - glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); - glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); - glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); - glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); - glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); - glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); - glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); - glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); - glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); - glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); - glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); - glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); - glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); - glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); - glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); - glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); - glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); - glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); - glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); - glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); - glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); - glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); - glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); - glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); - glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); -} -static void load_GL_VERSION_1_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_1) return; - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); - glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); - glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); - glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); - glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); - glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); - glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); - glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); - glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); - glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); - glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); - glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); - glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); - glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); - glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); - glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); -} -static void load_GL_VERSION_1_2(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_2) return; - glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); - glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); - glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); - glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); -} -static void load_GL_VERSION_1_3(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_3) return; - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); - glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); - glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); - glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); - glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); - glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); - glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); - glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); - glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); - glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); - glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); - glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); - glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); - glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); - glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); - glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); - glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); - glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); - glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); - glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); - glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); - glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); - glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); - glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); - glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); - glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); - glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); - glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); - glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); - glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); - glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); - glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); - glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); - glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); - glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); - glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); - glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); - glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); - glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); - glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); -} -static void load_GL_VERSION_1_4(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_4) return; - glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); - glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); - glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); - glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); - glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); - glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); - glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); - glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); - glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); - glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); - glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); - glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); - glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); - glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); - glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); - glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); - glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); - glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); - glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); - glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); - glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); - glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); - glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); - glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); - glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); - glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); - glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); - glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); - glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); - glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); - glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); - glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); - glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); - glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); - glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); - glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); - glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); - glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); - glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); - glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); - glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); - glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); - glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); - glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); - glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); - glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); - glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); -} -static void load_GL_VERSION_1_5(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_5) return; - glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); - glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); - glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); - glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); - glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); - glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); - glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); - glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); - glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); - glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); -} -static void load_GL_VERSION_2_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_2_0) return; - glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); - glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); - glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); - glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); - glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); - glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); - glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); - glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); - glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); - glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); - glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); - glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); - glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); - glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); - glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); - glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); - glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); - glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); - glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); - glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); - glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); - glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); - glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); - glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); - glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); - glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); - glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); - glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); - glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); - glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); - glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); - glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); - glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); - glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); - glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); - glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); - glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); - glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); - glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); - glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); - glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); - glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); - glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); - glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); - glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); - glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); - glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); - glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); - glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); - glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); - glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); - glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); - glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); - glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); - glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); - glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); - glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); - glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); - glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); - glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); - glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); - glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); - glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); - glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); - glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); - glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); - glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); - glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); - glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); - glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); - glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); - glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); - glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); - glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); - glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); - glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); - glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); - glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); - glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); - glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); - glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); - glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); - glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); - glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); - glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); - glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); - glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); - glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); - glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); - glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); - glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); - glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); - glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); -} -static void load_GL_VERSION_2_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_2_1) return; - glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); - glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); - glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); - glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); - glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); - glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); -} -static void load_GL_VERSION_3_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_0) return; - glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); - glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); - glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); - glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); - glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); - glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); - glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); - glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); - glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); - glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); - glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); - glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); - glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); - glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); - glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); - glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); - glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); - glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); - glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); - glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); - glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); - glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); - glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); - glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); - glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); - glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); - glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); - glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); - glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); - glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); - glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); - glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); - glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); - glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); - glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); - glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); - glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); - glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); - glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); - glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); - glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); - glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); - glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); - glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); - glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); - glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); - glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); - glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); - glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); - glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); - glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); - glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); - glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); - glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); - glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); - glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); - glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); - glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); - glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); - glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); - glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); - glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); - glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); - glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); - glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); - glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); - glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); - glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); - glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); - glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); - glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); - glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); - glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); - glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); - glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); - glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); - glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); - glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); - glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); - glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); -} -static void load_GL_VERSION_3_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_1) return; - glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); - glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); - glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); - glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); - glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); - glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); - glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); - glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); - glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); - glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); - glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); - glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); -} -static void load_GL_VERSION_3_2(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_2) return; - glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex"); - glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex"); - glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex"); - glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex"); - glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex"); - glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); - glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); - glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); - glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); - glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); - glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); - glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); - glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); - glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); - glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture"); - glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample"); - glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample"); - glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv"); - glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski"); -} -static void load_GL_VERSION_3_3(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_3) return; - glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)load("glBindFragDataLocationIndexed"); - glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC)load("glGetFragDataIndex"); - glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); - glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); - glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); - glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); - glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); - glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); - glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); - glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); - glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC)load("glSamplerParameterIiv"); - glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC)load("glSamplerParameterIuiv"); - glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); - glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC)load("glGetSamplerParameterIiv"); - glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); - glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC)load("glGetSamplerParameterIuiv"); - glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC)load("glQueryCounter"); - glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC)load("glGetQueryObjecti64v"); - glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC)load("glGetQueryObjectui64v"); - glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); - glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC)load("glVertexAttribP1ui"); - glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC)load("glVertexAttribP1uiv"); - glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC)load("glVertexAttribP2ui"); - glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC)load("glVertexAttribP2uiv"); - glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC)load("glVertexAttribP3ui"); - glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC)load("glVertexAttribP3uiv"); - glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC)load("glVertexAttribP4ui"); - glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC)load("glVertexAttribP4uiv"); - glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC)load("glVertexP2ui"); - glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC)load("glVertexP2uiv"); - glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC)load("glVertexP3ui"); - glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC)load("glVertexP3uiv"); - glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC)load("glVertexP4ui"); - glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC)load("glVertexP4uiv"); - glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC)load("glTexCoordP1ui"); - glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC)load("glTexCoordP1uiv"); - glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC)load("glTexCoordP2ui"); - glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC)load("glTexCoordP2uiv"); - glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC)load("glTexCoordP3ui"); - glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC)load("glTexCoordP3uiv"); - glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC)load("glTexCoordP4ui"); - glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC)load("glTexCoordP4uiv"); - glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC)load("glMultiTexCoordP1ui"); - glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC)load("glMultiTexCoordP1uiv"); - glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC)load("glMultiTexCoordP2ui"); - glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC)load("glMultiTexCoordP2uiv"); - glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC)load("glMultiTexCoordP3ui"); - glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC)load("glMultiTexCoordP3uiv"); - glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC)load("glMultiTexCoordP4ui"); - glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC)load("glMultiTexCoordP4uiv"); - glad_glNormalP3ui = (PFNGLNORMALP3UIPROC)load("glNormalP3ui"); - glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC)load("glNormalP3uiv"); - glad_glColorP3ui = (PFNGLCOLORP3UIPROC)load("glColorP3ui"); - glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC)load("glColorP3uiv"); - glad_glColorP4ui = (PFNGLCOLORP4UIPROC)load("glColorP4ui"); - glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC)load("glColorP4uiv"); - glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC)load("glSecondaryColorP3ui"); - glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC)load("glSecondaryColorP3uiv"); -} -static void load_GL_VERSION_4_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_4_0) return; - glad_glMinSampleShading = (PFNGLMINSAMPLESHADINGPROC)load("glMinSampleShading"); - glad_glBlendEquationi = (PFNGLBLENDEQUATIONIPROC)load("glBlendEquationi"); - glad_glBlendEquationSeparatei = (PFNGLBLENDEQUATIONSEPARATEIPROC)load("glBlendEquationSeparatei"); - glad_glBlendFunci = (PFNGLBLENDFUNCIPROC)load("glBlendFunci"); - glad_glBlendFuncSeparatei = (PFNGLBLENDFUNCSEPARATEIPROC)load("glBlendFuncSeparatei"); - glad_glDrawArraysIndirect = (PFNGLDRAWARRAYSINDIRECTPROC)load("glDrawArraysIndirect"); - glad_glDrawElementsIndirect = (PFNGLDRAWELEMENTSINDIRECTPROC)load("glDrawElementsIndirect"); - glad_glUniform1d = (PFNGLUNIFORM1DPROC)load("glUniform1d"); - glad_glUniform2d = (PFNGLUNIFORM2DPROC)load("glUniform2d"); - glad_glUniform3d = (PFNGLUNIFORM3DPROC)load("glUniform3d"); - glad_glUniform4d = (PFNGLUNIFORM4DPROC)load("glUniform4d"); - glad_glUniform1dv = (PFNGLUNIFORM1DVPROC)load("glUniform1dv"); - glad_glUniform2dv = (PFNGLUNIFORM2DVPROC)load("glUniform2dv"); - glad_glUniform3dv = (PFNGLUNIFORM3DVPROC)load("glUniform3dv"); - glad_glUniform4dv = (PFNGLUNIFORM4DVPROC)load("glUniform4dv"); - glad_glUniformMatrix2dv = (PFNGLUNIFORMMATRIX2DVPROC)load("glUniformMatrix2dv"); - glad_glUniformMatrix3dv = (PFNGLUNIFORMMATRIX3DVPROC)load("glUniformMatrix3dv"); - glad_glUniformMatrix4dv = (PFNGLUNIFORMMATRIX4DVPROC)load("glUniformMatrix4dv"); - glad_glUniformMatrix2x3dv = (PFNGLUNIFORMMATRIX2X3DVPROC)load("glUniformMatrix2x3dv"); - glad_glUniformMatrix2x4dv = (PFNGLUNIFORMMATRIX2X4DVPROC)load("glUniformMatrix2x4dv"); - glad_glUniformMatrix3x2dv = (PFNGLUNIFORMMATRIX3X2DVPROC)load("glUniformMatrix3x2dv"); - glad_glUniformMatrix3x4dv = (PFNGLUNIFORMMATRIX3X4DVPROC)load("glUniformMatrix3x4dv"); - glad_glUniformMatrix4x2dv = (PFNGLUNIFORMMATRIX4X2DVPROC)load("glUniformMatrix4x2dv"); - glad_glUniformMatrix4x3dv = (PFNGLUNIFORMMATRIX4X3DVPROC)load("glUniformMatrix4x3dv"); - glad_glGetUniformdv = (PFNGLGETUNIFORMDVPROC)load("glGetUniformdv"); - glad_glGetSubroutineUniformLocation = (PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC)load("glGetSubroutineUniformLocation"); - glad_glGetSubroutineIndex = (PFNGLGETSUBROUTINEINDEXPROC)load("glGetSubroutineIndex"); - glad_glGetActiveSubroutineUniformiv = (PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC)load("glGetActiveSubroutineUniformiv"); - glad_glGetActiveSubroutineUniformName = (PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC)load("glGetActiveSubroutineUniformName"); - glad_glGetActiveSubroutineName = (PFNGLGETACTIVESUBROUTINENAMEPROC)load("glGetActiveSubroutineName"); - glad_glUniformSubroutinesuiv = (PFNGLUNIFORMSUBROUTINESUIVPROC)load("glUniformSubroutinesuiv"); - glad_glGetUniformSubroutineuiv = (PFNGLGETUNIFORMSUBROUTINEUIVPROC)load("glGetUniformSubroutineuiv"); - glad_glGetProgramStageiv = (PFNGLGETPROGRAMSTAGEIVPROC)load("glGetProgramStageiv"); - glad_glPatchParameteri = (PFNGLPATCHPARAMETERIPROC)load("glPatchParameteri"); - glad_glPatchParameterfv = (PFNGLPATCHPARAMETERFVPROC)load("glPatchParameterfv"); - glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); - glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); - glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); - glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); - glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); - glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); - glad_glDrawTransformFeedback = (PFNGLDRAWTRANSFORMFEEDBACKPROC)load("glDrawTransformFeedback"); - glad_glDrawTransformFeedbackStream = (PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC)load("glDrawTransformFeedbackStream"); - glad_glBeginQueryIndexed = (PFNGLBEGINQUERYINDEXEDPROC)load("glBeginQueryIndexed"); - glad_glEndQueryIndexed = (PFNGLENDQUERYINDEXEDPROC)load("glEndQueryIndexed"); - glad_glGetQueryIndexediv = (PFNGLGETQUERYINDEXEDIVPROC)load("glGetQueryIndexediv"); -} -static int find_extensionsGL(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; -} - -static void find_coreGL(void) { - - /* Thank you @elmindreda - * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 - * https://github.com/glfw/glfw/blob/master/src/context.c#L36 - */ - int i, major, minor; - - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL - }; - - version = (const char*) glGetString(GL_VERSION); - if (!version) return; - - for (i = 0; prefixes[i]; i++) { - const size_t length = strlen(prefixes[i]); - if (strncmp(version, prefixes[i], length) == 0) { - version += length; - break; - } - } - -/* PR #18 */ -#ifdef _MSC_VER - sscanf_s(version, "%d.%d", &major, &minor); -#else - sscanf(version, "%d.%d", &major, &minor); -#endif - - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; - GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; - GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; - GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; - GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; - GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; - GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; - GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; - GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; - GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; - GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; - GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; - GLAD_GL_VERSION_4_0 = (major == 4 && minor >= 0) || major > 4; - if (GLVersion.major > 4 || (GLVersion.major >= 4 && GLVersion.minor >= 0)) { - max_loaded_major = 4; - max_loaded_minor = 0; - } -} - -int gladLoadGLLoader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGL(); - load_GL_VERSION_1_0(load); - load_GL_VERSION_1_1(load); - load_GL_VERSION_1_2(load); - load_GL_VERSION_1_3(load); - load_GL_VERSION_1_4(load); - load_GL_VERSION_1_5(load); - load_GL_VERSION_2_0(load); - load_GL_VERSION_2_1(load); - load_GL_VERSION_3_0(load); - load_GL_VERSION_3_1(load); - load_GL_VERSION_3_2(load); - load_GL_VERSION_3_3(load); - load_GL_VERSION_4_0(load); - - if (!find_extensionsGL()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; -} - -static void load_GL_ES_VERSION_2_0(GLADloadproc load) { - if(!GLAD_GL_ES_VERSION_2_0) return; - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); - glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); - glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); - glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); - glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); - glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); - glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); - glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); - glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); - glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); - glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); - glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); - glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); - glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); - glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); - glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); - glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); - glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); - glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); - glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); - glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); - glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); - glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); - glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); - glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); - glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); - glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); - glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); - glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); - glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); - glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); - glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); - glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); - glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); - glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); - glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); - glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); - glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); - glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); - glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); - glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); - glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); - glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); - glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); - glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); - glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); - glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); - glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); - glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); - glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); - glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); - glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); - glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); - glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); - glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); - glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); - glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); - glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); - glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); - glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); - glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); -} -static void load_GL_ES_VERSION_3_0(GLADloadproc load) { - if(!GLAD_GL_ES_VERSION_3_0) return; - glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); - glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); - glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); - glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); - glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); - glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); - glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); - glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); - glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); - glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); - glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); - glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); - glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); - glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); - glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); - glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); - glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); - glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); - glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); - glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); - glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); - glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); - glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); - glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); - glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); - glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); - glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); - glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); - glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); - glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); - glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); - glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); - glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); - glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); - glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); - glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); - glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); - glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); - glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); - glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); - glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); - glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); - glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); - glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); - glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); - glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); - glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); - glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); - glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); - glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); - glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); - glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); - glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); - glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); - glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); - glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); - glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); - glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); - glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); - glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); - glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); - glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); - glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); - glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); - glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); - glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); - glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync"); - glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync"); - glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync"); - glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync"); - glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync"); - glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v"); - glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv"); - glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v"); - glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v"); - glad_glGenSamplers = (PFNGLGENSAMPLERSPROC)load("glGenSamplers"); - glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC)load("glDeleteSamplers"); - glad_glIsSampler = (PFNGLISSAMPLERPROC)load("glIsSampler"); - glad_glBindSampler = (PFNGLBINDSAMPLERPROC)load("glBindSampler"); - glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC)load("glSamplerParameteri"); - glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC)load("glSamplerParameteriv"); - glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC)load("glSamplerParameterf"); - glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC)load("glSamplerParameterfv"); - glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC)load("glGetSamplerParameteriv"); - glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC)load("glGetSamplerParameterfv"); - glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)load("glVertexAttribDivisor"); - glad_glBindTransformFeedback = (PFNGLBINDTRANSFORMFEEDBACKPROC)load("glBindTransformFeedback"); - glad_glDeleteTransformFeedbacks = (PFNGLDELETETRANSFORMFEEDBACKSPROC)load("glDeleteTransformFeedbacks"); - glad_glGenTransformFeedbacks = (PFNGLGENTRANSFORMFEEDBACKSPROC)load("glGenTransformFeedbacks"); - glad_glIsTransformFeedback = (PFNGLISTRANSFORMFEEDBACKPROC)load("glIsTransformFeedback"); - glad_glPauseTransformFeedback = (PFNGLPAUSETRANSFORMFEEDBACKPROC)load("glPauseTransformFeedback"); - glad_glResumeTransformFeedback = (PFNGLRESUMETRANSFORMFEEDBACKPROC)load("glResumeTransformFeedback"); - glad_glGetProgramBinary = (PFNGLGETPROGRAMBINARYPROC)load("glGetProgramBinary"); - glad_glProgramBinary = (PFNGLPROGRAMBINARYPROC)load("glProgramBinary"); - glad_glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC)load("glProgramParameteri"); - glad_glInvalidateFramebuffer = (PFNGLINVALIDATEFRAMEBUFFERPROC)load("glInvalidateFramebuffer"); - glad_glInvalidateSubFramebuffer = (PFNGLINVALIDATESUBFRAMEBUFFERPROC)load("glInvalidateSubFramebuffer"); - glad_glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)load("glTexStorage2D"); - glad_glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)load("glTexStorage3D"); - glad_glGetInternalformativ = (PFNGLGETINTERNALFORMATIVPROC)load("glGetInternalformativ"); -} -static int find_extensionsGLES2(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; -} - -static void find_coreGLES2(void) { - - /* Thank you @elmindreda - * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 - * https://github.com/glfw/glfw/blob/master/src/context.c#L36 - */ - int i, major, minor; - - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL - }; - - version = (const char*) glGetString(GL_VERSION); - if (!version) return; - - for (i = 0; prefixes[i]; i++) { - const size_t length = strlen(prefixes[i]); - if (strncmp(version, prefixes[i], length) == 0) { - version += length; - break; - } - } - -/* PR #18 */ -#ifdef _MSC_VER - sscanf_s(version, "%d.%d", &major, &minor); -#else - sscanf(version, "%d.%d", &major, &minor); -#endif - - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; - GLAD_GL_ES_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; - if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 0)) { - max_loaded_major = 3; - max_loaded_minor = 0; - } -} - -int gladLoadGLES2Loader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGLES2(); - load_GL_ES_VERSION_2_0(load); - load_GL_ES_VERSION_3_0(load); - - if (!find_extensionsGLES2()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; -} - -static void load_GL_VERSION_ES_CM_1_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_ES_CM_1_0) return; - glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); - glad_glClipPlanef = (PFNGLCLIPPLANEFPROC)load("glClipPlanef"); - glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); - glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); - glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); - glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); - glad_glFrustumf = (PFNGLFRUSTUMFPROC)load("glFrustumf"); - glad_glGetClipPlanef = (PFNGLGETCLIPPLANEFPROC)load("glGetClipPlanef"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); - glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); - glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); - glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); - glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); - glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); - glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); - glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); - glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); - glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); - glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); - glad_glOrthof = (PFNGLORTHOFPROC)load("glOrthof"); - glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); - glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); - glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); - glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); - glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); - glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glAlphaFuncx = (PFNGLALPHAFUNCXPROC)load("glAlphaFuncx"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColorx = (PFNGLCLEARCOLORXPROC)load("glClearColorx"); - glad_glClearDepthx = (PFNGLCLEARDEPTHXPROC)load("glClearDepthx"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); - glad_glClipPlanex = (PFNGLCLIPPLANEXPROC)load("glClipPlanex"); - glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); - glad_glColor4x = (PFNGLCOLOR4XPROC)load("glColor4x"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDepthRangex = (PFNGLDEPTHRANGEXPROC)load("glDepthRangex"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glFogx = (PFNGLFOGXPROC)load("glFogx"); - glad_glFogxv = (PFNGLFOGXVPROC)load("glFogxv"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glFrustumx = (PFNGLFRUSTUMXPROC)load("glFrustumx"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetClipPlanex = (PFNGLGETCLIPPLANEXPROC)load("glGetClipPlanex"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFixedv = (PFNGLGETFIXEDVPROC)load("glGetFixedv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetLightxv = (PFNGLGETLIGHTXVPROC)load("glGetLightxv"); - glad_glGetMaterialxv = (PFNGLGETMATERIALXVPROC)load("glGetMaterialxv"); - glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); - glad_glGetTexEnvxv = (PFNGLGETTEXENVXVPROC)load("glGetTexEnvxv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetTexParameterxv = (PFNGLGETTEXPARAMETERXVPROC)load("glGetTexParameterxv"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glLightModelx = (PFNGLLIGHTMODELXPROC)load("glLightModelx"); - glad_glLightModelxv = (PFNGLLIGHTMODELXVPROC)load("glLightModelxv"); - glad_glLightx = (PFNGLLIGHTXPROC)load("glLightx"); - glad_glLightxv = (PFNGLLIGHTXVPROC)load("glLightxv"); - glad_glLineWidthx = (PFNGLLINEWIDTHXPROC)load("glLineWidthx"); - glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); - glad_glLoadMatrixx = (PFNGLLOADMATRIXXPROC)load("glLoadMatrixx"); - glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); - glad_glMaterialx = (PFNGLMATERIALXPROC)load("glMaterialx"); - glad_glMaterialxv = (PFNGLMATERIALXVPROC)load("glMaterialxv"); - glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); - glad_glMultMatrixx = (PFNGLMULTMATRIXXPROC)load("glMultMatrixx"); - glad_glMultiTexCoord4x = (PFNGLMULTITEXCOORD4XPROC)load("glMultiTexCoord4x"); - glad_glNormal3x = (PFNGLNORMAL3XPROC)load("glNormal3x"); - glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); - glad_glOrthox = (PFNGLORTHOXPROC)load("glOrthox"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glPointParameterx = (PFNGLPOINTPARAMETERXPROC)load("glPointParameterx"); - glad_glPointParameterxv = (PFNGLPOINTPARAMETERXVPROC)load("glPointParameterxv"); - glad_glPointSizex = (PFNGLPOINTSIZEXPROC)load("glPointSizex"); - glad_glPolygonOffsetx = (PFNGLPOLYGONOFFSETXPROC)load("glPolygonOffsetx"); - glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); - glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glRotatex = (PFNGLROTATEXPROC)load("glRotatex"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glSampleCoveragex = (PFNGLSAMPLECOVERAGEXPROC)load("glSampleCoveragex"); - glad_glScalex = (PFNGLSCALEXPROC)load("glScalex"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); - glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); - glad_glTexEnvx = (PFNGLTEXENVXPROC)load("glTexEnvx"); - glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); - glad_glTexEnvxv = (PFNGLTEXENVXVPROC)load("glTexEnvxv"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameterx = (PFNGLTEXPARAMETERXPROC)load("glTexParameterx"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexParameterxv = (PFNGLTEXPARAMETERXVPROC)load("glTexParameterxv"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glTranslatex = (PFNGLTRANSLATEXPROC)load("glTranslatex"); - glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); -} -static int find_extensionsGLES1(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; -} - -static void find_coreGLES1(void) { - - /* Thank you @elmindreda - * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 - * https://github.com/glfw/glfw/blob/master/src/context.c#L36 - */ - int i, major, minor; - - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL - }; - - version = (const char*) glGetString(GL_VERSION); - if (!version) return; - - for (i = 0; prefixes[i]; i++) { - const size_t length = strlen(prefixes[i]); - if (strncmp(version, prefixes[i], length) == 0) { - version += length; - break; - } - } - -/* PR #18 */ -#ifdef _MSC_VER - sscanf_s(version, "%d.%d", &major, &minor); -#else - sscanf(version, "%d.%d", &major, &minor); -#endif - - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_VERSION_ES_CM_1_0 = (major == 1 && minor >= 0) || major > 1; - if (GLVersion.major > 1 || (GLVersion.major >= 1 && GLVersion.minor >= 0)) { - max_loaded_major = 1; - max_loaded_minor = 0; - } -} - -int gladLoadGLES1Loader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGLES1(); - load_GL_VERSION_ES_CM_1_0(load); - - if (!find_extensionsGLES1()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; -} - diff --git a/lib/openal-soft b/lib/openal-soft deleted file mode 160000 index d3875f33..00000000 --- a/lib/openal-soft +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d3875f333fb6abe2f39d82caca329414871ae53b diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0167be64..3e8e0523 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,23 +1,19 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Build Project -add_executable(${DAWN_TARGET_NAME}) - -# Add in base library -add_subdirectory(dawn) - -# Compile entry targets -if(DAWN_TARGET STREQUAL "linux-x64-glfw") - add_subdirectory(dawnlinux) - add_subdirectory(dawnglfw) - add_subdirectory(dawnopengl) - add_subdirectory(dawnrpg) -else() - message(FATAL_ERROR "You need to define an entry target") -endif() - -# Compress the game assets. -add_dependencies(${DAWN_TARGET_NAME} dawnassets) \ No newline at end of file +# Copyright (c) 2024 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Build Project +add_executable(${DAWN_TARGET_NAME}) + +# Add base +add_subdirectory(dawn) +add_subdirectory(dawnterm) + +# Compile entries +if(DAWN_TARGET STREQUAL "linux-x64-glfw") + add_subdirectory(dawnlinux) + add_subdirectory(dawntermlinux) +else() + message(FATAL_ERROR "Unknown target: ${DAWN_TARGET}") +endif() \ No newline at end of file diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt index c6ea8a5b..1d11ec2d 100644 --- a/src/dawn/CMakeLists.txt +++ b/src/dawn/CMakeLists.txt @@ -1,40 +1,27 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Libraries -target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC - glm::glm - archive_static - freetype - nlohmann_json::nlohmann_json -) - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -# Subdirs -add_subdirectory(assert) -add_subdirectory(asset) -add_subdirectory(audio) -add_subdirectory(component) -add_subdirectory(display) -add_subdirectory(environment) -add_subdirectory(game) -# add_subdirectory(games) -# add_subdirectory(input) -add_subdirectory(locale) -add_subdirectory(prefab) -# add_subdirectory(physics) -add_subdirectory(poker) -add_subdirectory(save) -add_subdirectory(scene) -# add_subdirectory(state) -add_subdirectory(time) -add_subdirectory(util) -add_subdirectory(ui) \ No newline at end of file +# Copyright (c) 2024 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Libraries +target_link_libraries(${DAWN_TARGET_NAME} + PUBLIC +) + +# Includes +target_include_directories(${DAWN_TARGET_NAME} + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + +# Subdirs +add_subdirectory(assert) +add_subdirectory(rpg) + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE + input.c + time.c + game.c +) \ No newline at end of file diff --git a/src/dawn/assert/CMakeLists.txt b/src/dawn/assert/CMakeLists.txt index a22374f6..91fa327f 100644 --- a/src/dawn/assert/CMakeLists.txt +++ b/src/dawn/assert/CMakeLists.txt @@ -1,9 +1,12 @@ -# Copyright (c) 2022 Dominic Masters +# Copyright (c) 2024 Dominic Masters # # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs + +# Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - assert.cpp + assert.c ) \ No newline at end of file diff --git a/src/dawn/assert/assert.cpp b/src/dawn/assert/assert.c similarity index 72% rename from src/dawn/assert/assert.cpp rename to src/dawn/assert/assert.c index 16799950..ed81bc67 100644 --- a/src/dawn/assert/assert.cpp +++ b/src/dawn/assert/assert.c @@ -5,7 +5,8 @@ * https://opensource.org/licenses/MIT */ -#include "assert.hpp" +#include "assert.h" +#include void assertTrueImplement( const char *file, @@ -26,10 +27,11 @@ void assertTrueImplement( func ); - va_list argptr; - va_start(argptr, message); - vfprintf(stderr, message, argptr); - va_end(argptr); + // Print message. + va_list args; + va_start(args, message); + vfprintf(stderr, message, args); + va_end(args); fprintf(stderr, "\n"); - throw std::runtime_error("Assert failed."); + abort(); } diff --git a/src/dawn/assert/assert.hpp b/src/dawn/assert/assert.h similarity index 78% rename from src/dawn/assert/assert.hpp rename to src/dawn/assert/assert.h index b33bf94c..80efdcda 100644 --- a/src/dawn/assert/assert.hpp +++ b/src/dawn/assert/assert.h @@ -6,7 +6,7 @@ */ #pragma once -#include "dawnlibs.hpp" +#include "dawn.h" /** * Asserts that a given statement must evaluate to true or the assertion fails @@ -63,7 +63,7 @@ void assertTrueImplement( * @param message Message (sprintf format) to send to the logger. * @param args Optional TParam args for the sprintf message to accept. */ -#define assertNotNull(x, ...) assertTrue(x != nullptr, __VA_ARGS__) +#define assertNotNull(x, ...) assertTrue(x != NULL, __VA_ARGS__) /** * Asserts that a given pointer is null. @@ -71,29 +71,7 @@ void assertTrueImplement( * @param message Message (sprintf format) to send to the logger. * @param args Optional TParam args for the sprintf message to accept. */ -#define assertNull(x, ...) assertTrue(x == nullptr, __VA_ARGS__) - -/** - * Asserts that a given map has a specific key. - * @param map Map to check. - * @param key Key to check for. - * @param message Message (sprintf format) to send to the logger. - * @param args Optional TParam args for the sprintf message to accept. - */ -#define assertMapHasKey(map, key, ...) assertTrue( \ - map.find(key) != map.end(), __VA_ARGS__ \ -) - -/** - * Asserts that a given map does not have a specific key. - * @param map Map to check. - * @param key Key to check for. - * @param message Message (sprintf format) to send to the logger. - * @param args Optional TParam args for the sprintf message to accept. - */ -#define assertMapNotHasKey(map, key, ...) assertTrue( \ - map.find(key) == map.end(), __VA_ARGS__ \ -) +#define assertNull(x, ...) assertTrue(x == NULL, __VA_ARGS__) /** * Asserts that a given value has a specific flag turned off. diff --git a/src/dawn/asset/AssetDataLoader.cpp b/src/dawn/asset/AssetDataLoader.cpp deleted file mode 100644 index 32609382..00000000 --- a/src/dawn/asset/AssetDataLoader.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "AssetDataLoader.hpp" -#include "util/Math.hpp" - -using namespace Dawn; - -ssize_t assetDataLoaderArchiveRead( - struct archive *archive, - void *d, - const void **buffer -) { - assertNotNull(archive, "Archive is NULL!"); - assertNotNull(d, "Data is NULL!"); - assertNotNull(buffer, "Buffer is NULL!"); - AssetDataLoader *loader = (AssetDataLoader*)d; - - *buffer = loader->buffer; - size_t read = fread( - loader->buffer, 1, ASSET_LOADER_BUFFER_SIZE, loader->assetArchiveFile - ); - if(ferror(loader->assetArchiveFile)) return ARCHIVE_FATAL; - return read; -} - -int64_t assetDataLoaderArchiveSeek( - struct archive *archive, - void *d, - int64_t offset, - int32_t whence -) { - assertNotNull(archive, "Archive is NULL!"); - assertNotNull(d, "Data is NULL!"); - assertTrue(offset > 0, "Offset must be greater than 0!"); - AssetDataLoader *loader = (AssetDataLoader*)d; - int32_t ret = fseek(loader->assetArchiveFile, offset, whence); - assertTrue(ret == 0, "Failed to seek!"); - return ftell(loader->assetArchiveFile); -} - -int32_t assetDataLoaderArchiveOpen(struct archive *a, void *d) { - assertNotNull(a, "Archive is NULL!"); - assertNotNull(d, "Data is NULL!"); - AssetDataLoader *loader = (AssetDataLoader*)d; - - int32_t ret = fseek(loader->assetArchiveFile, 0, SEEK_SET); - assertTrue(ret == 0, "Failed to seek to start of file!"); - return ARCHIVE_OK; -} - -int32_t assetDataLoaderArchiveClose(struct archive *a, void *d) { - assertNotNull(a, "Archive is NULL!"); - assertNotNull(d, "Data is NULL!"); - return assetDataLoaderArchiveOpen(a, d); -} - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - -AssetDataLoader::AssetDataLoader(std::string fileName) : fileName(fileName) { - assertTrue( - fileName.size() > 0, - "IAssetDataLoader::IAssetDataLoader: fileName must be greater than 0" - ); -} - -void AssetDataLoader::open() { - assertNull(this->assetArchiveFile, "AssetDataLoader::open: File is already open"); - assertNull(this->assetArchive, "AssetDataLoader::open: Archive is already open"); - assertNull(this->assetArchiveEntry, "AssetDataLoader::open: Entry is already open"); - - this->assetArchiveFile = this->openAssetArchiveFile(); - assertNotNull(this->assetArchiveFile, "AssetDataLoader::open: Failed to open archive file!"); - - // Open archive reader - assetArchive = archive_read_new(); - assertNotNull(assetArchive, "AssetDataLoader::open: Failed to create archive reader"); - - // Set up the reader - archive_read_support_format_tar(assetArchive); - - // Open reader - archive_read_set_open_callback(assetArchive, &assetDataLoaderArchiveOpen); - archive_read_set_read_callback(assetArchive, &assetDataLoaderArchiveRead); - archive_read_set_seek_callback(assetArchive, &assetDataLoaderArchiveSeek); - archive_read_set_close_callback(assetArchive, &assetDataLoaderArchiveClose); - archive_read_set_callback_data(assetArchive, this); - - int32_t ret = archive_read_open1(assetArchive); - assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to open archive!"); - position = 0; - - // Iterate over each file to find the one for this asset loader. - while(archive_read_next_header(assetArchive, &assetArchiveEntry) == ARCHIVE_OK) { - const char_t *headerFile = (char_t*)archive_entry_pathname(assetArchiveEntry); - if(std::string(headerFile) == this->fileName) return; - int32_t ret = archive_read_data_skip(assetArchive); - assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::open: Failed to skip data!"); - } - - assertUnreachable("AssetDataLoader::open: Failed to find file!"); -} - -int32_t AssetDataLoader::close() { - assertNotNull(this->assetArchiveFile, "AssetDataLoader::close: File is NULL"); - assertNotNull(this->assetArchive, "AssetDataLoader::close: Archive is NULL!"); - assertNotNull(this->assetArchiveEntry, "AssetDataLoader::close: Entry is NULL!"); - - // Close the archive - int32_t ret = archive_read_free(this->assetArchive); - assertTrue(ret == ARCHIVE_OK, "AssetDataLoader::close: Failed to close archive!"); - - this->assetArchive = nullptr; - this->assetArchiveEntry = nullptr; - - // Close the file - int32_t res = fclose(this->assetArchiveFile); - this->assetArchiveFile = nullptr; - return res; -} - -size_t AssetDataLoader::read(uint8_t *buffer, size_t size) { - assertNotNull(buffer, "Buffer is NULL!"); - assertTrue(size > 0, "Size must be greater than 0!"); - assertNotNull(this->assetArchive, "assetRead: Archive is NULL!"); - assertNotNull(this->assetArchiveEntry, "assetRead: Entry is NULL!"); - - ssize_t read = archive_read_data(this->assetArchive, buffer, size); - this->position += read; - - if(read == ARCHIVE_FATAL) { - assertUnreachable(archive_error_string(this->assetArchive)); - } - - assertTrue(read != ARCHIVE_RETRY, "assetRead: Failed to read data (RETRY)!"); - assertTrue(read != ARCHIVE_WARN, "assetRead: Failed to read data (WARN)!"); - - return read; -} - -size_t AssetDataLoader::readUntil( - uint8_t *buffer, - const size_t maxSize, - const char_t delimiter -) { - size_t totalRead = this->read(buffer, maxSize); - size_t i = 0; - while(i < totalRead) { - if(buffer[i] == delimiter) break; - i++; - } - buffer[i++] = '\0'; - return i; -} - -size_t AssetDataLoader::getSize() { - assertTrue(this->assetArchiveEntry != nullptr, "AssetDataLoader::getSize: Entry is NULL!"); - assertTrue(archive_entry_size_is_set(assetArchiveEntry), "assetGetSize: Entry size is not set!"); - return archive_entry_size(assetArchiveEntry); -} - -size_t AssetDataLoader::skip(size_t n) { - assertTrue(n >= 0, "AssetDataLoader::skip: Byte count must be greater than 0."); - - uint8_t dumpBuffer[ASSET_LOADER_BUFFER_SIZE]; - size_t skipped = 0; - size_t n2, n3; - while(n != 0) { - n2 = Math::min(n, ASSET_LOADER_BUFFER_SIZE); - n3 = this->read(dumpBuffer, n2); - assertTrue(n3 == n2, "AssetDataLoader::skip: Failed to skip bytes!"); - n -= n3; - } - - return skipped; -} - -size_t AssetDataLoader::setPosition(const size_t position) { - assertTrue(position >= 0, "Position must be greater than or equal to 0"); - this->rewind(); - return this->skip(position); -} - -void AssetDataLoader::rewind() { - // TODO: See if I can optimize this - this->close(); - this->open(); -} - -size_t AssetDataLoader::getPosition() { - assertNotNull(this->assetArchiveFile, "AssetDataLoader::getPosition: File is not open!"); - return this->position; -} - -AssetDataLoader::~AssetDataLoader() { - if(this->assetArchiveFile != nullptr) this->close(); -} \ No newline at end of file diff --git a/src/dawn/asset/AssetDataLoader.hpp b/src/dawn/asset/AssetDataLoader.hpp deleted file mode 100644 index 33394d2d..00000000 --- a/src/dawn/asset/AssetDataLoader.hpp +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -extern "C" { - #include - #include -} - -#define ASSET_LOADER_BUFFER_SIZE 32768 - -/** - * Method invoked by the libarchive internals to read bytes from the archive - * file pointer. - * - * @param archive Archive requesting the read. - * @param data Data pointer passed to the archive. - * @param buffer Pointer to where the buffer pointer should be stored. - * @return Count of bytes read. - */ -ssize_t assetDataLoaderArchiveRead( - struct archive *archive, - void *data, - const void **buffer -); - -/** - * Method invoked by the libarchive internals to seek the archive file pointer. - * - * @param archive Archive requesting the seek. - * @param data Data pointer passed to the archive. - * @param offset Offset to seek to. - * @param whence Whence to seek from. - * @return The new offset. - */ -int64_t assetDataLoaderArchiveSeek( - struct archive *archive, - void *data, - int64_t offset, - int32_t whence -); - -/** - * Method invoked by the libarchive internals to open the archive file pointer. - * - * @param archive Archive requesting the open. - * @param data Data pointer passed to the archive. - * @return 0 if success, otherwise for failure. - */ -int32_t assetDataLoaderArchiveOpen(struct archive *a, void *data); - -/** - * Method invoked by the libarchive internals to close the archive file pointer. - * - * @param archive Archive requesting the close. - * @param data Data pointer passed to the archive. - * @return 0 if success, otherwise for failure. - */ -int32_t assetDataLoaderArchiveClose(struct archive *a, void *data); - -namespace Dawn { - class AssetDataLoader { - protected: - struct archive *assetArchive = nullptr; - struct archive_entry *assetArchiveEntry = nullptr; - size_t position; - std::string fileName; - - public: - uint8_t buffer[ASSET_LOADER_BUFFER_SIZE]; - FILE *assetArchiveFile = nullptr; - - /** - * Unimplemented method intended to be implemented by the platform that - * will be used to request a File pointer to the asset. - * - * @return Pointer to the opened asset archive. - */ - FILE * openAssetArchiveFile(); - - /** - * Create a new asset loader. Asset Loaders can be used to load data from - * a file in a myriad of ways. - * - * @param fileName File name of the asset that is to be loaded. - */ - AssetDataLoader(std::string filename); - - /** - * Platform-centric method to open a file buffer to an asset. - */ - void open(); - - /** - * Closes the previously ppened asset. - * @return 0 if successful, otherwise false. - */ - int32_t close(); - - /** - * Read bytes from buffer. - * @param buffer Pointer to a ubyte array to buffer data into. - * @param size Length of the data buffer (How many bytes to read). - * @return The count of bytes read. - */ - size_t read(uint8_t *buffer, size_t size); - - /** - * Reads bytes from the buffer until a given delimiter is found. Returned - * position will be the index of the delimiter within the buffer. - * - * @param buffer Buffer to read into. - * @param maxSize Maximum size of the buffer. - * @param delimiter Delimiter to read until. - * @return The count of bytes read (including null terminator) - */ - size_t readUntil( - uint8_t *buffer, - const size_t maxSize, - const char_t delimiter - ); - - /** - * Get the size of the asset. - * @return The size of the asset in bytes. - */ - size_t getSize(); - - /** - * Skips the read head forward to a given position. - * - * @param n Count of bytes to progress the read head by. - * @return Count of bytes progressed. - */ - size_t skip(size_t n); - - /** - * Rewind the read head to the beginning of the file. - */ - void rewind(); - - /** - * Sets the absolute position of the read head within the buffer of the - * file. - * - * @param absolutePosition Absolute position to set the read head to. - */ - size_t setPosition(const size_t absolutePosition); - - /** - * Returns the current position of the read head. - * - * @return The current read head position. - */ - size_t getPosition(); - - /** - * Cleanup the asset loader. - */ - virtual ~AssetDataLoader(); - }; -} \ No newline at end of file diff --git a/src/dawn/asset/AssetLoader.cpp b/src/dawn/asset/AssetLoader.cpp deleted file mode 100644 index e2e3a3a6..00000000 --- a/src/dawn/asset/AssetLoader.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "AssetLoader.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -AssetLoader::AssetLoader(const std::string name) : name(name) { - assertTrue(name.size() > 0, "Asset::Asset: Name cannot be empty"); -} - -AssetLoader::~AssetLoader() { - this->loaded = false; -} \ No newline at end of file diff --git a/src/dawn/asset/AssetLoader.hpp b/src/dawn/asset/AssetLoader.hpp deleted file mode 100644 index 563904fa..00000000 --- a/src/dawn/asset/AssetLoader.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class AssetLoader { - public: - const std::string name; - bool_t loaded = false; - - /** - * Create an abstract Asset object. - * - * @param name Name of the asset. - */ - AssetLoader(const std::string name); - - /** - * Virtual function that will be called by the asset manager on a - * synchronous basis. This will only trigger if the blocks are false and - * the loaded is also false. - */ - virtual void updateSync() = 0; - - /** - * Virtual function called by the asset manager asynchronously every tick. - * This will only trigger if blocks are false and the loaded state is also - * false. - */ - virtual void updateAsync() = 0; - - /** - * Dispose the asset item. - */ - virtual ~AssetLoader(); - }; -} \ No newline at end of file diff --git a/src/dawn/asset/AssetManager.cpp b/src/dawn/asset/AssetManager.cpp deleted file mode 100644 index eca085b4..00000000 --- a/src/dawn/asset/AssetManager.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "AssetManager.hpp" -#include "loaders/TextureLoader.hpp" -#include "loaders/TrueTypeLoader.hpp" -#include "loaders/JSONLoader.hpp" - -using namespace Dawn; - -void AssetManager::init() { - -} - -void AssetManager::update() { - auto itPending = pendingAssetLoaders.begin(); - while(itPending != pendingAssetLoaders.end()) { - auto loader = *itPending; - loader->updateSync(); - loader->updateAsync(); - if(loader->loaded) { - finishedAssetLoaders.push_back(loader); - itPending = pendingAssetLoaders.erase(itPending); - } else { - itPending++; - } - } -} - -void AssetManager::removeExisting(const std::string filename) { - auto existing = std::find_if( - pendingAssetLoaders.begin(), pendingAssetLoaders.end(), - [&](auto &loader) { - return loader->name == filename; - } - ); - if(existing != pendingAssetLoaders.end()) { - pendingAssetLoaders.erase(existing); - } - - existing = std::find_if( - finishedAssetLoaders.begin(), finishedAssetLoaders.end(), - [&](auto &loader) { - return loader->name == filename; - } - ); - if(existing != finishedAssetLoaders.end()) { - finishedAssetLoaders.erase(existing); - } -} - -bool_t AssetManager::isEverythingLoaded() { - return pendingAssetLoaders.size() == 0; -} - -bool_t AssetManager::isLoaded(const std::string filename) { - auto existing = this->getExisting(filename); - if(existing) return existing->loaded; - return false; -} - -template<> -std::shared_ptr AssetManager::get( - const std::string filename, - const uint32_t fontSize -) { - auto existing = this->getExisting(filename); - if(existing) { - // Check pointer hasn't gone stale, if it has remove it and create new. - auto texture = existing->getTexture(fontSize); - if(texture) return texture; - this->removeExisting(filename); - } - - std::shared_ptr loader = std::make_shared( - filename - ); - pendingAssetLoaders.push_back(std::static_pointer_cast(loader)); - return loader->getTexture(fontSize); -} - -template<> -std::shared_ptr AssetManager::get( - const std::string filename -) { - auto existing = this->getExisting(filename); - if(existing) return existing->data; - - std::shared_ptr loader = std::make_shared( - filename - ); - pendingAssetLoaders.push_back(std::static_pointer_cast(loader)); - return loader->data; -} - - -AssetManager::~AssetManager() { - -} \ No newline at end of file diff --git a/src/dawn/asset/AssetManager.hpp b/src/dawn/asset/AssetManager.hpp deleted file mode 100644 index f4704e42..00000000 --- a/src/dawn/asset/AssetManager.hpp +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "asset/AssetLoader.hpp" - -namespace Dawn { - class AssetManager final { - private: - std::vector> pendingAssetLoaders; - std::vector> finishedAssetLoaders; - - /** - * Returns an existing asset loader if it exists. - * - * @param filename The filename of the asset to get. - * @return The asset loader if it exists, otherwise nullptr. - */ - template - std::shared_ptr getExisting(const std::string filename) { - auto existing = std::find_if( - pendingAssetLoaders.begin(), pendingAssetLoaders.end(), - [&](auto &loader) { - return loader->name == filename; - } - ); - - if(existing == pendingAssetLoaders.end()) { - existing = std::find_if( - finishedAssetLoaders.begin(), finishedAssetLoaders.end(), - [&](auto &loader) { - return loader->name == filename; - } - ); - - if(existing == finishedAssetLoaders.end()) return nullptr; - } - - return std::static_pointer_cast(*existing); - } - - /** - * Removes an existing asset loader if it exists. - * - * @param filename The filename of the asset to remove. - */ - void removeExisting(const std::string filename); - - public: - /** - * Initializes this asset manager so it can begin accepting assets. - */ - void init(); - - /** - * Updates the asset manager. - */ - void update(); - - /** - * Returns whether the asset manager has loaded all of the currently - * managed assets. - * - * @return True if all assets have been loaded. - */ - bool_t isEverythingLoaded(); - - /** - * Returns whether the asset manager has loaded the given asset. - * - * @param filename The filename of the asset to check. - * @return True if the asset has been loaded. - */ - bool_t isLoaded(const std::string filename); - - /** - * Returns the asset loader for the given asset. - * - * @param filename The filename of the asset to get. - * @param fontSize The font size to get the truetype asset of. - * @return The asset loader for the given asset. - */ - template - std::shared_ptr get(const std::string filename); - - /** - * Returns the asset loader for the given asset. - * - * @param filename The filename of the asset to get. - * @param fontSize The font size to get the truetype asset of. - * @return The asset loader for the given asset. - */ - template - std::shared_ptr get( - const std::string filename, - const uint32_t fontSize - ); - - /** - * Dispose the asset manager, and all attached assets. - */ - ~AssetManager(); - }; -} \ No newline at end of file diff --git a/src/dawn/asset/CMakeLists.txt b/src/dawn/asset/CMakeLists.txt deleted file mode 100644 index bc04aeec..00000000 --- a/src/dawn/asset/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2022 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - AssetLoader.cpp - AssetDataLoader.cpp - AssetManager.cpp -) - -# Subdirs -add_subdirectory(loaders) \ No newline at end of file diff --git a/src/dawn/asset/loaders/CMakeLists.txt b/src/dawn/asset/loaders/CMakeLists.txt deleted file mode 100644 index 1f2bcac1..00000000 --- a/src/dawn/asset/loaders/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2022 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - TextureLoader.cpp - TrueTypeLoader.cpp - JSONLoader.cpp -) \ No newline at end of file diff --git a/src/dawn/asset/loaders/JSONLoader.cpp b/src/dawn/asset/loaders/JSONLoader.cpp deleted file mode 100644 index 350ea52b..00000000 --- a/src/dawn/asset/loaders/JSONLoader.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "JSONLoader.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -JSONLoader::JSONLoader(const std::string name) : - AssetLoader(name), - loader(name + ".json"), - state(JSONLoaderLoadState::INITIAL) -{ - data = std::make_shared(); -} - -void JSONLoader::updateAsync() { - if(this->state != JSONLoaderLoadState::INITIAL) return; - this->state = JSONLoaderLoadState::LOADING_FILE; - - this->loader.open(); - auto size = this->loader.getSize(); - - auto buffer = new uint8_t[size + 1]; - assertNotNull(buffer, "Failed to allocate buffer!"); - - this->state = JSONLoaderLoadState::PARSING_DATA; - auto read = this->loader.read(buffer, size); - assertTrue(read == size, "Failed to read entire file!"); - buffer[size] = '\0'; - - *data = json::parse(buffer); - delete[] buffer; - - this->state = JSONLoaderLoadState::DONE; - this->loaded = true; -} - -void JSONLoader::updateSync() { -} - -JSONLoader::~JSONLoader() { - this->data = nullptr; -} \ No newline at end of file diff --git a/src/dawn/asset/loaders/JSONLoader.hpp b/src/dawn/asset/loaders/JSONLoader.hpp deleted file mode 100644 index 3eb412c9..00000000 --- a/src/dawn/asset/loaders/JSONLoader.hpp +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "asset/AssetLoader.hpp" -#include "asset/AssetDataLoader.hpp" - -namespace Dawn { - enum class JSONLoaderLoadState { - INITIAL, - LOADING_FILE, - PARSING_DATA, - DONE - }; - - class JSONLoader : public AssetLoader { - protected: - AssetDataLoader loader; - enum JSONLoaderLoadState state; - - public: - std::shared_ptr data; - - /** - * Constructs a JSON asset loader. You should instead use the parent - * asset managers' abstracted load method - * - * @param name File name asset to load, omitting the extension. - */ - JSONLoader(const std::string name); - - void updateSync() override; - void updateAsync() override; - - /** - * Dispose / Cleanup the JSON asset. - */ - ~JSONLoader(); - }; -} \ No newline at end of file diff --git a/src/dawn/asset/loaders/TextureLoader.cpp b/src/dawn/asset/loaders/TextureLoader.cpp deleted file mode 100644 index 14f2cbc8..00000000 --- a/src/dawn/asset/loaders/TextureLoader.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TextureLoader.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -TextureLoader::TextureLoader(const std::string name) : - AssetLoader(name), - loader(name + ".texture"), - state(TextureLoaderLoadState::INITIAL) -{ - sharedTexture = std::make_shared(); - weakTexture = sharedTexture; -} - -void TextureLoader::updateAsync() { - if(this->state != TextureLoaderLoadState::INITIAL) return; - this->state = TextureLoaderLoadState::ASYNC_LOADING; - this->loader.open(); - - // Read in the header. - uint8_t buffer[TEXTURE_LOADER_HEADER_SIZE]; - size_t pos = 0; - - // Read Version - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - std::string version = std::string((char*)buffer); - assertTrue(version == "DT_2.00", "Invalid Texture Version!"); - - // Read Texture Width - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - width = std::stoi(std::string((char*)buffer)); - assertTrue(width > 0, "Invalid Texture Width!"); - - // Read Texture Height - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - height = std::stoi(std::string((char*)buffer)); - assertTrue(height > 0, "Invalid Texture Height!"); - - // Texture Format (RGBA, RGB, etc) - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - int32_t iFormat = std::stoi(std::string((char*)buffer)); - switch(iFormat) { - case 1: format = TextureFormat::R; break; - case 2: format = TextureFormat::RG; break; - case 3: format = TextureFormat::RGB; break; - case 4: format = TextureFormat::RGBA; break; - default: assertUnreachable("Invalid Texture Format %i!", iFormat); - } - - // Wrap X - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - int32_t iWrapX = std::stoi(std::string((char*)buffer)); - switch(iWrapX) { - case 0: wrapX = TextureWrapMode::REPEAT; break; - case 1: wrapX = TextureWrapMode::MIRRORED_REPEAT; break; - case 2: wrapX = TextureWrapMode::CLAMP_TO_EDGE; break; - case 3: wrapX = TextureWrapMode::CLAMP_TO_BORDER; break; - default: assertUnreachable("Invalid Texture Wrap X %i!", iWrapX); - } - - // Wrap Y - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - int32_t iWrapY = std::stoi(std::string((char*)buffer)); - switch(iWrapY) { - case 0: wrapY = TextureWrapMode::REPEAT; break; - case 1: wrapY = TextureWrapMode::MIRRORED_REPEAT; break; - case 2: wrapY = TextureWrapMode::CLAMP_TO_EDGE; break; - case 3: wrapY = TextureWrapMode::CLAMP_TO_BORDER; break; - default: assertUnreachable("Invalid Texture Wrap Y %i!", iWrapY); - } - - // Filter Min - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - int32_t iFilterMin = std::stoi(std::string((char*)buffer)); - switch(iFilterMin) { - case 0: filterMin = TextureFilterMode::NEAREST; break; - case 1: filterMin = TextureFilterMode::LINEAR; break; - default: assertUnreachable("Invalid Texture Filter Min %i!", iFilterMin); - } - - // Filter Mag - this->loader.setPosition(pos); - pos += this->loader.readUntil(buffer, TEXTURE_LOADER_HEADER_SIZE, '|'); - int32_t iFilterMag = std::stoi(std::string((char*)buffer)); - switch(iFilterMag) { - case 0: filterMag = TextureFilterMode::NEAREST; break; - case 1: filterMag = TextureFilterMode::LINEAR; break; - default: assertUnreachable("Invalid Texture Filter Mag %i!", iFilterMag); - } - - // Data begins here. This part is done synchronously directly to the GPU. - this->loader.setPosition(pos); - size_t bufferSize = width * height * iFormat; - data = new uint8_t[bufferSize]; - assertNotNull(data, "Failed to allocate texture data!"); - this->loader.read(data, bufferSize); - - // Handoff to sync to buffer to GPU. - this->state = TextureLoaderLoadState::ASYNC_DONE; -} - -void TextureLoader::updateSync() { - if(this->state != TextureLoaderLoadState::ASYNC_DONE) return; - this->state = TextureLoaderLoadState::SYNC_LOADING; - - assertNotNull(this->sharedTexture, "Texture is null!"); - assertNotNull(this->data, "Texture data is null!"); - - // Setup Texture - this->sharedTexture->setSize( - this->width, - this->height, - this->format, - TextureDataFormat::UNSIGNED_BYTE - ); - this->sharedTexture->buffer(this->data); - - // Free data buffer - delete[] this->data; - this->data = nullptr; - - // Leat go of the held pointer - this->sharedTexture = nullptr; - - // Hand off and call done - this->state = TextureLoaderLoadState::SYNC_DONE; - this->loaded = true; -} - -TextureLoader::~TextureLoader() { - if(this->data != nullptr) { - delete[] this->data; - this->data = nullptr; - } - this->sharedTexture = nullptr; -} \ No newline at end of file diff --git a/src/dawn/asset/loaders/TextureLoader.hpp b/src/dawn/asset/loaders/TextureLoader.hpp deleted file mode 100644 index d5b19ddf..00000000 --- a/src/dawn/asset/loaders/TextureLoader.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "asset/AssetLoader.hpp" -#include "asset/AssetDataLoader.hpp" -#include "display/Texture.hpp" - -#define TEXTURE_LOADER_HEADER_SIZE 256 - -namespace Dawn { - enum class TextureLoaderLoadState { - INITIAL, - ASYNC_LOADING, - ASYNC_DONE, - SYNC_LOADING, - SYNC_DONE - }; - - class TextureLoader : public AssetLoader { - protected: - AssetDataLoader loader; - enum TextureLoaderLoadState state; - uint8_t *data = nullptr; - int32_t width = -1, height = -1; - enum TextureFormat format; - enum TextureWrapMode wrapX; - enum TextureWrapMode wrapY; - enum TextureFilterMode filterMin; - enum TextureFilterMode filterMag; - - public: - std::shared_ptr sharedTexture; - std::weak_ptr weakTexture; - - /** - * Constructs a texture asset loader. You should instead use the parent - * asset managers' abstracted load method - * - * @param name File name asset to load, omitting the extension. - */ - TextureLoader(const std::string name); - - void updateSync() override; - void updateAsync() override; - - /** - * Dispose / Cleanup the texture asset. Will also dispose the underlying - * texture itself. - */ - ~TextureLoader(); - }; -} diff --git a/src/dawn/asset/loaders/TrueTypeLoader.cpp b/src/dawn/asset/loaders/TrueTypeLoader.cpp deleted file mode 100644 index d1138efa..00000000 --- a/src/dawn/asset/loaders/TrueTypeLoader.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TrueTypeLoader.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -TrueTypeLoader::TrueTypeLoader(const std::string name) : - AssetLoader(name), - loader(name + ".ttf") -{ - // Init the font. - auto ret = FT_Init_FreeType(&fontLibrary); - assertTrue(ret == 0, "Failed to initialize FreeType library."); -} - -void TrueTypeLoader::updateSync() { - if(state != TrueTypeLoaderState::ASYNC_DONE) return; - state = TrueTypeLoaderState::SYNC_LOADING; - - // Init all the textures. - auto it = textures.begin(); - while(it != textures.end()) { - auto texture = it->second.lock(); - - if(texture) { - texture->setFace(face); - it++; - continue; - } - - it = textures.erase(it); - } - - // Done - state = TrueTypeLoaderState::SYNC_DONE; - this->loaded = true; -} - -void TrueTypeLoader::updateAsync() { - if(state != TrueTypeLoaderState::INITIAL) return; - state = TrueTypeLoaderState::ASYNC_LOADING; - - // Load the data. - this->loader.open(); - size_t size = loader.getSize(); - buffer = new uint8_t[size]; - - // Read the data. - size_t readSize = loader.read(buffer, size); - assertTrue(readSize == size, "Failed to read all data from TrueTypeLoader."); - - // Init the font. - auto ret = FT_New_Memory_Face(fontLibrary, buffer, size, 0, &face); - assertTrue(ret == 0, "Failed to load font face."); - - // Now close the asset loader - loader.close(); - state = TrueTypeLoaderState::ASYNC_DONE; -} - -std::shared_ptr TrueTypeLoader::getTexture( - const uint32_t fontSize -) { - // Check if we have the texture already and it hasn't gone stale. - auto it = textures.find(fontSize); - if(it != textures.end()) { - if(!it->second.expired()) return it->second.lock(); - textures.erase(it); - } - - // Create the texture. - auto texture = std::make_shared(fontSize); - textures[fontSize] = texture; - if(this->loaded) texture->setFace(face); - return texture; -} - -TrueTypeLoader::~TrueTypeLoader() { - if( - this->state == TrueTypeLoaderState::SYNC_DONE || - this->state == TrueTypeLoaderState::SYNC_LOADING || - this->state == TrueTypeLoaderState::ASYNC_DONE - ) { - FT_Done_Face(face); - } - - FT_Done_FreeType(fontLibrary); - - if(buffer != nullptr) { - delete[] buffer; - buffer = nullptr; - } -} diff --git a/src/dawn/asset/loaders/TrueTypeLoader.hpp b/src/dawn/asset/loaders/TrueTypeLoader.hpp deleted file mode 100644 index 18e08977..00000000 --- a/src/dawn/asset/loaders/TrueTypeLoader.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "asset/AssetLoader.hpp" -#include "asset/AssetDataLoader.hpp" -#include "display/font/TrueTypeTexture.hpp" - -namespace Dawn { - enum class TrueTypeLoaderState { - INITIAL, - ASYNC_LOADING, - ASYNC_DONE, - SYNC_LOADING, - SYNC_DONE - }; - - class TrueTypeLoader : public AssetLoader { - protected: - FT_Library fontLibrary; - FT_Face face; - AssetDataLoader loader; - std::unordered_map> textures; - enum TrueTypeLoaderState state = TrueTypeLoaderState::INITIAL; - uint8_t *buffer = nullptr; - - public: - /** - * Constructs a TrueTypeLoader. You should instead use the parent - * asset managers' abstracted load method - * - * @param name File name asset to load, omitting the extension. - */ - TrueTypeLoader(const std::string name); - - void updateSync() override; - void updateAsync() override; - - /** - * Returns the texture for the given font size. - * - * @param fontSize Font size to get the texture for. - * @return Texture for the given character. - */ - std::shared_ptr getTexture( - const uint32_t fontSize - ); - - /** - * Dispose / Cleanup the truetype asset. Will also dispose the underlying - * truetype itself. - */ - ~TrueTypeLoader(); - }; -} diff --git a/src/dawn/audio/CMakeLists.txt b/src/dawn/audio/CMakeLists.txt deleted file mode 100644 index c594ce51..00000000 --- a/src/dawn/audio/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - IAudioManager.cpp -) \ No newline at end of file diff --git a/src/dawn/audio/IAudioManager.cpp b/src/dawn/audio/IAudioManager.cpp deleted file mode 100644 index def7b969..00000000 --- a/src/dawn/audio/IAudioManager.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "IAudioManager.hpp" - -using namespace Dawn; - -IAudioManager::IAudioManager() { -} - -IAudioManager::~IAudioManager() { -} \ No newline at end of file diff --git a/src/dawn/audio/IAudioManager.hpp b/src/dawn/audio/IAudioManager.hpp deleted file mode 100644 index 97327515..00000000 --- a/src/dawn/audio/IAudioManager.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class IAudioManager { - public: - /** - * Construct a new IAudioManager. - */ - IAudioManager(); - - /** - * Initializes the audio manager system. - */ - virtual void init() = 0; - - /** - * Ticks/Update the audio manager system. - */ - virtual void update() = 0; - - /** - * Deinitializes the audio manager system. - */ - virtual ~IAudioManager(); - }; -} \ No newline at end of file diff --git a/src/dawn/component/CMakeLists.txt b/src/dawn/component/CMakeLists.txt deleted file mode 100644 index 24bc74cc..00000000 --- a/src/dawn/component/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - SimpleComponent.cpp -) - -# Subdirs -add_subdirectory(display) -add_subdirectory(ui) -add_subdirectory(vn) \ No newline at end of file diff --git a/src/dawn/component/SimpleComponent.cpp b/src/dawn/component/SimpleComponent.cpp deleted file mode 100644 index 5ce8f0ab..00000000 --- a/src/dawn/component/SimpleComponent.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SimpleComponent.hpp" - -using namespace Dawn; - -void SimpleComponent::onInit() { - this->initMethod(*this, events); -} - -void SimpleComponent::onDispose() { - for(auto &event : events) { - event(); - } -} - -std::shared_ptr Dawn::addSimpleComponent( - std::shared_ptr item, - std::function>&)> init -) { - auto cmp = item->addComponent(); - cmp->initMethod = init; - return cmp; -} \ No newline at end of file diff --git a/src/dawn/component/SimpleComponent.hpp b/src/dawn/component/SimpleComponent.hpp deleted file mode 100644 index 9f51812c..00000000 --- a/src/dawn/component/SimpleComponent.hpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/Scene.hpp" - -namespace Dawn { - class SimpleComponent final : public SceneComponent { - private: - std::vector> events; - - public: - std::function>& - )> initMethod; - - void onInit() override; - void onDispose() override; - }; - - std::shared_ptr addSimpleComponent( - std::shared_ptr item, - std::function>& - )> init - ); -} \ No newline at end of file diff --git a/src/dawn/component/display/CMakeLists.txt b/src/dawn/component/display/CMakeLists.txt deleted file mode 100644 index 3afde340..00000000 --- a/src/dawn/component/display/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Camera.cpp - MeshRenderer.cpp -) - -# Subdirs -add_subdirectory(material) \ No newline at end of file diff --git a/src/dawn/component/display/Camera.cpp b/src/dawn/component/display/Camera.cpp deleted file mode 100644 index 49a370c3..00000000 --- a/src/dawn/component/display/Camera.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "Camera.hpp" -#include "game/Game.hpp" - -using namespace Dawn; - -void Camera::onInit() { - this->onResizeListener = this->getRenderTarget()->onResize.listen([&]( - float_t width, float_t height - ) { - this->onResize.emit(this->getRenderTarget(), width, height); - }); -} - -void Camera::onDispose() { - renderTarget = nullptr; -} - -std::shared_ptr Camera::getRenderTarget() { - if(this->renderTarget) return this->renderTarget; - return getGame()->renderHost.getBackBufferRenderTarget(); -} - -glm::mat4 Camera::getProjection() { - switch(this->type) { - case CameraType::ORTHOGONAL: - return glm::ortho( - (float_t)this->orthoLeft, - (float_t)this->orthoRight, - (float_t)this->orthoBottom, - (float_t)this->orthoTop, - (float_t)this->clipNear, - (float_t)this->clipFar - ); - - case CameraType::PERSPECTIVE: - return glm::perspective( - (float_t)this->fov, - this->getAspect(), - (float_t)this->clipNear, - (float_t)this->clipFar - ); - } - - assertUnreachable("Invalid Camera Type!"); - return glm::mat4(1.0f); -} - -float_t Camera::getAspect() { - auto rt = this->getRenderTarget(); - return rt->getWidth() / rt->getHeight(); -} - -void Camera::setRenderTarget(std::shared_ptr renderTarget) { - onResizeListener(); - this->renderTarget = renderTarget; - this->onResizeListener = this->getRenderTarget()->onResize.listen([&]( - float_t width, float_t height - ) { - this->onResize.emit(this->getRenderTarget(), width, height); - }); -} \ No newline at end of file diff --git a/src/dawn/component/display/Camera.hpp b/src/dawn/component/display/Camera.hpp deleted file mode 100644 index f6103955..00000000 --- a/src/dawn/component/display/Camera.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItem.hpp" -#include "display/RenderTarget.hpp" - -namespace Dawn { - enum CameraType { - PERSPECTIVE, - ORTHOGONAL - }; - - class Camera final : public SceneComponent { - private: - std::shared_ptr renderTarget; - std::function onResizeListener; - - public: - Event, float_t, float_t> onResize; - float_t clipNear = 0.01f; - float_t clipFar = 1000.0f; - enum CameraType type = CameraType::PERSPECTIVE; - - float_t fov = 0.785398f; - - float_t orthoLeft = -1.0f; - float_t orthoRight = 1.0f; - float_t orthoBottom = -1.0f; - float_t orthoTop = 1.0f; - - void onInit() override; - void onDispose() override; - - /** - * Returns the aspect ratio that the camera is using. In future I may - * allow you to specify a custom ratio for stylistic reasons but for now I - * just take the ratio of the specific frame buffer. - * - * @return The aspect ratio as a ratio of w/h. - */ - float_t getAspect(); - - /** - * Returns the render target for this camera. - * - * @return Render target. - */ - std::shared_ptr getRenderTarget(); - - /** - * Returns the projection matrix for this camera. - * - * @return Projection matrix. - */ - glm::mat4 getProjection(); - - /** - * Sets the render target for this camera. - * - * @param renderTarget The render target to set. - */ - void setRenderTarget(std::shared_ptr renderTarget); - }; -} \ No newline at end of file diff --git a/src/dawn/component/display/IRenderableComponent.hpp b/src/dawn/component/display/IRenderableComponent.hpp deleted file mode 100644 index 1bf77f5a..00000000 --- a/src/dawn/component/display/IRenderableComponent.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/pass/RenderPass.hpp" -#include "display/pass/RenderPassContext.hpp" -#include "display/mesh/Mesh.hpp" - -namespace Dawn { - class IRenderableComponent { - public: - /** - * Retreive the list of render passes for this component. - * - * @param ctx Context for the render pass. - * @return List of render passes. - */ - virtual std::vector> getPasses( - struct RenderPassContext &ctx - ) = 0; - }; - - /** - * Short-hand function to create a render pass. - * - * @tparam S Shader type. - * @tparam D Shader's data type - * @param self Instance of the IRenderableComponent that is creating the pass. - * @param data Data to use for the render pass. - * @return Created render pass. - */ - template - std::shared_ptr createRenderPass( - SceneComponent &self, - const D data, - const std::unordered_map< - shadertexturebinding_t, std::shared_ptr - > textures = {}, - const std::shared_ptr mesh = nullptr, - const enum MeshDrawMode drawMode = MeshDrawMode::TRIANGLES, - int32_t indiceStart = 0, - int32_t indiceCount = -1 - ) { - return std::make_shared>( - self, - data, - textures, - mesh, - drawMode, - indiceStart, - indiceCount - ); - } -} \ No newline at end of file diff --git a/src/dawn/component/display/MeshRenderer.cpp b/src/dawn/component/display/MeshRenderer.cpp deleted file mode 100644 index a109e806..00000000 --- a/src/dawn/component/display/MeshRenderer.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "MeshRenderer.hpp" - -using namespace Dawn; - -void MeshRenderer::onInit() { - -} - -void MeshRenderer::onDispose() { - mesh = nullptr; -} \ No newline at end of file diff --git a/src/dawn/component/display/MeshRenderer.hpp b/src/dawn/component/display/MeshRenderer.hpp deleted file mode 100644 index edc6eb3a..00000000 --- a/src/dawn/component/display/MeshRenderer.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/mesh/Mesh.hpp" -#include "scene/SceneItem.hpp" - -namespace Dawn { - class MeshRenderer final : public SceneComponent { - public: - std::shared_ptr mesh; - - void onInit() override; - void onDispose() override; - }; -} \ No newline at end of file diff --git a/src/dawn/component/display/material/CMakeLists.txt b/src/dawn/component/display/material/CMakeLists.txt deleted file mode 100644 index b7f6c71d..00000000 --- a/src/dawn/component/display/material/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Material.cpp - SimpleTexturedMaterial.cpp -) \ No newline at end of file diff --git a/src/dawn/component/display/material/Material.cpp b/src/dawn/component/display/material/Material.cpp deleted file mode 100644 index 59bbf643..00000000 --- a/src/dawn/component/display/material/Material.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Material.hpp" - -using namespace Dawn; - -void Material::onInit() { - -} - -void Material::onDispose() { - -} \ No newline at end of file diff --git a/src/dawn/component/display/material/Material.hpp b/src/dawn/component/display/material/Material.hpp deleted file mode 100644 index 76b2e466..00000000 --- a/src/dawn/component/display/material/Material.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneComponent.hpp" -#include "component/display/IRenderableComponent.hpp" - -namespace Dawn { - class Material : - public SceneComponent, - public IRenderableComponent - { - protected: - - public: - void onInit() override; - void onDispose() override; - }; -} \ No newline at end of file diff --git a/src/dawn/component/display/material/SimpleTexturedMaterial.cpp b/src/dawn/component/display/material/SimpleTexturedMaterial.cpp deleted file mode 100644 index 00fd64af..00000000 --- a/src/dawn/component/display/material/SimpleTexturedMaterial.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SimpleTexturedMaterial.hpp" - -using namespace Dawn; - -struct Color SimpleTexturedMaterial::getColor() { - return this->data.color; -} - -std::shared_ptr SimpleTexturedMaterial::getTexture() { - return this->texture; -} - -void SimpleTexturedMaterial::setTexture(std::shared_ptr texture) { - this->texture = texture; -} - -void SimpleTexturedMaterial::setColor(const struct Color color) { - this->data.color = color; -} - -std::vector> SimpleTexturedMaterial::getPasses( - struct RenderPassContext &ctx -) { - this->data.model = this->getItem()->getWorldTransform(); - this->data.projection = ctx.camera->getProjection(); - this->data.view = ctx.camera->getItem()->getWorldTransform(); - auto textures = std::unordered_map< - shadertexturebinding_t, std::shared_ptr - >(); - - if(this->texture) { - this->data.hasTexture = true; - this->data.texture = 0; - textures[this->data.texture] = this->texture; - } else { - this->data.hasTexture = false; - } - - return { - createRenderPass( - *this, - data, - textures - ) - }; -} diff --git a/src/dawn/component/display/material/SimpleTexturedMaterial.hpp b/src/dawn/component/display/material/SimpleTexturedMaterial.hpp deleted file mode 100644 index dc91d179..00000000 --- a/src/dawn/component/display/material/SimpleTexturedMaterial.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "component/display/material/Material.hpp" -#include "display/shader/SimpleTexturedShader.hpp" -#include "display/Texture.hpp" - -namespace Dawn { - class SimpleTexturedMaterial : public Material { - private: - struct SimpleTexturedShaderData data; - std::shared_ptr texture; - - public: - /** - * Returns the color of this material. - */ - struct Color getColor(); - - /** - * Returns the texture of this material. - * - * @return The texture of this material. - */ - std::shared_ptr getTexture(); - - /** - * Sets the texture of this material. - * - * @param texture The texture to set. - */ - void setTexture(std::shared_ptr texture); - - /** - * Sets the color of this material. - * - * @param color The color to set. - */ - void setColor(const struct Color color); - - std::vector> getPasses( - struct RenderPassContext &ctx - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/component/ui/CMakeLists.txt b/src/dawn/component/ui/CMakeLists.txt deleted file mode 100644 index 6cadd54f..00000000 --- a/src/dawn/component/ui/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - UICanvas.cpp -) \ No newline at end of file diff --git a/src/dawn/component/ui/UICanvas.cpp b/src/dawn/component/ui/UICanvas.cpp deleted file mode 100644 index 6316e598..00000000 --- a/src/dawn/component/ui/UICanvas.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UICanvas.hpp" -#include "display/pass/RenderPass.hpp" -#include "display/mesh/QuadMesh.hpp" -#include "ui/UIElement.hpp" - -using namespace Dawn; - -void UICanvas::onInit() { - mesh = std::make_shared(); - mesh->createBuffers( - QUAD_VERTICE_COUNT * UI_SHADER_QUAD_COUNT, - QUAD_INDICE_COUNT * UI_SHADER_QUAD_COUNT - ); - - for(int32_t i = 0; i < UI_SHADER_QUAD_COUNT; i++) { - QuadMesh::bufferWithIndex( - mesh, - glm::vec4(0, 0, 1, 1), - glm::vec4(0, 0, 1, 1), - i * QUAD_VERTICE_COUNT, - i * QUAD_INDICE_COUNT, - i * QUAD_VERTICE_COUNT - ); - } -} - -void UICanvas::onDispose() { - mesh = nullptr; -} - -std::vector> UICanvas::getPasses( -struct RenderPassContext &ctx -) { - if(this->elements.empty()) return {}; - - glm::mat4 projection; - glm::mat4 view; - - // Setup the projection and views - data.projection = glm::ortho( - 0.0f, ctx.renderTarget->getWidth(), - ctx.renderTarget->getHeight(), 0.0f, - 0.0f, 1.0f - ); - data.view = glm::mat4(1.0f); - data.model = glm::mat4(1.0f); - - // Reset the passes - this->passes.clear(); - this->textureBindings.clear(); - this->textures.clear(); - quadCount = 0; - nextBinding = 0; - - // Alignment root - const glm::vec2 rootPosition = { 0, 0 }; - const glm::vec2 rootSize = { - ctx.renderTarget->getWidth(), - ctx.renderTarget->getHeight() - }; - const float_t rootScale = 1.0f; - - // Get the quads for each component - auto itComponents = elements.begin(); - auto self = std::ref(*this); - while(itComponents != elements.end()) { - auto component = *itComponents; - component->updateAlignment(rootPosition, rootSize, rootScale); - component->getQuads(self); - ++itComponents; - } - - // Flush the remaining quads - flushPass(); - return passes; -} - -void UICanvas::addQuad( - const glm::vec4 quad, - const glm::vec4 uvs, - const struct Color color, - const enum UIShaderQuadStyle style, - const std::shared_ptr text -) { - glm::vec4 styleData; - styleData[0] = (float_t)style; - - if(text == nullptr) { - styleData[1] = -1; - } else { - shadertexturebinding_t texture; - auto bindingIt = textureBindings.find(text); - if(bindingIt == textureBindings.end()) { - if(nextBinding >= UI_SHADER_TEXTURE_COUNT) { - flushPass(); - } - textureBindings[text] = nextBinding; - textures[nextBinding] = text; - data.textures[nextBinding] = nextBinding; - texture = nextBinding++; - } else { - texture = bindingIt->second; - } - styleData[1] = (float_t)texture; - } - - data.quads[quadCount] = { - quad, - uvs, - color, - styleData - }; - quadCount++; - if(quadCount == UI_SHADER_QUAD_COUNT) flushPass(); -} - -void UICanvas::flushPass() { - if(quadCount == 0) return; - - auto pass = createRenderPass( - std::ref(*this), - data, - textures, - mesh, - MeshDrawMode::TRIANGLES, - 0, - quadCount * QUAD_INDICE_COUNT - ); - passes.push_back(pass); - - quadCount = 0; - nextBinding = 0; - textures.clear(); - textureBindings.clear(); -} - -void UICanvas::addElement(std::shared_ptr element) { - elements.push_back(element); -} - -void UICanvas::removeElement(std::shared_ptr element) { - auto it = std::find(elements.begin(), elements.end(), element); - if(it != elements.end()) elements.erase(it); -} \ No newline at end of file diff --git a/src/dawn/component/ui/UICanvas.hpp b/src/dawn/component/ui/UICanvas.hpp deleted file mode 100644 index cd1dcbc5..00000000 --- a/src/dawn/component/ui/UICanvas.hpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItem.hpp" -#include "component/display/IRenderableComponent.hpp" -#include "display/shader/UIShader.hpp" - -namespace Dawn { - class UIElement; - - class UICanvas : - public SceneComponent, - public IRenderableComponent - { - private: - std::shared_ptr mesh; - UIShaderData data; - std::vector> elements; - - size_t quadCount = 0; - shadertexturebinding_t nextBinding = 0; - std::unordered_map< - shadertexturebinding_t, std::shared_ptr - > textures; - std::map< - std::shared_ptr, shadertexturebinding_t - > textureBindings; - - std::vector> passes; - - protected: - virtual void onInit() override; - virtual void onDispose() override; - - /** - * Flushes all pending quads to the render pass. This doesn't actually - * render anything, it just flushes the data buffer to a new pass. - */ - void flushPass(); - - public: - std::vector> getPasses( - struct RenderPassContext &ctx - ) override; - - /** - * Adds a quad to the canvas and performs a flush if necessary. - * - * @param quad The quad to add. - * @param uvs The UVs to use for the quad. - * @param color The color to use for the quad. - * @param style Style that the quad should be rendered in. - * @param texture The texture to use for the quad, can be null. - */ - void addQuad( - const glm::vec4 quad, - const glm::vec4 uvs, - const struct Color color, - const enum UIShaderQuadStyle style, - const std::shared_ptr texture = nullptr - ); - - /** - * Adds a component to the canvas. - * - * @param component The component to add. - */ - void addElement(std::shared_ptr component); - - /** - * Removes a component from the canvas. - * - * @param component The component to remove. - */ - void removeElement(std::shared_ptr component); - }; -} \ No newline at end of file diff --git a/src/dawn/component/vn/CMakeLists.txt b/src/dawn/component/vn/CMakeLists.txt deleted file mode 100644 index 5652d8cd..00000000 --- a/src/dawn/component/vn/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - VNManager.cpp -) \ No newline at end of file diff --git a/src/dawn/component/vn/VNManager.cpp b/src/dawn/component/vn/VNManager.cpp deleted file mode 100644 index a4e758b7..00000000 --- a/src/dawn/component/vn/VNManager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "VNManager.hpp" - -using namespace Dawn; - -void VNManager::onInit() { - assertNotNull(canvas, "Canvas must be set."); - assertNotNull(texture, "Texture must be set."); - - container = std::make_shared(); - container->align = { 0, 128, 0, 0 }; - container->alignX = UIAlignmentType::STRETCH; - container->alignY = UIAlignmentType::END; - - borders = std::make_shared(); - borders->align = { 0, 0, 0, 0 }; - borders->alignX = UIAlignmentType::STRETCH; - borders->alignY = UIAlignmentType::STRETCH; - borders->color = COLOR_BLUE; - container->appendChild(borders); - - background = std::make_shared(); - background->align = { 16, 16, 16, 16 }; - background->alignX = UIAlignmentType::STRETCH; - background->alignY = UIAlignmentType::STRETCH; - background->color = COLOR_RED; - container->appendChild(background); - - label = std::make_shared(); - label->align = { 16, 16, 16, 16 }; - label->alignX = UIAlignmentType::STRETCH; - label->alignY = UIAlignmentType::STRETCH; - label->setFont(texture); - label->setText(text); - container->appendChild(label); - - canvas->addElement(container); - - listeners.push_back(getScene()->onUnpausedUpdate.listen([&](const float_t d) { - - })); - - auto w = label->getWidth(); - auto cw = container->getWidth(); -} - -void VNManager::onDispose() { - canvas->removeElement(container); - - container = nullptr; - label = nullptr; - background = nullptr; - borders = nullptr; - texture = nullptr; - canvas = nullptr; -} - -void VNManager::setText(const std::wstring &text) { - this->text = text; - if(label) label->setText(text); -} \ No newline at end of file diff --git a/src/dawn/component/vn/VNManager.hpp b/src/dawn/component/vn/VNManager.hpp deleted file mode 100644 index 9c6aba2e..00000000 --- a/src/dawn/component/vn/VNManager.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneItem.hpp" -#include "ui/container/UIContainer.hpp" -#include "ui/elements/UILabel.hpp" -#include "ui/elements/UIRectangle.hpp" - -namespace Dawn { - class VNManager : public SceneComponent { - protected: - std::shared_ptr container; - std::shared_ptr label; - std::shared_ptr borders; - std::shared_ptr background; - std::wstring text; - - public: - std::shared_ptr canvas; - std::shared_ptr texture; - - - void onInit() override; - void onDispose() override; - - /** - * Sets the text to display. - * - * @param text The text to display. - */ - void setText(const std::wstring &text); - }; -} \ No newline at end of file diff --git a/src/dawn/dawn.h b/src/dawn/dawn.h new file mode 100644 index 00000000..e9515757 --- /dev/null +++ b/src/dawn/dawn.h @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef bool bool_t; +typedef char char_t; +typedef unsigned char uchar_t; \ No newline at end of file diff --git a/src/dawn/dawnlibs.hpp b/src/dawn/dawnlibs.hpp deleted file mode 100644 index fb85f91e..00000000 --- a/src/dawn/dawnlibs.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) 2022 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -// Static Libs -extern "C" { - // Standard Libs - #include - #include - #include - #include - #include - #include - #include - #include - #include - - typedef bool bool_t; - typedef char char_t; -} - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -// #include -#include -#include -#include -#include -// #include -#include -#define GLM_ENABLE_EXPERIMENTAL 1 -#include - -#include -using json = nlohmann::json; \ No newline at end of file diff --git a/src/dawn/display/CMakeLists.txt b/src/dawn/display/CMakeLists.txt deleted file mode 100644 index c33affdc..00000000 --- a/src/dawn/display/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Color.cpp - RenderPipeline.cpp - IRenderHost.cpp -) - -# Subdirs -add_subdirectory(font) -add_subdirectory(mesh) -add_subdirectory(shader) \ No newline at end of file diff --git a/src/dawn/display/Color.cpp b/src/dawn/display/Color.cpp deleted file mode 100644 index 25c3c15a..00000000 --- a/src/dawn/display/Color.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Color.hpp" -#include "util/String.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -struct Color Color::fromString(const std::string str) { - // Convert to lowercase - auto lower = String::toLowercase(str); - - if(String::includes(lower, "cornflower")) { - return COLOR_CORNFLOWER_BLUE; - - } else if(String::includes(lower, "magenta")) { - return COLOR_MAGENTA; - - } else if(String::includes(lower, "white")) { - return COLOR_WHITE; - - } else if(String::includes(lower, "black")) { - return COLOR_BLACK; - - } else if(String::includes(lower, "red")) { - return COLOR_RED; - - } else if(String::includes(lower, "green")) { - return COLOR_GREEN; - - } else if(String::includes(lower, "blue")) { - return COLOR_BLUE; - - } else if(String::includes(lower, "transparent")) { - return COLOR_TRANSPARENT; - } - - // Hex code? - if(lower[0] == '#') { - // Remove the hash - lower = lower.substr(1); - - // Convert to RGB - if(lower.length() == 3) { - // Convert to 6 digit hex - lower = lower[0] + lower[0] + lower[1] + lower[1] + lower[2] + lower[2]; - } - - // Convert to RGB - return { - (float_t)std::stoi(lower.substr(0, 2), nullptr, 16) / 255.0f, - (float_t)std::stoi(lower.substr(2, 2), nullptr, 16) / 255.0f, - (float_t)std::stoi(lower.substr(4, 2), nullptr, 16) / 255.0f, - 1.0f - }; - } - - // Split by comma - auto splitByComma = String::split(str, ","); - if(splitByComma.size() == 3) { - // RGB - return { - (float_t)std::stof(splitByComma[0]), - (float_t)std::stof(splitByComma[1]), - (float_t)std::stof(splitByComma[2]), - 1.0f - }; - } else if(splitByComma.size() == 4) { - // RGBA - return { - (float_t)std::stof(splitByComma[0]), - (float_t)std::stof(splitByComma[1]), - (float_t)std::stof(splitByComma[2]), - (float_t)std::stof(splitByComma[3]) - }; - } - - // TODO: Parse other kinds of colors - assertUnreachable("Failed to find a color match for %s", str); - return {}; -} \ No newline at end of file diff --git a/src/dawn/display/Color.hpp b/src/dawn/display/Color.hpp deleted file mode 100644 index d639ba61..00000000 --- a/src/dawn/display/Color.hpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - struct ColorU8 { - uint8_t r, g, b, a; - }; - - struct Color final { - /** - * Returns a color from a string. - * - * @param str String to parse. - * @return Color parsed. - */ - static struct Color fromString(const std::string str); - - float_t r, g, b, a; - - const struct Color& operator = (const struct Color &val) { - this->r = val.r; - this->g = val.g; - this->b = val.b; - this->a = val.a; - return *this; - } - - struct Color operator * (const float_t &x) { - return { - r * x, - g * x, - b * x, - a * x - }; - } - - struct Color operator - (const struct Color &color) { - return { - r - color.r, - g - color.g, - b - color.b, - a - color.a - }; - } - - struct Color operator + (const struct Color &color) { - return { - r + color.r, - g + color.g, - b + color.b, - a + color.a - }; - } - - const bool_t operator == (const struct Color &other) { - return r == other.r && g == other.g && b == other.b && a == other.a; - } - - operator struct ColorU8() const { - return { - (uint8_t)(r * 255), - (uint8_t)(g * 255), - (uint8_t)(b * 255), - (uint8_t)(a * 255) - }; - } - }; - - #define COLOR_DEF(r,g,b,a) { r, g, b, a } - #define COLOR_WHITE COLOR_DEF(1.0f, 1.0f, 1.0f, 1.0f) - #define COLOR_RED COLOR_DEF(1.0f, 0, 0, 1.0f) - #define COLOR_GREEN COLOR_DEF(0, 1.0f, 0, 1.0f) - #define COLOR_BLUE COLOR_DEF(0, 0, 1.0f, 1.0f) - #define COLOR_BLACK COLOR_DEF(0, 0, 0, 1.0f) - #define COLOR_MAGENTA COLOR_DEF(1.0f, 0, 1.0f, 1.0f) - #define COLOR_DARK_GREY COLOR_DEF(0.2f, 0.2f, 0.2f, 1.0f) - #define COLOR_LIGHT_GREY COLOR_DEF(0.8f, 0.8f, 0.8f, 1.0f) - #define COLOR_CORNFLOWER_BLUE COLOR_DEF(0.4f, 0.6f, 0.9f, 1.0f) - #define COLOR_WHITE_TRANSPARENT COLOR_DEF(1.0f, 1.0f, 1.0f, 0.0f) - #define COLOR_BLACK_TRANSPARENT COLOR_DEF(0.0f, 0.0f, 0.0f, 0.0f) - #define COLOR_YELLOW COLOR_DEF(1.0f, 1.0f, 0.0f, 1.0f) - #define COLOR_CYAN COLOR_DEF(0.0f, 1.0f, 1.0f, 1.0f) - #define COLOR_TRANSPARENT COLOR_WHITE_TRANSPARENT -} \ No newline at end of file diff --git a/src/dawn/display/IRenderHost.cpp b/src/dawn/display/IRenderHost.cpp deleted file mode 100644 index 06d8c5cf..00000000 --- a/src/dawn/display/IRenderHost.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "IRenderHost.hpp" - -using namespace Dawn; - -IRenderHost::IRenderHost() : renderPipeline(), shaderManager() { -} - -IRenderHost::~IRenderHost() { -} \ No newline at end of file diff --git a/src/dawn/display/IRenderHost.hpp b/src/dawn/display/IRenderHost.hpp deleted file mode 100644 index 88766205..00000000 --- a/src/dawn/display/IRenderHost.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "display/RenderTarget.hpp" -#include "display/RenderPipeline.hpp" -#include "display/shader/ShaderManager.hpp" - -namespace Dawn { - class Game; - - class IRenderHost { - public: - RenderPipeline renderPipeline; - ShaderManager shaderManager; - - /** - * Creates a render host. - */ - IRenderHost(); - - /** - * Initializes the render host, called by the game during the initial - * set up of the engine. - * - * @param game Game that requested the render host to initialize. - */ - virtual void init(const std::shared_ptr game) = 0; - - /** - * Performs an update/tick of the render host. This would be the game - * asking the RenderHost to do the rendering. - */ - virtual void update(const std::shared_ptr game) = 0; - - /** - * Overridable request from the game that asks if the RenderHost has any - * reason that it should need to close. For most libraries this would be - * whether or not the window was closed. - * - * @return True if the render host requests the game to gracefully exit. - */ - virtual bool_t isCloseRequested() = 0; - - /** - * Returns the back buffer render target. This is the render target that - * is used to render to the screen. - * - * @return The back buffer render target. - */ - virtual std::shared_ptr getBackBufferRenderTarget() = 0; - - /** - * Destroys the render host. - */ - virtual ~IRenderHost(); - }; -} \ No newline at end of file diff --git a/src/dawn/display/ITexture.hpp b/src/dawn/display/ITexture.hpp deleted file mode 100644 index dc0952e8..00000000 --- a/src/dawn/display/ITexture.hpp +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/Color.hpp" - -namespace Dawn { - enum class TextureFormat { - R = 1, - RG = 2, - RGB = 3, - RGBA = 4 - }; - - enum class TextureWrapMode { - REPEAT = 0, - MIRRORED_REPEAT = 1, - CLAMP_TO_EDGE = 2, - CLAMP_TO_BORDER = 3 - }; - - enum class TextureFilterMode { - NEAREST = 0, - LINEAR = 1 - }; - - enum class TextureDataFormat { - UNSIGNED_BYTE = sizeof(uint8_t), - FLOAT = sizeof(float_t) - }; - - class ITexture { - public: - enum TextureWrapMode wrapModeX = TextureWrapMode::REPEAT; - enum TextureWrapMode wrapModeY = TextureWrapMode::REPEAT; - enum TextureFilterMode filterModeMin = TextureFilterMode::NEAREST; - enum TextureFilterMode filterModeMag = TextureFilterMode::NEAREST; - enum TextureFilterMode mipMapFilterModeMin = TextureFilterMode::NEAREST; - enum TextureFilterMode mipMapFilterModeMag = TextureFilterMode::NEAREST; - - /** - * Returns the width of the texture. - * - * @return Width of the texture. - */ - virtual int32_t getWidth() = 0; - - /** - * Returns the height of the texture. - * - * @return Height of the texture. - */ - virtual int32_t getHeight() = 0; - - /** - * Initializes a texture. - * - * @param width Width of the texture (in pixels). - * @param height Height of the texture (in pixels). - * @param format Data format of the texture to use. - * @param dataFormat Data format of the texture to use. - */ - virtual void setSize( - const int32_t width, - const int32_t height, - const enum TextureFormat format, - const enum TextureDataFormat dataFormat - ) = 0; - - /** - * Returns true only when the texture has been loaded, sized and put on - * the gpu for rendering. - * - * @return True if ready, otherwise false. - */ - virtual bool_t isReady() = 0; - - /** - * Buffer pixel data onto the GPU. Pixel buffering is rather costly so - * avoid doing this too often. - * - * @param pixels Array of pixels you're trying to buffer. - */ - virtual void buffer(const struct ColorU8 pixels[]) = 0; - - /** - * Buffer pixel data onto the GPU. Pixel buffering is rather costly so - * avoid doing this too often. - * - * @param pixels Array of pixels you're trying to buffer. - */ - virtual void buffer(const struct Color pixels[]) = 0; - - /** - * Buffer pixel data onto the GPU. Pixel buffering is rather costly so - * avoid doing this too often. - * - * @param pixels Array of pixels you're trying to buffer. - */ - virtual void buffer(const uint8_t pixels[]) = 0; - - /** - * Binds the texture to the given slot (for use by the shaders). - * - * @param slot Slot to bind to. - */ - virtual void bind(const uint8_t slot) = 0; - - /** - * Disposes of the texture. - */ - virtual ~ITexture() { - } - }; -} \ No newline at end of file diff --git a/src/dawn/display/RenderPipeline.cpp b/src/dawn/display/RenderPipeline.cpp deleted file mode 100644 index fc69fb5a..00000000 --- a/src/dawn/display/RenderPipeline.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "RenderPipeline.hpp" -#include "game/Game.hpp" -#include "scene/Scene.hpp" -#include "component/display/Camera.hpp" -#include "component/display/IRenderableComponent.hpp" - -using namespace Dawn; - -RenderPipeline::RenderPipeline() { - -} - -void RenderPipeline::render( - const std::shared_ptr game -) { - assertNotNull(game, "Game cannot be null"); - - auto scene = game->getCurrentScene(); - if(!scene) return; - - this->renderScene(game, scene); -} - -void RenderPipeline::renderScene( - const std::shared_ptr game, - const std::shared_ptr scene -) { - assertNotNull(game, "Game cannot be null"); - assertNotNull(scene, "Scene cannot be null"); - - // TODO: Render Subscenes First - - // Get a list of all cameras in the scene - auto cameras = scene->findComponents(); - auto backBuffer = scene->getGame()->renderHost.getBackBufferRenderTarget(); - - std::shared_ptr backbufferCamera = nullptr; - for(auto camera : cameras) { - auto rt = camera->getRenderTarget(); - // Is this camera the backbuffer camera? - if(rt == backBuffer) { - backbufferCamera = camera; - continue; - } - - // Render scene with this camera - renderSceneCamera(game, scene, camera, rt); - } - - if(backbufferCamera) { - // Render the backbuffer camera - renderSceneCamera(game, scene, backbufferCamera, backBuffer); - } -} - -void RenderPipeline::renderSceneCamera( - const std::shared_ptr game, - const std::shared_ptr scene, - const std::shared_ptr camera, - const std::shared_ptr renderTarget -) { - assertNotNull(game, "Game cannot be null"); - assertNotNull(scene, "Scene cannot be null"); - assertNotNull(camera, "Camera cannot be null"); - assertNotNull(renderTarget, "RenderTarget cannot be null"); - - struct RenderPassContext ctx = { - game, - scene, - camera, - renderTarget - }; - - // Get list of renderables - std::vector> renderPasses; - auto renderables = scene->findComponents(); - for(auto renderable : renderables) { - auto rp = renderable->getPasses(ctx); - renderPasses.insert(renderPasses.end(), rp.begin(), rp.end()); - } - - // TODO: Make clearing the buffers editable! - renderTarget->bind(); - renderTarget->clear( - RENDER_TARGET_CLEAR_COLOR | - RENDER_TARGET_CLEAR_DEPTH - ); - - for(auto renderPass : renderPasses) { - renderPass->bind(); - renderPass->setData(); - renderPass->upload(); - renderPass->draw(); - } -} - -RenderPipeline::~RenderPipeline() { - -} \ No newline at end of file diff --git a/src/dawn/display/RenderPipeline.hpp b/src/dawn/display/RenderPipeline.hpp deleted file mode 100644 index 8da4f262..00000000 --- a/src/dawn/display/RenderPipeline.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class Game; - class Scene; - class Camera; - class RenderTarget; - - class RenderPipeline { - public: - /** - * Creates a new RenderPipeline. - */ - RenderPipeline(); - - /** - * Renders the game. This will render the current scene. - * - * @param game Game to render. - */ - void render( - const std::shared_ptr game - ); - - /** - * Renders a specific scene. This will render all cameras within the - * scene. - * - * @param game Game to render. - * @param scene Scene to render. - */ - void renderScene( - const std::shared_ptr game, - const std::shared_ptr scene - ); - - /** - * Renders a specific scene with a specific camera. - * - * @param game Game to render. - * @param scene Scene to render. - * @param camera Camera to render. - * @param renderTarget Render target to render to. - */ - void renderSceneCamera( - const std::shared_ptr game, - const std::shared_ptr scene, - const std::shared_ptr camera, - const std::shared_ptr renderTarget - ); - - /** - * Destroys the RenderPipeline. - */ - virtual ~RenderPipeline(); - }; -} \ No newline at end of file diff --git a/src/dawn/display/RenderTarget.hpp b/src/dawn/display/RenderTarget.hpp deleted file mode 100644 index 9755e6ba..00000000 --- a/src/dawn/display/RenderTarget.hpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "event/Event.hpp" - -#define RENDER_TARGET_CLEAR_COLOR (1 << 0) -#define RENDER_TARGET_CLEAR_DEPTH (1 << 1) - -namespace Dawn { - class RenderTarget { - public: - Event onResize; - - /** - * Return the width of the render target. - * - * @return The width of the render target. - */ - virtual float_t getWidth() = 0; - - /** - * Return the height of the render target. - * - * @return The height of the render target. - */ - virtual float_t getHeight() = 0; - - /** - * Returns the scale (as in pixel density) of the render target. This is - * typically 1.0f, but on high DPI displays this may be 2.0f or higher. - * - * @return The scale of the render target. - */ - virtual float_t getScale() = 0; - - /** - * Sets the clear color of the render target when the clear method for - * the color buffer is requested. - * - * @param color Color to use for the clear operation. - */ - virtual void setClearColor(const struct Color color) = 0; - - /** - * Request the existing data in the render target to be cleared out. We - * typically assume the render target can support multiple buffer types, - * so you can opt to only clear certain buffer types. - * - * @param clearFlags Flags to request what is going to be cleared. - */ - virtual void clear(const int32_t clearFlags) = 0; - - /** - * Bind the render target for rendering to. The proceeding render requests - * will want to render to this render target directly. In future I may - * see if we can have multiple render targets bound at once to make this - * operation perform faster. - */ - virtual void bind() = 0; - - /** - * Destroys the render target. - */ - virtual ~RenderTarget() { - - } - }; -} \ No newline at end of file diff --git a/src/dawn/display/color.h b/src/dawn/display/color.h new file mode 100644 index 00000000..1cff50a2 --- /dev/null +++ b/src/dawn/display/color.h @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 +#define COLOR_RED 0x02 +#define COLOR_GREEN 0x03 +#define COLOR_BLUE 0x04 +#define COLOR_YELLOW 0x05 +#define COLOR_MAGENTA 0x06 +#define COLOR_CYAN 0x07 \ No newline at end of file diff --git a/src/dawn/display/display.h b/src/dawn/display/display.h new file mode 100644 index 00000000..fb5a3000 --- /dev/null +++ b/src/dawn/display/display.h @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +/** + * Initializes the display subsystem. + */ +void displayInit(); + +/** + * Updates the display subsystem, this is basically asking the display renderer + * to perform a render. + */ +void displayUpdate(); + +/** + * Cleans up the display subsystem. + */ +void displayDispose(); \ No newline at end of file diff --git a/src/dawn/display/font/CMakeLists.txt b/src/dawn/display/font/CMakeLists.txt deleted file mode 100644 index e92f0a96..00000000 --- a/src/dawn/display/font/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - TrueTypeTexture.cpp -) diff --git a/src/dawn/display/font/TrueTypeCharacter.hpp b/src/dawn/display/font/TrueTypeCharacter.hpp deleted file mode 100644 index f4e04451..00000000 --- a/src/dawn/display/font/TrueTypeCharacter.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - struct TrueTypeCharacter { - glm::vec2 advance; - glm::vec2 size; - glm::vec2 offset; - glm::vec4 quad; - }; -} \ No newline at end of file diff --git a/src/dawn/display/font/TrueTypeTexture.cpp b/src/dawn/display/font/TrueTypeTexture.cpp deleted file mode 100644 index dee30e0c..00000000 --- a/src/dawn/display/font/TrueTypeTexture.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TrueTypeTexture.hpp" -#include "assert/assert.hpp" -#include "util/Math.hpp" -#include "display/mesh/QuadMesh.hpp" - -using namespace Dawn; - -TrueTypeTexture::TrueTypeTexture(const uint32_t fontSize) : - fontSize(fontSize) -{ - assertTrue(fontSize > 0, "Font size cannot be zero"); - texture = std::make_shared(); -} - -void TrueTypeTexture::setFace(const FT_Face face) { - this->face = face; - assertTrue(fontSize < 256, "Font size cannot be greater than 256"); - - // Set freetype font size prior to baking. - auto ret = FT_Set_Pixel_Sizes(face, 0, fontSize); - if(ret != 0) { - assertUnreachable("Failed to set font size %i", ret); - } - - // Set the texture size - texture->setSize( - fontSize * 24, - fontSize * 24, - TextureFormat::R, - TextureDataFormat::UNSIGNED_BYTE - ); - - // Texture buffer - uint8_t *buffer = new uint8_t[texture->getWidth() * texture->getHeight()]; - // Fill with zeros - std::memset(buffer, 0, texture->getWidth() * texture->getHeight()); - - size_t offset = 0; - struct TrueTypeCharacter info; - int32_t textureX = 0, textureY = 0; - int32_t rowHeight = 0; - - // Character sets - std::vector characterBlocks; - // Latin - for(wchar_t c = 0x0020; c < 0x007F; c++) characterBlocks.push_back(c); - // Latin-1 Supplement - for(wchar_t c = 0x00A0; c < 0x00FF; c++) characterBlocks.push_back(c); - // Latin Extended-A - for(wchar_t c = 0x0100; c < 0x017F; c++) characterBlocks.push_back(c); - // Latin Extended-B - for(wchar_t c = 0x0180; c < 0x024F; c++) characterBlocks.push_back(c); - // Hiragana - for(wchar_t c = 0x3040; c < 0x309F; c++) characterBlocks.push_back(c); - // Katakana - for(wchar_t c = 0x30A0; c < 0x30FF; c++) characterBlocks.push_back(c); - - // For each character in the character set - for(wchar_t c : characterBlocks) { - // Load the character - if(FT_Load_Char(face, c, FT_LOAD_RENDER)) { - assertUnreachable("Failed to load character (1)"); - } - - // Store the character information - info.advance.x = (float_t)(face->glyph->advance.x >> 6); - info.advance.y = (float_t)(face->glyph->advance.y >> 6); - info.size = glm::vec2(face->glyph->bitmap.width, face->glyph->bitmap.rows); - - // Determine the texture position - if(textureX + face->glyph->bitmap.width >= texture->getWidth()) { - textureX = 0; - textureY += rowHeight + 2;// Tiny gap between rows - rowHeight = face->glyph->bitmap.rows; - } else { - rowHeight = Math::max(rowHeight, face->glyph->bitmap.rows); - } - - // Set the quad positions - info.offset = glm::vec2( - face->glyph->bitmap_left, - -face->glyph->bitmap_top - ); - info.quad = glm::vec4( - textureX, - textureY, - textureX + face->glyph->bitmap.width, - textureY + face->glyph->bitmap.rows - ) / glm::vec4( - texture->getWidth(), - texture->getHeight(), - texture->getWidth(), - texture->getHeight() - ); - - // Store the cached character data. - this->characterData[c] = info; - - // Determine pixel offset. - offset = textureX + (textureY * texture->getWidth()); - assertTrue( - offset + (face->glyph->bitmap.rows * texture->getWidth()) <= - texture->getWidth() * texture->getHeight(), - "Font texture buffer overflow will occur." - ); - - // Buffer pixels, we have to do this one row at a time due to the - // differences in width between the glyph and the texture. - const size_t countPerRow = face->glyph->bitmap.width; - int32_t i = 0; - while(i != face->glyph->bitmap.rows) { - std::memcpy( - buffer + offset + (i * texture->getWidth()), - face->glyph->bitmap.buffer + (i * countPerRow), - countPerRow - ); - i++; - } - - // Increment textureX - textureX += face->glyph->bitmap.width + 2;// I add a tiny gap between chars - } - - this->texture->buffer(buffer); - delete[] buffer; -} - -struct TrueTypeCharacter TrueTypeTexture::getCharacterData(wchar_t c) { - return this->characterData[c]; -} - -glm::vec2 TrueTypeTexture::bufferStringToMesh( - std::shared_ptr mesh, - const std::wstring text, - glm::vec2 &position, - bool_t flipY -) { - assertNotNull(mesh, "Mesh must be supplied and not null"); - assertTrue(text.size() > 0, "Text must be at least one character long."); - - // Create mesh buffers - mesh->createBuffers( - text.length() * QUAD_VERTICE_COUNT, - text.length() * QUAD_INDICE_COUNT - ); - - // Foreach char - size_t i = 0; - glm::vec2 size = { 0, 0 }; - for(wchar_t c : text) { - // Get the character data - auto info = this->getCharacterData(c); - - // Buffer the quad - glm::vec4 quad = glm::vec4( - position.x, - position.y, - position.x + info.size.x, - position.y + info.size.y - ); - if(flipY) { - QuadMesh::buffer( - mesh, - quad, - glm::vec4( - info.quad.x, - info.quad.w, - info.quad.z, - info.quad.y - ), - i * QUAD_VERTICE_COUNT, - i * QUAD_INDICE_COUNT - ); - } else { - QuadMesh::buffer( - mesh, - quad, - info.quad, - i * QUAD_VERTICE_COUNT, - i * QUAD_INDICE_COUNT - ); - } - position += info.advance; - size += info.advance; - - i++; - } - - return size; -} - -TrueTypeTexture::~TrueTypeTexture() { -} diff --git a/src/dawn/display/font/TrueTypeTexture.hpp b/src/dawn/display/font/TrueTypeTexture.hpp deleted file mode 100644 index ece25333..00000000 --- a/src/dawn/display/font/TrueTypeTexture.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/Texture.hpp" -#include "TrueTypeCharacter.hpp" -#include "display/mesh/Mesh.hpp" -#include -#include FT_FREETYPE_H - -namespace Dawn { - class TrueTypeTexture final { - private: - FT_Face face; - - public: - uint32_t fontSize; - std::shared_ptr texture; - std::unordered_map characterData; - - /** - * Construct a new New True Type Face Texture object - * - * @param fontSize Size of the font. - */ - TrueTypeTexture(const uint32_t fontSize); - - /** - * Sets the face for this texture. - * - * @param face Face to set. - */ - void setFace(const FT_Face face); - - /** - * Returns the character data for the given character. - * - * @param c Character to get data for. - * @return The Character data for the given character. - */ - struct TrueTypeCharacter getCharacterData(wchar_t c); - - /** - * Buffers a string to the given mesh. - * - * @param mesh Mesh to buffer to. - * @param text Text to buffer. - * @param position Position to buffer to. - * @param flipY Whether or not to flip the Y axis. - * @return The size of the string. - */ - glm::vec2 bufferStringToMesh( - std::shared_ptr mesh, - const std::wstring text, - glm::vec2 &position, - bool_t flipY = false - ); - - /** - * Destroys this true type face texture. - */ - ~TrueTypeTexture(); - }; -} \ No newline at end of file diff --git a/src/dawn/display/mesh/CMakeLists.txt b/src/dawn/display/mesh/CMakeLists.txt deleted file mode 100644 index 741a6ec2..00000000 --- a/src/dawn/display/mesh/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - CubeMesh.cpp - QuadMesh.cpp -) \ No newline at end of file diff --git a/src/dawn/display/mesh/CubeMesh.cpp b/src/dawn/display/mesh/CubeMesh.cpp deleted file mode 100644 index 9906a30a..00000000 --- a/src/dawn/display/mesh/CubeMesh.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "CubeMesh.hpp" - -using namespace Dawn; - -void CubeMesh::buffer( - const std::shared_ptr mesh, - const glm::vec3 pos, - const glm::vec3 size, - const int32_t verticeStart, - const int32_t indiceStart -) { - glm::vec3 positions[CUBE_VERTICE_COUNT] = { - pos, - glm::vec3(pos.x+size.x, pos.y, pos.z), - glm::vec3(pos.x, pos.y+size.y, pos.z), - glm::vec3(pos.x+size.x, pos.y+size.y, pos.z), - - glm::vec3(pos.x, pos.y, pos.z+size.z), - glm::vec3(pos.x+size.x, pos.y, pos.z+size.z), - glm::vec3(pos.x, pos.y+size.y, pos.z+size.z), - pos + size - }; - - glm::vec2 coordinates[CUBE_VERTICE_COUNT] = { - glm::vec2(0, 0), - glm::vec2(1, 0), - glm::vec2(0, 1), - glm::vec2(1, 1), - - glm::vec2(0, 0), - glm::vec2(1, 0), - glm::vec2(0, 1), - glm::vec2(1, 1) - }; - - int32_t indices[CUBE_INDICE_COUNT] = { - // Back - verticeStart, verticeStart + 1, verticeStart + 3, - verticeStart, verticeStart + 2, verticeStart + 3, - - // Right - verticeStart + 1, verticeStart + 5, verticeStart + 7, - verticeStart + 1, verticeStart + 3, verticeStart + 7, - - // Left - verticeStart + 4, verticeStart, verticeStart + 2, - verticeStart + 4, verticeStart + 6, verticeStart + 2, - - // Front - verticeStart + 5, verticeStart + 4, verticeStart + 6, - verticeStart + 5, verticeStart + 7, verticeStart + 6, - - // Top - verticeStart + 7, verticeStart + 2, verticeStart + 6, - verticeStart + 7, verticeStart + 3, verticeStart + 2, - - // Bottom - verticeStart + 1, verticeStart, verticeStart + 4, - verticeStart + 1, verticeStart + 4, verticeStart + 5 - }; - - mesh->bufferPositions(verticeStart, positions, CUBE_VERTICE_COUNT); - mesh->bufferCoordinates(verticeStart, coordinates, CUBE_VERTICE_COUNT); - mesh->bufferIndices(indiceStart, indices, CUBE_INDICE_COUNT); -} \ No newline at end of file diff --git a/src/dawn/display/mesh/CubeMesh.hpp b/src/dawn/display/mesh/CubeMesh.hpp deleted file mode 100644 index 5e71da50..00000000 --- a/src/dawn/display/mesh/CubeMesh.hpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/mesh/Mesh.hpp" - -#define CUBE_VERTICE_COUNT 8 -#define CUBE_INDICE_COUNT 36 - -namespace Dawn { - class CubeMesh { - public: - /** - * Buffers cube mesh vertices and indices into the given mesh. - * - * @param size The size of the cube. - * @param verticeStart The starting index of the vertices. - * @param indiceStart The starting index of the indices. - */ - static void buffer( - const std::shared_ptr mesh, - const glm::vec3 pos, - const glm::vec3 size, - const int32_t verticeStart, - const int32_t indiceStart - ); - }; -} \ No newline at end of file diff --git a/src/dawn/display/mesh/IMesh.hpp b/src/dawn/display/mesh/IMesh.hpp deleted file mode 100644 index 32df33a2..00000000 --- a/src/dawn/display/mesh/IMesh.hpp +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum MeshDrawMode { - TRIANGLES, - TRIANGLE_STRIP, - TRIANGLE_FAN, - LINES, - POINTS - // LINE_STRIP, - }; - - class IMesh { - protected: - /** How many vertices are in the mesh */ - int32_t verticeCount = -1; - /** How many indices are in the mesh */ - int32_t indiceCount = -1; - - public: - /** - * Create a new set of buffers for the mesh to use. - * - * @param verticeCount How many Vertices will this buffer support. - * @param indiceCount How many Indices will this buffer support. - */ - virtual void createBuffers( - const int32_t verticeCount, - const int32_t indiceCount - ) = 0; - - /** - * Cleanup the buffers on a given mesh. This is useful if you intend to - * expand the count of vertices your mesh supports. - */ - virtual void disposeBuffers() = 0; - - /** - * Write vertice positions to the mesh. - * - * @param pos Position, within the buffer, to write to. - * @param vertices Array of positions to write. - * @param len How many positions are in the array. - */ - virtual void bufferPositions( - const int32_t pos, - const glm::vec3 positions[], - const int32_t len - ) = 0; - - /** - * Write vertice coordinates to the mesh. - * - * @param pos Position, within the buffer, to write to. - * @param coordinates Array of coordinates to write. - * @param len How many coordinates are in the array. - */ - virtual void bufferCoordinates( - const int32_t pos, - const glm::vec2 coordinates[], - const int32_t len - ) = 0; - - /** - * Write indices to the mesh. - * - * @param pos Position, within the buffer, to write to. - * @param indices Array of indices to write. - * @param len How many indices are in the array. - */ - virtual void bufferIndices( - const int32_t pos, - const int32_t indices[], - const int32_t len - ) = 0; - - /** - * Draw a primitive. Primitives are drawn by their indices. - * - * @param drawMode Which drawing mode to use to draw the primitive. - * @param start Start indice (index) to draw. - * @param count Count of indices to draw. Use -1 to draw all. - */ - virtual void draw( - const enum MeshDrawMode drawMode, - const int32_t start, - const int32_t count - ) = 0; - - /** - * Cleanup a previously initiated mesh. - */ - virtual ~IMesh() { - } - }; -} \ No newline at end of file diff --git a/src/dawn/display/mesh/QuadMesh.cpp b/src/dawn/display/mesh/QuadMesh.cpp deleted file mode 100644 index c094c2e6..00000000 --- a/src/dawn/display/mesh/QuadMesh.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "QuadMesh.hpp" - -using namespace Dawn; - -void QuadMesh::buffer( - const std::shared_ptr mesh, - const glm::vec4 positions, - const glm::vec4 coordinates, - const int32_t verticeStart, - const int32_t indiceStart, - const float_t depth -) { - glm::vec3 vertices[QUAD_VERTICE_COUNT] = { - glm::vec3(positions.x, positions.y, depth), - glm::vec3(positions.z, positions.y, depth), - glm::vec3(positions.x, positions.w, depth), - glm::vec3(positions.z, positions.w, depth) - }; - - glm::vec2 coords[QUAD_VERTICE_COUNT] = { - glm::vec2(coordinates.x, coordinates.y), - glm::vec2(coordinates.z, coordinates.y), - glm::vec2(coordinates.x, coordinates.w), - glm::vec2(coordinates.z, coordinates.w) - }; - - int32_t indices[QUAD_INDICE_COUNT] = { - verticeStart, verticeStart + 1, verticeStart + 3, - verticeStart, verticeStart + 2, verticeStart + 3 - }; - - mesh->bufferPositions(verticeStart, vertices, QUAD_VERTICE_COUNT); - mesh->bufferCoordinates(verticeStart, coords, QUAD_VERTICE_COUNT); - mesh->bufferIndices(indiceStart, indices, QUAD_INDICE_COUNT); -} - -void QuadMesh::bufferWithIndex( - const std::shared_ptr mesh, - const glm::vec4 positions, - const glm::vec4 coordinates, - const int32_t verticeStart, - const int32_t indiceStart, - const int32_t indexOffset -) { - glm::vec3 vertices[QUAD_VERTICE_COUNT] = { - glm::vec3(positions.x, positions.y, indexOffset), - glm::vec3(positions.z, positions.y, indexOffset + 1), - glm::vec3(positions.x, positions.w, indexOffset + 2), - glm::vec3(positions.z, positions.w, indexOffset + 3) - }; - - glm::vec2 coords[QUAD_VERTICE_COUNT] = { - glm::vec2(coordinates.x, coordinates.y), - glm::vec2(coordinates.z, coordinates.y), - glm::vec2(coordinates.x, coordinates.w), - glm::vec2(coordinates.z, coordinates.w) - }; - - int32_t indices[QUAD_INDICE_COUNT] = { - verticeStart, verticeStart + 1, verticeStart + 3, - verticeStart, verticeStart + 2, verticeStart + 3 - }; - - mesh->bufferPositions(verticeStart, vertices, QUAD_VERTICE_COUNT); - mesh->bufferCoordinates(verticeStart, coords, QUAD_VERTICE_COUNT); - mesh->bufferIndices(indiceStart, indices, QUAD_INDICE_COUNT); -} \ No newline at end of file diff --git a/src/dawn/display/mesh/QuadMesh.hpp b/src/dawn/display/mesh/QuadMesh.hpp deleted file mode 100644 index 009fcdad..00000000 --- a/src/dawn/display/mesh/QuadMesh.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/mesh/Mesh.hpp" - -#define QUAD_VERTICE_COUNT 4 -#define QUAD_INDICE_COUNT 6 - -namespace Dawn { - class QuadMesh { - public: - /** - * Buffers quad mesh vertices and indices into the given mesh. - * - * @param mesh The mesh to buffer into. - * @param positions The positions of the vertices. - * @param coordinates The coordinates of the vertices. - * @param verticeStart The starting index of the vertices. - * @param indiceStart The starting index of the indices. - * @param depth The depth of the vertices (Z coordinate). - */ - static void buffer( - const std::shared_ptr mesh, - const glm::vec4 positions, - const glm::vec4 coordinates, - const int32_t verticeStart, - const int32_t indiceStart, - const float_t depth = 0.0f - ); - - /** - * Buffers quad mesh vertices and indices into the given mesh. This will - * store the index of the vertice in the Z component, allowing you to find - * which vertex ID you are rendering in your shader. - * - * @param mesh The mesh to buffer into. - * @param positions The positions of the vertices. - * @param coordinates The coordinates of the vertices. - * @param verticeStart The starting index of the vertices. - * @param indiceStart The starting index of the indices. - * @param indexOffset The offset to add to the index of each vertex. - */ - static void bufferWithIndex( - const std::shared_ptr mesh, - const glm::vec4 positions, - const glm::vec4 coordinates, - const int32_t verticeStart, - const int32_t indiceStart, - const int32_t indexOffset = 0 - ); - }; -} \ No newline at end of file diff --git a/src/dawn/display/pass/IRenderPass.hpp b/src/dawn/display/pass/IRenderPass.hpp deleted file mode 100644 index a06da51b..00000000 --- a/src/dawn/display/pass/IRenderPass.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/mesh/Mesh.hpp" - -namespace Dawn { - class IRenderPass { - public: - std::shared_ptr mesh; - - /** - * Binds the shader for this render pass. - */ - virtual void bind() = 0; - - /** - * Sets the data for this render pass to the shader. - */ - virtual void setData() = 0; - - /** - * Uploads the data to the GPU. - */ - virtual void upload() = 0; - - /** - * Draws the mesh for this render pass. - */ - virtual void draw() = 0; - - /** - * Cleans up the render pass. - */ - virtual ~IRenderPass() { - } - }; -} \ No newline at end of file diff --git a/src/dawn/display/pass/RenderPass.hpp b/src/dawn/display/pass/RenderPass.hpp deleted file mode 100644 index 746c0136..00000000 --- a/src/dawn/display/pass/RenderPass.hpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/Game.hpp" -#include "display/pass/IRenderPass.hpp" -#include "display/shader/Shader.hpp" -#include "display/Texture.hpp" -#include "component/display/MeshRenderer.hpp" - -namespace Dawn { - template - class RenderPass : public IRenderPass { - private: - std::shared_ptr shader; - const std::unordered_map< - shadertexturebinding_t, std::shared_ptr - > textures; - std::shared_ptr mesh; - const enum MeshDrawMode drawMode; - const int32_t indiceStart; - const int32_t indiceCount; - const D data; - - public: - /** - * Constructs a new RenderPass. - * - * @param self Self component instance that is creating this render pass. - * @param d The data to use for this render pass. - * @param mesh The mesh to use for this render pass. - * @param drawMode The draw mode to use for this render pass. - * @param indiceStart The indice to start drawing from. - * @param indiceCount The number of indices to draw. - */ - RenderPass( - SceneComponent &self, - const D d, - const std::unordered_map< - shadertexturebinding_t, std::shared_ptr - > textures, - const std::shared_ptr mesh, - const enum MeshDrawMode drawMode, - const int32_t indiceStart, - const int32_t indiceCount - ) : - data(d), - textures(textures), - mesh(mesh), - drawMode(drawMode), - indiceStart(indiceStart), - indiceCount(indiceCount) - { - //Get the shader - shader = ( - self.getGame()->renderHost.shaderManager.getShader() - ); - assertNotNull(shader, "Shader cannot be null!"); - - // Need mesh? - if(!this->mesh) { - auto meshRenderer = self.getItem()->getComponent(); - if(meshRenderer) this->mesh = meshRenderer->mesh; - } - } - - void bind() override { - shader->bind(); - } - - void setData() override { - shader->setData(data); - } - - void upload() override { - for(auto &pair : textures) { - if(!pair.second->isReady()) continue; - pair.second->bind(pair.first); - } - shader->upload(); - } - - void draw() override { - if(mesh) { - mesh->draw(drawMode, indiceStart, indiceCount); - } - } - - ~RenderPass() override { - } - }; -} \ No newline at end of file diff --git a/src/dawn/display/pass/RenderPassContext.hpp b/src/dawn/display/pass/RenderPassContext.hpp deleted file mode 100644 index 87e54640..00000000 --- a/src/dawn/display/pass/RenderPassContext.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/Game.hpp" -#include "scene/Scene.hpp" -#include "component/display/Camera.hpp" - -namespace Dawn { - struct RenderPassContext { - std::shared_ptr game; - std::shared_ptr scene; - std::shared_ptr camera; - std::shared_ptr renderTarget; - }; -} \ No newline at end of file diff --git a/src/dawn/display/shader/CMakeLists.txt b/src/dawn/display/shader/CMakeLists.txt deleted file mode 100644 index 1d4aa6a9..00000000 --- a/src/dawn/display/shader/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - IShader.cpp - IShaderStage.cpp -) \ No newline at end of file diff --git a/src/dawn/display/shader/IShader.cpp b/src/dawn/display/shader/IShader.cpp deleted file mode 100644 index 941406b1..00000000 --- a/src/dawn/display/shader/IShader.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "display/shader/Shader.hpp" -#include "assert/assert.hpp" -#include "display/Color.hpp" -#include "display/Texture.hpp" - -using namespace Dawn; - -size_t shaderParameterTypeGetSize(const enum ShaderParameterType type) { - switch(type) { - case ShaderParameterType::VEC2: - return sizeof(glm::vec2); - - case ShaderParameterType::VEC3: - return sizeof(glm::vec3); - - case ShaderParameterType::VEC4: - return sizeof(glm::vec4); - - case ShaderParameterType::MAT3: - return sizeof(glm::mat3); - - case ShaderParameterType::MAT4: - return sizeof(glm::mat4); - - case ShaderParameterType::COLOR: - return sizeof(struct Color); - - case ShaderParameterType::FLOAT: - return sizeof(float); - - case ShaderParameterType::INT: - return sizeof(int32_t); - - case ShaderParameterType::TEXTURE: - return sizeof(shadertexturebinding_t); - - default: - assertUnreachable("Unknown ShaderParameterType"); - return 0; - } -} diff --git a/src/dawn/display/shader/IShader.hpp b/src/dawn/display/shader/IShader.hpp deleted file mode 100644 index b35aadd5..00000000 --- a/src/dawn/display/shader/IShader.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum class ShaderParameterType { - VEC2, - VEC3, - VEC4, - MAT3, - MAT4, - COLOR, - FLOAT, - INT, - TEXTURE, - BOOLEAN - }; - - class IShaderBase { - public: - virtual ~IShaderBase() { - - } - }; - - template - class IShader : public IShaderBase { - protected: - T data; - - public: - /** - * Returns the currently uploaded data on the Shader. - * - * @return The uploaded data. - */ - T getData() { - return data; - } - - /** - * Sets the entire data to be uploaded. - * - * @param data Data to be uploaded. - */ - void setData(const T data) { - this->data = data; - } - - /** - * Initializes the shader, this needs to be called before the shader can - * be used. - */ - virtual void init() = 0; - - /** - * Binds the shader as the current one, does not upload any data, somewhat - * relies on something else uploading the data. - */ - virtual void bind() = 0; - - /** - * Uploads the data to the GPU. - */ - virtual void upload() = 0; - - /** - * Disposes of the shader. - */ - virtual ~IShader() { - - } - }; -} - -/** - * Returns the size of the ShaderParameterType. - * - * @param type The type to get the size of. - * @return Size of the type. - */ -size_t shaderParameterTypeGetSize(const enum Dawn::ShaderParameterType type); \ No newline at end of file diff --git a/src/dawn/display/shader/IShaderStage.cpp b/src/dawn/display/shader/IShaderStage.cpp deleted file mode 100644 index 1f395710..00000000 --- a/src/dawn/display/shader/IShaderStage.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "IShaderStage.hpp" - -using namespace Dawn; - -IShaderStage::IShaderStage(const enum ShaderStageType type) : - type(type) -{ - -} - -IShaderStage::~IShaderStage() { - -} \ No newline at end of file diff --git a/src/dawn/display/shader/IShaderStage.hpp b/src/dawn/display/shader/IShaderStage.hpp deleted file mode 100644 index fae14b94..00000000 --- a/src/dawn/display/shader/IShaderStage.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum class ShaderStageType { - VERTEX, - FRAGMENT, - // COMPUTE - }; - - class IShaderStage { - public: - const enum ShaderStageType type; - - /** - * Constructs a new Shader Stage. - * - * @param type Type of shader stage. - */ - IShaderStage(const enum ShaderStageType type); - - /** - * Destroy the IShaderStage object - */ - virtual ~IShaderStage(); - }; -} \ No newline at end of file diff --git a/src/dawn/display/shader/ShaderManager.hpp b/src/dawn/display/shader/ShaderManager.hpp deleted file mode 100644 index 762a7770..00000000 --- a/src/dawn/display/shader/ShaderManager.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/Shader.hpp" - -namespace Dawn { - class ShaderManager { - private: - std::vector> shaders; - - public: - /** - * Retreives an instance of the shader from the shader manager. If the - * shader does not exist it will be created. - * - * @tparam T Type of shader to retreive. - * @return Shader instance. - */ - template - std::shared_ptr getShader() { - auto itShaders = shaders.begin(); - while(itShaders != shaders.end()) { - // auto shader = itShaders->lock(); - // if(!shader) { - // itShaders = shaders.erase(itShaders); - // continue; - // } - // std::shared_ptr casted = std::dynamic_pointer_cast(shader); - - auto shader = *itShaders; - std::shared_ptr casted = std::dynamic_pointer_cast(shader); - if(casted) return casted; - itShaders++; - } - - auto newShader = std::make_shared(); - shaders.push_back(newShader); - newShader->init(); - return newShader; - } - }; -} \ No newline at end of file diff --git a/src/dawn/environment/CMakeLists.txt b/src/dawn/environment/CMakeLists.txt deleted file mode 100644 index 5893dcaa..00000000 --- a/src/dawn/environment/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Environment.cpp -) \ No newline at end of file diff --git a/src/dawn/environment/Environment.cpp b/src/dawn/environment/Environment.cpp deleted file mode 100644 index 023d4431..00000000 --- a/src/dawn/environment/Environment.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Environment.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -Environment environment; - -bool_t Environment::hasVariable(const std::string &key) { - assertTrue(key.length() > 0, "Key must be at least 1 character long."); - return this->variables.find(key) != this->variables.end(); -} - -void Environment::setVariable( - const std::string &key, - const std::string &value -) { - assertTrue(key.length() > 0, "Key must be at least 1 character long."); - - this->variables[key] = value; -} - -std::string Environment::getVariable(const std::string &key) { - assertTrue(key.length() > 0, "Key must be at least 1 character long."); - assertTrue(this->hasVariable(key), "Variable does not exist."); - return this->variables[key]; -} diff --git a/src/dawn/environment/Environment.hpp b/src/dawn/environment/Environment.hpp deleted file mode 100644 index e4fd3c25..00000000 --- a/src/dawn/environment/Environment.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class Environment { - private: - std::map variables; - - public: - /** - * Checks if the environment has a variable. - * - * @param key Variable key to check. - * @return True if the variable exists, false otherwise. - */ - bool_t hasVariable(const std::string &key); - - /** - * Sets a variable in the environment. - * - * @param key Variable key to set. - * @param value Variable value to set. - */ - void setVariable(const std::string &key, const std::string &value); - - /** - * Gets a variable from the environment. - * - * @param key Variable key to get. - * @return Variable value, or empty string if not found. - */ - std::string getVariable(const std::string &key); - }; -} - -extern Dawn::Environment environment; \ No newline at end of file diff --git a/src/dawn/event/CustomEvent.hpp b/src/dawn/event/CustomEvent.hpp deleted file mode 100644 index a2622dbb..00000000 --- a/src/dawn/event/CustomEvent.hpp +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum class CustomEventResult { - NOTHING, - REMOVE, - INVOKE, - INVOKE_AND_REMOVE - }; - - template< - typename InternalData, - typename InternalListenerData, - typename ListenerArgument, - typename ...InvokeArgs - > - class CustomEvent { - private: - int32_t nextId = 0; - std::unordered_map< - int32_t, - std::pair> - > listeners; - - protected: - InternalData internalData; - - /** - * Custom event filter. Decides whether or not the event should be emitted - * to the listener. - * - * @param listenerData Data for this listener. - * @param args The arguments to pass to the listeners. - * @return The result of the filter. - */ - virtual enum CustomEventResult shouldEmit( - const InternalListenerData &listenerData, - const InvokeArgs... args - ) = 0; - - /** - * Transform the arguments for listener data when the listener is first - * subscribed. - * - * @param argument The argument to transform. - * @return The transformed argument into an internal data format. - */ - virtual InternalListenerData transformData( - const ListenerArgument &argument - ) = 0; - - /** - * Transform the data for listener data after the event has been emitted. - * - * @param internalData The internal data to transform. - * @return Updated/Transformed internal data. - */ - virtual InternalListenerData transformDataAfterEmit( - const InternalListenerData &internalData - ) { - return internalData; - } - - public: - /** - * Emits the event. - * @param args The arguments to pass to the listeners. - */ - void emit(InvokeArgs... args) { - auto copy = listeners; - for(auto &pair : copy) { - // Check emit test. - auto result = this->shouldEmit( - pair.second.first, - args... - ); - if( - result == CustomEventResult::INVOKE || - result == CustomEventResult::INVOKE_AND_REMOVE - ) { - pair.second.second(args...); - } - - if( - result == CustomEventResult::REMOVE || - result == CustomEventResult::INVOKE_AND_REMOVE - ) { - listeners.erase(pair.first); - continue; - } - - if( - result == CustomEventResult::INVOKE || - result == CustomEventResult::INVOKE_AND_REMOVE - ) { - // Update the internal data. - listeners[pair.first].first = transformDataAfterEmit( - pair.second.first - ); - } - } - } - - /** - * Listens to the event. - * - * @param data Listener data to use. - * @param listener The listener to add. - * @returns A function that can be called to remove the listener. - */ - std::function listen( - const ListenerArgument &data, - const std::function listener - ) { - int32_t id = nextId++; - - auto pair = std::make_pair( - transformData(data), - listener - ); - - listeners[id] = pair; - return [this, id]() { - listeners.erase(id); - }; - } - - /** - * Destroys the custom event. - */ - virtual ~CustomEvent() { - listeners.clear(); - } - }; -} \ No newline at end of file diff --git a/src/dawn/event/Event.hpp b/src/dawn/event/Event.hpp deleted file mode 100644 index 5204a029..00000000 --- a/src/dawn/event/Event.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - template - class Event { - private: - int32_t nextId = 0; - std::map> listeners; - - public: - /** - * Constructs a new Event. - */ - Event() { - - } - - /** - * Emits the event. - * @param args The arguments to pass to the listeners. - */ - void emit(A ...args) { - auto copy = listeners; - for(auto &pair : copy) { - pair.second(args...); - } - } - - /** - * Listens to the event. - * @param listener The listener to add. - * @returns A function that can be called to remove the listener. - */ - std::function listen( - const std::function listener - ) { - int32_t id = nextId++; - listeners[id] = listener; - return [this, id]() { - listeners.erase(id); - }; - } - - /** - * Destroys the event. - */ - virtual ~Event() { - listeners.clear(); - } - }; -} \ No newline at end of file diff --git a/src/dawn/game.c b/src/dawn/game.c new file mode 100644 index 00000000..f4135e6b --- /dev/null +++ b/src/dawn/game.c @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "game.h" +#include "time.h" +#include "input.h" +#include "display/display.h" +#include "rpg/world/maps/testmap.h" + +map_t MAP; +game_t GAME; + +void gameInit() { + memset(&GAME, 0, sizeof(game_t)); + + timeInit(); + inputInit(); + displayInit(); + + testMapInit(&MAP); + gameSetMap(&MAP); +} + +uint8_t gameUpdate(const float_t delta) { + timeUpdate(delta); + inputUpdate(); + + if(GAME.currentMap) { + mapUpdate(GAME.currentMap); + } + + displayUpdate(); + + if(inputIsDown(INPUT_BIND_CANCEL)) return GAME_UPDATE_RESULT_EXIT; + return GAME_UPDATE_RESULT_CONTINUE; +} + +void gameSetMap(map_t *map) { + GAME.currentMap = map; +} + +void gameDispose() { + displayDispose(); +} \ No newline at end of file diff --git a/src/dawn/game.h b/src/dawn/game.h new file mode 100644 index 00000000..3d1b1ac7 --- /dev/null +++ b/src/dawn/game.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "rpg/world/map.h" + +#define GAME_UPDATE_RESULT_CONTINUE 0 +#define GAME_UPDATE_RESULT_EXIT 1 + +typedef struct { + map_t *currentMap; +} game_t; + +extern game_t GAME; + +/** + * Initializes the game state. + */ +void gameInit(); + +/** + * Updates the game state. + * + * @param delta Time since last update. + * @return Game update result, 0 for continue, 1 for exit, else for failure. + */ +uint8_t gameUpdate(const float_t delta); + +/** + * Sets the current map, does not take ownership. + * + * @param map Map to set. + */ +void gameSetMap(map_t *map); + +/** + * Cleans up the game state. + */ +void gameDispose(); \ No newline at end of file diff --git a/src/dawn/game/CMakeLists.txt b/src/dawn/game/CMakeLists.txt deleted file mode 100644 index b729632c..00000000 --- a/src/dawn/game/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Game.cpp -) \ No newline at end of file diff --git a/src/dawn/game/Game.cpp b/src/dawn/game/Game.cpp deleted file mode 100644 index 9ecfc879..00000000 --- a/src/dawn/game/Game.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "game/Game.hpp" -#include "game/GameInit.hpp" -#include "scene/Scene.hpp" - -using namespace Dawn; - -Game::Game() { - -} - -void Game::init() { - renderHost.init(shared_from_this()); - inputManager.init(shared_from_this()); - saveManager.init(shared_from_this()); - - auto initialScene = Scene::getInitialScene(); - this->nextFrameScene = std::make_shared(shared_from_this(), initialScene); -} - -void Game::update() { - this->assetManager.update(); - - if(nextFrameScene) { - nextFrameScene->stage(); - currentScene = nextFrameScene; - nextFrameScene = nullptr; - } - - timeManager.update(); - inputManager.update(); - if(currentScene) currentScene->update(); - renderHost.update(shared_from_this()); -} - -bool_t Game::isCloseRequested() { - return ( - renderHost.isCloseRequested() - ); -} - -std::shared_ptr Game::getCurrentScene() { - return currentScene; -} - -Game::~Game() { - currentScene = nullptr; - nextFrameScene = nullptr; - - assertTrue(SCENE_ITEMS_ACTIVE == 0, "Some scene items are still active?"); - assertTrue(SCENE_COMPONENTS_ACTIVE == 0, "Some scene components are still active?"); -} \ No newline at end of file diff --git a/src/dawn/game/Game.hpp b/src/dawn/game/Game.hpp deleted file mode 100644 index 15772ecf..00000000 --- a/src/dawn/game/Game.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "display/RenderHost.hpp" -#include "input/InputManager.hpp" -#include "time/TimeManager.hpp" -#include "asset/AssetManager.hpp" -#include "locale/LocaleManager.hpp" -#include "save/SaveManager.hpp" - -namespace Dawn { - class Scene; - - class Game : public std::enable_shared_from_this { - private: - std::shared_ptr currentScene = nullptr; - std::shared_ptr nextFrameScene = nullptr; - - public: - RenderHost renderHost; - InputManager inputManager; - TimeManager timeManager; - AssetManager assetManager; - LocaleManager localeManager; - SaveManager saveManager; - - /** - * Constructs the game instance, does not initialize anything. - */ - Game(); - - /** - * Initialize the game and all of its components. - */ - void init(); - - /** - * Performs a single update tick on the game engine, and in turn all of - * the game's sub systems. - */ - void update(); - - /** - * Returns whether the game has been requested to gracefully close at the - * next available opportunity. - * - * @return True if the game should close. - */ - bool_t isCloseRequested(); - - /** - * Returns the current scene that is active. - * - * @return The current scene. - */ - std::shared_ptr getCurrentScene(); - - /** - * Deconstructs the game instance, does not deinitialize anything. - */ - virtual ~Game(); - }; -} \ No newline at end of file diff --git a/src/dawn/game/GameInit.hpp b/src/dawn/game/GameInit.hpp deleted file mode 100644 index fa65ee52..00000000 --- a/src/dawn/game/GameInit.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/Game.hpp" -#include "scene/Scene.hpp" - -namespace Dawn { - class GameInit { - public: - static std::function getInitialScene(); - }; -} \ No newline at end of file diff --git a/src/dawn/input.c b/src/dawn/input.c new file mode 100644 index 00000000..9a75e49e --- /dev/null +++ b/src/dawn/input.c @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "input.h" + +input_t INPUT; + +void inputInit() { + memset(&INPUT, 0, sizeof(input_t)); +} + +void inputUpdate() { + // Update the previous state + memcpy( + INPUT.previousState, + INPUT.currentState, + sizeof(INPUT.previousState) + ); + + // Get the new state + for(inputbind_t i = 0; i < INPUT_BIND_COUNT; i++) { + INPUT.currentState[i] = inputGetState(i); + } +} + +inputstate_t inputIsDown(const inputbind_t bind) { + return INPUT.currentState[bind]; +} + +inputstate_t inputWasPressed(const inputbind_t bind) { + return INPUT.currentState[bind] && !INPUT.previousState[bind]; +} + +inputstate_t inputWasReleased(const inputbind_t bind) { + return !INPUT.currentState[bind] && INPUT.previousState[bind]; +} \ No newline at end of file diff --git a/src/dawn/input.h b/src/dawn/input.h new file mode 100644 index 00000000..69b350f3 --- /dev/null +++ b/src/dawn/input.h @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2023 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +typedef uint8_t inputbind_t; +typedef bool_t inputstate_t; + +#define INPUT_BIND_UP 0x00 +#define INPUT_BIND_DOWN 0x01 +#define INPUT_BIND_LEFT 0x02 +#define INPUT_BIND_RIGHT 0x03 +#define INPUT_BIND_ACCEPT 0x04 +#define INPUT_BIND_CANCEL 0x05 + +#define INPUT_BIND_COUNT (INPUT_BIND_CANCEL + 1) + +typedef struct { + inputstate_t currentState[INPUT_BIND_COUNT]; + inputstate_t previousState[INPUT_BIND_COUNT]; +} input_t; + +extern input_t INPUT; + +/** + * Initializes the input system. + */ +void inputInit(); + +/** + * Updates the input system. + */ +void inputUpdate(); + +/** + * Returns whether or not the given input is down. + * + * @param bind The input to check. + */ +inputstate_t inputIsDown(const inputbind_t bind); + +/** + * Returns whether or not the given input was pressed this update tick. + * + * @param bind The input to check. + */ +inputstate_t inputWasPressed(const inputbind_t bind); + +/** + * Returns whether or not the given input was released this update tick. + * + * @param bind The input to check. + */ +inputstate_t inputWasReleased(const inputbind_t bind); + +/** + * Returns the current state of the given input. Overridden per platform. + * + * @param bind The input to check. + */ +inputstate_t inputGetState(const inputbind_t bind); \ No newline at end of file diff --git a/src/dawn/input/IInputManager.hpp b/src/dawn/input/IInputManager.hpp deleted file mode 100644 index d482c823..00000000 --- a/src/dawn/input/IInputManager.hpp +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "util/Math.hpp" -#include "input/InputBinds.hpp" - -namespace Dawn { - class DawnGame; - - template - class IInputManager { - protected: - std::unordered_map> binds; - std::unordered_map valuesLeft; - std::unordered_map valuesRight; - bool_t currentIsLeft = true; - - /** - * Method to be overwritten by the host, reads a RAW input value from - * the pad/input device directly. - * - * @param axis Axis to get the value of. - * @return The current input value (between 0 and 1). - */ - virtual float_t getInputValue(const T axis) = 0; - - public: - /** - * Binds an axis to a bind. - * - * @param bind Bind to bind the axis to. - * @param axis Axis to use for this bind. - */ - void bind(const enum InputBind bind, const T axis) { - this->binds[bind].push_back(axis); - } - - /** - * Unbind a previously bound axis from a bind. - * - * @param bind Bind to remove all binds from. - */ - void unbind(const enum InputBind bind) { - this->binds[bind].clear(); - } - - /** - * Unbind all values, all of them. - */ - void unbindAll() { - this->binds.clear(); - this->values.clear(); - } - - /** - * Return the current bind value. - * - * @param bind Bind to get the value of. - * @return The current input state (between 0 and 1). - */ - float_t getValue(const enum InputBind bind) { - if(this->currentIsLeft) { - auto exist = this->valuesLeft.find(bind); - return exist == this->valuesLeft.end() ? 0.0f : exist->second; - } else { - auto exist = this->valuesRight.find(bind); - return exist == this->valuesRight.end() ? 0.0f : exist->second; - } - } - - /** - * Return the bind value from the previous frame. - * - * @param bind Bind to get the value of. - * @return The value of the bind, last frame. - */ - float_t getValueLastUpdate(const enum InputBind bind) { - if(this->currentIsLeft) { - auto exist = this->valuesRight.find(bind); - return exist == this->valuesRight.end() ? 0.0f : exist->second; - } else { - auto exist = this->valuesLeft.find(bind); - return exist == this->valuesLeft.end() ? 0.0f : exist->second; - } - } - - /** - * Returns an axis input for a given negative and positive bind. This will - * combine and clamp the values to be between -1 and 1. For example, if - * the negative bind is 100% actuated and positive is not at all actuated, - * then the value will be -1. If instead positive is 50% actuated, then - * the value will be -0.5. If both are equally actuacted, then the value - * will be 0. - * - * @param negative Bind to use for the negative axis. - * @param positive Bind to use for the positive axis. - * @return A value between -1 and 1. - */ - float_t getAxis(const enum InputBind negative, const enum InputBind positive) { - return -getValue(negative) + getValue(positive); - } - - glm::vec2 getAxis2D( - const enum InputBind negativeX, - const enum InputBind positiveX, - const enum InputBind negativeY, - const enum InputBind positiveY - ) { - return glm::vec2( - getAxis(negativeX, positiveX), - getAxis(negativeY, positiveY) - ); - } - - /** - * Returns the 2D Axis for the given binds. - * - * @param x X Axis bind. - * @param y Y Axis bind. - * @return 2D vector of the two given input binds. - */ - glm::vec2 getAxis2D(const enum InputBind x, const enum InputBind y) { - return glm::vec2(getValue(x), getValue(y)); - } - - /** - * Returns true if the given bind is currently being pressed (a non-zero - * value). - * - * @param bind Bind to check if pressed. - * @return True if value is non-zero, or false for zero. - */ - bool_t isDown(const enum InputBind bind) { - return this->getValue(bind) != 0.0f; - } - - /** - * Returns true on the first frame an input was pressed (when the state - * had changed from 0 to non-zero). - * - * @param bind Bind to check if pressed. - * @return True if down this frame and not down last frame. - */ - bool_t isPressed(const enum InputBind bind) { - return this->getValue(bind) != 0 && this->getValueLastUpdate(bind) == 0; - } - - /** - * Returns true on the first frame an input was released (when the state - * had changed from non-zero to 0). - * - * @param bind Bind to check if released. - * @return True if up this frame, and down last frame. - */ - bool_t wasReleased(const enum InputBind bind) { - return this->getValue(bind) == 0 && this->getValueLastUpdate(bind) != 0; - } - - /** - * Internal method to update the input state, checks current input raws - * and decides what values are set for the inputs. - */ - void update() { - auto it = this->binds.begin(); - this->currentIsLeft = !this->currentIsLeft; - - // For each bind... - while(it != this->binds.end()) { - float_t value = 0.0f, valCurrent; - - // For each input axis... - auto bindIt = it->second.begin(); - while(bindIt != it->second.end()) { - // Get value and make the new max. - float_t inputValue = this->getInputValue(*bindIt); - value = Math::max(value, inputValue); - ++bindIt; - } - - // Set into current values - if(this->currentIsLeft) { - valCurrent = this->valuesRight[it->first]; - this->valuesLeft[it->first] = value; - } else { - valCurrent = this->valuesLeft[it->first]; - this->valuesRight[it->first] = value; - } - - // Fire events when necessary. - if(value == 0 && valCurrent == 1) { - // eventBindReleased.invoke(it->first); - } else if(valCurrent == 0 && value == 1) { - // eventBindPressed.invoke(it->first); - } - - ++it; - } - - // TODO: trigger events - } - - virtual ~IInputManager() { - } - }; -} \ No newline at end of file diff --git a/src/dawn/locale/CMakeLists.txt b/src/dawn/locale/CMakeLists.txt deleted file mode 100644 index 7d03642e..00000000 --- a/src/dawn/locale/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - LocaleManager.cpp -) \ No newline at end of file diff --git a/src/dawn/locale/LocaleManager.cpp b/src/dawn/locale/LocaleManager.cpp deleted file mode 100644 index a7ddfd8b..00000000 --- a/src/dawn/locale/LocaleManager.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "LocaleManager.hpp" - -using namespace Dawn; \ No newline at end of file diff --git a/src/dawn/locale/LocaleManager.hpp b/src/dawn/locale/LocaleManager.hpp deleted file mode 100644 index f69e39db..00000000 --- a/src/dawn/locale/LocaleManager.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class LocaleManager final { - private: - - public: - }; -} \ No newline at end of file diff --git a/src/dawn/poker/CMakeLists.txt b/src/dawn/poker/CMakeLists.txt deleted file mode 100644 index bf81e955..00000000 --- a/src/dawn/poker/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Card.cpp - PokerPot.cpp - PokerPlayer.cpp - PokerGame.cpp - PokerWinning.cpp - PokerTurn.cpp -) \ No newline at end of file diff --git a/src/dawn/poker/Card.cpp b/src/dawn/poker/Card.cpp deleted file mode 100644 index c46fecae..00000000 --- a/src/dawn/poker/Card.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Card.hpp" -#include "util/Random.hpp" - -using namespace Dawn; - -void Card::shuffle(std::vector &deck) { - for(uint8_t i = 0; i < deck.size(); i++) { - uint8_t swap = Random::random(0, deck.size() - 1); - struct Card tmp = deck[i]; - deck[i] = deck[swap]; - deck[swap] = tmp; - } -} - -void Card::fillDeck(std::vector &deck) { - deck.clear(); - for(uint8_t i = 0; i < CARD_DECK_SIZE; i++) { - deck.push_back(Card(i)); - } -} - -int32_t Card::contains( - const std::vector &deck, - const struct Card c -) { - if(deck.size() == 0) return -1; - - return std::distance( - deck.begin(), - std::find_if( - deck.begin(), - deck.end(), - [c](struct Card card) { - return card.cardValue == c.cardValue; - } - ) - ); -} - -int32_t Card::containsValue( - const std::vector &deck, - const enum CardValue number -) { - if(deck.size() == 0) return -1; - - return std::distance( - deck.begin(), - std::find_if( - deck.begin(), - deck.end(), - [number](struct Card c) { - return c.getValue() == number; - } - ) - ); -} - -std::vector Card::countPairs( - const std::vector &deck, - const enum CardValue val -) { - std::vector pairs; - - std::for_each( - deck.begin(), - deck.end(), - [&pairs, val](struct Card c) { - if(c.getValue() == val) pairs.push_back(c); - } - ); - - return pairs; -} - -bool_t Card::cardSorter(struct Card left, struct Card right) { - return left.cardValue < right.cardValue; -} - -void Card::sort(std::vector &deck) { - std::sort(deck.begin(), deck.end(), &Card::cardSorter); -} - -enum CardValue Card::getValue() { - return (enum CardValue)(cardValue % CARD_COUNT_PER_SUIT); -} - -enum CardSuit Card::getSuit() { - return (enum CardSuit)(cardValue / CARD_COUNT_PER_SUIT); -} \ No newline at end of file diff --git a/src/dawn/poker/Card.hpp b/src/dawn/poker/Card.hpp deleted file mode 100644 index b5b3ffeb..00000000 --- a/src/dawn/poker/Card.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "assert/assert.hpp" - -namespace Dawn { - enum class CardSuit : uint8_t { - Clubs = 0, - Diamonds = 1, - Hearts = 2, - Spades = 3, - }; - - enum class CardValue : uint8_t { - Two = 0, - Three = 1, - Four = 2, - Five = 3, - Six = 4, - Seven = 5, - Eight = 6, - Nine = 7, - Ten = 8, - Jack = 9, - Queen = 10, - King = 11, - Ace = 12, - Invalid = 0xFF - }; - - /** Count of cards in each suit */ - #define CARD_COUNT_PER_SUIT 13 - - /** Count of suits */ - #define CARD_SUIT_COUNT 4 - - /** Standard Card Deck Size */ - #define CARD_DECK_SIZE CARD_COUNT_PER_SUIT*CARD_SUIT_COUNT - - struct Card { - public: - uint8_t cardValue; - - /** - * Shuffles a hand / deck - * - * @param deck Array of cards to shuffle. - */ - static void shuffle(std::vector &deck); - - /** - * Fills a vector with all of the cards in a deck, in order. - * - * @param deck Deck to fill. - */ - static void fillDeck(std::vector &deck); - - /** - * Check if an array of cards contains a specific card. - * - * @param deck Deck/Hand/Array of cards to check. - * @param card Card to look for - * @returns The index within the array that the card is. -1 if not found. - */ - static int32_t contains( - const std::vector &deck, - const struct Card card - ); - - /** - * Check if the array of cards contains a specific number. - * - * @param deck Array of cards to check - * @param number The number to look for. - * @returns The index that the first card is. -1 if not found. - */ - static int32_t containsValue( - const std::vector &deck, - const enum CardValue number - ); - - /** - * Counts the amount of times a card's number appears within the given - * hand. - * - * @param deck The hand to check - * @param val Value of pairs to find. - * @return Card pairs in the deck. - */ - static std::vector countPairs( - const std::vector &deck, - const enum CardValue val - ); - - /** - * Sorter for the cardSorter function. - * - * @param left Left card to compare. - * @param right Right card to compare. - * @returns True if left is less than right. - */ - static bool_t cardSorter(struct Card left, struct Card right); - - /** - * Sort a hand of cards. Cards are ordered in descending weight, aces are - * high. Cards will be grouped by their suits, e.g. CARD_CLUBS_TWO will - * appear before CARD_DIAMONDS_KING. - * - * @param deck Hand of cards to sort. - */ - static void sort(std::vector &deck); - - /** - * Constructor for the Card class. - * - * @param suit Suit of the card. - * @param num Number of the card. - */ - Card(const CardSuit suit, const CardValue num) : - Card( - ((uint8_t)suit * CARD_COUNT_PER_SUIT) + (uint8_t)num - ) - { - } - - /** - * Constructor for the Card class. - * - * @param cv Card value. - */ - Card(const uint8_t cv) : cardValue(cv) { - } - - /** - * Returns the number of a given card. - * @returns The card number. - */ - enum CardValue getValue(); - - /** - * Returns the suit of a given card. - * @returns The suit. - */ - enum CardSuit getSuit(); - }; - -} \ No newline at end of file diff --git a/src/dawn/poker/PokerGame.cpp b/src/dawn/poker/PokerGame.cpp deleted file mode 100644 index 0782a00c..00000000 --- a/src/dawn/poker/PokerGame.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerGame.hpp" - -using namespace Dawn; - -std::shared_ptr PokerGame::addNewPlayer() { - auto player = std::make_shared( - weak_from_this(), this->players.size() - ); - assertFalse(this->players.size() == PLAYER_COUNT_MAX, "Too many players."); - this->players.push_back(player); - return player; -} - -std::shared_ptr PokerGame::getCurrentBetter() { - auto nextIndex = this->getNextBetterIndex(); - if(nextIndex == 0xFF) return nullptr; - return this->players[nextIndex]; -} - -void PokerGame::newGame() { - assertTrue(this->players.size() >= PLAYER_COUNT_MIN, "Not enough players."); - this->newRound(); - this->smallBlind = POKER_BLIND_SMALL_DEFAULT; - this->bigBlind = POKER_BLIND_BIG_DEFAULT; - - auto it = this->players.begin(); - while(it != this->players.end()) { - auto player = *it; - player->setChips(POKER_PLAYER_CHIPS_DEFAULT); - player->isOut = false; - ++it; - } - - this->setDealer(0x00); -} - -void PokerGame::newRound() { - this->deck.clear(); - Card::fillDeck(this->deck); - - this->grave.clear(); - this->community.clear(); - this->pots.clear(); - this->pots.push_back(PokerPot()); - - this->hasFlopped = false; - this->hasTurned = false; - this->hasRivered = false; - - auto it = this->players.begin(); - while(it != this->players.end()) { - auto player = *it; - player->hand.clear(); - player->currentBet = 0; - player->isFolded = false; - player->isShowingHand = false; - player->hasBetThisRound = false; - player->timesRaised = 0; - player->currentBet = 0; - ++it; - } - - this->setDealer(this->dealerIndex + 0x01); -} - -void PokerGame::newBettingRound() { - auto it = this->players.begin(); - while(it != this->players.end()) { - auto player = *it; - player->hasBetThisRound = false; - player->timesRaised = 0; - ++it; - } - - this->betterIndex = this->bigBlindIndex; - this->betterIndex = this->getNextBetterIndex(); -} - -uint8_t PokerGame::getNextBetterIndex() { - uint8_t j, i; - for(i = 0; i < this->players.size(); i++) { - j = (i + this->betterIndex) % this->players.size(); - auto player = this->players[j]; - if(player->needsToBetThisRound()) return j; - } - return 0xFF; -} - -void PokerGame::takeBlinds() { - auto playerSmallBlind = this->players[this->smallBlindIndex]; - auto playerBigBlind = this->players[this->bigBlindIndex]; - - playerSmallBlind->bet(this->smallBlind); - playerBigBlind->bet(this->bigBlind); - - playerSmallBlind->hasBetThisRound = false; - playerBigBlind->hasBetThisRound = false; -} - -void PokerGame::setDealer(const uint8_t dealer) { - uint8_t i, k; - std::shared_ptr player; - bool_t foundDealer; - bool_t foundSmall; - - foundDealer = false; - foundSmall = false; - this->dealerIndex = dealer; - - for(i = 0; i < this->players.size(); i++) { - k = (dealer + i) % this->players.size(); - player = this->players[k]; - if(player->isOut) continue; - if(!foundDealer) { - this->dealerIndex = k; - foundDealer = true; - } else if(!foundSmall) { - this->smallBlindIndex = k; - foundSmall = true; - } else { - this->bigBlindIndex = k; - break; - } - } -} - -uint8_t PokerGame::getRemainingBettersCount() { - uint8_t count = 0; - auto it = this->players.begin(); - while(it != this->players.end()) { - if((*it)->needsToBetThisRound()) count++; - ++it; - } - return count; -} - -uint8_t PokerGame::getRemainingPlayersCount() { - uint8_t count = 0; - auto it = this->players.begin(); - while(it != this->players.end()) { - if(!(*it)->isFolded && !(*it)->isOut) count++; - ++it; - } - return count; -} - -int32_t PokerGame::getCurrentCallValue() { - assertTrue(this->pots.size() > 0, "No pots?"); - return this->pots.back().call; -} - -void PokerGame::burnCard() { - assertTrue(this->deck.size() > 0, "No cards to burn."); - auto card = this->deck.back(); - this->deck.pop_back(); - this->grave.push_back(card); -} - -void PokerGame::dealCard(PokerPlayer &player) { - assertTrue(this->deck.size() > 0, "No cards to deal."); - auto card = this->deck.back(); - this->deck.pop_back(); - player.hand.push_back(card); -} - -void PokerGame::dealToEveryone(const uint8_t count) { - for(uint8_t i = 0; i < count; i++) { - auto it = this->players.begin(); - while(it != this->players.end()) { - this->dealCard(*(*it)); - ++it; - } - } -} - -void PokerGame::turn(const uint8_t count) { - uint8_t c = count; - if(c == 0xFF) c = this->getCountOfCardsToTurn(); - assertTrue(this->deck.size() >= c, "Not enough cards to turn."); - for(uint8_t i = 0; i < c; i++) { - auto card = this->deck.back(); - this->deck.pop_back(); - this->community.push_back(card); - } -} - -uint8_t PokerGame::getCountOfCardsToTurn() { - if(!this->hasFlopped) return 3; - if(!this->hasTurned) return 1; - if(!this->hasRivered) return 1; - assertUnreachable("No more cards to turn."); -} \ No newline at end of file diff --git a/src/dawn/poker/PokerGame.hpp b/src/dawn/poker/PokerGame.hpp deleted file mode 100644 index beeb99cf..00000000 --- a/src/dawn/poker/PokerGame.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerPlayer.hpp" - -/** The default blind cost for the big blind. */ -#define POKER_BLIND_BIG_DEFAULT 600 -/** The default blind cost for the small blind. (Defaults half big blind) */ -#define POKER_BLIND_SMALL_DEFAULT (POKER_BLIND_BIG_DEFAULT/2) - -/** How many cards are dealt for the flop, turn and river */ -#define POKER_FLOP_CARD_COUNT 3 -#define POKER_TURN_CARD_COUNT 1 -#define POKER_RIVER_CARD_COUNT 1 - -#define PLAYER_COUNT_MAX 8 -#define PLAYER_COUNT_MIN 2 - -namespace Dawn { - class PokerGame : public std::enable_shared_from_this { - protected: - std::vector deck; - std::vector grave; - uint8_t dealerIndex; - uint8_t smallBlindIndex; - uint8_t bigBlindIndex; - int32_t smallBlind = POKER_BLIND_SMALL_DEFAULT; - int32_t bigBlind = POKER_BLIND_BIG_DEFAULT; - - bool_t hasFlopped = false; - bool_t hasTurned = false; - bool_t hasRivered = false; - - public: - std::vector> players; - std::vector pots; - std::vector community; - uint8_t betterIndex; - - /** - * Creates and adds a new player to the game. - */ - std::shared_ptr addNewPlayer(); - - /** - * Returns the player that is currently the better. - * - * @return The player that is currently the better. - */ - std::shared_ptr getCurrentBetter(); - - /** - * Starts a new game of poker. - */ - void newGame(); - - /** - * Starts a new round of poker. - */ - void newRound(); - - /** - * Starts a new betting round. - */ - void newBettingRound(); - - /** - * Takes the blinds from the players. - */ - void takeBlinds(); - - /** - * Sets the blinds for the game. - * - * @param small The cost of the small blind. - * @param big The cost of the big blind. - */ - void setBlinds(const int32_t small, const int32_t big); - - /** - * Returns the count of players that still need to bet this round. - * - * @return The count of players that still need to bet this round. - */ - uint8_t getRemainingBettersCount(); - - /** - * Returns the current call value for the game. - * - * @return The current call value for the game. - */ - int32_t getCurrentCallValue(); - - /** - * Returns the next better index. - * - * @return The next better index. - */ - uint8_t getNextBetterIndex(); - - /** - * Sets the dealer for the game. - * - * @param dealer The index of the dealer. - */ - void setDealer(const uint8_t dealer); - - /** - * Sends a card to the burn pile. - */ - void burnCard(); - - /** - * Deals a card to a player. - * - * @param player The player to deal the card to. - */ - void dealCard(PokerPlayer &player); - - /** - * Deals a card to each player. - * - * @param count The count of cards to deal. - */ - void dealToEveryone(const uint8_t count); - - /** - * Deals a card to the community. - * - * @param count The count of cards to turn. - */ - void turn(const uint8_t count = 0xFF); - - /** - * Returns the count of cards that need to be turned. - * - * @return The count of cards that need to be turned. - */ - uint8_t getCountOfCardsToTurn(); - - /** - * Returns the count of players that are still in the game. - * - * @return The count of players that are still in the game. - */ - uint8_t getRemainingPlayersCount(); - }; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerPlayer.cpp b/src/dawn/poker/PokerPlayer.cpp deleted file mode 100644 index c09fd776..00000000 --- a/src/dawn/poker/PokerPlayer.cpp +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerPlayer.hpp" -#include "PokerGame.hpp" -#include "util/Math.hpp" -#include "util/Random.hpp" -#include "util/Easing.hpp" - -using namespace Dawn; - -PokerPlayer::PokerPlayer( - const std::weak_ptr pokerGame, - const uint8_t playerIndex -) { - this->pokerGame = pokerGame; - this->playerIndex = playerIndex; - this->chips = POKER_PLAYER_CHIPS_DEFAULT; -} - -void PokerPlayer::addChips(const int32_t chips) { - assertTrue(chips > 0, "Must add a positive amount of chips."); - - this->chips += chips; - if(this->chips > 0) this->isOut = false; - - this->eventChipsChanged.emit(); -} - -void PokerPlayer::setChips(const int32_t chips) { - this->chips = 0; - this->addChips(chips); -} - -bool_t PokerPlayer::needsToBetThisRound() { - if(this->isFolded) return false; - if(this->chips <= 0) return false; - if(!this->hasBetThisRound) return true; - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - if(this->currentBet < pg->getCurrentCallValue()) return true; - return false; -} - -void PokerPlayer::bet( - struct PokerPot &pot, - const int32_t chips -) { - assertTrue(chips >= 0, "Chips must be a positive value."); - assertTrue(!this->isFolded, "Cannot bet if player is folded."); - assertTrue(!this->isOut, "Cannot bet if player is out."); - - this->setChips(this->chips - chips); - this->currentBet += chips; - this->hasBetThisRound = true; - if(chips > 0) { - this->timesRaised++; - } else { - this->timesRaised = 0; - } - - pot.chips += chips; - pot.call = Math::max(pot.call, this ->currentBet); - - auto existing = std::find(pot.players.begin(), pot.players.end(), shared_from_this()); - if(existing == pot.players.end()) pot.players.push_back(shared_from_this()); -} - -void PokerPlayer::bet(const int32_t chips) { - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - assertTrue(pg->pots.size() > 0, "PokerGame has no pots?"); - this->bet(pg->pots.back(), chips); -} - -void PokerPlayer::fold() { - this->isFolded = true; - this->hasBetThisRound = true; - this->timesRaised = 0; -} - -bool_t PokerPlayer::canCheck() { - if(this->isFolded) return false; - if(this->isOut) return false; - - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - return pg->getCurrentCallValue() == this->currentBet; -} - -struct PokerTurn PokerPlayer::getAITurn() { - struct PokerTurn turn; - float_t confidence; - int32_t callBet; - float_t potOdds; - - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - - // Can the player do anything? - if(this->isFolded || this->isOut) { - turn.type = PokerTurnType::Out; - return turn; - } - - // The following logic is heavily inspired by; - // https://github.com/gorel/C-Poker-AI/blob/master/src/common/pokerai.c - // But with some changes and smarts added by me. The original source code will - // essentially just run a crap tun of simulated games and get the times that - // they are expected to win from those games, but I'm just going to use the - // odds of the winning hand. - - - // Is this preflop? - if(pg->community.size() == 0) { - assertTrue( - this->hand.size() == POKER_PLAYER_HAND_SIZE_MAX, - "Invalid hand size." - ); - - // Get the hand weight - auto cardNumber0 = this->hand[0].getValue(); - auto suitNumber0 = this->hand[0].getSuit(); - auto cardNumber1 = this->hand[1].getValue(); - auto suitNumber1 = this->hand[1].getSuit(); - - // Get delta between cards - auto i = (uint8_t)Math::abs( - (int8_t)cardNumber0 - (int8_t)cardNumber1 - ); - - // Get card weight - confidence = (float_t)cardNumber0 + (float_t)cardNumber1; - if(cardNumber0 == cardNumber1) {// Pairs - confidence += 6; - } else if(suitNumber0 == suitNumber1) {// Same suit - confidence += 4; - } - - // Get difference from cards for guessing flush - if(i > 4) { - confidence -= 4; - } else if(i > 2) { - confidence -= i; - } - - // Get the confidence delta 0-1 - confidence = confidence / 30.0f; - - // This may change in future, but I was finding the AI did not want to bet - // during the preflop enough, this curves the AI to want to preflop call - // often. - confidence = Easing::easeOutCubic(confidence); - } else { - // Simulate my hand being the winning hand, use that as the confidence - auto winning = this->getWinning(); - confidence = PokerWinning::getWinningTypeConfidence(winning.type); - } - - // Now we know how confident the AI is, let's put a chip value to that weight - // How many chips to call? - callBet = this->getCallBet(); - - // Do they need chips to call, or is it possible to check? - if(callBet > 0) { - potOdds = (float_t)callBet / ( - (float_t)callBet + - (float_t)this->getSumOfChips() - ); - } else { - potOdds = 1.0f / (float_t)pg->getRemainingBettersCount(); - } - - // Now determine the expected ROI - auto expectedGain = confidence / potOdds; - - // Now get a random 0-100 - auto random = Random::random() % 100; - - // Determine the max bet that the AI is willing to make - auto maxBet = (int32_t)((float_t)this->chips / 1.75f) - (random / 2); - maxBet -= callBet; - - // Determine what's a good bluff bet. - auto bluffBet = random * maxBet / 100 / 2; - - // Now prep the output - auto isBluff = false; - auto amount = 0; - - // Now the actual AI can happen. This is basically a weight to confidence - // ratio. The higher the gains and the confidence then the more likely the AI - // is to betting. There are also bluff chances within here. - if(expectedGain < 0.8f && confidence < 0.8f) { - if(random < 85) { - amount = 0; - } else { - amount = bluffBet; - isBluff = true; - } - } else if((expectedGain < 1.0f && confidence < 0.85f) || confidence < 0.1f) { - if(random < 80) { - amount = 0; - } else if(random < 5) { - amount = callBet; - isBluff = true; - } else { - amount = bluffBet; - isBluff = true; - } - } else if((expectedGain < 1.3f && confidence < 0.9f) || confidence < 0.5f) { - if(random < 60 || confidence < 0.5f) { - amount = callBet; - } else { - amount = maxBet; - } - } else if(confidence < 0.95f || pg->community.size() < 4) { - if(random < 20) { - amount = callBet; - } else { - amount = maxBet; - } - } else { - amount = (this->chips - callBet) * 9 / 10; - } - - // TODO: We can nicely round the amounts here to get us to a more "human" - // number. - - // If this is the first round... make it a lot less likely I'll bet - if(pg->community.size() == 0 && amount > callBet) { - if(random > 5) amount = callBet; - } - - // Did we actually bet? - if(amount > 0) { - std::cout << "AI is betting " << amount << " chips, bluff:" << isBluff << std::endl; - - // Let's not get caught in a raising loop with AI. - if(this->timesRaised >= POKER_PLAYER_MAX_RAISES) { - amount = callBet; - } - - amount = Math::max(amount, callBet); - turn = PokerTurn::bet(shared_from_this(), amount); - turn.confidence = confidence; - } else if(this->canCheck()) { - turn = PokerTurn::bet(shared_from_this(), 0); - turn.confidence = 1; - } else { - turn = PokerTurn::fold(shared_from_this()); - turn.confidence = 1 - confidence; - } - - return turn; -} - -int32_t PokerPlayer::getCallBet() { - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - return pg->getCurrentCallValue() - this->currentBet; -} - -int32_t PokerPlayer::getSumOfChips() { - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - int32_t count = 0; - auto it = pg->pots.begin(); - while(it != pg->pots.end()) { - if(std::find( - it->players.begin(), it->players.end(), shared_from_this() - ) != it->players.end()) { - count += it->chips; - } - ++it; - } - return count; -} - -struct PokerWinning PokerPlayer::getWinning() { - struct PokerWinning winning; - struct Card card(0x00); - uint8_t i, j; - int32_t index; - enum CardValue number, look; - enum CardSuit suit; - std::vector pairs; - - auto pg = this->pokerGame.lock(); - assertNotNull(pg, "PokerGame has become invalid."); - - winning.player = shared_from_this(); - - // Get the full poker hand (should be a 7 card hand, but MAY not be) - for(i = 0; i < pg->community.size(); i++) { - winning.full.push_back(pg->community[i]); - } - for(i = 0; i < this->hand.size(); i++) { - winning.full.push_back(this->hand[i]); - } - Card::sort(winning.full); - - //////////////////////// Now look for the winning set //////////////////////// - - // Royal / Straight Flush - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i]; - number = card.getValue(); - if(number < CardValue::Five) continue; - - suit = card.getSuit(); - - winning.set.clear(); - winning.set.push_back(card); - - // Now look for the matching cards (Reverse order to order from A to 10) - for(j = 1; j <= 4; j++) { - // Ace low. - look = ( - number == CardValue::Five && j == 4 ? - (enum CardValue)CardValue::Ace : - (enum CardValue)((uint8_t)number - j) - ); - index = Card::contains(winning.full, Card(suit, look)); - if(index == -1) break; - winning.set.push_back(winning.full[index]); - } - - // Check if has all necessary cards. - if(winning.set.size() < POKER_WINNING_SET_SIZE) continue; - - // Add self to array - winning.type = ( - number == CardValue::Ace ? PokerWinningType::RoyalFlush : - PokerWinningType::StraightFlush - ); - winning.fillRemaining(); - return winning; - } - - // Four of a kind. - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i]; - number = card.getValue(); - pairs = Card::countPairs(winning.full, number); - if(pairs.size() < CARD_SUIT_COUNT) continue; - - winning.set = pairs; - winning.type = PokerWinningType::FourOfAKind; - winning.fillRemaining(); - return winning; - } - - // Full House - winning.set.clear(); - for(i = 0; i < winning.full.size(); i++) { - // Check we haven't already added this card. - card = winning.full[i]; - if(Card::contains(winning.set, card) != -1) { - continue; - } - - number = card.getValue(); - pairs = Card::countPairs(winning.full, number); - - // Did we find either two pair or three pair? - if(pairs.size() != 2 && pairs.size() != 3) continue; - if(winning.set.size() == 3) {//Clamp to 5 max. - pairs.pop_back(); - } - - // Copy found pairs. - for(j = 0; j < pairs.size(); j++) { - winning.set.push_back(pairs[j]); - } - - // Winned? - if(winning.set.size() != POKER_WINNING_SET_SIZE) continue; - winning.type = PokerWinningType::FullHouse; - winning.fillRemaining(); - return winning; - } - - // Flush (5 same suit) - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i]; - suit = card.getSuit(); - - winning.set.clear(); - winning.set.push_back(card); - - for(j = i+1; j < winning.full.size(); j++) { - if(winning.full[j].getSuit() != suit) continue; - winning.set.push_back(winning.full[j]); - if(winning.set.size() == POKER_WINNING_SET_SIZE) break; - } - if(winning.set.size() < POKER_WINNING_SET_SIZE) continue; - winning.type = PokerWinningType::Flush; - winning.fillRemaining(); - return winning; - } - - // Straight (sequence any suit) - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i]; - number = card.getValue(); - if(number < CardValue::Five) continue; - - winning.set.clear(); - winning.set.push_back(card); - - for(j = 1; j <= 4; j++) { - // Ace low. - look = ( - number == CardValue::Five && j == 4 ? - (enum CardValue)CardValue::Ace : - (enum CardValue)((uint8_t)number - j) - ); - index = Card::containsValue(winning.full, look); - if(index == -1) break; - winning.set.push_back(winning.full[index]); - } - - // Check if has all necessary cards. - if(winning.set.size() < POKER_WINNING_SET_SIZE) continue; - winning.type = PokerWinningType::Straight; - winning.fillRemaining(); - return winning; - } - - // Three of a kind - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i]; - number = card.getValue(); - pairs = Card::countPairs(winning.full, number); - if(pairs.size() != 3) continue; - - winning.set = pairs; - winning.type = PokerWinningType::ThreeOfAKind; - winning.fillRemaining(); - return winning; - } - - // Two Pair - winning.set.clear(); - for(i = 0; i < winning.full.size(); i++) { - card = winning.full[i];// Check we haven't already added this card. - if( - winning.set.size() > 0 && - Card::contains(winning.set, card) != -1 - ) { - continue; - } - - number = card.getValue(); - pairs = Card::countPairs(winning.full, number); - if(pairs.size() != 2) continue; - for(j = 0; j < pairs.size(); j++) { - winning.set.push_back(pairs[j]); - } - if(winning.set.size() != 4) continue; - winning.type = PokerWinningType::TwoPair; - winning.fillRemaining(); - return winning; - } - - // Pair - if(winning.set.size() == 2) { - winning.type = PokerWinningType::Pair; - winning.fillRemaining(); - return winning; - } - - // High card - winning.set.clear(); - winning.fillRemaining(); - winning.type = PokerWinningType::HighCard; - return winning; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerPlayer.hpp b/src/dawn/poker/PokerPlayer.hpp deleted file mode 100644 index 35f597bc..00000000 --- a/src/dawn/poker/PokerPlayer.hpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "Card.hpp" -#include "PokerPot.hpp" -#include "PokerWinning.hpp" -#include "PokerTurn.hpp" -#include "event/Event.hpp" - -#define POKER_PLAYER_CHIPS_DEFAULT 10000 - -/** Maximum cards a players' hand can hold */ -#define POKER_PLAYER_HAND_SIZE_MAX 2 - -#define POKER_PLAYER_MAX_RAISES 0x02 - -namespace Dawn { - class PokerGame; - - class PokerPlayer : public std::enable_shared_from_this { - public: - std::weak_ptr pokerGame; - uint8_t playerIndex; - int32_t chips = 0; - int32_t currentBet = 0; - uint8_t timesRaised = 0; - bool_t isFolded = false; - bool_t isOut = false; - bool_t hasBetThisRound = false; - bool_t isShowingHand = false; - bool_t isHuman = false; - std::vector hand; - - Event<> eventChipsChanged; - - /** - * Constructor for the PokerPlayer class. - * - * @param pokerGame Poker game this player is a part of. - * @param playerIndex Index of the player in the game. - */ - PokerPlayer( - const std::weak_ptr pokerGame, - const uint8_t playerIndex - ); - - /** - * Adds chips to the player. This will also update the players' state. - * - * @param chips Count of chips to add. - */ - void addChips(const int32_t chips); - - /** - * Sets the chips a player has. - * - * @param chips Chips to set to the player. - */ - void setChips(const int32_t chips); - - /** - * Returns true if the player still needs to bet this betting round. - * - * @return True if betting is still required by this player. - */ - bool_t needsToBetThisRound(); - - /** - * Let a player bet chips into the pot. - * - * @param pot Poker pot to bet in to. - * @param amount The amount of chips the player is betting. - */ - void bet(struct PokerPot &pot, const int32_t amount); - - /** - * Let a player bet chips into the current pot. - * - * @param amount The amount of chips the player is betting. - */ - void bet(const int32_t amount); - - /** - * Player folds. - */ - void fold(); - - /** - * Returns the AI result for a turn done by a non human player. - * - * @return Some information about the move the player is trying to perform - */ - struct PokerTurn getAITurn(); - - /** - * Calculates and returns the winning state for a given player - * - * @return The winning state for this current players hand. - */ - struct PokerWinning getWinning(); - - /** - * Returns the sum of chips in the pot(s) that the specified player is in. - * This does not consider the pot, player or hand, just the pure sum of - * chips. - * - * @return The sum of chips from the pots the player is within. - */ - int32_t getSumOfChips(); - - /** - * Get the bet necessary for a specific player to make a call. This takes - * the players current bet and the bet necessary to call into the pot and - * will return the difference. - * - * @return The count of chips needed to call into the current active pot. - */ - int32_t getCallBet(); - - /** - * Returns whether or not the player can check, or if they need to either - * fold, call or bet. - * - * @return True if they can check. - */ - bool_t canCheck(); - }; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerPot.cpp b/src/dawn/poker/PokerPot.cpp deleted file mode 100644 index 4f1ad30b..00000000 --- a/src/dawn/poker/PokerPot.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerPot.hpp" -#include "PokerGame.hpp" -#include "PokerPlayer.hpp" - -using namespace Dawn; - -void PokerPotWinning::award() { - auto it = this->winners.begin(); - while(it != this->winners.end()) { - if(it == this->winners.begin()) { - (*it)->addChips(this->chipsEach + this->chipsOverflow); - } else { - (*it)->addChips(this->chipsEach); - } - ++it; - } -} - -struct PokerPotWinning PokerPot::getWinners() { - struct PokerPotWinning winning; - - winning.pot = this; - - // Calculate the winnings first. - auto it = this->players.begin(); - while(it != this->players.end()) { - auto player = *it; - - if(player->isOut || player->isFolded) { - ++it; - continue; - } - - winning.participants.push_back(player); - winning.winnings[player] = player->getWinning(); - ++it; - } - - // Compare participating players - auto it2 = winning.participants.begin(); - while(it2 != winning.participants.end()) { - auto playerLeft = *it2; - auto winnerLeft = &winning.winnings[playerLeft]; - bool_t isWinner = true; - enum CardValue highNumber = CardValue::Invalid; - enum CardValue number = CardValue::Invalid; - struct Card highCard(0xFF); - struct Card card(0xFF); - - auto it3 = winning.participants.begin(); - while(it3 != winning.participants.end()) { - if(it2 == it3) { - ++it3; - continue; - } - - auto playerRight = *it3; - auto winnerRight = &winning.winnings[playerRight]; - - // Am I the better hand / Is it the better hand? - if(winnerLeft->type < winnerRight->type) { - ++it3; - continue; - } - if(winnerLeft->type > winnerRight->type) { - isWinner = false; - break; - } - - // Equal, compare hands. - card = PokerWinning::compare(*winnerLeft, *winnerRight); - if(card.cardValue == 0xFF) { - isWinner = false; - break; - } - - // Determine high card. - number = card.getValue(); - if( - highNumber == CardValue::Invalid || - number == CardValue::Ace || - number > highNumber - ) { - highCard = card; - highNumber = number; - } - ++it3; - } - - if(!isWinner) { - ++it2; - continue; - } - - winnerLeft->kicker = highCard; - winning.winners.push_back(playerLeft); - ++it2; - } - - winning.chipsEach = this->chips / (int32_t)winning.winners.size(); - winning.chipsOverflow = this->chips - ( - winning.chipsEach * (int32_t)winning.winners.size() - ); - - return winning; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerPot.hpp b/src/dawn/poker/PokerPot.hpp deleted file mode 100644 index 5843ca95..00000000 --- a/src/dawn/poker/PokerPot.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "PokerWinning.hpp" - -namespace Dawn { - class PokerPlayer; - class PokerGame; - struct PokerPot; - - struct PokerPotWinning { - public: - std::map, struct PokerWinning> winnings; - std::vector> winners; - std::vector> participants; - struct PokerPot *pot; - int32_t chipsEach; - int32_t chipsOverflow; - - void award(); - }; - - struct PokerPot { - public: - int32_t chips; - int32_t call; - std::vector> players; - - /** - * Get the winners of the pot. - * - * @return The winning state of the pot. - */ - struct PokerPotWinning getWinners(); - }; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerTurn.cpp b/src/dawn/poker/PokerTurn.cpp deleted file mode 100644 index e9425cc7..00000000 --- a/src/dawn/poker/PokerTurn.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerTurn.hpp" -#include "PokerPlayer.hpp" -#include "PokerGame.hpp" - -using namespace Dawn; - -struct PokerTurn PokerTurn::bet( - std::shared_ptr player, - const int32_t chips -) { - struct PokerTurn turn; - int32_t i; - - assertNotNull(player, "Player cannot be null."); - assertTrue(chips >= 0, "Chips must be greater than or equal to 0."); - - turn.player = player; - turn.confidence = 1; - - if(chips == 0) { - turn.type = PokerTurnType::Check; - turn.chips = 0; - } else if(player->chips <= chips) { - turn.chips = player->chips; - turn.type = PokerTurnType::AllIn; - } else { - turn.chips = chips; - turn.type = PokerTurnType::Bet; - - auto pg = player->pokerGame.lock(); - assertNotNull(pg, "Player must be in a game."); - - i = pg->getCurrentCallValue(); - - if(chips == (i - player->currentBet)) turn.type = PokerTurnType::Call; - } - - return turn; -} - -struct PokerTurn PokerTurn::fold(std::shared_ptr player) { - struct PokerTurn turn; - turn.player = player; - turn.chips = 0; - turn.confidence = 1; - turn.type = PokerTurnType::Fold; - return turn; -} - -void PokerTurn::action() { - assertNotNull(this->player, "Player cannot be null."); - - switch(this->type) { - case PokerTurnType::Bet: - case PokerTurnType::Call: - case PokerTurnType::AllIn: - this->player->bet(this->chips); - break; - - case PokerTurnType::Check: - player->bet(0); - break; - - case PokerTurnType::Fold: - player->fold(); - break; - - default: - assertUnreachable("Unknown turn type."); - break; - } -} \ No newline at end of file diff --git a/src/dawn/poker/PokerTurn.hpp b/src/dawn/poker/PokerTurn.hpp deleted file mode 100644 index d1a414c7..00000000 --- a/src/dawn/poker/PokerTurn.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class PokerPlayer; - - enum class PokerTurnType : uint8_t { - Out = 0, - Fold = 1, - Bet = 2, - Call = 3, - Check = 4, - AllIn = 5 - }; - - struct PokerTurn { - public: - /** What type of action the turn is */ - enum PokerTurnType type; - /** How many chips they did in their turn (if applicable) */ - int32_t chips; - /** How confident the AI is about their turn. 0 = none, 1 = full */ - float_t confidence; - /** Player that this action belongs to */ - std::shared_ptr player; - - /** - * Generate a turn action for betting as a player. - * - * @param player Player index who is betting. - * @param chips Chips to raise by. - * @return A turn for a bet action. - */ - static struct PokerTurn bet( - std::shared_ptr player, const int32_t chips - ); - - /** - * Return a turn action for the given player to fold. - * - * @return A turn for a fold action. - */ - static struct PokerTurn fold(std::shared_ptr player); - - /** - * Actions / Performs this turn against the defined player. - */ - void action(); - }; -} \ No newline at end of file diff --git a/src/dawn/poker/PokerWinning.cpp b/src/dawn/poker/PokerWinning.cpp deleted file mode 100644 index 76932707..00000000 --- a/src/dawn/poker/PokerWinning.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PokerWinning.hpp" -#include "PokerPlayer.hpp" - -using namespace Dawn; - -float_t PokerWinning::getWinningTypeConfidence(enum PokerWinningType type) { - switch(type) { - case PokerWinningType::RoyalFlush: - return POKER_WINNING_CONFIDENCE_ROYAL_FLUSH; - case PokerWinningType::StraightFlush: - return POKER_WINNING_CONFIDENCE_STRAIGHT_FLUSH; - case PokerWinningType::FourOfAKind: - return POKER_WINNING_CONFIDENCE_FOUR_OF_A_KIND; - case PokerWinningType::FullHouse: - return POKER_WINNING_CONFIDENCE_FULL_HOUSE; - case PokerWinningType::Flush: - return POKER_WINNING_CONFIDENCE_FLUSH; - case PokerWinningType::Straight: - return POKER_WINNING_CONFIDENCE_STRAIGHT; - case PokerWinningType::ThreeOfAKind: - return POKER_WINNING_CONFIDENCE_THREE_OF_A_KIND; - case PokerWinningType::TwoPair: - return POKER_WINNING_CONFIDENCE_TWO_PAIR; - case PokerWinningType::Pair: - return POKER_WINNING_CONFIDENCE_PAIR; - default: - return POKER_WINNING_CONFIDENCE_HIGH_CARD; - } -} - -struct Card PokerWinning::compare( - const struct PokerWinning &left, - const struct PokerWinning &right -) { - uint8_t i; - enum CardValue number = CardValue::Invalid; - enum CardValue highNumberLeft = CardValue::Invalid; - enum CardValue highNumberRight = CardValue::Invalid; - struct Card card(0xFF), highCardLeft(0xFF), highCardRight(0xFF); - int32_t index; - uint8_t countCardsSame; - - countCardsSame = 0; - - for(i = 0; i < left.set.size(); i++) { - card = left.set[i]; - number = card.getValue(); - // Quick check - if(highNumberLeft != CardValue::Invalid && number < highNumberLeft) continue; - - // Check if this number is within the other hand or not - index = Card::containsValue(right.set, number); - if(index != -1) { - // This number IS within the other hand, let's check that the EXACT card - // is a match/isn't a match. - index = Card::contains(right.set, card); - - // Exact card match - if(index != -1) { - countCardsSame++; - continue; - } - // Not exact card match.. ? - } - - if( - highNumberLeft == CardValue::Invalid || - number == CardValue::Ace || - highNumberLeft < number - ) { - highNumberLeft = number; - highCardLeft = card; - } - } - - for(i = 0; i < right.set.size(); i++) { - card = right.set[i]; - number = card.getValue(); - if(highNumberRight != CardValue::Invalid && number < highNumberRight) { - continue; - } - - index = Card::containsValue(left.set, number); - if(index != -1) { - index = Card::contains(left.set, card); - if(index != -1) continue; - } - - if( - highNumberRight == CardValue::Invalid || - number == CardValue::Ace || highNumberRight < number - ) { - highNumberRight = number; - highCardRight = card; - } - } - - - if(countCardsSame == left.set.size()) { - for(i = 0; i < left.set.size(); i++) { - card = left.set[i]; - number = card.getValue(); - if( - highNumberLeft == CardValue::Invalid || - number == CardValue::Ace || - highNumberLeft < number - ) { - highNumberLeft = number; - highCardLeft = card; - } - } - return highCardLeft; - } - - if(highCardLeft.cardValue == 0xFF) return 0xFF; - if(highNumberLeft < highNumberRight) return 0xFF; - return highCardLeft;// Greater or Equal to. -} - -void PokerWinning::fillRemaining() { - uint8_t i; - CardValue highest, current; - struct Card highestCard(0x00); - struct Card currentCard(0x00); - - // Set the kicker - this->kicker = 0xFF; - - // Fill the remaining cards - while(this->set.size() < POKER_WINNING_SET_SIZE) { - highest = CardValue::Invalid; - - for(i = 0; i < this->full.size(); i++) { - currentCard = this->full[i]; - if(Card::contains(this->set, currentCard) != -1) continue; - - if(highest == CardValue::Invalid) { - highestCard = currentCard; - highest = highestCard.getValue(); - } else { - current = currentCard.getValue(); - if(current != CardValue::Ace && current < highest) continue; - highestCard = currentCard; - highest = current; - } - } - - if(highest == CardValue::Invalid) break; - this->set.push_back(highestCard); - } - Card::sort(this->set); -} \ No newline at end of file diff --git a/src/dawn/poker/PokerWinning.hpp b/src/dawn/poker/PokerWinning.hpp deleted file mode 100644 index b560cb4c..00000000 --- a/src/dawn/poker/PokerWinning.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "Card.hpp" - -#define POKER_WINNING_CONFIDENCE_ROYAL_FLUSH 1.0f -#define POKER_WINNING_CONFIDENCE_STRAIGHT_FLUSH 0.99f -#define POKER_WINNING_CONFIDENCE_FOUR_OF_A_KIND 0.9f -#define POKER_WINNING_CONFIDENCE_FULL_HOUSE 0.85f -#define POKER_WINNING_CONFIDENCE_FLUSH 0.8f -#define POKER_WINNING_CONFIDENCE_STRAIGHT 0.7f -#define POKER_WINNING_CONFIDENCE_THREE_OF_A_KIND 0.5f -#define POKER_WINNING_CONFIDENCE_TWO_PAIR 0.4f -#define POKER_WINNING_CONFIDENCE_PAIR 0.2f -#define POKER_WINNING_CONFIDENCE_HIGH_CARD 0.1f - -/** How many cards in the winning set */ -#define POKER_WINNING_SET_SIZE 5 - -namespace Dawn { - class PokerPlayer; - - enum class PokerWinningType { - Null, - RoyalFlush, - StraightFlush, - FourOfAKind, - FullHouse, - Flush, - Straight, - ThreeOfAKind, - TwoPair, - Pair, - HighCard - }; - - struct PokerWinning { - public: - /** - * Get the confidence of the bet for a given winning type. - * - * @param type Winning type type. - * @return The confidence. - */ - static float_t getWinningTypeConfidence(enum PokerWinningType type); - - /** - * Compares two winning sets. The returned card is the kicker if the LEFT - * side is the winner. If LEFT is not a winner then 0xFF will be returned. - * - * @param left Left winning set. - * @param right Right winning set. - * @return The kicker card from left's hand or 0xFF if not the winner. - */ - static struct Card compare( - const struct PokerWinning &left, - const struct PokerWinning &right - ); - - /** Winning Type */ - enum PokerWinningType type; - /** The full set of both the dealer and player's hand */ - std::vector full; - /** Holds the winning set */ - std::vector set; - /** If there was a kicker card it will be here */ - struct Card kicker; - /* The player this winning state belongs to */ - std::shared_ptr player; - - PokerWinning() : kicker(0xFF) {} - - /** - * Fills the remaining cards for a given poker player winning hand. - * Essentially this will just take the highest cards and slot them into - * the array. This also sorts the cards. - * - * @param winning Pointer to the poker winning to fill out. - */ - void fillRemaining(); - }; -} \ No newline at end of file diff --git a/src/dawn/prefab/CMakeLists.txt b/src/dawn/prefab/CMakeLists.txt deleted file mode 100644 index 013175a6..00000000 --- a/src/dawn/prefab/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - SimpleSpinningCube.cpp -) \ No newline at end of file diff --git a/src/dawn/prefab/Prefab.hpp b/src/dawn/prefab/Prefab.hpp deleted file mode 100644 index 68890b62..00000000 --- a/src/dawn/prefab/Prefab.hpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/Scene.hpp" - -namespace Dawn { - struct Prefab { - public: - std::shared_ptr item; - }; -} \ No newline at end of file diff --git a/src/dawn/prefab/SimpleSpinningCube.cpp b/src/dawn/prefab/SimpleSpinningCube.cpp deleted file mode 100644 index ae93ffd0..00000000 --- a/src/dawn/prefab/SimpleSpinningCube.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SimpleSpinningCube.hpp" -#include "display/mesh/CubeMesh.hpp" -#include "component/SimpleComponent.hpp" - -using namespace Dawn; - -struct SimpleSpinningCube Dawn::createSimpleSpinningCube(Scene &s) { - struct SimpleSpinningCube cube; - - // Create the scene item. - cube.item = s.createSceneItem(); - - // Create a simple cube mesh. - cube.mesh = std::make_shared(); - cube.mesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - CubeMesh::buffer(cube.mesh, glm::vec3(-1, -1, -1), glm::vec3(2, 2, 2), 0, 0); - - // Add a renderer to the scene item. - cube.meshRenderer = cube.item->addComponent(); - cube.meshRenderer->mesh = cube.mesh; - - // Add a material to the scene item. - cube.material = cube.item->addComponent(); - cube.material->setColor(COLOR_MAGENTA); - - // Add a simple event listener component to the scene item. - addSimpleComponent(cube.item, [](auto &cmp, auto &events) { - // Note that add component cannot receive a self reference, so we must - // capture the component by reference instead. - events.push_back(cmp.getScene()->onUnpausedUpdate.listen([&]( - float_t delta - ) { - // Since we captured within the lambda, we can access the component - // directly. - auto item = cmp.getItem(); - item->setLocalRotation( - item->getLocalRotation() * - glm::quat(glm::vec3(1, 1, 0) * delta) - ); - })); - }); - - return cube; -} \ No newline at end of file diff --git a/src/dawn/prefab/SimpleSpinningCube.hpp b/src/dawn/prefab/SimpleSpinningCube.hpp deleted file mode 100644 index 6e5a38c2..00000000 --- a/src/dawn/prefab/SimpleSpinningCube.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/Prefab.hpp" -#include "component/display/MeshRenderer.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" - -namespace Dawn { - struct SimpleSpinningCube : public Prefab { - public: - std::shared_ptr mesh; - std::shared_ptr meshRenderer; - std::shared_ptr material; - }; - - /** - * Creates a simple spinning cube prefab on the scene. - * - * @param s Scene to add the simple spinning cube to. - * @return The simple spinning cube prefab. - */ - struct SimpleSpinningCube createSimpleSpinningCube(Scene &s); -} \ No newline at end of file diff --git a/src/dawnrpg/component/CMakeLists.txt b/src/dawn/rpg/CMakeLists.txt similarity index 77% rename from src/dawnrpg/component/CMakeLists.txt rename to src/dawn/rpg/CMakeLists.txt index 238c0485..173d3355 100644 --- a/src/dawnrpg/component/CMakeLists.txt +++ b/src/dawn/rpg/CMakeLists.txt @@ -3,5 +3,8 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs add_subdirectory(entity) -add_subdirectory(world) \ No newline at end of file +add_subdirectory(world) + +# Sources \ No newline at end of file diff --git a/src/dawnrpg/prefab/CMakeLists.txt b/src/dawn/rpg/entity/CMakeLists.txt similarity index 71% rename from src/dawnrpg/prefab/CMakeLists.txt rename to src/dawn/rpg/entity/CMakeLists.txt index 7ba151cd..7857b6ab 100644 --- a/src/dawnrpg/prefab/CMakeLists.txt +++ b/src/dawn/rpg/entity/CMakeLists.txt @@ -3,9 +3,12 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs + +# Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - PlayerPrefab.cpp - WorldPrefab.cpp - TestEntityPrefab.cpp + entity.c + entitydirection.c + player.c ) \ No newline at end of file diff --git a/src/dawn/rpg/entity/entity.c b/src/dawn/rpg/entity/entity.c new file mode 100644 index 00000000..40f09bc1 --- /dev/null +++ b/src/dawn/rpg/entity/entity.c @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "entity.h" +#include "entitydirection.h" +#include "rpg/world/map.h" +#include "assert/assert.h" + +void entityInit( + entity_t *entity, + const uint8_t type, + map_t *map +) { + assertNotNull(entity, "Entity cannot be NULL."); + assertNotNull(map, "Map cannot be NULL."); + + memset(entity, 0, sizeof(entity_t)); + entity->type = type; + entity->map = map; + + switch(type) { + case ENTITY_TYPE_NULL: + assertUnreachable("Should not be initializing a NULL entity."); + break; + + case ENTITY_TYPE_PLAYER: + playerInit(entity); + break; + + case ENTITY_TYPE_NPC: + break; + + default: + assertUnreachable("Unknown entity type."); + } +} + +void entityUpdate(entity_t *entity) { + assertNotNull(entity, "Entity cannot be NULL."); + + switch(entity->type) { + case ENTITY_TYPE_NULL: + assertUnreachable("Should not be updating a NULL entity."); + break; + + case ENTITY_TYPE_PLAYER: + playerUpdate(entity); + break; + + case ENTITY_TYPE_NPC: + break; + + default: + assertUnreachable("Unknown entity type."); + } +} + +void entityWalk(entity_t *entity, const uint8_t dir) { + assertNotNull(entity, "Entity cannot be NULL."); + + uint16_t newX = entity->x, newY = entity->y; + entityDirectionOffsetAdd(dir, &newX, &newY); + + // Update direction, this happens regardless of if the player can move + entity->direction = dir; + + // Walking OOB? + if(newX >= entity->map->width || newY >= entity->map->height) { + return; + } + + // Get tile at position + tile_t tileAtPosition = mapTileGetByPosition( + entity->map, + newX, + newY, + entity->layer + ); + if(tileIsSolid(tileAtPosition)) return; + + // Get entity at position + entity_t *entityAtPosition = mapEntityGetByPosition( + entity->map, + newX, + newY + ); + if(entityAtPosition != NULL) return; + + // Commit to move + entity->x = newX; + entity->y = newY; +} + +void entityPositionSet(entity_t *entity, const uint16_t x, const uint16_t y) { + assertNotNull(entity, "Entity cannot be NULL."); + entity->x = x; + entity->y = y; +} \ No newline at end of file diff --git a/src/dawn/rpg/entity/entity.h b/src/dawn/rpg/entity/entity.h new file mode 100644 index 00000000..afb7d565 --- /dev/null +++ b/src/dawn/rpg/entity/entity.h @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "player.h" + +#define ENTITY_TYPE_NULL 0 +#define ENTITY_TYPE_PLAYER 1 +#define ENTITY_TYPE_NPC 2 + +typedef struct _map_t map_t; + +typedef struct _entity_t { + map_t *map; + uint8_t type; + uint16_t x; + uint16_t y; + uint8_t layer; + uint8_t direction; + + union { + player_t player; + }; +} entity_t; + +/** + * Initializes an entity. + * + * @param entity Entity to initialize. + * @param type Type of entity to initialize. + */ +void entityInit( + entity_t *entity, + const uint8_t type, + map_t *map +); + +/** + * Updates an entity. + * + * @param entity Entity to update. + */ +void entityUpdate(entity_t *entity); + +/** + * Moves an entity. + * + * @param entity Entity to move. + * @param dir Direction to move. + */ +void entityWalk(entity_t *entity, const uint8_t dir); + +/** + * Sets the position of an entity. Performs an immediate move. + * + * @param entity Entity to set position of. + * @param x X position to set. + * @param y Y position to set. + */ +void entityPositionSet(entity_t *entity, const uint16_t x, const uint16_t y); \ No newline at end of file diff --git a/src/dawn/rpg/entity/entitydirection.c b/src/dawn/rpg/entity/entitydirection.c new file mode 100644 index 00000000..b834286a --- /dev/null +++ b/src/dawn/rpg/entity/entitydirection.c @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "entitydirection.h" +#include "assert/assert.h" + +void entityDirectionOffsetGet(const uint8_t dir, uint16_t *x, uint16_t *y) { + switch(dir) { + case ENTITY_DIRECTION_SOUTH: + *x = 0; + *y = 1; + break; + case ENTITY_DIRECTION_NORTH: + *x = 0; + *y = -1; + break; + case ENTITY_DIRECTION_WEST: + *x = -1; + *y = 0; + break; + case ENTITY_DIRECTION_EAST: + *x = 1; + *y = 0; + break; + default: + assertUnreachable("Invalid entity direction."); + } +} + +void entityDirectionOffsetAdd(const uint8_t dir, uint16_t *x, uint16_t *y) { + switch(dir) { + case ENTITY_DIRECTION_SOUTH: + *y += 1; + break; + case ENTITY_DIRECTION_NORTH: + *y -= 1; + break; + case ENTITY_DIRECTION_WEST: + *x -= 1; + break; + case ENTITY_DIRECTION_EAST: + *x += 1; + break; + default: + assertUnreachable("Invalid entity direction."); + } +} + +uint8_t entityDirectionLookAt( + const uint16_t srcX, const uint16_t srcY, + const uint16_t trgX, const uint16_t trgY +) { + if(srcX < trgX) return ENTITY_DIRECTION_EAST; + if(srcX > trgX) return ENTITY_DIRECTION_WEST; + if(srcY < trgY) return ENTITY_DIRECTION_SOUTH; + if(srcY > trgY) return ENTITY_DIRECTION_NORTH; + return ENTITY_DIRECTION_SOUTH; +} \ No newline at end of file diff --git a/src/dawn/rpg/entity/entitydirection.h b/src/dawn/rpg/entity/entitydirection.h new file mode 100644 index 00000000..073a6fe4 --- /dev/null +++ b/src/dawn/rpg/entity/entitydirection.h @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +#define ENTITY_DIRECTION_SOUTH 0 +#define ENTITY_DIRECTION_NORTH 1 +#define ENTITY_DIRECTION_WEST 2 +#define ENTITY_DIRECTION_EAST 3 + +/** + * Returns the offset for a given direction. + * + * @param dir Direction to get offset for. + * @param x Pointer to store x offset. + * @param y Pointer to store y offset. + */ +void entityDirectionOffsetGet(const uint8_t dir, uint16_t *x, uint16_t *y); + +/** + * Adds the offset for a given direction to the given x and y. + * + * @param dir Direction to get offset for. + * @param x Pointer to add x offset to. + * @param y Pointer to add y offset to. + */ +void entityDirectionOffsetAdd(const uint8_t dir, uint16_t *x, uint16_t *y); + +/** + * Returns the direction to look at from one point to another. + * + * @param srcX Source X position. + * @param srcY Source Y position. + * @param trgX Target X position. + * @param trgY Target Y position. + * @return Direction to look at. + */ +uint8_t entityDirectionLookAt( + const uint16_t srcX, const uint16_t srcY, + const uint16_t trgX, const uint16_t trgY +); \ No newline at end of file diff --git a/src/dawn/rpg/entity/player.c b/src/dawn/rpg/entity/player.c new file mode 100644 index 00000000..72c0959e --- /dev/null +++ b/src/dawn/rpg/entity/player.c @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "player.h" +#include "entity.h" +#include "entitydirection.h" +#include "rpg/world/map.h" +#include "input.h" +#include "assert/assert.h" + +void playerInit(entity_t *entity) { + assertTrue(entity->type == ENTITY_TYPE_PLAYER, "Entity is not a player."); +} + +void playerUpdate(entity_t *entity) { + assertTrue(entity->type == ENTITY_TYPE_PLAYER, "Entity is not a player."); + + if(inputIsDown(INPUT_BIND_DOWN)) { + return entityWalk(entity, ENTITY_DIRECTION_SOUTH); + } else if(inputIsDown(INPUT_BIND_UP)) { + return entityWalk(entity, ENTITY_DIRECTION_NORTH); + } else if(inputIsDown(INPUT_BIND_LEFT)) { + return entityWalk(entity, ENTITY_DIRECTION_WEST); + } else if(inputIsDown(INPUT_BIND_RIGHT)) { + return entityWalk(entity, ENTITY_DIRECTION_EAST); + } + + if(inputIsDown(INPUT_BIND_ACCEPT)) { + // Check what the player is trying to interact with + uint16_t x = entity->x, y = entity->y; + entityDirectionOffsetAdd(entity->direction, &x, &y); + + entity_t *target = mapEntityGetByPosition(entity->map, x, y); + if(target) { + // Interact with the target + target->direction = entityDirectionLookAt( + target->x, target->y, + entity->x, entity->y + ); + return; + } + } +} \ No newline at end of file diff --git a/src/dawn/rpg/entity/player.h b/src/dawn/rpg/entity/player.h new file mode 100644 index 00000000..bf09c7b0 --- /dev/null +++ b/src/dawn/rpg/entity/player.h @@ -0,0 +1,29 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +typedef struct _entity_t entity_t; + +typedef struct { + uint8_t mana; +} player_t; + +/** + * Initializes a player entity. + * + * @param entity Player entity to initialize. + */ +void playerInit(entity_t *entity); + +/** + * Updates a player entity. + * + * @param entity Player entity to update. + */ +void playerUpdate(entity_t *entity); \ No newline at end of file diff --git a/src/dawnrpg/component/world/CMakeLists.txt b/src/dawn/rpg/world/CMakeLists.txt similarity index 76% rename from src/dawnrpg/component/world/CMakeLists.txt rename to src/dawn/rpg/world/CMakeLists.txt index bc77b7e6..9437dc47 100644 --- a/src/dawnrpg/component/world/CMakeLists.txt +++ b/src/dawn/rpg/world/CMakeLists.txt @@ -3,10 +3,11 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs + +# Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - World.cpp - Map.cpp - Chunk.cpp - Tile.cpp + tile.c + map.c ) \ No newline at end of file diff --git a/src/dawn/rpg/world/map.c b/src/dawn/rpg/world/map.c new file mode 100644 index 00000000..90dcafa5 --- /dev/null +++ b/src/dawn/rpg/world/map.c @@ -0,0 +1,128 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "map.h" +#include "assert/assert.h" + +void mapInit( + map_t *map, + const uint16_t width, + const uint16_t height, + const uint8_t layers +) { + assertNotNull(map, "Map cannot be NULL."); + assertTrue( + width > 0, + "Map width must be greater than 0." + ); + assertTrue( + width < MAP_WIDTH_MAX, + "Map width must be less than or equal to MAP_WIDTH_MAX." + ); + assertTrue( + height > 0, + "Map height must be greater than 0." + ); + assertTrue( + height < MAP_HEIGHT_MAX, + "Map height must be less than or equal to MAP_HEIGHT_MAX." + ); + assertTrue( + layers > 0, + "Map layers must be greater than 0." + ); + assertTrue( + layers < MAP_LAYERS_MAX, + "Map layers must be less than or equal to MAP_LAYERS_MAX." + ); + + memset(map, 0, sizeof(map)); + + map->width = width; + map->height = height; + map->layers = layers; +} + +void mapUpdate(map_t *map) { + for(uint8_t i = 0; i < map->entityCount; i++) { + entity_t *entity = &map->entities[i]; + entityUpdate(entity); + } +} + +entity_t * mapEntityAdd(map_t *map) { + assertTrue( + map->entityCount < MAP_ENTITIES_MAX, + "Cannot add any more entities to map." + ); + + entity_t *entity = &map->entities[map->entityCount]; + map->entityCount++; + return entity; +} + +entity_t * mapEntityGetByPosition( + map_t *map, + const uint16_t x, + const uint16_t y +) { + if(x >= map->width || y >= map->height) return NULL; + + for(uint8_t i = 0; i < map->entityCount; i++) { + entity_t *entity = &map->entities[i]; + if(entity->x == x && entity->y == y) { + return entity; + } + } + + return NULL; +} + +tile_t mapTileGetByPosition( + const map_t *map, + const uint16_t x, + const uint16_t y, + const uint8_t layer +) { + assertTrue( + x < map->width, + "X position must be less than map width." + ); + assertTrue( + y < map->height, + "Y position must be less than map height." + ); + assertTrue( + layer < map->layers, + "Layer must be less than map layers." + ); + + return map->tiles[ + (layer * map->width * map->height) + + (y * map->width) + + x + ]; +} + +void mapTilesSet( + map_t *map, + const tile_t tiles[], + const uint8_t layer +) { + assertNotNull(map, "Map cannot be NULL."); + assertNotNull(tiles, "Tiles cannot be NULL."); + assertTrue( + layer < map->layers, + "Layer must be less than map layers." + ); + + memcpy( + map->tiles + (layer * map->width * map->height), + tiles, + map->width * map->height * sizeof(tile_t) + ); +} \ No newline at end of file diff --git a/src/dawn/rpg/world/map.h b/src/dawn/rpg/world/map.h new file mode 100644 index 00000000..63e281f6 --- /dev/null +++ b/src/dawn/rpg/world/map.h @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "tile.h" +#include "rpg/entity/entity.h" + +#define MAP_WIDTH_MAX 2048 +#define MAP_HEIGHT_MAX 2048 +#define MAP_LAYERS_MAX 4 +#define MAP_ENTITIES_MAX 256 + +typedef struct _map_t { + tile_t tiles[MAP_WIDTH_MAX * MAP_HEIGHT_MAX * MAP_LAYERS_MAX]; + uint16_t width; + uint16_t height; + uint8_t layers; + + entity_t entities[MAP_ENTITIES_MAX]; + uint8_t entityCount; +} map_t; + +/** + * Initializes a map. + * + * @param map Map to initialize. + * @param width Width of the map. + * @param height Height of the map. + * @param layers Number of layers in the map. + */ +void mapInit( + map_t *map, + const uint16_t width, + const uint16_t height, + const uint8_t layers +); + +/** + * Updates the map and all entities on it. + * + * @param map Map to update. + */ +void mapUpdate(map_t *map); + +/** + * Adds an entity to the map. + * + * @param map Map to add the entity to. + * @param entity Entity to add to the map. + */ +entity_t * mapEntityAdd(map_t *map); + +/** + * Gets the entity at the specified position. + * + * @param map Map to get the entity from. + * @param x X position of the entity. + * @param y Y position of the entity. + * @return Entity at the specified position, or NULL if no entity is there. + */ +entity_t * mapEntityGetByPosition( + map_t *map, + const uint16_t x, + const uint16_t y +); + +/** + * Gets the tile at the specified position. + * + * @param map Map to get the tile from. + * @param x X position of the tile. + * @param y Y position of the tile. + * @param layer Layer of the tile. + * @return Tile at the specified position. + */ +tile_t mapTileGetByPosition( + const map_t *map, + const uint16_t x, + const uint16_t y, + const uint8_t layer +); + +/** + * Quickly set an entire layer of tiles at once. + * + * @param map Map to set the tiles on. + * @param ids Array of tiles to set. + * @param layer Layer to set the tiles on. + */ +void mapTilesSet( + map_t *map, + const tile_t tiles[], + const uint8_t layer +); \ No newline at end of file diff --git a/src/dawn/rpg/world/maps/testmap.h b/src/dawn/rpg/world/maps/testmap.h new file mode 100644 index 00000000..145e87ad --- /dev/null +++ b/src/dawn/rpg/world/maps/testmap.h @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "rpg/world/map.h" +#include "assert/assert.h" + +void testMapInit(map_t *map) { + mapInit(map, 20, 20, 1); + + entity_t *player = mapEntityAdd(map); + entityInit(player, ENTITY_TYPE_PLAYER, map); + entityPositionSet(player, 5, 5); + + entity_t *npc = mapEntityAdd(map); + entityInit(npc, ENTITY_TYPE_NPC, map); + entityPositionSet(npc, 10, 10); + + tile_t tiles[42 * 42]; + memset(tiles, 0, sizeof(tiles)); + + tiles[0].id = TILE_ID_GRASS; + tiles[1].id = TILE_ID_GRASS; + tiles[2].id = TILE_ID_GRASS; + tiles[3].id = TILE_ID_GRASS; + tiles[4].id = TILE_ID_GRASS; + tiles[5].id = TILE_ID_GRASS; + tiles[6].id = TILE_ID_GRASS; + tiles[7].id = TILE_ID_GRASS; + tiles[8].id = TILE_ID_GRASS; + tiles[9].id = TILE_ID_GRASS; + tiles[10].id = TILE_ID_GRASS; + tiles[11].id = TILE_ID_WATER; + tiles[12].id = TILE_ID_WATER; + tiles[13].id = TILE_ID_WATER; + tiles[14].id = TILE_ID_WATER; + tiles[15].id = TILE_ID_WATER; + tiles[16].id = TILE_ID_GRASS; + tiles[17].id = TILE_ID_GRASS; + tiles[18].id = TILE_ID_GRASS; + tiles[19].id = TILE_ID_GRASS; + + tiles[20].id = TILE_ID_GRASS; + tiles[21].id = TILE_ID_GRASS; + tiles[22].id = TILE_ID_GRASS; + tiles[23].id = TILE_ID_GRASS; + tiles[24].id = TILE_ID_GRASS; + tiles[25].id = TILE_ID_GRASS; + tiles[26].id = TILE_ID_GRASS; + tiles[27].id = TILE_ID_GRASS; + tiles[28].id = TILE_ID_GRASS; + tiles[29].id = TILE_ID_GRASS; + tiles[30].id = TILE_ID_WATER; + tiles[31].id = TILE_ID_WATER; + tiles[32].id = TILE_ID_WATER; + tiles[33].id = TILE_ID_WATER; + tiles[34].id = TILE_ID_WATER; + tiles[35].id = TILE_ID_WATER; + tiles[36].id = TILE_ID_GRASS; + tiles[37].id = TILE_ID_GRASS; + tiles[38].id = TILE_ID_GRASS; + tiles[39].id = TILE_ID_GRASS; + + + + mapTilesSet(map, tiles, 0); +} \ No newline at end of file diff --git a/src/dawn/rpg/world/tile.c b/src/dawn/rpg/world/tile.c new file mode 100644 index 00000000..0876d236 --- /dev/null +++ b/src/dawn/rpg/world/tile.c @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "tile.h" + +bool_t tileIsSolid(const tile_t tile) { + switch(tile.id) { + case TILE_ID_WATER: + return true; + + default: + return false; + } + return false; +} \ No newline at end of file diff --git a/src/dawn/rpg/world/tile.h b/src/dawn/rpg/world/tile.h new file mode 100644 index 00000000..36eaf615 --- /dev/null +++ b/src/dawn/rpg/world/tile.h @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +#define TILE_ID_NULL 0 +#define TILE_ID_GRASS 1 +#define TILE_ID_WATER 2 + +typedef struct { + uint8_t id; +} tile_t; + +/** + * Returns whether or not the tile is solid. + * + * @param tile Tile to check. + * @return True if the tile is solid, false otherwise. + */ +bool_t tileIsSolid(const tile_t tile); \ No newline at end of file diff --git a/src/dawn/save/CMakeLists.txt b/src/dawn/save/CMakeLists.txt deleted file mode 100644 index 8bb54958..00000000 --- a/src/dawn/save/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - SaveFile.cpp - SaveManager.cpp -) \ No newline at end of file diff --git a/src/dawn/save/SaveFile.cpp b/src/dawn/save/SaveFile.cpp deleted file mode 100644 index 7d35aba1..00000000 --- a/src/dawn/save/SaveFile.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SaveFile.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -SaveFile::SaveFile() { - -} - -bool_t SaveFile::doesSaveHaveChanges() { - return this->hasChanges; -} - -bool_t SaveFile::has(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - return this->data.find(key) != this->data.end(); -} - -// String (raw) -template<> -std::string SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return ""; - return this->data[key]; -} - -template<> -void SaveFile::set( - const std::string &key, - const std::string value -) { - assertFalse(key.empty(), "Key cannot be empty."); - this->data[key] = value; - this->hasChanges = true; -} - -// int32_t -template<> -int32_t SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return 0; - return std::stoi(this->data[key]); -} - -template<> -void SaveFile::set( - const std::string &key, - const int32_t value -) { - this->set(key, std::to_string(value)); -} - -// uint32_t -template<> -uint32_t SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return 0; - return std::stoul(this->data[key]); -} - -template<> -void SaveFile::set( - const std::string &key, - const uint32_t value -) { - this->set(key, std::to_string(value)); -} - -// int64_t -template<> -int64_t SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return 0; - return std::stoll(this->data[key]); -} - -template<> -void SaveFile::set( - const std::string &key, - const int64_t value -) { - this->set(key, std::to_string(value)); -} - -// uint64_t -template<> -uint64_t SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return 0; - return std::stoull(this->data[key]); -} - -template<> -void SaveFile::set( - const std::string &key, - const uint64_t value -) { - this->set(key, std::to_string(value)); -} - -// float_t -template<> -float_t SaveFile::get(const std::string &key) { - assertFalse(key.empty(), "Key cannot be empty."); - if(!this->has(key)) return 0.0f; - return std::stof(this->data[key]); -} - -template<> -void SaveFile::set( - const std::string &key, - const float_t value -) { - this->set(key, std::to_string(value)); -} - -SaveFile::~SaveFile() { - -} \ No newline at end of file diff --git a/src/dawn/save/SaveFile.hpp b/src/dawn/save/SaveFile.hpp deleted file mode 100644 index a44f529c..00000000 --- a/src/dawn/save/SaveFile.hpp +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class SaveManager; - - struct SaveFile final { - private: - std::unordered_map data; - bool_t hasChanges = false; - - public: - /** - * Creates a new SaveFile. - */ - SaveFile(); - - /** - * Returns true if the SaveFile has unsaved changes. - * - * @return True if the SaveFile has changes. - */ - bool_t doesSaveHaveChanges(); - - /** - * Returns true if the key exists. - * - * @param key Key to check. - * @return True if the key exists. - */ - bool_t has(const std::string &key); - - /** - * Returns the value of the key. - * - * @param key Key to get the value of. - * @return The value of the key. - */ - template - T get(const std::string &key); - - /** - * Sets the value of the key. - * - * @param key Key to set the value of. - * @param value Value to set the key to. - */ - template - void set(const std::string &key, const T value); - - /** - * Destroys the SaveFile. - */ - virtual ~SaveFile(); - - friend class SaveManager; - }; -} \ No newline at end of file diff --git a/src/dawn/save/SaveManager.cpp b/src/dawn/save/SaveManager.cpp deleted file mode 100644 index 8e1fb021..00000000 --- a/src/dawn/save/SaveManager.cpp +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SaveManager.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -void SaveManager::init(std::shared_ptr game) { - assertNotNull(game, "Game instance cannot be null!"); - this->game = game; -} \ No newline at end of file diff --git a/src/dawn/save/SaveManager.hpp b/src/dawn/save/SaveManager.hpp deleted file mode 100644 index 74c6d2e8..00000000 --- a/src/dawn/save/SaveManager.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "save/SaveFile.hpp" - -namespace Dawn { - class Game; - - enum class SaveResult { - SUCCESS, - FAILURE - }; - - enum class LoadResult { - SUCCESS, - FAILURE - }; - - class SaveManager final { - private: - std::weak_ptr game; - struct SaveFile saveFile; - int8_t currentSlot = -1; - - public: - /** - * Initializes the save manager and prepares it for use. - * - * @param game The game to initialize the save manager for. - */ - void init(std::shared_ptr game); - - /** - * Immediately save the game to the given file. This will invoke the - * game's custom writer to write the output data to the save file. - */ - enum SaveResult save(); - - /** - * Loads the current slotted save file. Invokes the internal managers read - * function. - */ - enum LoadResult load(); - - /** - * Deletes the given slot. - * - * @param slot Slot to delete. - */ - void deleteSlot(int8_t slot); - - /** - * Returns the current slotted save file. - * - * @returns The current slotted save file. - */ - int8_t getCurrentSlot(); - - /** - * Sets the current slotted save file. - * - * @param slot The slot to set. - */ - void useSlot(int8_t slot); - - /** - * Returns a list of used save slots, does not confirm if they are corrupt - * or not, just whether they are in existance or not. - * - * @return List of used save slots. - */ - std::vector getSlots(); - }; -} \ No newline at end of file diff --git a/src/dawn/scene/CMakeLists.txt b/src/dawn/scene/CMakeLists.txt deleted file mode 100644 index 47e87520..00000000 --- a/src/dawn/scene/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Scene.cpp - SceneItem.cpp - SceneComponent.cpp -) - -# Subdirs -add_subdirectory(item) \ No newline at end of file diff --git a/src/dawn/scene/Scene.cpp b/src/dawn/scene/Scene.cpp deleted file mode 100644 index d79a1929..00000000 --- a/src/dawn/scene/Scene.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Scene.hpp" - -using namespace Dawn; - -Scene::Scene( - const std::weak_ptr game, - const std::function sceneInitializer -) : - game(game), - sceneInitializer(sceneInitializer) -{ -} - -void Scene::stage() { - Scene &selfReference = *this; - sceneInitializer(selfReference); -} - -void Scene::update() { - // Initialize new scene items - if(!hasInitialized) { - hasInitialized = true; - for(auto &item : sceneItems) { - item->init(); - } - } - - // Remove stale scene items. - auto itRemove = sceneItemsToRemove.begin(); - while(itRemove != sceneItemsToRemove.end()) { - auto item = *itRemove; - auto it = std::find(sceneItems.begin(), sceneItems.end(), item); - if(it != sceneItems.end()) sceneItems.erase(it); - itRemove++; - } - sceneItemsToRemove.clear(); - - // Tick scene items. - float_t delta = getGame()->timeManager.delta; - if(paused) { - onPausedUpdate.emit(delta); - } else { - onUnpausedUpdate.emit(delta); - - onTimeout.tick(delta); - onInterval.tick(delta); - } -} - -std::shared_ptr Scene::getGame() { - return game.lock(); -} - -std::shared_ptr Scene::createSceneItem() { - auto item = std::make_shared(shared_from_this()); - sceneItems.push_back(item); - return item; -} - -void Scene::removeItem(const std::shared_ptr item) { - sceneItemsToRemove.push_back(item); -} - -Scene::~Scene() { - sceneItemsToRemove.clear(); - sceneItems.clear(); -} \ No newline at end of file diff --git a/src/dawn/scene/Scene.hpp b/src/dawn/scene/Scene.hpp deleted file mode 100644 index c7f3814a..00000000 --- a/src/dawn/scene/Scene.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "game/Game.hpp" -#include "scene/SceneItem.hpp" -#include "event/Event.hpp" -#include "time/event/IntervalEvent.hpp" -#include "time/event/TimeoutEvent.hpp" - -namespace Dawn { - struct IntervalData { - float_t frequency; - float_t nextInvoke; - }; - - class Scene final : public std::enable_shared_from_this { - private: - std::weak_ptr game; - const std::function sceneInitializer; - std::vector> sceneItems; - std::vector> sceneItemsToRemove; - bool_t paused = false; - bool_t hasInitialized = false; - - public: - Event onUnpausedUpdate; - Event onPausedUpdate; - TimeoutEvent onTimeout; - IntervalEvent onInterval; - - /** - * Returns the initial scene for the game. - * - * @return Initial scene function. - */ - static const std::function getInitialScene(); - - /** - * Constructs a scene object. - * - * @param game Game that initialized this scene. - */ - Scene( - const std::weak_ptr game, - const std::function sceneInitializer - ); - - /** - * Stages all of the scene items on the scene. - */ - void stage(); - - /** - * Called by the game every frame that the scene is set as the currently - * active scene. This may not be sequential, for example a scene can be - * active, then switched to a different scene temporarily, and then can be - * switched back to the active one. - */ - void update(); - - /** - * Returns a copy of the game instance that this scene belongs to. - * - * @return Shared pointer to the game instance. - */ - std::shared_ptr getGame(); - - /** - * Creates a scene item that belongs to this scene. - * - * @return Pointer to the new scene item. - */ - std::shared_ptr createSceneItem(); - - /** - * Removes a scene item from the scene. This remove will happen at the - * start of the next scene update. - * - * @param item Scene item to remove. - */ - void removeItem(const std::shared_ptr item); - - /** - * Returns a list of scene components that match the given type. - * - * @return List of scene components matching the type. - */ - template - std::vector> findComponents() { - std::vector> components; - for(auto item : sceneItems) { - auto component = item->getComponent(); - if(component) components.push_back(component); - } - return components; - } - - /** - * Destroys the scene object and cleans up all of its children. - */ - virtual ~Scene(); - }; -} \ No newline at end of file diff --git a/src/dawn/scene/SceneComponent.cpp b/src/dawn/scene/SceneComponent.cpp deleted file mode 100644 index 7c18560a..00000000 --- a/src/dawn/scene/SceneComponent.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "util/Flag.hpp" -#include "game/Game.hpp" -#include "scene/Scene.hpp" - -using namespace Dawn; - -uint64_t SCENE_COMPONENTS_ACTIVE = 0; - -void SceneComponent::init(const std::shared_ptr item) { - SCENE_COMPONENTS_ACTIVE++; - - assertFlagOff( - sceneComponentState, - SCENE_COMPONENT_STATE_INIT, - "SceneComponent is already initialized!" - ); - Flag::turnOn( - sceneComponentState, - SCENE_COMPONENT_STATE_INIT - ); - this->item = item; - this->onInit(); -} - -void SceneComponent::dispose() { - assertFlagOn( - sceneComponentState, - SCENE_COMPONENT_STATE_INIT, - "SceneComponent is not initialized!" - ); - assertFlagOff( - sceneComponentState, - SCENE_COMPONENT_STATE_DISPOSED, - "SceneComponent is already disposed!" - ); - Flag::turnOn( - sceneComponentState, - SCENE_COMPONENT_STATE_DISPOSED - ); - - // Clear Listeners - for(auto &listener : this->listeners) listener(); - this->listeners.clear(); - - this->onDispose(); - this->item.reset(); -} - -std::shared_ptr SceneComponent::getItem() { - auto item = this->item.lock(); - assertNotNull(item, "Item cannot be null?"); - return item; -} - -std::shared_ptr SceneComponent::getScene() { - auto item = this->getItem(); - auto scene = item->getScene(); - assertNotNull(scene, "Scene cannot be null?"); - return scene; -} - -std::shared_ptr SceneComponent::getGame() { - auto scene = this->getScene(); - auto game = scene->getGame(); - assertNotNull(game, "Game cannot be null?"); - return game; -} - -SceneComponent::~SceneComponent() { - if(Flag::isOn( - sceneComponentState, - SCENE_COMPONENT_STATE_INIT - )) { - assertFlagOn( - sceneComponentState, - SCENE_COMPONENT_STATE_DISPOSED, - "SceneComponent is initialized but was not properly disposed!" - ); - } - - this->item.reset(); - SCENE_COMPONENTS_ACTIVE--; -} \ No newline at end of file diff --git a/src/dawn/scene/SceneComponent.hpp b/src/dawn/scene/SceneComponent.hpp deleted file mode 100644 index 018ea6b8..00000000 --- a/src/dawn/scene/SceneComponent.hpp +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -#define SCENE_COMPONENT_STATE_INIT 0x01 -#define SCENE_COMPONENT_STATE_DISPOSED 0x02 - -extern uint64_t SCENE_COMPONENTS_ACTIVE; - -namespace Dawn { - class Game; - class Scene; - class SceneItem; - class SceneItemComponents; - - class SceneComponent : std::enable_shared_from_this { - private: - std::weak_ptr item; - uint_fast8_t sceneComponentState = 0; - - protected: - std::vector> listeners; - - /** - * Custom component listener that is invoked when the component is meant - * to initialize. - */ - virtual void onInit() = 0; - - /** - * Custom component listener that is invoked when the component is meant - * to dispose. - */ - virtual void onDispose() = 0; - - public: - /** - * Initializes this scene component. - * - * @param item Scene item that this component belongs to. - */ - void init(const std::shared_ptr item); - - /** - * Disposes this scene component. - */ - void dispose(); - - /** - * Returns the scene item that this scene component belongs to. - * - * @return Reference to the scene item that this component belongs to. - */ - std::shared_ptr getItem(); - - /** - * Returns the scene that this scene component belongs to. - * - * @return Reference to the scene that this component belongs to. - */ - std::shared_ptr getScene(); - - /** - * Returns the game that this scene component belongs to. - * - * @return Reference to the game that this component belongs to. - */ - std::shared_ptr getGame(); - - /** - * Disposes this scene component. - */ - virtual ~SceneComponent(); - - friend class SceneItem; - friend class SceneItemComponents; - }; -} \ No newline at end of file diff --git a/src/dawn/scene/SceneItem.cpp b/src/dawn/scene/SceneItem.cpp deleted file mode 100644 index 1deb6612..00000000 --- a/src/dawn/scene/SceneItem.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scene/SceneItem.hpp" -#include "scene/Scene.hpp" - -using namespace Dawn; - -uint64_t SCENE_ITEMS_ACTIVE = 0; - -SceneItem::SceneItem(const std::weak_ptr scene) : - scene(scene), - SceneItemTransform(), - SceneItemComponents() -{ - SCENE_ITEMS_ACTIVE++; -} - -std::shared_ptr SceneItem::sceneItemComponentsSelf() { - return shared_from_this(); -} - -std::shared_ptr SceneItem::getScene() { - return scene.lock(); -} - -void SceneItem::init() { - auto sharedThis = shared_from_this(); - for(auto &component : components) { - component->init(sharedThis); - } -} - -void SceneItem::remove() { - auto scene = getScene(); - if(!scene) return; - scene->removeItem(shared_from_this()); -} - -SceneItem::~SceneItem() { - SCENE_ITEMS_ACTIVE--; -} \ No newline at end of file diff --git a/src/dawn/scene/SceneItem.hpp b/src/dawn/scene/SceneItem.hpp deleted file mode 100644 index b97cd17e..00000000 --- a/src/dawn/scene/SceneItem.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/item/SceneItemTransform.hpp" -#include "scene/item/SceneItemComponents.hpp" - -extern uint64_t SCENE_ITEMS_ACTIVE; - -namespace Dawn { - class Scene; - - class SceneItem final : - public SceneItemTransform, - public SceneItemComponents, - public std::enable_shared_from_this - { - private: - std::weak_ptr scene; - - protected: - std::shared_ptr sceneItemComponentsSelf() override; - - public: - /** - * Constructs a scene item. - * - * @param scene Scene that this item belongs to. - */ - SceneItem(const std::weak_ptr scene); - - /** - * Called when the scene item is supposed to initialize. Should happen - * on the first frame that the scene item is staged. - */ - void init(); - - /** - * Returns the scene that this scene item belongs to. - * - * @return Pointer to the scene that this item belongs to. - */ - std::shared_ptr getScene(); - - /** - * Queues this scene item to be removed from the scene (on the next scene - * update). - */ - void remove(); - - /** - * Returns the scene that this item belongs to. - * - * @return Scene that this item belongs to. - */ - virtual ~SceneItem(); - }; -} \ No newline at end of file diff --git a/src/dawn/scene/item/CMakeLists.txt b/src/dawn/scene/item/CMakeLists.txt deleted file mode 100644 index b118a368..00000000 --- a/src/dawn/scene/item/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - SceneItemComponents.cpp - SceneItemTransform.cpp -) \ No newline at end of file diff --git a/src/dawn/scene/item/SceneItemComponents.cpp b/src/dawn/scene/item/SceneItemComponents.cpp deleted file mode 100644 index fb6224e3..00000000 --- a/src/dawn/scene/item/SceneItemComponents.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "SceneItemComponents.hpp" - -using namespace Dawn; - -SceneItemComponents::SceneItemComponents() { - -} - -void SceneItemComponents::removeComponent( - const std::shared_ptr component -) { - auto it = std::find(components.begin(), components.end(), component); - if(it == components.end()) return; //Not found? - it->get()->dispose(); - components.erase(it); -} - -SceneItemComponents::~SceneItemComponents() { - auto it = components.begin(); - while(it != components.end()) { - auto component = *it; - component->dispose(); - ++it; - } - components.clear(); -} \ No newline at end of file diff --git a/src/dawn/scene/item/SceneItemComponents.hpp b/src/dawn/scene/item/SceneItemComponents.hpp deleted file mode 100644 index 1107938b..00000000 --- a/src/dawn/scene/item/SceneItemComponents.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneComponent.hpp" - -namespace Dawn { - class SceneItem; - - class SceneItemComponents { - protected: - std::vector> components; - - /** - * Shorthand way of allowing this class to retreive itself as a SceneItem. - * - * @return This as a shared pointer to a SceneItem. - */ - virtual std::shared_ptr sceneItemComponentsSelf() = 0; - - public: - SceneItemComponents(); - - /** - * Removes a component from this item. - * - * @param component Component to remove. - */ - void removeComponent(const std::shared_ptr component); - - /** - * Adds a component to this item. You are given a shared pointer back but - * you are not intended to take responsibility for the component. - * - * @return Shared pointer to the created component. - */ - template - std::shared_ptr addComponent() { - //Create the component and add it. - std::shared_ptr component = std::make_shared(); - this->components.push_back( - static_pointer_cast(component) - ); - component->item = this->sceneItemComponentsSelf(); - return component; - } - - /** - * Returns a list of components that match the given type. - * - * @return List of components matching the type. - */ - template - std::shared_ptr getComponent() { - for(auto component : this->components) { - auto cast = std::dynamic_pointer_cast(component); - if(cast) return cast; - } - return nullptr; - } - - virtual ~SceneItemComponents(); - }; -} \ No newline at end of file diff --git a/src/dawn/scene/item/SceneItemTransform.cpp b/src/dawn/scene/item/SceneItemTransform.cpp deleted file mode 100644 index 69496608..00000000 --- a/src/dawn/scene/item/SceneItemTransform.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "scene/item/SceneItemTransform.hpp" -#include "scene/SceneItem.hpp" - -using namespace Dawn; - -SceneItemTransform::SceneItemTransform() : - transformLocal(1.0f), - transformWorld(1.0f) -{ - this->updateLocalValuesFromLocalTransform(); -} - -void SceneItemTransform::updateLocalValuesFromLocalTransform() { - glm::vec3 skew; - glm::vec4 perspective; - glm::decompose( - this->transformLocal, - this->localScale, - this->localRotation, - this->localPosition, - skew, - perspective - ); -} - -void SceneItemTransform::updateLocalTransformFromWorldTransform() { - auto parent = this->getParent(); - if(!parent) { - this->transformLocal = this->transformWorld; - } else { - this->transformLocal = ( - glm::inverse(parent->transformWorld) * this->transformWorld - ); - } - this->updateLocalValuesFromLocalTransform(); -} - -void SceneItemTransform::updateChildrenWorldTransforms() { - std::for_each( - this->children.begin(), - this->children.end(), - [](std::weak_ptr &item) { - if(auto child = item.lock()) child->updateWorldTransformFromParent(); - } - ); -} - -void SceneItemTransform::updateWorldTransformFromParent() { - auto parent = this->getParent(); - if(!parent) { - this->transformWorld = this->transformLocal; - } else { - this->transformWorld = ( - parent->transformWorld * this->transformLocal - ); - } - this->updateLocalValuesFromLocalTransform(); - this->updateChildrenWorldTransforms(); -} - -void SceneItemTransform::updateLocalTransformFromLocalValues() { - this->transformLocal = glm::translate( - glm::mat4(1.0f), - this->localPosition - ) * glm::mat4_cast(this->localRotation) * glm::scale( - glm::mat4(1.0f), - this->localScale - ); - this->updateWorldTransformFromLocalTransform(); -} - -void SceneItemTransform::updateWorldTransformFromLocalTransform() { - auto parent = this->getParent(); - if(!parent) { - this->transformWorld = this->transformLocal; - } else { - this->transformWorld = ( - parent->transformWorld * this->transformLocal - ); - } - this->updateChildrenWorldTransforms(); -} - -std::shared_ptr SceneItemTransform::getParent() { - return parent.lock(); -} - -std::vector> SceneItemTransform::getChildren() { - std::vector> children; - std::for_each( - this->children.begin(), - this->children.end(), - [&children](std::weak_ptr &item) { - if(auto child = item.lock()) children.push_back(child); - } - ); - return children; -} - -glm::mat4 SceneItemTransform::getLocalTransform() { - return this->transformLocal; -} - -glm::mat4 SceneItemTransform::getWorldTransform() { - return this->transformWorld; -} - -glm::vec3 SceneItemTransform::getLocalPosition() { - return this->localPosition; -} - -glm::vec3 SceneItemTransform::getLocalScale() { - return this->localScale; -} - -glm::quat SceneItemTransform::getLocalRotation() { - return this->localRotation; -} - -void SceneItemTransform::setParent(std::shared_ptr parent) { - if(this->parent.lock() == parent) return; - - auto self = dynamic_cast(this); - assertNotNull(self, "Cannot set parent of null item?"); - - if(auto oldParent = this->parent.lock()) { - auto &children = oldParent->children; - children.erase( - std::remove_if( - children.begin(), - children.end(), - [self](std::weak_ptr &item) { - return item.lock() == self->shared_from_this(); - } - ), - children.end() - ); - } - this->parent = parent; - if(auto newParent = this->parent.lock()) { - newParent->children.push_back(self->shared_from_this()); - } - this->updateWorldTransformFromParent(); -} - -void SceneItemTransform::setLocalTransform(const glm::mat4 transform) { - this->transformLocal = transform; - this->updateLocalValuesFromLocalTransform(); - this->updateWorldTransformFromLocalTransform(); -} - -void SceneItemTransform::setWorldTransform(const glm::mat4 transform) { - this->transformWorld = transform; - this->updateLocalTransformFromWorldTransform(); - this->updateChildrenWorldTransforms(); -} - -void SceneItemTransform::setLocalPosition(const glm::vec3 position) { - this->localPosition = position; - this->updateLocalTransformFromLocalValues(); -} - -void SceneItemTransform::setLocalScale(const glm::vec3 scale) { - this->localScale = scale; - this->updateLocalTransformFromLocalValues(); -} - -void SceneItemTransform::setLocalRotation(const glm::quat rotation) { - this->localRotation = rotation; - this->updateLocalTransformFromLocalValues(); -} - -bool_t SceneItemTransform::isChildOf(std::shared_ptr item) { - assertNotNull(item, "Cannot check if child of null item."); - auto parent = this->getParent(); - while(parent) { - if(parent == item) return true; - parent = parent->getParent(); - } - return false; -} - -void SceneItemTransform::lookAt( - const glm::vec3 position, - const glm::vec3 target, - const glm::vec3 up -) { - this->setWorldTransform(glm::lookAt(position, target, up)); -} - -float_t SceneItemTransform::lookAtPixelPerfect( - const glm::vec3 &position, - const glm::vec3 &look, - const float_t viewportHeight, - const float_t fov, - const float_t scale -) { - float_t z = ( - tanf((glm::radians(180.0f) - fov) / 2.0f) * - (viewportHeight/2.0f) - ) / scale; - this->lookAt( - glm::vec3(position.x, position.y, position.z + z), - look, - glm::vec3(0, 1, 0) - ); - return z; -} - -SceneItemTransform::~SceneItemTransform() { - std::for_each( - this->children.begin(), - this->children.end(), - [](std::weak_ptr &item) { - if(auto child = item.lock()) { - child->parent.reset(); - child->updateWorldTransformFromParent(); - } - } - ); - this->children.clear(); - this->parent.reset(); -} \ No newline at end of file diff --git a/src/dawn/scene/item/SceneItemTransform.hpp b/src/dawn/scene/item/SceneItemTransform.hpp deleted file mode 100644 index a91f1969..00000000 --- a/src/dawn/scene/item/SceneItemTransform.hpp +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class SceneItem; - - class SceneItemTransform { - protected: - // Local (real) values - glm::vec3 localPosition; - glm::vec3 localScale; - glm::quat localRotation; - - // Cached (non-real) values - glm::mat4 transformLocal; - glm::mat4 transformWorld; - - // Heirarchy - std::weak_ptr parent; - std::vector> children; - - /** - * Unpacks the local transform into the local transform matrix values. - */ - void updateLocalValuesFromLocalTransform(); - - /** - * Sets the local transform (and all local real values) to match the world - * transform values. - */ - void updateLocalTransformFromWorldTransform(); - - /** - * Updates the world transform of this items children. - */ - void updateChildrenWorldTransforms(); - - /** - * Called by the parent of this item when it's transform changes. - */ - void updateWorldTransformFromParent(); - - /** - * Updates the local transform of this item from the local values. - */ - void updateLocalTransformFromLocalValues(); - - /** - * Updates the world transform from this items local transform. - */ - void updateWorldTransformFromLocalTransform(); - - public: - SceneItemTransform(); - - /** - * Returns the parent of this scene item. - * - * @return Pointer to the parent of this scene item. - */ - std::shared_ptr getParent(); - - /** - * Returns the children of this scene item. - * - * @return Vector of pointers to the children of this scene item. - */ - std::vector> getChildren(); - - /** - * Returns the local transform of this item (relative to its parent). - * - * @return Local transform of this item. - */ - glm::mat4 getLocalTransform(); - - /** - * Returns the world transform of this item (relative to scene root). - * - * @return World transform of this item. - */ - glm::mat4 getWorldTransform(); - - /** - * Gets the local position of this item (relative to its parent). - * - * @return Local position of this item. - */ - glm::vec3 getLocalPosition(); - - /** - * Local scale of this item (relative to its parent). - * - * @return Local scale of this item. - */ - glm::vec3 getLocalScale(); - - /** - * Local rotation of this item (relative to its parent). - * - * @return Local rotation of this item. - */ - glm::quat getLocalRotation(); - - /** - * Sets the parent of this item. - * - * @param parent Parent of this item. - */ - void setParent(std::shared_ptr parent); - - /** - * Sets the transform of this item within local space (relative to parent) - * - * @param transform Transform of this item in local space. - */ - void setLocalTransform(const glm::mat4 transform); - - /** - * Sets the transform of this item within world space (relative to scene - * root) - * - * @param transform Transform of this item in world space. - */ - void setWorldTransform(const glm::mat4 transform); - - /** - * Sets the local position of this item (relative to its parent). - * - * @param position Local position of this item. - */ - void setLocalPosition(const glm::vec3 position); - - /** - * Sets the local scale of this item (relative to its parent). - * - * @param scale Local scale of this item. - */ - void setLocalScale(const glm::vec3 scale); - - /** - * Sets the local rotation of this item (relative to its parent). - * - * @param rotation Local rotation of this item. - */ - void setLocalRotation(const glm::quat rotation); - - /** - * Returns whether or not this item is a child of the given item. This - * will traverse up the entire heirarchy to confirm. - * - * @return True if this item is within the given item's heirarchy. - */ - bool_t isChildOf(std::shared_ptr item); - - /** - * Orients this transform to look at a given point in world space. - * - * @param position Position of the origin of this transform. - * @param look Position in world space this transform looks at. - * @param up Up vector of this transform. - */ - void lookAt( - const glm::vec3 position, - const glm::vec3 look, - const glm::vec3 up - ); - - /** - * Shorthand combined for lookAt and perspectivePixelPerfectDistance - * to allow you to create pixel perfect lookAt camera view matricies. - * - * @param position Position of the camera. Z is for an offset. - * @param look Position in world space this transform looks at. - * @param viewportHeight Height of the viewport. - * @param fov Field of view (in radians). - * @return The Z distance that was calculated. - */ - float_t lookAtPixelPerfect( - const glm::vec3 &position, - const glm::vec3 &look, - const float_t viewportHeight, - const float_t fov, - const float_t scale = 1.0f - ); - - virtual ~SceneItemTransform(); - }; -} \ No newline at end of file diff --git a/src/dawn/time.c b/src/dawn/time.c new file mode 100644 index 00000000..5e4ac00a --- /dev/null +++ b/src/dawn/time.c @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "time.h" +#include "assert/assert.h" + +dawntime_t TIME; + +void timeInit() { + TIME.delta = 0.0f; + TIME.time = 0.0f; +} + +void timeUpdate(const float_t delta) { + assertTrue(delta > 0, "time delta must be greater than 0."); + + TIME.delta = delta; + TIME.time += delta; +} \ No newline at end of file diff --git a/src/dawn/time.h b/src/dawn/time.h new file mode 100644 index 00000000..d8d225f5 --- /dev/null +++ b/src/dawn/time.h @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +typedef struct { + float_t delta; + float_t time; +} dawntime_t; + +extern dawntime_t TIME; + +/** + * Initializes the time system. + */ +void timeInit(); + +/** + * Updates the time system. + * + * @param delta Time since last update. + */ +void timeUpdate(const float_t delta); \ No newline at end of file diff --git a/src/dawn/time/CMakeLists.txt b/src/dawn/time/CMakeLists.txt deleted file mode 100644 index 07371285..00000000 --- a/src/dawn/time/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - ITimeManager.cpp -) - -# Subdirs -add_subdirectory(event) \ No newline at end of file diff --git a/src/dawn/time/ITimeManager.cpp b/src/dawn/time/ITimeManager.cpp deleted file mode 100644 index e780fac7..00000000 --- a/src/dawn/time/ITimeManager.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "ITimeManager.hpp" - -using namespace Dawn; - -ITimeManager::~ITimeManager() { - -} \ No newline at end of file diff --git a/src/dawn/time/ITimeManager.hpp b/src/dawn/time/ITimeManager.hpp deleted file mode 100644 index b0e7fc8b..00000000 --- a/src/dawn/time/ITimeManager.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class ITimeManager { - public: - float_t delta = 0.016f; - float_t time = 0.016f; - - /** - * Ticks / updates the time management system. - */ - virtual void update() = 0; - - /** - * Returns the real world time epoch. - * - * @return Epoch time in milliseconds. - */ - virtual int64_t getRealTime() = 0; - - /** - * Cleans up the time manager. - */ - virtual ~ITimeManager(); - }; -} \ No newline at end of file diff --git a/src/dawn/time/event/CMakeLists.txt b/src/dawn/time/event/CMakeLists.txt deleted file mode 100644 index 514f06a7..00000000 --- a/src/dawn/time/event/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - IntervalEvent.cpp - TimeoutEvent.cpp -) \ No newline at end of file diff --git a/src/dawn/time/event/IntervalEvent.cpp b/src/dawn/time/event/IntervalEvent.cpp deleted file mode 100644 index a7025788..00000000 --- a/src/dawn/time/event/IntervalEvent.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "IntervalEvent.hpp" - -using namespace Dawn; - -IntervalEvent::IntervalEvent() : CustomEvent() { - internalData = 0.0f; -} - -enum CustomEventResult IntervalEvent::shouldEmit( - const struct IntervalEventData &listener -) { - if(listener.nextInvoke > internalData) return CustomEventResult::NOTHING; - return CustomEventResult::INVOKE; -} - -struct IntervalEventData IntervalEvent::transformData(const float_t &interval) { - - return { - .interval = interval, - .nextInvoke = internalData + interval - }; -} - -struct IntervalEventData IntervalEvent::transformDataAfterEmit( - const struct IntervalEventData &listenerData -) { - return { - .interval = listenerData.interval, - .nextInvoke = listenerData.nextInvoke + listenerData.interval - }; -} - -void IntervalEvent::tick(const float_t delta) { - internalData += delta; - emit(); -} \ No newline at end of file diff --git a/src/dawn/time/event/IntervalEvent.hpp b/src/dawn/time/event/IntervalEvent.hpp deleted file mode 100644 index a404efe8..00000000 --- a/src/dawn/time/event/IntervalEvent.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "event/CustomEvent.hpp" - -namespace Dawn { - struct IntervalEventData { - float_t interval; - float_t nextInvoke; - }; - - class IntervalEvent : public CustomEvent< - float_t, struct IntervalEventData, float_t - > { - protected: - enum CustomEventResult shouldEmit( - const struct IntervalEventData &listener - ) override; - struct IntervalEventData transformData(const float_t &interval) override; - struct IntervalEventData transformDataAfterEmit( - const struct IntervalEventData &listenerData - ) override; - - public: - IntervalEvent(); - - /** - * Ticks this interval event by a time delta amount. Will also emit all - * events that are ready to be emitted. - * - * @param delta Delta time. - */ - void tick(const float_t delta); - }; -} \ No newline at end of file diff --git a/src/dawn/time/event/TimeoutEvent.cpp b/src/dawn/time/event/TimeoutEvent.cpp deleted file mode 100644 index 72ce8955..00000000 --- a/src/dawn/time/event/TimeoutEvent.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TimeoutEvent.hpp" - -using namespace Dawn; - -TimeoutEvent::TimeoutEvent() : CustomEvent() { - internalData = 0.0f; -} - -enum CustomEventResult TimeoutEvent::shouldEmit(const float_t &listener) { - if(listener > internalData) return CustomEventResult::NOTHING; - return CustomEventResult::INVOKE_AND_REMOVE; -} - -float_t TimeoutEvent::transformData(const float_t &interval) { - return interval; -} - -void TimeoutEvent::tick(const float_t delta) { - internalData += delta; - emit(); -} \ No newline at end of file diff --git a/src/dawn/time/event/TimeoutEvent.hpp b/src/dawn/time/event/TimeoutEvent.hpp deleted file mode 100644 index 8386dde5..00000000 --- a/src/dawn/time/event/TimeoutEvent.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "event/CustomEvent.hpp" - -namespace Dawn { - class TimeoutEvent : public CustomEvent { - protected: - enum CustomEventResult shouldEmit(const float_t &listener) override; - float_t transformData(const float_t &timeout) override; - - public: - TimeoutEvent(); - - /** - * Ticks this timeout event by a time delta amount. Will also emit all - * events that are ready to be emitted. - * - * @param delta Delta time. - */ - void tick(const float_t delta); - }; -} \ No newline at end of file diff --git a/src/dawn/ui/CMakeLists.txt b/src/dawn/ui/CMakeLists.txt deleted file mode 100644 index 3d47b6db..00000000 --- a/src/dawn/ui/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - UIAlignableElement.cpp - UISubAlignableElement.cpp - UIElement.cpp - UIMenu.cpp -) - -# Subdirs -add_subdirectory(container) -add_subdirectory(elements) \ No newline at end of file diff --git a/src/dawn/ui/UIAlignableElement.cpp b/src/dawn/ui/UIAlignableElement.cpp deleted file mode 100644 index 79489c2d..00000000 --- a/src/dawn/ui/UIAlignableElement.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIAlignableElement.hpp" - -using namespace Dawn; - -UIAlignableElement::UIAlignableElement() { - alignUnit[0] = UIAlignmentUnit::SCALE; - alignUnit[1] = UIAlignmentUnit::SCALE; - alignUnit[2] = UIAlignmentUnit::SCALE; - alignUnit[3] = UIAlignmentUnit::SCALE; - - eventAlignmentUpdated = [&](const glm::vec2 p, const glm::vec2 s) { - }; -} - -void UIAlignableElement::updateSelfAlignment( - const glm::vec2 pPos, - const glm::vec2 pSize, - const float_t canvasScale -) { - auto valueAxis = [&]( - const enum UIAlignmentUnit unit, - const float_t alignment, - const float_t parentSize, - const float_t ratioSize, - const float_t contentSize - ) { - if(alignment == UI_ALIGN_SIZE_AUTO) return contentSize; - - switch(unit) { - case UIAlignmentUnit::PIXEL: - return alignment; - - case UIAlignmentUnit::SCALE: - return canvasScale * alignment; - - case UIAlignmentUnit::PERCENT: - return parentSize * (alignment / 100.0f); - - case UIAlignmentUnit::RATIO: - return (alignment / 100.0f) * ratioSize; - - default: - assertUnreachable("Invalid UIAlignmentType"); - return 0.0f; - } - }; - - auto alignAxis = [&]( - const enum UIAlignmentType type, - const enum UIAlignmentUnit unit0, - const enum UIAlignmentUnit unit1, - const float_t alignment0, - const float_t alignment1, - const float_t parentSize, - const float_t ratioSize, - const float_t contentSize, - float_t &outPosition, - float_t &outSize - ) { - switch(type) { - case UIAlignmentType::START: - outPosition = valueAxis( - unit0, - alignment0, - parentSize, - ratioSize, - contentSize - ); - outSize = valueAxis( - unit1, - alignment1, - parentSize, - ratioSize, - contentSize - ); - break; - - case UIAlignmentType::MIDDLE: - outSize = valueAxis( - unit1, - alignment1, - parentSize, - ratioSize, - contentSize - ); - outPosition = (parentSize / 2.0f) - (contentSize / 2.0f) + valueAxis( - unit0, - alignment0, - parentSize, - ratioSize, - contentSize - ); - break; - - case UIAlignmentType::END: - outSize = valueAxis( - unit0, - alignment0, - parentSize, - ratioSize, - contentSize - ); - outPosition = parentSize - outSize - valueAxis( - unit1, - alignment1, - parentSize, - ratioSize, - contentSize - ); - break; - - case UIAlignmentType::STRETCH: - outPosition = valueAxis( - unit0, - alignment0, - parentSize, - ratioSize, - contentSize - ); - outSize = parentSize - (outPosition + valueAxis( - unit1, - alignment1, - parentSize, - ratioSize, - contentSize - )); - break; - - default: - assertUnreachable("Invalid UIAlignmentType"); - } - }; - - bool_t heightFirst = ( - alignUnit[0] == UIAlignmentUnit::RATIO || - alignUnit[2] == UIAlignmentUnit::RATIO - ); - - if(heightFirst) { - // Align height first, this will define size.y which we can use as the ratio - // for the width/X axis alignment. - alignAxis( - alignY, - alignUnit[1], - alignUnit[3], - align[1], - align[3], - pSize.y, - 0, - this->getContentHeight(), - position.y, - size.y - ); - alignAxis( - alignX, - alignUnit[0], - alignUnit[2], - align[0], - align[2], - pSize.x, - size.y, - this->getContentWidth(), - position.x, - size.x - ); - } else { - alignAxis( - alignX, - alignUnit[0], - alignUnit[2], - align[0], - align[2], - pSize.x, - 0, - this->getContentWidth(), - position.x, - size.x - ); - alignAxis( - alignY, - alignUnit[1], - alignUnit[3], - align[1], - align[3], - pSize.y, - size.x, - this->getContentHeight(), - position.y, - size.y - ); - } - - this->position += pPos; - this->eventAlignmentUpdated(position, size); -} - -bool_t UIAlignableElement::hasExplicitWidth() { - if(alignX == UIAlignmentType::STRETCH) return true; - if(alignX == UIAlignmentType::END) { - return align[1] != UI_ALIGN_SIZE_AUTO; - } - return align[3] != UI_ALIGN_SIZE_AUTO; - -} - -bool_t UIAlignableElement::hasExplicitHeight() { - if(alignY == UIAlignmentType::STRETCH) return true; - if(alignY == UIAlignmentType::END) { - return align[0] != UI_ALIGN_SIZE_AUTO; - } - return align[2] != UI_ALIGN_SIZE_AUTO; -} - -float_t UIAlignableElement::getWidth() { - if(hasExplicitWidth()) return size.x; - return getContentWidth(); -} - -float_t UIAlignableElement::getHeight() { - if(hasExplicitHeight()) return size.y; - return getContentHeight(); -} - - -void UIAlignableElement::updateAlignment( - const glm::vec2 pPos, - const glm::vec2 pSize, - const float_t canvasScale -) { - this->updateSelfAlignment(pPos, pSize, canvasScale); - - // Now update children alignment - auto children = getChildren(); - for(auto &c : children) { - c->updateAlignment(this->position, this->size, canvasScale); - } -} \ No newline at end of file diff --git a/src/dawn/ui/UIAlignableElement.hpp b/src/dawn/ui/UIAlignableElement.hpp deleted file mode 100644 index 83223e13..00000000 --- a/src/dawn/ui/UIAlignableElement.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIElement.hpp" - -namespace Dawn { - #define UI_ALIGN_SIZE_AUTO -1.0f - - enum class UIAlignmentType { - START, - MIDDLE, - END, - STRETCH - }; - - enum class UIAlignmentUnit { - PIXEL, - SCALE, - PERCENT, - RATIO - }; - - class UIAlignableElement : public UIElement { - protected: - glm::vec2 position; - glm::vec2 size; - - /** - * Updates the alignment of this element ONLY. - * - * @param parentPosition The position of the parent. - * @param parentSize The size of the parent. - * @param canvasScale The scale of the canvas. - */ - virtual void updateSelfAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ); - - /** - * Returns true only if the width of this component is explicitly set. - * - * @return True if the width of this component is explicitly set. - */ - bool_t hasExplicitWidth(); - - /** - * Returns true only if the height of this component is explicitly set. - * - * @return True if the height of this component is explicitly set. - */ - bool_t hasExplicitHeight(); - - public: - // Primary alignment controls - glm::vec4 align = glm::vec4(0, 0, 0, 0); - enum UIAlignmentType alignX = UIAlignmentType::STRETCH; - enum UIAlignmentType alignY = UIAlignmentType::STRETCH; - enum UIAlignmentUnit alignUnit[4]; - - std::function< - void(const glm::vec2, const glm::vec2) - > eventAlignmentUpdated; - - /** - * Constructor for the UIAlignableElement. - */ - UIAlignableElement(); - - float_t getWidth() override; - float_t getHeight() override; - - void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/ui/UIElement.cpp b/src/dawn/ui/UIElement.cpp deleted file mode 100644 index 3663223a..00000000 --- a/src/dawn/ui/UIElement.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIElement.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -std::vector> UIElement::getChildren() { - return {}; -} - -void UIElement::getSelfQuads(UICanvas &ctx) { - //Do nothing -} - -float_t UIElement::getContentWidth() { - return 0.0f; -} - -float_t UIElement::getContentHeight() { - return 0.0f; -} - -float_t UIElement::getWidth() { - return this->getContentWidth(); -} - -float_t UIElement::getHeight() { - return this->getContentHeight(); -} - -void UIElement::getQuads(UICanvas &ctx) { - this->getSelfQuads(ctx); - - auto children = getChildren(); - for(auto &c : children) { - c->getQuads(ctx); - } -} - -void UIElement::updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale -) { - auto children = getChildren(); - for(auto &c : children) { - c->updateAlignment(parentPosition, parentSize, canvasScale); - } -} \ No newline at end of file diff --git a/src/dawn/ui/UIElement.hpp b/src/dawn/ui/UIElement.hpp deleted file mode 100644 index cc5583ae..00000000 --- a/src/dawn/ui/UIElement.hpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/UIShader.hpp" -#include "component/ui/UICanvas.hpp" - -namespace Dawn { - class UIElement { - protected: - /** - * Virtual method overridden by the UIElement to get the quads for the - * component. - * - * @param alignment The alignment of this component. - * @param ctx The canvas to add the quads to. - */ - virtual void getSelfQuads(UICanvas &ctx); - - public: - /** - * Overrided method by the UI Element that requests the minimum - * width of the content. - * - * @return The minimum width of the content. - */ - virtual float_t getContentWidth(); - - /** - * Overrided method by the UI Element that requests the minimum - * height of the content. - * - * @return The minimum height of the content. - */ - virtual float_t getContentHeight(); - - /** - * Returns the width of this component. - * - * @return The width of this component. - */ - virtual float_t getWidth(); - - /** - * Returns the height of this component. - * - * @return The height of this component. - */ - virtual float_t getHeight(); - - /** - * Virtual method overridden by the UIElement to get the children of - * this component. - */ - virtual std::vector> getChildren(); - - /** - * Method called by the UICanvas to get the quads for this component. - * - * @param ctx The canvas to add the quads to. - */ - void getQuads(UICanvas &ctx); - - /** - * Updates the alignment of this component based on the parent. Typically - * left to the UIAlignableElement to implement, default implementation - * does nothing but invoke children. - * - * @param parentPosition The position of the parent. - * @param parentSize The size of the parent. - */ - virtual void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ); - }; -} \ No newline at end of file diff --git a/src/dawn/ui/UIMenu.cpp b/src/dawn/ui/UIMenu.cpp deleted file mode 100644 index 031488dc..00000000 --- a/src/dawn/ui/UIMenu.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIMenu.hpp" - -using namespace Dawn; - -void UIMenu::setPosition(int32_t x, int32_t y) { - assertTrue(x >= 0, "X position must be greater than or equal to 0."); - assertTrue(y >= 0, "Y position must be greater than or equal to 0."); - assertTrue(x < columns, "X must be less than the number of columns."); - assertTrue(y < rows, "Y must be less than the number of rows."); - - if(this->x == x && this->y == y) return; - - this->x = x; - this->y = y; - - eventPositionChanged.emit(x, y); -} - -void UIMenu::setSize(int32_t columns, int32_t rows) { - assertTrue(columns > 0, "Columns must be greater than 0."); - assertTrue(rows > 0, "Rows must be greater than 0."); - assertTrue(columns > x, "Columns must be greater than current x position."); - assertTrue(rows > y, "Rows must be greater than current y position."); - - if(this->columns == columns && this->rows == rows) return; - - this->columns = columns; - this->rows = rows; -} - -int32_t UIMenu::getX() { - return x; -} - -int32_t UIMenu::getY() { - return y; -} - -int32_t UIMenu::getColumns() { - return columns; -} - -int32_t UIMenu::getRows() { - return rows; -} \ No newline at end of file diff --git a/src/dawn/ui/UIMenu.hpp b/src/dawn/ui/UIMenu.hpp deleted file mode 100644 index 8a769f82..00000000 --- a/src/dawn/ui/UIMenu.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIElement.hpp" - -namespace Dawn { - class UIMenu final : public UIElement { - private: - int32_t x = 0; - int32_t y = 0; - int32_t columns = 1; - int32_t rows = 1; - - public: - Event eventPositionChanged; - - /** - * Sets the position of this menu. - * - * @param x The x position of this menu. - * @param y The y position of this menu. - */ - void setPosition(int32_t x, int32_t y); - - /** - * Sets the size of this menu. - * - * @param columns The number of columns in this menu. - * @param rows The number of rows in this menu. - */ - void setSize(int32_t columns, int32_t rows); - - /** - * Gets the x position of this menu. - * - * @return The x position of this menu. - */ - int32_t getX(); - - /** - * Gets the y position of this menu. - * - * @return The y position of this menu. - */ - int32_t getY(); - - /** - * Gets the number of columns in this menu. - * - * @return The number of columns in this menu. - */ - int32_t getColumns(); - - /** - * Gets the number of rows in this menu. - * - * @return The number of rows in this menu. - */ - int32_t getRows(); - }; -} \ No newline at end of file diff --git a/src/dawn/ui/UISubAlignableElement.cpp b/src/dawn/ui/UISubAlignableElement.cpp deleted file mode 100644 index 778a6fa0..00000000 --- a/src/dawn/ui/UISubAlignableElement.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UISubAlignableElement.hpp" - -using namespace Dawn; - -void UISubAlignableElement::updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale -) { - UIAlignableElement::updateAlignment(parentPosition, parentSize, canvasScale); - - switch(this->subAlignX) { - case UISubAlignment::START: - this->subAlignedPosition.x = this->position.x; - break; - - case UISubAlignment::MIDDLE: - this->subAlignedPosition.x = ( - this->position.x + - (this->size.x / 2.0f) - - (this->getContentWidth() / 2.0f) - ); - break; - - case UISubAlignment::END: - this->subAlignedPosition.x = ( - this->position.x + - this->size.x - - this->getContentWidth() - ); - break; - - default: - assertUnreachable("Unknown UISubAlignment!"); - } - - switch(this->subAlignY) { - case UISubAlignment::START: - this->subAlignedPosition.y = this->position.y; - break; - - case UISubAlignment::MIDDLE: - this->subAlignedPosition.y = ( - this->position.y + - (this->size.y / 2.0f) - - (this->getContentHeight() / 2.0f) - ); - break; - - case UISubAlignment::END: - this->subAlignedPosition.y = ( - this->position.y + - this->size.y - - this->getContentHeight() - ); - break; - - default: - assertUnreachable("Unknown UISubAlignment!"); - } - - this->eventSubAlignmentUpdated.emit(this->subAlignedPosition); -} \ No newline at end of file diff --git a/src/dawn/ui/UISubAlignableElement.hpp b/src/dawn/ui/UISubAlignableElement.hpp deleted file mode 100644 index 151b12b3..00000000 --- a/src/dawn/ui/UISubAlignableElement.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIAlignableElement.hpp" - -namespace Dawn { - enum class UISubAlignment { - START, - MIDDLE, - END - }; - - class UISubAlignableElement : public UIAlignableElement { - protected: - glm::vec2 subAlignedPosition; - - public: - Event eventSubAlignmentUpdated; - - enum UISubAlignment subAlignX = UISubAlignment::START; - enum UISubAlignment subAlignY = UISubAlignment::START; - - void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/ui/container/CMakeLists.txt b/src/dawn/ui/container/CMakeLists.txt deleted file mode 100644 index 89ba7623..00000000 --- a/src/dawn/ui/container/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - UIColumnContainer.cpp - UIContainer.cpp - UIPaddingContainer.cpp - UIRowContainer.cpp -) \ No newline at end of file diff --git a/src/dawn/ui/container/UIColumnContainer.cpp b/src/dawn/ui/container/UIColumnContainer.cpp deleted file mode 100644 index e0cdd5e8..00000000 --- a/src/dawn/ui/container/UIColumnContainer.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "UIColumnContainer.hpp" - -using namespace Dawn; - -void UIColumnContainer::updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale -) { - this->updateSelfAlignment(parentPosition, parentSize, canvasScale); - - // Now we have our dimensions, divide evenly - auto children = this->getChildren(); - - float_t x = 0.0f; - float_t xPiece = this->size.x / (float_t)children.size(); - - // Update all children - for(auto &child : children) { - child->updateAlignment( - this->position + glm::vec2(x, 0), - glm::vec2( - xPiece, - this->size.y - ), - canvasScale - ); - x += xPiece; - } -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIColumnContainer.hpp b/src/dawn/ui/container/UIColumnContainer.hpp deleted file mode 100644 index 464be00c..00000000 --- a/src/dawn/ui/container/UIColumnContainer.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/container/UIContainer.hpp" - -namespace Dawn { - class UIColumnContainer final : public UIContainer { - public: - void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIContainer.cpp b/src/dawn/ui/container/UIContainer.cpp deleted file mode 100644 index 85770599..00000000 --- a/src/dawn/ui/container/UIContainer.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "UIContainer.hpp" - -using namespace Dawn; - -std::vector> UIContainer::getChildren() { - return this->children; -} - -float_t UIContainer::getContentWidth() { - float_t width = 0; - auto children = this->getChildren(); - for(auto child : children) { - width = Math::max(width, child->getWidth()); - } - return width; -} - -float_t UIContainer::getContentHeight() { - float_t height = 0; - auto children = this->getChildren(); - for(auto child : children) { - height = Math::max(height, child->getHeight()); - } - return height; -} - -void UIContainer::appendChild(std::shared_ptr child) { - assertNotNull(child, "Cannot append a null child!"); - this->children.push_back(child); -} - -void UIContainer::removeChild(std::shared_ptr child) { - assertNotNull(child, "Cannot remove a null child!"); - auto it = std::find(this->children.begin(), this->children.end(), child); - if(it == this->children.end()) return; - this->children.erase(it); -} - -void UIContainer::clearChildren() { - this->children.clear(); -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIContainer.hpp b/src/dawn/ui/container/UIContainer.hpp deleted file mode 100644 index b25cae18..00000000 --- a/src/dawn/ui/container/UIContainer.hpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIAlignableElement.hpp" - -namespace Dawn { - class UIContainer : public UIAlignableElement { - private: - std::vector> children; - - public: - std::vector> getChildren() override; - - float_t getContentWidth() override; - float_t getContentHeight() override; - - /** - * Appends a child to this container. - * - * @param child Child to append. - */ - void appendChild(std::shared_ptr child); - - /** - * Removes a child from this container. - * - * @param child Child to remove. - */ - void removeChild(std::shared_ptr child); - - /** - * Removes all children from this container. - */ - void clearChildren(); - }; -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIPaddingContainer.cpp b/src/dawn/ui/container/UIPaddingContainer.cpp deleted file mode 100644 index 344a6d1d..00000000 --- a/src/dawn/ui/container/UIPaddingContainer.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIPaddingContainer.hpp" - -using namespace Dawn; - -float_t UIPaddingContainer::getContentWidth() { - float_t width = 0.0f; - for(auto &child : getChildren()) { - width = Math::max(width, child->getWidth()); - } - return width + padding.x + padding.z; -} - -float_t UIPaddingContainer::getContentHeight() { - float_t height = 0.0f; - for(auto &child : getChildren()) { - height = Math::max(height, child->getHeight()); - } - return height + padding.y + padding.w; -} - -void UIPaddingContainer::updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale -) { - glm::vec2 childPosition = parentPosition + glm::vec2(padding.x, padding.y); - glm::vec2 childSize = parentSize - glm::vec2(padding.x + padding.z, padding.y + padding.w); - - auto children = getChildren(); - for(auto &child : children) { - child->updateAlignment(childPosition, childSize, canvasScale); - } -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIPaddingContainer.hpp b/src/dawn/ui/container/UIPaddingContainer.hpp deleted file mode 100644 index 32578929..00000000 --- a/src/dawn/ui/container/UIPaddingContainer.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/container/UIContainer.hpp" - -namespace Dawn { - class UIPaddingContainer final : public UIContainer { - public: - glm::vec4 padding = { 0, 0, 0, 0 }; - - float_t getContentWidth() override; - float_t getContentHeight() override; - void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIRowContainer.cpp b/src/dawn/ui/container/UIRowContainer.cpp deleted file mode 100644 index 39823368..00000000 --- a/src/dawn/ui/container/UIRowContainer.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIRowContainer.hpp" - -using namespace Dawn; - -float_t UIRowContainer::getContentWidth() { - float_t width = 0.0f; - for(auto &child : this->getChildren()) { - width = Math::max(width, child->getWidth()); - } - return width; -} - -float_t UIRowContainer::getContentHeight() { - float_t height = 0.0f; - for(auto &child : this->getChildren()) { - height += child->getHeight(); - } - return height; -} - -void UIRowContainer::updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale -) { - this->updateSelfAlignment(parentPosition, parentSize, canvasScale); - - // Now we have our dimensions, divide evenly - auto children = this->getChildren(); - - float_t y = 0.0f; - float_t yPiece = this->size.y / (float_t)children.size(); - - // Update all children - for(auto &child : children) { - child->updateAlignment( - this->position + glm::vec2(0, y), - glm::vec2( - this->size.x, - yPiece - ), - canvasScale - ); - y += yPiece; - } -} \ No newline at end of file diff --git a/src/dawn/ui/container/UIRowContainer.hpp b/src/dawn/ui/container/UIRowContainer.hpp deleted file mode 100644 index 2363a7ee..00000000 --- a/src/dawn/ui/container/UIRowContainer.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/container/UIContainer.hpp" - -namespace Dawn { - class UIRowContainer final : public UIContainer { - public: - float_t getContentWidth() override; - float_t getContentHeight() override; - void updateAlignment( - const glm::vec2 parentPosition, - const glm::vec2 parentSize, - const float_t canvasScale - ) override; - }; -} \ No newline at end of file diff --git a/src/dawn/ui/elements/CMakeLists.txt b/src/dawn/ui/elements/CMakeLists.txt deleted file mode 100644 index bff5eaf1..00000000 --- a/src/dawn/ui/elements/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - UILabel.cpp - UIRectangle.cpp -) \ No newline at end of file diff --git a/src/dawn/ui/elements/UILabel.cpp b/src/dawn/ui/elements/UILabel.cpp deleted file mode 100644 index cdc21960..00000000 --- a/src/dawn/ui/elements/UILabel.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UILabel.hpp" - -using namespace Dawn; - -void UILabel::getSelfQuads(UICanvas &ctx) { - std::vector quads; - if(this->texture == nullptr || this->text.empty()) return; - - glm::vec4 quad; - glm::vec2 pos = glm::vec2(0, this->texture->fontSize); - bool_t lastCharWasSpace = false; - size_t len = Math::min(this->text.size(), this->renderCharacterCount); - float_t maxWidth = this->hasExplicitWidth() ? this->size.x : std::numeric_limits::max(); - - for(size_t i = 0; i < len; i++) { - wchar_t c = text[i]; - auto info = texture->getCharacterData(c); - - // Newline(s) - if(c == L'\n') { - pos.x = 0; - pos.y += this->texture->fontSize; - continue; - } - - // Spaces - if(c == L' ') { - pos.x += info.advance.x; - lastCharWasSpace = true; - continue; - } - - // Word Wrap - if(wordWrap) { - if(lastCharWasSpace) { - // Scan ahead to next space - float_t wordWidth = pos.x;// Start at current position and scan ahead. - for(size_t j = i; j < text.size(); j++) { - wchar_t c2 = text[j]; - if(c2 == L' ' || c2 == L'\n') { - break;// If we hit another space, we are OK. - } - - // Will this character fit on the row? If not the whole word will wrap. - auto info2 = texture->getCharacterData(c); - wordWidth += info.advance.x; - if(wordWidth > maxWidth) { - pos.x = 0; - pos.y += this->texture->fontSize; - break; - } - } - - lastCharWasSpace = false; - } - // } else if(pos.x + info.size.x > subAlignedPosition.x + size.x) { - // // Not word wrap, but instead just overflow characters. - // pos.x = 0; - // pos.y += this->texture->fontSize; - } - - ctx.addQuad( - { - subAlignedPosition.x + pos.x + info.offset.x, - subAlignedPosition.y + pos.y + info.offset.y, - subAlignedPosition.x + pos.x + info.size.x + info.offset.x, - subAlignedPosition.y + pos.y + info.size.y + info.offset.y - }, - { - info.quad.x, - info.quad.y, - info.quad.z, - info.quad.w - }, - this->color, - UIShaderQuadStyle::FONT, - texture->texture - ); - pos += info.advance; - } -} - -float_t UILabel::getContentWidth() { - if(this->texture == nullptr || this->text.empty()) return 0.0f; - - float_t lineWidth = 0.0f; - float_t width = 0.0f; - for(wchar_t c : text) { - if(c == L'\n') { - width = Math::max(width, lineWidth); - lineWidth = 0.0f; - continue; - } - - auto info = texture->getCharacterData(c); - lineWidth += info.advance.x; - if( - this->hasExplicitWidth() && - lineWidth >= size.x - ) return size.x; - } - width = Math::max(width, lineWidth); - return width; -} - -float_t UILabel::getContentHeight() { - if(this->texture == nullptr || this->text.empty()) return 0.0f; - - float_t height = this->texture->fontSize; - float_t lineWidth = 0.0f; - bool_t lastCharWasSpace = false; - - for(wchar_t c : text) { - if(c == L'\n') { - height += this->texture->fontSize; - continue; - } - - auto info = texture->getCharacterData(c); - - if(c == L' ') { - lineWidth += info.advance.x; - lastCharWasSpace = true; - continue; - } - - if(wordWrap) { - if(lastCharWasSpace) { - // Scan ahead to next space - float_t wordWidth = lineWidth;// Start at current position and scan ahead. - for(size_t j = 0; j < text.size(); j++) { - wchar_t c2 = text[j]; - if(c2 == L' ' || c2 == L'\n') { - break;// If we hit another space, we are OK. - } - - // Will this character fit on the row? If not the whole word will wrap. - auto info2 = texture->getCharacterData(c); - wordWidth += info.advance.x; - if(wordWidth > size.x) { - height += this->texture->fontSize; - lineWidth = 0.0f; - break; - } - } - - lastCharWasSpace = false; - } - // } else if(lineWidth + info.size.x > size.x) { - // height += this->texture->fontSize; - // lineWidth = 0.0f; - } - } - - return height; -} - -std::shared_ptr UILabel::getFont() { - return this->texture; -} - -std::wstring UILabel::getText() { - return this->text; -} - -void UILabel::setFont(std::shared_ptr texture) { - this->texture = texture; -} - -void UILabel::setText(const std::wstring &text) { - this->text = text; - this->renderCharacterCount = text.size(); -} \ No newline at end of file diff --git a/src/dawn/ui/elements/UILabel.hpp b/src/dawn/ui/elements/UILabel.hpp deleted file mode 100644 index 5823d39b..00000000 --- a/src/dawn/ui/elements/UILabel.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UISubAlignableElement.hpp" -#include "display/font/TrueTypeTexture.hpp" - -namespace Dawn { - class UILabel final : public UISubAlignableElement { - private: - std::shared_ptr texture = nullptr; - std::wstring text = L"Hello World"; - - protected: - void getSelfQuads(UICanvas &ctx) override; - - public: - bool_t wordWrap = true; - struct Color color = COLOR_WHITE; - size_t renderCharacterCount = 0; - - float_t getContentWidth() override; - float_t getContentHeight() override; - - /** - * Returns the font used for this label. - * - * @return The font used for this label. - */ - std::shared_ptr getFont(); - - /** - * Returns the text used for this label. - * - * @return The text used for this label. - */ - std::wstring getText(); - - /** - * Sets the font to use for this label. - * - * @param texture TrueType texture to use for this label. - */ - void setFont(std::shared_ptr texture); - - /** - * Sets the text to use for this label. - * - * @param text The text to use for this label. - */ - void setText(const std::wstring &text); - }; -} diff --git a/src/dawn/ui/elements/UIRectangle.cpp b/src/dawn/ui/elements/UIRectangle.cpp deleted file mode 100644 index 996303b9..00000000 --- a/src/dawn/ui/elements/UIRectangle.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UIRectangle.hpp" - -using namespace Dawn; - -void UIRectangle::getSelfQuads(UICanvas &ctx) { - std::vector quads; - ctx.addQuad( - glm::vec4(position, position + size), - uv, - color, - UIShaderQuadStyle::TEXTURED, - texture - ); -} \ No newline at end of file diff --git a/src/dawn/ui/elements/UIRectangle.hpp b/src/dawn/ui/elements/UIRectangle.hpp deleted file mode 100644 index 73cc1587..00000000 --- a/src/dawn/ui/elements/UIRectangle.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UIAlignableElement.hpp" - -namespace Dawn { - class UIRectangle final : public UIAlignableElement { - protected: - void getSelfQuads(UICanvas &ctx) override; - - public: - struct Color color = COLOR_WHITE; - std::shared_ptr texture = nullptr; - glm::vec4 uv = glm::vec4(0,0,1,1); - }; -} \ No newline at end of file diff --git a/src/dawn/util/CMakeLists.txt b/src/dawn/util/CMakeLists.txt deleted file mode 100644 index a7edbc6a..00000000 --- a/src/dawn/util/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Easing.cpp - String.cpp - Random.cpp -) \ No newline at end of file diff --git a/src/dawn/util/Easing.cpp b/src/dawn/util/Easing.cpp deleted file mode 100644 index ad48d16a..00000000 --- a/src/dawn/util/Easing.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Easing.hpp" - -using namespace Dawn; - -float_t Easing::linear(float_t t) { - return t; -} - -float_t Easing::easeInQuad(float_t t) { - return t * t; -} - -float_t Easing::easeOutQuad(float_t t) { - return t * (2 - t); -} - -float_t Easing::easeInOutQuad(float_t t) { - return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; -} - -float_t Easing::easeInCubic(float_t t) { - return t * t * t; -} - -float_t Easing::easeOutCubic(float_t t) { - return (--t) * t * t + 1; -} - -float_t Easing::easeInOutCubic(float_t t) { - return t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1; -} - -float_t Easing::easeInQuart(float_t t) { - return t * t * t * t; -} - -float_t Easing::easeOutQuart(float_t t) { - return 1 - (--t) * t * t * t; -} - -float_t Easing::easeInOutQuart(float_t t) { - return t < 0.5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t; -} - -float_t Easing::easeInQuint(float_t t) { - return t * t * t * t * t; -} - -float_t Easing::easeOutQuint(float_t t) { - return 1 + (--t) * t * t * t * t; -} - -float_t Easing::easeInOutQuint(float_t t) { - return t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t; -} - -float_t Easing::easeInSine(float_t t) { - return 1 - cos(t * M_PI_2); -} - -float_t Easing::easeOutSine(float_t t) { - return sin(t * M_PI_2); -} - -float_t Easing::easeInOutSine(float_t t) { - return 0.5 * (1 - cos(M_PI * t)); -} - -float_t Easing::easeInExpo(float_t t) { - return t == 0 ? 0 : pow(2, 10 * (t - 1)); -} - -float_t Easing::easeOutExpo(float_t t) { - return t == 1 ? 1 : 1 - pow(2, -10 * t); -} - -float_t Easing::easeInOutExpo(float_t t) { - if(t == 0) return 0; - if(t == 1) return 1; - if(t < 0.5) return 0.5 * pow(2, 20 * t - 10); - return 1 - 0.5 * pow(2, -20 * t + 10); -} - -float_t Easing::easeInCirc(float_t t) { - return 1 - sqrt(1 - t * t); -} - -float_t Easing::easeOutCirc(float_t t) { - return sqrt(1 - (--t) * t); -} - -float_t Easing::easeInOutCirc(float_t t) { - return t < 0.5 ? 0.5 * (1 - sqrt(1 - 4 * t * t)) : 0.5 * (sqrt(-((2 * t) - 3) * ((2 * t) - 1)) + 1); -} \ No newline at end of file diff --git a/src/dawn/util/Easing.hpp b/src/dawn/util/Easing.hpp deleted file mode 100644 index d22b8668..00000000 --- a/src/dawn/util/Easing.hpp +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class Easing final { - public: - /** - * Linear easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t linear(float_t t); - - /** - * Quadratic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInQuad(float_t t); - - /** - * Quadratic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutQuad(float_t t); - - /** - * Quadratic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutQuad(float_t t); - - /** - * Cubic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInCubic(float_t t); - - /** - * Cubic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutCubic(float_t t); - - /** - * Cubic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutCubic(float_t t); - - /** - * Quartic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInQuart(float_t t); - - /** - * Quartic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutQuart(float_t t); - - /** - * Quartic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutQuart(float_t t); - - /** - * Quintic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInQuint(float_t t); - - /** - * Quintic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutQuint(float_t t); - - /** - * Quintic easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutQuint(float_t t); - - /** - * Sine easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInSine(float_t t); - - /** - * Sine easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutSine(float_t t); - - /** - * Sine easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutSine(float_t t); - - /** - * Exponential easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInExpo(float_t t); - - /** - * Exponential easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutExpo(float_t t); - - /** - * Exponential easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutExpo(float_t t); - - /** - * Circular easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInCirc(float_t t); - - /** - * Circular easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeOutCirc(float_t t); - - /** - * Circular easing function. - * - * @param t Time value between 0 and 1. - * @return Eased value. - */ - static float_t easeInOutCirc(float_t t); - }; -} \ No newline at end of file diff --git a/src/dawn/util/Flag.hpp b/src/dawn/util/Flag.hpp deleted file mode 100644 index 9c5c3eb5..00000000 --- a/src/dawn/util/Flag.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class Flag final { - public: - template - static void turnOn(T &flag, const T check) { - flag |= check; - } - - template - static void turnOff(T &flag, const T check) { - flag &= ~check; - } - - template - static bool_t isOn(const T flag, const T check) { - return (flag & check) == check; - } - - template - static bool_t isOff(const T flag, const T check) { - return (flag & check) == 0; - } - }; -} \ No newline at end of file diff --git a/src/dawn/util/Macro.hpp b/src/dawn/util/Macro.hpp deleted file mode 100644 index bcfb26e8..00000000 --- a/src/dawn/util/Macro.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once - -#define MACRO_STRINGIFY_RAW(x) #x -#define MACRO_STRINGIFY(x) MACRO_STRINGIFY_RAW(x) - -#define MACRO_JOIN(x, y) x ## y \ No newline at end of file diff --git a/src/dawn/util/Math.hpp b/src/dawn/util/Math.hpp deleted file mode 100644 index 1723fbb3..00000000 --- a/src/dawn/util/Math.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright (c) 2022 Dominic Masters - * - * This software is released under the MIT License. - * https://opensource.org/licenses/MIT - */ - -#pragma once -#include "dawnlibs.hpp" - -#define MATH_PI 3.1415926535897f - -namespace Dawn { - class Math final { - public: - /** - * Returns the largest of the two provided int32 numbers. - * - * @param left Left number to get the largest of. - * @param right Right number to get the largest of. - * @return The larger of the two numbers - */ - template - static T max(T left, T right) { - return left < right ? right : left; - } - - /** - * Returns the smallest of two provided int32 numbers. - * - * @param left Left number to get the smallest of. - * @param right Right number to get the smallest of. - * @return Smaller of the two numbers. - */ - template - static T min(T left, T right) { - return left < right ? left : right; - } - - /** - * Returns the input value, constrained between the min and max values, so that - * the value cannot underceed the min, and cannot exceed the max. - * - * @param val Value to get the clamp for. - * @param min Minimum clamping value. - * @param max Maximum clamping value. - * @return The value, or the closest clamped value. - */ - template - static T clamp(T val, T min, T max) { - return mathMin(mathMax(val, min), max); - } - - /** - * Returns the absolute value (the non-negative representation of) for the given - * int32 number.Abs values will be -value if value < 0. - * - * @param value Value to get the absolute value for. - * @return The absolute value (-value if value < 0) - */ - template - static T abs(T value) { - return value < 0 ? -value : value; - } - - /** - * Returns the modulous a result for b. Works for floating point numbers. - * - * @param a Number to modulo against. (a % b) - * @param b Number to modulo with. (a % b) - * @returns The modulo result. - */ - template - static inline T mod(T value, T modulo) { - return ((value % modulo) + modulo) % modulo; - } - - static inline float_t fmod(float_t value, float_t modulo) { - float_t n = fmod(value, modulo); - return n; - } - - /** - * Convert degrees to radians. - * - * @param n Degrees to convert. - * @returns The number in radians. - */ - static float_t deg2rad(float_t degrees) { - return degrees * (MATH_PI / 180.0f); - } - - /** - * Convert radians to degrees. - * @param n Radians to convert. - * @returns The number in degrees. - */ - static float_t rad2deg(float_t n) { - return (n * 180.0f) / MATH_PI; - } - - /** - * Round a number to the nearest whole number. - * @param n Number to round. - * @return Rounded number. - */ - template - static T round(const float_t n) { - return (T)roundf(n); - } - - /** - * Rounds the number down to the nearest whole number. - * @param n Number to round down. - * @return Rounded number. - */ - template - static T floor(const float_t n) { - return (T)floorf(n); - } - - /** - * Get the square root of a number. - * - * @param n Number to get the square root of. - * @return float_t - */ - static float_t sqrt(const float_t n) { - return sqrtf(n); - } - - template - static T ceil(const float_t n) { - return (T)ceilf(n); - } - - /** - * Returns the next power of two for the given number. - * - * @param n Number to get the next power of two for. - * @return The next power of two. - */ - template - static T nextPowerOfTwo(T n) { - n--; - n |= n >> 1; - n |= n >> 2; - n |= n >> 4; - n |= n >> 8; - n |= n >> 16; - n++; - return n; - } - }; -} \ No newline at end of file diff --git a/src/dawn/util/Random.cpp b/src/dawn/util/Random.cpp deleted file mode 100644 index 5be63f82..00000000 --- a/src/dawn/util/Random.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Random.hpp" - -using namespace Dawn; - -void Random::seed(const uint64_t seed) { - srand(seed); -} - -uint64_t Random::next() { - return rand(); -} \ No newline at end of file diff --git a/src/dawn/util/Random.hpp b/src/dawn/util/Random.hpp deleted file mode 100644 index 78f14e7a..00000000 --- a/src/dawn/util/Random.hpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class Random final { - public: - /** - * Seeds the random number generator with the provided seed. - * - * @param seed Seed to use for the random number generator. - */ - static void seed(const uint64_t seed); - - /** - * Returns the next random number from the generator. - * - * @return The next random number. - */ - static uint64_t next(); - - /** - * Returns a random number between 0 and RAND_MAX. - * - * @return Random number between 0 and RAND_MAX. - */ - template - static T random() { - return (T)next(); - } - - /** - * Returns a random number between the provided min and max values. - * - * @param min Minimum value for the random number. - * @param max Maximum value for the random number. - * @return Random number between min and max. - */ - static float_t random(float_t min, float_t max) { - return min + (float_t)next() / (float_t)RAND_MAX * (max - min); - } - - /** - * Returns a random number between the provided min and max values. - * - * @param min Minimum value for the random number. - * @param max Maximum value for the random number. - * @return Random number between min and max. - */ - template - static T random(T min, T max) { - return (T)(min + (next() % (max - min + 1))); - } - }; -} \ No newline at end of file diff --git a/src/dawn/util/String.cpp b/src/dawn/util/String.cpp deleted file mode 100644 index cf8ba655..00000000 --- a/src/dawn/util/String.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "String.hpp" - -using namespace Dawn; - -std::string String::toLowercase(const std::string &str) { - std::string result = str; - std::transform(result.begin(), result.end(), result.begin(), ::tolower); - return result; -} - -bool_t String::includes(const std::string &str, const std::string &needle) { - return str.find(needle) != std::string::npos; -} - -std::vector String::split( - const std::string &s, - const std::string &delim -) { - size_t posStart = 0, posEnd, delimLength = delim.length(); - std::string token; - std::vector res; - - while((posEnd = s.find(delim, posStart)) != std::string::npos) { - token = s.substr(posStart, posEnd - posStart); - posStart = posEnd + delimLength; - res.push_back (token); - } - - res.push_back(s.substr(posStart)); - return res; -} \ No newline at end of file diff --git a/src/dawn/util/String.hpp b/src/dawn/util/String.hpp deleted file mode 100644 index a2d45dde..00000000 --- a/src/dawn/util/String.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - class String { - public: - /** - * Converts the given string to lowercase. - * - * @param str String to convert. - * @return The lowercase string. - */ - static std::string toLowercase(const std::string &str); - - /** - * Checks if the given string includes the given needle. - * - * @param str String to check. - * @param needle String to check for. - * @return True if the string includes the needle. - */ - static bool_t includes(const std::string &str, const std::string &needle); - - /** - * Splits the given string by the given delimiter. - * - * @param str String to split. - * @param delim Delimiter to split by. - * @return The split string. - */ - static std::vector split( - const std::string &str, - const std::string &delim - ); - }; -} \ No newline at end of file diff --git a/src/dawnglfw/CMakeLists.txt b/src/dawnglfw/CMakeLists.txt deleted file mode 100644 index 1e3a44e4..00000000 --- a/src/dawnglfw/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Libs -target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC - glfw - glad -) - -# Platform variables -# target_compile_definitions(${DAWN_TARGET_NAME} -# PUBLIC -# DAWN_OPENGL_GLSL=true -# ) - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -# Subdirs -add_subdirectory(display) -add_subdirectory(input) -add_subdirectory(time) \ No newline at end of file diff --git a/src/dawnglfw/dawnopengl.hpp b/src/dawnglfw/dawnopengl.hpp deleted file mode 100644 index 81865d1e..00000000 --- a/src/dawnglfw/dawnopengl.hpp +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include \ No newline at end of file diff --git a/src/dawnglfw/display/CMakeLists.txt b/src/dawnglfw/display/CMakeLists.txt deleted file mode 100644 index f9935303..00000000 --- a/src/dawnglfw/display/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - RenderHost.cpp -) \ No newline at end of file diff --git a/src/dawnglfw/display/RenderHost.cpp b/src/dawnglfw/display/RenderHost.cpp deleted file mode 100644 index 9549290b..00000000 --- a/src/dawnglfw/display/RenderHost.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "RenderHost.hpp" -#include "assert/assertgl.hpp" -#include "assert/assert.hpp" -#include "game/Game.hpp" -#include "display/RenderPipeline.hpp" - -using namespace Dawn; - -RenderHost::RenderHost() : IRenderHost() { - -} - -void RenderHost::init(const std::shared_ptr game) { - // Init GLFW - if(!glfwInit()) { - assertUnreachable("Failed to initialize GLFW!"); - } - - // Set the error callback for error handling. - glfwSetErrorCallback([](int error, const char *description) { - assertUnreachable(description); - }); - - // Setup window hints - glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, false); - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); - - // Create the window - window = glfwCreateWindow( - DAWN_GLFW_WINDOW_WIDTH_DEFAULT, - DAWN_GLFW_WINDOW_HEIGHT_DEFAULT, - "Dawn", - NULL, - NULL - ); - - // Validate window exists - if(!window) assertUnreachable("Failed to create GLFW window!"); - - // Setup the user pointer - glfwSetWindowUserPointer(window, game.get()); - - // Load GLAD - glfwMakeContextCurrent(window); - glfwSwapInterval(1); - gladLoadGLLoader((GLADloadproc)glfwGetProcAddress); - assertNoGLError(); - - // Get the resolution and scale/dpi - backBufferRenderTarget = std::make_shared(); - - int32_t fbWidth, fbHeight; - int32_t windowWidth, windowHeight; - glfwGetFramebufferSize(window, &fbWidth, &fbHeight); - glfwGetWindowSize(window, &windowWidth, &windowHeight); - - assertTrue(fbWidth > 0, "Detected framebuffer width is too small?"); - assertTrue(fbWidth > 0, "Detected framebuffer height is too small?"); - assertTrue(windowWidth > 0, "Detected window width is too small?"); - assertTrue(windowHeight > 0, "Detected window height is too small?"); - - backBufferRenderTarget->setSize(fbWidth, fbHeight); - backBufferRenderTarget->scale = (float_t)fbWidth / (float_t)windowWidth; - - // Framebuffer callback - glfwSetFramebufferSizeCallback(window, []( - GLFWwindow *window, - int32_t width, - int32_t height - ) { - // if(this->window == nullptr || window != this->window) return; - Game* game = (Game*)glfwGetWindowUserPointer(window); - assertNotNull(game, "Game cannot be null!"); - game->renderHost.backBufferRenderTarget->setSize(width, height); - }); -} - -void RenderHost::update(const std::shared_ptr game) { - // Prepare the initial values - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - assertNoGLError(); - glBlendFuncSeparate( - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_ONE, - GL_ONE_MINUS_SRC_ALPHA - ); - assertNoGLError(); - glDepthMask(GL_TRUE); - assertNoGLError(); - glDepthFunc(GL_LESS); - assertNoGLError(); - // glEnable(GL_DEPTH_TEST); - assertNoGLError(); - glEnable(GL_BLEND); - assertNoGLError(); - - // Pipeline - renderPipeline.render(game); - - // Tick the engine. - glfwSwapBuffers(window); - - // Update events - glfwPollEvents(); -} - -bool_t RenderHost::isCloseRequested() { - if(this->window == nullptr) return false; - return glfwWindowShouldClose(this->window); -} - -std::shared_ptr RenderHost::getBackBufferRenderTarget() { - return std::static_pointer_cast(backBufferRenderTarget); -} - -RenderHost::~RenderHost() { - if(this->window != nullptr) { - glfwDestroyWindow(this->window); - this->window = nullptr; - } - glfwTerminate(); -} \ No newline at end of file diff --git a/src/dawnglfw/display/RenderHost.hpp b/src/dawnglfw/display/RenderHost.hpp deleted file mode 100644 index c2fe9211..00000000 --- a/src/dawnglfw/display/RenderHost.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/IRenderHost.hpp" -#include "display/BackBufferRenderTarget.hpp" -#include -#include - -#define DAWN_GLFW_WINDOW_WIDTH_DEFAULT 1280 -#define DAWN_GLFW_WINDOW_HEIGHT_DEFAULT 720 - -namespace Dawn { - class Game; - - class RenderHost : public IRenderHost { - public: - std::shared_ptr backBufferRenderTarget; - GLFWwindow *window = nullptr; - - /** - * Initializes the GLFW RenderHost. - */ - RenderHost(); - - void init(const std::shared_ptr game) override; - void update(const std::shared_ptr game) override; - bool_t isCloseRequested() override; - std::shared_ptr getBackBufferRenderTarget() override; - - ~RenderHost(); - }; -} \ No newline at end of file diff --git a/src/dawnglfw/input/CMakeLists.txt b/src/dawnglfw/input/CMakeLists.txt deleted file mode 100644 index 156a1086..00000000 --- a/src/dawnglfw/input/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - InputManager.cpp -) \ No newline at end of file diff --git a/src/dawnglfw/input/InputManager.cpp b/src/dawnglfw/input/InputManager.cpp deleted file mode 100644 index c9317c5d..00000000 --- a/src/dawnglfw/input/InputManager.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "InputManager.hpp" -#include "game/Game.hpp" - -using namespace Dawn; - -void InputManager::init(const std::shared_ptr game) { - auto window = game->renderHost.window; - - glfwSetCursorPosCallback(window, []( - GLFWwindow* window, - double_t x, - double_t y - ) { - auto game = (Game*)glfwGetWindowUserPointer(window); - assertNotNull(game, "Game is not set on window user pointer."); - game->inputManager.rawInputValues[INPUT_MANAGER_AXIS_MOUSE_X] = (float_t) x; - game->inputManager.rawInputValues[INPUT_MANAGER_AXIS_MOUSE_Y] = (float_t) y; - }); - - glfwSetMouseButtonCallback(window, []( - GLFWwindow* window, - int32_t button, - int32_t action, - int32_t mods - ) { - auto game = (Game*)glfwGetWindowUserPointer(window); - assertNotNull(game, "Game is not set on window user pointer."); - switch(action) { - case GLFW_PRESS: - game->inputManager.rawInputValues[INPUT_MANAGER_AXIS_MOUSE_0 + button] = 1.0f; - return; - case GLFW_RELEASE: - game->inputManager.rawInputValues[INPUT_MANAGER_AXIS_MOUSE_0 + button] = 0.0f; - return; - default: - return; - } - }); - - glfwSetKeyCallback(window, []( - GLFWwindow* window, - int32_t key, - int32_t scancode, - int32_t action, - int32_t mods - ) { - auto game = (Game*)glfwGetWindowUserPointer(window); - assertNotNull(game, "Game is not set on window user pointer."); - - switch(action) { - case GLFW_PRESS: - game->inputManager.rawInputValues[key] = 1.0f; - return; - case GLFW_RELEASE: - game->inputManager.rawInputValues[key] = 0.0f; - return; - default: - return; - } - }); - - // Set default values - this->bind(InputBind::Up, GLFW_KEY_W); - this->bind(InputBind::Up, GLFW_KEY_UP); - this->bind(InputBind::Down, GLFW_KEY_S); - this->bind(InputBind::Down, GLFW_KEY_DOWN); - this->bind(InputBind::Left, GLFW_KEY_A); - this->bind(InputBind::Left, GLFW_KEY_LEFT); - this->bind(InputBind::Right, GLFW_KEY_D); - this->bind(InputBind::Right, GLFW_KEY_RIGHT); - this->bind(InputBind::Run, GLFW_KEY_LEFT_SHIFT); - this->bind(InputBind::Run, GLFW_KEY_RIGHT_SHIFT); - this->bind(InputBind::Action, GLFW_KEY_SPACE); - this->bind(InputBind::Action, GLFW_KEY_ENTER); - this->bind(InputBind::Action, GLFW_KEY_E); -} - -float_t InputManager::getInputValue(int32_t axis) { - auto exist = rawInputValues.find(axis); - if(exist == rawInputValues.end()) return 0.0f; - return exist->second; -} - -InputManager::~InputManager() { - // Nothing to do here. -} \ No newline at end of file diff --git a/src/dawnglfw/input/InputManager.hpp b/src/dawnglfw/input/InputManager.hpp deleted file mode 100644 index 6b1f15bf..00000000 --- a/src/dawnglfw/input/InputManager.hpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "input/IInputManager.hpp" - -#define INPUT_MANAGER_AXIS_MOUSE_X -580000 -#define INPUT_MANAGER_AXIS_MOUSE_Y -580001 -#define INPUT_MANAGER_AXIS_MOUSE_0 -590000 - -namespace Dawn { - class Game; - - class InputManager : public IInputManager { - protected: - float_t getInputValue(int32_t axis) override; - - public: - std::unordered_map rawInputValues; - - /** - * Initializes the input manager system. - * - * @param game Game that this input manager is for. - */ - void init(const std::shared_ptr game); - - /** - * Cleans up the GLFW input manager. - */ - ~InputManager(); - }; -} \ No newline at end of file diff --git a/src/dawnglfw/time/CMakeLists.txt b/src/dawnglfw/time/CMakeLists.txt deleted file mode 100644 index 8c9c29c9..00000000 --- a/src/dawnglfw/time/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - TimeManager.cpp -) \ No newline at end of file diff --git a/src/dawnglfw/time/TimeManager.cpp b/src/dawnglfw/time/TimeManager.cpp deleted file mode 100644 index 28bc536a..00000000 --- a/src/dawnglfw/time/TimeManager.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TimeManager.hpp" -#include -#include -#include -#include -#include - -using namespace Dawn; - -TimeManager::TimeManager() { - lastUpdate = glfwGetTime(); -} - -void TimeManager::update() { - double_t newTime = glfwGetTime(); - delta = ( - (float_t)(newTime - lastUpdate) - ); - time += delta; - lastUpdate = newTime; -} - -int64_t TimeManager::getRealTime() { - auto millisec_since_epoch = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()) .count(); - return millisec_since_epoch; -} \ No newline at end of file diff --git a/src/dawnglfw/time/TimeManager.hpp b/src/dawnglfw/time/TimeManager.hpp deleted file mode 100644 index 4b434502..00000000 --- a/src/dawnglfw/time/TimeManager.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "time/ITimeManager.hpp" - -namespace Dawn { - class TimeManager : public ITimeManager { - private: - double_t lastUpdate = 0; - public: - /** - * Constructs and initializes the TimeManager. - */ - TimeManager(); - - void update() override; - int64_t getRealTime() override; - }; -} \ No newline at end of file diff --git a/src/dawnhelloworld/CMakeLists.txt b/src/dawnhelloworld/CMakeLists.txt deleted file mode 100644 index 841ba55b..00000000 --- a/src/dawnhelloworld/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -# Subdirs -add_subdirectory(game) -add_subdirectory(scene) - -# Assets -include("${DAWN_ASSETS_SOURCE_DIR}/games/helloworld/CMakeLists.txt") \ No newline at end of file diff --git a/src/dawnhelloworld/game/CMakeLists.txt b/src/dawnhelloworld/game/CMakeLists.txt deleted file mode 100644 index 57b52897..00000000 --- a/src/dawnhelloworld/game/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - GameInit.cpp -) \ No newline at end of file diff --git a/src/dawnhelloworld/game/GameInit.cpp b/src/dawnhelloworld/game/GameInit.cpp deleted file mode 100644 index 4aef18a2..00000000 --- a/src/dawnhelloworld/game/GameInit.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "game/GameInit.hpp" -#include "scene/SceneList.hpp" - -using namespace Dawn; - -std::function GameInit::getInitialScene() { - return helloWorldScene; -} \ No newline at end of file diff --git a/src/dawnhelloworld/scene/CMakeLists.txt b/src/dawnhelloworld/scene/CMakeLists.txt deleted file mode 100644 index dfda9095..00000000 --- a/src/dawnhelloworld/scene/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - HelloWorldScene.cpp -) \ No newline at end of file diff --git a/src/dawnhelloworld/scene/HelloWorldScene.cpp b/src/dawnhelloworld/scene/HelloWorldScene.cpp deleted file mode 100644 index b935fbd7..00000000 --- a/src/dawnhelloworld/scene/HelloWorldScene.cpp +++ /dev/null @@ -1,101 +0,0 @@ - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scene/SceneList.hpp" -#include "component/display/Camera.hpp" -#include "prefab/SimpleSpinningCube.hpp" -#include "display/font/TrueTypeTexture.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" -#include "display/mesh/QuadMesh.hpp" - -#include "component/ui/UICanvas.hpp" -#include "ui/elements/UIRectangle.hpp" -#include "ui/elements/UILabel.hpp" -#include "ui/UIMenu.hpp" -#include "ui/container/UIRowContainer.hpp" -#include "ui/container/UIPaddingContainer.hpp" - -#include -#include FT_FREETYPE_H - -using namespace Dawn; - -std::shared_ptr texture; - -void Dawn::helloWorldScene(Scene &s) { - std::string font = "ysabeau_medium"; - texture = s.getGame()->assetManager.get(font, 24); - - while(!s.getGame()->assetManager.isLoaded(font)) { - s.getGame()->assetManager.update(); - } - - auto cameraItem = s.createSceneItem(); - auto camera = cameraItem->addComponent(); - cameraItem->lookAt({ 120, 0, 300 }, { 120, 0, 0 }, { 0, 1, 0 }); - camera->clipFar = 99999.99f; - - // auto quad = s.createSceneItem(); - // auto quadMesh = std::make_shared(); - - // glm::vec2 position = { 0, 0 }; - // glm::vec2 size = texture->bufferStringToMesh( - // quadMesh, - // L"Hello World!", - // position, - // true - // ); - - // auto quadRenderer = quad->addComponent(); - // quadRenderer->mesh = quadMesh; - - // auto quadMaterial = quad->addComponent(); - // quadMaterial->setTexture(texture->texture); - - auto uiCanvasItem = s.createSceneItem(); - auto uiCanvas = uiCanvasItem->addComponent(); - - auto container = std::make_shared(); - container->align = { 32, 32, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO }; - container->alignX = UIAlignmentType::START; - container->alignY = UIAlignmentType::START; - uiCanvas->addElement(container); - - auto rect = std::make_shared(); - rect->color = COLOR_MAGENTA; - container->appendChild(rect); - - auto menu = std::make_shared(); - menu->setSize(1, 4); - container->appendChild(menu); - - auto rowContainer = std::make_shared(); - container->appendChild(rowContainer); - - std::vector labels = { - L"New Game", - L"Load Game", - L"Options", - L"Exit" - }; - - for(auto &label : labels) { - auto padding = std::make_shared(); - padding->align = { 0, 0, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO }; - padding->alignX = UIAlignmentType::START; - padding->alignY = UIAlignmentType::START; - padding->padding = { 8, 8, 8, 8 }; - - auto labelElement = std::make_shared(); - labelElement->wordWrap = false; - labelElement->align = { 0, 0, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO }; - labelElement->setText(label); - labelElement->setFont(texture); - - padding->appendChild(labelElement); - rowContainer->appendChild(padding); - } -} \ No newline at end of file diff --git a/src/dawnhelloworld/scene/SceneList.hpp b/src/dawnhelloworld/scene/SceneList.hpp deleted file mode 100644 index 6ab98c67..00000000 --- a/src/dawnhelloworld/scene/SceneList.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/Scene.hpp" - -namespace Dawn { - void helloWorldScene(Scene &s); -} \ No newline at end of file diff --git a/src/dawnlinux/CMakeLists.txt b/src/dawnlinux/CMakeLists.txt index 8fdb7f82..fbf02cd0 100644 --- a/src/dawnlinux/CMakeLists.txt +++ b/src/dawnlinux/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Dominic Masters +# Copyright (c) 2024 Dominic Masters # # This software is released under the MIT License. # https://opensource.org/licenses/MIT @@ -15,14 +15,8 @@ target_include_directories(${DAWN_TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR} ) -# Platform variables -# target_compile_definitions(${DAWN_TARGET_NAME} -# PUBLIC -# DAWN_ASSET_LOCATION="../../assets.tar" -# ) - # Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - main.cpp + main.c ) \ No newline at end of file diff --git a/src/dawnlinux/main.c b/src/dawnlinux/main.c new file mode 100644 index 00000000..c6284411 --- /dev/null +++ b/src/dawnlinux/main.c @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "main.h" +#include "rpg/world/map.h" +#include "game.h" +#include "linuxhost.h" + + +int32_t main() { + gameInit(); + + return linuxHostBeginUpdating(); +} \ No newline at end of file diff --git a/src/dawnlinux/main.cpp b/src/dawnlinux/main.cpp deleted file mode 100644 index 47e26ed8..00000000 --- a/src/dawnlinux/main.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "main.hpp" -#include "assert/assert.hpp" -#include "display/RenderHost.hpp" -#include "game/Game.hpp" -#include "asset/AssetDataLoader.hpp" -#include "environment/Environment.hpp" -#include - -using namespace Dawn; -namespace fs = std::filesystem; - -FILE * AssetDataLoader::openAssetArchiveFile() { - auto path = environment.getVariable("assetsPath"); - auto file = fopen(path.c_str(), "rb"); - if(!file) { - assertUnreachable("Failed to open assets file.\n%s!", strerror(errno)); - return nullptr; - } - return file; -} - -int32_t main(int32_t argc, const char **argv) { - //Set the path - assertTrue(argc > 0, "No executable path provided."); - environment.setVariable("executablePath", argv[0]); - - auto execPath = fs::path(environment.getVariable("executablePath")); - auto execDir = execPath; - while(fs::is_directory(execDir)) execDir = execDir.parent_path(); - environment.setVariable("executableDir", execDir.string()); - - // Find the assets - std::vector pathsToTryAndFindAssets = { - execDir / "assets.tar", - execDir / "assets.zip", - execDir / "data" / "assets.tar", - execDir / "data" / "assets.zip", - execDir.parent_path() / "assets.tar", - execDir.parent_path() / "assets.zip", - execDir.parent_path() / "data" / "assets.tar", - execDir.parent_path() / "data" / "assets.zip", - execDir.parent_path().parent_path() / "assets.tar", - execDir.parent_path().parent_path() / "assets.zip", - execDir.parent_path().parent_path() / "data" / "assets.tar", - execDir.parent_path().parent_path() / "data" / "assets.zip" - }; - auto matchingPathIfAny = std::find_if(pathsToTryAndFindAssets.begin(), pathsToTryAndFindAssets.end(), [](const fs::path &p) { - return fs::exists(p); - }); - - if(matchingPathIfAny == pathsToTryAndFindAssets.end()) { - std::cout << "Could not find game assets" << std::endl; - return 1; - } - environment.setVariable("assetsPath", matchingPathIfAny->string()); - - //Create the game - auto game = std::make_shared(); - game->init(); - - while(!game->isCloseRequested()) { - game->update(); - } - - return 0; -} \ No newline at end of file diff --git a/src/dawnlinux/main.h b/src/dawnlinux/main.h new file mode 100644 index 00000000..61aef3a9 --- /dev/null +++ b/src/dawnlinux/main.h @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "dawn.h" + +/** + * Main entry point for the application. + * + * @return int32_t The exit code of the application. + */ +int32_t main(); \ No newline at end of file diff --git a/src/dawnlinux/main.hpp b/src/dawnlinux/main.hpp deleted file mode 100644 index 242c021e..00000000 --- a/src/dawnlinux/main.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -/** - * The main entry point for the program. - * - * @param argc The count of arguments passed to the program. - * @param argv The arguments passed to the program. - * @return 0 for success, anything else for failure. - */ -int32_t main(int32_t argc, const char **argv); \ No newline at end of file diff --git a/src/dawnopengl/CMakeLists.txt b/src/dawnopengl/CMakeLists.txt deleted file mode 100644 index 06abe398..00000000 --- a/src/dawnopengl/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -if(NOT DEFINED DAWN_OPENGL_EXCLUDE_LIBRARIES) - # Libraries - find_package(OpenGL REQUIRED) - - target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${OPENGL_INCLUDE_DIR} - ) - - target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC - ${OPENGL_LIBRARIES} - ) -endif() - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -# Subdirs -add_subdirectory(assert) -add_subdirectory(display) -# add_subdirectory(scene) \ No newline at end of file diff --git a/src/dawnopengl/assert/CMakeLists.txt b/src/dawnopengl/assert/CMakeLists.txt deleted file mode 100644 index 2310d7a3..00000000 --- a/src/dawnopengl/assert/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - assertgl.cpp -) \ No newline at end of file diff --git a/src/dawnopengl/assert/assertgl.cpp b/src/dawnopengl/assert/assertgl.cpp deleted file mode 100644 index b23b4262..00000000 --- a/src/dawnopengl/assert/assertgl.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assertgl.hpp" -#include "assert/assert.hpp" -#include "dawnopengl.hpp" - -void assertNotGLErrorCheck(const char *file, int32_t line) { - GLenum errorCode; - std::string fileString = file; - std::string error = "GL Error"; - int32_t errorCount = 0; - - while((errorCode = glGetError()) != GL_NO_ERROR) { - errorCount++; - switch (errorCode) { - case GL_INVALID_ENUM: - error += "\nINVALID_ENUM"; - break; - - case GL_INVALID_VALUE: - error += "\nINVALID_VALUE"; - break; - - case GL_INVALID_OPERATION: - error += "\nINVALID_OPERATION"; - break; - - case GL_STACK_OVERFLOW: - error += "\nSTACK_OVERFLOW"; - break; - - case GL_STACK_UNDERFLOW: - error += "\nSTACK_UNDERFLOW"; - break; - - case GL_OUT_OF_MEMORY: - error += "\nOUT_OF_MEMORY"; - break; - - case GL_INVALID_FRAMEBUFFER_OPERATION: - error += "\nINVALID_FRAMEBUFFER_OPERATION"; - break; - - default: - error += "\nUNKNOWN GL ERROR ERROR"; - break; - } - - error += " (" + std::to_string(errorCode) + ")"; - } - - if(errorCount != 0) { - error += "\n" + std::string(file) + " (" + std::to_string(line) + ")"; - assertUnreachable(error.c_str()); - } -} \ No newline at end of file diff --git a/src/dawnopengl/assert/assertgl.hpp b/src/dawnopengl/assert/assertgl.hpp deleted file mode 100644 index 9364327d..00000000 --- a/src/dawnopengl/assert/assertgl.hpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -/** - * Asserts that there are no OpenGL errors. - * - * @param file The file the assertion is being made in. - * @param line The line the assertion is being made in. - */ -void assertNotGLErrorCheck(const char *file, int32_t line); - -/** - * Asserts that there are no OpenGL errors. - */ -#define assertNoGLError() assertNotGLErrorCheck(__FILE__, __LINE__) \ No newline at end of file diff --git a/src/dawnopengl/display/BackBufferRenderTarget.cpp b/src/dawnopengl/display/BackBufferRenderTarget.cpp deleted file mode 100644 index 149a9e3d..00000000 --- a/src/dawnopengl/display/BackBufferRenderTarget.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "dawnopengl.hpp" -#include "assert/assert.hpp" -#include "assert/assertgl.hpp" -#include "util/Flag.hpp" -#include "BackBufferRenderTarget.hpp" - -using namespace Dawn; - -BackBufferRenderTarget::BackBufferRenderTarget() { - -} - -float_t BackBufferRenderTarget::getScale() { - return this->scale; -} - -float_t BackBufferRenderTarget::getWidth() { - return this->width; -} - -float_t BackBufferRenderTarget::getHeight() { - return this->height; -} - -void BackBufferRenderTarget::setSize( - const float_t width, - const float_t height -) { - if(this->width == width && this->height == height) return; - - // Fixes a new bug that it seems GLFW has introduced. - this->width = width == 0 ? 1 : width; - this->height = height == 0 ? 1 : height; - - onResize.emit(this->width, this->height); -} - -void BackBufferRenderTarget::setClearColor(const struct Color color) { - this->clearColor = color; -} - -void BackBufferRenderTarget::clear(const int32_t clearFlags) { - glClearColor(clearColor.r, clearColor.g, clearColor.b, 1.0f); - assertNoGLError(); - - GLbitfield mask = 0; - if(Flag::isOn(clearFlags, RENDER_TARGET_CLEAR_COLOR)) { - mask |= GL_COLOR_BUFFER_BIT; - } - - if(Flag::isOn(clearFlags, RENDER_TARGET_CLEAR_DEPTH)) { - mask |= GL_DEPTH_BUFFER_BIT; - } - - glClear(mask); - assertNoGLError(); -} - -void BackBufferRenderTarget::bind() { - glBindFramebuffer(GL_FRAMEBUFFER, 0); - assertNoGLError(); - glViewport(0, 0, (GLsizei)this->width, (GLsizei)this->height); - assertNoGLError(); -} \ No newline at end of file diff --git a/src/dawnopengl/display/BackBufferRenderTarget.hpp b/src/dawnopengl/display/BackBufferRenderTarget.hpp deleted file mode 100644 index 8f5b89d2..00000000 --- a/src/dawnopengl/display/BackBufferRenderTarget.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/Color.hpp" -#include "display/RenderTarget.hpp" - -namespace Dawn { - class BackBufferRenderTarget final : public RenderTarget { - private: - float_t width = 1; - float_t height = 1; - struct Color clearColor = COLOR_CORNFLOWER_BLUE; - - public: - float_t scale = 1.0f; - - /** - * Construct the back buffer render target. - */ - BackBufferRenderTarget(); - - float_t getScale() override; - float_t getWidth() override; - float_t getHeight() override; - void setClearColor(const struct Color color) override; - void clear(const int32_t) override; - void bind() override; - - /** - * Requests to modify the viewport directly. This is mostly to be called - * by whatever is setting the window/display resolution, so that the - * backbuffer can keep track of what the viewport size is. This should - * also be DPI aware, e.g. "4k @ 2xDPI, resulting in a 1080p equiv" should - * still call this method with 3840, 2160. - * - * @param width New width of the back buffer. - * @param height New height of the back buffer. - */ - void setSize(const float_t width, const float_t height); - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/CMakeLists.txt b/src/dawnopengl/display/CMakeLists.txt deleted file mode 100644 index f24fd602..00000000 --- a/src/dawnopengl/display/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - BackBufferRenderTarget.cpp - Texture.cpp -) - -# Subdirs -add_subdirectory(mesh) -add_subdirectory(shader) \ No newline at end of file diff --git a/src/dawnopengl/display/Texture.cpp b/src/dawnopengl/display/Texture.cpp deleted file mode 100644 index 90c5cf39..00000000 --- a/src/dawnopengl/display/Texture.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "assert/assertgl.hpp" -#include "Texture.hpp" - -using namespace Dawn; - -void Texture::bind(const uint8_t slot) { - assertTrue(this->id != -1, "Texture is not ready!"); - glActiveTexture(GL_TEXTURE0 + slot); - assertNoGLError(); - glBindTexture(GL_TEXTURE_2D, this->id); - assertNoGLError(); - this->updateTextureProperties(); -} - -int32_t Texture::getWidth() { - return this->width; -} - -int32_t Texture::getHeight() { - return this->height; -} - -bool_t Texture::isReady() { - return this->id != -1; -} - -void Texture::setSize( - const int32_t width, - const int32_t height, - const enum TextureFormat format, - const enum TextureDataFormat dataFormat -) { - if(this->id != -1) { - glDeleteTextures(1, &this->id); - assertNoGLError(); - this->id = -1; - } - - int32_t maxSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize); - assertTrue(width > 0 && width <= maxSize, "Width is out of bounds!"); - assertTrue(height > 0 && height <= maxSize, "Height is out of bounds!"); - - this->width = width; - this->height = height; - this->format = format; - this->dataFormat = dataFormat; - - glGenTextures(1, &this->id); - assertNoGLError(); - if(this->id <= 0) assertUnreachable("Texture generation failed!"); - - // Initialize the texture to blank - glActiveTexture(GL_TEXTURE0); - assertNoGLError(); - this->bufferRaw(NULL); -} - -// bool_t Texture::isReady() { -// return this->id != -1; -// } - -void Texture::updateTextureProperties() { - auto setWrapMode = [](GLenum axis, enum TextureWrapMode wm) { - switch(wm) { - case TextureWrapMode::REPEAT: - glTexParameteri(GL_TEXTURE_2D, axis, GL_REPEAT); - break; - - case TextureWrapMode::MIRRORED_REPEAT: - glTexParameteri(GL_TEXTURE_2D, axis, GL_MIRRORED_REPEAT); - break; - - case TextureWrapMode::CLAMP_TO_EDGE: - glTexParameteri(GL_TEXTURE_2D, axis, GL_CLAMP_TO_EDGE); - break; - - case TextureWrapMode::CLAMP_TO_BORDER: - glTexParameteri(GL_TEXTURE_2D, axis, GL_CLAMP_TO_BORDER); - break; - - default: - assertUnreachable("Unknown wrap mode!"); - } - assertNoGLError(); - }; - - setWrapMode(GL_TEXTURE_WRAP_S, this->wrapModeX); - setWrapMode(GL_TEXTURE_WRAP_T, this->wrapModeY); - - auto setFilterMode = []( - GLenum minMag, - enum TextureFilterMode filter, - enum TextureFilterMode mapFilterMode - ) { - switch(filter) { - case TextureFilterMode::NEAREST: { - glTexParameteri(GL_TEXTURE_2D, minMag, GL_NEAREST); - break; - } - - case TextureFilterMode::LINEAR: { - glTexParameteri(GL_TEXTURE_2D, minMag, GL_LINEAR); - break; - } - - default: { - assertUnreachable("Unknown filter mode!"); - } - } - assertNoGLError(); - }; - - setFilterMode( - GL_TEXTURE_MIN_FILTER, this->filterModeMin, this->mipMapFilterModeMin - ); - setFilterMode( - GL_TEXTURE_MAG_FILTER, this->filterModeMag, this->mipMapFilterModeMag - ); -} - -void Texture::bufferRaw(const void *data) { - assertTrue(this->id != -1, "Texture is not ready!"); - - GLenum format; - switch(this->format) { - case TextureFormat::R: - format = GL_RED; - break; - - case TextureFormat::RG: - format = GL_RG; - break; - - case TextureFormat::RGB: - format = GL_RGB; - break; - - case TextureFormat::RGBA: - format = GL_RGBA; - break; - - default: - assertUnreachable("Unknown texture format!"); - } - - GLenum dataFormat; - switch(this->dataFormat) { - case TextureDataFormat::UNSIGNED_BYTE: - dataFormat = GL_UNSIGNED_BYTE; - break; - - case TextureDataFormat::FLOAT: - dataFormat = GL_FLOAT; - break; - - default: - assertUnreachable("Unknown texture data format!"); - } - - glBindTexture(GL_TEXTURE_2D, this->id); - assertNoGLError(); - glTexImage2D( - GL_TEXTURE_2D, 0, format, - this->width, this->height, - 0, format, dataFormat, data - ); - assertNoGLError(); - glGenerateMipmap(GL_TEXTURE_2D); - assertNoGLError(); -} - -void Texture::buffer(const struct ColorU8 pixels[]) { - assertTrue( - this->dataFormat == TextureDataFormat::UNSIGNED_BYTE, - "Texture data format must be unsigned byte!" - ); - this->bufferRaw((void*)pixels); -} - -void Texture::buffer(const struct Color pixels[]) { - std::cout << "Correct buffer" << std::endl; - assertTrue( - this->dataFormat == TextureDataFormat::FLOAT, - "Texture data format must be float!" - ); - assertTrue( - this->format == TextureFormat::RGBA, - "Texture format must be RGBA!" - ); - this->bufferRaw((void*)pixels); -} - -void Texture::buffer(const uint8_t pixels[]) { - assertTrue( - this->dataFormat == TextureDataFormat::UNSIGNED_BYTE, - "Texture data format must be unsigned byte!" - ); - this->bufferRaw((void*)pixels); -} - -Texture::~Texture() { - if(this->id != -1) { - glDeleteTextures(1, &this->id); - assertNoGLError(); - } -} \ No newline at end of file diff --git a/src/dawnopengl/display/Texture.hpp b/src/dawnopengl/display/Texture.hpp deleted file mode 100644 index 15677102..00000000 --- a/src/dawnopengl/display/Texture.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnopengl.hpp" -#include "display/ITexture.hpp" - -namespace Dawn { - class TextureRenderTarget; - - typedef GLuint textureslot_t; - - class Texture : public ITexture { - private: - int32_t width = -1; - int32_t height = -1; - GLuint id = -1; - enum TextureFormat format; - enum TextureDataFormat dataFormat; - - void updateTextureProperties(); - void bufferRaw(const void *data); - - public: - int32_t getWidth() override; - int32_t getHeight() override; - void setSize( - const int32_t width, - const int32_t height, - const enum TextureFormat format, - const enum TextureDataFormat dataForat - ) override; - bool_t isReady() override; - void buffer(const struct ColorU8 pixels[]) override; - void buffer(const struct Color pixels[]); - void buffer(const uint8_t pixels[]) override; - void bind(const uint8_t slot) override; - - ~Texture(); - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/mesh/CMakeLists.txt b/src/dawnopengl/display/mesh/CMakeLists.txt deleted file mode 100644 index eabd105a..00000000 --- a/src/dawnopengl/display/mesh/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Mesh.cpp -) \ No newline at end of file diff --git a/src/dawnopengl/display/mesh/Mesh.cpp b/src/dawnopengl/display/mesh/Mesh.cpp deleted file mode 100644 index d1959f10..00000000 --- a/src/dawnopengl/display/mesh/Mesh.cpp +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) 2022 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "assert/assertgl.hpp" -#include "display/mesh/Mesh.hpp" - -using namespace Dawn; - -void Mesh::createBuffers( - const int32_t verticeCount, - const int32_t indiceCount -) { - assertTrue(verticeCount > 0, "Vertice count must be greater than zero."); - assertTrue(indiceCount > 0, "Indice count must be greater than zero."); - - // Can we re-use the buffers? - if( - verticeCount <= this->verticeCount && - indiceCount <= this->indiceCount - ) return; - - this->disposeBuffers(); - - this->verticeCount = verticeCount; - this->indiceCount = indiceCount; - - auto sizePos = sizeof(glm::vec3) * verticeCount; - auto sizeInds = sizeof(int32_t) * indiceCount; - auto sizeCoords = sizeof(glm::vec2) * verticeCount; - - // Generate vertex array, I don't think I need to do this tbh. - glGenVertexArrays(1, &this->vertexArray); - assertNoGLError(); - glBindVertexArray(this->vertexArray); - assertNoGLError(); - - // Create some buffers, one for the vertex data, one for the indices - GLuint buffer[2]; - glGenBuffers(2, buffer); - assertNoGLError(); - this->vertexBuffer = buffer[0]; - if(this->vertexBuffer < 0) assertUnreachable("Can't make vertex buffer"); - this->indexBuffer = buffer[1]; - if(this->indexBuffer < 0) assertUnreachable("Can't make index buffer"); - - // Buffer an empty set of data then buffer each component - glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer); - assertNoGLError(); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer); - assertNoGLError(); - glBufferData(GL_ARRAY_BUFFER, sizePos+sizeCoords, 0, GL_DYNAMIC_DRAW); - assertNoGLError(); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeInds, 0, GL_DYNAMIC_DRAW); - assertNoGLError(); - - // Setup the attrib pointers - size_t offset = 0; - glVertexAttribPointer( - 0, sizeof(glm::vec3) / sizeof(float_t), - GL_FLOAT, GL_FALSE, - 0, (void *)offset - ); - assertNoGLError(); - glEnableVertexAttribArray(0); - assertNoGLError(); - - offset += sizePos; - glVertexAttribPointer( - 1, sizeof(glm::vec2) / sizeof(float_t), - GL_FLOAT, GL_FALSE, - 0, (void *)offset - ); - assertNoGLError(); - glEnableVertexAttribArray(1); - assertNoGLError(); -} - -void Mesh::disposeBuffers() { - glBindBuffer(GL_ARRAY_BUFFER, 0); - assertNoGLError(); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - assertNoGLError(); - - if(this->vertexBuffer != -1) { - glDeleteBuffers(1, &this->vertexBuffer); - assertNoGLError(); - this->vertexBuffer = -1; - this->verticeCount = -1; - } - - if(this->indexBuffer != -1) { - glDeleteBuffers(1, &this->indexBuffer); - assertNoGLError(); - this->indexBuffer = -1; - this->indiceCount = -1; - } - - if(this->vertexArray) { - glDeleteVertexArrays(1, &this->vertexArray); - assertNoGLError(); - this->vertexArray = -1; - } -} - -void Mesh::bufferPositions( - const int32_t pos, - const glm::vec3 positions[], - const int32_t len -) { - assertNotNull(positions, "Positions cannot be null"); - assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range"); - assertTrue(pos+len <= verticeCount, "Position + Length must be within range"); - assertTrue(len > 0, "Length must be greater than zero"); - - glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer); - assertNoGLError(); - glBufferSubData( - GL_ARRAY_BUFFER, - sizeof(glm::vec3) * pos, - sizeof(glm::vec3) * len, - (void*)positions - ); - assertNoGLError(); -} - -void Mesh::bufferCoordinates( - const int32_t pos, - const glm::vec2 coordinates[], - const int32_t len -) { - assertNotNull(coordinates, "Coordinates cannot be null"); - assertTrue(pos >= 0 && pos < verticeCount, "Position must be within range"); - assertTrue(pos+len <= verticeCount, "Position + Length must be within range"); - assertTrue(len > 0, "Length must be greater than zero"); - - auto offsetCoordinates = ( - (sizeof(glm::vec3) * this->verticeCount) + - (sizeof(glm::vec2) * pos) - ); - - glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer); - assertNoGLError(); - glBufferSubData( - GL_ARRAY_BUFFER, - offsetCoordinates, - sizeof(glm::vec2) * len, - (void*)coordinates - ); - assertNoGLError(); -} - -void Mesh::bufferIndices( - const int32_t pos, - const int32_t indices[], - const int32_t len -) { - assertNotNull(indices, "Indices cannot be null"); - assertTrue(pos >= 0 && pos < indiceCount, "Position must be within range"); - assertTrue(pos+len <= indiceCount, "Position + Length must be within range"); - assertTrue(len > 0, "Length must be greater than zero"); - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer); - assertNoGLError(); - glBufferSubData( - GL_ELEMENT_ARRAY_BUFFER, - sizeof(int32_t) * pos, - sizeof(int32_t) * len, - (void*)indices - ); - assertNoGLError(); -} - -void Mesh::draw( - const enum MeshDrawMode drawMode, - const int32_t start, - const int32_t count -) { - if( - count == 0 || - this->vertexBuffer == -1 || - this->indexBuffer == -1 - ) return; - - int32_t drawCount = count; - if(count == -1) drawCount = this->indiceCount; - - // Re-Bind the buffers - glBindVertexArray(this->vertexArray); - assertNoGLError(); - glBindBuffer(GL_ARRAY_BUFFER, this->vertexBuffer); - assertNoGLError(); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->indexBuffer); - assertNoGLError(); - - // Re-Calculate the attrib pointers. - size_t offset = 0; - glVertexAttribPointer( - 0, sizeof(glm::vec3) / sizeof(float_t), - GL_FLOAT, GL_FALSE, - 0, (void *)offset - ); - assertNoGLError(); - glEnableVertexAttribArray(0); - assertNoGLError(); - - offset += sizeof(glm::vec3) * this->verticeCount; - glVertexAttribPointer( - 1, sizeof(glm::vec2) / sizeof(float_t), - GL_FLOAT, GL_FALSE, - 0, (void *)offset - ); - assertNoGLError(); - glEnableVertexAttribArray(1); - assertNoGLError(); - - GLuint glDrawMode; - switch(drawMode) { - case MeshDrawMode::TRIANGLES: - glDrawMode = GL_TRIANGLES; - break; - - case MeshDrawMode::TRIANGLE_STRIP: - glDrawMode = GL_TRIANGLE_STRIP; - break; - - case MeshDrawMode::TRIANGLE_FAN: - glDrawMode = GL_TRIANGLE_FAN; - break; - - case MeshDrawMode::LINES: - glDrawMode = GL_LINES; - break; - - case MeshDrawMode::POINTS: - glDrawMode = GL_POINTS; - break; - - default: - assertUnreachable("Unsupported draw mode"); - } - - // Render the elements. - glDrawElements( - glDrawMode, - drawCount, - GL_UNSIGNED_INT, - (void *)(sizeof(int32_t) * start) - ); - assertNoGLError(); -} - -Mesh::~Mesh() { - this->disposeBuffers(); -} \ No newline at end of file diff --git a/src/dawnopengl/display/mesh/Mesh.hpp b/src/dawnopengl/display/mesh/Mesh.hpp deleted file mode 100644 index 227a090e..00000000 --- a/src/dawnopengl/display/mesh/Mesh.hpp +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnopengl.hpp" -#include "display/mesh/IMesh.hpp" - -namespace Dawn { - class Mesh : public IMesh { - protected: - GLuint vertexBuffer = -1; - GLuint indexBuffer = -1; - GLuint vertexArray = -1; - - public: - void createBuffers( - const int32_t verticeCount, - const int32_t indiceCount - ) override; - - void disposeBuffers() override; - - void bufferPositions( - const int32_t pos, - const glm::vec3 positions[], - const int32_t len - ) override; - - void bufferCoordinates( - const int32_t pos, - const glm::vec2 coordinates[], - const int32_t len - ) override; - - void bufferIndices( - const int32_t pos, - const int32_t indices[], - const int32_t len - ) override; - - void draw( - const enum MeshDrawMode drawMode, - const int32_t start, - const int32_t count - ) override; - - ~Mesh(); - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/CMakeLists.txt b/src/dawnopengl/display/shader/CMakeLists.txt deleted file mode 100644 index 2407fb33..00000000 --- a/src/dawnopengl/display/shader/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Shader.cpp - ShaderStage.cpp - SimpleTexturedShader.cpp - UIShader.cpp - ShaderParameter.cpp -) \ No newline at end of file diff --git a/src/dawnopengl/display/shader/Shader.cpp b/src/dawnopengl/display/shader/Shader.cpp deleted file mode 100644 index 8ed47699..00000000 --- a/src/dawnopengl/display/shader/Shader.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Shader.hpp" - -using namespace Dawn; \ No newline at end of file diff --git a/src/dawnopengl/display/shader/Shader.hpp b/src/dawnopengl/display/shader/Shader.hpp deleted file mode 100644 index 86109020..00000000 --- a/src/dawnopengl/display/shader/Shader.hpp +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/ShaderStage.hpp" -#include "display/shader/IShader.hpp" -#include "assert/assert.hpp" -#include "assert/assertgl.hpp" -#include "display/Color.hpp" -#include "display/Texture.hpp" - -#include "ShaderParameter.hpp" -#include "ShaderStructure.hpp" - -namespace Dawn { - typedef GLuint shadertexturebinding_t; - - enum class ShaderOpenGLVariant { - GLSL_330_CORE - }; - - template - class Shader : public IShader { - private: - std::vector> stages; - std::vector parameters; - std::vector structures; - enum ShaderOpenGLVariant variant; - - GLuint shaderProgram = -1; - - protected: - /** - * Overridable function to get the stages for the shader. - * - * @param variant The variant of the shader to use. - * @param rel The relative data to use. - * @param stages The stages to add to. - * @param parameters The parameters to add to. - * @param structures The structures to add to. - */ - virtual void getStages( - const enum ShaderOpenGLVariant variant, - const T *rel, - std::vector> &stages, - std::vector ¶meters, - std::vector &structures - ) = 0; - - public: - /** - * Initializes the shader, this needs to be called before the shader can - * be used. - */ - void init() override { - // Determine which kind of OpenGL shader to use. - variant = ShaderOpenGLVariant::GLSL_330_CORE; - - // Now get the stages - T dummy; - this->getStages( - variant, - &dummy, - stages, - parameters, - structures - ); - - // Create the shader program - shaderProgram = glCreateProgram(); - assertNoGLError(); - - // Attach all the stages - for(auto stage : stages) { - glAttachShader(shaderProgram, stage->id); - assertNoGLError(); - } - - // Link and verify the program - glLinkProgram(shaderProgram); - assertNoGLError(); - - GLint status; - glGetProgramiv(shaderProgram, GL_LINK_STATUS, &status); - assertNoGLError(); - assertTrue(status == GL_TRUE, "Failed to link shader program."); - - // Map parameters correctly. - std::for_each( - parameters.begin(), - parameters.end(), - [&](struct ShaderParameter ¶m) { - // Correct offset - param.offset = param.offset - (size_t)(&dummy); - param.location = glGetUniformLocation( - shaderProgram, - param.name.c_str() - ); - assertNoGLError(); - assertTrue( - param.location != -1, - "Failed to get location for parameter %s.", - param.name.c_str() - ); - } - ); - - // Map structures - std::for_each( - structures.begin(), - structures.end(), - [&](struct IShaderStructure &structure) { - structure.offset = structure.offset - (size_t)(&dummy); - structure.location = glGetUniformBlockIndex( - shaderProgram, - structure.structureName.c_str() - ); - assertNoGLError(); - assertTrue( - structure.location != -1, - "Failed to get location for structure %s.", - structure.structureName.c_str() - ); - - // Create the buffer - glGenBuffers(1, &structure.buffer); - } - ); - - this->bind(); - } - - /** - * Binds the shader as the current one, does not upload any data, somewhat - * relies on something else uploading the data. - */ - void bind() override { - glUseProgram(shaderProgram); - assertNoGLError(); - } - - /** - * Uploads the data to the GPU. - */ - void upload() override { - switch(this->variant) { - case ShaderOpenGLVariant::GLSL_330_CORE: - for(auto param : parameters) { - void *value = (void*)( - ((size_t)&this->data) + param.offset - ); - - switch(param.type) { - case ShaderParameterType::MAT4: { - glm::mat4 *matrix = (glm::mat4 *)value; - if(param.count != 1) { - assertUnreachable("I haven't implemented multiple mat4s"); - } - glUniformMatrix4fv( - param.location, 1, GL_FALSE, glm::value_ptr(*matrix) - ); - break; - } - - case ShaderParameterType::COLOR: { - auto color = (Color *)value; - glUniform4fv( - param.location, - param.count, - (GLfloat*)value - ); - break; - } - - case ShaderParameterType::BOOLEAN: { - glUniform1iv(param.location, param.count, (GLint*)value); - break; - } - - case ShaderParameterType::TEXTURE: { - glUniform1iv(param.location, param.count, (GLint*)value); - break; - } - - default: { - assertUnreachable("Unsupported ShaderParameterType"); - } - } - - assertNoGLError(); - } - break; - - default: - assertUnreachable("Unsupported ShaderOpenGLVariant"); - } - - // Upload structures - for(auto structure : structures) { - switch(structure.structureType) { - case ShaderOpenGLStructureType::STD140: { - // Upload the data - glBindBuffer(GL_UNIFORM_BUFFER, structure.buffer); - assertNoGLError(); - glBindBufferBase(GL_UNIFORM_BUFFER, structure.location, structure.buffer); - assertNoGLError(); - glBufferData( - GL_UNIFORM_BUFFER, - structure.size * structure.count, - (void*)((size_t)&this->data + (size_t)structure.offset), - GL_STATIC_DRAW - ); - assertNoGLError(); - break; - } - - default: - assertUnreachable("Unsupported ShaderOpenGLStructureType"); - } - } - } - - ~Shader() { - // Delete the structures - for(auto structure : structures) { - assertTrue(structure.buffer != -1, "Invalid buffer."); - glDeleteBuffers(1, &structure.buffer); - assertNoGLError(); - } - - // Delete the shader program - glDeleteProgram(shaderProgram); - assertNoGLError(); - } - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderParameter.cpp b/src/dawnopengl/display/shader/ShaderParameter.cpp deleted file mode 100644 index befc2e46..00000000 --- a/src/dawnopengl/display/shader/ShaderParameter.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "ShaderParameter.hpp" - -using namespace Dawn; - -ShaderParameter::ShaderParameter( - const std::string &name, - const void *offset, - const enum ShaderParameterType type, - const size_t count -) { - this->name = name; - this->offset = (size_t)offset; - this->type = type; - this->count = count; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderParameter.hpp b/src/dawnopengl/display/shader/ShaderParameter.hpp deleted file mode 100644 index 1b87da7a..00000000 --- a/src/dawnopengl/display/shader/ShaderParameter.hpp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/IShader.hpp" -#include "dawnopengl.hpp" - -namespace Dawn { - struct ShaderParameter { - std::string name; - size_t offset; - enum ShaderParameterType type; - size_t count; - GLint location = -1; - - /** - * Construct a new shader parameter. - * - * @param name Name of the parameter within the shader. - * @param offset Offset, relative to the structure of the data. - * @param type Type of the parameter. - * @param count How many elements in the array (if multiple). - */ - ShaderParameter( - const std::string &name, - const void *offset, - const enum ShaderParameterType type, - const size_t count = 1 - ); - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderStage.cpp b/src/dawnopengl/display/shader/ShaderStage.cpp deleted file mode 100644 index e48c5a16..00000000 --- a/src/dawnopengl/display/shader/ShaderStage.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assertgl.hpp" -#include "assert/assert.hpp" -#include "ShaderStage.hpp" - -using namespace Dawn; - -ShaderStage::ShaderStage( - const enum ShaderStageType type, - const std::string source -) : IShaderStage(type) { - // Get OpenGL Shader Type - GLenum shaderType; - switch(this->type) { - case ShaderStageType::VERTEX: - shaderType = GL_VERTEX_SHADER; - break; - - case ShaderStageType::FRAGMENT: - shaderType = GL_FRAGMENT_SHADER; - break; - - // case ShaderStageType::COMPUTE: - // shaderType = GL_COMPUTE; - // break; - - default: - assertUnreachable("Unknown ShaderStageType"); - } - - // Initialize the shader - this->id = glCreateShader(shaderType); - assertNoGLError(); - - // Compile the shader - auto cSource = source.c_str(); - glShaderSource(this->id, 1, &cSource, NULL); - assertNoGLError(); - glCompileShader(this->id); - assertNoGLError(); - - // Validate - GLint status; - glGetShaderiv(this->id, GL_COMPILE_STATUS, &status); - assertNoGLError(); - - if(!status) { - // Failed to compile - GLint logLength; - glGetShaderiv(this->id, GL_INFO_LOG_LENGTH, &logLength); - assertNoGLError(); - - GLchar *log = new GLchar[logLength]; - glGetShaderInfoLog(this->id, logLength, NULL, log); - assertNoGLError(); - assertUnreachable("Failed to compile shader stage %i:\n%s", type, log); - } -} - -ShaderStage::~ShaderStage() { - if(this->id != -1) { - glDeleteShader(this->id); - assertNoGLError(); - } -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderStage.hpp b/src/dawnopengl/display/shader/ShaderStage.hpp deleted file mode 100644 index f45432eb..00000000 --- a/src/dawnopengl/display/shader/ShaderStage.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnopengl.hpp" -#include "display/shader/IShaderStage.hpp" - -namespace Dawn { - class ShaderStage : public IShaderStage { - public: - GLuint id = -1; - - /** - * Constructs a new ShaderStage. - * - * @param type The type of shader this is. - * @param source The source code to compile. - */ - ShaderStage(const enum ShaderStageType type, const std::string source); - - /** - * Disposes of the shader stage. - */ - ~ShaderStage(); - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/ShaderStructure.hpp b/src/dawnopengl/display/shader/ShaderStructure.hpp deleted file mode 100644 index b384aea5..00000000 --- a/src/dawnopengl/display/shader/ShaderStructure.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma ocne -#include "display/shader/ShaderParameter.hpp" - -namespace Dawn { - enum class ShaderOpenGLStructureType { - STD140 - }; - - struct IShaderStructure { - std::string structureName; - size_t offset; - enum ShaderOpenGLStructureType structureType; - size_t size; - size_t count; - std::vector parameters; - GLint location = -1; - GLuint buffer = -1; - }; - - template - struct ShaderStructure final : public IShaderStructure { - public: - /** - * Constructs a new shader structure. Shader structures allow for larger - * amounts/volumes of data to be passed to the shader in a single call. - * Ideally I wouldn't really need this as I wanted the entire shader to - * basically be a single large structure, but OpenGL doesn't support that - * so I have to do this instead. - * - * @param structureName Structure name within the shader. - * @param offset Offset, within the data structure, that this structure - * starts at. - * @param structureType The type of structure data format to use. - * @param getParameters A callback that, when invoked, will populate the - * parameters vector with the parameters for this - * structure. - */ - ShaderStructure( - const std::string &structureName, - const void *offset, - const enum ShaderOpenGLStructureType structureType, - std::function< - void(const T&, std::vector&) - > getParameters, - size_t count = 1 - ) { - this->structureName = structureName; - this->offset = (size_t)offset; - this->structureType = structureType; - this->size = sizeof(T); - this->count = count; - this->parameters = std::vector(); - - T dummy; - getParameters(dummy, this->parameters); - - // Update offsets. - auto itParams = this->parameters.begin(); - while(itParams != this->parameters.end()) { - struct ShaderParameter ¶m = *itParams; - param.offset -= (size_t)(&dummy); - - // Check for non-aligned OpenGL structures. - if(param.offset % sizeof(glm::vec4) != 0) { - assertUnreachable( - "%s%s%s", - "Non-aligned OpenGL structure detected on param ", - param.name.c_str(), - "!\nEnsure you have padded correctly." - ); - } - - if( - itParams == (this->parameters.end() - 1) && - count > 1 && - (sizeof(T) % sizeof(glm::vec4)) != 0 - ) { - assertUnreachable( - "%s%s%s", - "Non-aligned OpenGL structure detected on last element in array structure on param ", - param.name.c_str(), - "!\nEnsure you have padded correctly." - ); - } - - ++itParams; - } - } - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/SimpleTexturedShader.cpp b/src/dawnopengl/display/shader/SimpleTexturedShader.cpp deleted file mode 100644 index bca7d20f..00000000 --- a/src/dawnopengl/display/shader/SimpleTexturedShader.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "display/shader/SimpleTexturedShader.hpp" - -using namespace Dawn; - -void SimpleTexturedShader::getStages( - const enum ShaderOpenGLVariant variant, - const struct SimpleTexturedShaderData *rel, - std::vector> &stages, - std::vector ¶meters, - std::vector &structures -) { - // Stages - std::shared_ptr vertex; - std::shared_ptr fragment; - - switch(variant) { - case ShaderOpenGLVariant::GLSL_330_CORE: - vertex = std::make_shared( - ShaderStageType::VERTEX, - "#version 330 core\n" - "layout (location = 0) in vec3 aPos;\n" - "layout (location = 1) in vec2 aTexCoord;\n" - "uniform mat4 u_Projection;\n" - "uniform mat4 u_View;\n" - "uniform mat4 u_Model;\n" - "out vec2 o_TextCoord;\n" - "void main() {\n" - "gl_Position = u_Projection * u_View * u_Model * vec4(aPos, 1.0);\n" - "o_TextCoord = vec2(aTexCoord.x, aTexCoord.y);\n" - "}" - ); - - fragment = std::make_shared( - ShaderStageType::FRAGMENT, - "#version 330 core\n" - "in vec2 o_TextCoord;\n" - "out vec4 o_Color;\n" - "uniform vec4 u_Color;\n" - "uniform bool u_HasTexture;\n" - "uniform sampler2D u_Texture;\n" - "void main() {\n" - "if(u_HasTexture) {\n" - "o_Color = texture(u_Texture, o_TextCoord) * u_Color;\n" - "} else {\n" - "o_Color = u_Color;" - "}\n" - "}\n" - ); - break; - - default: - assertUnreachable("Unsupported ShaderOpenGLVariant"); - } - - // Add stages - stages.push_back(vertex); - stages.push_back(fragment); - - // Parameters - parameters.push_back(ShaderParameter( - "u_Projection", - &rel->projection, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_View", - &rel->view, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_Model", - &rel->model, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_Color", - &rel->color, - ShaderParameterType::COLOR - )); - - parameters.push_back(ShaderParameter( - "u_HasTexture", - &rel->hasTexture, - ShaderParameterType::BOOLEAN - )); - - parameters.push_back(ShaderParameter( - "u_Texture", - &rel->texture, - ShaderParameterType::TEXTURE - )); -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp b/src/dawnopengl/display/shader/SimpleTexturedShader.hpp deleted file mode 100644 index ed23bea1..00000000 --- a/src/dawnopengl/display/shader/SimpleTexturedShader.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/Shader.hpp" - -namespace Dawn { - struct SimpleTexturedShaderData { - glm::mat4 projection; - glm::mat4 view; - glm::mat4 model; - struct Color color = COLOR_WHITE; - bool hasTexture = false; - shadertexturebinding_t texture = 0; - }; - - class SimpleTexturedShader : public Shader { - protected: - void getStages( - const enum ShaderOpenGLVariant variant, - const struct SimpleTexturedShaderData *rel, - std::vector> &stages, - std::vector ¶meters, - std::vector &structures - ) override; - }; -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/UIShader.cpp b/src/dawnopengl/display/shader/UIShader.cpp deleted file mode 100644 index 7e11504f..00000000 --- a/src/dawnopengl/display/shader/UIShader.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "display/shader/UIShader.hpp" -#include "util/Macro.hpp" - -using namespace Dawn; - -void UIShader::getStages( - const enum ShaderOpenGLVariant variant, - const struct UIShaderData *rel, - std::vector> &stages, - std::vector ¶meters, - std::vector &structures -) { - // Stages - std::shared_ptr vertex; - std::shared_ptr fragment; - - switch(variant) { - case ShaderOpenGLVariant::GLSL_330_CORE: - vertex = std::make_shared( - ShaderStageType::VERTEX, - "#version 330 core\n" - "layout (location = 0) in vec3 aPos;\n" - "layout (location = 1) in vec2 aTexCoord;\n" - "uniform mat4 u_Projection;\n" - "uniform mat4 u_View;\n" - "uniform mat4 u_Model;\n" - "struct UIShaderQuad {\n" - "vec4 quad;\n" - "vec4 uv;\n" - "vec4 color;\n" - "vec4 style;\n" - "};\n" - "layout (std140) uniform ub_Quad {\n" - "UIShaderQuad quads[" MACRO_STRINGIFY(UI_SHADER_QUAD_COUNT) "];\n" - "};\n" - "out vec2 v_TextCoord;\n" - "out vec4 v_Color;\n" - "out vec4 v_Style;\n" - "void main() {\n" - "vec4 pos;\n" - "vec2 coord;\n" - "int index = int(aPos.z);\n" - "int quadIndex = index / 4;\n" - "int vertexIndex = index % 4;\n" - "UIShaderQuad quad = quads[quadIndex];\n" - "if(vertexIndex == 0) {\n" - "pos.x = quad.quad.x;\n" - "pos.y = quad.quad.y;\n" - "coord.x = quad.uv.x;\n" - "coord.y = quad.uv.y;\n" - "} else if(vertexIndex == 1) {\n" - "pos.x = quad.quad.z;\n" - "pos.y = quad.quad.y;\n" - "coord.x = quad.uv.z;\n" - "coord.y = quad.uv.y;\n" - "} else if(vertexIndex == 2) {\n" - "pos.y = quad.quad.w;\n" - "pos.x = quad.quad.x;\n" - "coord.x = quad.uv.x;\n" - "coord.y = quad.uv.w;\n" - "} else if(vertexIndex == 3) {\n" - "pos.x = quad.quad.z;\n" - "pos.y = quad.quad.w;\n" - "coord.x = quad.uv.z;\n" - "coord.y = quad.uv.w;\n" - "}\n" - "pos.z = 0;\n" - "pos.w = 1;\n" - "gl_Position = u_Projection * u_View * u_Model * pos;\n" - "v_TextCoord = coord;\n" - "v_Color = quad.color;\n" - "v_Style = quad.style;\n" - "}" - ); - - fragment = std::make_shared( - ShaderStageType::FRAGMENT, - "#version 330 core\n" - "in vec2 v_TextCoord;\n" - "in vec4 v_Color;\n" - "in vec4 v_Style;\n" - "uniform sampler2D u_Texture[" MACRO_STRINGIFY(UI_SHADER_TEXTURE_COUNT) "];\n" - "out vec4 o_Color;\n" - "void main() {\n" - "vec4 texColor = vec4(1, 1, 1, 1);\n" - "int vStyle = int(round(v_Style[0]));\n" - "int vTextInd = int(round(v_Style[1]));\n" - "switch(vTextInd) {\n" - "case -1:\n" - "texColor = vec4(1, 1, 1, 1);\n" - "break;\n" - "case 0:\n" - "texColor = texture(u_Texture[0], v_TextCoord);\n" - "break;\n" - "case 1:\n" - "texColor = texture(u_Texture[1], v_TextCoord);\n" - "break;\n" - "case 2:\n" - "texColor = texture(u_Texture[2], v_TextCoord);\n" - "break;\n" - "case 3:\n" - "texColor = texture(u_Texture[3], v_TextCoord);\n" - "break;\n" - "case 4:\n" - "texColor = texture(u_Texture[4], v_TextCoord);\n" - "break;\n" - "case 5:\n" - "texColor = texture(u_Texture[5], v_TextCoord);\n" - "break;\n" - "}\n" - "switch(vStyle) {\n" - "case 0:\n" - "o_Color = texColor * v_Color;\n" - "break;\n" - "case 1:\n" - "o_Color.rgb = v_Color.rgb;\n" - "o_Color.a = texColor.r * v_Color.a;\n" - "break;\n" - "}\n" - "}\n" - ); - break; - - default: - assertUnreachable("Unsupported ShaderOpenGLVariant"); - } - - // Add stages - stages.push_back(vertex); - stages.push_back(fragment); - - // Parameters - parameters.push_back(ShaderParameter( - "u_Projection", - &rel->projection, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_View", - &rel->view, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_Model", - &rel->model, - ShaderParameterType::MAT4 - )); - - parameters.push_back(ShaderParameter( - "u_Texture", - &rel->textures, - ShaderParameterType::TEXTURE, - UI_SHADER_TEXTURE_COUNT - )); - - structures.push_back(ShaderStructure( - "ub_Quad", - &rel->quads, - ShaderOpenGLStructureType::STD140, - [&](const struct UIShaderQuad &rel, std::vector ¶meters) { - parameters.push_back(ShaderParameter( - "quad", - &rel.quad, - ShaderParameterType::VEC4 - )); - - parameters.push_back(ShaderParameter( - "uv", - &rel.uv, - ShaderParameterType::VEC4 - )); - - parameters.push_back(ShaderParameter( - "color", - &rel.color, - ShaderParameterType::COLOR - )); - - parameters.push_back(ShaderParameter( - "style", - &rel.style, - ShaderParameterType::VEC4 - )); - }, - UI_SHADER_QUAD_COUNT - )); -} \ No newline at end of file diff --git a/src/dawnopengl/display/shader/UIShader.hpp b/src/dawnopengl/display/shader/UIShader.hpp deleted file mode 100644 index 61f05ae1..00000000 --- a/src/dawnopengl/display/shader/UIShader.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/shader/Shader.hpp" - -namespace Dawn { - #define UI_SHADER_QUAD_COUNT 1024 - #define UI_SHADER_TEXTURE_COUNT 16 - - enum class UIShaderQuadStyle { - TEXTURED = 0, - FONT = 1 - }; - - struct UIShaderQuad { - glm::vec4 quad; - glm::vec4 uv; - struct Color color; - glm::vec4 style; - }; - - struct UIShaderData { - glm::mat4 projection; - glm::mat4 view; - glm::mat4 model; - shadertexturebinding_t textures[UI_SHADER_TEXTURE_COUNT]; - struct UIShaderQuad quads[UI_SHADER_QUAD_COUNT]; - }; - - class UIShader : public Shader { - protected: - void getStages( - const enum ShaderOpenGLVariant variant, - const struct UIShaderData *rel, - std::vector> &stages, - std::vector ¶meters, - std::vector &structures - ) override; - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/CMakeLists.txt b/src/dawnrpg/component/entity/CMakeLists.txt deleted file mode 100644 index 9ad6ee53..00000000 --- a/src/dawnrpg/component/entity/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2024 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - Entity.cpp - EntityDirection.cpp - EntityTilePosition.cpp - Player.cpp -) \ No newline at end of file diff --git a/src/dawnrpg/component/entity/Entity.cpp b/src/dawnrpg/component/entity/Entity.cpp deleted file mode 100644 index 5175c06e..00000000 --- a/src/dawnrpg/component/entity/Entity.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Entity.hpp" -#include "scene/Scene.hpp" -#include "assert/assert.hpp" -#include "util/Easing.hpp" -#include "component/world/World.hpp" -#include "component/world/Map.hpp" - -using namespace Dawn; - -void Entity::onInit() { - assertNotNull(this->getMap(), "Entity map cannot be null."); - - // Listen for turn time - listeners.push_back(getScene()->onUnpausedUpdate.listen([this](float_t delta){ - if(this->turnTime <= 0.0f) return; - this->turnTime -= delta; - if(this->turnTime <= 0) this->turnTime = 0.0f; - })); - - // Listen for movement - listeners.push_back(getScene()->onUnpausedUpdate.listen([this](float_t delta){ - if(this->stepTime <= 0.0f) return; - this->stepTime -= delta * this->stepSpeed; - - glm::vec3 nextPosition = this->tilePosition.toWorldSpace(); - - if(this->stepTime <= 0) { - this->getItem()->setLocalPosition(nextPosition); - this->stepTime = 0.0f; - this->eventMove.emit(); - this->eventStepEnd.emit(); - return; - } - - float_t t = 1.0f - this->stepTime; - glm::vec3 lastPosition = this->lastTilePosition.toWorldSpace(); - glm::vec3 newLocal = glm::mix(lastPosition, nextPosition, t); - this->getItem()->setLocalPosition(newLocal); - this->eventMove.emit(); - })); - - // Notify map. - getMap()->entityNotifyInit(this->getItem()); -} - -void Entity::onDispose() { - auto map = this->map.lock(); - if(map) map->entityNotifyDispose(this->getItem()); -} - -std::shared_ptr Entity::getMap() { - auto map = this->map.lock(); - assertNotNull(map, "Map cannot be null?"); - return map; -} - -std::shared_ptr Entity::getWorld() { - return this->getMap()->getWorld(); -} - -struct EntityStepResult Entity::move( - const enum EntityDirection direction, - const float_t stepSpeed -) { - assertFalse(this->isMoving(), "Entity is already moving."); - struct EntityStepResult result; - - if(this->direction != direction) { - this->turn(direction); - result.type = EntityStepResultType::Turn; - return result; - } - - auto map = this->getMap(); - struct EntityTilePosition newPosition = ( - entityDirectionGetRelativeTilePosition( - this->tilePosition, - direction - ) - ); - - // Check for entity in way. - auto entityInWay = map->getEntityAt(newPosition); - if(entityInWay) { - result.type = EntityStepResultType::EntityInWay; - result.entityInWay = entityInWay; - return result; - } - - // Get the tile at the destination, check for height if we are on stairs, etc. - // If the tile is not walkable, return early. - auto chunk = map->getChunkAtTile(newPosition); - auto tilePos = newPosition.toTilePosition(); - auto tileAt = chunk->getTileAt(tilePos); - if(tileAt.isSolid()) { - result.type = EntityStepResultType::SolidTileInWay; - result.tileInWayChunk = chunk; - result.tileInWayPosition = tilePos; - return result; - } - - // Move the entity to the new tile. - this->lastTilePosition = this->tilePosition; - this->tilePosition = newPosition; - this->stepTime = 1.0f; - this->stepSpeed = stepSpeed; - - this->eventStepStart.emit(); - return result; -} - -void Entity::turn(const enum EntityDirection direction) { - this->direction = direction; - this->turnTime = ENTITY_TURN_TIME; - this->eventTurn.emit(); -} - -void Entity::setPosition(struct EntityTilePosition pos) { - this->stepTime = 0.0f; - this->tilePosition = pos; - this->lastTilePosition = pos; - this->getItem()->setLocalPosition(pos.toWorldSpace()); - this->eventMove.emit(); -} - -bool_t Entity::isMoving() { - return this->stepTime > 0.0f || this->turnTime > 0.0f; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/Entity.hpp b/src/dawnrpg/component/entity/Entity.hpp deleted file mode 100644 index 7deb9b10..00000000 --- a/src/dawnrpg/component/entity/Entity.hpp +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "component/world/Map.hpp" -#include "event/Event.hpp" -#include "EntityDirection.hpp" - -#define ENTITY_STEP_SPEED_DEFAULT 3.0f -#define ENTITY_STEP_SPEED_RUNNING 6.0f -#define ENTITY_TURN_TIME 0.06f - -namespace Dawn { - class Entity; - - enum class EntityStepResultType : uint8_t { - Turn, - Step, - EntityInWay, - SolidTileInWay - }; - - struct EntityStepResult { - enum EntityStepResultType type; - - // I'd love to unionize this but it seems that it's not ideal rn. - std::shared_ptr entityInWay; - - std::shared_ptr tileInWayChunk; - struct TilePosition tileInWayPosition; - }; - - class Entity : public SceneComponent { - private: - float_t turnTime = 0.0f; - - struct EntityTilePosition lastTilePosition; - float_t stepTime = 0.0f; - float_t stepSpeed = ENTITY_STEP_SPEED_DEFAULT; - - protected: - enum EntityDirection direction = EntityDirection::Down; - struct EntityTilePosition tilePosition; - - public: - std::weak_ptr map; - enum EntityID id = EntityID::Null; - - Event<> eventStepStart; - Event<> eventStepEnd; - Event<> eventMove; - Event<> eventTurn; - - void onInit() override; - void onDispose() override; - - /** - * Gets the map that the entity is on. - * - * @return The map that the entity is on. - */ - std::shared_ptr getMap(); - - /** - * Gets the world that the entity is on. - * - * @return The world that the entity is on. - */ - std::shared_ptr getWorld(); - - /** - * Moves the entity in the given direction. - * - * @param direction The direction to move in. - * @param stepSpeed The speed to move at. - */ - struct EntityStepResult move( - const enum EntityDirection direction, - const float_t stepSpeed = ENTITY_STEP_SPEED_DEFAULT - ); - - /** - * Turns the entity in the given direction. This will have a slight delay - * and count as moving. - * - * @param direction The direction to turn in. - */ - void turn(const enum EntityDirection direction); - - /** - * Safely sets the position of the entity. This will invoke movement - * events but not step events, so steps may be cancelled in this context. - * - * @param position The new position of the entity. - */ - void setPosition(struct EntityTilePosition position); - - /** - * Checks if the entity is currently moving (in a step). - * - * @return True if the entity is moving, false otherwise. - */ - bool_t isMoving(); - - friend class World; - friend class Map; - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/EntityDirection.cpp b/src/dawnrpg/component/entity/EntityDirection.cpp deleted file mode 100644 index 3f09ee01..00000000 --- a/src/dawnrpg/component/entity/EntityDirection.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "EntityDirection.hpp" - -using namespace Dawn; - -glm::vec3 entityDirectionGetVector(const EntityDirection &dir) { - switch(dir) { - case EntityDirection::Up: return glm::vec3(0.0f, 1.0f, 0.0f); - case EntityDirection::Down: return glm::vec3(0.0f, -1.0f, 0.0f); - case EntityDirection::Left: return glm::vec3(-1.0f, 0.0f, 0.0f); - case EntityDirection::Right: return glm::vec3(1.0f, 0.0f, 0.0f); - default: - assertUnreachable("Invalid direction: %d", dir); - return glm::vec3(0.0f, 0.0f, 0.0f); - } -} - -struct EntityTilePosition entityDirectionGetRelativeTilePosition( - const EntityTilePosition &pos, - const EntityDirection &dir, - int32_t distance -) { - struct EntityTilePosition result = pos; - switch(dir) { - case EntityDirection::Down: result.y -= distance; break; - case EntityDirection::Up: result.y += distance; break; - case EntityDirection::Left: result.x -= distance; break; - case EntityDirection::Right: result.x += distance; break; - default: - assertUnreachable("Invalid direction: %d", dir); - break; - } - return result; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/EntityDirection.hpp b/src/dawnrpg/component/entity/EntityDirection.hpp deleted file mode 100644 index 79de74f6..00000000 --- a/src/dawnrpg/component/entity/EntityDirection.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" -#include "EntityTilePosition.hpp" - -enum class EntityDirection : uint8_t { - Up, - Down, - Left, - Right, -}; - -/** - * Gets the vector for the given direction. - * - * @param dir The direction to get the vector for. - * @return The vector for the given direction. - */ -glm::vec3 entityDirectionGetVector(const EntityDirection &dir); - -/** - * Gets the relative tile position for the given direction. - * - * @param pos The current position. - * @param dir The direction to get the relative position for. - * @param distance The distance to get the relative position for. - * @return The relative tile position for the given direction. - */ -struct Dawn::EntityTilePosition entityDirectionGetRelativeTilePosition( - const Dawn::EntityTilePosition &pos, - const EntityDirection &dir, - int32_t distance = 1 -); \ No newline at end of file diff --git a/src/dawnrpg/component/entity/EntityID.hpp b/src/dawnrpg/component/entity/EntityID.hpp deleted file mode 100644 index 3c8c065b..00000000 --- a/src/dawnrpg/component/entity/EntityID.hpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum class EntityID : uint32_t { - Null = 0, - Player = 1, - TestEntity = 2 - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/EntityTilePosition.cpp b/src/dawnrpg/component/entity/EntityTilePosition.cpp deleted file mode 100644 index b88ab5d3..00000000 --- a/src/dawnrpg/component/entity/EntityTilePosition.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "EntityTilePosition.hpp" - -using namespace Dawn; - -const glm::vec3 EntityTilePosition::toWorldSpace() const { - return glm::vec3( - this->x, - this->y, - this->z - ); -} - -const struct ChunkPosition EntityTilePosition::toChunkPosition() const { - return { - (int32_t)(this->x / CHUNK_WIDTH), - (int32_t)(this->y / CHUNK_HEIGHT), - (int32_t)(this->z / CHUNK_DEPTH) - }; -} - -const struct TilePosition EntityTilePosition::toTilePosition() const { - return { - (uint8_t)(this->x % CHUNK_WIDTH), - (uint8_t)(this->y % CHUNK_HEIGHT), - (uint8_t)(this->z % CHUNK_DEPTH) - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/EntityTilePosition.hpp b/src/dawnrpg/component/entity/EntityTilePosition.hpp deleted file mode 100644 index 6d1750a6..00000000 --- a/src/dawnrpg/component/entity/EntityTilePosition.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "component/world/Chunk.hpp" - -namespace Dawn { - struct EntityTilePosition { - int64_t x, y, z; - - // Overload the equality operator. - bool operator==(const EntityTilePosition &other) const { - return this->x == other.x && this->y == other.y && this->z == other.z; - } - - // Overload the inequality operator. - bool operator!=(const EntityTilePosition &other) const { - return !(*this == other); - } - - /** - * Converts the tile position to a world space position. - * - * @return This tile position in world space. - */ - const glm::vec3 toWorldSpace() const; - - /** - * Converts the tile position to a chunk position. - * - * @return This tile position in chunk space. - */ - const struct ChunkPosition toChunkPosition() const; - - /** - * Converts the tile position to a chunk tile position. - * - * @return This tile position in chunk tile space. - */ - const struct TilePosition toTilePosition() const; - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/Player.cpp b/src/dawnrpg/component/entity/Player.cpp deleted file mode 100644 index 71a3d347..00000000 --- a/src/dawnrpg/component/entity/Player.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Player.hpp" -#include "scene/Scene.hpp" -#include "input/InputBinds.hpp" - -using namespace Dawn; - -void Player::updateCameraPosition() { - auto c = camera.lock(); - if(!c) return; - glm::vec3 pos = this->getItem()->getLocalPosition(); - c->getItem()->lookAtPixelPerfect( - pos + glm::vec3(0, -10, 0), - pos, - c->getRenderTarget()->getHeight(), - c->fov, - 48.0f - ); -} - -void Player::onInit() { - Entity::onInit(); - - listeners.push_back(getScene()->onUnpausedUpdate.listen([this](float_t delta){ - if(this->isMoving()) return; - - InputManager &im = getGame()->inputManager; - bool_t run = im.isDown(InputBind::Run); - float_t stepSpeed = run ? ENTITY_STEP_SPEED_RUNNING : ENTITY_STEP_SPEED_DEFAULT; - - if(im.isDown(InputBind::Up)) { - this->move(EntityDirection::Up, stepSpeed); - } else if(im.isDown(InputBind::Down)) { - this->move(EntityDirection::Down, stepSpeed); - } else if(im.isDown(InputBind::Left)) { - this->move(EntityDirection::Left, stepSpeed); - } else if(im.isDown(InputBind::Right)) { - this->move(EntityDirection::Right, stepSpeed); - } else if(im.isDown(InputBind::Action)) { - this->interact(); - } - })); - - auto c = camera.lock(); - if(c) { - listeners.push_back(c->getRenderTarget()->onResize.listen([this](int width, int height){ - this->updateCameraPosition(); - })); - } - - listeners.push_back(eventMove.listen([this]() { - this->updateCameraPosition(); - })); - - this->updateCameraPosition(); -} - -void Player::interact() { - // Get direction - auto tile = entityDirectionGetRelativeTilePosition( - this->tilePosition, this->direction - ); - - auto at = getMap()->getEntityAt(tile); - if(at == nullptr) return; - - std::cout << "Interacting" << std::endl; -} - -void Player::onDispose() { - Entity::onDispose(); -} \ No newline at end of file diff --git a/src/dawnrpg/component/entity/Player.hpp b/src/dawnrpg/component/entity/Player.hpp deleted file mode 100644 index 8159ecf7..00000000 --- a/src/dawnrpg/component/entity/Player.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "component/entity/Entity.hpp" -#include "component/display/Camera.hpp" - -namespace Dawn { - class Player : public Entity { - protected: - void updateCameraPosition(); - - public: - std::weak_ptr camera; - - void onInit() override; - void onDispose() override; - - /** - * Interacts with whatever is in front of the player. - */ - void interact(); - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Chunk.cpp b/src/dawnrpg/component/world/Chunk.cpp deleted file mode 100644 index d5b8ea06..00000000 --- a/src/dawnrpg/component/world/Chunk.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Chunk.hpp" - -using namespace Dawn; - -Chunk::Chunk() { - -} - -struct Tile Chunk::getTileAt(const struct TilePosition &pos) { - return this->tiles[pos.x][pos.y][pos.z]; -} - -Chunk::~Chunk() { - -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Chunk.hpp b/src/dawnrpg/component/world/Chunk.hpp deleted file mode 100644 index e3066689..00000000 --- a/src/dawnrpg/component/world/Chunk.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "Tile.hpp" - -#define CHUNK_WIDTH 32 -#define CHUNK_HEIGHT 32 -#define CHUNK_DEPTH 8 - -namespace Dawn { - struct ChunkPosition { - int32_t x; - int32_t y; - int32_t z; - - ChunkPosition operator-(const ChunkPosition &other) const { - return { - this->x - other.x, - this->y - other.y, - this->z - other.z - }; - } - }; - - class Chunk { - public: - struct ChunkPosition position; - struct Tile tiles[CHUNK_WIDTH][CHUNK_HEIGHT][CHUNK_DEPTH]; - - Chunk(); - - /** - * Gets the tile at the given position. - * - * @param pos The position of the tile to get. - * @return The tile at the given position. - */ - struct Tile getTileAt(const struct TilePosition &pos); - - ~Chunk(); - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Map.cpp b/src/dawnrpg/component/world/Map.cpp deleted file mode 100644 index 56a7afdd..00000000 --- a/src/dawnrpg/component/world/Map.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "assert/assert.hpp" -#include "scene/SceneItem.hpp" -#include "Map.hpp" -#include "component/entity/Entity.hpp" - -using namespace Dawn; - -void Map::entityNotifyInit(std::shared_ptr item) { - auto entity = item->getComponent(); - assertNotNull(entity, "Entity component not found on item."); - auto id = entity->id; - assertMapNotHasKey(this->entities, id, "Entity already exists in Map."); - assertTrue(id != EntityID::Null, "Entity ID is invalid."); - this->entities[id] = entity; -} - -void Map::entityNotifyDispose(std::shared_ptr item) { - auto entity = item->getComponent(); - assertNotNull(entity, "Entity component not found on item."); - auto id = entity->id; - assertMapHasKey(this->entities, id, "Entity does not exist in Map."); - assertTrue(id != EntityID::Null, "Entity ID is invalid."); - this->entities.erase(id); -} - -void Map::onInit() { -} - -void Map::onDispose() { -} - -void Map::setSize( - const uint32_t width, - const uint32_t height, - const uint32_t depth, - const uint8_t chunkWidth, - const uint8_t chunkHeight, - const uint8_t chunkDepth -) { - this->chunkOrder.clear(); - - this->mapWidth = width; - this->mapHeight = height; - this->mapDepth = depth; - this->mapChunkWidth = chunkWidth; - this->mapChunkHeight = chunkHeight; - this->mapChunkDepth = chunkDepth; - this->mapChunkCount = chunkWidth * chunkHeight * chunkDepth; - this->chunks = std::make_unique[]>( - this->mapChunkCount - ); - - this->chunkTopLeft.x = 0; - this->chunkTopLeft.y = 0; - this->chunkTopLeft.z = 0; - - // Load initial chunks - for(auto z = 0; z < chunkDepth; z++) { - for(auto y = 0; y < chunkHeight; y++) { - for(auto x = 0; x < chunkWidth; x++) { - auto chunk = std::make_shared(); - memset(chunk->tiles, 0, sizeof(chunk->tiles)); - chunk->position.x = x; - chunk->position.y = y; - chunk->position.z = z; - this->chunks[x + y * chunkWidth + z * chunkWidth * chunkHeight] = chunk; - - this->chunkOrder.push_back(chunk); - } - } - } -} - -std::shared_ptr Map::getWorld() { - auto world = this->world.lock(); - assertNotNull(world, "World cannot be null?"); - return world; -} - -std::shared_ptr Map::getEntity(const EntityID id) { - assertMapHasKey(this->entities, id, "Entity does not exist in Map."); - auto ent = this->entities[id]; - auto lock = ent.lock(); - if(!lock) { - this->entities.erase(id); - return nullptr; - } - assertTrue(lock->id == id, "Entity ID mismatch."); - return lock; -} - -std::shared_ptr Map::getEntityAt(const EntityTilePosition &pos) { - for(auto &pair : this->entities) { - auto ent = pair.second.lock(); - if(!ent) continue; - if(ent->tilePosition != pos) continue; - return ent; - } - return nullptr; -} - -std::shared_ptr Map::getChunkAt(const struct ChunkPosition &pos) { - assertTrue(pos.x >= this->chunkTopLeft.x, "Chunk X out of bounds."); - assertTrue(pos.y >= this->chunkTopLeft.y, "Chunk Y out of bounds."); - assertTrue(pos.z >= this->chunkTopLeft.z, "Chunk Z out of bounds."); - - // First, offset position from top left - auto offset = pos - this->chunkTopLeft; - - assertTrue(offset.x < this->mapChunkWidth, "Chunk X out of bounds."); - assertTrue(offset.y < this->mapChunkHeight, "Chunk Y out of bounds."); - assertTrue(offset.z < this->mapChunkDepth, "Chunk Z out of bounds."); - - // Convert to index - auto i = ( - offset.x + - offset.y * this->mapChunkWidth + - offset.z * this->mapChunkWidth * this->mapChunkHeight - ); - - assertTrue(i >= 0 && i < this->mapChunkCount, "Chunk index out of bounds."); - return this->chunkOrder[i]; -} - -std::shared_ptr Map::getChunkAtTile(const EntityTilePosition &pos) { - auto chunkPos = pos.toChunkPosition(); - return this->getChunkAt(chunkPos); -} - -struct Tile Map::getTileAt(const EntityTilePosition &pos) { - auto chunk = this->getChunkAtTile(pos); - auto tilePos = pos.toTilePosition(); - return chunk->getTileAt(tilePos); -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Map.hpp b/src/dawnrpg/component/world/Map.hpp deleted file mode 100644 index 0969499c..00000000 --- a/src/dawnrpg/component/world/Map.hpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "component/world/World.hpp" -#include "component/entity/EntityID.hpp" -#include "component/entity/EntityTilePosition.hpp" -#include "Chunk.hpp" - -namespace Dawn { - class Map : public SceneComponent { - private: - std::unordered_map> entities; - - uint32_t mapWidth, mapHeight, mapDepth; - uint8_t mapChunkWidth, mapChunkHeight, mapChunkDepth; - uint32_t mapChunkCount; - std::unique_ptr[]> chunks; - std::vector> chunkOrder; - struct ChunkPosition chunkTopLeft; - - /** - * Part of the ECS, this function is called when an entity is initialized. - * - * @param item Scene Item that has been initialized. - */ - void entityNotifyInit(std::shared_ptr item); - - /** - * Part of the ECS, this function is called when an entity is disposed. - * - * @param item Scene Item that has been disposed. - */ - void entityNotifyDispose(std::shared_ptr entity); - - public: - std::weak_ptr world; - - void onInit() override; - void onDispose() override; - - /** - * Sets the size of the map. - * - * @param width The width of the map. - * @param height The height of the map. - * @param depth The depth of the map. - * @param chunkWidth The width of the maps chunks. - * @param chunkHeight The height of the maps chunks. - * @param chunkDepth The depth of the maps chunks. - */ - void setSize( - const uint32_t width, - const uint32_t height, - const uint32_t depth, - const uint8_t chunkWidth, - const uint8_t chunkHeight, - const uint8_t chunkDepth - ); - - /** - * Gets the world that this map belongs to. - * - * @return The world that this map belongs to. - */ - std::shared_ptr getWorld(); - - /** - * Gets the entity with the given ID. - * - * @param id The ID of the entity to get. - * @return The entity with the given ID. - */ - std::shared_ptr getEntity(const EntityID id); - - /** - * Gets the entity at the given position. - * - * @param pos The position to check for an entity. - * @return The entity at the given position, or nullptr. - */ - std::shared_ptr getEntityAt(const EntityTilePosition &pos); - - /** - * Gets the chunk at the given position. - * - * @param pos The position of the chunk to get. - * @return The chunk at the given position. - */ - std::shared_ptr getChunkAt(const struct ChunkPosition &pos); - - /** - * Gets the chunk at the given tile position. - * - * @param pos The tile position of the chunk to get. - * @return The chunk at the given tile position. - */ - std::shared_ptr getChunkAtTile(const EntityTilePosition &pos); - - /** - * Gets the tile at the given position. - * - * @param pos The position of the tile to get. - * @return The tile at the given position. - */ - struct Tile getTileAt(const EntityTilePosition &pos); - - friend class Entity; - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Tile.cpp b/src/dawnrpg/component/world/Tile.cpp deleted file mode 100644 index 4345497b..00000000 --- a/src/dawnrpg/component/world/Tile.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "Tile.hpp" - -using namespace Dawn; - -bool_t Tile::isSolid() { - if(this->id == TileID::Null) return false; - return false; -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/Tile.hpp b/src/dawnrpg/component/world/Tile.hpp deleted file mode 100644 index b3115c8d..00000000 --- a/src/dawnrpg/component/world/Tile.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - enum class TileID : uint16_t { - Null = 0, - Test = 1 - }; - - struct TilePosition { - uint8_t x, y, z; - }; - - union TileData { - int64_t raw; - }; - - struct Tile { - enum TileID id; - union TileData data; - - /** - * Returns whether or not this tile is solid. - * - * @return Whether or not this tile is solid. - */ - bool_t isSolid(); - }; -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/World.cpp b/src/dawnrpg/component/world/World.cpp deleted file mode 100644 index 7669e0b8..00000000 --- a/src/dawnrpg/component/world/World.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "World.hpp" -#include "scene/Scene.hpp" - -using namespace Dawn; - - -void World::onInit() { - -} - -void World::onDispose() { - -} \ No newline at end of file diff --git a/src/dawnrpg/component/world/World.hpp b/src/dawnrpg/component/world/World.hpp deleted file mode 100644 index 6e92e442..00000000 --- a/src/dawnrpg/component/world/World.hpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/SceneComponent.hpp" - -namespace Dawn { - class Map; - class Entity; - - class World : public SceneComponent { - private: - - public: - void onInit() override; - void onDispose() override; - - friend class Map; - friend class Entity; - }; -} \ No newline at end of file diff --git a/src/dawnrpg/dawnrpg.cpp b/src/dawnrpg/dawnrpg.cpp deleted file mode 100644 index 0674ec1c..00000000 --- a/src/dawnrpg/dawnrpg.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scenes/SceneList.hpp" - -using namespace Dawn; - -const std::function Scene::getInitialScene() { - return Dawn::vnScene; -} \ No newline at end of file diff --git a/src/dawnrpg/input/InputBinds.hpp b/src/dawnrpg/input/InputBinds.hpp deleted file mode 100644 index 313ea2f7..00000000 --- a/src/dawnrpg/input/InputBinds.hpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once - -namespace Dawn { - enum class InputBind : uint8_t { - Up, - Down, - Left, - Right, - Run, - Action - }; -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/PlayerPrefab.cpp b/src/dawnrpg/prefab/PlayerPrefab.cpp deleted file mode 100644 index ebc11df8..00000000 --- a/src/dawnrpg/prefab/PlayerPrefab.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "PlayerPrefab.hpp" -#include "display/mesh/CubeMesh.hpp" - -using namespace Dawn; - -struct PlayerPrefab Dawn::createPlayerPrefab( - const std::shared_ptr map -) { - struct PlayerPrefab player; - player.item = map->getScene()->createSceneItem(); - player.item->setParent(map->getItem()); - - player.player = player.item->addComponent(); - player.player->map = map; - player.player->id = EntityID::Player; - - player.mesh = std::make_shared(); - player.mesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - CubeMesh::buffer( - player.mesh, - glm::vec3(-0.5f, -0.5f, -0.5f), - glm::vec3(1, 1, 1), - 0, 0 - ); - - player.meshRenderer = player.item->addComponent(); - player.meshRenderer->mesh = player.mesh; - - player.material = player.item->addComponent(); - player.material->setColor(COLOR_MAGENTA); - - return player; -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/PlayerPrefab.hpp b/src/dawnrpg/prefab/PlayerPrefab.hpp deleted file mode 100644 index b6f3bfdd..00000000 --- a/src/dawnrpg/prefab/PlayerPrefab.hpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/Prefab.hpp" -#include "component/display/MeshRenderer.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" -#include "component/entity/Player.hpp" - -namespace Dawn { - struct PlayerPrefab : public Prefab { - public: - std::shared_ptr player; - std::shared_ptr mesh; - std::shared_ptr meshRenderer; - std::shared_ptr material; - }; - - struct PlayerPrefab createPlayerPrefab(const std::shared_ptr world); -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/TestEntityPrefab.cpp b/src/dawnrpg/prefab/TestEntityPrefab.cpp deleted file mode 100644 index 8a441257..00000000 --- a/src/dawnrpg/prefab/TestEntityPrefab.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TestEntityPrefab.hpp" -#include "display/mesh/CubeMesh.hpp" - -using namespace Dawn; - -struct TestEntityPrefab Dawn::createTestEntityPrefab( - const std::shared_ptr map -) { - struct TestEntityPrefab entity; - entity.item = map->getScene()->createSceneItem(); - entity.item->setParent(map->getItem()); - - entity.entity = entity.item->addComponent(); - entity.entity->map = map; - entity.entity->id = EntityID::TestEntity; - - entity.mesh = std::make_shared(); - entity.mesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - CubeMesh::buffer( - entity.mesh, - glm::vec3(-0.5f, -0.5f, -0.5f), - glm::vec3(1, 1, 1), - 0, 0 - ); - - entity.meshRenderer = entity.item->addComponent(); - entity.meshRenderer->mesh = entity.mesh; - - entity.material = entity.item->addComponent(); - entity.material->setColor(COLOR_GREEN); - - return entity; -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/TestEntityPrefab.hpp b/src/dawnrpg/prefab/TestEntityPrefab.hpp deleted file mode 100644 index fa7452f5..00000000 --- a/src/dawnrpg/prefab/TestEntityPrefab.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/Prefab.hpp" -#include "component/entity/Entity.hpp" -#include "component/display/MeshRenderer.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" - -namespace Dawn { - struct TestEntityPrefab : public Prefab { - public: - std::shared_ptr entity; - std::shared_ptr mesh; - std::shared_ptr meshRenderer; - std::shared_ptr material; - }; - - struct TestEntityPrefab createTestEntityPrefab( - const std::shared_ptr map - ); -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/WorldPrefab.cpp b/src/dawnrpg/prefab/WorldPrefab.cpp deleted file mode 100644 index 239c6223..00000000 --- a/src/dawnrpg/prefab/WorldPrefab.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "WorldPrefab.hpp" -#include "display/mesh/QuadMesh.hpp" - -using namespace Dawn; - -struct WorldPrefab Dawn::createWorldPrefab(Scene &s) { - struct WorldPrefab world; - - world.item = s.createSceneItem(); - world.world = world.item->addComponent(); - - return world; -} - -struct MapPrefab Dawn::createMapPrefab( - const std::shared_ptr world -) { - struct MapPrefab map; - - map.item = world->getScene()->createSceneItem(); - map.map = map.item->addComponent(); - map.map->world = world; - - return map; -} \ No newline at end of file diff --git a/src/dawnrpg/prefab/WorldPrefab.hpp b/src/dawnrpg/prefab/WorldPrefab.hpp deleted file mode 100644 index 8fe9fb88..00000000 --- a/src/dawnrpg/prefab/WorldPrefab.hpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "prefab/Prefab.hpp" -#include "component/world/World.hpp" -#include "component/world/Map.hpp" - -namespace Dawn { - struct WorldPrefab : public Prefab { - public: - std::shared_ptr world; - }; - - struct MapPrefab : public Prefab { - public: - std::shared_ptr map; - }; - - struct WorldPrefab createWorldPrefab(Scene &scene); - - struct MapPrefab createMapPrefab(const std::shared_ptr world); -} \ No newline at end of file diff --git a/src/dawnrpg/scenes/SceneList.hpp b/src/dawnrpg/scenes/SceneList.hpp deleted file mode 100644 index 4a9d848b..00000000 --- a/src/dawnrpg/scenes/SceneList.hpp +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "scene/Scene.hpp" - -namespace Dawn { - void testScene(Scene &scene); - void worldScene(Scene &scene); - void vnScene(Scene &scene); -} diff --git a/src/dawnrpg/scenes/TestScene.cpp b/src/dawnrpg/scenes/TestScene.cpp deleted file mode 100644 index 2b5c90e9..00000000 --- a/src/dawnrpg/scenes/TestScene.cpp +++ /dev/null @@ -1,105 +0,0 @@ - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scenes/SceneList.hpp" -#include "component/display/Camera.hpp" -#include "prefab/SimpleSpinningCube.hpp" -#include "component/display/material/SimpleTexturedMaterial.hpp" -#include "display/mesh/CubeMesh.hpp" - -#include "component/ui/UICanvas.hpp" -#include "ui/elements/UIRectangle.hpp" -#include "ui/elements/UILabel.hpp" -#include "ui/UIMenu.hpp" -#include "ui/container/UIRowContainer.hpp" -#include "ui/container/UIPaddingContainer.hpp" - -#include "poker/PokerGame.hpp" - -using namespace Dawn; - -void Dawn::testScene(Scene &s) { - auto cameraItem = s.createSceneItem(); - auto camera = cameraItem->addComponent(); - cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); - camera->clipFar = 99999.99f; - - auto cube = s.createSceneItem(); - auto cubeMesh = std::make_shared(); - auto cubeRenderer = cube->addComponent(); - auto cubeMaterial = cube->addComponent(); - - cubeRenderer->mesh = cubeMesh; - cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - CubeMesh::buffer(cubeMesh, glm::vec3(0,0,0), glm::vec3(1, 1, 1), 0, 0); - - auto canvasItem = s.createSceneItem(); - auto canvas = canvasItem->addComponent(); - - auto container = std::make_shared(); - container->align = { 32, 32, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO }; - container->alignX = UIAlignmentType::START; - container->alignY = UIAlignmentType::START; - canvas->addElement(container); - - auto rect = std::make_shared(); - rect->align = { 0, 0, 32, 32 }; - rect->alignX = UIAlignmentType::START; - rect->alignY = UIAlignmentType::START; - rect->color = COLOR_MAGENTA; - container->appendChild(rect); - - auto texture = s.getGame()->assetManager.get("font_silver", 128); - while(!s.getGame()->assetManager.isEverythingLoaded()) { - s.getGame()->assetManager.update(); - } - - auto label = std::make_shared(); - label->align = { 0, 0, UI_ALIGN_SIZE_AUTO, UI_ALIGN_SIZE_AUTO }; - label->alignX = UIAlignmentType::START; - label->alignY = UIAlignmentType::START; - label->setFont(texture); - label->setText(L"Hello World!"); - container->appendChild(label); - - // auto game = std::make_shared(); - // auto player0 = game->addNewPlayer(); - // auto player1 = game->addNewPlayer(); - // auto player2 = game->addNewPlayer(); - // auto player3 = game->addNewPlayer(); - // game->newGame(); - // game->takeBlinds(); - // game->dealToEveryone(2); - - // std::shared_ptr player; - // while((player = game->getCurrentBetter()) != nullptr) { - // auto turn = player->getAITurn(); - // std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl; - // turn.action(); - // } - - // std::cout << "Reveal flop" << std::endl; - // game->burnCard(); - // game->turn(); - - // game->newBettingRound(); - // while((player = game->getCurrentBetter()) != nullptr) { - // auto turn = player->getAITurn(); - // std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl; - // turn.action(); - // } - - // std::cout << "Reveal turn" << std::endl; - // game->burnCard(); - // game->turn(); - - // game->newBettingRound(); - // while((player = game->getCurrentBetter()) != nullptr) { - // auto turn = player->getAITurn(); - // std::cout << "Player " << (int)player->playerIndex << " is taking turn: " << (int)turn.type << std::endl; - // turn.action(); - // } -} \ No newline at end of file diff --git a/src/dawnrpg/scenes/VNScene.cpp b/src/dawnrpg/scenes/VNScene.cpp deleted file mode 100644 index 9cbb6b2d..00000000 --- a/src/dawnrpg/scenes/VNScene.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scenes/SceneList.hpp" -#include "component/display/Camera.hpp" - -#include "component/ui/UICanvas.hpp" -#include "ui/elements/UIRectangle.hpp" -#include "ui/elements/UILabel.hpp" -#include "ui/UIMenu.hpp" -#include "ui/container/UIRowContainer.hpp" -#include "ui/container/UIPaddingContainer.hpp" -#include "component/vn/VNManager.hpp" - -using namespace Dawn; - -void Dawn::vnScene(Scene &s) { - // Load assets - // auto testj = s.getGame()->assetManager.get("test"); - auto texture = s.getGame()->assetManager.get( - "font_silver", 32 - ); - while(!s.getGame()->assetManager.isEverythingLoaded()) { - s.getGame()->assetManager.update(); - } - - // Setup camera - auto cameraItem = s.createSceneItem(); - auto camera = cameraItem->addComponent(); - cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); - camera->clipFar = 99999.99f; - - // Create canvas - auto canvasItem = s.createSceneItem(); - auto canvas = canvasItem->addComponent(); - - auto vnManager = canvasItem->addComponent(); - vnManager->canvas = canvas; - vnManager->texture = texture; - vnManager->setText(L"The quick brown fox jumps over the lazy dog. It does this by flapping its little wings and flying away into the sunset. The quick brown fox jumps over the lazy dog. It does this by flapping its little wings and flying away into the sunset. The quick brown fox jumps over the lazy dog. It does this by flapping its little wings and flying away into the sunset."); - - std::cout << "VN Scene Loaded" << std::endl; -} \ No newline at end of file diff --git a/src/dawnrpg/scenes/WorldScene.cpp b/src/dawnrpg/scenes/WorldScene.cpp deleted file mode 100644 index adbed34a..00000000 --- a/src/dawnrpg/scenes/WorldScene.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "scenes/SceneList.hpp" -#include "prefab/PlayerPrefab.hpp" -#include "prefab/TestEntityPrefab.hpp" -#include "prefab/WorldPrefab.hpp" -#include "component/display/Camera.hpp" -// #include "prefab/SimpleSpinningCube.hpp" -// #include "component/display/material/SimpleTexturedMaterial.hpp" -// #include "display/mesh/CubeMesh.hpp" - -// #include "component/ui/UICanvas.hpp" -// #include "ui/elements/UIRectangle.hpp" -// #include "ui/elements/UILabel.hpp" -// #include "ui/UIMenu.hpp" -// #include "ui/container/UIRowContainer.hpp" -// #include "ui/container/UIPaddingContainer.hpp" - -// #include "poker/PokerGame.hpp" - -using namespace Dawn; - -void Dawn::worldScene(Scene &s) { - auto testj = s.getGame()->assetManager.get("test"); - while(!s.getGame()->assetManager.isEverythingLoaded()) { - s.getGame()->assetManager.update(); - } - - auto cameraItem = s.createSceneItem(); - auto camera = cameraItem->addComponent(); - cameraItem->lookAt({ 3, 3, 3 }, { 0, 0, 0 }, { 0, 1, 0 }); - camera->clipFar = 99999.99f; - - // auto cube = s.createSceneItem(); - // auto cubeMesh = std::make_shared(); - // auto cubeRenderer = cube->addComponent(); - // auto cubeMaterial = cube->addComponent(); - - // cubeRenderer->mesh = cubeMesh; - // cubeMesh->createBuffers(CUBE_VERTICE_COUNT, CUBE_INDICE_COUNT); - // CubeMesh::buffer(cubeMesh, glm::vec3(0,0,0), glm::vec3(1, 1, 1), 0, 0); - - // auto canvasItem = s.createSceneItem(); - // auto canvas = canvasItem->addComponent(); - - auto world = createWorldPrefab(s); - auto map = createMapPrefab(world.world); - map.map->setSize( - 32, 32, 32, - 3, 3, 3 - ); - - auto chunk = map.map->getChunkAt({ 0, 0, 0 }); - chunk = map.map->getChunkAt({ 1, 0, 0 }); - chunk = map.map->getChunkAt({ 0, 1, 0 }); - chunk = map.map->getChunkAt({ 0, 0, 1 }); - - auto player = createPlayerPrefab(map.map); - player.player->camera = camera; - - auto test = createTestEntityPrefab(map.map); - test.entity->setPosition({ 5, 0, 0 }); -} \ No newline at end of file diff --git a/src/dawntruetype/CMakeLists.txt b/src/dawnterm/CMakeLists.txt similarity index 71% rename from src/dawntruetype/CMakeLists.txt rename to src/dawnterm/CMakeLists.txt index 86a8bf3b..d330dbf6 100644 --- a/src/dawntruetype/CMakeLists.txt +++ b/src/dawnterm/CMakeLists.txt @@ -1,20 +1,23 @@ -# Copyright (c) 2022 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Includes -target_include_directories(${DAWN_TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_LIST_DIR} -) - -target_link_libraries(${DAWN_TARGET_NAME} - PUBLIC - freetype -) - -# Subdirs -add_subdirectory(asset) -add_subdirectory(display) -add_subdirectory(ui) \ No newline at end of file +# Copyright (c) 2024 Dominic Masters +# +# This software is released under the MIT License. +# https://opensource.org/licenses/MIT + +# Libraries +target_link_libraries(${DAWN_TARGET_NAME} + PUBLIC +) + +# Includes +target_include_directories(${DAWN_TARGET_NAME} + PUBLIC + ${CMAKE_CURRENT_LIST_DIR} +) + +# Subdirs +add_subdirectory(display) + +# Sources +target_sources(${DAWN_TARGET_NAME} + PRIVATE +) \ No newline at end of file diff --git a/src/dawnrpg/scenes/CMakeLists.txt b/src/dawnterm/display/CMakeLists.txt similarity index 76% rename from src/dawnrpg/scenes/CMakeLists.txt rename to src/dawnterm/display/CMakeLists.txt index 3ea6c81b..fb39880e 100644 --- a/src/dawnrpg/scenes/CMakeLists.txt +++ b/src/dawnterm/display/CMakeLists.txt @@ -3,9 +3,11 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs + +# Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - TestScene.cpp - WorldScene.cpp - VNScene.cpp + frame.c + symbol.c ) \ No newline at end of file diff --git a/src/dawnterm/display/frame.c b/src/dawnterm/display/frame.c new file mode 100644 index 00000000..2797438e --- /dev/null +++ b/src/dawnterm/display/frame.c @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "frame.h" +#include "display/symbol.h" +#include "rpg/world/map.h" +#include "game.h" + +char_t FRAME_BUFFER[FRAME_HEIGHT * FRAME_WIDTH]; +uint8_t FRAME_COLOR[FRAME_HEIGHT * FRAME_WIDTH]; + +void frameInit() { + memset(FRAME_BUFFER, ' ', FRAME_HEIGHT * FRAME_WIDTH); +} + +void frameUpdate() { + // Draw buffer + entity_t *ent; + tile_t tile; + uint32_t i; + + map_t *map = GAME.currentMap; + if(map == NULL) { + memset(FRAME_BUFFER, ' ', FRAME_HEIGHT * FRAME_WIDTH); + return; + } + + // Update frame buffer. I can definitely optimize this. + i = 0; + for(uint16_t y = 0; y < FRAME_HEIGHT; y++) { + for(uint16_t x = 0; x < FRAME_WIDTH; x++) { + if(x >= map->width || y >= map->height) { + FRAME_COLOR[i] = COLOR_BLACK; + FRAME_BUFFER[i++] = ' '; + continue; + } + + // Entity? + ent = mapEntityGetByPosition(map, x, y); + if(ent != NULL) { + FRAME_COLOR[i] = symbolGetColorByEntity(ent); + FRAME_BUFFER[i++] = symbolGetCharByEntity(ent); + continue; + } + + // Tile? + tile = mapTileGetByPosition(map, x, y, 0); + FRAME_COLOR[i] = symbolGetColorByTile(tile); + FRAME_BUFFER[i++] = symbolGetCharByTile(tile); + } + } +} \ No newline at end of file diff --git a/src/dawnterm/display/frame.h b/src/dawnterm/display/frame.h new file mode 100644 index 00000000..0ee81c4e --- /dev/null +++ b/src/dawnterm/display/frame.h @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "display/color.h" + +#define FRAME_WIDTH 30 +#define FRAME_HEIGHT 12 + +extern char_t FRAME_BUFFER[FRAME_HEIGHT * FRAME_WIDTH]; +extern uint8_t FRAME_COLOR[FRAME_HEIGHT * FRAME_WIDTH]; + +/** + * Initializes the frame buffer. + */ +void frameInit(); + +/** + * Updates the terminal frame. + */ +void frameUpdate(); \ No newline at end of file diff --git a/src/dawnterm/display/symbol.c b/src/dawnterm/display/symbol.c new file mode 100644 index 00000000..208cf052 --- /dev/null +++ b/src/dawnterm/display/symbol.c @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "assert/assert.h" +#include "rpg/entity/entitydirection.h" +#include "symbol.h" +#include "time.h" + +char_t symbolGetCharByEntity(const entity_t *ent) { + assertNotNull(ent, "Entity cannot be NULL."); + switch(ent->direction) { + case ENTITY_DIRECTION_EAST: return '>'; + case ENTITY_DIRECTION_WEST: return '<'; + case ENTITY_DIRECTION_NORTH: return '^'; + case ENTITY_DIRECTION_SOUTH: return 'v'; + default: + assertUnreachable("Invalid entity direction."); + } +} + +char_t symbolGetCharByTile(const tile_t tile) { + switch(tile.id) { + case TILE_ID_GRASS: + return '+'; + + case TILE_ID_WATER: + // Take remainder + return (int32_t)(TIME.time * 2) % 2 == 0 ? '~' : '-'; + + default: + return ' '; + } +} + +uint8_t symbolGetColorByEntity(const entity_t *ent) { + assertNotNull(ent, "Entity cannot be NULL."); + switch(ent->type) { + case ENTITY_TYPE_PLAYER: + return COLOR_RED; + + case ENTITY_TYPE_NPC: + return COLOR_YELLOW; + + default: + assertUnreachable("Invalid entity type."); + } +} + +uint8_t symbolGetColorByTile(const tile_t tile) { + switch(tile.id) { + case TILE_ID_GRASS: + return COLOR_GREEN; + + case TILE_ID_WATER: + return COLOR_BLUE; + + default: + return COLOR_BLACK; + } +} \ No newline at end of file diff --git a/src/dawnterm/display/symbol.h b/src/dawnterm/display/symbol.h new file mode 100644 index 00000000..ae8e5bfa --- /dev/null +++ b/src/dawnterm/display/symbol.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "rpg/entity/entity.h" +#include "rpg/world/tile.h" +#include "display/color.h" + +/** + * Returns the symbol for the given entity. + * + * @param ent Entity to get the symbol for. + * @return The symbol for the entity. + */ +char_t symbolGetCharByEntity(const entity_t *ent); + +/** + * Returns the symbol for the given tile. + * + * @param tile Tile to get the symbol for. + * @return The symbol for the tile. + */ +char_t symbolGetCharByTile(const tile_t tile); + +/** + * Returns the color for the given entity. + * + * @param ent Entity to get the color for. + * @return The color for the entity. + */ +uint8_t symbolGetColorByEntity(const entity_t *ent); + +/** + * Returns the color for the given tile. + * + * @param tile Tile to get the color for. + * @return The color for the tile. + */ +uint8_t symbolGetColorByTile(const tile_t tile); \ No newline at end of file diff --git a/src/dawnrpg/CMakeLists.txt b/src/dawntermlinux/CMakeLists.txt similarity index 56% rename from src/dawnrpg/CMakeLists.txt rename to src/dawntermlinux/CMakeLists.txt index c6c7237d..b7fa5584 100644 --- a/src/dawnrpg/CMakeLists.txt +++ b/src/dawntermlinux/CMakeLists.txt @@ -1,24 +1,26 @@ -# Copyright (c) 2023 Dominic Masters +# Copyright (c) 2024 Dominic Masters # # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Libraries +target_link_libraries(${DAWN_TARGET_NAME} + PUBLIC + m +) + # Includes target_include_directories(${DAWN_TARGET_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} ) +# Subdirs +add_subdirectory(display) + # Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - dawnrpg.cpp -) - -# Subdirs -add_subdirectory(component) -add_subdirectory(prefab) -add_subdirectory(scenes) - -# Assets -include("${DAWN_ASSETS_SOURCE_DIR}/dawnrpg/CMakeLists.txt") \ No newline at end of file + input.c + linuxhost.c +) \ No newline at end of file diff --git a/src/dawntruetype/asset/CMakeLists.txt b/src/dawntermlinux/display/CMakeLists.txt similarity index 76% rename from src/dawntruetype/asset/CMakeLists.txt rename to src/dawntermlinux/display/CMakeLists.txt index fbf54f24..8dc2fa73 100644 --- a/src/dawntruetype/asset/CMakeLists.txt +++ b/src/dawntermlinux/display/CMakeLists.txt @@ -3,9 +3,10 @@ # This software is released under the MIT License. # https://opensource.org/licenses/MIT +# Subdirs + +# Sources target_sources(${DAWN_TARGET_NAME} PRIVATE - AssetManagerTrueType.cpp -) - -add_subdirectory(loaders) \ No newline at end of file + display.c +) \ No newline at end of file diff --git a/src/dawntermlinux/display/display.c b/src/dawntermlinux/display/display.c new file mode 100644 index 00000000..3d9f96de --- /dev/null +++ b/src/dawntermlinux/display/display.c @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "display/display.h" +#include "display/frame.h" +#include "display/termcolor.h" +#include "assert/assert.h" + +void displayInit() { + frameInit(); +} + +void displayUpdate() { + frameUpdate(); + + // Print clear and return to top left + printf("\033[2J\033[1;1H"); + int32_t i = 0; + const char_t *color; + for(uint16_t y = 0; y < FRAME_HEIGHT; y++) { + for(uint16_t x = 0; x < FRAME_WIDTH; x++) { + switch(FRAME_COLOR[i]) { + case COLOR_BLACK: + color = TERM_COLOR_BLACK; + break; + + case COLOR_WHITE: + color = TERM_COLOR_WHITE; + break; + + case COLOR_RED: + color = TERM_COLOR_RED; + break; + + case COLOR_GREEN: + color = TERM_COLOR_GREEN; + break; + + case COLOR_BLUE: + color = TERM_COLOR_BLUE; + break; + + case COLOR_YELLOW: + color = TERM_COLOR_YELLOW; + break; + + case COLOR_MAGENTA: + color = TERM_COLOR_MAGENTA; + break; + + case COLOR_CYAN: + color = TERM_COLOR_CYAN; + break; + + default: + assertUnreachable("Invalid color."); + } + + printf( + "%s%c", + color, + FRAME_BUFFER[i] + ); + i++; + } + + printf("\r\n"); + } + + printf(TERM_COLOR_RESET); +} + +void displayDispose() { +} \ No newline at end of file diff --git a/src/dawntermlinux/display/termcolor.h b/src/dawntermlinux/display/termcolor.h new file mode 100644 index 00000000..07e25ce2 --- /dev/null +++ b/src/dawntermlinux/display/termcolor.h @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "dawn.h" + +#define TERM_COLOR_BLACK "\x1b[30m" +#define TERM_COLOR_WHITE "\x1b[37m" +#define TERM_COLOR_RED "\x1b[31m" +#define TERM_COLOR_GREEN "\x1b[32m" +#define TERM_COLOR_BLUE "\x1b[34m" +#define TERM_COLOR_YELLOW "\x1b[33m" +#define TERM_COLOR_MAGENTA "\x1b[35m" +#define TERM_COLOR_CYAN "\x1b[36m" + +#define TERM_COLOR_RESET "\x1b[0m" \ No newline at end of file diff --git a/src/dawntermlinux/input.c b/src/dawntermlinux/input.c new file mode 100644 index 00000000..c90426b7 --- /dev/null +++ b/src/dawntermlinux/input.c @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "input.h" +#include "linuxhost.h" + +inputstate_t inputGetState(const inputbind_t bind) { + int32_t k = LINUX_TERM_HOST_KEY_PRESS; + + if(k == -1) return false; + + switch(bind) { + case INPUT_BIND_DOWN: + return k == 's'; + + case INPUT_BIND_UP: + return k == 'w'; + + case INPUT_BIND_LEFT: + return k == 'a'; + + case INPUT_BIND_RIGHT: + return k == 'd'; + + case INPUT_BIND_ACCEPT: + return k == 'e'; + + case INPUT_BIND_CANCEL: + return k == 'q'; + + default: + return false; + } +} \ No newline at end of file diff --git a/src/dawntermlinux/linuxhost.c b/src/dawntermlinux/linuxhost.c new file mode 100644 index 00000000..83b392dd --- /dev/null +++ b/src/dawntermlinux/linuxhost.c @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#include "linuxhost.h" +#include "game.h" +#include +#include + +int32_t LINUX_TERM_HOST_KEY_PRESS; +struct termios origionalTermios; + +void terminalModeReset() { + tcsetattr(0, TCSANOW, &origionalTermios); +} + +void terminalModeSetCONIO() { + struct termios new_termios; + + /* take two copies - one for now, one for later */ + tcgetattr(0, &origionalTermios); + memcpy(&new_termios, &origionalTermios, sizeof(new_termios)); + + /* register cleanup handler, and set the new terminal mode */ + atexit(terminalModeReset); + cfmakeraw(&new_termios); + tcsetattr(0, TCSANOW, &new_termios); +} + +int32_t keyboardCharacterAvailable() { + struct timeval tv = { 0L, 0L }; + fd_set fds; + FD_ZERO(&fds); + FD_SET(0, &fds); + return select(1, &fds, NULL, NULL, &tv) > 0; +} + +int32_t keyboardCharacterRead() { + int32_t r; + uchar_t c; + if ((r = read(0, &c, sizeof(c))) < 0) { + return r; + } else { + return c; + } +} + +int32_t linuxHostBeginUpdating() { + while(true) { + terminalModeSetCONIO(); + + while(!keyboardCharacterAvailable()) { + uint8_t result = gameUpdate(0.1f); + if(result == GAME_UPDATE_RESULT_EXIT) return 0; + if(result != GAME_UPDATE_RESULT_CONTINUE) return -1; + + // Clear input. + LINUX_TERM_HOST_KEY_PRESS = -1; + + // Clear console and return to left top + printf("\033[2J\033[1;1H"); + usleep(100000); + } + + LINUX_TERM_HOST_KEY_PRESS = keyboardCharacterRead(); + } + + return 0; +} \ No newline at end of file diff --git a/src/dawntermlinux/linuxhost.h b/src/dawntermlinux/linuxhost.h new file mode 100644 index 00000000..ccaa0704 --- /dev/null +++ b/src/dawntermlinux/linuxhost.h @@ -0,0 +1,16 @@ +/** + * Copyright (c) 2024 Dominic Masters + * + * This software is released under the MIT License. + * https://opensource.org/licenses/MIT + */ + +#pragma once +#include "display/display.h" + +extern int32_t LINUX_TERM_HOST_KEY_PRESS; + +/** + * Begins updating the host. + */ +int32_t linuxHostBeginUpdating(); diff --git a/src/dawntruetype/asset/AssetManagerTrueType.cpp b/src/dawntruetype/asset/AssetManagerTrueType.cpp deleted file mode 100644 index dadb814d..00000000 --- a/src/dawntruetype/asset/AssetManagerTrueType.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2024 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "asset/AssetManager.hpp" -#include "loaders/TrueTypeLoader.hpp" - -template<> -std::shared_ptr AssetManager::get( - const std::string filename, - const uint32_t fontSize -) { - auto existing = this->getExisting(filename); - if(existing) { - // Check pointer hasn't gone stale, if it has remove it and create new. - auto texture = existing->getTexture(fontSize); - if(texture) return texture; - this->removeExisting(filename); - } - - std::shared_ptr loader = std::make_shared( - filename - ); - pendingAssetLoaders.push_back(std::static_pointer_cast(loader)); - return loader->getTexture(fontSize); -} \ No newline at end of file diff --git a/src/dawntruetype/asset/loaders/CMakeLists.txt b/src/dawntruetype/asset/loaders/CMakeLists.txt deleted file mode 100644 index 577a1d15..00000000 --- a/src/dawntruetype/asset/loaders/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2024 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Sources -target_sources(${DAWN_TARGET_NAME} - PRIVATE - TrueTypeLoader.cpp -) \ No newline at end of file diff --git a/src/dawntruetype/asset/loaders/TrueTypeLoader.cpp b/src/dawntruetype/asset/loaders/TrueTypeLoader.cpp deleted file mode 100644 index 3d7a06b4..00000000 --- a/src/dawntruetype/asset/loaders/TrueTypeLoader.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TrueTypeLoader.hpp" -#include "assert/assert.hpp" - -using namespace Dawn; - -TrueTypeLoader::TrueTypeLoader(const std::string name) : - AssetLoader(name), - loader(name + ".ttf") -{ - // Init the font. - auto ret = FT_Init_FreeType(&fontLibrary); - assertTrue(ret == 0, "Failed to initialize FreeType library."); -} - -void TrueTypeLoader::updateSync() { - if(state != TrueTypeLoaderState::ASYNC_DONE) return; - state = TrueTypeLoaderState::SYNC_LOADING; - - // Init all the textures. - auto it = textures.begin(); - while(it != textures.end()) { - auto texture = it->second.lock(); - - if(texture) { - texture->setFace(face); - it++; - continue; - } - - it = textures.erase(it); - } - - // Done - state = TrueTypeLoaderState::SYNC_DONE; - this->loaded = true; -} - -void TrueTypeLoader::updateAsync() { - if(state != TrueTypeLoaderState::INITIAL) return; - state = TrueTypeLoaderState::ASYNC_LOADING; - - // Load the data. - this->loader.open(); - size_t size = loader.getSize(); - buffer = new uint8_t[size]; - - // Read the data. - size_t readSize = loader.read(buffer, size); - assertTrue(readSize == size, "Failed to read all data from TrueTypeLoader."); - - // Init the font. - auto ret = FT_New_Memory_Face(fontLibrary, buffer, size, 0, &face); - assertTrue(ret == 0, "Failed to load font face."); - - // Now close the asset loader - loader.close(); - state = TrueTypeLoaderState::ASYNC_DONE; -} - -std::shared_ptr TrueTypeLoader::getTexture( - const uint32_t fontSize -) { - // Check if we have the texture already and it hasn't gone stale. - auto it = textures.find(fontSize); - if(it != textures.end()) { - if(!it->second.expired()) return it->second.lock(); - textures.erase(it); - } - - // Create the texture. - auto texture = std::make_shared(fontSize); - textures[fontSize] = texture; - if(this->loaded) texture->setFace(face); - return texture; -} - -TrueTypeLoader::~TrueTypeLoader() { - if( - this->state == TrueTypeLoaderState::SYNC_DONE || - this->state == TrueTypeLoaderState::SYNC_LOADING || - this->state == TrueTypeLoaderState::ASYNC_DONE - ) { - FT_Done_Face(face); - } - - FT_Done_FreeType(fontLibrary); - - if(buffer != nullptr) { - delete[] buffer; - buffer = nullptr; - } -} \ No newline at end of file diff --git a/src/dawntruetype/asset/loaders/TrueTypeLoader.hpp b/src/dawntruetype/asset/loaders/TrueTypeLoader.hpp deleted file mode 100644 index 8735dab4..00000000 --- a/src/dawntruetype/asset/loaders/TrueTypeLoader.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "asset/AssetLoader.hpp" -#include "asset/AssetDataLoader.hpp" -#include "display/font/TrueTypeTexture.hpp" - -namespace Dawn { - enum class TrueTypeLoaderState { - INITIAL, - ASYNC_LOADING, - ASYNC_DONE, - SYNC_LOADING, - SYNC_DONE - }; - - class TrueTypeLoader : public AssetLoader { - protected: - FT_Library fontLibrary; - FT_Face face; - AssetDataLoader loader; - std::unordered_map> textures; - enum TrueTypeLoaderState state = TrueTypeLoaderState::INITIAL; - uint8_t *buffer = nullptr; - - public: - /** - * Constructs a TrueTypeLoader. You should instead use the parent - * asset managers' abstracted load method - * - * @param name File name asset to load, omitting the extension. - */ - TrueTypeLoader(const std::string name); - - void updateSync() override; - void updateAsync() override; - - /** - * Returns the texture for the given font size. - * - * @param fontSize Font size to get the texture for. - * @return Texture for the given character. - */ - std::shared_ptr getTexture( - const uint32_t fontSize - ); - - /** - * Dispose / Cleanup the truetype asset. Will also dispose the underlying - * truetype itself. - */ - ~TrueTypeLoader(); - }; -} \ No newline at end of file diff --git a/src/dawntruetype/display/CMakeLists.txt b/src/dawntruetype/display/CMakeLists.txt deleted file mode 100644 index 4f7c267f..00000000 --- a/src/dawntruetype/display/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_subdirectory(font) \ No newline at end of file diff --git a/src/dawntruetype/display/font/CMakeLists.txt b/src/dawntruetype/display/font/CMakeLists.txt deleted file mode 100644 index 42404b54..00000000 --- a/src/dawntruetype/display/font/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - TrueTypeTexture.cpp -) \ No newline at end of file diff --git a/src/dawntruetype/display/font/TrueTypeCharacter.hpp b/src/dawntruetype/display/font/TrueTypeCharacter.hpp deleted file mode 100644 index f4e04451..00000000 --- a/src/dawntruetype/display/font/TrueTypeCharacter.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "dawnlibs.hpp" - -namespace Dawn { - struct TrueTypeCharacter { - glm::vec2 advance; - glm::vec2 size; - glm::vec2 offset; - glm::vec4 quad; - }; -} \ No newline at end of file diff --git a/src/dawntruetype/display/font/TrueTypeTexture.cpp b/src/dawntruetype/display/font/TrueTypeTexture.cpp deleted file mode 100644 index e0bdc443..00000000 --- a/src/dawntruetype/display/font/TrueTypeTexture.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "TrueTypeTexture.hpp" -#include "assert/assert.hpp" -#include "util/Math.hpp" -#include "display/mesh/QuadMesh.hpp" - -using namespace Dawn; - -TrueTypeTexture::TrueTypeTexture(const uint32_t fontSize) : - fontSize(fontSize) -{ - assertTrue(fontSize > 0, "Font size cannot be zero"); - texture = std::make_shared(); -} - -void TrueTypeTexture::setFace(const FT_Face face) { - this->face = face; - assertTrue(fontSize < 256, "Font size cannot be greater than 256"); - - // Set freetype font size prior to baking. - auto ret = FT_Set_Pixel_Sizes(face, 0, fontSize); - if(ret != 0) { - assertUnreachable("Failed to set font size %i", ret); - } - - // Set the texture size - texture->setSize( - fontSize * 24, - fontSize * 24, - TextureFormat::R, - TextureDataFormat::UNSIGNED_BYTE - ); - - // Texture buffer - uint8_t *buffer = new uint8_t[texture->getWidth() * texture->getHeight()]; - // Fill with zeros - std::memset(buffer, 0, texture->getWidth() * texture->getHeight()); - - size_t offset = 0; - struct TrueTypeCharacter info; - int32_t textureX = 0, textureY = 0; - int32_t rowHeight = 0; - - // Character sets - std::vector characterBlocks; - // Latin - for(wchar_t c = 0x0020; c < 0x007F; c++) characterBlocks.push_back(c); - // Latin-1 Supplement - for(wchar_t c = 0x00A0; c < 0x00FF; c++) characterBlocks.push_back(c); - // Latin Extended-A - for(wchar_t c = 0x0100; c < 0x017F; c++) characterBlocks.push_back(c); - // Latin Extended-B - for(wchar_t c = 0x0180; c < 0x024F; c++) characterBlocks.push_back(c); - // Hiragana - for(wchar_t c = 0x3040; c < 0x309F; c++) characterBlocks.push_back(c); - // Katakana - for(wchar_t c = 0x30A0; c < 0x30FF; c++) characterBlocks.push_back(c); - - // For each character in the character set - for(wchar_t c : characterBlocks) { - // Load the character - if(FT_Load_Char(face, c, FT_LOAD_RENDER)) { - assertUnreachable("Failed to load character (1)"); - } - - // Store the character information - info.advance.x = (float_t)(face->glyph->advance.x >> 6); - info.advance.y = (float_t)(face->glyph->advance.y >> 6); - info.size = glm::vec2(face->glyph->bitmap.width, face->glyph->bitmap.rows); - - // Determine the texture position - if(textureX + face->glyph->bitmap.width >= texture->getWidth()) { - textureX = 0; - textureY += rowHeight + 2;// Tiny gap between rows - rowHeight = face->glyph->bitmap.rows; - } else { - rowHeight = Math::max(rowHeight, face->glyph->bitmap.rows); - } - - // Set the quad positions - info.offset = glm::vec2( - face->glyph->bitmap_left, - -face->glyph->bitmap_top - ); - info.quad = glm::vec4( - textureX, - textureY, - textureX + face->glyph->bitmap.width, - textureY + face->glyph->bitmap.rows - ) / glm::vec4( - texture->getWidth(), - texture->getHeight(), - texture->getWidth(), - texture->getHeight() - ); - - // Store the cached character data. - this->characterData[c] = info; - - // Determine pixel offset. - offset = textureX + (textureY * texture->getWidth()); - assertTrue( - offset + (face->glyph->bitmap.rows * texture->getWidth()) <= - texture->getWidth() * texture->getHeight(), - "Font texture buffer overflow will occur." - ); - - // Buffer pixels, we have to do this one row at a time due to the - // differences in width between the glyph and the texture. - const size_t countPerRow = face->glyph->bitmap.width; - int32_t i = 0; - while(i != face->glyph->bitmap.rows) { - std::memcpy( - buffer + offset + (i * texture->getWidth()), - face->glyph->bitmap.buffer + (i * countPerRow), - countPerRow - ); - i++; - } - - // Increment textureX - textureX += face->glyph->bitmap.width + 2;// I add a tiny gap between chars - } - - this->texture->buffer(buffer); - delete[] buffer; -} - -struct TrueTypeCharacter TrueTypeTexture::getCharacterData(wchar_t c) { - return this->characterData[c]; -} - -glm::vec2 TrueTypeTexture::bufferStringToMesh( - std::shared_ptr mesh, - const std::wstring text, - glm::vec2 &position, - bool_t flipY -) { - assertNotNull(mesh, "Mesh must be supplied and not null"); - assertTrue(text.size() > 0, "Text must be at least one character long."); - - // Create mesh buffers - mesh->createBuffers( - text.length() * QUAD_VERTICE_COUNT, - text.length() * QUAD_INDICE_COUNT - ); - - // Foreach char - size_t i = 0; - glm::vec2 size = { 0, 0 }; - for(wchar_t c : text) { - // Get the character data - auto info = this->getCharacterData(c); - - // Buffer the quad - glm::vec4 quad = glm::vec4( - position.x, - position.y, - position.x + info.size.x, - position.y + info.size.y - ); - if(flipY) { - QuadMesh::buffer( - mesh, - quad, - glm::vec4( - info.quad.x, - info.quad.w, - info.quad.z, - info.quad.y - ), - i * QUAD_VERTICE_COUNT, - i * QUAD_INDICE_COUNT - ); - } else { - QuadMesh::buffer( - mesh, - quad, - info.quad, - i * QUAD_VERTICE_COUNT, - i * QUAD_INDICE_COUNT - ); - } - position += info.advance; - size += info.advance; - - i++; - } - - return size; -} - -TrueTypeTexture::~TrueTypeTexture() { -} \ No newline at end of file diff --git a/src/dawntruetype/display/font/TrueTypeTexture.hpp b/src/dawntruetype/display/font/TrueTypeTexture.hpp deleted file mode 100644 index ece25333..00000000 --- a/src/dawntruetype/display/font/TrueTypeTexture.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "display/Texture.hpp" -#include "TrueTypeCharacter.hpp" -#include "display/mesh/Mesh.hpp" -#include -#include FT_FREETYPE_H - -namespace Dawn { - class TrueTypeTexture final { - private: - FT_Face face; - - public: - uint32_t fontSize; - std::shared_ptr texture; - std::unordered_map characterData; - - /** - * Construct a new New True Type Face Texture object - * - * @param fontSize Size of the font. - */ - TrueTypeTexture(const uint32_t fontSize); - - /** - * Sets the face for this texture. - * - * @param face Face to set. - */ - void setFace(const FT_Face face); - - /** - * Returns the character data for the given character. - * - * @param c Character to get data for. - * @return The Character data for the given character. - */ - struct TrueTypeCharacter getCharacterData(wchar_t c); - - /** - * Buffers a string to the given mesh. - * - * @param mesh Mesh to buffer to. - * @param text Text to buffer. - * @param position Position to buffer to. - * @param flipY Whether or not to flip the Y axis. - * @return The size of the string. - */ - glm::vec2 bufferStringToMesh( - std::shared_ptr mesh, - const std::wstring text, - glm::vec2 &position, - bool_t flipY = false - ); - - /** - * Destroys this true type face texture. - */ - ~TrueTypeTexture(); - }; -} \ No newline at end of file diff --git a/src/dawntruetype/ui/CMakeLists.txt b/src/dawntruetype/ui/CMakeLists.txt deleted file mode 100644 index bb90be1b..00000000 --- a/src/dawntruetype/ui/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2024 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_subdirectory(elements) \ No newline at end of file diff --git a/src/dawntruetype/ui/elements/CMakeLists.txt b/src/dawntruetype/ui/elements/CMakeLists.txt deleted file mode 100644 index a17b14dd..00000000 --- a/src/dawntruetype/ui/elements/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -target_sources(${DAWN_TARGET_NAME} - PRIVATE - UILabel.cpp -) \ No newline at end of file diff --git a/src/dawntruetype/ui/elements/UILabel.cpp b/src/dawntruetype/ui/elements/UILabel.cpp deleted file mode 100644 index 31bb630b..00000000 --- a/src/dawntruetype/ui/elements/UILabel.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#include "UILabel.hpp" - -using namespace Dawn; - -void UILabel::getSelfQuads(UICanvas &ctx) { - std::vector quads; - if(this->texture == nullptr || this->text.empty()) return; - - glm::vec4 quad; - glm::vec2 pos = glm::vec2(0, this->texture->fontSize); - bool_t lastCharWasSpace = false; - - for(size_t i = 0; i < text.size(); i++) { - wchar_t c = text[i]; - auto info = texture->getCharacterData(c); - - // Newline(s) - if(c == L'\n') { - pos.x = 0; - pos.y += this->texture->fontSize; - continue; - } - - // Spaces - if(c == L' ') { - pos.x += info.advance.x; - lastCharWasSpace = true; - continue; - } - - // Word Wrap - if(wordWrap) { - if(lastCharWasSpace) { - // Scan ahead to next space - float_t wordWidth = pos.x;// Start at current position and scan ahead. - for(size_t j = i; j < text.size(); j++) { - wchar_t c2 = text[j]; - if(c2 == L' ' || c2 == L'\n') { - break;// If we hit another space, we are OK. - } - - // Will this character fit on the row? If not the whole word will wrap. - auto info2 = texture->getCharacterData(c); - wordWidth += info.advance.x; - if(wordWidth > size.x) { - pos.x = 0; - pos.y += this->texture->fontSize; - break; - } - } - - lastCharWasSpace = false; - } - // } else if(pos.x + info.size.x > subAlignedPosition.x + size.x) { - // // Not word wrap, but instead just overflow characters. - // pos.x = 0; - // pos.y += this->texture->fontSize; - } - - ctx.addQuad( - { - subAlignedPosition.x + pos.x + info.offset.x, - subAlignedPosition.y + pos.y + info.offset.y, - subAlignedPosition.x + pos.x + info.size.x + info.offset.x, - subAlignedPosition.y + pos.y + info.size.y + info.offset.y - }, - { - info.quad.x, - info.quad.y, - info.quad.z, - info.quad.w - }, - this->color, - UIShaderQuadStyle::FONT, - texture->texture - ); - pos += info.advance; - } -} - -float_t UILabel::getContentWidth() { - if(this->texture == nullptr || this->text.empty()) return 0.0f; - - float_t lineWidth = 0.0f; - float_t width = 0.0f; - for(wchar_t c : text) { - if(c == L'\n') { - width = Math::max(width, lineWidth); - lineWidth = 0.0f; - continue; - } - - auto info = texture->getCharacterData(c); - lineWidth += info.advance.x; - if( - this->hasExplicitWidth() && - lineWidth >= size.x - ) return size.x; - } - width = Math::max(width, lineWidth); - return width; -} - -float_t UILabel::getContentHeight() { - if(this->texture == nullptr || this->text.empty()) return 0.0f; - - float_t height = this->texture->fontSize; - float_t lineWidth = 0.0f; - bool_t lastCharWasSpace = false; - - for(wchar_t c : text) { - if(c == L'\n') { - height += this->texture->fontSize; - continue; - } - - auto info = texture->getCharacterData(c); - - if(c == L' ') { - lineWidth += info.advance.x; - lastCharWasSpace = true; - continue; - } - - if(wordWrap) { - if(lastCharWasSpace) { - // Scan ahead to next space - float_t wordWidth = lineWidth;// Start at current position and scan ahead. - for(size_t j = 0; j < text.size(); j++) { - wchar_t c2 = text[j]; - if(c2 == L' ' || c2 == L'\n') { - break;// If we hit another space, we are OK. - } - - // Will this character fit on the row? If not the whole word will wrap. - auto info2 = texture->getCharacterData(c); - wordWidth += info.advance.x; - if(wordWidth > size.x) { - height += this->texture->fontSize; - lineWidth = 0.0f; - break; - } - } - - lastCharWasSpace = false; - } - // } else if(lineWidth + info.size.x > size.x) { - // height += this->texture->fontSize; - // lineWidth = 0.0f; - } - } - - return height; -} - -std::shared_ptr UILabel::getFont() { - return this->texture; -} - -std::wstring UILabel::getText() { - return this->text; -} - -void UILabel::setFont(std::shared_ptr texture) { - this->texture = texture; -} - -void UILabel::setText(const std::wstring &text) { - this->text = text; -} \ No newline at end of file diff --git a/src/dawntruetype/ui/elements/UILabel.hpp b/src/dawntruetype/ui/elements/UILabel.hpp deleted file mode 100644 index 8ea4eeef..00000000 --- a/src/dawntruetype/ui/elements/UILabel.hpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2023 Dominic Masters -// -// This software is released under the MIT License. -// https://opensource.org/licenses/MIT - -#pragma once -#include "ui/UISubAlignableElement.hpp" -#include "display/font/TrueTypeTexture.hpp" - -namespace Dawn { - class UILabel final : public UISubAlignableElement { - private: - std::shared_ptr texture = nullptr; - std::wstring text = L"Hello World"; - - protected: - void getSelfQuads(UICanvas &ctx) override; - - public: - bool_t wordWrap = true; - struct Color color = COLOR_WHITE; - - float_t getContentWidth() override; - float_t getContentHeight() override; - - /** - * Returns the font used for this label. - * - * @return The font used for this label. - */ - std::shared_ptr getFont(); - - /** - * Returns the text used for this label. - * - * @return The text used for this label. - */ - std::wstring getText(); - - /** - * Sets the font to use for this label. - * - * @param texture TrueType texture to use for this label. - */ - void setFont(std::shared_ptr texture); - - /** - * Sets the text to use for this label. - * - * @param text The text to use for this label. - */ - void setText(const std::wstring &text); - }; -} \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt deleted file mode 100644 index 00eab013..00000000 --- a/tools/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2023 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Tools -add_subdirectory(assetstool) -add_subdirectory(copytool) -add_subdirectory(texturetool) -add_subdirectory(truetypetool) \ No newline at end of file diff --git a/tools/assetstool/CMakeLists.txt b/tools/assetstool/CMakeLists.txt deleted file mode 100644 index 2cd1a33f..00000000 --- a/tools/assetstool/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -add_custom_target(dawnassets - COMMAND ${DAWN_TOOLS_DIR}/assetstool/assetstool.py - --input=${DAWN_ASSETS_BUILD_DIR} - --output=${DAWN_BUILD_DIR}/assets.tar - COMMENT "Bundling assets..." - USES_TERMINAL - DEPENDS ${DAWN_ASSETS} -) \ No newline at end of file diff --git a/tools/assetstool/assetstool.py b/tools/assetstool/assetstool.py deleted file mode 100755 index 9db833e2..00000000 --- a/tools/assetstool/assetstool.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -import os -import tarfile -import argparse - -# Args -parser = argparse.ArgumentParser(description='Bundles all assets into the internal archive format.') -parser.add_argument('-i', '--input'); -parser.add_argument('-o', '--output'); -args = parser.parse_args() - -# Ensure the directory for the output path exists -if not os.path.exists(os.path.dirname(args.output)): - os.makedirs(os.path.dirname(args.output)) - -# Create a ZIP archive and add the specified directory -# archive = tarfile.open(args.output, 'w:bz2') # BZ2 Compression - -# Does the archive already exist? -filesInArchive = [] - -if os.path.exists(args.output): - # Yes, open it - archive = tarfile.open(args.output, 'r:') - - # Get all the files in the archive - for member in archive.getmembers(): - filesInArchive.append(member.name) - - archive.close() - - # Open archive for appending. - archive = tarfile.open(args.output, 'a:') -else: - # No, create it - archive = tarfile.open(args.output, 'w:') - -# Add all files in the input directory -for foldername, subfolders, filenames in os.walk(args.input): - for filename in filenames: - - # Is the file already in the archive? - absolute_path = os.path.join(foldername, filename) - relative_path = os.path.relpath(absolute_path, args.input) - - if relative_path in filesInArchive: - # Yes, skip it - continue - - # No, add it - print(f"Archiving asset {filename}...") - archive.add(absolute_path, arcname=relative_path) - -# Close the archive -archive.close() \ No newline at end of file diff --git a/tools/copytool/CMakeLists.txt b/tools/copytool/CMakeLists.txt deleted file mode 100644 index a8aaee48..00000000 --- a/tools/copytool/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -function(tool_copy target input output) - add_custom_target(${target} - COMMAND ${CMAKE_COMMAND} -E copy ${input} ${output} - ) - add_dependencies(dawnassets ${target}) -endfunction() \ No newline at end of file diff --git a/tools/texturetool/CMakeLists.txt b/tools/texturetool/CMakeLists.txt deleted file mode 100644 index ef87fe7d..00000000 --- a/tools/texturetool/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (c) 2021 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -# Tool Function -function(tool_texture target) - # Defaults - set(FILE "" ) - set(FILTER_MIN "") - set(FILTER_MAG "") - set(WRAP_X "") - set(WRAP_Y "") - set(SCALE "") - set(CROP_START_X "") - set(CROP_START_Y "") - set(CROP_END_X "") - set(CROP_END_Y "") - - # Parse Args - foreach(_PAIR IN LISTS ARGN) - if (_PAIR MATCHES "^([^:]+)=(.*)$") - set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) - else() - message(FATAL_ERROR "Invalid pair: ${_PAIR}") - endif() - endforeach() - - # Check for missing args - if(NOT DEFINED FILE) - message(FATAL_ERROR "Missing FILE input") - endif() - - add_custom_target(${target} - COMMAND ${DAWN_TOOLS_DIR}/texturetool/texturetool.py - --input="${FILE}" - --output="${DAWN_ASSETS_BUILD_DIR}/${target}.texture" - --wrap-x="${WRAP_X}" - --wrap-y="${WRAP_Y}" - --filter-min="${FILTER_MIN}" - --filter-mag="${FILTER_MIN}" - --scale="${SCALE}" - --crop-start-x="${CROP_START_X}" - --crop-start-y="${CROP_START_Y}" - --crop-end-x="${CROP_END_X}" - --crop-end-y="${CROP_END_Y}" - COMMENT "Generating texture ${target} from ${FILE}" - ) - add_dependencies(dawnassets ${target}) -endfunction() \ No newline at end of file diff --git a/tools/texturetool/texturetool.py b/tools/texturetool/texturetool.py deleted file mode 100755 index c96fcb67..00000000 --- a/tools/texturetool/texturetool.py +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2023 Dominic Masters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -from PIL import Image -import argparse -import os - -# Args -parser = argparse.ArgumentParser(description='Converts image textures to internal game data format.') -parser.add_argument('-i', '--input'); -parser.add_argument('-o', '--output'); -parser.add_argument('-s', '--scale'); -parser.add_argument('-sf', '--scale-filter'); -parser.add_argument('-wx', '--wrap-x'); -parser.add_argument('-wy', '--wrap-y'); -parser.add_argument('-fi', '--filter-min') -parser.add_argument('-fg', '--filter-mag') -parser.add_argument('-csx', '--crop-start-x'); -parser.add_argument('-csy', '--crop-start-y'); -parser.add_argument('-cex', '--crop-end-x'); -parser.add_argument('-cey', '--crop-end-y'); -args = parser.parse_args() - -# Ensure input exists -if not os.path.exists(args.input): - print(f"Input file '{args.input}' does not exist.") - exit(1) - -# Open image -img = Image.open(args.input) - -# Normalize the image -hasAlpha = img.mode == 'RGBA' or img.mode == 'LA' - -# Convert the image to RGB or RGBA mode based on alpha channel -if hasAlpha: - img = img.convert('RGBA') -else: - img = img.convert('RGB') - - # Apply cropping -crop_box = [ - int(args.crop_start_x) if args.crop_start_x not in (None, "") else 0, - int(args.crop_start_y) if args.crop_start_y not in (None, "") else 0, - int(args.crop_end_x) if args.crop_end_x not in (None, "") else img.width, - int(args.crop_end_y) if args.crop_end_y not in (None, "") else img.height -] -img = img.crop(crop_box) - -# Apply scaling -if args.scale not in (None, ""): - scale = float(args.scale) - newSize = (int(img.width * scale), int(img.height * scale)) - if args.scale_filter == 'NEAREST': - img = img.resize(newSize, Image.NEAREST) - elif args.scale_filter == 'BILINEAR': - img = img.resize(newSize, Image.BILINEAR) - elif args.scale_filter == 'BICUBIC': - img = img.resize(newSize, Image.BICUBIC) - elif args.scale_filter == 'LANCZOS': - img = img.resize(newSize, Image.LANCZOS) - else: - img = img.resize(newSize) - - -# Filter -if args.filter_min.lower() == 'NEAREST': - filterMin = 0 -else: - filterMin = 1 - -if args.filter_mag.lower() == 'NEAREST': - filterMag = 0 -else: - filterMag = 1 - -# Wrap -if args.wrap_x.lower() == 'repeat': - wrapX = 0 -elif args.wrap_x.lower() == 'mirror': - wrapX = 1 -elif args.wrap_x.lower() == 'clamp': - wrapX = 2 -elif args.wrap_x.lower() == 'border': - wrapX = 3 -else: - wrapX = 2 - -if args.wrap_y.lower() == 'repeat': - wrapY = 0 -elif args.wrap_y.lower() == 'mirror': - wrapY = 1 -elif args.wrap_y.lower() == 'clamp': - wrapY = 2 -elif args.wrap_y.lower() == 'border': - wrapY = 3 -else: - wrapY = 2 - -# Get raw pixel data -buffer = img.tobytes() - -# Create the output directory if it doesn't exist -os.makedirs(os.path.dirname(args.output), exist_ok=True) - -# Write the image metadata and pixel data to the output file -with open(args.output, 'wb') as f: - header = f"DT_2.00|{img.width}|{img.height}|{4 if hasAlpha else 3}|{wrapX}|{wrapY}|{filterMin}|{filterMag}|" - f.write(header.encode()) - f.write(buffer) \ No newline at end of file diff --git a/tools/truetypetool/CMakeLists.txt b/tools/truetypetool/CMakeLists.txt deleted file mode 100644 index 17dce31f..00000000 --- a/tools/truetypetool/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2023 Dominic Msters -# -# This software is released under the MIT License. -# https://opensource.org/licenses/MIT - -function(tool_truetype target ttf) - tool_copy(${target} ${ttf} ${DAWN_ASSETS_BUILD_DIR}/${target}.ttf) -endfunction() \ No newline at end of file