Sync codebase with DivaGL

This commit is contained in:
korenkonder
2024-04-02 23:57:30 +03:00
parent da226ae4f1
commit cd3eff7ec8
4 changed files with 26 additions and 14 deletions
+16 -3
View File
@@ -71,10 +71,10 @@ void draw_state::set_fog_height(bool value) {
}
sss_data::sss_data() : init_data(), enable(), npr_contour(), param() {
init_data = true;
init_data = false;
enable = true;
npr_contour = true;
param = { 0.0f, 0.0f, 0.0f, 1.0f };
param = 1.0f;
}
sss_data::~sss_data() {
@@ -82,14 +82,27 @@ sss_data::~sss_data() {
}
void sss_data::free() {
if (init_data)
for (RenderTexture& i : textures)
i.Free();
}
void sss_data::init() {
if (init_data)
return;
textures[0].Init(640, 360, 0, GL_RGBA16F, GL_ZERO /*GL_DEPTH_COMPONENT32F*/);
textures[1].Init(320, 180, 0, GL_RGBA16F, GL_ZERO);
textures[2].Init(320, 180, 0, GL_RGBA16F, GL_ZERO);
textures[3].Init(320, 180, 0, GL_RGBA16F, GL_ZERO);
param = { 0.0f, 0.0f, 0.0f, 1.0f };
init_data = true;
}
void sss_data::set_texture(int32_t texture_index) {
gl_state_active_bind_texture_2d(16, textures[texture_index].GetColorTex());
gl_state_active_texture(0);
}
light_proj::light_proj(int32_t width, int32_t height) : enable(), texture_id() {
+1
View File
@@ -78,6 +78,7 @@ struct sss_data {
void free();
void init();
void set_texture(int32_t);
};
struct light_proj {
+7 -8
View File
@@ -133,14 +133,14 @@ namespace rndr {
gpu_time[i] = 0.0;
}
set_pass_sw(RND_PASSID_2, 0);
set_pass_sw(RND_PASSID_REFLECT, 0);
set_pass_sw(RND_PASSID_REFRACT, 0);
set_pass_sw(RND_PASSID_PRE_PROCESS, 0);
set_pass_sw(RND_PASSID_SHOW_VECTOR, 0);
set_pass_sw(RND_PASSID_2, false);
set_pass_sw(RND_PASSID_REFLECT, false);
set_pass_sw(RND_PASSID_REFRACT, false);
set_pass_sw(RND_PASSID_PRE_PROCESS, false);
set_pass_sw(RND_PASSID_SHOW_VECTOR, false);
shadow_ptr = 0;
sync_gpu = 0;
sync_gpu = false;
time.get_timestamp();
shadow = true;
@@ -807,8 +807,7 @@ namespace rndr {
uniform_value[U_WATER_REFLECT] = 0;
}
gl_state_active_bind_texture_2d(16, rctx->sss_data->textures[1].GetColorTex());
gl_state_active_texture(0);
rctx->sss_data->set_texture(1);
gl_state_bind_sampler(14, rctx->render_samplers[0]);
gl_state_bind_sampler(15, rctx->render_samplers[0]);
+2 -3
View File
@@ -29,11 +29,10 @@ void Shadow::ctrl() {
view_mat[0] = rctx_ptr->camera->view;
view_mat[1] = rctx_ptr->camera->inv_view;
::light_set* set = &rctx_ptr->light_set[LIGHT_SET_MAIN];
light_data* data = &set->lights[LIGHT_CHARA];
light_data& light_chara = rctx_ptr->light_set[LIGHT_SET_MAIN].lights[LIGHT_CHARA];
vec3 position;
data->get_position(position);
light_chara.get_position(position);
float_t length = vec3::length(position);
if (length < 0.000001f)
direction = { 0.0f, 1.0f, 0.0f };