diff options
Diffstat (limited to 'source/blender/draw/engines')
14 files changed, 38 insertions, 38 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc index bc0891ceb92..e4c4f6f3f6f 100644 --- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc @@ -637,8 +637,8 @@ void DepthOfField::render(View &view, /* Do not step over any unvisited tile. */ int max_multiplier = dilation_radius + 1; - int ring_count = min_ii(DOF_DILATE_RING_COUNT, ceilf(remainder / (float)max_multiplier)); - int multiplier = min_ii(max_multiplier, floorf(remainder / (float)ring_count)); + int ring_count = min_ii(DOF_DILATE_RING_COUNT, ceilf(remainder / float(max_multiplier))); + int multiplier = min_ii(max_multiplier, floorf(remainder / float(ring_count))); dilation_radius += ring_count * multiplier; diff --git a/source/blender/draw/engines/eevee_next/eevee_film.cc b/source/blender/draw/engines/eevee_next/eevee_film.cc index 244eb1e54ef..82f948167dc 100644 --- a/source/blender/draw/engines/eevee_next/eevee_film.cc +++ b/source/blender/draw/engines/eevee_next/eevee_film.cc @@ -120,7 +120,7 @@ void Film::sync_mist() const ::World *world = inst_.scene->world; float mist_start = world ? world->miststa : cam.clip_near; float mist_distance = world ? world->mistdist : fabsf(cam.clip_far - cam.clip_near); - int mist_type = world ? world->mistype : (int)WO_MIST_LINEAR; + int mist_type = world ? world->mistype : int(WO_MIST_LINEAR); switch (mist_type) { case WO_MIST_QUADRATIC: diff --git a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc index f5638cc5160..29a5484f438 100644 --- a/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc +++ b/source/blender/draw/engines/eevee_next/eevee_renderbuffers.cc @@ -43,10 +43,10 @@ void RenderBuffers::acquire(int2 extent) bool do_vector_render_pass = (enabled_passes & EEVEE_RENDER_PASS_VECTOR) || (inst_.motion_blur.postfx_enabled() && !inst_.is_viewport()); uint32_t max_light_color_layer = max_ii(enabled_passes & EEVEE_RENDER_PASS_DIFFUSE_LIGHT ? - (int)RENDER_PASS_LAYER_DIFFUSE_LIGHT : + int(RENDER_PASS_LAYER_DIFFUSE_LIGHT) : -1, enabled_passes & EEVEE_RENDER_PASS_SPECULAR_LIGHT ? - (int)RENDER_PASS_LAYER_SPECULAR_LIGHT : + int(RENDER_PASS_LAYER_SPECULAR_LIGHT) : -1) + 1; /* Only RG16F when only doing only reprojection or motion blur. */ diff --git a/source/blender/draw/engines/eevee_next/eevee_sampling.cc b/source/blender/draw/engines/eevee_next/eevee_sampling.cc index 76a0e98638b..521b6d603df 100644 --- a/source/blender/draw/engines/eevee_next/eevee_sampling.cc +++ b/source/blender/draw/engines/eevee_next/eevee_sampling.cc @@ -215,8 +215,8 @@ void Sampling::dof_disk_sample_get(float *r_radius, float *r_theta) const samples_passed += ring_sample_count; } - *r_radius = ring / (float)dof_ring_count_; - *r_theta = 2.0f * M_PI * ring_sample / (float)ring_sample_count; + *r_radius = ring / float(dof_ring_count_); + *r_theta = 2.0f * M_PI * ring_sample / float(ring_sample_count); } /** \} */ @@ -233,7 +233,7 @@ void Sampling::cdf_from_curvemapping(const CurveMapping &curve, Vector<float> &c cdf[0] = 0.0f; /* Actual CDF evaluation. */ for (int u : IndexRange(cdf.size() - 1)) { - float x = (float)(u + 1) / (float)(cdf.size() - 1); + float x = float(u + 1) / float(cdf.size() - 1); cdf[u + 1] = cdf[u] + BKE_curvemapping_evaluateF(&curve, 0, x); } /* Normalize the CDF. */ @@ -249,14 +249,14 @@ void Sampling::cdf_from_curvemapping(const CurveMapping &curve, Vector<float> &c void Sampling::cdf_invert(Vector<float> &cdf, Vector<float> &inverted_cdf) { for (int u : inverted_cdf.index_range()) { - float x = (float)u / (float)(inverted_cdf.size() - 1); + float x = float(u) / float(inverted_cdf.size() - 1); for (int i : cdf.index_range()) { if (i == cdf.size() - 1) { inverted_cdf[u] = 1.0f; } else if (cdf[i] >= x) { float t = (x - cdf[i]) / (cdf[i + 1] - cdf[i]); - inverted_cdf[u] = ((float)i + t) / (float)(cdf.size() - 1); + inverted_cdf[u] = (float(i) + t) / float(cdf.size() - 1); break; } } diff --git a/source/blender/draw/engines/eevee_next/eevee_velocity.cc b/source/blender/draw/engines/eevee_next/eevee_velocity.cc index 7af311a8ccc..e7e4984f7de 100644 --- a/source/blender/draw/engines/eevee_next/eevee_velocity.cc +++ b/source/blender/draw/engines/eevee_next/eevee_velocity.cc @@ -226,11 +226,11 @@ void VelocityModule::step_swap() for (VelocityObjectData &vel : velocity_map.values()) { vel.obj.ofs[step_a] = vel.obj.ofs[step_b]; - vel.obj.ofs[step_b] = (uint)-1; + vel.obj.ofs[step_b] = uint(-1); vel.geo.ofs[step_a] = vel.geo.ofs[step_b]; vel.geo.len[step_a] = vel.geo.len[step_b]; - vel.geo.ofs[step_b] = (uint)-1; - vel.geo.len[step_b] = (uint)-1; + vel.geo.ofs[step_b] = uint(-1); + vel.geo.len[step_b] = uint(-1); } }; @@ -262,7 +262,7 @@ void VelocityModule::end_sync() uint32_t max_resource_id_ = 0u; for (Map<ObjectKey, VelocityObjectData>::Item item : velocity_map.items()) { - if (item.value.obj.resource_id == (uint32_t)-1) { + if (item.value.obj.resource_id == uint32_t(-1)) { deleted_obj.append(item.key); } else { @@ -302,7 +302,7 @@ void VelocityModule::end_sync() } indirection_buf[vel.obj.resource_id] = vel; /* Reset for next sync. */ - vel.obj.resource_id = (uint)-1; + vel.obj.resource_id = uint(-1); } object_steps[STEP_PREVIOUS]->push_update(); diff --git a/source/blender/draw/engines/eevee_next/eevee_view.cc b/source/blender/draw/engines/eevee_next/eevee_view.cc index 48951c2bae7..3a4fb9d4c20 100644 --- a/source/blender/draw/engines/eevee_next/eevee_view.cc +++ b/source/blender/draw/engines/eevee_next/eevee_view.cc @@ -39,7 +39,7 @@ void ShadingView::sync() int2 render_extent = inst_.film.render_extent_get(); if (false /* inst_.camera.is_panoramic() */) { - int64_t render_pixel_count = render_extent.x * (int64_t)render_extent.y; + int64_t render_pixel_count = render_extent.x * int64_t(render_extent.y); /* Divide pixel count between the 6 views. Rendering to a square target. */ extent_[0] = extent_[1] = ceilf(sqrtf(1 + (render_pixel_count / 6))); /* TODO(@fclem): Clip unused views here. */ diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc index 494fd3739d7..903bcbb911e 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.cc +++ b/source/blender/draw/engines/overlay/overlay_armature.cc @@ -416,7 +416,7 @@ static float encode_2f_to_float(float a, float b) { CLAMP(a, 0.0f, 1.0f); CLAMP(b, 0.0f, 2.0f); /* Can go up to 2. Needed for wire size. */ - return (float)((int)(a * 255) | ((int)(b * 255) << 8)); + return float(int(a * 255) | (int(b * 255) << 8)); } void OVERLAY_bone_instance_data_set_color_hint(BoneInstanceData *data, const float hint_color[4]) @@ -941,11 +941,11 @@ static void cp_shade_color3ub(uchar cp[3], const int offset) { int r, g, b; - r = offset + (int)cp[0]; + r = offset + int(cp[0]); CLAMP(r, 0, 255); - g = offset + (int)cp[1]; + g = offset + int(cp[1]); CLAMP(g, 0, 255); - b = offset + (int)cp[2]; + b = offset + int(cp[2]); CLAMP(b, 0, 255); cp[0] = r; diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.cc b/source/blender/draw/engines/overlay/overlay_edit_uv.cc index dd29a128255..2b1af67175e 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.cc +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.cc @@ -68,7 +68,7 @@ static OVERLAY_UVLineStyle edit_uv_line_style_from_space_image(const SpaceImage static GPUTexture *edit_uv_mask_texture( Mask *mask, const int width, const int height_, const float aspx, const float aspy) { - const int height = (float)height_ * (aspy / aspx); + const int height = float(height_) * (aspy / aspx); MaskRasterHandle *handle; float *buffer = static_cast<float *>(MEM_mallocN(sizeof(float) * height * width, __func__)); @@ -308,8 +308,8 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) { const int tile_x = ((tile->tile_number - 1001) % 10); const int tile_y = ((tile->tile_number - 1001) / 10); - obmat[3][1] = (float)tile_y; - obmat[3][0] = (float)tile_x; + obmat[3][1] = float(tile_y); + obmat[3][0] = float(tile_x); DRW_shgroup_call_obmat(grp, geom, obmat); } /* Only mark active border when overlays are enabled. */ @@ -318,8 +318,8 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) ImageTile *active_tile = static_cast<ImageTile *>( BLI_findlink(&image->tiles, image->active_tile_index)); if (active_tile) { - obmat[3][0] = (float)((active_tile->tile_number - 1001) % 10); - obmat[3][1] = (float)((active_tile->tile_number - 1001) / 10); + obmat[3][0] = float((active_tile->tile_number - 1001) % 10); + obmat[3][1] = float((active_tile->tile_number - 1001) / 10); grp = DRW_shgroup_create(sh, psl->edit_uv_tiled_image_borders_ps); DRW_shgroup_uniform_vec4_copy(grp, "color", selected_color); DRW_shgroup_call_obmat(grp, geom, obmat); diff --git a/source/blender/draw/engines/overlay/overlay_engine.cc b/source/blender/draw/engines/overlay/overlay_engine.cc index bb9f2e3a8ce..bbcae92561d 100644 --- a/source/blender/draw/engines/overlay/overlay_engine.cc +++ b/source/blender/draw/engines/overlay/overlay_engine.cc @@ -50,7 +50,7 @@ static void OVERLAY_engine_init(void *vedata) } OVERLAY_PrivateData *pd = stl->pd; - pd->space_type = v3d != nullptr ? (int)SPACE_VIEW3D : draw_ctx->space_data->spacetype; + pd->space_type = v3d != nullptr ? int(SPACE_VIEW3D) : draw_ctx->space_data->spacetype; if (pd->space_type == SPACE_IMAGE) { const SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; diff --git a/source/blender/draw/engines/overlay/overlay_grid.cc b/source/blender/draw/engines/overlay/overlay_grid.cc index d1958205a10..0cffa528219 100644 --- a/source/blender/draw/engines/overlay/overlay_grid.cc +++ b/source/blender/draw/engines/overlay/overlay_grid.cc @@ -67,8 +67,8 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) grid->distance = 1.0f; copy_v3_fl3(grid->size, 1.0f, 1.0f, 1.0f); if (is_uv_edit) { - grid->size[0] = (float)sima->tile_grid_shape[0]; - grid->size[1] = (float)sima->tile_grid_shape[1]; + grid->size[0] = float(sima->tile_grid_shape[0]); + grid->size[1] = float(sima->tile_grid_shape[1]); } grid->zoom_factor = ED_space_image_zoom_level(v2d, SI_GRID_STEPS_LEN); @@ -122,9 +122,9 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) } } - grid_axes[0] = (float)((grid_flag & (PLANE_XZ | PLANE_XY)) != 0); - grid_axes[1] = (float)((grid_flag & (PLANE_YZ | PLANE_XY)) != 0); - grid_axes[2] = (float)((grid_flag & (PLANE_YZ | PLANE_XZ)) != 0); + grid_axes[0] = float((grid_flag & (PLANE_XZ | PLANE_XY)) != 0); + grid_axes[1] = float((grid_flag & (PLANE_YZ | PLANE_XY)) != 0); + grid_axes[2] = float((grid_flag & (PLANE_YZ | PLANE_XZ)) != 0); /* Z axis if needed */ if (((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) && show_axis_z) { @@ -156,9 +156,9 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata) zneg_flag |= CLIP_ZPOS; } - zplane_axes[0] = (float)((zpos_flag & (PLANE_XZ | PLANE_XY)) != 0); - zplane_axes[1] = (float)((zpos_flag & (PLANE_YZ | PLANE_XY)) != 0); - zplane_axes[2] = (float)((zpos_flag & (PLANE_YZ | PLANE_XZ)) != 0); + zplane_axes[0] = float((zpos_flag & (PLANE_XZ | PLANE_XY)) != 0); + zplane_axes[1] = float((zpos_flag & (PLANE_YZ | PLANE_XY)) != 0); + zplane_axes[2] = float((zpos_flag & (PLANE_YZ | PLANE_XZ)) != 0); } else { zneg_flag = zpos_flag = CLIP_ZNEG | CLIP_ZPOS; diff --git a/source/blender/draw/engines/overlay/overlay_image.cc b/source/blender/draw/engines/overlay/overlay_image.cc index 47587319098..f42867622e4 100644 --- a/source/blender/draw/engines/overlay/overlay_image.cc +++ b/source/blender/draw/engines/overlay/overlay_image.cc @@ -135,7 +135,7 @@ static struct GPUTexture *image_camera_background_texture_get(CameraBGImage *bgp Scene *scene = draw_ctx->scene; float aspect_x, aspect_y; int width, height; - int ctime = (int)DEG_get_ctime(draw_ctx->depsgraph); + int ctime = int(DEG_get_ctime(draw_ctx->depsgraph)); *r_use_alpha_premult = false; *r_use_view_transform = false; diff --git a/source/blender/draw/engines/overlay/overlay_metaball.cc b/source/blender/draw/engines/overlay/overlay_metaball.cc index 38de273028b..2fc6910fe44 100644 --- a/source/blender/draw/engines/overlay/overlay_metaball.cc +++ b/source/blender/draw/engines/overlay/overlay_metaball.cc @@ -74,7 +74,7 @@ void OVERLAY_edit_metaball_cache_populate(OVERLAY_Data *vedata, Object *ob) LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { const bool is_selected = (ml->flag & SELECT) != 0; const bool is_scale_radius = (ml->flag & MB_SCALE_RAD) != 0; - float stiffness_radius = ml->rad * atanf(ml->s) / (float)M_PI_2; + float stiffness_radius = ml->rad * atanf(ml->s) / float(M_PI_2); BoneInstanceData instdata; if (is_select) { diff --git a/source/blender/draw/engines/overlay/overlay_motion_path.cc b/source/blender/draw/engines/overlay/overlay_motion_path.cc index 00b2a8665fd..3f6954f821b 100644 --- a/source/blender/draw/engines/overlay/overlay_motion_path.cc +++ b/source/blender/draw/engines/overlay/overlay_motion_path.cc @@ -116,7 +116,7 @@ static void motion_path_cache(OVERLAY_Data *vedata, const DRWContextState *draw_ctx = DRW_context_state_get(); struct DRWTextStore *dt = DRW_text_cache_ensure(); int txt_flag = DRW_TEXT_CACHE_GLOBALSPACE; - int cfra = (int)DEG_get_ctime(draw_ctx->depsgraph); + int cfra = int(DEG_get_ctime(draw_ctx->depsgraph)); bool selected = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->base_flag & BASE_SELECTED); bool show_keyframes = (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) != 0; bool show_keyframes_no = (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) != 0; diff --git a/source/blender/draw/engines/overlay/overlay_outline.cc b/source/blender/draw/engines/overlay/overlay_outline.cc index e308775dc6e..af348ae3c3e 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.cc +++ b/source/blender/draw/engines/overlay/overlay_outline.cc @@ -192,7 +192,7 @@ static void gpencil_layer_cache_populate(bGPDlayer *gpl, DRWShadingGroup *grp = iter->stroke_grp = DRW_shgroup_create_sub(iter->stroke_grp); DRW_shgroup_uniform_bool_copy(grp, "gpStrokeOrder3d", is_stroke_order_3d); DRW_shgroup_uniform_float_copy(grp, "gpThicknessScale", object_scale); - DRW_shgroup_uniform_float_copy(grp, "gpThicknessOffset", (float)gpl->line_change); + DRW_shgroup_uniform_float_copy(grp, "gpThicknessOffset", float(gpl->line_change)); DRW_shgroup_uniform_float_copy(grp, "gpThicknessWorldScale", thickness_scale); DRW_shgroup_uniform_vec4_copy(grp, "gpDepthPlane", iter->plane); } |