Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/eevee/eevee_lightprobes.c
| Show First 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | for (int i = 0; (ob = pinfo->probes_planar_ref[i]) && (i < MAX_PLANAR); i++) { | ||||
| /* Distance factors */ | /* Distance factors */ | ||||
| float max_dist = probe->distinf; | float max_dist = probe->distinf; | ||||
| float min_dist = min_ff(1.0f - 1e-8f, 1.0f - probe->falloff) * probe->distinf; | float min_dist = min_ff(1.0f - 1e-8f, 1.0f - probe->falloff) * probe->distinf; | ||||
| eplanar->attenuation_scale = -1.0f / max_ff(1e-8f, max_dist - min_dist); | eplanar->attenuation_scale = -1.0f / max_ff(1e-8f, max_dist - min_dist); | ||||
| eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale; | eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale; | ||||
| /* Debug Display */ | /* Debug Display */ | ||||
| if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { | if (BKE_object_is_visible(ob) && | ||||
| DRW_state_draw_support() && | |||||
| (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) | |||||
| { | |||||
| DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_planar_display_sh, psl->probe_display); | DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_planar_display_sh, psl->probe_display); | ||||
| DRW_shgroup_uniform_int(grp, "probeIdx", &ped->probe_id, 1); | DRW_shgroup_uniform_int(grp, "probeIdx", &ped->probe_id, 1); | ||||
| DRW_shgroup_uniform_buffer(grp, "probePlanars", &txl->planar_pool); | DRW_shgroup_uniform_buffer(grp, "probePlanars", &txl->planar_pool); | ||||
| DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo); | DRW_shgroup_uniform_block(grp, "planar_block", sldata->planar_ubo); | ||||
| struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); | struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get(); | ||||
| DRW_shgroup_call_add(grp, geom, ob->obmat); | DRW_shgroup_call_add(grp, geom, ob->obmat); | ||||
| Show All 36 Lines | for (int i = 1; (ob = pinfo->probes_cube_ref[i]) && (i < MAX_PROBE); i++) { | ||||
| } | } | ||||
| unit_m4(eprobe->parallaxmat); | unit_m4(eprobe->parallaxmat); | ||||
| scale_m4_fl(eprobe->parallaxmat, dist); | scale_m4_fl(eprobe->parallaxmat, dist); | ||||
| mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat); | mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat); | ||||
| invert_m4(eprobe->parallaxmat); | invert_m4(eprobe->parallaxmat); | ||||
| /* Debug Display */ | /* Debug Display */ | ||||
| if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { | if (BKE_object_is_visible(ob) && | ||||
| DRW_shgroup_call_dynamic_add(stl->g_data->cube_display_shgrp, &ped->probe_id, ob->obmat[3], &probe->data_draw_size); | DRW_state_draw_support() && | ||||
| (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) | |||||
| { | |||||
| DRW_shgroup_call_dynamic_add( | |||||
| stl->g_data->cube_display_shgrp, &ped->probe_id, ob->obmat[3], &probe->data_draw_size); | |||||
| } | } | ||||
| } | } | ||||
| /* IRRADIANCE GRID */ | /* IRRADIANCE GRID */ | ||||
| int offset = 1; /* to account for the world probe */ | int offset = 1; /* to account for the world probe */ | ||||
| for (int i = 1; (ob = pinfo->probes_grid_ref[i]) && (i < MAX_GRID); i++) { | for (int i = 1; (ob = pinfo->probes_grid_ref[i]) && (i < MAX_GRID); i++) { | ||||
| LightProbe *probe = (LightProbe *)ob->data; | LightProbe *probe = (LightProbe *)ob->data; | ||||
| EEVEE_LightGrid *egrid = &pinfo->grid_data[i]; | EEVEE_LightGrid *egrid = &pinfo->grid_data[i]; | ||||
| Show All 40 Lines | for (int i = 1; (ob = pinfo->probes_grid_ref[i]) && (i < MAX_GRID); i++) { | ||||
| add_v3_v3(egrid->increment_z, half_cell_dim); | add_v3_v3(egrid->increment_z, half_cell_dim); | ||||
| add_v3_fl(egrid->increment_z, -1.0f); | add_v3_fl(egrid->increment_z, -1.0f); | ||||
| mul_m4_v3(ob->obmat, egrid->increment_z); | mul_m4_v3(ob->obmat, egrid->increment_z); | ||||
| sub_v3_v3(egrid->increment_z, egrid->corner); | sub_v3_v3(egrid->increment_z, egrid->corner); | ||||
| copy_v3_v3_int(egrid->resolution, &probe->grid_resolution_x); | copy_v3_v3_int(egrid->resolution, &probe->grid_resolution_x); | ||||
| /* Debug Display */ | /* Debug Display */ | ||||
| if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { | if (BKE_object_is_visible(ob) && | ||||
| DRW_state_draw_support() && | |||||
| (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) | |||||
| { | |||||
| struct Gwn_Batch *geom = DRW_cache_sphere_get(); | struct Gwn_Batch *geom = DRW_cache_sphere_get(); | ||||
| DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh, psl->probe_display, geom); | DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh, psl->probe_display, geom); | ||||
| DRW_shgroup_set_instance_count(grp, ped->num_cell); | DRW_shgroup_set_instance_count(grp, ped->num_cell); | ||||
| DRW_shgroup_uniform_int(grp, "offset", &egrid->offset, 1); | DRW_shgroup_uniform_int(grp, "offset", &egrid->offset, 1); | ||||
| DRW_shgroup_uniform_ivec3(grp, "grid_resolution", egrid->resolution, 1); | DRW_shgroup_uniform_ivec3(grp, "grid_resolution", egrid->resolution, 1); | ||||
| DRW_shgroup_uniform_vec3(grp, "corner", egrid->corner, 1); | DRW_shgroup_uniform_vec3(grp, "corner", egrid->corner, 1); | ||||
| DRW_shgroup_uniform_vec3(grp, "increment_x", egrid->increment_x, 1); | DRW_shgroup_uniform_vec3(grp, "increment_x", egrid->increment_x, 1); | ||||
| DRW_shgroup_uniform_vec3(grp, "increment_y", egrid->increment_y, 1); | DRW_shgroup_uniform_vec3(grp, "increment_y", egrid->increment_y, 1); | ||||
| ▲ Show 20 Lines • Show All 670 Lines • Show Last 20 Lines | |||||