mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2024-12-26 09:59:04 +01:00
Remove unused color union fields
This commit is contained in:
parent
530fb40fb7
commit
69122122f0
7 changed files with 99 additions and 103 deletions
|
@ -143,10 +143,10 @@ void render_push_tris(tris_t tris, uint16_t texture_index) {
|
|||
vec2i_t sc2 = vec2i(p2.x * w2 + w2, h2 - p2.y * h2);
|
||||
|
||||
rgba_t color = tris.vertices[0].color;
|
||||
color.as_rgba.r = min(color.as_rgba.r * 2, 255);
|
||||
color.as_rgba.g = min(color.as_rgba.g * 2, 255);
|
||||
color.as_rgba.b = min(color.as_rgba.b * 2, 255);
|
||||
color.as_rgba.a = clamp(color.as_rgba.a * (1.0-p0.z) * FAR_PLANE * (2.0/255.0), 0, 255);
|
||||
color.r = min(color.r * 2, 255);
|
||||
color.g = min(color.g * 2, 255);
|
||||
color.b = min(color.b * 2, 255);
|
||||
color.a = clamp(color.a * (1.0-p0.z) * FAR_PLANE * (2.0/255.0), 0, 255);
|
||||
|
||||
line(sc0, sc1, color);
|
||||
line(sc1, sc2, color);
|
||||
|
@ -244,9 +244,9 @@ void render_textures_dump(const char *path) {}
|
|||
|
||||
static inline rgba_t color_mix(rgba_t in, rgba_t out) {
|
||||
return rgba(
|
||||
lerp(in.as_rgba.r, out.as_rgba.r, out.as_rgba.a/255.0),
|
||||
lerp(in.as_rgba.g, out.as_rgba.g, out.as_rgba.a/255.0),
|
||||
lerp(in.as_rgba.b, out.as_rgba.b, out.as_rgba.a/255.0),
|
||||
lerp(in.r, out.r, out.a/255.0),
|
||||
lerp(in.g, out.g, out.a/255.0),
|
||||
lerp(in.b, out.b, out.a/255.0),
|
||||
1
|
||||
);
|
||||
}
|
||||
|
|
10
src/types.h
10
src/types.h
|
@ -7,12 +7,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef union rgba_t {
|
||||
struct {
|
||||
uint8_t r, g, b, a;
|
||||
} as_rgba;
|
||||
uint8_t as_components[4];
|
||||
uint32_t as_uint32;
|
||||
typedef struct rgba_t {
|
||||
uint8_t r, g, b, a;
|
||||
} rgba_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -45,7 +41,7 @@ typedef struct {
|
|||
} tris_t;
|
||||
|
||||
|
||||
#define rgba(R, G, B, A) ((rgba_t){.as_rgba = {.r = R, .g = G, .b = B, .a = A}})
|
||||
#define rgba(R, G, B, A) ((rgba_t){.r = R, .g = G, .b = B, .a = A})
|
||||
#define vec2(X, Y) ((vec2_t){.x = X, .y = Y})
|
||||
#define vec3(X, Y, Z) ((vec3_t){.x = X, .y = Y, .z = Z})
|
||||
#define vec2i(X, Y) ((vec2i_t){.x = X, .y = Y})
|
||||
|
|
|
@ -73,36 +73,36 @@ void droid_draw(droid_t *droid) {
|
|||
|
||||
switch (prm.f3->type) {
|
||||
case PRM_TYPE_GT3:
|
||||
prm.gt3->colour[0].as_rgba.r = r;
|
||||
prm.gt3->colour[0].as_rgba.g = g;
|
||||
prm.gt3->colour[0].as_rgba.b = b;
|
||||
prm.gt3->colour[0].r = r;
|
||||
prm.gt3->colour[0].g = g;
|
||||
prm.gt3->colour[0].b = b;
|
||||
|
||||
prm.gt3->colour[1].as_rgba.r = r;
|
||||
prm.gt3->colour[1].as_rgba.g = g;
|
||||
prm.gt3->colour[1].as_rgba.b = b;
|
||||
prm.gt3->colour[1].r = r;
|
||||
prm.gt3->colour[1].g = g;
|
||||
prm.gt3->colour[1].b = b;
|
||||
|
||||
prm.gt3->colour[2].as_rgba.r = r;
|
||||
prm.gt3->colour[2].as_rgba.g = g;
|
||||
prm.gt3->colour[2].as_rgba.b = b;
|
||||
prm.gt3->colour[2].r = r;
|
||||
prm.gt3->colour[2].g = g;
|
||||
prm.gt3->colour[2].b = b;
|
||||
prm.gt3++;
|
||||
break;
|
||||
|
||||
case PRM_TYPE_GT4:
|
||||
prm.gt4->colour[0].as_rgba.r = r;
|
||||
prm.gt4->colour[0].as_rgba.g = g;
|
||||
prm.gt4->colour[0].as_rgba.b = b;
|
||||
prm.gt4->colour[0].r = r;
|
||||
prm.gt4->colour[0].g = g;
|
||||
prm.gt4->colour[0].b = b;
|
||||
|
||||
prm.gt4->colour[1].as_rgba.r = r;
|
||||
prm.gt4->colour[1].as_rgba.g = g;
|
||||
prm.gt4->colour[1].as_rgba.b = b;
|
||||
prm.gt4->colour[1].r = r;
|
||||
prm.gt4->colour[1].g = g;
|
||||
prm.gt4->colour[1].b = b;
|
||||
|
||||
prm.gt4->colour[2].as_rgba.r = r;
|
||||
prm.gt4->colour[2].as_rgba.g = g;
|
||||
prm.gt4->colour[2].as_rgba.b = b;
|
||||
prm.gt4->colour[2].r = r;
|
||||
prm.gt4->colour[2].g = g;
|
||||
prm.gt4->colour[2].b = b;
|
||||
|
||||
prm.gt4->colour[3].as_rgba.r = 40;
|
||||
prm.gt4->colour[3].as_rgba.g = 40;
|
||||
prm.gt4->colour[3].as_rgba.b = 40;
|
||||
prm.gt4->colour[3].r = 40;
|
||||
prm.gt4->colour[3].g = 40;
|
||||
prm.gt4->colour[3].b = 40;
|
||||
prm.gt4++;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -58,17 +58,17 @@ void hud_load() {
|
|||
|
||||
static void hud_draw_speedo_bar(vec2i_t *pos, const speedo_bar_t *a, const speedo_bar_t *b, float f, rgba_t color_override) {
|
||||
rgba_t left_color, right_color;
|
||||
if (color_override.as_uint32 > 0) {
|
||||
if (color_override.a > 0) {
|
||||
left_color = color_override;
|
||||
right_color = color_override;
|
||||
}
|
||||
else {
|
||||
left_color = a->color;
|
||||
right_color = rgba(
|
||||
lerp(a->color.as_rgba.r, b->color.as_rgba.r, f),
|
||||
lerp(a->color.as_rgba.g, b->color.as_rgba.g, f),
|
||||
lerp(a->color.as_rgba.b, b->color.as_rgba.b, f),
|
||||
lerp(a->color.as_rgba.a, b->color.as_rgba.a, f)
|
||||
lerp(a->color.r, b->color.r, f),
|
||||
lerp(a->color.g, b->color.g, f),
|
||||
lerp(a->color.b, b->color.b, f),
|
||||
lerp(a->color.a, b->color.a, f)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -168,9 +168,9 @@ void scene_set_start_booms(int light_index) {
|
|||
|
||||
for (int j = 0; j < lights_len; j++) {
|
||||
for (int v = 0; v < 4; v++) {
|
||||
libPoly.gt4->colour[v].as_rgba.r = color.as_rgba.r;
|
||||
libPoly.gt4->colour[v].as_rgba.g = color.as_rgba.g;
|
||||
libPoly.gt4->colour[v].as_rgba.b = color.as_rgba.b;
|
||||
libPoly.gt4->colour[v].r = color.r;
|
||||
libPoly.gt4->colour[v].g = color.g;
|
||||
libPoly.gt4->colour[v].b = color.b;
|
||||
}
|
||||
libPoly.gt4 += 1;
|
||||
}
|
||||
|
@ -183,9 +183,9 @@ void scene_pulsate_red_light(Object *obj) {
|
|||
Prm libPoly = {.primitive = obj->primitives};
|
||||
|
||||
for (int v = 0; v < 4; v++) {
|
||||
libPoly.gt4->colour[v].as_rgba.r = r;
|
||||
libPoly.gt4->colour[v].as_rgba.g = 0x00;
|
||||
libPoly.gt4->colour[v].as_rgba.b = 0x00;
|
||||
libPoly.gt4->colour[v].r = r;
|
||||
libPoly.gt4->colour[v].g = 0x00;
|
||||
libPoly.gt4->colour[v].b = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,25 +237,25 @@ void scene_update_aurora_borealis() {
|
|||
int16_t *coords = aurora_borealis.coords[i];
|
||||
|
||||
if (aurora_borealis.grey_coords[i] != -2) {
|
||||
aurora_borealis.primitives[i]->colour[0].as_rgba.r = (sin(coords[0] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[0].as_rgba.g = (sin(coords[0] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[0].as_rgba.b = (sin(coords[0] * (phase + 0.039)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[0].r = (sin(coords[0] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[0].g = (sin(coords[0] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[0].b = (sin(coords[0] * (phase + 0.039)) * 64.0) + 190;
|
||||
}
|
||||
if (aurora_borealis.grey_coords[i] != -2) {
|
||||
aurora_borealis.primitives[i]->colour[1].as_rgba.r = (sin(coords[1] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[1].as_rgba.g = (sin(coords[1] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[1].as_rgba.b = (sin(coords[1] * (phase + 0.039)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[1].r = (sin(coords[1] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[1].g = (sin(coords[1] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[1].b = (sin(coords[1] * (phase + 0.039)) * 64.0) + 190;
|
||||
}
|
||||
if (aurora_borealis.grey_coords[i] != -1) {
|
||||
aurora_borealis.primitives[i]->colour[2].as_rgba.r = (sin(coords[2] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[2].as_rgba.g = (sin(coords[2] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[2].as_rgba.b = (sin(coords[2] * (phase + 0.039)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[2].r = (sin(coords[2] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[2].g = (sin(coords[2] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[2].b = (sin(coords[2] * (phase + 0.039)) * 64.0) + 190;
|
||||
}
|
||||
|
||||
if (aurora_borealis.grey_coords[i] != -1) {
|
||||
aurora_borealis.primitives[i]->colour[3].as_rgba.r = (sin(coords[3] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[3].as_rgba.g = (sin(coords[3] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[3].as_rgba.b = (sin(coords[3] * (phase + 0.039)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[3].r = (sin(coords[3] * phase) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[3].g = (sin(coords[3] * (phase + 0.054)) * 64.0) + 190;
|
||||
aurora_borealis.primitives[i]->colour[3].b = (sin(coords[3] * (phase + 0.039)) * 64.0) + 190;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,10 +291,10 @@ void ship_init_exhaust_plume(ship_t *self) {
|
|||
indices[indices_len++] = prm.ft3->coords[2];
|
||||
|
||||
flags_add(prm.ft3->flag, PRM_TRANSLUCENT);
|
||||
prm.ft3->colour.as_rgba.r = 180;
|
||||
prm.ft3->colour.as_rgba.g = 97 ;
|
||||
prm.ft3->colour.as_rgba.b = 120;
|
||||
prm.ft3->colour.as_rgba.a = 140;
|
||||
prm.ft3->colour.r = 180;
|
||||
prm.ft3->colour.g = 97 ;
|
||||
prm.ft3->colour.b = 120;
|
||||
prm.ft3->colour.a = 140;
|
||||
}
|
||||
prm.ft3 += 1;
|
||||
break;
|
||||
|
@ -328,10 +328,10 @@ void ship_init_exhaust_plume(ship_t *self) {
|
|||
|
||||
flags_add(prm.gt3->flag, PRM_TRANSLUCENT);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
prm.gt3->colour[j].as_rgba.r = 180;
|
||||
prm.gt3->colour[j].as_rgba.g = 97 ;
|
||||
prm.gt3->colour[j].as_rgba.b = 120;
|
||||
prm.gt3->colour[j].as_rgba.a = 140;
|
||||
prm.gt3->colour[j].r = 180;
|
||||
prm.gt3->colour[j].g = 97 ;
|
||||
prm.gt3->colour[j].b = 120;
|
||||
prm.gt3->colour[j].a = 140;
|
||||
}
|
||||
}
|
||||
prm.gt3 += 1;
|
||||
|
|
|
@ -353,15 +353,15 @@ void weapon_update_mine_lights(weapon_t *self, int index) {
|
|||
for (int i = 0; i < 8; i++) {
|
||||
switch (prm.primitive->type) {
|
||||
case PRM_TYPE_GT3:
|
||||
prm.gt3->colour[0].as_rgba.r = 230;
|
||||
prm.gt3->colour[1].as_rgba.r = r;
|
||||
prm.gt3->colour[2].as_rgba.r = r;
|
||||
prm.gt3->colour[0].as_rgba.g = 0;
|
||||
prm.gt3->colour[1].as_rgba.g = 0x40;
|
||||
prm.gt3->colour[2].as_rgba.g = 0x40;
|
||||
prm.gt3->colour[0].as_rgba.b = 0;
|
||||
prm.gt3->colour[1].as_rgba.b = 0;
|
||||
prm.gt3->colour[2].as_rgba.b = 0;
|
||||
prm.gt3->colour[0].r = 230;
|
||||
prm.gt3->colour[1].r = r;
|
||||
prm.gt3->colour[2].r = r;
|
||||
prm.gt3->colour[0].g = 0;
|
||||
prm.gt3->colour[1].g = 0x40;
|
||||
prm.gt3->colour[2].g = 0x40;
|
||||
prm.gt3->colour[0].b = 0;
|
||||
prm.gt3->colour[1].b = 0;
|
||||
prm.gt3->colour[2].b = 0;
|
||||
prm.gt3 += 1;
|
||||
break;
|
||||
}
|
||||
|
@ -585,20 +585,20 @@ void weapon_update_shield(weapon_t *self) {
|
|||
col1 = sin(color_timer * coords[1]) * 127 + 128;
|
||||
col2 = sin(color_timer * coords[2]) * 127 + 128;
|
||||
|
||||
poly.g3->colour[0].as_rgba.r = col0;
|
||||
poly.g3->colour[0].as_rgba.g = col0;
|
||||
poly.g3->colour[0].as_rgba.b = 255;
|
||||
poly.g3->colour[0].as_rgba.a = shield_alpha;
|
||||
poly.g3->colour[0].r = col0;
|
||||
poly.g3->colour[0].g = col0;
|
||||
poly.g3->colour[0].b = 255;
|
||||
poly.g3->colour[0].a = shield_alpha;
|
||||
|
||||
poly.g3->colour[1].as_rgba.r = col1;
|
||||
poly.g3->colour[1].as_rgba.g = col1;
|
||||
poly.g3->colour[1].as_rgba.b = 255;
|
||||
poly.g3->colour[1].as_rgba.a = shield_alpha;
|
||||
poly.g3->colour[1].r = col1;
|
||||
poly.g3->colour[1].g = col1;
|
||||
poly.g3->colour[1].b = 255;
|
||||
poly.g3->colour[1].a = shield_alpha;
|
||||
|
||||
poly.g3->colour[2].as_rgba.r = col2;
|
||||
poly.g3->colour[2].as_rgba.g = col2;
|
||||
poly.g3->colour[2].as_rgba.b = 255;
|
||||
poly.g3->colour[2].as_rgba.a = shield_alpha;
|
||||
poly.g3->colour[2].r = col2;
|
||||
poly.g3->colour[2].g = col2;
|
||||
poly.g3->colour[2].b = 255;
|
||||
poly.g3->colour[2].a = shield_alpha;
|
||||
poly.g3 += 1;
|
||||
break;
|
||||
|
||||
|
@ -610,25 +610,25 @@ void weapon_update_shield(weapon_t *self) {
|
|||
col2 = sin(color_timer * coords[2]) * 127 + 128;
|
||||
col3 = sin(color_timer * coords[3]) * 127 + 128;
|
||||
|
||||
poly.g4->colour[0].as_rgba.r = col0;
|
||||
poly.g4->colour[0].as_rgba.g = col0;
|
||||
poly.g4->colour[0].as_rgba.b = 255;
|
||||
poly.g4->colour[0].as_rgba.a = shield_alpha;
|
||||
poly.g4->colour[0].r = col0;
|
||||
poly.g4->colour[0].g = col0;
|
||||
poly.g4->colour[0].b = 255;
|
||||
poly.g4->colour[0].a = shield_alpha;
|
||||
|
||||
poly.g4->colour[1].as_rgba.r = col1;
|
||||
poly.g4->colour[1].as_rgba.g = col1;
|
||||
poly.g4->colour[1].as_rgba.b = 255;
|
||||
poly.g4->colour[1].as_rgba.a = shield_alpha;
|
||||
poly.g4->colour[1].r = col1;
|
||||
poly.g4->colour[1].g = col1;
|
||||
poly.g4->colour[1].b = 255;
|
||||
poly.g4->colour[1].a = shield_alpha;
|
||||
|
||||
poly.g4->colour[2].as_rgba.r = col2;
|
||||
poly.g4->colour[2].as_rgba.g = col2;
|
||||
poly.g4->colour[2].as_rgba.b = 255;
|
||||
poly.g4->colour[2].as_rgba.a = shield_alpha;
|
||||
poly.g4->colour[2].r = col2;
|
||||
poly.g4->colour[2].g = col2;
|
||||
poly.g4->colour[2].b = 255;
|
||||
poly.g4->colour[2].a = shield_alpha;
|
||||
|
||||
poly.g4->colour[3].as_rgba.r = col3;
|
||||
poly.g4->colour[3].as_rgba.g = col3;
|
||||
poly.g4->colour[3].as_rgba.b = 255;
|
||||
poly.g4->colour[3].as_rgba.a = shield_alpha;
|
||||
poly.g4->colour[3].r = col3;
|
||||
poly.g4->colour[3].g = col3;
|
||||
poly.g4->colour[3].b = 255;
|
||||
poly.g4->colour[3].a = shield_alpha;
|
||||
poly.g4 += 1;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue