From 7aa8e8961022fc0b6ea2b31bda2e1562b4bdd5cc Mon Sep 17 00:00:00 2001 From: dashodanger <> Date: Fri, 13 Dec 2024 20:20:49 -0700 Subject: [PATCH] Return to GL 1.3 minimum requirement; use strips for MD2/MD3 again instead of triangles --- libraries/glad/include/glad/glad.h | 314 +------------------------ libraries/glad/src/glad.c | 156 +----------- source_files/edge/i_video.cc | 4 +- source_files/edge/r_md2.cc | 366 ++++++++++++++++------------- source_files/edge/r_mdl.cc | 120 ++++------ source_files/edge/r_state.h | 15 -- source_files/edge/r_units.cc | 21 +- 7 files changed, 261 insertions(+), 735 deletions(-) diff --git a/libraries/glad/include/glad/glad.h b/libraries/glad/include/glad/glad.h index 1a8500454..9baebafe4 100644 --- a/libraries/glad/include/glad/glad.h +++ b/libraries/glad/include/glad/glad.h @@ -1,10 +1,10 @@ /* - OpenGL loader generated by glad 0.1.36 on Mon Nov 4 20:51:32 2024. + OpenGL loader generated by glad 0.1.36 on Sat Dec 14 02:42:14 2024. Language/Generator: C/C++ Specification: gl - APIs: gl=1.5 + APIs: gl=1.3 Profile: compatibility Extensions: @@ -14,9 +14,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="" + --profile="compatibility" --api="gl=1.3" --generator="c" --spec="gl" --extensions="" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5 + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.3 */ @@ -798,106 +798,6 @@ typedef void (APIENTRY *GLVULKANPROCNV)(void); #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 #ifndef GL_VERSION_1_0 #define GL_VERSION_1_0 1 GLAPI int GLAD_GL_VERSION_1_0; @@ -2072,212 +1972,6 @@ 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 #ifdef __cplusplus } diff --git a/libraries/glad/src/glad.c b/libraries/glad/src/glad.c index 914aa7442..b0f54e2af 100644 --- a/libraries/glad/src/glad.c +++ b/libraries/glad/src/glad.c @@ -1,10 +1,10 @@ /* - OpenGL loader generated by glad 0.1.36 on Mon Nov 4 20:51:32 2024. + OpenGL loader generated by glad 0.1.36 on Sat Dec 14 02:42:14 2024. Language/Generator: C/C++ Specification: gl - APIs: gl=1.5 + APIs: gl=1.3 Profile: compatibility Extensions: @@ -14,9 +14,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=1.5" --generator="c" --spec="gl" --extensions="" + --profile="compatibility" --api="gl=1.3" --generator="c" --spec="gl" --extensions="" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.5 + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D1.3 */ #include @@ -259,24 +259,15 @@ 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; PFNGLACCUMPROC glad_glAccum = NULL; PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; PFNGLBEGINPROC glad_glBegin = NULL; -PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; -PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; PFNGLBITMAPPROC glad_glBitmap = NULL; -PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; -PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; -PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; -PFNGLBUFFERDATAPROC glad_glBufferData = NULL; -PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; PFNGLCALLLISTPROC glad_glCallList = NULL; PFNGLCALLLISTSPROC glad_glCallLists = NULL; PFNGLCLEARPROC glad_glClear = NULL; @@ -335,9 +326,7 @@ PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; PFNGLCULLFACEPROC glad_glCullFace = NULL; -PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; -PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; @@ -356,7 +345,6 @@ PFNGLENABLEPROC glad_glEnable = NULL; PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; PFNGLENDPROC glad_glEnd = NULL; PFNGLENDLISTPROC glad_glEndList = NULL; -PFNGLENDQUERYPROC glad_glEndQuery = NULL; PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; @@ -372,25 +360,15 @@ PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; PFNGLFINISHPROC glad_glFinish = NULL; PFNGLFLUSHPROC glad_glFlush = 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; PFNGLFRONTFACEPROC glad_glFrontFace = NULL; PFNGLFRUSTUMPROC glad_glFrustum = NULL; -PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; PFNGLGENLISTSPROC glad_glGenLists = NULL; -PFNGLGENQUERIESPROC glad_glGenQueries = NULL; PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; -PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; -PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; -PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; @@ -409,9 +387,6 @@ PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; -PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; -PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; -PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; PFNGLGETSTRINGPROC glad_glGetString = NULL; PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; @@ -438,10 +413,8 @@ PFNGLINDEXUBPROC glad_glIndexub = NULL; PFNGLINDEXUBVPROC glad_glIndexubv = NULL; PFNGLINITNAMESPROC glad_glInitNames = NULL; PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; -PFNGLISBUFFERPROC glad_glIsBuffer = NULL; PFNGLISENABLEDPROC glad_glIsEnabled = NULL; PFNGLISLISTPROC glad_glIsList = NULL; -PFNGLISQUERYPROC glad_glIsQuery = NULL; PFNGLISTEXTUREPROC glad_glIsTexture = NULL; PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; @@ -465,7 +438,6 @@ PFNGLMAP1DPROC glad_glMap1d = NULL; PFNGLMAP1FPROC glad_glMap1f = NULL; PFNGLMAP2DPROC glad_glMap2d = NULL; PFNGLMAP2FPROC glad_glMap2f = NULL; -PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; @@ -479,8 +451,6 @@ PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; -PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; -PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; @@ -535,10 +505,6 @@ 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; PFNGLPOINTSIZEPROC glad_glPointSize = NULL; PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; @@ -593,23 +559,6 @@ PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; PFNGLSCALEDPROC glad_glScaled = NULL; PFNGLSCALEFPROC glad_glScalef = 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; -PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; PFNGLSHADEMODELPROC glad_glShadeModel = NULL; PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; @@ -670,7 +619,6 @@ PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; PFNGLTRANSLATEDPROC glad_glTranslated = NULL; PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; -PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; PFNGLVERTEX2DPROC glad_glVertex2d = NULL; PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; PFNGLVERTEX2FPROC glad_glVertex2f = NULL; @@ -697,22 +645,6 @@ PFNGLVERTEX4SPROC glad_glVertex4s = NULL; PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; PFNGLVIEWPORTPROC glad_glViewport = 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"); @@ -1111,78 +1043,6 @@ static void load_GL_VERSION_1_3(GLADloadproc load) { 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 int find_extensionsGL(void) { if (!get_exts()) return 0; (void)&has_ext; @@ -1230,11 +1090,9 @@ static void find_coreGL(void) { 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; - if (GLVersion.major > 1 || (GLVersion.major >= 1 && GLVersion.minor >= 5)) { + if (GLVersion.major > 1 || (GLVersion.major >= 1 && GLVersion.minor >= 3)) { max_loaded_major = 1; - max_loaded_minor = 5; + max_loaded_minor = 3; } } @@ -1248,8 +1106,6 @@ int gladLoadGLLoader(GLADloadproc 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); if (!find_extensionsGL()) return 0; return GLVersion.major != 0 || GLVersion.minor != 0; diff --git a/source_files/edge/i_video.cc b/source_files/edge/i_video.cc index 055a9b219..11bc66b1e 100644 --- a/source_files/edge/i_video.cc +++ b/source_files/edge/i_video.cc @@ -323,8 +323,8 @@ static bool InitializeWindow(DisplayMode *mode) #ifndef EDGE_GL_ES2 gladLoadGL(); - if (GLVersion.major == 1 && GLVersion.minor < 5) - FatalError("System only supports GL %d.%d. Minimum GL version 1.5 required!\n", GLVersion.major, GLVersion.minor); + if (GLVersion.major == 1 && GLVersion.minor < 3) + FatalError("System only supports GL %d.%d. Minimum GL version 1.3 required!\n", GLVersion.major, GLVersion.minor); #endif return true; diff --git a/source_files/edge/r_md2.cc b/source_files/edge/r_md2.cc index dbc6fa918..467e5697f 100644 --- a/source_files/edge/r_md2.cc +++ b/source_files/edge/r_md2.cc @@ -87,13 +87,13 @@ struct RawMD2Header int32_t num_skins; int32_t num_vertices; // per frame int32_t num_st; - int32_t total_triangles_; + int32_t num_tris_; int32_t num_glcmds; int32_t num_frames; int32_t ofs_skins; int32_t ofs_st; - int32_t ofs_triangles_; + int32_t ofs_tris; int32_t ofs_frames; int32_t ofs_glcmds; int32_t ofs_end; @@ -116,6 +116,12 @@ struct RawMD2Vertex uint8_t light_normal; }; +struct RawMD2GLCommand +{ + uint32_t s, t; + int32_t vert_index; +}; + struct RawMD2Frame { uint32_t scale[3]; @@ -169,9 +175,9 @@ struct RawMD3Mesh int32_t num_frames; int32_t num_shaders; int32_t num_verts; - int32_t total_triangles_; + int32_t num_tris; - int32_t ofs_triangles_; + int32_t ofs_tris; int32_t ofs_shaders; int32_t ofs_texcoords; // one texcoord per vertex int32_t ofs_verts; @@ -232,8 +238,14 @@ struct MD2Point int vert_idx; }; -struct MD2Triangle +struct MD2Strip { + // either GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN + GLenum mode; + + // number of points in this strip / fan + int count; + // index to the first point (within md2_model_c::points). // All points for the strip are contiguous in that array. int first; @@ -244,36 +256,33 @@ class MD2Model public: int total_frames_; int total_points_; - int total_triangles_; + int total_strips_; MD2Frame *frames_; MD2Point *points_; - MD2Triangle *triangles_; + MD2Strip *strips_; int vertices_per_frame_; - GLuint vertex_buffer_object_; - RendererVertex *gl_vertices_; - bool color_flipped_; - public: - MD2Model(int nframe, int npoint, int ntriangles_) - : total_frames_(nframe), total_points_(npoint), total_triangles_(ntriangles_), vertices_per_frame_(0), - vertex_buffer_object_(0), gl_vertices_(nullptr) + MD2Model(int nframes, int npoints, int nstrips, int nverts) + : total_frames_(nframes), total_points_(npoints), total_strips_(nstrips), vertices_per_frame_(nverts), + gl_vertices_(nullptr) { frames_ = new MD2Frame[total_frames_]; points_ = new MD2Point[total_points_]; - triangles_ = new MD2Triangle[total_triangles_]; - gl_vertices_ = new RendererVertex[total_triangles_ * 3]; + strips_ = new MD2Strip[total_strips_]; + gl_vertices_ = new RendererVertex[vertices_per_frame_]; } ~MD2Model() { delete[] frames_; delete[] points_; - delete[] triangles_; + delete[] strips_; + delete[] gl_vertices_; } }; @@ -341,7 +350,7 @@ MD2Model *MD2Load(epi::File *f) if (epi::StringPrefixCompare(header.ident, kMD2Identifier) != 0) { - FatalError("MD2LoadModel: lump is not an MD2 model!"); + FatalError("MD2LoadModel: file is not an MD2 model!"); return nullptr; /* NOT REACHED */ } @@ -351,79 +360,81 @@ MD2Model *MD2Load(epi::File *f) return nullptr; /* NOT REACHED */ } - int num_frames = AlignedLittleEndianS32(header.num_frames); - int total_triangles_ = AlignedLittleEndianS32(header.total_triangles_); - int num_sts = AlignedLittleEndianS32(header.num_st); - int total_points_ = total_triangles_ * 3; + int num_frames = AlignedLittleEndianS32(header.num_frames); + int num_verts = AlignedLittleEndianS32(header.num_vertices); + int num_points = 0; + int num_strips = 0; - /* PARSE TRIANGLES */ + /* PARSE GL COMMANDS */ - RawMD2Triangle *md2_triangles_ = new RawMD2Triangle[total_triangles_]; + int num_glcmds = AlignedLittleEndianS32(header.num_glcmds); - f->Seek(AlignedLittleEndianS32(header.ofs_triangles_), epi::File::kSeekpointStart); - f->Read(md2_triangles_, total_triangles_ * sizeof(RawMD2Triangle)); + int32_t *glcmds = new int32_t[num_glcmds]; - for (int tri = 0; tri < total_triangles_; tri++) - { - md2_triangles_[tri].index_xyz[0] = AlignedLittleEndianU16(md2_triangles_[tri].index_xyz[0]); - md2_triangles_[tri].index_xyz[1] = AlignedLittleEndianU16(md2_triangles_[tri].index_xyz[1]); - md2_triangles_[tri].index_xyz[2] = AlignedLittleEndianU16(md2_triangles_[tri].index_xyz[2]); - md2_triangles_[tri].index_st[0] = AlignedLittleEndianU16(md2_triangles_[tri].index_st[0]); - md2_triangles_[tri].index_st[1] = AlignedLittleEndianU16(md2_triangles_[tri].index_st[1]); - } + f->Seek(AlignedLittleEndianS32(header.ofs_glcmds), epi::File::kSeekpointStart); + f->Read(glcmds, num_glcmds * sizeof(int32_t)); - /* PARSE TEXCOORDS */ + for (int aa = 0; aa < num_glcmds; aa++) + glcmds[aa] = AlignedLittleEndianS32(glcmds[aa]); - RawMD2TextureCoordinate *md2_sts = new RawMD2TextureCoordinate[num_sts]; + // determine total number of strips and points + for (i = 0; i < num_glcmds && glcmds[i] != 0; ) + { + int count = glcmds[i++]; - f->Seek(AlignedLittleEndianS32(header.ofs_st), epi::File::kSeekpointStart); - f->Read(md2_sts, num_sts * sizeof(RawMD2TextureCoordinate)); + if (count < 0) + count = -count; - for (int st = 0; st < num_sts; st++) - { - md2_sts[st].s = AlignedLittleEndianU16(md2_sts[st].s); - md2_sts[st].t = AlignedLittleEndianU16(md2_sts[st].t); - } + num_strips += 1; + num_points += count; - LogDebug(" frames:%d points:%d triangles: %d\n", num_frames, total_triangles_ * 3, total_triangles_); + i += count*3; + } - MD2Model *md = new MD2Model(num_frames, total_points_, total_triangles_); + MD2Model *md = new MD2Model(num_frames, num_points, num_strips, num_verts); - md->vertices_per_frame_ = AlignedLittleEndianS32(header.num_vertices); + LogDebug(" frames:%d points:%d strips: %d\n", num_frames, num_points, num_strips); - LogDebug(" vertices_per_frame_:%d\n", md->vertices_per_frame_); + LogDebug(" vertices_per_frame_:%d glcmds:%d\n", md->vertices_per_frame_, num_glcmds); - // convert raw triangles - MD2Triangle *tri = md->triangles_; - MD2Point *point = md->points_; + // convert glcmds into strips and points + MD2Strip *strip = md->strips_; + MD2Point *point = md->points_; - for (i = 0; i < total_triangles_; i++) - { - EPI_ASSERT(tri < md->triangles_ + md->total_triangles_); - EPI_ASSERT(point < md->points_ + md->total_points_); + for (i = 0; i < num_glcmds && glcmds[i] != 0; ) + { + int count = glcmds[i++]; - tri->first = point - md->points_; + EPI_ASSERT(strip < md->strips_ + md->total_strips_); + EPI_ASSERT(point < md->points_ + md->total_points_); - tri++; + strip->mode = (count < 0) ? GL_TRIANGLE_FAN : GL_TRIANGLE_STRIP; - for (int j = 0; j < 3; j++, point++) - { - RawMD2Triangle t = md2_triangles_[i]; + if (count < 0) + count = -count; - point->skin_s = (float)md2_sts[t.index_st[j]].s / header.skin_width; - point->skin_t = 1.0f - ((float)md2_sts[t.index_st[j]].t / header.skin_height); - point->vert_idx = t.index_xyz[j]; + strip->count = count; + strip->first = point - md->points_; - EPI_ASSERT(point->vert_idx >= 0); - EPI_ASSERT(point->vert_idx < md->vertices_per_frame_); - } - } + strip++; + + for (; count > 0; count--, point++, i += 3) + { + float *f_ptr = (float *) &glcmds[i]; + + point->skin_s = f_ptr[0]; + point->skin_t = 1.0 - f_ptr[1]; + point->vert_idx = glcmds[i+2]; - EPI_ASSERT(tri == md->triangles_ + md->total_triangles_); - EPI_ASSERT(point == md->points_ + md->total_points_); + EPI_ASSERT(point->vert_idx >= 0); + EPI_ASSERT(point->vert_idx < md->vertices_per_frame_); + } + } - delete[] md2_triangles_; - delete[] md2_sts; + EPI_ASSERT(strip == md->strips_ + md->total_strips_); + EPI_ASSERT(point == md->points_ + md->total_points_); + + delete[] glcmds; /* PARSE FRAMES */ @@ -506,12 +517,6 @@ MD2Model *MD2Load(epi::File *f) delete[] raw_verts; - glGenBuffers(1, &md->vertex_buffer_object_); - if (md->vertex_buffer_object_ == 0) - FatalError("MD2LoadModel: Failed to bind VBO!\n"); - global_render_state->BindBuffer(md->vertex_buffer_object_); - glBufferData(GL_ARRAY_BUFFER, md->total_triangles_ * 3 * sizeof(RendererVertex), nullptr, GL_STREAM_DRAW); - return md; } @@ -632,7 +637,7 @@ MD2Model *MD3Load(epi::File *f) if (strncmp(header.ident, kMD3Identifier, 4) != 0) { - FatalError("MD3LoadModel: lump is not an MD3 model!"); + FatalError("MD3LoadModel: file is not an MD3 model!"); return nullptr; /* NOT REACHED */ } @@ -657,13 +662,11 @@ MD2Model *MD3Load(epi::File *f) int num_frames = AlignedLittleEndianS32(mesh.num_frames); int num_verts = AlignedLittleEndianS32(mesh.num_verts); - int total_triangles_ = AlignedLittleEndianS32(mesh.total_triangles_); - - LogDebug(" frames:%d verts:%d triangles: %d\n", num_frames, num_verts, total_triangles_); + int num_strips = AlignedLittleEndianS32(mesh.num_tris); - MD2Model *md = new MD2Model(num_frames, total_triangles_ * 3, total_triangles_); + LogDebug(" frames:%d verts:%d triangles: %d\n", num_frames, num_verts, num_strips); - md->vertices_per_frame_ = num_verts; + MD2Model *md = new MD2Model(num_frames, num_strips * 3, num_strips, num_verts); /* PARSE TEXCOORD */ @@ -690,9 +693,9 @@ MD2Model *MD3Load(epi::File *f) /* PARSE TRIANGLES */ - f->Seek(mesh_base + AlignedLittleEndianS32(mesh.ofs_triangles_), epi::File::kSeekpointStart); + f->Seek(mesh_base + AlignedLittleEndianS32(mesh.ofs_tris), epi::File::kSeekpointStart); - for (i = 0; i < total_triangles_; i++) + for (i = 0; i < num_strips; i++) { RawMD3Triangle tri; @@ -706,7 +709,9 @@ MD2Model *MD3Load(epi::File *f) EPI_ASSERT(b < num_verts); EPI_ASSERT(c < num_verts); - md->triangles_[i].first = i * 3; + md->strips_[i].mode = GL_TRIANGLES; + md->strips_[i].first = i * 3; + md->strips_[i].count = 3; MD2Point *point = md->points_ + i * 3; @@ -765,11 +770,7 @@ MD2Model *MD3Load(epi::File *f) // TODO: load in bbox (for visibility checking) } - glGenBuffers(1, &md->vertex_buffer_object_); - if (md->vertex_buffer_object_ == 0) - FatalError("MD3LoadModel: Failed to create VBO!\n"); - global_render_state->BindBuffer(md->vertex_buffer_object_); - glBufferData(GL_ARRAY_BUFFER, md->total_triangles_ * 3 * sizeof(RendererVertex), nullptr, GL_STREAM_DRAW); + return md; } @@ -784,7 +785,7 @@ class MD2CoordinateData const MD2Frame *frame1_; const MD2Frame *frame2_; - const MD2Triangle *triangles_; + const MD2Strip *strip_; float lerp_; float x_, y_, z_; @@ -834,23 +835,6 @@ class MD2CoordinateData pos->Y = y_ + x2 * rotation_y_matrix_.X + y2 * rotation_y_matrix_.Y; pos->Z = z_ + z2; } - - void CalcNormal(HMM_Vec3 *normal, const MD2Vertex *vert) const - { - short n = vert->normal_idx; - - float nx1 = md_normals[n].X; - float ny1 = md_normals[n].Y; - float nz1 = md_normals[n].Z; - - float nx2 = nx1 * mouselook_x_matrix_.X + nz1 * mouselook_x_matrix_.Y; - float nz2 = nx1 * mouselook_z_matrix_.X + nz1 * mouselook_z_matrix_.Y; - float ny2 = ny1; - - normal->X = nx2 * rotation_x_matrix_.X + ny2 * rotation_x_matrix_.Y; - normal->Y = nx2 * rotation_y_matrix_.X + ny2 * rotation_y_matrix_.Y; - normal->Z = nz2; - } }; static void InitNormalColors(MD2CoordinateData *data) @@ -938,41 +922,31 @@ static void UpdateMulticols(MD2CoordinateData *data) } } -static inline float LerpIt(float v1, float v2, float lerp) -{ - return v1 * (1.0f - lerp) + v2 * lerp; -} - -static inline void ModelCoordFunc(MD2CoordinateData *data, int v_idx, HMM_Vec3 *pos, RGBAColor *rgb, HMM_Vec2 *texc, - HMM_Vec3 *normal) +static inline void ModelCoordFunc(MD2CoordinateData *data, int v_idx, HMM_Vec3 *pos, RGBAColor *rgb, HMM_Vec2 *texc) { const MD2Model *md = data->model_; const MD2Frame *frame1 = data->frame1_; const MD2Frame *frame2 = data->frame2_; - const MD2Triangle *tri = data->triangles_; + const MD2Strip *strip = data->strip_; - EPI_ASSERT(tri->first + v_idx >= 0); - EPI_ASSERT(tri->first + v_idx < md->total_points_); + EPI_ASSERT(strip->first + v_idx >= 0); + EPI_ASSERT(strip->first + v_idx < md->total_points_); - const MD2Point *point = &md->points_[tri->first + v_idx]; + const MD2Point *point = &md->points_[strip->first + v_idx]; const MD2Vertex *vert1 = &frame1->vertices[point->vert_idx]; const MD2Vertex *vert2 = &frame2->vertices[point->vert_idx]; - float x1 = LerpIt(vert1->x, vert2->x, data->lerp_); - float y1 = LerpIt(vert1->y, vert2->y, data->lerp_); - float z1 = LerpIt(vert1->z, vert2->z, data->lerp_) + data->bias_; + float x1 = HMM_Lerp(vert1->x, data->lerp_, vert2->x); + float y1 = HMM_Lerp(vert1->y, data->lerp_, vert2->y); + float z1 = HMM_Lerp(vert1->z, data->lerp_, vert2->z) + data->bias_; if (MirrorReflective()) y1 = -y1; data->CalcPos(pos, x1, y1, z1); - const MD2Vertex *n_vert = (data->lerp_ < 0.5) ? vert1 : vert2; - - data->CalcNormal(normal, n_vert); - if (data->is_fuzzy_) { texc->X = point->skin_s * data->fuzz_multiplier_ + data->fuzz_add_.X; @@ -984,7 +958,7 @@ static inline void ModelCoordFunc(MD2CoordinateData *data, int v_idx, HMM_Vec3 * *texc = {{point->skin_s * data->image_right_, point->skin_t * data->image_top_}}; - ColorMixer *col = &data->normal_colors_[n_vert->normal_idx]; + ColorMixer *col = &data->normal_colors_[(data->lerp_ < 0.5) ? vert1->normal_idx : vert2->normal_idx]; if (!data->is_additive_) { @@ -999,7 +973,7 @@ static inline void ModelCoordFunc(MD2CoordinateData *data, int v_idx, HMM_Vec3 * } void MD2RenderModel(MD2Model *md, const Image *skin_img, bool is_weapon, int frame1, int frame2, float lerp, float x, - float y, float z, MapObject *mo, RegionProperties *props, float scale, float aspect, float bias_, + float y, float z, MapObject *mo, RegionProperties *props, float scale, float aspect, float bias, int rotation) { // check if frames are valid @@ -1075,7 +1049,7 @@ void MD2RenderModel(MD2Model *md, const Image *skin_img, bool is_weapon, int fra data.xy_scale_ = scale * aspect * MirrorXYScale(); data.z_scale_ = scale * MirrorZScale(); - data.bias_ = bias_; + data.bias_ = bias; bool tilt = is_weapon || (mo->flags_ & kMapObjectFlagMissile) || (mo->hyper_flags_ & kHyperFlagForceModelTilt); @@ -1318,37 +1292,64 @@ void MD2RenderModel(MD2Model *md, const Image *skin_img, bool is_weapon, int fra global_render_state->TextureWrapT(renderer_dumb_clamp.d_ ? GL_CLAMP : GL_CLAMP_TO_EDGE); } - RendererVertex *start = md->gl_vertices_; - - for (int i = 0; i < md->total_triangles_; i++) + if (md->strips_[0].mode == GL_TRIANGLES) // MD3 models, it's a pile of triangles :/ { - data.triangles_ = &md->triangles_[i]; + glBegin(GL_TRIANGLES); + + RendererVertex *dest = md->gl_vertices_; - for (int v_idx = 0; v_idx < 3; v_idx++) + for (int i = 0; i < md->total_strips_; i++) { - RendererVertex *dest = start + (i * 3) + v_idx; + data.strip_ = &md->strips_[i]; - ModelCoordFunc(&data, v_idx, &dest->position, &dest->rgba, &dest->texture_coordinates[0], - &dest->normal); + for (int v_idx=0; v_idx < 3; v_idx++, dest++) + { + HMM_Vec3 *position = &dest->position; + RGBAColor *rgba = &dest->rgba; + HMM_Vec2 *texc = &dest->texture_coordinates[0]; - epi::SetRGBAAlpha(dest->rgba, trans); - dest->rgba = AlignedBigEndianU32(dest->rgba); + ModelCoordFunc(&data, v_idx, position, rgba, texc); + + epi::SetRGBAAlpha(*rgba, trans); + + global_render_state->GLColor(*rgba); + global_render_state->MultiTexCoord(GL_TEXTURE0, texc); + // vertex must be last + glVertex3fv((const GLfloat *)(position)); + } } - } - // setup client state - bool needed_bound = global_render_state->BindBuffer(md->vertex_buffer_object_); - glBufferData(GL_ARRAY_BUFFER, md->total_triangles_ * 3 * sizeof(RendererVertex), md->gl_vertices_, - GL_STREAM_DRAW); - if (needed_bound) - { - glVertexPointer(3, GL_FLOAT, sizeof(RendererVertex), (void *)(offsetof(RendererVertex, position.X))); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(RendererVertex), (void *)(offsetof(RendererVertex, rgba))); - glTexCoordPointer(2, GL_FLOAT, sizeof(RendererVertex), - (void *)(offsetof(RendererVertex, texture_coordinates[0]))); + glEnd(); } + else + { + RendererVertex *dest = md->gl_vertices_; + + for (int i = 0; i < md->total_strips_; i++) + { + data.strip_ = & md->strips_[i]; + + glBegin(data.strip_->mode); - glDrawArrays(GL_TRIANGLES, 0, md->total_triangles_ * 3); + for (int v_idx=0; v_idx < md->strips_[i].count; v_idx++) + { + HMM_Vec3 *position = &dest->position; + RGBAColor *rgba = &dest->rgba; + HMM_Vec2 *texc = &dest->texture_coordinates[0]; + + ModelCoordFunc(&data, v_idx, position, rgba, texc); + + epi::SetRGBAAlpha(*rgba, trans); + + global_render_state->GLColor(*rgba); + global_render_state->MultiTexCoord(GL_TEXTURE0, texc); + // vertex must be last + glVertex3fv((const GLfloat *)(position)); + } + + glEnd(); + } + } // restore the clamping mode if (old_clamp != kDummyClamp) @@ -1384,33 +1385,68 @@ void MD2RenderModel2D(MD2Model *md, const Image *skin_img, int frame, float x, f else global_render_state->GLColor(kRGBAWhite); - for (int i = 0; i < md->total_triangles_; i++) + if (md->strips_[0].mode == GL_TRIANGLES) { - const MD2Triangle *tri = &md->triangles_[i]; - glBegin(GL_TRIANGLES); - for (int v_idx = 0; v_idx < 3; v_idx++) + for (int i = 0; i < md->total_strips_; i++) { - const MD2Frame *frame_ptr = &md->frames_[frame]; + const MD2Strip *strip = &md->strips_[i]; + + for (int v_idx=0; v_idx < 3; v_idx++) + { + const MD2Frame *frame_ptr = & md->frames_[frame]; - EPI_ASSERT(tri->first + v_idx >= 0); - EPI_ASSERT(tri->first + v_idx < md->total_points_); + EPI_ASSERT(strip->first + v_idx >= 0); + EPI_ASSERT(strip->first + v_idx < md->total_points_); - const MD2Point *point = &md->points_[tri->first + v_idx]; - const MD2Vertex *vert = &frame_ptr->vertices[point->vert_idx]; + const MD2Point *point = &md->points_[strip->first + v_idx]; + const MD2Vertex *vert = &frame_ptr->vertices[point->vert_idx]; + const HMM_Vec2 texc = { point->skin_s * im_right, point->skin_t * im_top }; - glTexCoord2f(point->skin_s * im_right, point->skin_t * im_top); + global_render_state->MultiTexCoord(GL_TEXTURE0, &texc); - float dx = vert->x * xscale; - float dy = vert->y * xscale; - float dz = (vert->z + info->model_bias_) * yscale; + float dx = vert->x * xscale; + float dy = vert->y * xscale; + float dz = (vert->z + info->model_bias_) * yscale; - glVertex3f(x + dy, y + dz, dx / 256.0f); + glVertex3f(x + dy, y + dz, dx / 256.0f); + } } glEnd(); } + else + { + for (int i = 0; i < md->total_strips_; i++) + { + const MD2Strip *strip = &md->strips_[i]; + + glBegin(strip->mode); + + for (int v_idx=0; v_idx < md->strips_[i].count; v_idx++) + { + const MD2Frame *frame_ptr = & md->frames_[frame]; + + EPI_ASSERT(strip->first + v_idx >= 0); + EPI_ASSERT(strip->first + v_idx < md->total_points_); + + const MD2Point *point = &md->points_[strip->first + v_idx]; + const MD2Vertex *vert = &frame_ptr->vertices[point->vert_idx]; + const HMM_Vec2 texc = { point->skin_s * im_right, point->skin_t * im_top }; + + global_render_state->MultiTexCoord(GL_TEXTURE0, &texc); + + float dx = vert->x * xscale; + float dy = vert->y * xscale; + float dz = (vert->z + info->model_bias_) * yscale; + + glVertex3f(x + dy, y + dz, dx / 256.0f); + } + + glEnd(); + } + } global_render_state->Disable(GL_BLEND); global_render_state->Disable(GL_TEXTURE_2D); diff --git a/source_files/edge/r_mdl.cc b/source_files/edge/r_mdl.cc index e44848225..ddd4af030 100644 --- a/source_files/edge/r_mdl.cc +++ b/source_files/edge/r_mdl.cc @@ -100,9 +100,9 @@ struct RawMDLHeader int32_t skin_width; int32_t skin_height; - int32_t num_vertices; // per frame - int32_t total_triangles_; - int32_t total_frames_; + int32_t num_verts; // per frame + int32_t num_tris; + int32_t num_frames; int32_t synctype; int32_t flags; @@ -193,19 +193,17 @@ class MDLModel std::vector skin_id_list_; - GLuint vertex_buffer_object_; - RendererVertex *gl_vertices_; public: - MDLModel(int nframe, int npoint, int ntris, int swidth, int sheight) - : total_frames_(nframe), total_points_(npoint), total_triangles_(ntris), skin_width_(swidth), - skin_height_(sheight), vertices_per_frame_(0), vertex_buffer_object_(0), gl_vertices_(nullptr) + MDLModel(int nframes, int npoints, int ntris, int swidth, int sheight) + : total_frames_(nframes), total_points_(npoints), total_triangles_(ntris), skin_width_(swidth), + skin_height_(sheight), vertices_per_frame_(npoints), gl_vertices_(nullptr) { frames_ = new MDLFrame[total_frames_]; points_ = new MDLPoint[total_points_]; triangles_ = new MDLTriangle[total_triangles_]; - gl_vertices_ = new RendererVertex[total_triangles_ * 3]; + gl_vertices_ = new RendererVertex[vertices_per_frame_]; } ~MDLModel() @@ -213,6 +211,7 @@ class MDLModel delete[] frames_; delete[] points_; delete[] triangles_; + delete[] gl_vertices_; } }; @@ -276,14 +275,14 @@ MDLModel *MDLLoad(epi::File *f) return nullptr; /* NOT REACHED */ } - int total_frames_ = AlignedLittleEndianS32(header.total_frames_); - int total_triangles_ = AlignedLittleEndianS32(header.total_triangles_); - int num_verts = AlignedLittleEndianS32(header.num_vertices); + int num_frames = AlignedLittleEndianS32(header.num_frames); + int num_tris = AlignedLittleEndianS32(header.num_tris); + int num_verts = AlignedLittleEndianS32(header.num_verts); int swidth = AlignedLittleEndianS32(header.skin_width); int sheight = AlignedLittleEndianS32(header.skin_height); - int total_points_ = total_triangles_ * 3; + int num_points = num_tris * 3; - MDLModel *md = new MDLModel(total_frames_, total_points_, total_triangles_, swidth, sheight); + MDLModel *md = new MDLModel(num_frames, num_points, num_tris, swidth, sheight); /* PARSE SKINS */ @@ -321,14 +320,14 @@ MDLModel *MDLLoad(epi::File *f) /* PARSE TRIANGLES */ - RawMDLTriangle *tris = new RawMDLTriangle[total_triangles_]; - f->Read(tris, total_triangles_ * sizeof(RawMDLTriangle)); + RawMDLTriangle *tris = new RawMDLTriangle[num_tris]; + f->Read(tris, num_tris * sizeof(RawMDLTriangle)); /* PARSE FRAMES */ - RawMDLFrame *frames = new RawMDLFrame[total_frames_]; + RawMDLFrame *frames = new RawMDLFrame[num_frames]; - for (int fr = 0; fr < total_frames_; fr++) + for (int fr = 0; fr < num_frames; fr++) { frames[fr].frame.verts = new RawMDLVertex[num_verts]; f->Read(&frames[fr].type, sizeof(int)); @@ -338,9 +337,7 @@ MDLModel *MDLLoad(epi::File *f) f->Read(frames[fr].frame.verts, num_verts * sizeof(RawMDLVertex)); } - LogDebug(" frames:%d points:%d tris: %d\n", total_frames_, total_triangles_ * 3, total_triangles_); - - md->vertices_per_frame_ = num_verts; + LogDebug(" frames:%d points:%d tris: %d\n", num_frames, num_points, num_tris); LogDebug(" vertices_per_frame_:%d\n", md->vertices_per_frame_); @@ -348,7 +345,7 @@ MDLModel *MDLLoad(epi::File *f) MDLTriangle *tri = md->triangles_; MDLPoint *point = md->points_; - for (int i = 0; i < total_triangles_; i++) + for (int i = 0; i < num_tris; i++) { EPI_ASSERT(tri < md->triangles_ + md->total_triangles_); EPI_ASSERT(point < md->points_ + md->total_points_); @@ -403,7 +400,7 @@ MDLModel *MDLLoad(epi::File *f) translate[1] = f_ptr[1]; translate[2] = f_ptr[2]; - for (int i = 0; i < total_frames_; i++) + for (int i = 0; i < num_frames; i++) { RawMDLFrame raw_frame = frames[i]; @@ -444,11 +441,6 @@ MDLModel *MDLLoad(epi::File *f) delete[] texcoords; delete[] tris; delete[] frames; - glGenBuffers(1, &md->vertex_buffer_object_); - if (md->vertex_buffer_object_ == 0) - FatalError("MDL_LoadModel: Failed to bind VBO!\n"); - global_render_state->BindBuffer(md->vertex_buffer_object_); - glBufferData(GL_ARRAY_BUFFER, md->total_triangles_ * 3 * sizeof(RendererVertex), nullptr, GL_STREAM_DRAW); return md; } @@ -528,23 +520,6 @@ class MDLCoordinateData pos->Y = y_ + x2 * rotation_vector_y_.X + y2 * rotation_vector_y_.Y; pos->Z = z_ + z2; } - - void CalculateNormal(HMM_Vec3 *normal, const MDLVertex *vert) const - { - short n = vert->normal_idx; - - float nx1 = md_normals[n].X; - float ny1 = md_normals[n].Y; - float nz1 = md_normals[n].Z; - - float nx2 = nx1 * mouselook_x_vector_.X + nz1 * mouselook_x_vector_.Y; - float nz2 = nx1 * mouselook_z_vector_.X + nz1 * mouselook_z_vector_.Y; - float ny2 = ny1; - - normal->X = nx2 * rotation_vector_x_.X + ny2 * rotation_vector_x_.Y; - normal->Y = nx2 * rotation_vector_y_.X + ny2 * rotation_vector_y_.Y; - normal->Z = nz2; - } }; static void InitializeNormalColors(MDLCoordinateData *data) @@ -632,13 +607,7 @@ static void UpdateMulticols(MDLCoordinateData *data) } } -static inline float LerpIt(float v1, float v2, float lerp) -{ - return v1 * (1.0f - lerp) + v2 * lerp; -} - -static inline void ModelCoordFunc(MDLCoordinateData *data, int v_idx, HMM_Vec3 *pos, RGBAColor *rgb, HMM_Vec2 *texc, - HMM_Vec3 *normal) +static inline void ModelCoordFunc(MDLCoordinateData *data, int v_idx, HMM_Vec3 *pos, RGBAColor *rgb, HMM_Vec2 *texc) { const MDLModel *md = data->model_; @@ -654,19 +623,15 @@ static inline void ModelCoordFunc(MDLCoordinateData *data, int v_idx, HMM_Vec3 * const MDLVertex *vert1 = &frame1->vertices[point->vert_idx]; const MDLVertex *vert2 = &frame2->vertices[point->vert_idx]; - float x1 = LerpIt(vert1->x, vert2->x, data->lerp_); - float y1 = LerpIt(vert1->y, vert2->y, data->lerp_); - float z1 = LerpIt(vert1->z, vert2->z, data->lerp_) + data->bias_; + float x1 = HMM_Lerp(vert1->x, data->lerp_, vert2->x); + float y1 = HMM_Lerp(vert1->y, data->lerp_, vert2->y); + float z1 = HMM_Lerp(vert1->z, data->lerp_, vert2->z) + data->bias_; if (MirrorReflective()) y1 = -y1; data->CalculatePosition(pos, x1, y1, z1); - const MDLVertex *n_vert = (data->lerp_ < 0.5) ? vert1 : vert2; - - data->CalculateNormal(normal, n_vert); - if (data->is_fuzzy_) { texc->X = point->skin_s * data->fuzz_multiplier_ + data->fuzz_add_.X; @@ -678,7 +643,7 @@ static inline void ModelCoordFunc(MDLCoordinateData *data, int v_idx, HMM_Vec3 * *texc = {{point->skin_s, point->skin_t}}; - ColorMixer *col = &data->normal_colors_[n_vert->normal_idx]; + ColorMixer *col = &data->normal_colors_[(data->lerp_ < 0.5) ? vert1->normal_idx : vert2->normal_idx]; if (!data->is_additive_) { @@ -1013,37 +978,32 @@ void MDLRenderModel(MDLModel *md, const Image *skin_img, bool is_weapon, int fra global_render_state->TextureWrapT(renderer_dumb_clamp.d_ ? GL_CLAMP : GL_CLAMP_TO_EDGE); } - RendererVertex *start = md->gl_vertices_; + glBegin(GL_TRIANGLES); + + RendererVertex *dest = md->gl_vertices_; for (int i = 0; i < md->total_triangles_; i++) { data.strip_ = &md->triangles_[i]; - for (int v_idx = 0; v_idx < 3; v_idx++) + for (int v_idx = 0; v_idx < 3; v_idx++, dest++) { - RendererVertex *dest = start + (i * 3) + v_idx; + HMM_Vec3 *position = &dest->position; + RGBAColor *rgba = &dest->rgba; + HMM_Vec2 *texc = &dest->texture_coordinates[0]; - ModelCoordFunc(&data, v_idx, &dest->position, &dest->rgba, &dest->texture_coordinates[0], - &dest->normal); + ModelCoordFunc(&data, v_idx, position, rgba, texc); - epi::SetRGBAAlpha(dest->rgba, trans); - dest->rgba = AlignedBigEndianU32(dest->rgba); - } - } + epi::SetRGBAAlpha(*rgba, trans); - // setup client state - bool needed_bound = global_render_state->BindBuffer(md->vertex_buffer_object_); - glBufferData(GL_ARRAY_BUFFER, md->total_triangles_ * 3 * sizeof(RendererVertex), md->gl_vertices_, - GL_STREAM_DRAW); - if (needed_bound) - { - glVertexPointer(3, GL_FLOAT, sizeof(RendererVertex), (void *)(offsetof(RendererVertex, position.X))); - glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(RendererVertex), (void *)(offsetof(RendererVertex, rgba))); - glTexCoordPointer(2, GL_FLOAT, sizeof(RendererVertex), - (void *)(offsetof(RendererVertex, texture_coordinates[0]))); + global_render_state->GLColor(*rgba); + global_render_state->MultiTexCoord(GL_TEXTURE0, texc); + // vertex must be last + glVertex3fv((const GLfloat *)(position)); + } } - glDrawArrays(GL_TRIANGLES, 0, md->total_triangles_ * 3); + glEnd(); // restore the clamping mode if (old_clamp != kDummyClamp) diff --git a/source_files/edge/r_state.h b/source_files/edge/r_state.h index 62586fbc8..c07667cf8 100644 --- a/source_files/edge/r_state.h +++ b/source_files/edge/r_state.h @@ -541,19 +541,6 @@ class RenderState ec_frame_stats.draw_state_change++; } - bool BindBuffer(GLuint buffer) - { - if (bound_buffer_ == buffer) - { - return false; // already bound - } - - bound_buffer_ = buffer; - glBindBuffer(GL_ARRAY_BUFFER, buffer); - ec_frame_stats.draw_state_change++; - return true; - } - int frameStateChanges_ = 0; private: @@ -568,8 +555,6 @@ class RenderState GLenum shade_model_; - GLuint bound_buffer_; - bool enable_scissor_test_; bool enable_clip_plane_[6]; diff --git a/source_files/edge/r_units.cc b/source_files/edge/r_units.cc index 04e6bb83d..df76aed3e 100644 --- a/source_files/edge/r_units.cc +++ b/source_files/edge/r_units.cc @@ -215,17 +215,6 @@ struct Compare_Unit_pred } }; -static inline void RendererSendRawVector(const RendererVertex *V) -{ - global_render_state->GLColor(V->rgba); - - global_render_state->MultiTexCoord(GL_TEXTURE0, &V->texture_coordinates[0]); - global_render_state->MultiTexCoord(GL_TEXTURE1, &V->texture_coordinates[1]); - - // vertex must be last - glVertex3fv((const GLfloat *)(&V->position)); -} - // // RenderCurrentUnits // @@ -455,9 +444,15 @@ void RenderCurrentUnits(void) glBegin(unit->shape); - for (int v_idx = 0; v_idx < unit->count; v_idx++) + const RendererVertex *V = local_verts + unit->first; + + for (int v_idx = 0, v_last_idx = unit->count; v_idx < v_last_idx; v_idx++, V++) { - RendererSendRawVector(local_verts + unit->first + v_idx); + global_render_state->GLColor(V->rgba); + global_render_state->MultiTexCoord(GL_TEXTURE0, &V->texture_coordinates[0]); + global_render_state->MultiTexCoord(GL_TEXTURE1, &V->texture_coordinates[1]); + // vertex must be last + glVertex3fv((const GLfloat *)(&V->position)); } glEnd();