stage1: fix deprecations

This commit is contained in:
Andrei Alexeyev 2021-02-22 15:26:48 +02:00
parent 9db1160670
commit 4aa5d66c8a
No known key found for this signature in database
GPG key ID: 72D26128040B9690
2 changed files with 12 additions and 12 deletions

View file

@ -35,10 +35,10 @@ TASK(animate_bg, { Stage1DrawData *draw_data; }) {
for(int t = 0;; t += WAIT(1)) {
stage3d_update(&stage_3d_context);
stage_3d_context.crot[1] = 2.0f * sinf(t/113.0f);
stage_3d_context.crot[2] = 1.0f * sinf(t/132.0f);
stage_3d_context.cam.rot.v[1] = 2.0f * sinf(t/113.0f);
stage_3d_context.cam.rot.v[2] = 1.0f * sinf(t/132.0f);
fapproach_asymptotic_p(&stage_3d_context.crot[0], draw_data->pitch_target, 0.01, 1e-5);
fapproach_asymptotic_p(&stage_3d_context.cam.rot.v[0], draw_data->pitch_target, 0.01, 1e-5);
fapproach_asymptotic_p(&draw_data->fog.near, draw_data->fog.near_target, 0.001, 1e-5);
fapproach_asymptotic_p(&draw_data->fog.far, draw_data->fog.far_target, 0.001, 1e-5);
fapproach_p(&draw_data->snow.opacity, draw_data->snow.opacity_target, 1.0 / 180.0);
@ -57,9 +57,9 @@ void stage1_bg_init_fullstage(void) {
draw_data->fog.far = 1.0;
draw_data->snow.opacity = draw_data->snow.opacity_target;
stage_3d_context.crot[0] = draw_data->pitch_target;
stage_3d_context.cx[2] = 700;
stage_3d_context.cv[1] = 8;
stage_3d_context.cam.rot.v[0] = draw_data->pitch_target;
stage_3d_context.cam.pos[2] = 700;
stage_3d_context.cam.vel[1] = 8;
stage_3d_context.cam.aspect = STAGE3D_DEFAULT_ASPECT; // FIXME
stage_3d_context.cam.near = 500;
@ -81,5 +81,5 @@ void stage1_bg_init_spellpractice(void) {
draw_data->fog.near = draw_data->fog.near_target;
draw_data->fog.far = draw_data->fog.far_target;
draw_data->snow.opacity = draw_data->snow.opacity_target;
stage_3d_context.crot[0] = draw_data->pitch_target;
stage_3d_context.cam.rot.v[0] = draw_data->pitch_target;
}

View file

@ -86,7 +86,7 @@ static void stage1_water_draw(vec3 pos) {
r_state_push();
r_mat_mv_push();
r_mat_mv_translate(0, stage_3d_context.cx[1] + 500, 0);
r_mat_mv_translate(0, stage_3d_context.cam.pos[1] + 500, 0);
r_mat_mv_rotate(M_PI, 1, 0, 0);
static const Color water_color = { 0, 0.08, 0.08, 1 };
@ -125,7 +125,7 @@ static void stage1_water_draw(vec3 pos) {
set_ortho(VIEWPORT_W, VIEWPORT_H);
r_mat_mv_push_identity();
float hack = (stage_3d_context.crot[0] - 60) / 15.0;
float hack = (stage_3d_context.cam.rot.v[0] - 60) / 15.0;
float z = glm_lerp(0.75, 0.8, hack);
float zo = glm_lerp(-0.05, -0.3, hack);
@ -147,7 +147,7 @@ static void stage1_water_draw(vec3 pos) {
ShaderProgram *water_shader = res_shader("stage1_water");
r_uniform_float(r_shader_uniform(water_shader, "time"), 0.5 * global.frames / (float)FPS);
r_uniform_vec4_rgba(r_shader_uniform(water_shader, "water_color"), &water_color);
r_uniform_vec2(r_shader_uniform(water_shader, "wave_offset"), 0, stage_3d_context.cx[1] / 2400.0);
r_uniform_vec2(r_shader_uniform(water_shader, "wave_offset"), 0, stage_3d_context.cam.pos[1] / 2400.0);
if(pp_quality > 1) {
r_shader("blur5");
@ -200,7 +200,7 @@ static uint stage1_water_pos(Stage3D *s3d, vec3 p, float maxrange) {
}
static void stage1_smoke_draw(vec3 pos) {
float d = fabsf(pos[1] - stage_3d_context.cx[1]);
float d = fabsf(pos[1] - stage_3d_context.cam.pos[1]);
float o = ((d-500)*(d-500))/1.5e7;
o *= 5 * pow((5000 - d) / 5000, 3);
@ -308,7 +308,7 @@ static void stage1_snow_draw(vec3 pos) {
return;
}
float d = fabsf(pos[1] - stage_3d_context.cx[1]);
float d = fabsf(pos[1] - stage_3d_context.cam.pos[1]);
if(fabsf(d) < 500) {
return;