Make the binary symbols more compatible

This commit is contained in:
Luke Benstead 2019-03-08 21:36:23 +00:00
parent dc6b067e58
commit ac3ffb9ce0

View File

@ -152,6 +152,15 @@ static inline void markDead(ClipVertex* vert) {
vert->flags = VERTEX_CMD_EOL; vert->flags = VERTEX_CMD_EOL;
} }
#define B000 0
#define B111 7
#define B100 4
#define B010 2
#define B001 1
#define B101 5
#define B011 3
#define B110 6
void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset, uint8_t fladeShade) { void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset, uint8_t fladeShade) {
/* Room for clipping 16 triangles */ /* Room for clipping 16 triangles */
typedef struct { typedef struct {
@ -195,11 +204,11 @@ void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset, uint8_t fladeS
uint8_t visible = ((v1->w > 0) ? 4 : 0) | ((v2->w > 0) ? 2 : 0) | ((v3->w > 0) ? 1 : 0); uint8_t visible = ((v1->w > 0) ? 4 : 0) | ((v2->w > 0) ? 2 : 0) | ((v3->w > 0) ? 1 : 0);
switch(visible) { switch(visible) {
case 0b111: case B111:
/* All visible? Do nothing */ /* All visible? Do nothing */
continue; continue;
break; break;
case 0b000: case B000:
/* /*
It is not possible that this is any trangle except the first It is not possible that this is any trangle except the first
in a strip. That's because: in a strip. That's because:
@ -234,12 +243,12 @@ void clipTriangleStrip2(AlignedVector* vertices, uint32_t offset, uint8_t fladeS
v3->flags = VERTEX_CMD; v3->flags = VERTEX_CMD;
} }
break; break;
case 0b100: case B100:
case 0b010: case B010:
case 0b001: case B001:
case 0b101: case B101:
case 0b011: case B011:
case 0b110: case B110:
/* Store the triangle for clipping */ /* Store the triangle for clipping */
TO_CLIP[CLIP_COUNT].vertex[0] = *v1; TO_CLIP[CLIP_COUNT].vertex[0] = *v1;
TO_CLIP[CLIP_COUNT].vertex[1] = *v2; TO_CLIP[CLIP_COUNT].vertex[1] = *v2;