Compare commits

..

No commits in common. "fad11041bc26e3fc5c0dd463058333a4ebca80c9" and "f625dde8d11b187525876057b10b83879e097816" have entirely different histories.

5 changed files with 7 additions and 44 deletions

View File

@ -24,7 +24,7 @@ static void process_fly_mode(State *state) {
SceneIngame *scn = (SceneIngame *)state->scene;
DrawCameraFromPrincipalAxesResult dir_and_up =
draw_camera_from_principal_axes(scn->pos, scn->roll, scn->pitch, scn->yaw, (float)M_PI_2 * 0.8f, 1);
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2 * 0.8f, scn->roll, scn->pitch, scn->yaw);
const Vec3 right = m_vec_norm(m_vec_cross(dir_and_up.direction, dir_and_up.up));
const float speed = 0.04f; /* TODO: put this in a better place */
@ -81,7 +81,7 @@ static void process_ground_mode(State *state) {
SceneIngame *scn = (SceneIngame *)state->scene;
DrawCameraFromPrincipalAxesResult dir_and_up =
draw_camera_from_principal_axes(scn->pos, scn->roll, scn->pitch, scn->yaw, (float)M_PI_2 * 0.8f, 1);
draw_camera_from_principal_axes(scn->pos, (float)M_PI_2 * 0.8f, scn->roll, scn->pitch, scn->yaw);
dir_and_up.direction.y = 0;
dir_and_up.direction = vec3_norm(dir_and_up.direction);

View File

@ -81,10 +81,10 @@ void finally_draw_billboard_batch(struct MeshBatch const *batch,
const float xr = srcrect.x / dims.w;
const float yr = srcrect.y / dims.h;
const Vec2 uv0 = { xr, yr };
const Vec2 uv1 = { xr, yr + hr };
const Vec2 uv2 = { xr + wr, yr + hr };
const Vec2 uv3 = { xr + wr, yr };
const Vec2 uv0 = { xr + wr, yr };
const Vec2 uv1 = { xr + wr, yr + hr };
const Vec2 uv2 = { xr, yr + hr };
const Vec2 uv3 = { xr, yr };
for (size_t batch_n = 0; batch_n <= (primitives_len - 1) / QUAD_ELEMENT_BUFFER_LENGTH; batch_n++) {

View File

@ -500,7 +500,7 @@ void clear_draw_buffer(void) {
.clear_color = true,
.clear_depth = true,
.clear_stencil = true,
.color = ctx.background_color,
.color = (Color) { 230, 230, 230, 1 }
}
};

View File

@ -73,8 +73,6 @@ typedef struct EngineContext {
SDL_Window *window;
uint32_t window_id;
Color background_color;
bool is_running;
bool window_size_has_changed;
bool resync_flag;

View File

@ -510,41 +510,6 @@ static bool initialize(void) {
ctx.window_dims.x = (float)ctx.base_render_width;
ctx.window_dims.y = (float)ctx.base_render_height;
ctx.background_color = (Color){ 230, 230, 230, 255 };
toml_array_t *datum_background_color = toml_array_in(game, "background_color");
if (datum_background_color) do {
toml_datum_t datum_background_color_red = toml_int_at(datum_background_color, 0);
if (!datum_background_color_red.ok || datum_background_color_red.u.i < 0 || datum_background_color_red.u.i >= 256) {
log_warn("Invalid value for red channel of game.background_color");
break;
}
toml_datum_t datum_background_color_green = toml_int_at(datum_background_color, 1);
if (!datum_background_color_green.ok || datum_background_color_green.u.i < 0 || datum_background_color_green.u.i >= 256) {
log_warn("Invalid value for green channel of game.background_color");
break;
}
toml_datum_t datum_background_color_blue = toml_int_at(datum_background_color, 2);
if (!datum_background_color_blue.ok || datum_background_color_blue.u.i < 0 || datum_background_color_blue.u.i >= 256) {
log_warn("Invalid value for blue channel of game.background_color");
break;
}
toml_datum_t datum_background_color_alpha = toml_int_at(datum_background_color, 3);
if (!datum_background_color_alpha.ok || datum_background_color_alpha.u.i < 0 || datum_background_color_alpha.u.i >= 256) {
log_warn("Invalid value for alpha channel of game.background_color");
break;
}
ctx.background_color = (Color){
(uint8_t)datum_background_color_red.u.i,
(uint8_t)datum_background_color_green.u.i,
(uint8_t)datum_background_color_blue.u.i,
(uint8_t)datum_background_color_alpha.u.i,
};
} while (0);
ctx.game.resolution.x = (float)ctx.base_render_width;
ctx.game.resolution.y = (float)ctx.base_render_height;
/* add a watcher for immediate updates on window size */
SDL_AddEventWatch(event_callback, NULL);