From 6d80172d49bdef13ecd67c76d352849d70b77adf Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 9 Sep 2016 02:35:09 +0200 Subject: [PATCH] Add glColor3ui() --- data/GServer.interface | 5 +++++ include/GServer/video.h | 10 ++++++++++ src/gserver.c | 43 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/data/GServer.interface b/data/GServer.interface index 093d81f..e9790dd 100644 --- a/data/GServer.interface +++ b/data/GServer.interface @@ -26,6 +26,11 @@ arg1=INT32 arg2=INT32 arg3=INT32 +[call::glColor3ui] +arg1=UINT32 +arg2=UINT32 +arg3=UINT32 + [call::glColorMaterial] arg1=UINT32 arg2=UINT32 diff --git a/include/GServer/video.h b/include/GServer/video.h index 326e202..449629b 100644 --- a/include/GServer/video.h +++ b/include/GServer/video.h @@ -35,6 +35,7 @@ typedef enum _GServerVideoProto GSERVER_VIDEO_PROTO_2u, GSERVER_VIDEO_PROTO_3f, GSERVER_VIDEO_PROTO_3i, + GSERVER_VIDEO_PROTO_3u, GSERVER_VIDEO_PROTO_4f } GServerVideoProto; @@ -100,6 +101,13 @@ typedef enum _GServerVideoProto3i # define GSERVER_VIDEO_PROTO3i_LAST GSERVER_VIDEO_PROTO3i_glVertex3i # define GSERVER_VIDEO_PROTO3i_COUNT (GSERVER_VIDEO_PROTO3i_LAST + 1) +typedef enum _GServerVideoProto3u +{ + GSERVER_VIDEO_PROTO3i_glColor3ui = 0 +} GServerVideoProto3u; +# define GSERVER_VIDEO_PROTO3u_LAST GSERVER_VIDEO_PROTO3ui_glColor3ui +# define GSERVER_VIDEO_PROTO3u_COUNT (GSERVER_VIDEO_PROTO3ui_LAST + 1) + typedef enum _GServerVideoProto4f { GSERVER_VIDEO_PROTO4f_glClearColor = 0, @@ -140,6 +148,8 @@ struct _GServerVideoPlugin float x, float y, float z); void (*proto3i)(GServerVideoPlugin * plugin, GServerVideoProto3i func, int32_t x, int32_t y, int32_t z); + void (*proto3u)(GServerVideoPlugin * plugin, GServerVideoProto3u func, + uint32_t x, uint32_t y, uint32_t z); void (*proto4f)(GServerVideoPlugin * plugin, GServerVideoProto4f func, float x, float y, float z, float t); void * priv; diff --git a/src/gserver.c b/src/gserver.c index 39ef661..785f7d4 100644 --- a/src/gserver.c +++ b/src/gserver.c @@ -36,9 +36,11 @@ #ifdef DEBUG # define DEBUG_INTERFACE() fprintf(stderr, "DEBUG: %s()\n", __func__) # define DEBUG_INTERFACE1i(x) fprintf(stderr, "DEBUG: %s(0x%x)\n", __func__, x) -# define DEBUG_INTERFACE2i(x) fprintf(stderr, "DEBUG: %s(0x%x)\n", __func__, x, y) +# define DEBUG_INTERFACE2i(x) fprintf(stderr, "DEBUG: %s(0x%x, 0x%x)\n", __func__, x, y) +# define DEBUG_INTERFACE3i(x) fprintf(stderr, "DEBUG: %s(0x%x, 0x%x, 0x%x)\n", __func__, x, y, z) # define DEBUG_INTERFACE1u(x) DEBUG_INTERFACE1i(x) # define DEBUG_INTERFACE2u(x) DEBUG_INTERFACE2i(x) +# define DEBUG_INTERFACE3u(x) DEBUG_INTERFACE3i(x) # define DEBUG_INTERFACE3f(x, y, z) fprintf(stderr, \ "DEBUG: %s(%.1f, %.1f, %.1f)\n", __func__, *x, *y, *z) # define DEBUG_INTERFACE3i(x, y, z) fprintf(stderr, \ @@ -52,6 +54,7 @@ # define DEBUG_INTERFACE2u(x, y) # define DEBUG_INTERFACE3f(x, y, z) # define DEBUG_INTERFACE3i(x, y, z) +# define DEBUG_INTERFACE3u(x, y, z) # define DEBUG_INTERFACE4f(x, y, z, t) #endif @@ -118,6 +121,12 @@ struct _GServerCall int32_t z; } _3i; struct + { + uint32_t x; + uint32_t y; + uint32_t z; + } _3u; + struct { float x; float y; @@ -160,6 +169,8 @@ static int _gserver_queue3f(GServer * gserver, AppServerClient * asc, GServerVideoProto3f func, float x, float y, float z); static int _gserver_queue3i(GServer * gserver, AppServerClient * asc, GServerVideoProto3i func, int32_t x, int32_t y, int32_t z); +static int _gserver_queue3u(GServer * gserver, AppServerClient * asc, + GServerVideoProto3u func, uint32_t x, uint32_t y, uint32_t z); static int _gserver_queue4f(GServer * gserver, AppServerClient * asc, GServerVideoProto4f func, float x, float y, float z, float t); @@ -361,6 +372,12 @@ void gserver_refresh(GServer * gserver) DEBUG_INTERFACE3i(x, y, z); \ _gserver_queue3i(gserver, asc, GSERVER_VIDEO_PROTO3i_ ## func, x, y, z); \ } +#define GSERVER_PROTO3u(type, func, type1, type2, type3) \ + type GServer_ ## func (GServer * gserver, AppServerClient * asc, uint32_t x, uint32_t y, uint32_t z) \ +{ \ + DEBUG_INTERFACE3u(x, y, z); \ + _gserver_queue3u(gserver, asc, GSERVER_VIDEO_PROTO3i_ ## func, x, y, z); \ +} #define GSERVER_PROTO4f(type, func) \ type GServer_ ## func (GServer * gserver, AppServerClient * asc, float x, float y, float z, float t) \ { \ @@ -403,6 +420,9 @@ GSERVER_PROTO3f(void, glVertex3f) GSERVER_PROTO3i(void, glColor3i, int32_t, int32_t, int32_t) GSERVER_PROTO3i(void, glVertex3i, int32_t, int32_t, int32_t) +/* proto3u */ +GSERVER_PROTO3u(void, glColor3ui, uint32_t, uint32_t, uint32_t) + /* proto4f */ GSERVER_PROTO4f(void, glClearColor) GSERVER_PROTO4f(void, glRotatef) @@ -448,6 +468,11 @@ static void _gserver_client_calls(GServer * gserver, GServerClient * client) call->args._3i.y, call->args._3i.z); break; + case GSERVER_VIDEO_PROTO_3u: + vp->proto3u(vp, call->func, call->args._3u.x, + call->args._3u.y, + call->args._3u.z); + break; case GSERVER_VIDEO_PROTO_4f: vp->proto4f(vp, call->func, call->args._4f.x, call->args._4f.y, @@ -611,6 +636,22 @@ static int _gserver_queue3i(GServer * gserver, AppServerClient * asc, } +/* gserver_queue3u */ +static int _gserver_queue3u(GServer * gserver, AppServerClient * asc, + GServerVideoProto3u func, uint32_t x, uint32_t y, uint32_t z) +{ + GServerCall * gsc; + + if((gsc = _gserver_queue(gserver, asc, GSERVER_VIDEO_PROTO_3u, func)) + == NULL) + return -1; + gsc->args._3u.x = x; + gsc->args._3u.y = y; + gsc->args._3u.z = z; + return 0; +} + + /* gserver_queue4f */ static int _gserver_queue4f(GServer * gserver, AppServerClient * asc, GServerVideoProto4f func, float x, float y, float z, float t)