Cleanup: replace C-style casts with functional casts for numeric types
Use function style casts in C++ headers & source.
This commit is contained in:
@@ -320,7 +320,7 @@ GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut)
|
||||
|
||||
::glXQueryDrawable(m_display, m_window, GLX_SWAP_INTERVAL_EXT, &interval);
|
||||
|
||||
intervalOut = static_cast<int>(interval);
|
||||
intervalOut = int(interval);
|
||||
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
||||
@@ -528,7 +528,7 @@ void *GHOST_XrActionSet::getCustomdata()
|
||||
|
||||
uint32_t GHOST_XrActionSet::getActionCount() const
|
||||
{
|
||||
return (uint32_t)m_actions.size();
|
||||
return uint32_t(m_actions.size());
|
||||
}
|
||||
|
||||
void GHOST_XrActionSet::getActionCustomdataArray(void **r_customdata_array)
|
||||
|
||||
@@ -151,7 +151,7 @@ template<typename Mesh> class Mikktspace {
|
||||
|
||||
void genTangSpace()
|
||||
{
|
||||
nrFaces = (uint)mesh.GetNumFaces();
|
||||
nrFaces = uint(mesh.GetNumFaces());
|
||||
|
||||
#ifdef WITH_TBB
|
||||
nrThreads = tbb::this_task_arena::max_concurrency();
|
||||
@@ -276,7 +276,7 @@ template<typename Mesh> class Mikktspace {
|
||||
if (verts != 3 && verts != 4)
|
||||
continue;
|
||||
|
||||
uint tA = (uint)triangles.size();
|
||||
uint tA = uint(triangles.size());
|
||||
triangles.emplace_back(f, nrTSpaces);
|
||||
Triangle &triA = triangles[tA];
|
||||
|
||||
@@ -284,7 +284,7 @@ template<typename Mesh> class Mikktspace {
|
||||
triA.setVertices(0, 1, 2);
|
||||
}
|
||||
else {
|
||||
uint tB = (uint)triangles.size();
|
||||
uint tB = uint(triangles.size());
|
||||
triangles.emplace_back(f, nrTSpaces);
|
||||
Triangle &triB = triangles[tB];
|
||||
|
||||
@@ -731,7 +731,7 @@ template<typename Mesh> class Mikktspace {
|
||||
continue;
|
||||
}
|
||||
|
||||
const uint newGroupId = (uint)groups.size();
|
||||
const uint newGroupId = uint(groups.size());
|
||||
triangle.group[i] = newGroupId;
|
||||
|
||||
groups.emplace_back(triangle.vertices[i], bool(triangle.orientPreserving));
|
||||
|
||||
@@ -316,7 +316,7 @@ void SKY_nishita_skymodel_precompute_texture(float *pixels,
|
||||
|
||||
for (int y = start_y; y < end_y; y++) {
|
||||
/* sample more pixels toward the horizon */
|
||||
float latitude = (M_PI_2_F + half_lat_step) * sqr((float)y / height);
|
||||
float latitude = (M_PI_2_F + half_lat_step) * sqr(float(y) / height);
|
||||
|
||||
float *pixel_row = pixels + (y * width * stride);
|
||||
for (int x = 0; x < half_width; x++) {
|
||||
|
||||
@@ -60,12 +60,12 @@ template<> inline bool mix2(const float factor, const bool &a, const bool &b)
|
||||
|
||||
template<> inline int8_t mix2(const float factor, const int8_t &a, const int8_t &b)
|
||||
{
|
||||
return static_cast<int8_t>(std::round((1.0f - factor) * a + factor * b));
|
||||
return int8_t(std::round((1.0f - factor) * a + factor * b));
|
||||
}
|
||||
|
||||
template<> inline int mix2(const float factor, const int &a, const int &b)
|
||||
{
|
||||
return static_cast<int>(std::round((1.0f - factor) * a + factor * b));
|
||||
return int(std::round((1.0f - factor) * a + factor * b));
|
||||
}
|
||||
|
||||
template<> inline float mix2(const float factor, const float &a, const float &b)
|
||||
@@ -108,7 +108,7 @@ template<typename T> T mix3(const float3 &weights, const T &v0, const T &v1, con
|
||||
template<>
|
||||
inline int8_t mix3(const float3 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2)
|
||||
{
|
||||
return static_cast<int8_t>(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
|
||||
return int8_t(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
|
||||
}
|
||||
|
||||
template<> inline bool mix3(const float3 &weights, const bool &v0, const bool &v1, const bool &v2)
|
||||
@@ -118,7 +118,7 @@ template<> inline bool mix3(const float3 &weights, const bool &v0, const bool &v
|
||||
|
||||
template<> inline int mix3(const float3 &weights, const int &v0, const int &v1, const int &v2)
|
||||
{
|
||||
return static_cast<int>(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
|
||||
return int(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2));
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -160,10 +160,8 @@ inline ColorGeometry4b mix3(const float3 &weights,
|
||||
const float4 v1_f{&v1.r};
|
||||
const float4 v2_f{&v2.r};
|
||||
const float4 mixed = v0_f * weights[0] + v1_f * weights[1] + v2_f * weights[2];
|
||||
return ColorGeometry4b{static_cast<uint8_t>(mixed[0]),
|
||||
static_cast<uint8_t>(mixed[1]),
|
||||
static_cast<uint8_t>(mixed[2]),
|
||||
static_cast<uint8_t>(mixed[3])};
|
||||
return ColorGeometry4b{
|
||||
uint8_t(mixed[0]), uint8_t(mixed[1]), uint8_t(mixed[2]), uint8_t(mixed[3])};
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -180,8 +178,7 @@ template<>
|
||||
inline int8_t mix4(
|
||||
const float4 &weights, const int8_t &v0, const int8_t &v1, const int8_t &v2, const int8_t &v3)
|
||||
{
|
||||
return static_cast<int8_t>(
|
||||
std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
|
||||
return int8_t(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -194,8 +191,7 @@ inline bool mix4(
|
||||
template<>
|
||||
inline int mix4(const float4 &weights, const int &v0, const int &v1, const int &v2, const int &v3)
|
||||
{
|
||||
return static_cast<int>(
|
||||
std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
|
||||
return int(std::round(weights.x * v0 + weights.y * v1 + weights.z * v2 + weights.w * v3));
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -244,10 +240,8 @@ inline ColorGeometry4b mix4(const float4 &weights,
|
||||
const float4 v3_f{&v3.r};
|
||||
float4 mixed;
|
||||
interp_v4_v4v4v4v4(mixed, v0_f, v1_f, v2_f, v3_f, weights);
|
||||
return ColorGeometry4b{static_cast<uint8_t>(mixed[0]),
|
||||
static_cast<uint8_t>(mixed[1]),
|
||||
static_cast<uint8_t>(mixed[2]),
|
||||
static_cast<uint8_t>(mixed[3])};
|
||||
return ColorGeometry4b{
|
||||
uint8_t(mixed[0]), uint8_t(mixed[1]), uint8_t(mixed[2]), uint8_t(mixed[3])};
|
||||
}
|
||||
|
||||
/** \} */
|
||||
@@ -523,7 +517,7 @@ template<> struct DefaultMixerStruct<ColorGeometry4b> {
|
||||
template<> struct DefaultMixerStruct<int> {
|
||||
static int double_to_int(const double &value)
|
||||
{
|
||||
return static_cast<int>(std::round(value));
|
||||
return int(std::round(value));
|
||||
}
|
||||
/* Store interpolated ints in a double temporarily, so that weights are handled correctly. It
|
||||
* uses double instead of float so that it is accurate for all 32 bit integers. */
|
||||
@@ -542,7 +536,7 @@ template<> struct DefaultMixerStruct<bool> {
|
||||
template<> struct DefaultMixerStruct<int8_t> {
|
||||
static int8_t float_to_int8_t(const float &value)
|
||||
{
|
||||
return static_cast<int8_t>(std::round(value));
|
||||
return int8_t(std::round(value));
|
||||
}
|
||||
/* Store interpolated 8 bit integers in a float temporarily to increase accuracy. */
|
||||
using type = SimpleMixerWithAccumulationType<int8_t, float, float_to_int8_t>;
|
||||
|
||||
@@ -79,8 +79,8 @@ struct CryptomatteHash {
|
||||
{
|
||||
uint32_t mantissa = hash & ((1 << 23) - 1);
|
||||
uint32_t exponent = (hash >> 23) & ((1 << 8) - 1);
|
||||
exponent = MAX2(exponent, (uint32_t)1);
|
||||
exponent = MIN2(exponent, (uint32_t)254);
|
||||
exponent = MAX2(exponent, uint32_t(1));
|
||||
exponent = MIN2(exponent, uint32_t(254));
|
||||
exponent = exponent << 23;
|
||||
uint32_t sign = (hash >> 31);
|
||||
sign = sign << 31;
|
||||
|
||||
@@ -986,7 +986,7 @@ inline bool has_vector_handles(const int num_curve_points,
|
||||
const bool cyclic,
|
||||
const int resolution)
|
||||
{
|
||||
return evaluated_size - !cyclic != (int64_t)segments_num(num_curve_points, cyclic) * resolution;
|
||||
return evaluated_size - !cyclic != int64_t(segments_num(num_curve_points, cyclic)) * resolution;
|
||||
}
|
||||
|
||||
inline float3 calculate_vector_handle(const float3 &point, const float3 &next_point)
|
||||
|
||||
@@ -1084,8 +1084,7 @@ static void subdiv_mesh_vertex_of_loose_edge_interpolate(SubdivMeshContext *ctx,
|
||||
BLI_assert(u > 0.0f);
|
||||
BLI_assert(u < 1.0f);
|
||||
const float interpolation_weights[2] = {1.0f - u, u};
|
||||
const int coarse_vertex_indices[2] = {static_cast<int>(coarse_edge->v1),
|
||||
static_cast<int>(coarse_edge->v2)};
|
||||
const int coarse_vertex_indices[2] = {int(coarse_edge->v1), int(coarse_edge->v2)};
|
||||
CustomData_interp(&coarse_mesh->vdata,
|
||||
&subdiv_mesh->vdata,
|
||||
coarse_vertex_indices,
|
||||
|
||||
@@ -297,7 +297,7 @@ class CPPType : NonCopyable, NonMovable {
|
||||
*/
|
||||
bool pointer_has_valid_alignment(const void *ptr) const
|
||||
{
|
||||
return ((uintptr_t)ptr & alignment_mask_) == 0;
|
||||
return (uintptr_t(ptr) & alignment_mask_) == 0;
|
||||
}
|
||||
|
||||
bool pointer_can_point_to_instance(const void *ptr) const
|
||||
|
||||
@@ -271,7 +271,7 @@ CPPType::CPPType(CPPTypeParam<T, Flags> /* unused */, StringRef debug_name)
|
||||
is_equal_ = is_equal_cb<T>;
|
||||
}
|
||||
|
||||
alignment_mask_ = (uintptr_t)alignment_ - (uintptr_t)1;
|
||||
alignment_mask_ = uintptr_t(alignment_) - uintptr_t(1);
|
||||
has_special_member_functions_ = (default_construct_ && copy_construct_ && copy_assign_ &&
|
||||
move_construct_ && move_assign_ && destruct_);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class Cluster {
|
||||
|
||||
std::string name() const
|
||||
{
|
||||
return "cluster_" + std::to_string((uintptr_t)this);
|
||||
return "cluster_" + std::to_string(uintptr_t(this));
|
||||
}
|
||||
|
||||
void set_parent_cluster(Cluster *new_parent);
|
||||
|
||||
@@ -225,17 +225,17 @@ template<typename Pointer> struct PointerKeyInfo {
|
||||
|
||||
static bool is_empty(Pointer pointer)
|
||||
{
|
||||
return (uintptr_t)pointer == UINTPTR_MAX;
|
||||
return uintptr_t(pointer) == UINTPTR_MAX;
|
||||
}
|
||||
|
||||
static bool is_removed(Pointer pointer)
|
||||
{
|
||||
return (uintptr_t)pointer == UINTPTR_MAX - 1;
|
||||
return uintptr_t(pointer) == UINTPTR_MAX - 1;
|
||||
}
|
||||
|
||||
static bool is_not_empty_or_removed(Pointer pointer)
|
||||
{
|
||||
return (uintptr_t)pointer < UINTPTR_MAX - 1;
|
||||
return uintptr_t(pointer) < UINTPTR_MAX - 1;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
|
||||
Span<char> buffer = unused_borrowed_buffers_[i];
|
||||
if (buffer.size() >= min_allocation_size) {
|
||||
unused_borrowed_buffers_.remove_and_reorder(i);
|
||||
current_begin_ = (uintptr_t)buffer.begin();
|
||||
current_end_ = (uintptr_t)buffer.end();
|
||||
current_begin_ = uintptr_t(buffer.begin());
|
||||
current_end_ = uintptr_t(buffer.end());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya
|
||||
|
||||
void *buffer = allocator_.allocate(size_in_bytes, min_alignment, __func__);
|
||||
owned_buffers_.append(buffer);
|
||||
current_begin_ = (uintptr_t)buffer;
|
||||
current_begin_ = uintptr_t(buffer);
|
||||
current_end_ = current_begin_ + size_in_bytes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1314,7 +1314,7 @@ template<typename Key, typename Value> class StdUnorderedMapWrapper {
|
||||
|
||||
bool remove(const Key &key)
|
||||
{
|
||||
return (bool)map_.erase(key);
|
||||
return bool(map_.erase(key));
|
||||
}
|
||||
|
||||
Value &lookup(const Key &key)
|
||||
|
||||
@@ -366,7 +366,7 @@ template<typename T, BLI_ENABLE_IF((is_math_float_type<T>))>
|
||||
inline vec_base<T, 3> cross_poly(Span<vec_base<T, 3>> poly)
|
||||
{
|
||||
/* Newell's Method. */
|
||||
int nv = static_cast<int>(poly.size());
|
||||
int nv = int(poly.size());
|
||||
if (nv < 3) {
|
||||
return vec_base<T, 3>(0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ template<size_t Size, size_t Alignment> class AlignedBuffer {
|
||||
*/
|
||||
template<typename T, int64_t Size = 1> class TypedBuffer {
|
||||
private:
|
||||
BLI_NO_UNIQUE_ADDRESS AlignedBuffer<sizeof(T) * (size_t)Size, alignof(T)> buffer_;
|
||||
BLI_NO_UNIQUE_ADDRESS AlignedBuffer<sizeof(T) * size_t(Size), alignof(T)> buffer_;
|
||||
|
||||
public:
|
||||
operator T *()
|
||||
|
||||
@@ -917,7 +917,7 @@ template<typename Key> class StdUnorderedSetWrapper {
|
||||
|
||||
bool remove(const Key &key)
|
||||
{
|
||||
return (bool)set_.erase(key);
|
||||
return bool(set_.erase(key));
|
||||
}
|
||||
|
||||
void remove_contained(const Key &key)
|
||||
|
||||
@@ -585,7 +585,7 @@ inline std::ostream &operator<<(std::ostream &stream, StringRef ref)
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &stream, StringRefNull ref)
|
||||
{
|
||||
stream << std::string(ref.data(), (size_t)ref.size());
|
||||
stream << std::string(ref.data(), size_t(ref.size()));
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ constexpr bool operator==(StringRef a, StringRef b)
|
||||
/* This also avoids passing null to the call below, which would results in an ASAN warning. */
|
||||
return true;
|
||||
}
|
||||
return STREQLEN(a.data(), b.data(), (size_t)a.size());
|
||||
return STREQLEN(a.data(), b.data(), size_t(a.size()));
|
||||
}
|
||||
|
||||
constexpr bool operator!=(StringRef a, StringRef b)
|
||||
|
||||
@@ -87,7 +87,7 @@ class ExceptionThrower {
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return static_cast<uint64_t>(value);
|
||||
return uint64_t(value);
|
||||
}
|
||||
|
||||
friend bool operator==(const ExceptionThrower &a, const ExceptionThrower &b)
|
||||
|
||||
@@ -317,7 +317,7 @@ TEST(vector, BecomeLarge)
|
||||
}
|
||||
EXPECT_EQ(vec.size(), 100);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
EXPECT_EQ(vec[i], static_cast<int>(i * 5));
|
||||
EXPECT_EQ(vec[i], int(i * 5));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1130,7 +1130,7 @@ static void do_fillGradientBuffer(uint rw,
|
||||
dmin = ud; /* Set a new minimum equal to the new lower value. */
|
||||
}
|
||||
}
|
||||
odist = (float)(dmin); /* Cast outer min to a float. */
|
||||
odist = float(dmin); /* Cast outer min to a float. */
|
||||
rsf = odist * 0.5f;
|
||||
rsl = *(uint *)&odist; /* Use some peculiar properties of the way bits are stored. */
|
||||
rsl = 0x5f3759df - (rsl >> 1); /* In floats vs. uints to compute an approximate. */
|
||||
@@ -1151,7 +1151,7 @@ static void do_fillGradientBuffer(uint rw,
|
||||
}
|
||||
|
||||
/* Cast inner min to a float. */
|
||||
idist = (float)(dmin);
|
||||
idist = float(dmin);
|
||||
rsf = idist * 0.5f;
|
||||
rsl = *(uint *)&idist;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ struct MaterialKey {
|
||||
uint64_t hash() const
|
||||
{
|
||||
BLI_assert(options < sizeof(*mat));
|
||||
return (uint64_t)mat + options;
|
||||
return uint64_t(mat) + options;
|
||||
}
|
||||
|
||||
bool operator<(const MaterialKey &k) const
|
||||
@@ -154,7 +154,7 @@ struct ShaderKey {
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return (uint64_t)shader + options;
|
||||
return uint64_t(shader) + options;
|
||||
}
|
||||
|
||||
bool operator<(const ShaderKey &k) const
|
||||
|
||||
@@ -243,8 +243,8 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
|
||||
do_partial_update_float_buffer(tile_buffer, iterator);
|
||||
}
|
||||
|
||||
const float tile_width = static_cast<float>(iterator.tile_data.tile_buffer->x);
|
||||
const float tile_height = static_cast<float>(iterator.tile_data.tile_buffer->y);
|
||||
const float tile_width = float(iterator.tile_data.tile_buffer->x);
|
||||
const float tile_height = float(iterator.tile_data.tile_buffer->y);
|
||||
|
||||
for (int i = 0; i < SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN; i++) {
|
||||
const TextureInfo &info = instance_data.texture_infos[i];
|
||||
@@ -260,23 +260,20 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
|
||||
const float texture_height = GPU_texture_height(texture);
|
||||
/* TODO: early bound check. */
|
||||
ImageTileWrapper tile_accessor(iterator.tile_data.tile);
|
||||
float tile_offset_x = static_cast<float>(tile_accessor.get_tile_x_offset());
|
||||
float tile_offset_y = static_cast<float>(tile_accessor.get_tile_y_offset());
|
||||
float tile_offset_x = float(tile_accessor.get_tile_x_offset());
|
||||
float tile_offset_y = float(tile_accessor.get_tile_y_offset());
|
||||
rcti *changed_region_in_texel_space = &iterator.changed_region.region;
|
||||
rctf changed_region_in_uv_space;
|
||||
BLI_rctf_init(&changed_region_in_uv_space,
|
||||
static_cast<float>(changed_region_in_texel_space->xmin) /
|
||||
static_cast<float>(iterator.tile_data.tile_buffer->x) +
|
||||
tile_offset_x,
|
||||
static_cast<float>(changed_region_in_texel_space->xmax) /
|
||||
static_cast<float>(iterator.tile_data.tile_buffer->x) +
|
||||
tile_offset_x,
|
||||
static_cast<float>(changed_region_in_texel_space->ymin) /
|
||||
static_cast<float>(iterator.tile_data.tile_buffer->y) +
|
||||
tile_offset_y,
|
||||
static_cast<float>(changed_region_in_texel_space->ymax) /
|
||||
static_cast<float>(iterator.tile_data.tile_buffer->y) +
|
||||
tile_offset_y);
|
||||
BLI_rctf_init(
|
||||
&changed_region_in_uv_space,
|
||||
float(changed_region_in_texel_space->xmin) / float(iterator.tile_data.tile_buffer->x) +
|
||||
tile_offset_x,
|
||||
float(changed_region_in_texel_space->xmax) / float(iterator.tile_data.tile_buffer->x) +
|
||||
tile_offset_x,
|
||||
float(changed_region_in_texel_space->ymin) / float(iterator.tile_data.tile_buffer->y) +
|
||||
tile_offset_y,
|
||||
float(changed_region_in_texel_space->ymax) / float(iterator.tile_data.tile_buffer->y) +
|
||||
tile_offset_y);
|
||||
rctf changed_overlapping_region_in_uv_space;
|
||||
const bool region_overlap = BLI_rctf_isect(&info.clipping_uv_bounds,
|
||||
&changed_region_in_uv_space,
|
||||
@@ -423,8 +420,8 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
|
||||
* transformation. */
|
||||
float uv_to_texel[4][4];
|
||||
copy_m4_m4(uv_to_texel, instance_data.ss_to_texture);
|
||||
float scale[3] = {static_cast<float>(texture_width) / static_cast<float>(tile_buffer.x),
|
||||
static_cast<float>(texture_height) / static_cast<float>(tile_buffer.y),
|
||||
float scale[3] = {float(texture_width) / float(tile_buffer.x),
|
||||
float(texture_height) / float(tile_buffer.y),
|
||||
1.0f};
|
||||
rescale_m4(uv_to_texel, scale);
|
||||
uv_to_texel[3][0] += image_tile.get_tile_x_offset() /
|
||||
|
||||
@@ -1318,7 +1318,7 @@ static void drw_subdiv_compute_dispatch(const DRWSubdivCache *cache,
|
||||
/* X and Y dimensions may have different limits so the above computation may not be right, but
|
||||
* even with the standard 64k minimum on all dimensions we still have a lot of room. Therefore,
|
||||
* we presume it all fits. */
|
||||
BLI_assert(dispatch_ry < static_cast<uint>(GPU_max_work_group_count(1)));
|
||||
BLI_assert(dispatch_ry < uint(GPU_max_work_group_count(1)));
|
||||
|
||||
draw_subdiv_ubo_update_and_bind(
|
||||
cache, shader, src_offset, dst_offset, total_dispatch_size, has_sculpt_mask);
|
||||
|
||||
@@ -387,7 +387,7 @@ class DrawCommandBuf {
|
||||
instance_len = instance_len != -1 ? instance_len : 1;
|
||||
|
||||
int64_t index = commands.append_and_get_index({});
|
||||
headers.append({Type::Draw, static_cast<uint>(index)});
|
||||
headers.append({Type::Draw, uint(index)});
|
||||
commands[index].draw = {batch, instance_len, vertex_len, vertex_first, handle};
|
||||
}
|
||||
|
||||
@@ -489,11 +489,11 @@ class DrawMultiBuf {
|
||||
|
||||
DrawMulti &cmd = commands.last().draw_multi;
|
||||
|
||||
uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.uuid, batch), (uint)-1);
|
||||
uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.uuid, batch), uint(-1));
|
||||
|
||||
bool inverted = handle.has_inverted_handedness();
|
||||
|
||||
if (group_id == (uint)-1) {
|
||||
if (group_id == uint(-1)) {
|
||||
uint new_group_id = group_count_++;
|
||||
|
||||
DrawGroup &group = group_buf_.get_or_resize(new_group_id);
|
||||
|
||||
@@ -403,7 +403,7 @@ class PassSortable : public PassMain {
|
||||
{
|
||||
int64_t index = sub_passes_.append_and_get_index(
|
||||
PassBase(name, draw_commands_buf_, sub_passes_, shader_));
|
||||
headers_.append({Type::SubPass, static_cast<uint>(index)});
|
||||
headers_.append({Type::SubPass, uint(index)});
|
||||
sorting_values_.append(sorting_value);
|
||||
return sub_passes_[index];
|
||||
}
|
||||
@@ -442,7 +442,7 @@ namespace detail {
|
||||
template<class T> inline command::Undetermined &PassBase<T>::create_command(command::Type type)
|
||||
{
|
||||
int64_t index = commands_.append_and_get_index({});
|
||||
headers_.append({type, static_cast<uint>(index)});
|
||||
headers_.append({type, uint(index)});
|
||||
return commands_[index];
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ inline void PassBase<T>::clear(eGPUFrameBufferBits planes,
|
||||
float depth,
|
||||
uint8_t stencil)
|
||||
{
|
||||
create_command(command::Type::Clear).clear = {(uint8_t)planes, stencil, depth, color};
|
||||
create_command(command::Type::Clear).clear = {uint8_t(planes), stencil, depth, color};
|
||||
}
|
||||
|
||||
template<class T> inline GPUBatch *PassBase<T>::procedural_batch_get(GPUPrimType primitive)
|
||||
@@ -477,7 +477,7 @@ template<class T> inline PassBase<T> &PassBase<T>::sub(const char *name)
|
||||
{
|
||||
int64_t index = sub_passes_.append_and_get_index(
|
||||
PassBase(name, draw_commands_buf_, sub_passes_, shader_));
|
||||
headers_.append({command::Type::SubPass, static_cast<uint>(index)});
|
||||
headers_.append({command::Type::SubPass, uint(index)});
|
||||
return sub_passes_[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@ static void extract_edit_data_iter_subdiv_mesh(const DRWSubdivCache *subdiv_cach
|
||||
uint subdiv_quad_index,
|
||||
const MPoly *coarse_quad)
|
||||
{
|
||||
const int coarse_quad_index = static_cast<int>(coarse_quad - mr->mpoly);
|
||||
const int coarse_quad_index = int(coarse_quad - mr->mpoly);
|
||||
BMFace *coarse_quad_bm = bm_original_face_get(mr, coarse_quad_index);
|
||||
extract_edit_data_iter_subdiv_bm(subdiv_cache, mr, _data, subdiv_quad_index, coarse_quad_bm);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ static void extract_edituv_data_iter_subdiv_mesh(const DRWSubdivCache *subdiv_ca
|
||||
uint subdiv_quad_index,
|
||||
const MPoly *coarse_quad)
|
||||
{
|
||||
const int coarse_quad_index = static_cast<int>(coarse_quad - mr->mpoly);
|
||||
const int coarse_quad_index = int(coarse_quad - mr->mpoly);
|
||||
BMFace *coarse_quad_bm = bm_original_face_get(mr, coarse_quad_index);
|
||||
extract_edituv_data_iter_subdiv_bm(subdiv_cache, mr, _data, subdiv_quad_index, coarse_quad_bm);
|
||||
}
|
||||
|
||||
@@ -3659,10 +3659,10 @@ static void ui_but_build_drawstr_float(uiBut *but, double value)
|
||||
/* Change negative zero to regular zero, without altering anything else. */
|
||||
value += +0.0f;
|
||||
|
||||
if (value == (double)FLT_MAX) {
|
||||
if (value == double(FLT_MAX)) {
|
||||
STR_CONCAT(but->drawstr, slen, "inf");
|
||||
}
|
||||
else if (value == (double)-FLT_MAX) {
|
||||
else if (value == double(-FLT_MAX)) {
|
||||
STR_CONCAT(but->drawstr, slen, "-inf");
|
||||
}
|
||||
else if (subtype == PROP_PERCENTAGE) {
|
||||
|
||||
@@ -1396,8 +1396,7 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
|
||||
{
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
const float aspect = 1.0f;
|
||||
float init_position[2] = {static_cast<float>(win->eventstate->xy[0]),
|
||||
static_cast<float>(win->eventstate->xy[1])};
|
||||
float init_position[2] = {float(win->eventstate->xy[0]), float(win->eventstate->xy[1])};
|
||||
|
||||
uiTooltipData *data = ui_tooltip_data_from_gizmo(C, gz);
|
||||
if (data == nullptr) {
|
||||
|
||||
@@ -1866,7 +1866,7 @@ struct XFormAxisData {
|
||||
static void object_transform_axis_target_calc_depth_init(XFormAxisData *xfd, const int mval[2])
|
||||
{
|
||||
float view_co_a[3], view_co_b[3];
|
||||
const float2 mval_fl = {static_cast<float>(mval[0]), static_cast<float>(mval[1])};
|
||||
const float2 mval_fl = {float(mval[0]), float(mval[1])};
|
||||
ED_view3d_win_to_ray(xfd->vc.region, mval_fl, view_co_a, view_co_b);
|
||||
add_v3_v3(view_co_b, view_co_a);
|
||||
float center[3] = {0.0f};
|
||||
|
||||
@@ -980,7 +980,7 @@ void ED_imapaint_bucket_fill(struct bContext *C,
|
||||
|
||||
ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
|
||||
|
||||
const float mouse_init[2] = {static_cast<float>(mouse[0]), static_cast<float>(mouse[1])};
|
||||
const float mouse_init[2] = {float(mouse[0]), float(mouse[1])};
|
||||
paint_2d_bucket_fill(C, color, nullptr, mouse_init, nullptr, nullptr);
|
||||
|
||||
ED_image_undo_push_end();
|
||||
|
||||
@@ -4667,7 +4667,7 @@ static bool object_circle_select(ViewContext *vc,
|
||||
View3D *v3d = vc->v3d;
|
||||
|
||||
const float radius_squared = rad * rad;
|
||||
const float mval_fl[2] = {static_cast<float>(mval[0]), static_cast<float>(mval[1])};
|
||||
const float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
|
||||
bool changed = false;
|
||||
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
|
||||
|
||||
@@ -546,7 +546,7 @@ template<typename T> struct ValueOrField {
|
||||
|
||||
bool is_field() const
|
||||
{
|
||||
return (bool)this->field;
|
||||
return bool(this->field);
|
||||
}
|
||||
|
||||
Field<T> as_field() const
|
||||
|
||||
@@ -40,12 +40,12 @@ typedef enum GPUAttachmentType : int {
|
||||
|
||||
inline constexpr GPUAttachmentType operator-(GPUAttachmentType a, int b)
|
||||
{
|
||||
return static_cast<GPUAttachmentType>(static_cast<int>(a) - b);
|
||||
return static_cast<GPUAttachmentType>(int(a) - b);
|
||||
}
|
||||
|
||||
inline constexpr GPUAttachmentType operator+(GPUAttachmentType a, int b)
|
||||
{
|
||||
return static_cast<GPUAttachmentType>(static_cast<int>(a) + b);
|
||||
return static_cast<GPUAttachmentType>(int(a) + b);
|
||||
}
|
||||
|
||||
inline GPUAttachmentType &operator++(GPUAttachmentType &a)
|
||||
|
||||
@@ -352,7 +352,7 @@ struct MTLSamplerArray {
|
||||
{
|
||||
uint32_t hash = this->num_samplers;
|
||||
for (int i = 0; i < this->num_samplers; i++) {
|
||||
hash ^= (uint32_t)this->mtl_sampler_flags[i] << (i % 3);
|
||||
hash ^= uint32_t(this->mtl_sampler_flags[i]) << (i % 3);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ struct MTLVertexAttributeDescriptorPSO {
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return (uint64_t)((uint64_t)this->format ^ (this->offset << 4) ^ (this->buffer_index << 8) ^
|
||||
(this->format_conversion_mode << 12));
|
||||
return uint64_t((uint64_t(this->format) ^ (this->offset << 4) ^ (this->buffer_index << 8) ^
|
||||
(this->format_conversion_mode << 12)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,8 +46,7 @@ struct MTLVertexBufferLayoutDescriptorPSO {
|
||||
|
||||
uint64_t hash() const
|
||||
{
|
||||
return (uint64_t)((uint64_t)this->step_function ^ (this->step_rate << 4) ^
|
||||
(this->stride << 8));
|
||||
return uint64_t(uint64_t(this->step_function) ^ (this->step_rate << 4) ^ (this->stride << 8));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -217,31 +216,30 @@ struct MTLRenderPipelineStateDescriptor {
|
||||
* has collisions. */
|
||||
|
||||
uint64_t hash = this->vertex_descriptor.hash();
|
||||
hash ^= (uint64_t)this->num_color_attachments << 16; /* up to 6 (3 bits). */
|
||||
hash ^= (uint64_t)this->depth_attachment_format << 18; /* up to 555 (9 bits). */
|
||||
hash ^= (uint64_t)this->stencil_attachment_format << 20; /* up to 555 (9 bits). */
|
||||
hash ^= (uint64_t)(*(
|
||||
(uint64_t *)&this->vertex_descriptor.prim_topology_class)); /* Up to 3 (2 bits). */
|
||||
hash ^= uint64_t(this->num_color_attachments) << 16; /* up to 6 (3 bits). */
|
||||
hash ^= uint64_t(this->depth_attachment_format) << 18; /* up to 555 (9 bits). */
|
||||
hash ^= uint64_t(this->stencil_attachment_format) << 20; /* up to 555 (9 bits). */
|
||||
hash ^= uint64_t(
|
||||
*((uint64_t *)&this->vertex_descriptor.prim_topology_class)); /* Up to 3 (2 bits). */
|
||||
|
||||
/* Only include elements in Hash if they are needed - avoids variable null assignments
|
||||
* influencing hash. */
|
||||
if (this->num_color_attachments > 0) {
|
||||
hash ^= (uint64_t)this->color_write_mask << 22; /* 4 bit bit-mask. */
|
||||
hash ^= (uint64_t)this->alpha_blend_op << 26; /* Up to 4 (3 bits). */
|
||||
hash ^= (uint64_t)this->rgb_blend_op << 29; /* Up to 4 (3 bits). */
|
||||
hash ^= (uint64_t)this->dest_alpha_blend_factor << 32; /* Up to 18 (5 bits). */
|
||||
hash ^= (uint64_t)this->dest_rgb_blend_factor << 37; /* Up to 18 (5 bits). */
|
||||
hash ^= (uint64_t)this->src_alpha_blend_factor << 42; /* Up to 18 (5 bits). */
|
||||
hash ^= (uint64_t)this->src_rgb_blend_factor << 47; /* Up to 18 (5 bits). */
|
||||
hash ^= uint64_t(this->color_write_mask) << 22; /* 4 bit bit-mask. */
|
||||
hash ^= uint64_t(this->alpha_blend_op) << 26; /* Up to 4 (3 bits). */
|
||||
hash ^= uint64_t(this->rgb_blend_op) << 29; /* Up to 4 (3 bits). */
|
||||
hash ^= uint64_t(this->dest_alpha_blend_factor) << 32; /* Up to 18 (5 bits). */
|
||||
hash ^= uint64_t(this->dest_rgb_blend_factor) << 37; /* Up to 18 (5 bits). */
|
||||
hash ^= uint64_t(this->src_alpha_blend_factor) << 42; /* Up to 18 (5 bits). */
|
||||
hash ^= uint64_t(this->src_rgb_blend_factor) << 47; /* Up to 18 (5 bits). */
|
||||
}
|
||||
|
||||
for (const uint c : IndexRange(GPU_FB_MAX_COLOR_ATTACHMENT)) {
|
||||
hash ^= (uint64_t)this->color_attachment_format[c] << (c + 52); // up to 555 (9 bits)
|
||||
hash ^= uint64_t(this->color_attachment_format[c]) << (c + 52); /* Up to 555 (9 bits). */
|
||||
}
|
||||
|
||||
hash |= (uint64_t)((this->blending_enabled && (this->num_color_attachments > 0)) ? 1 : 0)
|
||||
<< 62;
|
||||
hash ^= (uint64_t)this->point_size;
|
||||
hash |= uint64_t((this->blending_enabled && (this->num_color_attachments > 0)) ? 1 : 0) << 62;
|
||||
hash ^= uint64_t(this->point_size);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,9 @@ struct TextureUpdateRoutineSpecialisation {
|
||||
uint64_t hash() const
|
||||
{
|
||||
blender::DefaultHash<std::string> string_hasher;
|
||||
return (uint64_t)string_hasher(
|
||||
return uint64_t(string_hasher(
|
||||
this->input_data_type + this->output_data_type +
|
||||
std::to_string((this->component_count_input << 8) + this->component_count_output));
|
||||
std::to_string((this->component_count_input << 8) + this->component_count_output)));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -108,10 +108,10 @@ struct TextureReadRoutineSpecialisation {
|
||||
uint64_t hash() const
|
||||
{
|
||||
blender::DefaultHash<std::string> string_hasher;
|
||||
return (uint64_t)string_hasher(this->input_data_type + this->output_data_type +
|
||||
std::to_string((this->component_count_input << 8) +
|
||||
this->component_count_output +
|
||||
(this->depth_format_mode << 28)));
|
||||
return uint64_t(string_hasher(this->input_data_type + this->output_data_type +
|
||||
std::to_string((this->component_count_input << 8) +
|
||||
this->component_count_output +
|
||||
(this->depth_format_mode << 28))));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,12 +138,12 @@ struct MTLSamplerState {
|
||||
|
||||
operator uint() const
|
||||
{
|
||||
return (uint)state;
|
||||
return uint(state);
|
||||
}
|
||||
|
||||
operator uint64_t() const
|
||||
{
|
||||
return (uint64_t)state;
|
||||
return uint64_t(state);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -35,11 +35,9 @@ class GLIndexBuf : public IndexBuf {
|
||||
{
|
||||
additional_vertex_offset += index_start_;
|
||||
if (index_type_ == GPU_INDEX_U32) {
|
||||
return reinterpret_cast<void *>(static_cast<intptr_t>(additional_vertex_offset) *
|
||||
sizeof(GLuint));
|
||||
return reinterpret_cast<void *>(intptr_t(additional_vertex_offset) * sizeof(GLuint));
|
||||
}
|
||||
return reinterpret_cast<void *>(static_cast<intptr_t>(additional_vertex_offset) *
|
||||
sizeof(GLushort));
|
||||
return reinterpret_cast<void *>(intptr_t(additional_vertex_offset) * sizeof(GLushort));
|
||||
}
|
||||
|
||||
GLuint restart_index() const
|
||||
|
||||
@@ -142,7 +142,7 @@ void *GLVertBuf::unmap(const void *mapped_data) const
|
||||
void GLVertBuf::wrap_handle(uint64_t handle)
|
||||
{
|
||||
BLI_assert(vbo_id_ == 0);
|
||||
BLI_assert(glIsBuffer(static_cast<uint>(handle)));
|
||||
BLI_assert(glIsBuffer(uint(handle)));
|
||||
is_wrapper_ = true;
|
||||
vbo_id_ = uint(handle);
|
||||
/* We assume the data is already on the device, so no need to allocate or send it. */
|
||||
|
||||
@@ -130,7 +130,7 @@ static TimeSamplingPtr create_time_sampling(double scene_fps,
|
||||
|
||||
get_shutter_samples(scene_fps, params, nr_of_samples, true, samples);
|
||||
|
||||
TimeSamplingType ts(static_cast<uint32_t>(samples.size()), 1.0 / scene_fps);
|
||||
TimeSamplingType ts(uint32_t(samples.size()), 1.0 / scene_fps);
|
||||
return TimeSamplingPtr(new TimeSampling(ts, samples)); // NOLINT: modernize-make-shared
|
||||
}
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ static void export_startjob(void *customdata,
|
||||
}
|
||||
|
||||
/* Update the scene for the next frame to render. */
|
||||
scene->r.cfra = static_cast<int>(frame);
|
||||
scene->r.subframe = static_cast<float>(frame - scene->r.cfra);
|
||||
scene->r.cfra = int(frame);
|
||||
scene->r.subframe = float(frame - scene->r.cfra);
|
||||
BKE_scene_graph_update_for_newframe(data->depsgraph);
|
||||
|
||||
CLOG_INFO(&LOG, 2, "Exporting frame %.2f", frame);
|
||||
|
||||
@@ -142,7 +142,7 @@ void ABCCurveWriter::do_write(HierarchyContext &context)
|
||||
}
|
||||
}
|
||||
|
||||
orders.push_back(static_cast<uint8_t>(nurbs->orderu));
|
||||
orders.push_back(uint8_t(nurbs->orderu));
|
||||
vert_counts.push_back(verts.size() - current_point_count);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,11 +77,11 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
|
||||
bcam->stereo.convergence_distance = convergence_plane.getValue(sample_sel);
|
||||
}
|
||||
|
||||
const float lens = static_cast<float>(cam_sample.getFocalLength());
|
||||
const float apperture_x = static_cast<float>(cam_sample.getHorizontalAperture());
|
||||
const float apperture_y = static_cast<float>(cam_sample.getVerticalAperture());
|
||||
const float h_film_offset = static_cast<float>(cam_sample.getHorizontalFilmOffset());
|
||||
const float v_film_offset = static_cast<float>(cam_sample.getVerticalFilmOffset());
|
||||
const float lens = float(cam_sample.getFocalLength());
|
||||
const float apperture_x = float(cam_sample.getHorizontalAperture());
|
||||
const float apperture_y = float(cam_sample.getVerticalAperture());
|
||||
const float h_film_offset = float(cam_sample.getHorizontalFilmOffset());
|
||||
const float v_film_offset = float(cam_sample.getVerticalFilmOffset());
|
||||
const float film_aspect = apperture_x / apperture_y;
|
||||
|
||||
bcam->lens = lens;
|
||||
@@ -89,10 +89,10 @@ void AbcCameraReader::readObjectData(Main *bmain, const ISampleSelector &sample_
|
||||
bcam->sensor_y = apperture_y * 10;
|
||||
bcam->shiftx = h_film_offset / apperture_x;
|
||||
bcam->shifty = v_film_offset / apperture_y / film_aspect;
|
||||
bcam->clip_start = max_ff(0.1f, static_cast<float>(cam_sample.getNearClippingPlane()));
|
||||
bcam->clip_end = static_cast<float>(cam_sample.getFarClippingPlane());
|
||||
bcam->dof.focus_distance = static_cast<float>(cam_sample.getFocusDistance());
|
||||
bcam->dof.aperture_fstop = static_cast<float>(cam_sample.getFStop());
|
||||
bcam->clip_start = max_ff(0.1f, float(cam_sample.getNearClippingPlane()));
|
||||
bcam->clip_end = float(cam_sample.getFarClippingPlane());
|
||||
bcam->dof.focus_distance = float(cam_sample.getFocusDistance());
|
||||
bcam->dof.aperture_fstop = float(cam_sample.getFStop());
|
||||
|
||||
m_object = BKE_object_add_only_object(bmain, OB_CAMERA, m_object_name.c_str());
|
||||
m_object->data = bcam;
|
||||
|
||||
@@ -152,7 +152,7 @@ void AbcCurveReader::read_curve_sample(Curve *cu,
|
||||
break;
|
||||
case Alembic::AbcGeom::kVariableOrder:
|
||||
if (orders && orders->size() > i) {
|
||||
nu->orderu = static_cast<short>((*orders)[i]);
|
||||
nu->orderu = short((*orders)[i]);
|
||||
break;
|
||||
}
|
||||
ATTR_FALLTHROUGH;
|
||||
|
||||
@@ -133,7 +133,7 @@ static void read_mverts_interp(MVert *mverts,
|
||||
const Imath::V3f &floor_pos = (*positions)[i];
|
||||
const Imath::V3f &ceil_pos = (*ceil_positions)[i];
|
||||
|
||||
interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), static_cast<float>(weight));
|
||||
interp_v3_v3v3(tmp, floor_pos.getValue(), ceil_pos.getValue(), float(weight));
|
||||
copy_zup_from_yup(mvert.co, tmp);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +448,7 @@ static void read_velocity(const V3fArraySamplePtr &velocities,
|
||||
const CDStreamConfig &config,
|
||||
const float velocity_scale)
|
||||
{
|
||||
const int num_velocity_vectors = static_cast<int>(velocities->size());
|
||||
const int num_velocity_vectors = int(velocities->size());
|
||||
if (num_velocity_vectors != config.mesh->totvert) {
|
||||
/* Files containing videogrammetry data may be malformed and export velocity data on missing
|
||||
* frames (most likely by copying the last valid data). */
|
||||
|
||||
@@ -110,7 +110,7 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0,
|
||||
|
||||
convert_matrix_datatype(m0, mat0);
|
||||
convert_matrix_datatype(m1, mat1);
|
||||
interp_m4_m4m4(ret, mat0, mat1, static_cast<float>(weight));
|
||||
interp_m4_m4m4(ret, mat0, mat1, float(weight));
|
||||
return convert_matrix_datatype(ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Imath::M44d convert_matrix_datatype(float mat[4][4])
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
m[i][j] = static_cast<double>(mat[i][j]);
|
||||
m[i][j] = double(mat[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4])
|
||||
{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
r_mat[i][j] = static_cast<float>(xform[i][j]);
|
||||
r_mat[i][j] = float(xform[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
|
||||
|
||||
/* Create objects and set scene frame range. */
|
||||
|
||||
const float size = static_cast<float>(data->readers.size());
|
||||
const float size = float(data->readers.size());
|
||||
size_t i = 0;
|
||||
|
||||
chrono_t min_time = std::numeric_limits<chrono_t>::max();
|
||||
@@ -542,8 +542,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
|
||||
scene->r.cfra = scene->r.sfra;
|
||||
}
|
||||
else if (min_time < max_time) {
|
||||
scene->r.sfra = static_cast<int>(round(min_time * FPS));
|
||||
scene->r.efra = static_cast<int>(round(max_time * FPS));
|
||||
scene->r.sfra = int(round(min_time * FPS));
|
||||
scene->r.efra = int(round(max_time * FPS));
|
||||
scene->r.cfra = scene->r.sfra;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class USDCurvesReader : public USDGeomReader {
|
||||
|
||||
bool valid() const override
|
||||
{
|
||||
return static_cast<bool>(curve_prim_);
|
||||
return bool(curve_prim_);
|
||||
}
|
||||
|
||||
void create_object(Main *bmain, double motionSampleTime) override;
|
||||
|
||||
@@ -27,7 +27,7 @@ class USDNurbsReader : public USDGeomReader {
|
||||
|
||||
bool valid() const override
|
||||
{
|
||||
return static_cast<bool>(curve_prim_);
|
||||
return bool(curve_prim_);
|
||||
}
|
||||
|
||||
void create_object(Main *bmain, double motionSampleTime) override;
|
||||
|
||||
@@ -23,7 +23,7 @@ class USDVolumeReader : public USDXformReader {
|
||||
|
||||
bool valid() const override
|
||||
{
|
||||
return static_cast<bool>(volume_);
|
||||
return bool(volume_);
|
||||
}
|
||||
|
||||
void create_object(Main *bmain, double motionSampleTime) override;
|
||||
|
||||
@@ -49,11 +49,11 @@ struct MTLTexMap {
|
||||
struct MTLMaterial {
|
||||
const MTLTexMap &tex_map_of_type(MTLTexMapType key) const
|
||||
{
|
||||
return texture_maps[(int)key];
|
||||
return texture_maps[int(key)];
|
||||
}
|
||||
MTLTexMap &tex_map_of_type(MTLTexMapType key)
|
||||
{
|
||||
return texture_maps[(int)key];
|
||||
return texture_maps[int(key)];
|
||||
}
|
||||
|
||||
std::string name;
|
||||
@@ -76,7 +76,7 @@ struct MTLMaterial {
|
||||
float aniso_rot{-1.0f}; /* `anisor` */
|
||||
|
||||
int illum_mode{-1};
|
||||
MTLTexMap texture_maps[(int)MTLTexMapType::Count];
|
||||
MTLTexMap texture_maps[int(MTLTexMapType::Count)];
|
||||
/* Only used for Normal Map node: `map_Bump`. */
|
||||
float normal_strength{-1.0f};
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@ struct Geometry {
|
||||
|
||||
int get_vertex_count() const
|
||||
{
|
||||
return (int)vertices_.size();
|
||||
return int(vertices_.size());
|
||||
}
|
||||
void track_vertex_index(int index)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user