Add glColor4b()

This commit is contained in:
Pierre Pronchery 2016-09-09 05:04:57 +02:00
parent 5dda52d4b7
commit c7b2a1a676
3 changed files with 65 additions and 64 deletions

View File

@ -50,6 +50,12 @@ arg1=UINT16
arg2=UINT16
arg3=UINT16
[call::glColor4b]
arg1=UINT8
arg2=UINT8
arg3=UINT8
arg4=UINT8
[call::glColor4d]
arg1=DOUBLE
arg2=DOUBLE

View File

@ -37,11 +37,11 @@ typedef enum _GServerVideoProto
GSERVER_VIDEO_PROTO_3f,
GSERVER_VIDEO_PROTO_3i,
GSERVER_VIDEO_PROTO_3s,
GSERVER_VIDEO_PROTO_4b,
GSERVER_VIDEO_PROTO_4d,
GSERVER_VIDEO_PROTO_4f,
GSERVER_VIDEO_PROTO_4i,
GSERVER_VIDEO_PROTO_4s,
GSERVER_VIDEO_PROTO_4ub
GSERVER_VIDEO_PROTO_4s
} GServerVideoProto;
typedef enum _GServerVideoProto0
@ -131,6 +131,14 @@ typedef enum _GServerVideoProto3s
# define GSERVER_VIDEO_PROTO3s_LAST GSERVER_VIDEO_PROTO3s_glColor3s
# define GSERVER_VIDEO_PROTO3s_COUNT (GSERVER_VIDEO_PROTO3s_LAST + 1)
typedef enum _GServerVideoProto4b
{
GSERVER_VIDEO_PROTO4b_glColor4b = 0,
GSERVER_VIDEO_PROTO4b_glColor4ub
} GServerVideoProto4b;
# define GSERVER_VIDEO_PROTO4b_LAST GSERVER_VIDEO_PROTO4b_glColor4ub
# define GSERVER_VIDEO_PROTO4b_COUNT (GSERVER_VIDEO_PROTO4b_LAST + 1)
typedef enum _GServerVideoProto4d
{
GSERVER_VIDEO_PROTO4d_glColor4d = 0
@ -163,13 +171,6 @@ typedef enum _GServerVideoProto4s
# define GSERVER_VIDEO_PROTO4s_LAST GSERVER_VIDEO_PROTO4s_glColor4us
# define GSERVER_VIDEO_PROTO4s_COUNT (GSERVER_VIDEO_PROTO4s_LAST + 1)
typedef enum _GServerVideoProto4ub
{
GSERVER_VIDEO_PROTO4ub_glColor4ub = 0
} GServerVideoProto4ub;
# define GSERVER_VIDEO_PROTO4ub_LAST GSERVER_VIDEO_PROTO4ub_glColor4ub
# define GSERVER_VIDEO_PROTO4ub_COUNT (GSERVER_VIDEO_PROTO4ub_LAST + 1)
/* GServerVideoPlugin */
typedef struct _GServerVideoPlugin GServerVideoPlugin;
@ -206,6 +207,8 @@ struct _GServerVideoPlugin
uint32_t x, uint32_t y, uint32_t z);
void (*proto3s)(GServerVideoPlugin * plugin, GServerVideoProto3s func,
uint16_t x, uint16_t y, uint16_t z);
void (*proto4b)(GServerVideoPlugin * plugin, GServerVideoProto4b func,
uint8_t x, uint8_t y, uint8_t z, uint8_t t);
void (*proto4d)(GServerVideoPlugin * plugin, GServerVideoProto4d func,
double x, double y, double z, double t);
void (*proto4f)(GServerVideoPlugin * plugin, GServerVideoProto4f func,
@ -214,8 +217,6 @@ struct _GServerVideoPlugin
uint32_t x, uint32_t y, uint32_t z, uint32_t t);
void (*proto4s)(GServerVideoPlugin * plugin, GServerVideoProto4s func,
uint16_t x, uint16_t y, uint16_t z, uint16_t t);
void (*proto4ub)(GServerVideoPlugin * plugin, GServerVideoProto4ub func,
uint8_t x, uint8_t y, uint8_t z, uint8_t t);
void * priv;
};

View File

@ -47,6 +47,7 @@
# define DEBUG_INTERFACE3i(x, y, z) \
fprintf(stderr, "DEBUG: %s(0x%x, 0x%x, 0x%x)\n", __func__, x, y, z)
# define DEBUG_INTERFACE3s(x, y, z) DEBUG_INTERFACE3i(x, y, z)
# define DEBUG_INTERFACE4b(x, y, z, t) DEBUG_INTERFACE4i(x, y, z, t)
# define DEBUG_INTERFACE4d(x, y, z, t) \
fprintf(stderr, "DEBUG: %s(%.1f, %.1f, %.1f, %.1f)\n", \
__func__, x, y, z, t)
@ -55,24 +56,22 @@
fprintf(stderr, "DEBUG: %s(0x%x, 0x%x, 0x%x, 0x%x)\n", \
__func__, x, y, z, t)
# define DEBUG_INTERFACE4s(x, y, z, t) DEBUG_INTERFACE4i(x, y, z, t)
# define DEBUG_INTERFACE4ub(x, y, z, t) DEBUG_INTERFACE4i(x, y, z, t)
# define DEBUG_INTERFACE4us(x, y, z, t) DEBUG_INTERFACE4i(x, y, z, t)
#else
# define DEBUG_INTERFACE()
# define DEBUG_INTERFACE1i(x)
# define DEBUG_INTERFACE2d(x, y, z)
# define DEBUG_INTERFACE2f(x, y, z)
# define DEBUG_INTERFACE2i(x, y)
# define DEBUG_INTERFACE3b(x, y, z)
# define DEBUG_INTERFACE3d(x, y, z)
# define DEBUG_INTERFACE3f(x, y, z)
# define DEBUG_INTERFACE3i(x, y, z)
# define DEBUG_INTERFACE3s(x, y, z)
# define DEBUG_INTERFACE4b(x, y, z, t)
# define DEBUG_INTERFACE4d(x, y, z, t)
# define DEBUG_INTERFACE4f(x, y, z, t)
# define DEBUG_INTERFACE4i(x, y, z, t)
# define DEBUG_INTERFACE4s(x, y, z, t)
# define DEBUG_INTERFACE4ub(x, y, z, t)
# define DEBUG_INTERFACE4us(x, y, z, t)
#endif
@ -151,6 +150,13 @@ struct _GServerCall
uint16_t z;
} _3s;
struct
{
uint8_t x;
uint8_t y;
uint8_t z;
uint8_t t;
} _4b;
struct
{
double x;
double y;
@ -178,13 +184,6 @@ struct _GServerCall
uint16_t z;
uint16_t t;
} _4s;
struct
{
uint8_t x;
uint8_t y;
uint8_t z;
uint8_t t;
} _4ub;
} args;
};
@ -225,6 +224,9 @@ static int _gserver_queue3i(GServer * gserver, AppServerClient * asc,
GServerVideoProto3i func, uint32_t x, uint32_t y, uint32_t z);
static int _gserver_queue3s(GServer * gserver, AppServerClient * asc,
GServerVideoProto3s func, uint16_t x, uint16_t y, uint16_t z);
static int _gserver_queue4b(GServer * gserver, AppServerClient * asc,
GServerVideoProto4b func, uint8_t x, uint8_t y, uint8_t z,
uint8_t t);
static int _gserver_queue4d(GServer * gserver, AppServerClient * asc,
GServerVideoProto4d func, double x, double y, double z,
double t);
@ -236,9 +238,6 @@ static int _gserver_queue4i(GServer * gserver, AppServerClient * asc,
static int _gserver_queue4s(GServer * gserver, AppServerClient * asc,
GServerVideoProto4s func, uint16_t x, uint16_t y, uint16_t z,
uint16_t t);
static int _gserver_queue4ub(GServer * gserver, AppServerClient * asc,
GServerVideoProto4ub func, uint8_t x, uint8_t y, uint8_t z,
uint8_t t);
/* public */
@ -450,6 +449,12 @@ void gserver_refresh(GServer * gserver)
DEBUG_INTERFACE3s(x, y, z); \
_gserver_queue3s(gserver, asc, GSERVER_VIDEO_PROTO3s_ ## func, (uint16_t)x, (uint16_t)y, (uint16_t)z); \
}
#define GSERVER_PROTO4b(type, func, type1, type2, type3, type4) \
type GServer_ ## func (GServer * gserver, AppServerClient * asc, type1 x, type2 y, type3 z, type4 t) \
{ \
DEBUG_INTERFACE4b(x, y, z, t); \
_gserver_queue4b(gserver, asc, GSERVER_VIDEO_PROTO4b_ ## func, (uint8_t)x, (uint8_t)y, (uint8_t)z, (uint8_t)t); \
}
#define GSERVER_PROTO4d(type, func) \
type GServer_ ## func (GServer * gserver, AppServerClient * asc, double x, double y, double z, double t) \
{ \
@ -474,18 +479,6 @@ void gserver_refresh(GServer * gserver)
DEBUG_INTERFACE4s(x, y, z, t); \
_gserver_queue4s(gserver, asc, GSERVER_VIDEO_PROTO4s_ ## func, (uint16_t)x, (uint16_t)y, (uint16_t)z, (uint16_t)t); \
}
#define GSERVER_PROTO4ub(type, func, type1, type2, type3, type4) \
type GServer_ ## func (GServer * gserver, AppServerClient * asc, type1 x, type2 y, type3 z, type4 t) \
{ \
DEBUG_INTERFACE4ub(x, y, z, t); \
_gserver_queue4ub(gserver, asc, GSERVER_VIDEO_PROTO4ub_ ## func, x, y, z, t); \
}
#define GSERVER_PROTO4us(type, func, type1, type2, type3, type4) \
type GServer_ ## func (GServer * gserver, AppServerClient * asc, type1 x, type2 y, type3 z, type4 t) \
{ \
DEBUG_INTERFACE4us(x, y, z, t); \
_gserver_queue4us(gserver, asc, GSERVER_VIDEO_PROTO4us_ ## func, x, y, z, t); \
}
/* proto0 */
GSERVER_PROTO0(void, glEnd)
@ -539,6 +532,10 @@ GSERVER_PROTO3i(void, glVertex3i, int32_t, int32_t, int32_t)
/* proto3s */
GSERVER_PROTO3s(void, glColor3s, int16_t, int16_t, int16_t)
/* proto4b */
GSERVER_PROTO4b(void, glColor4b, int8_t, int8_t, int8_t, int8_t)
GSERVER_PROTO4b(void, glColor4ub, uint8_t, uint8_t, uint8_t, uint8_t)
/* proto4d */
GSERVER_PROTO4d(void, glColor4d)
@ -555,9 +552,6 @@ GSERVER_PROTO4i(void, glColor4ui, uint32_t, uint32_t, uint32_t, uint32_t)
GSERVER_PROTO4s(void, glColor4s, int16_t, int16_t, int16_t, int16_t)
GSERVER_PROTO4s(void, glColor4us, uint16_t, uint16_t, uint16_t, uint16_t)
/* proto4ub */
GSERVER_PROTO4ub(void, glColor4ub, uint8_t, uint8_t, uint8_t, uint8_t)
/* private */
/* functions */
@ -610,6 +604,12 @@ static void _gserver_client_calls(GServer * gserver, GServerClient * client)
call->args._3s.y,
call->args._3s.z);
break;
case GSERVER_VIDEO_PROTO_4b:
vp->proto4b(vp, call->func, call->args._4b.x,
call->args._4b.y,
call->args._4b.z,
call->args._4b.t);
break;
case GSERVER_VIDEO_PROTO_4d:
vp->proto4d(vp, call->func, call->args._4d.x,
call->args._4d.y,
@ -634,12 +634,6 @@ static void _gserver_client_calls(GServer * gserver, GServerClient * client)
call->args._4s.z,
call->args._4s.t);
break;
case GSERVER_VIDEO_PROTO_4ub:
vp->proto4ub(vp, call->func, call->args._4ub.x,
call->args._4ub.y,
call->args._4ub.z,
call->args._4ub.t);
break;
}
}
}
@ -830,6 +824,24 @@ static int _gserver_queue3s(GServer * gserver, AppServerClient * asc,
}
/* gserver_queue4b */
static int _gserver_queue4b(GServer * gserver, AppServerClient * asc,
GServerVideoProto4b func, uint8_t x, uint8_t y, uint8_t z,
uint8_t t)
{
GServerCall * gsc;
if((gsc = _gserver_queue(gserver, asc, GSERVER_VIDEO_PROTO_4b, func))
== NULL)
return -1;
gsc->args._4b.x = x;
gsc->args._4b.y = y;
gsc->args._4b.z = z;
gsc->args._4b.t = t;
return 0;
}
/* gserver_queue4d */
static int _gserver_queue4d(GServer * gserver, AppServerClient * asc,
GServerVideoProto4d func, double x, double y, double z,
@ -899,21 +911,3 @@ static int _gserver_queue4s(GServer * gserver, AppServerClient * asc,
gsc->args._4s.t = t;
return 0;
}
/* gserver_queue4ub */
static int _gserver_queue4ub(GServer * gserver, AppServerClient * asc,
GServerVideoProto4ub func, uint8_t x, uint8_t y, uint8_t z,
uint8_t t)
{
GServerCall * gsc;
if((gsc = _gserver_queue(gserver, asc, GSERVER_VIDEO_PROTO_4ub, func))
== NULL)
return -1;
gsc->args._4ub.x = x;
gsc->args._4ub.y = y;
gsc->args._4ub.z = z;
gsc->args._4ub.t = t;
return 0;
}