diff options
Diffstat (limited to 'source/blender/draw')
27 files changed, 75 insertions, 75 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); } diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 79f2982ab65..fd00059bac6 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -204,7 +204,7 @@ BLI_INLINE void extract_init(const MeshRenderData *mr, run_data.buffer = mesh_extract_buffer_get(extractor, mbuflist); run_data.data_offset = data_offset; extractor->init(mr, cache, run_data.buffer, POINTER_OFFSET(data_stack, data_offset)); - data_offset += (uint32_t)extractor->data_size; + data_offset += uint32_t(extractor->data_size); } } diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc index 392144246df..f554e9e67c3 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc @@ -349,7 +349,7 @@ void mesh_render_data_update_normals(MeshRenderData *mr, const eMRDataType data_ { Mesh *me = mr->me; const bool is_auto_smooth = (me->flag & ME_AUTOSMOOTH) != 0; - const float split_angle = is_auto_smooth ? me->smoothresh : (float)M_PI; + const float split_angle = is_auto_smooth ? me->smoothresh : float(M_PI); if (mr->extract_type != MR_EXTRACT_BMESH) { /* Mesh */ diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index c387a47f0a6..97cec585979 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -664,7 +664,7 @@ static void draw_subdiv_cache_extra_coarse_face_data_bm(BMesh *bm, flag |= SUBDIV_COARSE_FACE_FLAG_SMOOTH; } const int loopstart = BM_elem_index_get(f->l_first); - flags_data[index] = (uint)(loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); + flags_data[index] = uint(loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); } } @@ -684,7 +684,7 @@ static void draw_subdiv_cache_extra_coarse_face_data_mesh(const MeshRenderData * if (mr->hide_poly && mr->hide_poly[i]) { flag |= SUBDIV_COARSE_FACE_FLAG_HIDDEN; } - flags_data[i] = (uint)(polys[i].loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); + flags_data[i] = uint(polys[i].loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); } } @@ -707,7 +707,7 @@ static void draw_subdiv_cache_extra_coarse_face_data_mapped(Mesh *mesh, if ((polys[i].flag & ME_SMOOTH) != 0) { flag |= SUBDIV_COARSE_FACE_FLAG_SMOOTH; } - flags_data[i] = (uint)(polys[i].loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); + flags_data[i] = uint(polys[i].loopstart) | (flag << SUBDIV_COARSE_FACE_FLAG_OFFSET); } } @@ -828,10 +828,10 @@ static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_con /* Set topology information only if we have loops. */ if (num_loops != 0) { - cache->num_subdiv_edges = (uint)num_edges; - cache->num_subdiv_loops = (uint)num_loops; - cache->num_subdiv_verts = (uint)num_verts; - cache->num_subdiv_quads = (uint)num_polys; + cache->num_subdiv_edges = uint(num_edges); + cache->num_subdiv_loops = uint(num_loops); + cache->num_subdiv_verts = uint(num_verts); + cache->num_subdiv_quads = uint(num_polys); cache->subdiv_polygon_offset = static_cast<int *>(MEM_dupallocN(subdiv_polygon_offset)); } @@ -2137,7 +2137,7 @@ void DRW_subdivide_loose_geom(DRWSubdivCache *subdiv_cache, MeshBufferCache *cac const bool is_simple = subdiv_cache->subdiv->settings.is_simple; const int resolution = subdiv_cache->resolution; const int resolution_1 = resolution - 1; - const float inv_resolution_1 = 1.0f / (float)resolution_1; + const float inv_resolution_1 = 1.0f / float(resolution_1); const int num_subdiv_vertices_per_coarse_edge = resolution - 2; const int num_subdivided_edge = coarse_loose_edge_len * diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc index ff69885b3b6..882eda9b31d 100644 --- a/source/blender/draw/intern/draw_command.cc +++ b/source/blender/draw/intern/draw_command.cc @@ -90,7 +90,7 @@ void DrawMulti::execute(RecordingState &state) const DrawMultiBuf::DrawGroupBuf &groups = multi_draw_buf->group_buf_; uint group_index = this->group_first; - while (group_index != (uint)-1) { + while (group_index != uint(-1)) { const DrawGroup &group = groups[group_index]; if (group.vertex_len > 0) { @@ -345,9 +345,9 @@ std::string PushConstant::serialize() const std::string Draw::serialize() const { - std::string inst_len = (instance_len == (uint)-1) ? "from_batch" : std::to_string(instance_len); - std::string vert_len = (vertex_len == (uint)-1) ? "from_batch" : std::to_string(vertex_len); - std::string vert_first = (vertex_first == (uint)-1) ? "from_batch" : + std::string inst_len = (instance_len == uint(-1)) ? "from_batch" : std::to_string(instance_len); + std::string vert_len = (vertex_len == uint(-1)) ? "from_batch" : std::to_string(vertex_len); + std::string vert_first = (vertex_first == uint(-1)) ? "from_batch" : std::to_string(vertex_first); return std::string(".draw(inst_len=") + inst_len + ", vert_len=" + vert_len + ", vert_first=" + vert_first + ", res_id=" + std::to_string(handle.resource_index()) + @@ -379,7 +379,7 @@ std::string DrawMulti::serialize(std::string line_prefix) const uint group_len = 0; uint group_index = this->group_first; - while (group_index != (uint)-1) { + while (group_index != uint(-1)) { const DrawGroup &grp = groups[group_index]; ss << std::endl << line_prefix << " .group(id=" << group_index << ", len=" << grp.len << ")"; @@ -505,7 +505,7 @@ void DrawCommandBuf::bind(RecordingState &state, * instance to set the correct resource_id. Workaround is a storage_buf + gl_InstanceID. */ BLI_assert(batch_inst_len == 1); - if (cmd.vertex_len == (uint)-1) { + if (cmd.vertex_len == uint(-1)) { cmd.vertex_len = batch_vert_len; } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc index d6c246c51a9..32a262e4533 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc @@ -71,7 +71,7 @@ BLI_INLINE void lines_adjacency_triangle( if (!value_is_init || v_data == NO_EDGE) { /* Save the winding order inside the sign bit. Because the * Edge-hash sort the keys and we need to compare winding later. */ - int value = (int)l1 + 1; /* 0 cannot be signed so add one. */ + int value = int(l1) + 1; /* 0 cannot be signed so add one. */ *pval = POINTER_FROM_INT((inv_indices) ? -value : value); /* Store loop indices for remaining non-manifold edges. */ data->vert_to_loop[v2] = l2; @@ -81,7 +81,7 @@ BLI_INLINE void lines_adjacency_triangle( /* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */ *pval = POINTER_FROM_INT(NO_EDGE); bool inv_opposite = (v_data < 0); - uint l_opposite = (uint)abs(v_data) - 1; + uint l_opposite = uint(abs(v_data)) - 1; /* TODO: Make this part thread-safe. */ if (inv_opposite == inv_indices) { /* Don't share edge if triangles have non matching winding. */ @@ -146,7 +146,7 @@ static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr), int v_data = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi)); if (v_data != NO_EDGE) { BLI_edgehashIterator_getKey(ehi, &v2, &v3); - l1 = (uint)abs(v_data) - 1; + l1 = uint(abs(v_data)) - 1; if (v_data < 0) { /* `inv_opposite`. */ SWAP(uint, v2, v3); } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc index 9fbbfc3d705..3977ba492ca 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_paint_mask.cc @@ -115,8 +115,8 @@ static void extract_lines_paint_mask_iter_subdiv_mesh(const DRWSubdivCache *subd uint start_loop_idx = subdiv_quad_index * 4; uint end_loop_idx = (subdiv_quad_index + 1) * 4; for (uint loop_idx = start_loop_idx; loop_idx < end_loop_idx; loop_idx++) { - const uint coarse_edge_index = (uint)subdiv_loop_edge_index[loop_idx]; - const uint subdiv_edge_index = (uint)subdiv_loop_subdiv_edge_index[loop_idx]; + const uint coarse_edge_index = uint(subdiv_loop_edge_index[loop_idx]); + const uint subdiv_edge_index = uint(subdiv_loop_subdiv_edge_index[loop_idx]); if (coarse_edge_index == -1u) { GPU_indexbuf_set_line_restart(&data->elb, subdiv_edge_index); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc index 27fd6546b8c..12e3d4afd5d 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edit_data.cc @@ -60,14 +60,14 @@ static void mesh_render_data_edge_flag(const MeshRenderData *mr, if (mr->edge_crease_ofs != -1) { float crease = BM_ELEM_CD_GET_FLOAT(eed, mr->edge_crease_ofs); if (crease > 0) { - eattr->crease = (uchar)ceil(crease * 15.0f); + eattr->crease = uchar(ceil(crease * 15.0f)); } } /* Use a byte for value range */ if (mr->bweight_ofs != -1) { float bweight = BM_ELEM_CD_GET_FLOAT(eed, mr->bweight_ofs); if (bweight > 0) { - eattr->bweight = (uchar)(bweight * 255.0f); + eattr->bweight = uchar(bweight * 255.0f); } } #ifdef WITH_FREESTYLE @@ -95,7 +95,7 @@ static void mesh_render_data_vert_flag(const MeshRenderData *mr, if (mr->vert_crease_ofs != -1) { float crease = BM_ELEM_CD_GET_FLOAT(eve, mr->vert_crease_ofs); if (crease > 0) { - eattr->crease |= (uchar)ceil(crease * 15.0f) << 4; + eattr->crease |= uchar(ceil(crease * 15.0f)) << 4; } } } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc index e4714aabf34..683abf24f03 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edituv_stretch_angle.cc @@ -52,7 +52,7 @@ static void compute_normalize_edge_vectors(float auv[2][2], static short v2_to_short_angle(const float v[2]) { - return atan2f(v[1], v[0]) * (float)M_1_PI * SHRT_MAX; + return atan2f(v[1], v[0]) * float(M_1_PI) * SHRT_MAX; } static void edituv_get_edituv_stretch_angle(float auv[2][2], @@ -63,7 +63,7 @@ static void edituv_get_edituv_stretch_angle(float auv[2][2], r_stretch->uv_angles[0] = v2_to_short_angle(auv[0]); r_stretch->uv_angles[1] = v2_to_short_angle(auv[1]); /* Compute 3D angle here. */ - r_stretch->angle = angle_normalized_v3v3(av[0], av[1]) * (float)M_1_PI * SHRT_MAX; + r_stretch->angle = angle_normalized_v3v3(av[0], av[1]) * float(M_1_PI) * SHRT_MAX; #if 0 /* here for reference, this is done in shader now. */ float uvang = angle_normalized_v2v2(auv0, auv1); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc index c391cb6ca5a..8bc4d7fe7c7 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc @@ -63,7 +63,7 @@ static void extract_fdots_pos_iter_poly_bm(const MeshRenderData *mr, do { add_v3_v3(co, bm_vert_co_get(mr, l_iter->v)); } while ((l_iter = l_iter->next) != l_first); - mul_v3_fl(co, 1.0f / (float)f->len); + mul_v3_fl(co, 1.0f / float(f->len)); } static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr, @@ -95,7 +95,7 @@ static void extract_fdots_pos_iter_poly_mesh(const MeshRenderData *mr, } if (!mr->use_subsurf_fdots) { - mul_v3_fl(co, 1.0f / (float)mp->totloop); + mul_v3_fl(co, 1.0f / float(mp->totloop)); } } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc index b0403cf7c4c..0c1b58a035f 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_uv.cc @@ -62,7 +62,7 @@ static void extract_fdots_uv_iter_poly_bm(const MeshRenderData *UNUSED(mr), BMLoop *l_iter, *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { - float w = 1.0f / (float)f->len; + float w = 1.0f / float(f->len); const MLoopUV *luv = (const MLoopUV *)BM_ELEM_CD_GET_VOID_P(l_iter, data->cd_ofs); madd_v2_v2fl(data->vbo_data[BM_elem_index_get(f)], luv->uv, w); } while ((l_iter = l_iter->next) != l_first); @@ -86,7 +86,7 @@ static void extract_fdots_uv_iter_poly_mesh(const MeshRenderData *mr, } } else { - float w = 1.0f / (float)mp->totloop; + float w = 1.0f / float(mp->totloop); madd_v2_v2fl(data->vbo_data[mp_index], data->uv_data[ml_index].uv, w); } } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc index fe2a02b6b63..a803fcaac1c 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_mesh_analysis.cc @@ -67,8 +67,8 @@ BLI_INLINE float overhang_remap(float fac, float min, float max, float minmax_ir static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang) { const MeshStatVis *statvis = &mr->toolsettings->statvis; - const float min = statvis->overhang_min / (float)M_PI; - const float max = statvis->overhang_max / (float)M_PI; + const float min = statvis->overhang_min / float(M_PI); + const float max = statvis->overhang_max / float(M_PI); const char axis = statvis->overhang_axis; BMEditMesh *em = mr->edit_bmesh; BMIter iter; @@ -88,7 +88,7 @@ static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang) if (mr->extract_type == MR_EXTRACT_BMESH) { int l_index = 0; BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - float fac = angle_normalized_v3v3(bm_face_no_get(mr, f), dir) / (float)M_PI; + float fac = angle_normalized_v3v3(bm_face_no_get(mr, f), dir) / float(M_PI); fac = overhang_remap(fac, min, max, minmax_irange); for (int i = 0; i < f->len; i++, l_index++) { r_overhang[l_index] = fac; @@ -98,7 +98,7 @@ static void statvis_calc_overhang(const MeshRenderData *mr, float *r_overhang) else { const MPoly *mp = mr->mpoly; for (int mp_index = 0, l_index = 0; mp_index < mr->poly_len; mp_index++, mp++) { - float fac = angle_normalized_v3v3(mr->poly_normals[mp_index], dir) / (float)M_PI; + float fac = angle_normalized_v3v3(mr->poly_normals[mp_index], dir) / float(M_PI); fac = overhang_remap(fac, min, max, minmax_irange); for (int i = 0; i < mp->totloop; i++, l_index++) { r_overhang[l_index] = fac; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc index 049fa416523..60ade9daadc 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_tan.cc @@ -302,7 +302,7 @@ static void extract_tan_init_subdiv(const DRWSubdivCache *subdiv_cache, /* Ensure data is uploaded properly. */ GPU_vertbuf_tag_dirty(coarse_vbo); /* Include stride in offset. */ - const int dst_offset = (int)subdiv_cache->num_subdiv_loops * 4 * pack_layer_index++; + const int dst_offset = int(subdiv_cache->num_subdiv_loops) * 4 * pack_layer_index++; draw_subdiv_interp_custom_data(subdiv_cache, coarse_vbo, dst_buffer, 4, dst_offset, false); } if (use_orco_tan) { @@ -317,7 +317,7 @@ static void extract_tan_init_subdiv(const DRWSubdivCache *subdiv_cache, /* Ensure data is uploaded properly. */ GPU_vertbuf_tag_dirty(coarse_vbo); /* Include stride in offset. */ - const int dst_offset = (int)subdiv_cache->num_subdiv_loops * 4 * pack_layer_index++; + const int dst_offset = int(subdiv_cache->num_subdiv_loops) * 4 * pack_layer_index++; draw_subdiv_interp_custom_data(subdiv_cache, coarse_vbo, dst_buffer, 4, dst_offset, false); } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc index 6606912850d..cbade20dd03 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_uv.cc @@ -146,7 +146,7 @@ static void extract_uv_init_subdiv(const DRWSubdivCache *subdiv_cache, int pack_layer_index = 0; for (int i = 0; i < MAX_MTFACE; i++) { if (uv_layers & (1 << i)) { - const int offset = (int)subdiv_cache->num_subdiv_loops * pack_layer_index++; + const int offset = int(subdiv_cache->num_subdiv_loops) * pack_layer_index++; draw_subdiv_extract_uvs(subdiv_cache, vbo, i, offset); } } |