diff options
Diffstat (limited to 'source/blender/draw/engines/eevee')
11 files changed, 37 insertions, 37 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 0d14a0c5f61..caa63b9c54c 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -189,7 +189,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph); - Camera *cam = (camera != NULL) ? camera->data : NULL; + Camera *cam = (camera != NULL && camera->type == OB_CAMERA) ? camera->data : NULL; if (cam && (cam->dof.flag & CAM_DOF_ENABLED)) { RegionView3D *rv3d = draw_ctx->rv3d; diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 9bf0cce2af2..26a264c1716 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -142,7 +142,7 @@ typedef struct EEVEE_LightBake { struct GPUTexture *dummy_layer_color; int total, done; /* to compute progress */ - short *stop, *do_update; + bool *stop, *do_update; float *progress; /** For only handling the resources. */ @@ -778,7 +778,7 @@ wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm, } if (old_lbake->stop != NULL) { - *old_lbake->stop = 1; + *old_lbake->stop = true; } BLI_mutex_unlock(old_lbake->mutex); } @@ -1359,13 +1359,13 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake, DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake); lbake->done += 1; *lbake->progress = lbake->done / (float)lbake->total; - *lbake->do_update = 1; + *lbake->do_update = true; eevee_lightbake_context_disable(lbake); return true; } -void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress) +void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress) { EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data; Depsgraph *depsgraph = lbake->depsgraph; @@ -1394,8 +1394,8 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float /* Resource allocation can fail. Early exit in this case. */ if (lbake->lcache->flag & LIGHTCACHE_INVALID) { - *lbake->stop = 1; - *lbake->do_update = 1; + *lbake->stop = true; + *lbake->do_update = true; lbake->lcache->flag &= ~LIGHTCACHE_BAKING; eevee_lightbake_context_disable(lbake); eevee_lightbake_delete_resources(lbake); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h index 4e94e1914a7..73961f1919d 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.h +++ b/source/blender/draw/engines/eevee/eevee_lightcache.h @@ -42,7 +42,7 @@ void *EEVEE_lightbake_job_data_alloc(struct Main *bmain, int frame); void EEVEE_lightbake_job_data_free(void *custom_data); void EEVEE_lightbake_update(void *custom_data); -void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress); +void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress); /** * This is to update the world irradiance and reflection contribution from diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 942ab5502c7..eb111610706 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -403,7 +403,7 @@ static bool eevee_lightprobes_culling_test(Object *ob) const float max[3] = {1.0f, 1.0f, 1.0f}; BKE_boundbox_init_from_minmax(&bbox, min, max); - copy_m4_m4(tmp, ob->obmat); + copy_m4_m4(tmp, ob->object_to_world); normalize_v3(tmp[2]); mul_v3_fl(tmp[2], probe->distinf); @@ -445,7 +445,7 @@ void EEVEE_lightprobes_cache_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata /* Debug Display */ DRWCallBuffer *grp = vedata->stl->g_data->planar_display_shgrp; if (grp && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { - DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->obmat); + DRW_buffer_add_entry(grp, &pinfo->num_planar, ob->object_to_world); } pinfo->num_planar++; @@ -488,30 +488,30 @@ void EEVEE_lightprobes_grid_data_from_object(Object *ob, EEVEE_LightGrid *egrid, mul_v3_v3fl(half_cell_dim, cell_dim, 0.5f); /* Matrix converting world space to cell ranges. */ - invert_m4_m4(egrid->mat, ob->obmat); + invert_m4_m4(egrid->mat, ob->object_to_world); /* First cell. */ copy_v3_fl(egrid->corner, -1.0f); add_v3_v3(egrid->corner, half_cell_dim); - mul_m4_v3(ob->obmat, egrid->corner); + mul_m4_v3(ob->object_to_world, egrid->corner); /* Opposite neighbor cell. */ copy_v3_fl3(egrid->increment_x, cell_dim[0], 0.0f, 0.0f); add_v3_v3(egrid->increment_x, half_cell_dim); add_v3_fl(egrid->increment_x, -1.0f); - mul_m4_v3(ob->obmat, egrid->increment_x); + mul_m4_v3(ob->object_to_world, egrid->increment_x); sub_v3_v3(egrid->increment_x, egrid->corner); copy_v3_fl3(egrid->increment_y, 0.0f, cell_dim[1], 0.0f); add_v3_v3(egrid->increment_y, half_cell_dim); add_v3_fl(egrid->increment_y, -1.0f); - mul_m4_v3(ob->obmat, egrid->increment_y); + mul_m4_v3(ob->object_to_world, egrid->increment_y); sub_v3_v3(egrid->increment_y, egrid->corner); copy_v3_fl3(egrid->increment_z, 0.0f, 0.0f, cell_dim[2]); add_v3_v3(egrid->increment_z, half_cell_dim); add_v3_fl(egrid->increment_z, -1.0f); - mul_m4_v3(ob->obmat, egrid->increment_z); + mul_m4_v3(ob->object_to_world, egrid->increment_z); sub_v3_v3(egrid->increment_z, egrid->corner); /* Visibility bias */ @@ -527,7 +527,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob LightProbe *probe = (LightProbe *)ob->data; /* Update transforms */ - copy_v3_v3(eprobe->position, ob->obmat[3]); + copy_v3_v3(eprobe->position, ob->object_to_world[3]); /* Attenuation */ eprobe->attenuation_type = probe->attenuation_type; @@ -535,7 +535,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob unit_m4(eprobe->attenuationmat); scale_m4_fl(eprobe->attenuationmat, probe->distinf); - mul_m4_m4m4(eprobe->attenuationmat, ob->obmat, eprobe->attenuationmat); + mul_m4_m4m4(eprobe->attenuationmat, ob->object_to_world, eprobe->attenuationmat); invert_m4(eprobe->attenuationmat); /* Parallax */ @@ -550,7 +550,7 @@ void EEVEE_lightprobes_cube_data_from_object(Object *ob, EEVEE_LightProbe *eprob scale_m4_fl(eprobe->parallaxmat, probe->distinf); } - mul_m4_m4m4(eprobe->parallaxmat, ob->obmat, eprobe->parallaxmat); + mul_m4_m4m4(eprobe->parallaxmat, ob->object_to_world, eprobe->parallaxmat); invert_m4(eprobe->parallaxmat); } @@ -566,8 +566,8 @@ void EEVEE_lightprobes_planar_data_from_object(Object *ob, vis_test->cached = false; /* Computing mtx : matrix that mirror position around object's XY plane. */ - normalize_m4_m4(normat, ob->obmat); /* object > world */ - invert_m4_m4(imat, normat); /* world > object */ + normalize_m4_m4(normat, ob->object_to_world); /* object > world */ + invert_m4_m4(imat, normat); /* world > object */ /* XY reflection plane */ imat[0][2] = -imat[0][2]; imat[1][2] = -imat[1][2]; @@ -576,38 +576,38 @@ void EEVEE_lightprobes_planar_data_from_object(Object *ob, mul_m4_m4m4(eplanar->mtx, normat, imat); /* world > object > mirrored obj > world */ /* Compute clip plane equation / normal. */ - copy_v3_v3(eplanar->plane_equation, ob->obmat[2]); + copy_v3_v3(eplanar->plane_equation, ob->object_to_world[2]); normalize_v3(eplanar->plane_equation); /* plane normal */ - eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->obmat[3]); + eplanar->plane_equation[3] = -dot_v3v3(eplanar->plane_equation, ob->object_to_world[3]); eplanar->clipsta = probe->clipsta; /* Compute XY clip planes. */ - normalize_v3_v3(eplanar->clip_vec_x, ob->obmat[0]); - normalize_v3_v3(eplanar->clip_vec_y, ob->obmat[1]); + normalize_v3_v3(eplanar->clip_vec_x, ob->object_to_world[0]); + normalize_v3_v3(eplanar->clip_vec_y, ob->object_to_world[1]); float vec[3] = {0.0f, 0.0f, 0.0f}; vec[0] = 1.0f; vec[1] = 0.0f; vec[2] = 0.0f; - mul_m4_v3(ob->obmat, vec); /* Point on the edge */ + mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */ eplanar->clip_edge_x_pos = dot_v3v3(eplanar->clip_vec_x, vec); vec[0] = 0.0f; vec[1] = 1.0f; vec[2] = 0.0f; - mul_m4_v3(ob->obmat, vec); /* Point on the edge */ + mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */ eplanar->clip_edge_y_pos = dot_v3v3(eplanar->clip_vec_y, vec); vec[0] = -1.0f; vec[1] = 0.0f; vec[2] = 0.0f; - mul_m4_v3(ob->obmat, vec); /* Point on the edge */ + mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */ eplanar->clip_edge_x_neg = dot_v3v3(eplanar->clip_vec_x, vec); vec[0] = 0.0f; vec[1] = -1.0f; vec[2] = 0.0f; - mul_m4_v3(ob->obmat, vec); /* Point on the edge */ + mul_m4_v3(ob->object_to_world, vec); /* Point on the edge */ eplanar->clip_edge_y_neg = dot_v3v3(eplanar->clip_vec_y, vec); /* Facing factors */ diff --git a/source/blender/draw/engines/eevee/eevee_lights.c b/source/blender/draw/engines/eevee/eevee_lights.c index 312305a31f7..f8250f9520d 100644 --- a/source/blender/draw/engines/eevee/eevee_lights.c +++ b/source/blender/draw/engines/eevee/eevee_lights.c @@ -132,7 +132,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli) const float light_threshold = draw_ctx->scene->eevee.light_threshold; /* Position */ - copy_v3_v3(evli->position, ob->obmat[3]); + copy_v3_v3(evli->position, ob->object_to_world[3]); /* Color */ copy_v3_v3(evli->color, &la->r); @@ -153,7 +153,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli) evli->invsqrdist_volume = 1.0f / max_ff(1e-4f, square_f(att_radius_volume)); /* Vectors */ - normalize_m4_m4_ex(mat, ob->obmat, scale); + normalize_m4_m4_ex(mat, ob->object_to_world, scale); copy_v3_v3(evli->forwardvec, mat[2]); normalize_v3(evli->forwardvec); negate_v3(evli->forwardvec); diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 068b18f1117..b134d7f6dc6 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -810,7 +810,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && + bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) && !DRW_state_is_image_render(); if (ob->sculpt && ob->sculpt->pbvh) { diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index a3ca19c88e1..9f7fb1c154c 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -292,7 +292,7 @@ void EEVEE_motion_blur_curves_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata) int mb_step = effects->motion_blur_step; /* Store transform. */ - copy_m4_m4(mb_data->obmat[mb_step], ob->obmat); + copy_m4_m4(mb_data->obmat[mb_step], ob->object_to_world); EEVEE_HairMotionData *mb_curves = EEVEE_motion_blur_curves_data_get(mb_data); @@ -362,7 +362,7 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), if (mb_data) { int mb_step = effects->motion_blur_step; /* Store transform. */ - copy_m4_m4(mb_data->obmat[mb_step], ob->obmat); + copy_m4_m4(mb_data->obmat[mb_step], ob->object_to_world); EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get(mb_data); diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index 9e571b1d15b..1cf3c7c6da1 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows.c +++ b/source/blender/draw/engines/eevee/eevee_shadows.c @@ -153,7 +153,7 @@ void EEVEE_shadows_caster_register(EEVEE_ViewLayerData *sldata, Object *ob) for (int i = 0; i < 8; i++) { float vec[3]; copy_v3_v3(vec, bb->vec[i]); - mul_m4_v3(ob->obmat, vec); + mul_m4_v3(ob->object_to_world, vec); minmax_v3v3_v3(min, max, vec); } diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 05b2bafdb3a..872696a8b7c 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -299,7 +299,7 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, } float size[3]; - mat4_to_size(size, ob->obmat); + mat4_to_size(size, ob->object_to_world); /* Check if any of the axes have 0 length. (see T69070) */ const float epsilon = 1e-8f; if ((size[0] < epsilon) || (size[1] < epsilon) || (size[2] < epsilon)) { diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl index 062a40f35c2..ccf6d6e2042 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl @@ -30,7 +30,7 @@ void main() vec3 world_pos = pos; #elif defined(POINTCLOUD_SHADER) pointcloud_get_pos_and_radius(pointPosition, pointRadius); - pointID = gl_VertexID; + pointID = pointcloud_get_point_id(); #else vec3 world_pos = point_object_to_world(pos); #endif diff --git a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl index 8f49c7bd265..7a22b2c53d7 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_vert.glsl @@ -37,7 +37,7 @@ void main() vec3 world_pos = pos; #elif defined(POINTCLOUD_SHADER) pointcloud_get_pos_and_radius(pointPosition, pointRadius); - pointID = gl_VertexID; + pointID = pointcloud_get_point_id(); #else vec3 world_pos = point_object_to_world(pos); #endif |