diff --git a/src/CRE/camera.cpp b/src/CRE/camera.cpp index 7fb0648a..ac6a4bfa 100644 --- a/src/CRE/camera.cpp +++ b/src/CRE/camera.cpp @@ -14,6 +14,7 @@ static void camera_calculate_forward(camera* c); camera::camera() : forward(), rotation(), view_point(), interest(), depth(), aet_depth(), use_up(), field_1E4(), field_1F0(), field_1FC(), field_208(), yaw(), pitch(), roll(), aspect(), fov(), aet_fov(), max_distance(), min_distance(), +proj_left_offset(), proj_right_offset(), proj_bottom_offset(), proj_top_offset(), fast_change(), fast_change_hist0(), fast_change_hist1(), ignore_fov(), ignore_min_dist() { } @@ -317,8 +318,8 @@ static void camera_calculate_projection(camera* c) { extern render_context* rctx_ptr; rctx_ptr->render.calc_projection_matrix(&c->projection, c->fov, (float_t)c->aspect, c->min_distance, c->max_distance, - c->projection_scale.x, c->projection_scale.y, - c->projection_scale.z, c->projection_scale.w); + c->proj_left_offset, c->proj_right_offset, + c->proj_left_offset, c->proj_right_offset); mat4_invert(&c->projection, &c->inv_projection); float_t height = (float_t)res_wind_int->height * 0.5f; diff --git a/src/CRE/camera.hpp b/src/CRE/camera.hpp index 34583eeb..d80409e1 100644 --- a/src/CRE/camera.hpp +++ b/src/CRE/camera.hpp @@ -18,7 +18,10 @@ struct camera { double_t aspect; float_t min_distance; float_t max_distance; - vec4 projection_scale; + float_t proj_left_offset; + float_t proj_right_offset; + float_t proj_bottom_offset; + float_t proj_top_offset; bool use_up; vec3 up; bool ignore_fov; diff --git a/src/CRE/render.cpp b/src/CRE/render.cpp index 02885156..968ceac3 100644 --- a/src/CRE/render.cpp +++ b/src/CRE/render.cpp @@ -370,12 +370,12 @@ namespace rndr { } void Render::calc_projection_matrix(mat4* mat, float_t fov, float_t aspect, float_t z_near, float_t z_far, - float_t left_scale, float_t right_scale, float_t bottom_scale, float_t top_scale) { + float_t left_offset, float_t right_offset, float_t bottom_offset, float_t top_offset) { float_t tan_fov = (float_t)tan(fov * M_PI * (1.0 / 360.0)) * z_near; - float_t left = -tan_fov * aspect + tan_fov * aspect * left_scale; - float_t right = tan_fov * aspect + tan_fov * aspect * right_scale; - float_t bottom = -tan_fov + tan_fov * bottom_scale; - float_t top = tan_fov + tan_fov * top_scale; + float_t left = -tan_fov * aspect + tan_fov * aspect * left_offset; + float_t right = tan_fov * aspect + tan_fov * aspect * right_offset; + float_t bottom = -tan_fov + tan_fov * bottom_offset; + float_t top = tan_fov + tan_fov * top_offset; if (taa) { float_t offset = taa_texture_selector == 1 ? -0.25f : 0.25f; @@ -1527,8 +1527,8 @@ namespace rndr { } void Render::apply_mlaa(int32_t destination, int32_t source, int32_t ss_alpha_mask) { + gl_state_begin_event("PostProcess::mlaa"); if (mlaa) { - gl_state_begin_event("PostProcess::mlaa"); mlaa_buffer.Bind(); gl_state_active_bind_texture_2d(0, taa_tex[source]->glid); gl_state_bind_sampler(0, rctx_ptr->render_samplers[1]); @@ -1564,7 +1564,6 @@ namespace rndr { uniform_value[U_ALPHA_MASK] = 0; gl_state_active_bind_texture_2d(0, 0); gl_state_active_bind_texture_2d(1, 0); - gl_state_end_event(); } else { taa_buffer[destination].Bind(); @@ -1576,6 +1575,7 @@ namespace rndr { render_post_width_scale, render_post_height_scale, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f); } + gl_state_end_event(); } void Render::apply_tone_map(texture* light_proj_tex, int32_t npr_param) { diff --git a/src/CRE/render.hpp b/src/CRE/render.hpp index ec6a1cd2..b7081500 100644 --- a/src/CRE/render.hpp +++ b/src/CRE/render.hpp @@ -183,7 +183,7 @@ namespace rndr { void bind_render_texture(bool aet_back = false); void calc_exposure_chara_data(camera* cam); void calc_projection_matrix(mat4* mat, float_t fov, float_t aspect, float_t z_near, float_t z_far, - float_t left_scale, float_t right_scale, float_t bottom_scale, float_t top_scale); + float_t left_offset, float_t right_offset, float_t bottom_offset, float_t top_offset); void ctrl(camera* cam); void draw_quad(int32_t width, int32_t height, float_t s0, float_t t0, float_t s1, float_t t1, float_t scale, float_t param_x, float_t param_y, float_t param_z, float_t param_w); diff --git a/src/KKdLib/database/auth_3d.cpp b/src/KKdLib/database/auth_3d.cpp index 82da02ca..0517bd4d 100644 --- a/src/KKdLib/database/auth_3d.cpp +++ b/src/KKdLib/database/auth_3d.cpp @@ -440,11 +440,9 @@ static void auth_3d_database_file_write_text(auth_3d_database_file* auth_3d_db_f kv.close_scope(); } - if (!uid_max) - uid_max = count; - kv.write(s, "length", count); - kv.write(s, "max", uid_max); + if (uid_max != -1) + kv.write(s, "max", uid_max); kv.close_scope(); } diff --git a/src/ReDIVA/data_test/motion_test.cpp b/src/ReDIVA/data_test/motion_test.cpp index 74e08d9b..b2d49078 100644 --- a/src/ReDIVA/data_test/motion_test.cpp +++ b/src/ReDIVA/data_test/motion_test.cpp @@ -2022,7 +2022,7 @@ void DataTestMotDw::FrameSliderProc::Callback(dw::SelectionListener::CallbackDat dw::Slider* slider = dynamic_cast(data->widget); if (slider) { float_t frame = slider->GetValue(); - data_test_mot_dw_array_get(slider->scroll_bar->callback_data.i32)->dtm_mot->SetFrame(frame); + data_test_mot_dw_array_get(slider->callback_data.i32)->dtm_mot->SetFrame(frame); if (test_mot_data->sync_frame) { dtm_mot_array[0].SetFrame(frame); dtm_mot_array[1].SetFrame(frame);