Cleanup: use function style casts for C++
This commit is contained in:
@@ -296,7 +296,7 @@ static void load_node(const tinygltf::Model &gltf_model,
|
||||
float world_transform[4][4];
|
||||
|
||||
GHOST_XrControllerModelNode &node = nodes.emplace_back();
|
||||
const int32_t node_idx = (int32_t)(nodes.size() - 1);
|
||||
const int32_t node_idx = int32_t(nodes.size() - 1);
|
||||
node.parent_idx = parent_idx;
|
||||
calc_node_transforms(gltf_node, parent_transform, node.local_transform, world_transform);
|
||||
|
||||
@@ -496,7 +496,7 @@ void GHOST_XrControllerModel::loadControllerModel(XrSession session)
|
||||
|
||||
std::vector<XrControllerModelNodePropertiesMSFT> node_properties(
|
||||
model_properties.nodeCountOutput, {XR_TYPE_CONTROLLER_MODEL_NODE_PROPERTIES_MSFT});
|
||||
model_properties.nodeCapacityInput = (uint32_t)node_properties.size();
|
||||
model_properties.nodeCapacityInput = uint32_t(node_properties.size());
|
||||
model_properties.nodeProperties = node_properties.data();
|
||||
CHECK_XR(g_xrGetControllerModelPropertiesMSFT(session, m_model_key, &model_properties),
|
||||
"Failed to get controller model node properties.");
|
||||
@@ -583,11 +583,11 @@ void GHOST_XrControllerModel::updateComponents(XrSession session)
|
||||
void GHOST_XrControllerModel::getData(GHOST_XrControllerModelData &r_data)
|
||||
{
|
||||
if (m_data_loaded) {
|
||||
r_data.count_vertices = (uint32_t)m_vertices.size();
|
||||
r_data.count_vertices = uint32_t(m_vertices.size());
|
||||
r_data.vertices = m_vertices.data();
|
||||
r_data.count_indices = (uint32_t)m_indices.size();
|
||||
r_data.count_indices = uint32_t(m_indices.size());
|
||||
r_data.indices = m_indices.data();
|
||||
r_data.count_components = (uint32_t)m_components.size();
|
||||
r_data.count_components = uint32_t(m_components.size());
|
||||
r_data.components = m_components.data();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -745,7 +745,7 @@ bool GHOST_XrSession::attachActionSets()
|
||||
|
||||
for (auto &[profile, bindings] : profile_bindings) {
|
||||
bindings_info.interactionProfile = profile;
|
||||
bindings_info.countSuggestedBindings = (uint32_t)bindings.size();
|
||||
bindings_info.countSuggestedBindings = uint32_t(bindings.size());
|
||||
bindings_info.suggestedBindings = bindings.data();
|
||||
|
||||
CHECK_XR(xrSuggestInteractionProfileBindings(instance, &bindings_info),
|
||||
@@ -754,7 +754,7 @@ bool GHOST_XrSession::attachActionSets()
|
||||
|
||||
/* Attach action sets. */
|
||||
XrSessionActionSetsAttachInfo attach_info{XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO};
|
||||
attach_info.countActionSets = (uint32_t)m_oxr->action_sets.size();
|
||||
attach_info.countActionSets = uint32_t(m_oxr->action_sets.size());
|
||||
|
||||
/* Create an aligned copy of the action sets to pass to xrAttachSessionActionSets(). */
|
||||
std::vector<XrActionSet> action_sets(attach_info.countActionSets);
|
||||
@@ -776,7 +776,7 @@ bool GHOST_XrSession::syncActions(const char *action_set_name)
|
||||
|
||||
XrActionsSyncInfo sync_info{XR_TYPE_ACTIONS_SYNC_INFO};
|
||||
sync_info.countActiveActionSets = (action_set_name != nullptr) ? 1 :
|
||||
(uint32_t)action_sets.size();
|
||||
uint32_t(action_sets.size());
|
||||
if (sync_info.countActiveActionSets < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2387,7 +2387,7 @@ void BKE_brush_scale_size(int *r_brush_size,
|
||||
if (old_unprojected_radius != 0) {
|
||||
scale /= new_unprojected_radius;
|
||||
}
|
||||
(*r_brush_size) = (int)((float)(*r_brush_size) * scale);
|
||||
(*r_brush_size) = int(float(*r_brush_size) * scale);
|
||||
}
|
||||
|
||||
void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2])
|
||||
|
||||
@@ -3085,7 +3085,7 @@ void BKE_curve_bevelList_make(Object *ob, const ListBase *nurbs, const bool for_
|
||||
make_bevel_list_segment_3D(bl);
|
||||
}
|
||||
else {
|
||||
make_bevel_list_3D(bl, (int)(resolu * cu->twist_smooth), cu->twist_mode);
|
||||
make_bevel_list_3D(bl, int(resolu * cu->twist_smooth), cu->twist_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5263,7 +5263,7 @@ static void blend_read_mdisps(BlendDataReader *reader,
|
||||
* overwritten with the correct value in
|
||||
* bm_corners_to_loops() */
|
||||
float gridsize = sqrtf(mdisps[i].totdisp);
|
||||
mdisps[i].level = (int)(logf(gridsize - 1.0f) / (float)M_LN2) + 1;
|
||||
mdisps[i].level = int(logf(gridsize - 1.0f) / float(M_LN2)) + 1;
|
||||
}
|
||||
|
||||
if (BLO_read_requires_endian_switch(reader) && (mdisps[i].disps)) {
|
||||
|
||||
@@ -3861,7 +3861,7 @@ static int generate_arc_from_point_to_point(ListBase *list,
|
||||
/* Number of points is 2^(n+1) + 1 on half a circle (n=subdivisions)
|
||||
* so we multiply by (angle / pi) to get the right amount of
|
||||
* points to insert. */
|
||||
int num_points = (int)(((1 << (subdivisions + 1)) - 1) * (angle / M_PI));
|
||||
int num_points = int(((1 << (subdivisions + 1)) - 1) * (angle / M_PI));
|
||||
if (num_points > 0) {
|
||||
float angle_incr = angle / float(num_points);
|
||||
|
||||
|
||||
@@ -1678,7 +1678,7 @@ void BKE_mesh_normals_loop_split(const MVert *mverts,
|
||||
size_t(numLoops), sizeof(*loop_to_poly), __func__);
|
||||
|
||||
/* When using custom loop normals, disable the angle feature! */
|
||||
const bool check_angle = (split_angle < (float)M_PI) && (clnors_data == nullptr);
|
||||
const bool check_angle = (split_angle < float(M_PI)) && (clnors_data == nullptr);
|
||||
|
||||
MLoopNorSpaceArray _lnors_spacearr = {nullptr};
|
||||
|
||||
@@ -1784,7 +1784,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
||||
/* In this case we always consider split nors as ON,
|
||||
* and do not want to use angle to define smooth fans! */
|
||||
const bool use_split_normals = true;
|
||||
const float split_angle = (float)M_PI;
|
||||
const float split_angle = float(M_PI);
|
||||
|
||||
BLI_SMALLSTACK_DECLARE(clnors_data, short *);
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ void BKE_modifier_copydata_generic(const ModifierData *md_src,
|
||||
const char *md_src_data = ((const char *)md_src) + data_size;
|
||||
char *md_dst_data = ((char *)md_dst) + data_size;
|
||||
BLI_assert(data_size <= (size_t)mti->structSize);
|
||||
memcpy(md_dst_data, md_src_data, (size_t)mti->structSize - data_size);
|
||||
memcpy(md_dst_data, md_src_data, size_t(mti->structSize) - data_size);
|
||||
|
||||
/* Runtime fields are never to be preserved. */
|
||||
md_dst->runtime = nullptr;
|
||||
|
||||
@@ -2331,7 +2331,7 @@ Object *BKE_scene_camera_switch_find(Scene *scene)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const int ctime = (int)BKE_scene_ctime_get(scene);
|
||||
const int ctime = int(BKE_scene_ctime_get(scene));
|
||||
int frame = -(MAXFRAME + 1);
|
||||
int min_frame = MAXFRAME + 1;
|
||||
Object *camera = nullptr;
|
||||
@@ -2872,10 +2872,10 @@ int get_render_child_particle_number(const RenderData *r, int child_num, bool fo
|
||||
{
|
||||
if (r->mode & R_SIMPLIFY) {
|
||||
if (for_render) {
|
||||
return (int)(r->simplify_particles_render * child_num);
|
||||
return int(r->simplify_particles_render * child_num);
|
||||
}
|
||||
|
||||
return (int)(r->simplify_particles * child_num);
|
||||
return int(r->simplify_particles * child_num);
|
||||
}
|
||||
|
||||
return child_num;
|
||||
|
||||
@@ -2191,18 +2191,18 @@ static double insphereadapt(const double *pa,
|
||||
INEXACT double _i, _j;
|
||||
double _0;
|
||||
|
||||
aex = (double)(pa[0] - pe[0]);
|
||||
bex = (double)(pb[0] - pe[0]);
|
||||
cex = (double)(pc[0] - pe[0]);
|
||||
dex = (double)(pd[0] - pe[0]);
|
||||
aey = (double)(pa[1] - pe[1]);
|
||||
bey = (double)(pb[1] - pe[1]);
|
||||
cey = (double)(pc[1] - pe[1]);
|
||||
dey = (double)(pd[1] - pe[1]);
|
||||
aez = (double)(pa[2] - pe[2]);
|
||||
bez = (double)(pb[2] - pe[2]);
|
||||
cez = (double)(pc[2] - pe[2]);
|
||||
dez = (double)(pd[2] - pe[2]);
|
||||
aex = double(pa[0] - pe[0]);
|
||||
bex = double(pb[0] - pe[0]);
|
||||
cex = double(pc[0] - pe[0]);
|
||||
dex = double(pd[0] - pe[0]);
|
||||
aey = double(pa[1] - pe[1]);
|
||||
bey = double(pb[1] - pe[1]);
|
||||
cey = double(pc[1] - pe[1]);
|
||||
dey = double(pd[1] - pe[1]);
|
||||
aez = double(pa[2] - pe[2]);
|
||||
bez = double(pb[2] - pe[2]);
|
||||
cez = double(pc[2] - pe[2]);
|
||||
dez = double(pd[2] - pe[2]);
|
||||
|
||||
Two_Product(aex, bey, aexbey1, aexbey0);
|
||||
Two_Product(bex, aey, bexaey1, bexaey0);
|
||||
|
||||
@@ -5111,12 +5111,12 @@ static void convert_pointer_array_64_to_32(BlendDataReader *reader,
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
uint64_t ptr = src[i];
|
||||
BLI_endian_switch_uint64(&ptr);
|
||||
dst[i] = (uint32_t)(ptr >> 3);
|
||||
dst[i] = uint32_t(ptr >> 3);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
dst[i] = (uint32_t)(src[i] >> 3);
|
||||
dst[i] = uint32_t(src[i] >> 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3034,9 +3034,9 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
||||
gpmd->factor *= 2.0f;
|
||||
}
|
||||
else {
|
||||
gpmd->step = 1 + (int)(gpmd->factor * max_ff(0.0f,
|
||||
min_ff(5.1f * sqrtf(gpmd->step) - 3.0f,
|
||||
gpmd->step + 2.0f)));
|
||||
gpmd->step = 1 + int(gpmd->factor * max_ff(0.0f,
|
||||
min_ff(5.1f * sqrtf(gpmd->step) - 3.0f,
|
||||
gpmd->step + 2.0f)));
|
||||
gpmd->factor = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ static void drw_text_cache_draw_ex(DRWTextStore *dt, ARegion *region)
|
||||
}
|
||||
|
||||
BLF_position(
|
||||
font_id, (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1] + vos->yoffs), 2.0f);
|
||||
font_id, float(vos->sco[0] + vos->xoffs), float(vos->sco[1] + vos->yoffs), 2.0f);
|
||||
BLF_draw(font_id,
|
||||
(vos->flag & DRW_TEXT_CACHE_STRING_PTR) ? *((const char **)vos->str) : vos->str,
|
||||
vos->str_len);
|
||||
@@ -248,7 +248,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
|
||||
if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_INDICES) && (em->selectmode & SCE_SELECT_EDGE)) {
|
||||
edge_tex_count += 1;
|
||||
}
|
||||
const short edge_tex_sep = (short)((edge_tex_count - 1) * 5.0f * U.dpi_fac);
|
||||
const short edge_tex_sep = short((edge_tex_count - 1) * 5.0f * U.dpi_fac);
|
||||
|
||||
/* Make the precision of the display value proportionate to the grid-size. */
|
||||
|
||||
@@ -450,14 +450,14 @@ void DRW_text_edit_mesh_measure_stats(ARegion *region,
|
||||
area += area_tri_v3(v1, v2, v3);
|
||||
}
|
||||
|
||||
mul_v3_fl(vmid, 1.0f / (float)n);
|
||||
mul_v3_fl(vmid, 1.0f / float(n));
|
||||
mul_m4_v3(ob->obmat, vmid);
|
||||
|
||||
if (unit->system) {
|
||||
numstr_len = BKE_unit_value_as_string(
|
||||
numstr,
|
||||
sizeof(numstr),
|
||||
(double)(area * unit->scale_length * unit->scale_length),
|
||||
double(area * unit->scale_length * unit->scale_length),
|
||||
3,
|
||||
B_UNIT_AREA,
|
||||
unit,
|
||||
|
||||
@@ -89,7 +89,7 @@ struct PBVHVbo {
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
sprintf(buf, "%d:%d:%s", (int)type, (int)domain, name.c_str());
|
||||
sprintf(buf, "%d:%d:%s", int(type), int(domain), name.c_str());
|
||||
|
||||
key = string(buf);
|
||||
return key;
|
||||
@@ -382,7 +382,7 @@ struct PBVHBatches {
|
||||
foreach_grids([&](int /*x*/, int /*y*/, int /*grid_index*/, CCGElem *elems[4], int i) {
|
||||
float *mask = CCG_elem_mask(&args->ccg_key, elems[i]);
|
||||
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? (uchar)(*mask * 255.0f) :
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = mask ? uchar(*mask * 255.0f) :
|
||||
255;
|
||||
});
|
||||
break;
|
||||
@@ -536,8 +536,8 @@ struct PBVHBatches {
|
||||
if (mask) {
|
||||
foreach_faces(
|
||||
[&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri * /*tri*/) {
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = (uchar)(mask[vertex_i] *
|
||||
255.0f);
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = uchar(mask[vertex_i] *
|
||||
255.0f);
|
||||
});
|
||||
}
|
||||
else {
|
||||
@@ -757,7 +757,7 @@ struct PBVHBatches {
|
||||
foreach_bmesh([&](BMLoop *l) {
|
||||
float mask = BM_ELEM_CD_GET_FLOAT(l->v, cd_mask);
|
||||
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = (uchar)(mask * 255.0f);
|
||||
*static_cast<uchar *>(GPU_vertbuf_raw_step(&access)) = uchar(mask * 255.0f);
|
||||
});
|
||||
}
|
||||
break;
|
||||
@@ -1154,11 +1154,11 @@ struct PBVHBatches {
|
||||
for (int i : IndexRange(attrs_num)) {
|
||||
PBVHAttrReq *attr = attrs + i;
|
||||
|
||||
if (!has_vbo(attr->domain, (int)attr->type, attr->name)) {
|
||||
create_vbo(attr->domain, (uint32_t)attr->type, attr->name, args);
|
||||
if (!has_vbo(attr->domain, int(attr->type), attr->name)) {
|
||||
create_vbo(attr->domain, uint32_t(attr->type), attr->name, args);
|
||||
}
|
||||
|
||||
PBVHVbo *vbo = get_vbo(attr->domain, (uint32_t)attr->type, attr->name);
|
||||
PBVHVbo *vbo = get_vbo(attr->domain, uint32_t(attr->type), attr->name);
|
||||
int vbo_i = get_vbo_index(vbo);
|
||||
|
||||
batch.vbos.append(vbo_i);
|
||||
|
||||
@@ -5933,7 +5933,7 @@ bContextStore *UI_but_context_get(const uiBut *but)
|
||||
|
||||
void UI_but_unit_type_set(uiBut *but, const int unit_type)
|
||||
{
|
||||
but->unit_type = (uchar)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
|
||||
but->unit_type = uchar(RNA_SUBTYPE_UNIT_VALUE(unit_type));
|
||||
}
|
||||
|
||||
int UI_but_unit_type_get(const uiBut *but)
|
||||
|
||||
@@ -1628,7 +1628,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
|
||||
|
||||
float step;
|
||||
if (sms->time_allowed != 0.0) {
|
||||
step = (float)((v2d->smooth_timer->duration) / sms->time_allowed);
|
||||
step = float((v2d->smooth_timer->duration) / sms->time_allowed);
|
||||
}
|
||||
else {
|
||||
step = 1.0f;
|
||||
@@ -1859,11 +1859,11 @@ static void scroller_activate_init(bContext *C,
|
||||
|
||||
if (in_scroller == 'h') {
|
||||
/* horizontal scroller - calculate adjustment factor first */
|
||||
const float mask_size = (float)BLI_rcti_size_x(&v2d->hor);
|
||||
const float mask_size = float(BLI_rcti_size_x(&v2d->hor));
|
||||
vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size;
|
||||
|
||||
/* pixel rounding */
|
||||
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(®ion->winrct) + 1);
|
||||
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / float(BLI_rcti_size_x(®ion->winrct) + 1);
|
||||
|
||||
/* get 'zone' (i.e. which part of scroller is activated) */
|
||||
vsm->zone = mouse_in_scroller_handle(
|
||||
@@ -1879,11 +1879,11 @@ static void scroller_activate_init(bContext *C,
|
||||
}
|
||||
else {
|
||||
/* vertical scroller - calculate adjustment factor first */
|
||||
const float mask_size = (float)BLI_rcti_size_y(&v2d->vert);
|
||||
const float mask_size = float(BLI_rcti_size_y(&v2d->vert));
|
||||
vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size;
|
||||
|
||||
/* pixel rounding */
|
||||
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(®ion->winrct) + 1);
|
||||
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / float(BLI_rcti_size_y(®ion->winrct) + 1);
|
||||
|
||||
/* get 'zone' (i.e. which part of scroller is activated) */
|
||||
vsm->zone = mouse_in_scroller_handle(
|
||||
@@ -2000,11 +2000,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
|
||||
switch (vsm->scroller) {
|
||||
case 'h': /* horizontal scroller - so only horizontal movement
|
||||
* ('cur' moves opposite to mouse) */
|
||||
vsm->delta = (float)(event->xy[0] - vsm->lastx);
|
||||
vsm->delta = float(event->xy[0] - vsm->lastx);
|
||||
break;
|
||||
case 'v': /* vertical scroller - so only vertical movement
|
||||
* ('cur' moves opposite to mouse) */
|
||||
vsm->delta = (float)(event->xy[1] - vsm->lasty);
|
||||
vsm->delta = float(event->xy[1] - vsm->lasty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2013,11 +2013,11 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e
|
||||
switch (vsm->scroller) {
|
||||
case 'h': /* horizontal scroller - so only horizontal movement
|
||||
* ('cur' moves with mouse) */
|
||||
vsm->delta = (float)(vsm->lastx - event->xy[0]);
|
||||
vsm->delta = float(vsm->lastx - event->xy[0]);
|
||||
break;
|
||||
case 'v': /* vertical scroller - so only vertical movement
|
||||
* ('cur' moves with to mouse) */
|
||||
vsm->delta = (float)(vsm->lasty - event->xy[1]);
|
||||
vsm->delta = float(vsm->lasty - event->xy[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2080,11 +2080,11 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, const wmEvent *
|
||||
switch (vsm->scroller) {
|
||||
case 'h': /* horizontal scroller - so only horizontal movement
|
||||
* ('cur' moves opposite to mouse) */
|
||||
vsm->delta = (float)(event->xy[0] - vsm->scrollbar_orig);
|
||||
vsm->delta = float(event->xy[0] - vsm->scrollbar_orig);
|
||||
break;
|
||||
case 'v': /* vertical scroller - so only vertical movement
|
||||
* ('cur' moves opposite to mouse) */
|
||||
vsm->delta = (float)(event->xy[1] - vsm->scrollbar_orig);
|
||||
vsm->delta = float(event->xy[1] - vsm->scrollbar_orig);
|
||||
break;
|
||||
}
|
||||
scroller_activate_apply(C, op);
|
||||
@@ -2177,8 +2177,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
const int snap_test = ED_region_snap_size_test(region);
|
||||
|
||||
/* zoom 1.0 */
|
||||
const int winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1);
|
||||
const int winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1);
|
||||
const int winx = float(BLI_rcti_size_x(&v2d->mask) + 1);
|
||||
const int winy = float(BLI_rcti_size_y(&v2d->mask) + 1);
|
||||
|
||||
v2d->cur.xmax = v2d->cur.xmin + winx;
|
||||
v2d->cur.ymax = v2d->cur.ymin + winy;
|
||||
|
||||
@@ -399,7 +399,7 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
|
||||
sco1 = SCULPT_vertex_co_get(ss, vertex);
|
||||
}
|
||||
else {
|
||||
sco1 /= (float)sco1_len;
|
||||
sco1 /= float(sco1_len);
|
||||
len1_sum /= sco1_len;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ static void sculpt_calc_blurred_cavity(SculptSession *ss,
|
||||
sco2 = SCULPT_vertex_co_get(ss, vertex);
|
||||
}
|
||||
else {
|
||||
sco2 /= (float)sco2_len;
|
||||
sco2 /= float(sco2_len);
|
||||
}
|
||||
|
||||
normalize_v3(sno1);
|
||||
@@ -448,8 +448,8 @@ int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking)
|
||||
for (int i = 0; i < cm->totpoint; i++) {
|
||||
hash = BLI_hash_int_2d(hash, *reinterpret_cast<uint *>(&cm->curve[i].x));
|
||||
hash = BLI_hash_int_2d(hash, *reinterpret_cast<uint *>(&cm->curve[i].y));
|
||||
hash = BLI_hash_int_2d(hash, (uint)cm->curve[i].flag);
|
||||
hash = BLI_hash_int_2d(hash, (uint)cm->curve[i].shorty);
|
||||
hash = BLI_hash_int_2d(hash, uint(cm->curve[i].flag));
|
||||
hash = BLI_hash_int_2d(hash, uint(cm->curve[i].shorty));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -778,11 +778,11 @@ static void sculpt_normal_occlusion_automasking_fill(AutomaskingCache *automaski
|
||||
|
||||
float f = *(float *)SCULPT_vertex_attr_get(vertex, ss->attrs.automasking_factor);
|
||||
|
||||
if ((int)mode & BRUSH_AUTOMASKING_BRUSH_NORMAL) {
|
||||
if (int(mode) & BRUSH_AUTOMASKING_BRUSH_NORMAL) {
|
||||
f *= automasking_brush_normal_factor(automasking, ss, vertex, &nodedata);
|
||||
}
|
||||
if ((int)mode & BRUSH_AUTOMASKING_VIEW_NORMAL) {
|
||||
if ((int)mode & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
|
||||
if (int(mode) & BRUSH_AUTOMASKING_VIEW_NORMAL) {
|
||||
if (int(mode) & BRUSH_AUTOMASKING_VIEW_OCCLUSION) {
|
||||
f *= automasking_view_occlusion_factor(automasking, ss, vertex, -1, &nodedata);
|
||||
}
|
||||
|
||||
|
||||
@@ -3605,8 +3605,8 @@ static void outliner_draw_struct_marks(ARegion *region,
|
||||
immThemeColorShadeAlpha(TH_BACK, -15, -200);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2f(pos, 0, (float)*starty + UI_UNIT_Y);
|
||||
immVertex2f(pos, region->v2d.cur.xmax, (float)*starty + UI_UNIT_Y);
|
||||
immVertex2f(pos, 0, float(*starty) + UI_UNIT_Y);
|
||||
immVertex2f(pos, region->v2d.cur.xmax, float(*starty) + UI_UNIT_Y);
|
||||
immEnd();
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
@@ -122,8 +122,8 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
|
||||
else {
|
||||
float rect_scale[2];
|
||||
if (rect) {
|
||||
rect_scale[0] = (float)BLI_rcti_size_x(rect) / (float)region->winx;
|
||||
rect_scale[1] = (float)BLI_rcti_size_y(rect) / (float)region->winy;
|
||||
rect_scale[0] = float(BLI_rcti_size_x(rect)) / float(region->winx);
|
||||
rect_scale[1] = float(BLI_rcti_size_y(rect)) / float(region->winy);
|
||||
}
|
||||
/* NOTE: calls BKE_object_where_is_calc for camera... */
|
||||
view3d_viewmatrix_set(depsgraph, scene, v3d, rv3d, rect ? rect_scale : nullptr);
|
||||
@@ -139,11 +139,11 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
|
||||
if (!offscreen && rv3d->persp == RV3D_CAMOB && v3d->camera) {
|
||||
rctf cameraborder;
|
||||
ED_view3d_calc_camera_border(scene, depsgraph, region, v3d, rv3d, &cameraborder, false);
|
||||
rv3d->viewcamtexcofac[0] = (float)region->winx / BLI_rctf_size_x(&cameraborder);
|
||||
rv3d->viewcamtexcofac[1] = (float)region->winy / BLI_rctf_size_y(&cameraborder);
|
||||
rv3d->viewcamtexcofac[0] = float(region->winx) / BLI_rctf_size_x(&cameraborder);
|
||||
rv3d->viewcamtexcofac[1] = float(region->winy) / BLI_rctf_size_y(&cameraborder);
|
||||
|
||||
rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / (float)region->winx;
|
||||
rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / (float)region->winy;
|
||||
rv3d->viewcamtexcofac[2] = -rv3d->viewcamtexcofac[0] * cameraborder.xmin / float(region->winx);
|
||||
rv3d->viewcamtexcofac[3] = -rv3d->viewcamtexcofac[1] * cameraborder.ymin / float(region->winy);
|
||||
}
|
||||
else {
|
||||
rv3d->viewcamtexcofac[0] = rv3d->viewcamtexcofac[1] = 1.0f;
|
||||
@@ -168,10 +168,10 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
|
||||
len_px = 2.0f / sqrtf(min_ff(len_squared_v3(v1), len_squared_v3(v2)));
|
||||
|
||||
if (rect) {
|
||||
len_sc = (float)max_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
|
||||
len_sc = float(max_ii(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)));
|
||||
}
|
||||
else {
|
||||
len_sc = (float)MAX2(region->winx, region->winy);
|
||||
len_sc = float(MAX2(region->winx, region->winy));
|
||||
}
|
||||
|
||||
rv3d->pixsize = len_px / len_sc;
|
||||
@@ -561,10 +561,10 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region,
|
||||
* obscures the 3D camera border */
|
||||
/* NOTE: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable
|
||||
* but keep it here in case we need to remove the workaround */
|
||||
x1i = (int)(x1 - 1.0001f);
|
||||
y1i = (int)(y1 - 1.0001f);
|
||||
x2i = (int)(x2 + (1.0f - 0.0001f));
|
||||
y2i = (int)(y2 + (1.0f - 0.0001f));
|
||||
x1i = int(x1 - 1.0001f);
|
||||
y1i = int(y1 - 1.0001f);
|
||||
x2i = int(x2 + (1.0f - 0.0001f));
|
||||
y2i = int(y2 + (1.0f - 0.0001f));
|
||||
|
||||
uint shdr_pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
@@ -843,7 +843,7 @@ float ED_scene_grid_scale(const Scene *scene, const char **r_grid_unit)
|
||||
if (r_grid_unit) {
|
||||
*r_grid_unit = BKE_unit_display_name_get(usys, i);
|
||||
}
|
||||
return (float)BKE_unit_scalar_get(usys, i) / scene->unit.scale_length;
|
||||
return float(BKE_unit_scalar_get(usys, i)) / scene->unit.scale_length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ void ED_view3d_grid_steps(const Scene *scene,
|
||||
|
||||
int i;
|
||||
for (i = 0; i < len; i++) {
|
||||
r_grid_steps[i] = (float)BKE_unit_scalar_get(usys, len - 1 - i) * grid_scale;
|
||||
r_grid_steps[i] = float(BKE_unit_scalar_get(usys, len - 1 - i)) * grid_scale;
|
||||
}
|
||||
for (; i < STEPS_LEN; i++) {
|
||||
/* Fill last slots */
|
||||
@@ -1063,7 +1063,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d)
|
||||
# define ROT_AXIS_DETAIL 13
|
||||
|
||||
const float s = 0.05f * scale;
|
||||
const float step = 2.0f * (float)(M_PI / ROT_AXIS_DETAIL);
|
||||
const float step = 2.0f * float(M_PI / ROT_AXIS_DETAIL);
|
||||
|
||||
float q[4]; /* rotate ring so it's perpendicular to axis */
|
||||
const int upright = fabsf(rv3d->rot_axis[2]) >= 0.95f;
|
||||
@@ -1386,7 +1386,7 @@ static void draw_selected_name(
|
||||
|
||||
/* color depends on whether there is a keyframe */
|
||||
if (id_frame_has_keyframe(
|
||||
(ID *)ob, /* BKE_scene_ctime_get(scene) */ (float)cfra, ANIMFILTER_KEYS_LOCAL)) {
|
||||
(ID *)ob, /* BKE_scene_ctime_get(scene) */ float(cfra), ANIMFILTER_KEYS_LOCAL)) {
|
||||
UI_FontThemeColor(font_id, TH_TIME_KEYFRAME);
|
||||
}
|
||||
else if (ED_gpencil_has_keyframe_v3d(scene, ob, cfra)) {
|
||||
@@ -2216,7 +2216,7 @@ void ED_view3d_select_id_validate(ViewContext *vc)
|
||||
|
||||
int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist)
|
||||
{
|
||||
return (int)min_ff(ceilf(dist), (float)max_ii(region->winx, region->winx));
|
||||
return int(min_ff(ceilf(dist), float(max_ii(region->winx, region->winx))));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -2281,7 +2281,7 @@ static ViewDepths *view3d_depths_create(ARegion *region)
|
||||
/* Convert in-place. */
|
||||
int pixel_count = d->w * d->h;
|
||||
for (int i = 0; i < pixel_count; i++) {
|
||||
d->depths[i] = (int_depths[i] >> 8u) / (float)0xFFFFFF;
|
||||
d->depths[i] = (int_depths[i] >> 8u) / float(0xFFFFFF);
|
||||
}
|
||||
/* Assumed to be this as they are never changed. */
|
||||
d->depth_range[0] = 0.0;
|
||||
@@ -2293,13 +2293,13 @@ static ViewDepths *view3d_depths_create(ARegion *region)
|
||||
float view3d_depth_near(ViewDepths *d)
|
||||
{
|
||||
/* Convert to float for comparisons. */
|
||||
const float near = (float)d->depth_range[0];
|
||||
const float far_real = (float)d->depth_range[1];
|
||||
const float near = float(d->depth_range[0]);
|
||||
const float far_real = float(d->depth_range[1]);
|
||||
float far = far_real;
|
||||
|
||||
const float *depths = d->depths;
|
||||
float depth = FLT_MAX;
|
||||
int i = (int)d->w * (int)d->h; /* Cast to avoid short overflow. */
|
||||
int i = int(d->w) * int(d->h); /* Cast to avoid short overflow. */
|
||||
|
||||
/* Far is both the starting 'far' value
|
||||
* and the closest value found. */
|
||||
@@ -2515,8 +2515,8 @@ void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
|
||||
printable[0] = '\0';
|
||||
|
||||
/* Doing an average for a more robust calculation. */
|
||||
fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0 /
|
||||
(fpsi->lredrawtime - fpsi->redrawtime));
|
||||
fpsi->redrawtimes_fps[fpsi->redrawtime_index] = float(1.0 /
|
||||
(fpsi->lredrawtime - fpsi->redrawtime));
|
||||
|
||||
float fps = 0.0f;
|
||||
int tot = 0;
|
||||
@@ -2534,13 +2534,13 @@ void ED_scene_draw_fps(const Scene *scene, int xoffset, int *yoffset)
|
||||
const int font_id = BLF_default();
|
||||
|
||||
/* Is this more than half a frame behind? */
|
||||
if (fps + 0.5f < (float)(FPS)) {
|
||||
if (fps + 0.5f < float(FPS)) {
|
||||
UI_FontThemeColor(font_id, TH_REDALERT);
|
||||
BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %.2f"), fps);
|
||||
}
|
||||
else {
|
||||
UI_FontThemeColor(font_id, TH_TEXT_HI);
|
||||
BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f));
|
||||
BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), int(fps + 0.5f));
|
||||
}
|
||||
|
||||
BLF_enable(font_id, BLF_SHADOW);
|
||||
|
||||
@@ -388,13 +388,13 @@ void IndexBuf::squeeze_indices_short(uint min_idx,
|
||||
0xFFFFu :
|
||||
(max_idx - min_idx);
|
||||
for (uint i = 0; i < index_len_; i++) {
|
||||
ushort_idx[i] = (uint16_t)MIN2(clamp_max_idx, uint_idx[i] - min_idx);
|
||||
ushort_idx[i] = uint16_t(MIN2(clamp_max_idx, uint_idx[i] - min_idx));
|
||||
}
|
||||
}
|
||||
else {
|
||||
index_base_ = 0;
|
||||
for (uint i = 0; i < index_len_; i++) {
|
||||
ushort_idx[i] = (uint16_t)(uint_idx[i]);
|
||||
ushort_idx[i] = uint16_t(uint_idx[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
const MDeformVert *dvert;
|
||||
int defgrp_index;
|
||||
float ctime = DEG_get_ctime(ctx->depsgraph);
|
||||
float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow));
|
||||
float minfac = float(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow));
|
||||
float lifefac = wmd->height;
|
||||
float(*tex_co)[3] = nullptr;
|
||||
const int wmd_axis = wmd->flag & (MOD_WAVE_X | MOD_WAVE_Y);
|
||||
@@ -175,7 +175,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
lifefac = 0.0;
|
||||
}
|
||||
else {
|
||||
lifefac = (float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp)));
|
||||
lifefac = float(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
amplit -= (ctime - wmd->timeoffs) * wmd->speed;
|
||||
|
||||
if (wmd->flag & MOD_WAVE_CYCL) {
|
||||
amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width) + wmd->width;
|
||||
amplit = float(fmodf(amplit - wmd->width, 2.0f * wmd->width)) + wmd->width;
|
||||
}
|
||||
|
||||
if (falloff != 0.0f) {
|
||||
@@ -252,7 +252,7 @@ static void waveModifier_do(WaveModifierData *md,
|
||||
/* GAUSSIAN */
|
||||
if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) {
|
||||
amplit = amplit * wmd->narrow;
|
||||
amplit = (float)(1.0f / expf(amplit * amplit) - minfac);
|
||||
amplit = float(1.0f / expf(amplit * amplit) - minfac);
|
||||
|
||||
/* Apply texture. */
|
||||
if (tex_co) {
|
||||
|
||||
Reference in New Issue
Block a user