Cleanup: various C++ cleanups
- Use C++ headers. - Use function style cast. - Use boolean literals. - Remove redundant struct, void. - Remove redundant parenthesis.
This commit is contained in:
@@ -436,7 +436,7 @@ static void checker_board_color_prepare_thread_do(void *data_v, int scanline)
|
||||
{
|
||||
FillCheckerColorThreadData *data = (FillCheckerColorThreadData *)data_v;
|
||||
const int num_scanlines = 1;
|
||||
size_t offset = (size_t(data->width)) * scanline * 4;
|
||||
size_t offset = size_t(data->width) * scanline * 4;
|
||||
uchar *rect = (data->rect != nullptr) ? (data->rect + offset) : nullptr;
|
||||
float *rect_float = (data->rect_float != nullptr) ? (data->rect_float + offset) : nullptr;
|
||||
checker_board_color_prepare_slice(
|
||||
|
||||
@@ -794,7 +794,7 @@ bool BKE_image_render_write_exr(ReportList *reports,
|
||||
|
||||
LISTBASE_FOREACH (RenderPass *, rp, &rl->passes) {
|
||||
/* Skip non-RGBA and Z passes if not using multi layer. */
|
||||
if (!multi_layer && !(STR_ELEM(rp->name, RE_PASSNAME_COMBINED, ""))) {
|
||||
if (!multi_layer && !STR_ELEM(rp->name, RE_PASSNAME_COMBINED, "")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -457,7 +457,7 @@ void BLI_box_pack_2d(
|
||||
tot_y = max_ff(box_ymax_get(box), tot_y);
|
||||
|
||||
/* Place the box */
|
||||
vert->free &= (signed char)(~quad_flag(j));
|
||||
vert->free &= (signed char)~quad_flag(j);
|
||||
|
||||
switch (j) {
|
||||
case TR:
|
||||
|
||||
@@ -305,7 +305,7 @@ static enum ISectType intersect_line_tri(const float p0[3],
|
||||
fac = line_point_factor_v3(ix_pair[0], p0, p1);
|
||||
if ((fac >= e->eps_margin) && (fac <= 1.0f - e->eps_margin)) {
|
||||
copy_v3_v3(r_ix, ix_pair[0]);
|
||||
return ISectType((IX_EDGE_TRI_EDGE0 + (enum ISectType)i_t0));
|
||||
return ISectType(IX_EDGE_TRI_EDGE0 + (enum ISectType)i_t0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ static void basic_cache_init(void *vedata)
|
||||
|
||||
/* TODO(fclem): DRW_cache_object_surface_material_get needs a refactor to allow passing nullptr
|
||||
* instead of gpumat_array. Avoiding all this boilerplate code. */
|
||||
static struct GPUBatch **basic_object_surface_material_get(Object *ob)
|
||||
static GPUBatch **basic_object_surface_material_get(Object *ob)
|
||||
{
|
||||
const int materials_len = DRW_cache_object_material_count_get(ob);
|
||||
GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len);
|
||||
@@ -141,7 +141,7 @@ static void basic_cache_populate_particles(void *vedata, Object *ob)
|
||||
ParticleSettings *part = psys->part;
|
||||
const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
|
||||
if (draw_as == PART_DRAW_PATH) {
|
||||
struct GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, nullptr);
|
||||
GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, nullptr);
|
||||
if (stl->g_data->use_material_slot_selection) {
|
||||
const short material_slot = part->omat;
|
||||
DRW_select_load_id(ob->runtime.select_id | (material_slot << 16));
|
||||
@@ -188,7 +188,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
|
||||
|
||||
if (is_flat_object_viewed_from_side) {
|
||||
/* Avoid losing flat objects when in ortho views (see #56549) */
|
||||
struct GPUBatch *geom = DRW_cache_object_all_edges_get(ob);
|
||||
GPUBatch *geom = DRW_cache_object_all_edges_get(ob);
|
||||
if (geom) {
|
||||
DRW_shgroup_call(stl->g_data->depth_shgrp[do_in_front], geom, ob);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
|
||||
}
|
||||
else {
|
||||
if (stl->g_data->use_material_slot_selection && BKE_object_supports_material_slots(ob)) {
|
||||
struct GPUBatch **geoms = basic_object_surface_material_get(ob);
|
||||
GPUBatch **geoms = basic_object_surface_material_get(ob);
|
||||
if (geoms) {
|
||||
const int materials_len = DRW_cache_object_material_count_get(ob);
|
||||
for (int i = 0; i < materials_len; i++) {
|
||||
@@ -223,7 +223,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
|
||||
}
|
||||
}
|
||||
else {
|
||||
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
|
||||
GPUBatch *geom = DRW_cache_object_surface_get(ob);
|
||||
if (geom) {
|
||||
DRW_shgroup_call(shgrp, geom, ob);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ static void basic_draw_scene(void *vedata)
|
||||
DRW_draw_pass(psl->depth_pass_cull[1]);
|
||||
}
|
||||
|
||||
static void basic_engine_free(void)
|
||||
static void basic_engine_free()
|
||||
{
|
||||
BASIC_shaders_free();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ GPUShader *BASIC_shaders_pointcloud_depth_conservative_sh_get(eGPUShaderConfig c
|
||||
return sh_data->pointcloud_depth_conservative;
|
||||
}
|
||||
|
||||
void BASIC_shaders_free(void)
|
||||
void BASIC_shaders_free()
|
||||
{
|
||||
for (int i = 0; i < GPU_SHADER_CFG_LEN; i++) {
|
||||
GPUShader **sh_data_as_array = (GPUShader **)&e_data.sh_data[i];
|
||||
|
||||
@@ -37,11 +37,11 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *vedata)
|
||||
effects->source_texel_size[0] = 1.0f / viewport_size[0];
|
||||
effects->source_texel_size[1] = 1.0f / viewport_size[1];
|
||||
|
||||
blitsize[0] = (int)viewport_size[0];
|
||||
blitsize[1] = (int)viewport_size[1];
|
||||
blitsize[0] = int(viewport_size[0]);
|
||||
blitsize[1] = int(viewport_size[1]);
|
||||
|
||||
effects->blit_texel_size[0] = 1.0f / (float)blitsize[0];
|
||||
effects->blit_texel_size[1] = 1.0f / (float)blitsize[1];
|
||||
effects->blit_texel_size[0] = 1.0f / float(blitsize[0]);
|
||||
effects->blit_texel_size[1] = 1.0f / float(blitsize[1]);
|
||||
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->bloom_blit = DRW_texture_pool_query_2d_ex(
|
||||
@@ -59,13 +59,13 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *vedata)
|
||||
effects->bloom_clamp = scene_eval->eevee.bloom_clamp;
|
||||
|
||||
/* determine the iteration count */
|
||||
const float minDim = (float)MIN2(blitsize[0], blitsize[1]);
|
||||
const float minDim = float(MIN2(blitsize[0], blitsize[1]));
|
||||
const float maxIter = (radius - 8.0f) + log(minDim) / log(2);
|
||||
const int maxIterInt = effects->bloom_iteration_len = (int)maxIter;
|
||||
const int maxIterInt = effects->bloom_iteration_len = int(maxIter);
|
||||
|
||||
CLAMP(effects->bloom_iteration_len, 1, MAX_BLOOM_STEP);
|
||||
|
||||
effects->bloom_sample_scale = 0.5f + maxIter - (float)maxIterInt;
|
||||
effects->bloom_sample_scale = 0.5f + maxIter - float(maxIterInt);
|
||||
effects->bloom_curve_threshold[0] = threshold - knee;
|
||||
effects->bloom_curve_threshold[1] = knee * 2.0f;
|
||||
effects->bloom_curve_threshold[2] = 0.25f / max_ff(1e-5f, knee);
|
||||
@@ -82,8 +82,8 @@ int EEVEE_bloom_init(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *vedata)
|
||||
texsize[0] = MAX2(texsize[0], 2);
|
||||
texsize[1] = MAX2(texsize[1], 2);
|
||||
|
||||
effects->downsamp_texel_size[i][0] = 1.0f / (float)texsize[0];
|
||||
effects->downsamp_texel_size[i][1] = 1.0f / (float)texsize[1];
|
||||
effects->downsamp_texel_size[i][0] = 1.0f / float(texsize[0]);
|
||||
effects->downsamp_texel_size[i][1] = 1.0f / float(texsize[1]);
|
||||
|
||||
eGPUTextureUsage downsample_usage = GPU_TEXTURE_USAGE_SHADER_READ |
|
||||
GPU_TEXTURE_USAGE_ATTACHMENT |
|
||||
@@ -137,7 +137,7 @@ static DRWShadingGroup *eevee_create_bloom_pass(const char *name,
|
||||
bool resolve,
|
||||
bool resolve_add_base)
|
||||
{
|
||||
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *quad = DRW_cache_fullscreen_quad_get();
|
||||
|
||||
*pass = DRW_pass_create(name, DRW_STATE_WRITE_COLOR);
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ void EEVEE_cryptomatte_renderpasses_init(EEVEE_Data *vedata)
|
||||
}
|
||||
const eViewLayerCryptomatteFlags active_layers = eevee_cryptomatte_active_layers(view_layer);
|
||||
if (active_layers) {
|
||||
struct CryptomatteSession *session = BKE_cryptomatte_init();
|
||||
CryptomatteSession *session = BKE_cryptomatte_init();
|
||||
if ((active_layers & VIEW_LAYER_CRYPTOMATTE_OBJECT) != 0) {
|
||||
BKE_cryptomatte_add_layer(session, "CryptoObject");
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ void EEVEE_view_layer_data_free(void *storage)
|
||||
}
|
||||
}
|
||||
|
||||
EEVEE_ViewLayerData *EEVEE_view_layer_data_get(void)
|
||||
EEVEE_ViewLayerData *EEVEE_view_layer_data_get()
|
||||
{
|
||||
return (EEVEE_ViewLayerData *)DRW_view_layer_engine_data_get(&draw_engine_eevee_type);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure_ex(ViewLayer *view_layer)
|
||||
return *sldata;
|
||||
}
|
||||
|
||||
EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure(void)
|
||||
EEVEE_ViewLayerData *EEVEE_view_layer_data_ensure()
|
||||
{
|
||||
EEVEE_ViewLayerData **sldata = (EEVEE_ViewLayerData **)DRW_view_layer_engine_data_ensure(
|
||||
&draw_engine_eevee_type, &EEVEE_view_layer_data_free);
|
||||
|
||||
@@ -121,8 +121,8 @@ bool EEVEE_depth_of_field_jitter_get(EEVEE_EffectsInfo *fx,
|
||||
samples_passed += ring_sample_count;
|
||||
}
|
||||
|
||||
r_jitter[0] = (float)ring / ring_count;
|
||||
r_jitter[1] = (float)ring_sample / ring_sample_count;
|
||||
r_jitter[0] = float(ring) / ring_count;
|
||||
r_jitter[1] = float(ring_sample) / ring_sample_count;
|
||||
|
||||
{
|
||||
/* Bokeh shape parameterization. */
|
||||
@@ -516,8 +516,8 @@ static void dof_dilate_tiles_pass_draw(EEVEE_FramebufferList *fbl,
|
||||
/* 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, floor(remainder / (float)ring_count));
|
||||
int ring_count = min_ii(DOF_DILATE_RING_COUNT, ceilf(remainder / float(max_multiplier)));
|
||||
int multiplier = min_ii(max_multiplier, floor(remainder / float(ring_count)));
|
||||
|
||||
dilation_radius += ring_count * multiplier;
|
||||
|
||||
@@ -681,7 +681,7 @@ static void dof_gather_pass_init(EEVEE_FramebufferList *fbl,
|
||||
int res[2] = {int(divide_ceil_u(fullres[0], 2)), int(divide_ceil_u(fullres[1], 2))};
|
||||
int input_size[2];
|
||||
GPU_texture_get_mipmap_size(txl->dof_reduced_color, 0, input_size);
|
||||
float uv_correction_fac[2] = {res[0] / (float)input_size[0], res[1] / (float)input_size[1]};
|
||||
float uv_correction_fac[2] = {res[0] / float(input_size[0]), res[1] / float(input_size[1])};
|
||||
float output_texel_size[2] = {1.0f / res[0], 1.0f / res[1]};
|
||||
const bool use_bokeh_tx = (fx->dof_bokeh_gather_lut_tx != nullptr);
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata,
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const int size_fs[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
const int size_fs[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
|
||||
if (!stl->effects) {
|
||||
stl->effects = static_cast<EEVEE_EffectsInfo *>(
|
||||
@@ -247,7 +247,7 @@ void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
downsample_write = DRW_STATE_WRITE_COLOR;
|
||||
}
|
||||
|
||||
struct GPUBatch *quad = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *quad = DRW_cache_fullscreen_quad_get();
|
||||
|
||||
if (effects->enabled_effects & EFFECT_RADIANCE_BUFFER) {
|
||||
DRW_PASS_CREATE(psl->color_copy_ps, DRW_STATE_WRITE_COLOR);
|
||||
@@ -366,7 +366,7 @@ static void max_downsample_cb(void *vedata, int level)
|
||||
static void simple_downsample_cube_cb(void *vedata, int level)
|
||||
{
|
||||
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
|
||||
e_data.texel_size[0] = (float)(1 << level) / (float)GPU_texture_width(e_data.color_src);
|
||||
e_data.texel_size[0] = float(1 << level) / float(GPU_texture_width(e_data.color_src));
|
||||
e_data.texel_size[1] = e_data.texel_size[0];
|
||||
DRW_draw_pass(psl->color_downsample_cube_ps);
|
||||
}
|
||||
|
||||
@@ -635,7 +635,7 @@ static void eevee_store_metadata(void *vedata, RenderResult *render_result)
|
||||
}
|
||||
}
|
||||
|
||||
static void eevee_engine_free(void)
|
||||
static void eevee_engine_free()
|
||||
{
|
||||
EEVEE_shaders_free();
|
||||
EEVEE_lightprobes_free();
|
||||
|
||||
@@ -76,7 +76,7 @@ struct EEVEE_LightBake {
|
||||
ViewLayer *view_layer_input;
|
||||
LightCache *lcache;
|
||||
Scene *scene;
|
||||
struct Main *bmain;
|
||||
Main *bmain;
|
||||
EEVEE_ViewLayerData *sldata;
|
||||
|
||||
/** Current probe being rendered. */
|
||||
@@ -278,7 +278,7 @@ static void irradiance_pool_size_get(int visibility_size, int total_samples, int
|
||||
/* The irradiance itself take one layer, hence the +1 */
|
||||
int layer_count = MIN2(irr_per_vis + 1, IRRADIANCE_MAX_POOL_LAYER);
|
||||
|
||||
int texel_count = (int)ceilf((float)total_samples / (float)(layer_count - 1));
|
||||
int texel_count = int(ceilf(float(total_samples) / float(layer_count - 1)));
|
||||
r_size[0] = visibility_size *
|
||||
max_ii(1, min_ii(texel_count, (IRRADIANCE_MAX_POOL_SIZE / visibility_size)));
|
||||
r_size[1] = visibility_size *
|
||||
@@ -759,7 +759,7 @@ static void eevee_lightbake_create_resources(EEVEE_LightBake *lbake)
|
||||
|
||||
wmJob *EEVEE_lightbake_job_create(wmWindowManager *wm,
|
||||
wmWindow *win,
|
||||
struct Main *bmain,
|
||||
Main *bmain,
|
||||
ViewLayer *view_layer,
|
||||
Scene *scene,
|
||||
int delay,
|
||||
@@ -830,7 +830,7 @@ wmJob *EEVEE_lightbake_job_create(wmWindowManager *wm,
|
||||
}
|
||||
|
||||
void *EEVEE_lightbake_job_data_alloc(
|
||||
struct Main *bmain, ViewLayer *view_layer, Scene *scene, bool run_as_job, int frame)
|
||||
Main *bmain, ViewLayer *view_layer, Scene *scene, bool run_as_job, int frame)
|
||||
{
|
||||
BLI_assert(BLI_thread_is_main());
|
||||
|
||||
@@ -1098,7 +1098,7 @@ static void compute_cell_id(EEVEE_LightGrid *egrid,
|
||||
|
||||
/* Add one for level 0 */
|
||||
int max_lvl = (int)floorf(log2f(
|
||||
(float)MAX3(probe->grid_resolution_x, probe->grid_resolution_y, probe->grid_resolution_z)));
|
||||
float(MAX3(probe->grid_resolution_x, probe->grid_resolution_y, probe->grid_resolution_z))));
|
||||
|
||||
int visited_cells = 0;
|
||||
*r_stride = 0;
|
||||
@@ -1208,7 +1208,7 @@ static void eevee_lightbake_render_grid_sample(void *ved, void *user_data)
|
||||
egrid->level_bias = 1.0f;
|
||||
}
|
||||
else if (lbake->bounce_curr == 0) {
|
||||
egrid->level_bias = (float)(stride << 1);
|
||||
egrid->level_bias = float(stride << 1);
|
||||
}
|
||||
|
||||
/* Only run this for the last sample of a bounce. */
|
||||
@@ -1395,7 +1395,7 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake,
|
||||
eevee_lightbake_context_enable(lbake);
|
||||
DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake);
|
||||
lbake->done += 1;
|
||||
*lbake->progress = lbake->done / (float)lbake->total;
|
||||
*lbake->progress = lbake->done / float(lbake->total);
|
||||
*lbake->do_update = true;
|
||||
eevee_lightbake_context_disable(lbake);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata,
|
||||
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
|
||||
DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
DRW_shgroup_call_instances(grp, nullptr, geom, 6);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata,
|
||||
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
|
||||
DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
DRW_shgroup_call(grp, geom, nullptr);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata,
|
||||
DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
|
||||
DRW_shgroup_uniform_block(grp, "renderpass_block", sldata->renderpass_ubo.combined);
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
DRW_shgroup_call(grp, geom, nullptr);
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ void EEVEE_lightbake_cache_init(EEVEE_ViewLayerData *sldata,
|
||||
|
||||
DRW_shgroup_uniform_texture_ref(grp, "irradianceGrid", &light_cache->grid_tx.tex);
|
||||
|
||||
struct GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
GPUBatch *geom = DRW_cache_fullscreen_quad_get();
|
||||
DRW_shgroup_call(grp, geom, nullptr);
|
||||
}
|
||||
}
|
||||
@@ -707,7 +707,7 @@ void EEVEE_lightprobes_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
|
||||
GPU_uniformbuf_update(sldata->grid_ubo, &sldata->probes->grid_data);
|
||||
|
||||
/* For shading, save max level of the octahedron map */
|
||||
sldata->common_data.prb_lod_cube_max = (float)light_cache->mips_len;
|
||||
sldata->common_data.prb_lod_cube_max = float(light_cache->mips_len);
|
||||
sldata->common_data.prb_irradiance_vis_size = light_cache->vis_res;
|
||||
sldata->common_data.prb_irradiance_smooth = square_f(scene_eval->eevee.gi_irradiance_smoothing);
|
||||
sldata->common_data.prb_num_render_cube = max_ii(1, light_cache->cube_len);
|
||||
@@ -996,7 +996,7 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_LightProbesInfo *pinfo = sldata->probes;
|
||||
LightCache *light_cache = vedata->stl->g_data->light_cache;
|
||||
|
||||
float target_size = (float)GPU_texture_width(rt_color);
|
||||
float target_size = float(GPU_texture_width(rt_color));
|
||||
|
||||
/* Max lod used from the render target probe */
|
||||
pinfo->lod_rt_max = log2_floor_u(target_size) - 2.0f;
|
||||
@@ -1007,17 +1007,17 @@ void EEVEE_lightbake_filter_glossy(EEVEE_ViewLayerData *sldata,
|
||||
|
||||
/* 2 - Let gpu create Mipmaps for Filtered Importance Sampling. */
|
||||
/* Bind next framebuffer to be able to gen. mips for probe_rt. */
|
||||
EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
|
||||
EEVEE_downsample_cube_buffer(vedata, rt_color, int(pinfo->lod_rt_max));
|
||||
|
||||
/* 3 - Render to probe array to the specified layer, do prefiltering. */
|
||||
int mipsize = GPU_texture_width(light_cache->cube_tx.tex);
|
||||
for (int i = 0; i < maxlevel + 1; i++) {
|
||||
float bias = 0.0f;
|
||||
pinfo->texel_size = 1.0f / (float)mipsize;
|
||||
pinfo->padding_size = (i == maxlevel) ? 0 : (float)(1 << (maxlevel - i - 1));
|
||||
pinfo->texel_size = 1.0f / float(mipsize);
|
||||
pinfo->padding_size = (i == maxlevel) ? 0 : float(1 << (maxlevel - i - 1));
|
||||
pinfo->padding_size *= pinfo->texel_size;
|
||||
pinfo->layer = probe_idx * 6;
|
||||
pinfo->roughness = i / (float)maxlevel;
|
||||
pinfo->roughness = i / float(maxlevel);
|
||||
/* Disney Roughness */
|
||||
pinfo->roughness = square_f(pinfo->roughness);
|
||||
/* Distribute Roughness across lod more evenly */
|
||||
@@ -1081,7 +1081,7 @@ void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_LightProbesInfo *pinfo = sldata->probes;
|
||||
LightCache *light_cache = vedata->stl->g_data->light_cache;
|
||||
|
||||
float target_size = (float)GPU_texture_width(rt_color);
|
||||
float target_size = float(GPU_texture_width(rt_color));
|
||||
|
||||
pinfo->intensity_fac = intensity;
|
||||
|
||||
@@ -1112,7 +1112,7 @@ void EEVEE_lightbake_filter_diffuse(EEVEE_ViewLayerData *sldata,
|
||||
GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_NONE});
|
||||
|
||||
/* 4 - Compute diffuse irradiance */
|
||||
EEVEE_downsample_cube_buffer(vedata, rt_color, (int)(pinfo->lod_rt_max));
|
||||
EEVEE_downsample_cube_buffer(vedata, rt_color, int(pinfo->lod_rt_max));
|
||||
|
||||
GPU_framebuffer_ensure_config(
|
||||
&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE_LAYER(light_cache->grid_tx.tex, 0)});
|
||||
@@ -1143,7 +1143,7 @@ void EEVEE_lightbake_filter_visibility(EEVEE_ViewLayerData *sldata,
|
||||
pinfo->visibility_blur = vis_blur;
|
||||
pinfo->near_clip = -clipsta;
|
||||
pinfo->far_clip = -clipend;
|
||||
pinfo->texel_size = 1.0f / (float)vis_size;
|
||||
pinfo->texel_size = 1.0f / float(vis_size);
|
||||
|
||||
int cell_per_col = GPU_texture_height(light_cache->grid_tx.tex) / vis_size;
|
||||
int cell_per_row = GPU_texture_width(light_cache->grid_tx.tex) / vis_size;
|
||||
@@ -1269,7 +1269,7 @@ void EEVEE_lightprobes_refresh(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
}
|
||||
}
|
||||
|
||||
void EEVEE_lightprobes_free(void)
|
||||
void EEVEE_lightprobes_free()
|
||||
{
|
||||
MEM_SAFE_FREE(e_data.format_probe_display_planar);
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.planar_pool_placeholder);
|
||||
|
||||
@@ -79,20 +79,20 @@ static float light_shape_radiance_get(const Light *la, const EEVEE_Light *evli)
|
||||
area *= M_PI / 4.0f;
|
||||
}
|
||||
/* Convert radiant flux to radiance. */
|
||||
return (float)M_1_PI / area;
|
||||
return float(M_1_PI) / area;
|
||||
}
|
||||
case LA_SPOT:
|
||||
case LA_LOCAL: {
|
||||
/* Sphere area. */
|
||||
float area = 4.0f * (float)M_PI * square_f(evli->radius);
|
||||
float area = 4.0f * float(M_PI) * square_f(evli->radius);
|
||||
/* Convert radiant flux to radiance. */
|
||||
return 1.0f / (area * (float)M_PI);
|
||||
return 1.0f / (area * float(M_PI));
|
||||
}
|
||||
default:
|
||||
case LA_SUN: {
|
||||
float inv_sin_sq = 1.0f + 1.0f / square_f(evli->radius);
|
||||
/* Convert irradiance to radiance. */
|
||||
return (float)M_1_PI * inv_sin_sq;
|
||||
return float(M_1_PI) * inv_sin_sq;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,14 +114,14 @@ static float light_volume_radiance_factor_get(const Light *la,
|
||||
float tmp = M_PI_2 / (M_PI_2 + sqrtf(area));
|
||||
/* Lerp between 1.0 and the limit (1 / pi). */
|
||||
float mrp_scaling = tmp + (1.0f - tmp) * M_1_PI;
|
||||
power *= (float)M_1_PI * mrp_scaling;
|
||||
power *= float(M_1_PI) * mrp_scaling;
|
||||
break;
|
||||
}
|
||||
case LA_SPOT:
|
||||
case LA_LOCAL: {
|
||||
/* Convert radiant flux to intensity. */
|
||||
/* Inverse of sphere solid angle. */
|
||||
power *= 0.25f * (float)M_1_PI;
|
||||
power *= 0.25f * float(M_1_PI);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -186,7 +186,7 @@ static void eevee_light_setup(Object *ob, EEVEE_Light *evli)
|
||||
light_shape_parameters_set(evli, la, scale);
|
||||
|
||||
/* Light Type */
|
||||
evli->light_type = (float)la->type;
|
||||
evli->light_type = float(la->type);
|
||||
if ((la->type == LA_AREA) && ELEM(la->area_shape, LA_AREA_DISK, LA_AREA_ELLIPSE)) {
|
||||
evli->light_type = LAMPTYPE_AREA_ELLIPSE;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ static void eevee_lookdev_hdri_preview_init(EEVEE_Data *vedata, EEVEE_ViewLayerD
|
||||
DRWShadingGroup *grp;
|
||||
|
||||
const EEVEE_EffectsInfo *effects = vedata->stl->effects;
|
||||
struct GPUBatch *sphere = DRW_cache_sphere_get(effects->sphere_lod);
|
||||
GPUBatch *sphere = DRW_cache_sphere_get(effects->sphere_lod);
|
||||
int mat_options = VAR_MAT_MESH | VAR_MAT_LOOKDEV;
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS |
|
||||
|
||||
@@ -58,7 +58,7 @@ typedef struct EeveeMaterialCache {
|
||||
/* *********** FUNCTIONS *********** */
|
||||
|
||||
/* XXX TODO: define all shared resources in a shared place without duplication. */
|
||||
GPUTexture *EEVEE_materials_get_util_tex(void)
|
||||
GPUTexture *EEVEE_materials_get_util_tex()
|
||||
{
|
||||
return e_data.util_tex;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void EEVEE_material_bind_resources(DRWShadingGroup *shgrp,
|
||||
}
|
||||
}
|
||||
|
||||
static void eevee_init_noise_texture(void)
|
||||
static void eevee_init_noise_texture()
|
||||
{
|
||||
e_data.noise_tex = DRW_texture_create_2d(
|
||||
64, 64, GPU_RGBA16F, DRWTextureFlag(0), (float *)blue_noise);
|
||||
@@ -143,7 +143,7 @@ static void eevee_init_noise_texture(void)
|
||||
|
||||
#define RUNTIME_LUT_CREATION 0
|
||||
|
||||
static void eevee_init_util_texture(void)
|
||||
static void eevee_init_util_texture()
|
||||
{
|
||||
const int layers = 4 + 16;
|
||||
float(*texels)[4] = static_cast<float(*)[4]>(
|
||||
@@ -255,7 +255,7 @@ void EEVEE_materials_init(EEVEE_ViewLayerData *sldata,
|
||||
else {
|
||||
double r;
|
||||
BLI_halton_1d(5, 0.0, stl->effects->taa_current_sample - 1, &r);
|
||||
sldata->common_data.alpha_hash_offset = (float)r;
|
||||
sldata->common_data.alpha_hash_offset = float(r);
|
||||
sldata->common_data.alpha_hash_scale = 0.01f;
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
||||
GPUMaterial **gpumat_array = BLI_array_alloca(gpumat_array, materials_len);
|
||||
MATCACHE_AS_ARRAY(matcache, shading_gpumat, materials_len, gpumat_array);
|
||||
/* Get per-material split surface */
|
||||
struct GPUBatch **mat_geom = DRW_cache_object_surface_material_get(
|
||||
GPUBatch **mat_geom = DRW_cache_object_surface_material_get(
|
||||
ob, gpumat_array, materials_len);
|
||||
|
||||
if (mat_geom) {
|
||||
@@ -995,7 +995,7 @@ void EEVEE_materials_cache_finish(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *
|
||||
SET_FLAG_FROM_TEST(effects->enabled_effects, effects->sss_surface_count > 0, EFFECT_SSS);
|
||||
}
|
||||
|
||||
void EEVEE_materials_free(void)
|
||||
void EEVEE_materials_free()
|
||||
{
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.util_tex);
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.noise_tex);
|
||||
|
||||
@@ -62,8 +62,8 @@ int EEVEE_motion_blur_init(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *vedata)
|
||||
|
||||
const float *fs_size = DRW_viewport_size_get();
|
||||
const int tx_size[2] = {
|
||||
1 + ((int)fs_size[0] / EEVEE_VELOCITY_TILE_SIZE),
|
||||
1 + ((int)fs_size[1] / EEVEE_VELOCITY_TILE_SIZE),
|
||||
1 + (int(fs_size[0]) / EEVEE_VELOCITY_TILE_SIZE),
|
||||
1 + (int(fs_size[1]) / EEVEE_VELOCITY_TILE_SIZE),
|
||||
};
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
effects->velocity_tiles_x_tx = DRW_texture_pool_query_2d_ex(
|
||||
|
||||
@@ -47,7 +47,7 @@ int EEVEE_occlusion_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
stl->g_data->render_passes & EEVEE_RENDER_PASS_AO)
|
||||
{
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const int fs_size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
const int fs_size[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
|
||||
common_data->ao_dist = scene_eval->eevee.gtao_distance;
|
||||
common_data->ao_factor = max_ff(1e-4f, scene_eval->eevee.gtao_factor);
|
||||
@@ -266,7 +266,7 @@ void EEVEE_occlusion_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *
|
||||
}
|
||||
}
|
||||
|
||||
void EEVEE_occlusion_free(void)
|
||||
void EEVEE_occlusion_free()
|
||||
{
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.dummy_horizon_tx);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool EEVEE_render_init(EEVEE_Data *ved, RenderEngine *engine, Depsgraph *depsgra
|
||||
}
|
||||
EEVEE_PrivateData *g_data = stl->g_data;
|
||||
g_data->background_alpha = DRW_state_draw_background() ? 1.0f : 0.0f;
|
||||
g_data->valid_double_buffer = 0;
|
||||
g_data->valid_double_buffer = false;
|
||||
copy_v2_v2(g_data->size_orig, size_orig);
|
||||
|
||||
float *camtexcofac = g_data->camtexcofac;
|
||||
@@ -664,7 +664,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
|
||||
* flushing of freed GPUBackend resources. */
|
||||
GPU_render_step();
|
||||
|
||||
RE_engine_update_progress(engine, (float)(render_samples++) / (float)tot_sample);
|
||||
RE_engine_update_progress(engine, float(render_samples++) / float(tot_sample));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,16 +61,16 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
|
||||
void *owner = (void *)EEVEE_screen_raytrace_init;
|
||||
const int divisor = (effects->reflection_trace_full) ? 1 : 2;
|
||||
int tracing_res[2] = {(int)viewport_size[0] / divisor, (int)viewport_size[1] / divisor};
|
||||
const int size_fs[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
int tracing_res[2] = {int(viewport_size[0]) / divisor, int(viewport_size[1]) / divisor};
|
||||
const int size_fs[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
const bool high_qual_input = true; /* TODO: dither low quality input. */
|
||||
const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
|
||||
|
||||
tracing_res[0] = max_ii(1, tracing_res[0]);
|
||||
tracing_res[1] = max_ii(1, tracing_res[1]);
|
||||
|
||||
common_data->ssr_uv_scale[0] = size_fs[0] / ((float)tracing_res[0] * divisor);
|
||||
common_data->ssr_uv_scale[1] = size_fs[1] / ((float)tracing_res[1] * divisor);
|
||||
common_data->ssr_uv_scale[0] = size_fs[0] / (float(tracing_res[0]) * divisor);
|
||||
common_data->ssr_uv_scale[1] = size_fs[1] / (float(tracing_res[1]) * divisor);
|
||||
|
||||
/* MRT for the shading pass in order to output needed data for the SSR pass. */
|
||||
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT;
|
||||
|
||||
@@ -102,7 +102,7 @@ static void frustum_min_bounding_sphere(const float corners[8][3],
|
||||
* Remember we need a __stable__ solution! */
|
||||
|
||||
/* Try to reduce float imprecision leading to shimmering. */
|
||||
*r_radius = (float)round_to_digits(sqrtf(*r_radius), 3);
|
||||
*r_radius = float(round_to_digits(sqrtf(*r_radius), 3));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -113,10 +113,10 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
|
||||
float view_far,
|
||||
int sample_ofs)
|
||||
{
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id;
|
||||
EEVEE_ShadowCascade *csm_data = linfo->shadow_cascade_data + (int)shdw_data->type_data_id;
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + int(evli->shadow_id);
|
||||
EEVEE_ShadowCascade *csm_data = linfo->shadow_cascade_data + int(shdw_data->type_data_id);
|
||||
EEVEE_ShadowCascadeRender *csm_render = linfo->shadow_cascade_render +
|
||||
(int)shdw_data->type_data_id;
|
||||
int(shdw_data->type_data_id);
|
||||
int cascade_count = csm_render->cascade_count;
|
||||
float cascade_fade = csm_render->cascade_fade;
|
||||
float cascade_max_dist = csm_render->cascade_max_dist;
|
||||
@@ -235,8 +235,8 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
|
||||
|
||||
for (int c = 1; c < cascade_count; c++) {
|
||||
/* View Space */
|
||||
float linear_split = interpf(csm_end, csm_start, c / (float)cascade_count);
|
||||
float exp_split = csm_start * powf(csm_end / csm_start, c / (float)cascade_count);
|
||||
float linear_split = interpf(csm_end, csm_start, c / float(cascade_count));
|
||||
float exp_split = csm_start * powf(csm_end / csm_start, c / float(cascade_count));
|
||||
|
||||
if (is_persp) {
|
||||
csm_data->split_start[c] = interpf(exp_split, linear_split, cascade_exponent);
|
||||
@@ -394,10 +394,10 @@ void EEVEE_shadows_draw_cascades(EEVEE_ViewLayerData *sldata,
|
||||
EEVEE_LightsInfo *linfo = sldata->lights;
|
||||
|
||||
EEVEE_Light *evli = linfo->light_data + linfo->shadow_cascade_light_indices[cascade_index];
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id;
|
||||
EEVEE_ShadowCascade *csm_data = linfo->shadow_cascade_data + (int)shdw_data->type_data_id;
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + int(evli->shadow_id);
|
||||
EEVEE_ShadowCascade *csm_data = linfo->shadow_cascade_data + int(shdw_data->type_data_id);
|
||||
EEVEE_ShadowCascadeRender *csm_render = linfo->shadow_cascade_render +
|
||||
(int)shdw_data->type_data_id;
|
||||
int(shdw_data->type_data_id);
|
||||
|
||||
float near = DRW_view_near_distance_get(view);
|
||||
float far = DRW_view_far_distance_get(view);
|
||||
|
||||
@@ -60,11 +60,11 @@ start:
|
||||
#else
|
||||
int i = sample_ofs;
|
||||
#endif
|
||||
switch ((int)evli->light_type) {
|
||||
switch (int(evli->light_type)) {
|
||||
case LA_AREA:
|
||||
EEVEE_sample_rectangle(i, evli->rightvec, evli->upvec, evli->sizex, evli->sizey, jitter);
|
||||
break;
|
||||
case (int)LAMPTYPE_AREA_ELLIPSE:
|
||||
case int(LAMPTYPE_AREA_ELLIPSE):
|
||||
EEVEE_sample_ellipse(i, evli->rightvec, evli->upvec, evli->sizex, evli->sizey, jitter);
|
||||
break;
|
||||
default:
|
||||
@@ -83,8 +83,8 @@ start:
|
||||
|
||||
bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli, int sample_ofs)
|
||||
{
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id;
|
||||
EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + (int)shdw_data->type_data_id;
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + int(evli->shadow_id);
|
||||
EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + int(shdw_data->type_data_id);
|
||||
|
||||
eevee_light_matrix_get(evli, cube_data->shadowmat);
|
||||
|
||||
@@ -111,7 +111,7 @@ bool EEVEE_shadows_cube_setup(EEVEE_LightsInfo *linfo, const EEVEE_Light *evli,
|
||||
*/
|
||||
/* NOTE: this has implication for spotlight rendering optimization
|
||||
* (see EEVEE_shadows_draw_cubemap). */
|
||||
float angular_texel_size = 2.0f * DEG2RADF(90) / (float)linfo->shadow_cube_size;
|
||||
float angular_texel_size = 2.0f * DEG2RADF(90) / float(linfo->shadow_cube_size);
|
||||
EEVEE_random_rotation_m4(sample_ofs, angular_texel_size, cube_data->shadowmat);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ static void eevee_ensure_cube_views(
|
||||
/* This half texel offset is used to ensure correct filtering between faces. */
|
||||
/* FIXME: This exhibit float precision issue with lower cube_res.
|
||||
* But it seems to be caused by the perspective_m4. */
|
||||
side *= ((float)cube_res + 1.0f) / (float)(cube_res);
|
||||
side *= (float(cube_res) + 1.0f) / float(cube_res);
|
||||
}
|
||||
|
||||
perspective_m4(winmat, -side, side, -side, side, near, far);
|
||||
@@ -171,8 +171,8 @@ void EEVEE_shadows_draw_cubemap(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata,
|
||||
EEVEE_LightsInfo *linfo = sldata->lights;
|
||||
|
||||
EEVEE_Light *evli = linfo->light_data + linfo->shadow_cube_light_indices[cube_index];
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + (int)evli->shadow_id;
|
||||
EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + (int)shdw_data->type_data_id;
|
||||
EEVEE_Shadow *shdw_data = linfo->shadow_data + int(evli->shadow_id);
|
||||
EEVEE_ShadowCube *cube_data = linfo->shadow_cube_data + int(shdw_data->type_data_id);
|
||||
|
||||
eevee_ensure_cube_views(shdw_data->near,
|
||||
shdw_data->far,
|
||||
|
||||
@@ -30,7 +30,7 @@ void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
EEVEE_TextureList *txl = vedata->txl;
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const int fs_size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
const int fs_size[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
|
||||
if (effects->enabled_effects & EFFECT_SSS) {
|
||||
/* NOTE: we need another stencil because the stencil buffer is on the same texture
|
||||
|
||||
@@ -46,7 +46,7 @@ static void compute_cdf(float (*func)(float x), float cdf[FILTER_CDF_TABLE_SIZE]
|
||||
cdf[0] = 0.0f;
|
||||
/* Actual CDF evaluation. */
|
||||
for (int u = 0; u < FILTER_CDF_TABLE_SIZE - 1; u++) {
|
||||
float x = (float)(u + 1) / (float)(FILTER_CDF_TABLE_SIZE - 1);
|
||||
float x = float(u + 1) / float(FILTER_CDF_TABLE_SIZE - 1);
|
||||
cdf[u + 1] = cdf[u] + func(x - 0.5f); /* [-0.5..0.5]. We resize later. */
|
||||
}
|
||||
/* Normalize the CDF. */
|
||||
@@ -61,7 +61,7 @@ static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE],
|
||||
float invert_cdf[FILTER_CDF_TABLE_SIZE])
|
||||
{
|
||||
for (int u = 0; u < FILTER_CDF_TABLE_SIZE; u++) {
|
||||
float x = (float)u / (float)(FILTER_CDF_TABLE_SIZE - 1);
|
||||
float x = float(u) / float(FILTER_CDF_TABLE_SIZE - 1);
|
||||
for (int i = 0; i < FILTER_CDF_TABLE_SIZE; i++) {
|
||||
if (cdf[i] >= x) {
|
||||
if (i == FILTER_CDF_TABLE_SIZE - 1) {
|
||||
@@ -69,7 +69,7 @@ static void invert_cdf(const float cdf[FILTER_CDF_TABLE_SIZE],
|
||||
}
|
||||
else {
|
||||
float t = (x - cdf[i]) / (cdf[i + 1] - cdf[i]);
|
||||
invert_cdf[u] = ((float)i + t) / (float)(FILTER_CDF_TABLE_SIZE - 1);
|
||||
invert_cdf[u] = (float(i) + t) / float(FILTER_CDF_TABLE_SIZE - 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -83,14 +83,14 @@ static float eval_table(const float *table, float x)
|
||||
CLAMP(x, 0.0f, 1.0f);
|
||||
x = x * (FILTER_CDF_TABLE_SIZE - 1);
|
||||
|
||||
int index = min_ii((int)(x), FILTER_CDF_TABLE_SIZE - 1);
|
||||
int index = min_ii(int(x), FILTER_CDF_TABLE_SIZE - 1);
|
||||
int nindex = min_ii(index + 1, FILTER_CDF_TABLE_SIZE - 1);
|
||||
float t = x - index;
|
||||
|
||||
return (1.0f - t) * table[index] + t * table[nindex];
|
||||
}
|
||||
|
||||
static void eevee_create_cdf_table_temporal_sampling(void)
|
||||
static void eevee_create_cdf_table_temporal_sampling()
|
||||
{
|
||||
float *cdf_table = static_cast<float *>(
|
||||
MEM_mallocN(sizeof(float) * FILTER_CDF_TABLE_SIZE, "Eevee Filter CDF table"));
|
||||
@@ -118,8 +118,8 @@ void EEVEE_temporal_sampling_offset_calc(const double ht_point[2],
|
||||
const float filter_size,
|
||||
float r_offset[2])
|
||||
{
|
||||
r_offset[0] = eval_table(e_data.inverted_cdf, (float)(ht_point[0])) * filter_size;
|
||||
r_offset[1] = eval_table(e_data.inverted_cdf, (float)(ht_point[1])) * filter_size;
|
||||
r_offset[0] = eval_table(e_data.inverted_cdf, float(ht_point[0])) * filter_size;
|
||||
r_offset[1] = eval_table(e_data.inverted_cdf, float(ht_point[1])) * filter_size;
|
||||
}
|
||||
|
||||
void EEVEE_temporal_sampling_matrices_calc(EEVEE_EffectsInfo *effects, const double ht_point[2])
|
||||
@@ -273,7 +273,7 @@ int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *v
|
||||
view_is_valid = view_is_valid && (stl->g_data->view_updated == false);
|
||||
|
||||
if (draw_ctx->evil_C != nullptr) {
|
||||
struct wmWindowManager *wm = CTX_wm_manager(draw_ctx->evil_C);
|
||||
wmWindowManager *wm = CTX_wm_manager(draw_ctx->evil_C);
|
||||
view_is_valid = view_is_valid && (ED_screen_animation_no_scrub(wm) == nullptr);
|
||||
}
|
||||
|
||||
@@ -373,10 +373,10 @@ void EEVEE_temporal_sampling_draw(EEVEE_Data *vedata)
|
||||
if ((effects->enabled_effects & EFFECT_TAA) != 0 && effects->taa_current_sample != 1) {
|
||||
if (DRW_state_is_image_render()) {
|
||||
/* See EEVEE_temporal_sampling_init() for more details. */
|
||||
effects->taa_alpha = 1.0f / (float)(effects->taa_render_sample);
|
||||
effects->taa_alpha = 1.0f / float(effects->taa_render_sample);
|
||||
}
|
||||
else {
|
||||
effects->taa_alpha = 1.0f / (float)(effects->taa_current_sample);
|
||||
effects->taa_alpha = 1.0f / float(effects->taa_current_sample);
|
||||
}
|
||||
|
||||
GPU_framebuffer_bind(effects->target_buffer);
|
||||
|
||||
@@ -57,9 +57,9 @@ void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample)
|
||||
|
||||
BLI_halton_3d(ht_primes, ht_offset, current_sample, ht_point);
|
||||
|
||||
common_data->vol_jitter[0] = (float)ht_point[0];
|
||||
common_data->vol_jitter[1] = (float)ht_point[1];
|
||||
common_data->vol_jitter[2] = (float)ht_point[2];
|
||||
common_data->vol_jitter[0] = float(ht_point[0]);
|
||||
common_data->vol_jitter[1] = float(ht_point[1]);
|
||||
common_data->vol_jitter[2] = float(ht_point[2]);
|
||||
}
|
||||
|
||||
void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
@@ -80,8 +80,8 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
/* Find Froxel Texture resolution. */
|
||||
int tex_size[3];
|
||||
|
||||
tex_size[0] = (int)ceilf(fmaxf(1.0f, viewport_size[0] / (float)tile_size));
|
||||
tex_size[1] = (int)ceilf(fmaxf(1.0f, viewport_size[1] / (float)tile_size));
|
||||
tex_size[0] = int(ceilf(fmaxf(1.0f, viewport_size[0] / float(tile_size))));
|
||||
tex_size[1] = int(ceilf(fmaxf(1.0f, viewport_size[1] / float(tile_size))));
|
||||
tex_size[2] = max_ii(scene_eval->eevee.volumetric_samples, 1);
|
||||
|
||||
/* Clamp 3D texture size based on device maximum. */
|
||||
@@ -91,8 +91,8 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
tex_size[1] = tex_size[1] > maxSize ? maxSize : tex_size[1];
|
||||
tex_size[2] = tex_size[2] > maxSize ? maxSize : tex_size[2];
|
||||
|
||||
common_data->vol_coord_scale[0] = viewport_size[0] / (float)(tile_size * tex_size[0]);
|
||||
common_data->vol_coord_scale[1] = viewport_size[1] / (float)(tile_size * tex_size[1]);
|
||||
common_data->vol_coord_scale[0] = viewport_size[0] / float(tile_size * tex_size[0]);
|
||||
common_data->vol_coord_scale[1] = viewport_size[1] / float(tile_size * tex_size[1]);
|
||||
common_data->vol_coord_scale[2] = 1.0f / viewport_size[0];
|
||||
common_data->vol_coord_scale[3] = 1.0f / viewport_size[1];
|
||||
|
||||
@@ -114,9 +114,9 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_integ_fb);
|
||||
copy_v3_v3_int(common_data->vol_tex_size, tex_size);
|
||||
|
||||
common_data->vol_inv_tex_size[0] = 1.0f / (float)(tex_size[0]);
|
||||
common_data->vol_inv_tex_size[1] = 1.0f / (float)(tex_size[1]);
|
||||
common_data->vol_inv_tex_size[2] = 1.0f / (float)(tex_size[2]);
|
||||
common_data->vol_inv_tex_size[0] = 1.0f / float(tex_size[0]);
|
||||
common_data->vol_inv_tex_size[1] = 1.0f / float(tex_size[1]);
|
||||
common_data->vol_inv_tex_size[2] = 1.0f / float(tex_size[2]);
|
||||
}
|
||||
|
||||
/* Like frostbite's paper, 5% blend of the new frame. */
|
||||
@@ -130,7 +130,7 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
bool do_taa = ((effects->enabled_effects & EFFECT_TAA) != 0);
|
||||
|
||||
if (draw_ctx->evil_C != nullptr) {
|
||||
struct wmWindowManager *wm = CTX_wm_manager(draw_ctx->evil_C);
|
||||
wmWindowManager *wm = CTX_wm_manager(draw_ctx->evil_C);
|
||||
do_taa = do_taa && (ED_screen_animation_no_scrub(wm) == nullptr);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ void EEVEE_volumes_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
||||
float integration_start = scene_eval->eevee.volumetric_start;
|
||||
float integration_end = scene_eval->eevee.volumetric_end;
|
||||
effects->volume_light_clamp = scene_eval->eevee.volumetric_light_clamp;
|
||||
common_data->vol_shadow_steps = (float)scene_eval->eevee.volumetric_shadow_samples;
|
||||
common_data->vol_shadow_steps = float(scene_eval->eevee.volumetric_shadow_samples);
|
||||
if ((scene_eval->eevee.flag & SCE_EEVEE_VOLUMETRIC_SHADOWS) == 0) {
|
||||
common_data->vol_shadow_steps = 0;
|
||||
}
|
||||
@@ -598,7 +598,7 @@ void EEVEE_volumes_resolve(EEVEE_ViewLayerData * /*sldata*/, EEVEE_Data *vedata)
|
||||
}
|
||||
}
|
||||
|
||||
void EEVEE_volumes_free(void)
|
||||
void EEVEE_volumes_free()
|
||||
{
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.dummy_scatter);
|
||||
DRW_TEXTURE_FREE_SAFE(e_data.dummy_transmit);
|
||||
|
||||
@@ -394,7 +394,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
|
||||
DRW_shgroup_uniform_vec3_copy(grp, "gpNormal", tgp_ob->plane_normal);
|
||||
DRW_shgroup_uniform_bool_copy(grp, "gpStrokeOrder3d", tgp_ob->is_drawmode3d);
|
||||
DRW_shgroup_uniform_float_copy(grp, "gpThicknessScale", tgp_ob->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_float_copy(grp, "gpVertexColorOpacity", vert_col_opacity);
|
||||
|
||||
|
||||
@@ -466,7 +466,7 @@ static void gpencil_view_layer_data_free(void *storage)
|
||||
BLI_memblock_destroy(vldata->gp_vfx_pool, nullptr);
|
||||
}
|
||||
|
||||
GPENCIL_ViewLayerData *GPENCIL_view_layer_data_ensure(void)
|
||||
GPENCIL_ViewLayerData *GPENCIL_view_layer_data_ensure()
|
||||
{
|
||||
GPENCIL_ViewLayerData **vldata = (GPENCIL_ViewLayerData **)DRW_view_layer_engine_data_ensure(
|
||||
&draw_engine_gpencil_type, gpencil_view_layer_data_free);
|
||||
|
||||
@@ -181,7 +181,7 @@ void GPENCIL_cache_init(void *ved)
|
||||
DRWShadingGroup *grp;
|
||||
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
pd->cfra = (int)DEG_get_ctime(draw_ctx->depsgraph);
|
||||
pd->cfra = int(DEG_get_ctime(draw_ctx->depsgraph));
|
||||
pd->simplify_antialias = GPENCIL_SIMPLIFY_AA(draw_ctx->scene);
|
||||
pd->use_layer_fb = false;
|
||||
pd->use_object_fb = false;
|
||||
@@ -539,7 +539,7 @@ static void gpencil_stroke_cache_populate(bGPDlayer *gpl,
|
||||
if (show_stroke) {
|
||||
int vfirst = gps->runtime.stroke_start * 3;
|
||||
bool is_cyclic = ((gps->flag & GP_STROKE_CYCLIC) != 0) && (gps->totpoints > 2);
|
||||
int vcount = (gps->totpoints + (int)is_cyclic) * 2 * 3;
|
||||
int vcount = (gps->totpoints + int(is_cyclic)) * 2 * 3;
|
||||
gpencil_drawcall_add(iter, geom, vfirst, vcount);
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ void GPENCIL_cache_populate(void *ved, Object *ob)
|
||||
/* Special case for rendering onion skin. */
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
bool do_onion = (!pd->is_render) ? pd->do_onion : (gpd->onion_flag & GP_ONION_GHOST_ALWAYS);
|
||||
gpd->runtime.playing = (short)pd->playing;
|
||||
gpd->runtime.playing = short(pd->playing);
|
||||
|
||||
/* When render in background the active frame could not be properly set due thread priority,
|
||||
* better set again. This is not required in viewport. */
|
||||
@@ -972,7 +972,7 @@ void GPENCIL_draw_scene(void *ved)
|
||||
}
|
||||
}
|
||||
|
||||
static void GPENCIL_engine_free(void)
|
||||
static void GPENCIL_engine_free()
|
||||
{
|
||||
GPENCIL_shader_free();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ void GPENCIL_render_init(GPENCIL_Data *vedata,
|
||||
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
const int size[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
|
||||
/* Set the perspective & view matrix. */
|
||||
float winmat[4][4], viewmat[4][4], viewinv[4][4];
|
||||
|
||||
@@ -48,7 +48,7 @@ static struct {
|
||||
GPUShader *fx_transform_sh;
|
||||
} g_shaders = {{nullptr}};
|
||||
|
||||
void GPENCIL_shader_free(void)
|
||||
void GPENCIL_shader_free()
|
||||
{
|
||||
DRW_SHADER_FREE_SAFE(g_shaders.antialiasing_sh[0]);
|
||||
DRW_SHADER_FREE_SAFE(g_shaders.antialiasing_sh[1]);
|
||||
@@ -80,7 +80,7 @@ GPUShader *GPENCIL_shader_antialiasing(int stage)
|
||||
return g_shaders.antialiasing_sh[stage];
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_geometry_get(void)
|
||||
GPUShader *GPENCIL_shader_geometry_get()
|
||||
{
|
||||
if (!g_shaders.gpencil_sh) {
|
||||
g_shaders.gpencil_sh = GPU_shader_create_from_info_name("gpencil_geometry");
|
||||
@@ -88,7 +88,7 @@ GPUShader *GPENCIL_shader_geometry_get(void)
|
||||
return g_shaders.gpencil_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_layer_blend_get(void)
|
||||
GPUShader *GPENCIL_shader_layer_blend_get()
|
||||
{
|
||||
if (!g_shaders.layer_blend_sh) {
|
||||
g_shaders.layer_blend_sh = GPU_shader_create_from_info_name("gpencil_layer_blend");
|
||||
@@ -96,7 +96,7 @@ GPUShader *GPENCIL_shader_layer_blend_get(void)
|
||||
return g_shaders.layer_blend_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_mask_invert_get(void)
|
||||
GPUShader *GPENCIL_shader_mask_invert_get()
|
||||
{
|
||||
if (!g_shaders.mask_invert_sh) {
|
||||
g_shaders.mask_invert_sh = GPU_shader_create_from_info_name("gpencil_mask_invert");
|
||||
@@ -104,7 +104,7 @@ GPUShader *GPENCIL_shader_mask_invert_get(void)
|
||||
return g_shaders.mask_invert_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_depth_merge_get(void)
|
||||
GPUShader *GPENCIL_shader_depth_merge_get()
|
||||
{
|
||||
if (!g_shaders.depth_merge_sh) {
|
||||
g_shaders.depth_merge_sh = GPU_shader_create_from_info_name("gpencil_depth_merge");
|
||||
@@ -114,7 +114,7 @@ GPUShader *GPENCIL_shader_depth_merge_get(void)
|
||||
|
||||
/* ------- FX Shaders --------- */
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_blur_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_blur_get()
|
||||
{
|
||||
if (!g_shaders.fx_blur_sh) {
|
||||
g_shaders.fx_blur_sh = GPU_shader_create_from_info_name("gpencil_fx_blur");
|
||||
@@ -122,7 +122,7 @@ GPUShader *GPENCIL_shader_fx_blur_get(void)
|
||||
return g_shaders.fx_blur_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_colorize_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_colorize_get()
|
||||
{
|
||||
if (!g_shaders.fx_colorize_sh) {
|
||||
g_shaders.fx_colorize_sh = GPU_shader_create_from_info_name("gpencil_fx_colorize");
|
||||
@@ -130,7 +130,7 @@ GPUShader *GPENCIL_shader_fx_colorize_get(void)
|
||||
return g_shaders.fx_colorize_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_composite_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_composite_get()
|
||||
{
|
||||
if (!g_shaders.fx_composite_sh) {
|
||||
g_shaders.fx_composite_sh = GPU_shader_create_from_info_name("gpencil_fx_composite");
|
||||
@@ -138,7 +138,7 @@ GPUShader *GPENCIL_shader_fx_composite_get(void)
|
||||
return g_shaders.fx_composite_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_glow_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_glow_get()
|
||||
{
|
||||
if (!g_shaders.fx_glow_sh) {
|
||||
g_shaders.fx_glow_sh = GPU_shader_create_from_info_name("gpencil_fx_glow");
|
||||
@@ -146,7 +146,7 @@ GPUShader *GPENCIL_shader_fx_glow_get(void)
|
||||
return g_shaders.fx_glow_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_pixelize_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_pixelize_get()
|
||||
{
|
||||
if (!g_shaders.fx_pixel_sh) {
|
||||
g_shaders.fx_pixel_sh = GPU_shader_create_from_info_name("gpencil_fx_pixelize");
|
||||
@@ -154,7 +154,7 @@ GPUShader *GPENCIL_shader_fx_pixelize_get(void)
|
||||
return g_shaders.fx_pixel_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_rim_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_rim_get()
|
||||
{
|
||||
if (!g_shaders.fx_rim_sh) {
|
||||
g_shaders.fx_rim_sh = GPU_shader_create_from_info_name("gpencil_fx_rim");
|
||||
@@ -162,7 +162,7 @@ GPUShader *GPENCIL_shader_fx_rim_get(void)
|
||||
return g_shaders.fx_rim_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_shadow_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_shadow_get()
|
||||
{
|
||||
if (!g_shaders.fx_shadow_sh) {
|
||||
g_shaders.fx_shadow_sh = GPU_shader_create_from_info_name("gpencil_fx_shadow");
|
||||
@@ -170,7 +170,7 @@ GPUShader *GPENCIL_shader_fx_shadow_get(void)
|
||||
return g_shaders.fx_shadow_sh;
|
||||
}
|
||||
|
||||
GPUShader *GPENCIL_shader_fx_transform_get(void)
|
||||
GPUShader *GPENCIL_shader_fx_transform_get()
|
||||
{
|
||||
if (!g_shaders.fx_transform_sh) {
|
||||
g_shaders.fx_transform_sh = GPU_shader_create_from_info_name("gpencil_fx_transform");
|
||||
|
||||
@@ -97,13 +97,13 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
|
||||
BM_mesh_elem_table_ensure(em->bm, BM_VERT | BM_EDGE | BM_FACE);
|
||||
|
||||
if (select_mode & SCE_SELECT_FACE) {
|
||||
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
DRWShadingGroup *face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat);
|
||||
DRW_shgroup_uniform_int_copy(face_shgrp, "offset", *(int *)&initial_offset);
|
||||
DRW_shgroup_call_no_cull(face_shgrp, geom_faces, ob);
|
||||
|
||||
if (draw_facedot) {
|
||||
struct GPUBatch *geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me);
|
||||
GPUBatch *geom_facedots = DRW_mesh_batch_cache_get_facedots_with_select_id(me);
|
||||
DRW_shgroup_call_no_cull(face_shgrp, geom_facedots, ob);
|
||||
}
|
||||
*r_face_offset = initial_offset + em->bm->totface;
|
||||
@@ -111,7 +111,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
|
||||
else {
|
||||
if (ob->dt >= OB_SOLID) {
|
||||
#ifdef USE_CAGE_OCCLUSION
|
||||
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
#else
|
||||
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_surface(me);
|
||||
#endif
|
||||
@@ -123,7 +123,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
|
||||
|
||||
/* Unlike faces, only draw edges if edge select mode. */
|
||||
if (select_mode & SCE_SELECT_EDGE) {
|
||||
struct GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
|
||||
GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
|
||||
DRWShadingGroup *edge_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_edge);
|
||||
DRW_shgroup_uniform_int_copy(edge_shgrp, "offset", *(int *)r_face_offset);
|
||||
DRW_shgroup_call_no_cull(edge_shgrp, geom_edges, ob);
|
||||
@@ -137,7 +137,7 @@ static void draw_select_id_edit_mesh(SELECTID_StorageList *stl,
|
||||
|
||||
/* Unlike faces, only verts if vert select mode. */
|
||||
if (select_mode & SCE_SELECT_VERTEX) {
|
||||
struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
|
||||
GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
|
||||
DRWShadingGroup *vert_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_vert);
|
||||
DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *(int *)r_edge_offset);
|
||||
DRW_shgroup_call_no_cull(vert_shgrp, geom_verts, ob);
|
||||
@@ -158,7 +158,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
|
||||
{
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
|
||||
struct GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
DRWShadingGroup *face_shgrp;
|
||||
if (select_mode & SCE_SELECT_FACE) {
|
||||
face_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_face_flat);
|
||||
@@ -173,7 +173,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
|
||||
DRW_shgroup_call_no_cull(face_shgrp, geom_faces, ob);
|
||||
|
||||
if (select_mode & SCE_SELECT_EDGE) {
|
||||
struct GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
|
||||
GPUBatch *geom_edges = DRW_mesh_batch_cache_get_edges_with_select_id(me);
|
||||
DRWShadingGroup *edge_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_edge);
|
||||
DRW_shgroup_uniform_int_copy(edge_shgrp, "offset", *(int *)r_face_offset);
|
||||
DRW_shgroup_call_no_cull(edge_shgrp, geom_edges, ob);
|
||||
@@ -184,7 +184,7 @@ static void draw_select_id_mesh(SELECTID_StorageList *stl,
|
||||
}
|
||||
|
||||
if (select_mode & SCE_SELECT_VERTEX) {
|
||||
struct GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
|
||||
GPUBatch *geom_verts = DRW_mesh_batch_cache_get_verts_with_select_id(me);
|
||||
DRWShadingGroup *vert_shgrp = DRW_shgroup_create_sub(stl->g_data->shgrp_vert);
|
||||
DRW_shgroup_uniform_int_copy(vert_shgrp, "offset", *r_edge_offset);
|
||||
DRW_shgroup_call_no_cull(vert_shgrp, geom_verts, ob);
|
||||
|
||||
@@ -40,7 +40,7 @@ static struct {
|
||||
/** \name Utils
|
||||
* \{ */
|
||||
|
||||
static void select_engine_framebuffer_setup(void)
|
||||
static void select_engine_framebuffer_setup()
|
||||
{
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
int size[2];
|
||||
@@ -234,7 +234,7 @@ static void select_cache_populate(void *vedata, Object *ob)
|
||||
if (!e_data.context.is_dirty && sel_data && sel_data->is_drawn) {
|
||||
/* The object indices have already been drawn. Fill depth pass.
|
||||
* Optimization: Most of the time this depth pass is not used. */
|
||||
struct Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
Mesh *me = static_cast<Mesh *>(ob->data);
|
||||
if (e_data.context.select_mode & SCE_SELECT_FACE) {
|
||||
GPUBatch *geom_faces = DRW_mesh_batch_cache_get_triangles_with_select_id(me);
|
||||
DRW_shgroup_call_obmat(stl->g_data->shgrp_depth_only, geom_faces, ob->object_to_world);
|
||||
@@ -272,8 +272,7 @@ static void select_cache_populate(void *vedata, Object *ob)
|
||||
sel_data->drawn_index = e_data.context.objects_drawn_len;
|
||||
sel_data->is_drawn = true;
|
||||
|
||||
struct ObjectOffsets *ob_offsets =
|
||||
&e_data.context.index_offsets[e_data.context.objects_drawn_len];
|
||||
ObjectOffsets *ob_offsets = &e_data.context.index_offsets[e_data.context.objects_drawn_len];
|
||||
|
||||
uint offset = e_data.context.index_drawn_len;
|
||||
select_id_draw_object(vedata,
|
||||
@@ -331,7 +330,7 @@ static void select_draw_scene(void *vedata)
|
||||
}
|
||||
}
|
||||
|
||||
static void select_engine_free(void)
|
||||
static void select_engine_free()
|
||||
{
|
||||
for (int sh_data_index = 0; sh_data_index < ARRAY_SIZE(e_data.sh_data); sh_data_index++) {
|
||||
SELECTID_Shaders *sh_data = &e_data.sh_data[sh_data_index];
|
||||
@@ -404,17 +403,17 @@ RenderEngineType DRW_engine_viewport_select_type = {
|
||||
/** \name Exposed `select_private.h` functions
|
||||
* \{ */
|
||||
|
||||
SELECTID_Context *DRW_select_engine_context_get(void)
|
||||
SELECTID_Context *DRW_select_engine_context_get()
|
||||
{
|
||||
return &e_data.context;
|
||||
}
|
||||
|
||||
GPUFrameBuffer *DRW_engine_select_framebuffer_get(void)
|
||||
GPUFrameBuffer *DRW_engine_select_framebuffer_get()
|
||||
{
|
||||
return e_data.framebuffer_select_id;
|
||||
}
|
||||
|
||||
GPUTexture *DRW_engine_select_texture_get(void)
|
||||
GPUTexture *DRW_engine_select_texture_get()
|
||||
{
|
||||
return e_data.texture_u32;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ static void workbench_taa_jitter_init_order(float (*table)[2], int num)
|
||||
}
|
||||
}
|
||||
|
||||
static void workbench_taa_jitter_init(void)
|
||||
static void workbench_taa_jitter_init()
|
||||
{
|
||||
if (e_data.init == false) {
|
||||
e_data.init = true;
|
||||
|
||||
@@ -40,7 +40,7 @@ static float *create_disk_samples(int num_samples, int num_iterations)
|
||||
double dphi;
|
||||
BLI_hammersley_1d(i, &dphi);
|
||||
|
||||
float phi = (float)dphi * 2.0f * M_PI + it_add;
|
||||
float phi = float(dphi) * 2.0f * M_PI + it_add;
|
||||
texels[i][0] = cosf(phi);
|
||||
texels[i][1] = sinf(phi);
|
||||
/* This deliberately distribute more samples
|
||||
|
||||
@@ -81,8 +81,8 @@ static void workbench_dof_setup_samples(
|
||||
if (abs(j) < i && abs(k) < i) {
|
||||
continue;
|
||||
}
|
||||
float x = ((float)j) / KERNEL_RAD;
|
||||
float y = ((float)k) / KERNEL_RAD;
|
||||
float x = float(j) / KERNEL_RAD;
|
||||
float y = float(k) / KERNEL_RAD;
|
||||
|
||||
float r, T;
|
||||
square_to_circle(x, y, &r, &T);
|
||||
@@ -141,7 +141,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata)
|
||||
}
|
||||
|
||||
const float *full_size = DRW_viewport_size_get();
|
||||
const int size[2] = {max_ii(1, (int)full_size[0] / 2), max_ii(1, (int)full_size[1] / 2)};
|
||||
const int size[2] = {max_ii(1, int(full_size[0]) / 2), max_ii(1, int(full_size[1]) / 2)};
|
||||
#if 0 /* TODO(fclem): finish COC min_max optimization. */
|
||||
/* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */
|
||||
int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]};
|
||||
@@ -320,7 +320,7 @@ void workbench_dof_cache_init(WORKBENCH_Data *vedata)
|
||||
/* We reuse the same noise texture. Ensure it is up to date. */
|
||||
workbench_cavity_samples_ubo_ensure(wpd);
|
||||
|
||||
float offset = wpd->taa_sample / (float)max_ii(1, wpd->taa_sample_len);
|
||||
float offset = wpd->taa_sample / float(max_ii(1, wpd->taa_sample_len));
|
||||
DRWShadingGroup *grp = DRW_shgroup_create(blur1_sh, psl->dof_blur1_ps);
|
||||
DRW_shgroup_uniform_block(grp, "samples", wpd->vldata->dof_sample_ubo);
|
||||
DRW_shgroup_uniform_texture(grp, "noiseTex", wpd->vldata->cavity_jitter_tx);
|
||||
|
||||
@@ -653,7 +653,7 @@ void workbench_draw_finish(void * /*ved*/)
|
||||
DRW_view_set_active(nullptr);
|
||||
}
|
||||
|
||||
static void workbench_engine_free(void)
|
||||
static void workbench_engine_free()
|
||||
{
|
||||
workbench_shader_free();
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ static void workbench_render_matrices_init(RenderEngine *engine, Depsgraph *deps
|
||||
DRW_view_set_active(view);
|
||||
}
|
||||
|
||||
static bool workbench_render_framebuffers_init(void)
|
||||
static bool workbench_render_framebuffers_init()
|
||||
{
|
||||
/* For image render, allocate own buffers because we don't have a viewport. */
|
||||
const float *viewport_size = DRW_viewport_size_get();
|
||||
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
|
||||
const int size[2] = {int(viewport_size[0]), int(viewport_size[1])};
|
||||
|
||||
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, const boo
|
||||
WORKBENCH_PrivateData *wpd = data->stl->wpd;
|
||||
|
||||
bool is_manifold;
|
||||
struct GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold);
|
||||
GPUBatch *geom_shadow = DRW_cache_object_edge_detection_get(ob, &is_manifold);
|
||||
if (geom_shadow == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ static struct DRWShapeCache {
|
||||
GPUBatch *drw_sphere_lod[DRW_LOD_MAX];
|
||||
} SHC = {nullptr};
|
||||
|
||||
void DRW_shape_cache_free(void)
|
||||
void DRW_shape_cache_free()
|
||||
{
|
||||
uint i = sizeof(SHC) / sizeof(GPUBatch *);
|
||||
GPUBatch **batch = (GPUBatch **)&SHC;
|
||||
@@ -184,7 +184,7 @@ void DRW_shape_cache_free(void)
|
||||
/** \name Procedural Batches
|
||||
* \{ */
|
||||
|
||||
GPUBatch *drw_cache_procedural_points_get(void)
|
||||
GPUBatch *drw_cache_procedural_points_get()
|
||||
{
|
||||
if (!SHC.drw_procedural_verts) {
|
||||
/* TODO(fclem): get rid of this dummy VBO. */
|
||||
@@ -199,7 +199,7 @@ GPUBatch *drw_cache_procedural_points_get(void)
|
||||
return SHC.drw_procedural_verts;
|
||||
}
|
||||
|
||||
GPUBatch *drw_cache_procedural_lines_get(void)
|
||||
GPUBatch *drw_cache_procedural_lines_get()
|
||||
{
|
||||
if (!SHC.drw_procedural_lines) {
|
||||
/* TODO(fclem): get rid of this dummy VBO. */
|
||||
@@ -214,7 +214,7 @@ GPUBatch *drw_cache_procedural_lines_get(void)
|
||||
return SHC.drw_procedural_lines;
|
||||
}
|
||||
|
||||
GPUBatch *drw_cache_procedural_triangles_get(void)
|
||||
GPUBatch *drw_cache_procedural_triangles_get()
|
||||
{
|
||||
if (!SHC.drw_procedural_tris) {
|
||||
/* TODO(fclem): get rid of this dummy VBO. */
|
||||
@@ -228,7 +228,7 @@ GPUBatch *drw_cache_procedural_triangles_get(void)
|
||||
return SHC.drw_procedural_tris;
|
||||
}
|
||||
|
||||
GPUBatch *drw_cache_procedural_triangle_strips_get(void)
|
||||
GPUBatch *drw_cache_procedural_triangle_strips_get()
|
||||
{
|
||||
if (!SHC.drw_procedural_tri_strips) {
|
||||
/* TODO(fclem): get rid of this dummy VBO. */
|
||||
@@ -249,7 +249,7 @@ GPUBatch *drw_cache_procedural_triangle_strips_get(void)
|
||||
/** \name Helper functions
|
||||
* \{ */
|
||||
|
||||
static GPUVertFormat extra_vert_format(void)
|
||||
static GPUVertFormat extra_vert_format()
|
||||
{
|
||||
GPUVertFormat format = {0};
|
||||
GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
@@ -357,7 +357,7 @@ static GPUVertBuf *sphere_wire_vbo(const float rad, int flag)
|
||||
/* a single ring of vertices */
|
||||
float p[NSEGMENTS][2];
|
||||
for (int i = 0; i < NSEGMENTS; i++) {
|
||||
float angle = 2 * M_PI * ((float)i / (float)NSEGMENTS);
|
||||
float angle = 2 * M_PI * (float(i) / float(NSEGMENTS));
|
||||
p[i][0] = rad * cosf(angle);
|
||||
p[i][1] = rad * sinf(angle);
|
||||
}
|
||||
@@ -388,7 +388,7 @@ static GPUVertBuf *sphere_wire_vbo(const float rad, int flag)
|
||||
}
|
||||
|
||||
/* Quads */
|
||||
GPUBatch *DRW_cache_fullscreen_quad_get(void)
|
||||
GPUBatch *DRW_cache_fullscreen_quad_get()
|
||||
{
|
||||
if (!SHC.drw_fullscreen_quad) {
|
||||
/* Use a triangle instead of a real quad */
|
||||
@@ -421,7 +421,7 @@ GPUBatch *DRW_cache_fullscreen_quad_get(void)
|
||||
return SHC.drw_fullscreen_quad;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_quad_get(void)
|
||||
GPUBatch *DRW_cache_quad_get()
|
||||
{
|
||||
if (!SHC.drw_quad) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -441,7 +441,7 @@ GPUBatch *DRW_cache_quad_get(void)
|
||||
return SHC.drw_quad;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_quad_wires_get(void)
|
||||
GPUBatch *DRW_cache_quad_wires_get()
|
||||
{
|
||||
if (!SHC.drw_quad_wires) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -462,7 +462,7 @@ GPUBatch *DRW_cache_quad_wires_get(void)
|
||||
return SHC.drw_quad_wires;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_grid_get(void)
|
||||
GPUBatch *DRW_cache_grid_get()
|
||||
{
|
||||
if (!SHC.drw_grid) {
|
||||
/* Position Only 2D format */
|
||||
@@ -480,10 +480,10 @@ GPUBatch *DRW_cache_grid_get(void)
|
||||
uint v_idx = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
float pos0[2] = {(float)i / 8.0f, (float)j / 8.0f};
|
||||
float pos1[2] = {(float)(i + 1) / 8.0f, (float)j / 8.0f};
|
||||
float pos2[2] = {(float)i / 8.0f, (float)(j + 1) / 8.0f};
|
||||
float pos3[2] = {(float)(i + 1) / 8.0f, (float)(j + 1) / 8.0f};
|
||||
float pos0[2] = {float(i) / 8.0f, float(j) / 8.0f};
|
||||
float pos1[2] = {float(i + 1) / 8.0f, float(j) / 8.0f};
|
||||
float pos2[2] = {float(i) / 8.0f, float(j + 1) / 8.0f};
|
||||
float pos3[2] = {float(i + 1) / 8.0f, float(j + 1) / 8.0f};
|
||||
|
||||
madd_v2_v2v2fl(pos0, blender::float2{-1.0f, -1.0f}, pos0, 2.0f);
|
||||
madd_v2_v2v2fl(pos1, blender::float2{-1.0f, -1.0f}, pos1, 2.0f);
|
||||
@@ -728,7 +728,7 @@ static const float bone_box_solid_normals[12][3] = {
|
||||
{0.0f, 1.0f, 0.0f},
|
||||
};
|
||||
|
||||
GPUBatch *DRW_cache_cube_get(void)
|
||||
GPUBatch *DRW_cache_cube_get()
|
||||
{
|
||||
if (!SHC.drw_cube) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -761,7 +761,7 @@ GPUBatch *DRW_cache_cube_get(void)
|
||||
return SHC.drw_cube;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_circle_get(void)
|
||||
GPUBatch *DRW_cache_circle_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 64
|
||||
if (!SHC.drw_circle) {
|
||||
@@ -772,8 +772,8 @@ GPUBatch *DRW_cache_circle_get(void)
|
||||
|
||||
int v = 0;
|
||||
for (int a = 0; a < CIRCLE_RESOL + 1; a++) {
|
||||
float x = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
float z = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
float x = sinf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
float z = cosf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
float y = 0.0f;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{x, y, z}, VCLASS_EMPTY_SCALED});
|
||||
}
|
||||
@@ -784,7 +784,7 @@ GPUBatch *DRW_cache_circle_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_normal_arrow_get(void)
|
||||
GPUBatch *DRW_cache_normal_arrow_get()
|
||||
{
|
||||
if (!SHC.drw_normal_arrow) {
|
||||
GPUVertFormat format = {0};
|
||||
@@ -822,7 +822,7 @@ void DRW_vertbuf_create_wiredata(GPUVertBuf *vbo, const int vert_len)
|
||||
GPU_vertbuf_data_alloc(vbo, vert_len);
|
||||
|
||||
if (GPU_vertbuf_get_format(vbo)->stride == 1) {
|
||||
memset(GPU_vertbuf_get_data(vbo), 0xFF, (size_t)vert_len);
|
||||
memset(GPU_vertbuf_get_data(vbo), 0xFF, size_t(vert_len));
|
||||
}
|
||||
else {
|
||||
GPUVertBufRaw wd_step;
|
||||
@@ -842,7 +842,7 @@ void DRW_vertbuf_create_wiredata(GPUVertBuf *vbo, const int vert_len)
|
||||
*
|
||||
* \{ */
|
||||
|
||||
GPUBatch *DRW_gpencil_dummy_buffer_get(void)
|
||||
GPUBatch *DRW_gpencil_dummy_buffer_get()
|
||||
{
|
||||
if (SHC.drw_gpencil_dummy_quad == nullptr) {
|
||||
GPUVertFormat format = {0};
|
||||
@@ -990,7 +990,7 @@ GPUBatch **DRW_cache_object_surface_material_get(Object *ob,
|
||||
/** \name Empties
|
||||
* \{ */
|
||||
|
||||
GPUBatch *DRW_cache_plain_axes_get(void)
|
||||
GPUBatch *DRW_cache_plain_axes_get()
|
||||
{
|
||||
if (!SHC.drw_plain_axes) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1012,7 +1012,7 @@ GPUBatch *DRW_cache_plain_axes_get(void)
|
||||
return SHC.drw_plain_axes;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_cube_get(void)
|
||||
GPUBatch *DRW_cache_empty_cube_get()
|
||||
{
|
||||
if (!SHC.drw_empty_cube) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1032,7 +1032,7 @@ GPUBatch *DRW_cache_empty_cube_get(void)
|
||||
return SHC.drw_empty_cube;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_single_arrow_get(void)
|
||||
GPUBatch *DRW_cache_single_arrow_get()
|
||||
{
|
||||
if (!SHC.drw_single_arrow) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1070,7 +1070,7 @@ GPUBatch *DRW_cache_single_arrow_get(void)
|
||||
return SHC.drw_single_arrow;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_sphere_get(void)
|
||||
GPUBatch *DRW_cache_empty_sphere_get()
|
||||
{
|
||||
if (!SHC.drw_empty_sphere) {
|
||||
GPUVertBuf *vbo = sphere_wire_vbo(1.0f, VCLASS_EMPTY_SCALED);
|
||||
@@ -1079,7 +1079,7 @@ GPUBatch *DRW_cache_empty_sphere_get(void)
|
||||
return SHC.drw_empty_sphere;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_cone_get(void)
|
||||
GPUBatch *DRW_cache_empty_cone_get()
|
||||
{
|
||||
#define NSEGMENTS 8
|
||||
if (!SHC.drw_empty_cone) {
|
||||
@@ -1092,7 +1092,7 @@ GPUBatch *DRW_cache_empty_cone_get(void)
|
||||
/* a single ring of vertices */
|
||||
float p[NSEGMENTS][2];
|
||||
for (int i = 0; i < NSEGMENTS; i++) {
|
||||
float angle = 2 * M_PI * ((float)i / (float)NSEGMENTS);
|
||||
float angle = 2 * M_PI * (float(i) / float(NSEGMENTS));
|
||||
p[i][0] = cosf(angle);
|
||||
p[i][1] = sinf(angle);
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ GPUBatch *DRW_cache_empty_cone_get(void)
|
||||
#undef NSEGMENTS
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_cylinder_get(void)
|
||||
GPUBatch *DRW_cache_empty_cylinder_get()
|
||||
{
|
||||
#define NSEGMENTS 12
|
||||
if (!SHC.drw_empty_cylinder) {
|
||||
@@ -1131,7 +1131,7 @@ GPUBatch *DRW_cache_empty_cylinder_get(void)
|
||||
int flag = VCLASS_EMPTY_SCALED;
|
||||
float p[NSEGMENTS][2];
|
||||
for (int i = 0; i < NSEGMENTS; i++) {
|
||||
float angle = 2 * M_PI * ((float)i / (float)NSEGMENTS);
|
||||
float angle = 2 * M_PI * (float(i) / float(NSEGMENTS));
|
||||
p[i][0] = cosf(angle);
|
||||
p[i][1] = sinf(angle);
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@ GPUBatch *DRW_cache_empty_cylinder_get(void)
|
||||
#undef NSEGMENTS
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_capsule_body_get(void)
|
||||
GPUBatch *DRW_cache_empty_capsule_body_get()
|
||||
{
|
||||
if (!SHC.drw_empty_capsule_body) {
|
||||
const float pos[8][3] = {
|
||||
@@ -1192,14 +1192,14 @@ GPUBatch *DRW_cache_empty_capsule_body_get(void)
|
||||
return SHC.drw_empty_capsule_body;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_empty_capsule_cap_get(void)
|
||||
GPUBatch *DRW_cache_empty_capsule_cap_get()
|
||||
{
|
||||
#define NSEGMENTS 24 /* Must be multiple of 2. */
|
||||
if (!SHC.drw_empty_capsule_cap) {
|
||||
/* a single ring of vertices */
|
||||
float p[NSEGMENTS][2];
|
||||
for (int i = 0; i < NSEGMENTS; i++) {
|
||||
float angle = 2 * M_PI * ((float)i / (float)NSEGMENTS);
|
||||
float angle = 2 * M_PI * (float(i) / float(NSEGMENTS));
|
||||
p[i][0] = cosf(angle);
|
||||
p[i][1] = sinf(angle);
|
||||
}
|
||||
@@ -1249,7 +1249,7 @@ GPUBatch *DRW_cache_empty_capsule_cap_get(void)
|
||||
#undef NSEGMENTS
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_wind_get(void)
|
||||
GPUBatch *DRW_cache_field_wind_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
if (!SHC.drw_field_wind) {
|
||||
@@ -1262,7 +1262,7 @@ GPUBatch *DRW_cache_field_wind_get(void)
|
||||
int v = 0;
|
||||
int flag = VCLASS_EMPTY_SIZE;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
float z = 0.05f * (float)i;
|
||||
float z = 0.05f * float(i);
|
||||
circle_verts(vbo, &v, CIRCLE_RESOL, 1.0f, z, flag);
|
||||
}
|
||||
|
||||
@@ -1272,7 +1272,7 @@ GPUBatch *DRW_cache_field_wind_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_force_get(void)
|
||||
GPUBatch *DRW_cache_field_force_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
if (!SHC.drw_field_force) {
|
||||
@@ -1295,7 +1295,7 @@ GPUBatch *DRW_cache_field_force_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_vortex_get(void)
|
||||
GPUBatch *DRW_cache_field_vortex_get()
|
||||
{
|
||||
#define SPIRAL_RESOL 32
|
||||
if (!SHC.drw_field_vortex) {
|
||||
@@ -1308,12 +1308,12 @@ GPUBatch *DRW_cache_field_vortex_get(void)
|
||||
int v = 0;
|
||||
int flag = VCLASS_EMPTY_SIZE;
|
||||
for (int a = SPIRAL_RESOL; a > -1; a--) {
|
||||
float r = a / (float)SPIRAL_RESOL;
|
||||
float r = a / float(SPIRAL_RESOL);
|
||||
float angle = (2.0f * M_PI * a) / SPIRAL_RESOL;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{sinf(angle) * r, cosf(angle) * r, 0.0f}, flag});
|
||||
}
|
||||
for (int a = 1; a <= SPIRAL_RESOL; a++) {
|
||||
float r = a / (float)SPIRAL_RESOL;
|
||||
float r = a / float(SPIRAL_RESOL);
|
||||
float angle = (2.0f * M_PI * a) / SPIRAL_RESOL;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{sinf(angle) * -r, cosf(angle) * -r, 0.0f}, flag});
|
||||
}
|
||||
@@ -1325,7 +1325,7 @@ GPUBatch *DRW_cache_field_vortex_get(void)
|
||||
#undef SPIRAL_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_curve_get(void)
|
||||
GPUBatch *DRW_cache_field_curve_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
if (!SHC.drw_field_curve) {
|
||||
@@ -1345,7 +1345,7 @@ GPUBatch *DRW_cache_field_curve_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_tube_limit_get(void)
|
||||
GPUBatch *DRW_cache_field_tube_limit_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
#define SIDE_STIPPLE 32
|
||||
@@ -1367,7 +1367,7 @@ GPUBatch *DRW_cache_field_tube_limit_get(void)
|
||||
for (int a = 0; a < 4; a++) {
|
||||
float angle = (2.0f * M_PI * a) / 4.0f;
|
||||
for (int i = 0; i < SIDE_STIPPLE; i++) {
|
||||
float z = (i / (float)SIDE_STIPPLE) * 2.0f - 1.0f;
|
||||
float z = (i / float(SIDE_STIPPLE)) * 2.0f - 1.0f;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{sinf(angle), cosf(angle), z}, flag});
|
||||
}
|
||||
}
|
||||
@@ -1380,7 +1380,7 @@ GPUBatch *DRW_cache_field_tube_limit_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_cone_limit_get(void)
|
||||
GPUBatch *DRW_cache_field_cone_limit_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
#define SIDE_STIPPLE 32
|
||||
@@ -1402,7 +1402,7 @@ GPUBatch *DRW_cache_field_cone_limit_get(void)
|
||||
for (int a = 0; a < 4; a++) {
|
||||
float angle = (2.0f * M_PI * a) / 4.0f;
|
||||
for (int i = 0; i < SIDE_STIPPLE; i++) {
|
||||
float z = (i / (float)SIDE_STIPPLE) * 2.0f - 1.0f;
|
||||
float z = (i / float(SIDE_STIPPLE)) * 2.0f - 1.0f;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{sinf(angle) * z, cosf(angle) * z, z}, flag});
|
||||
}
|
||||
}
|
||||
@@ -1415,7 +1415,7 @@ GPUBatch *DRW_cache_field_cone_limit_get(void)
|
||||
#undef CIRCLE_RESOL
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_field_sphere_limit_get(void)
|
||||
GPUBatch *DRW_cache_field_sphere_limit_get()
|
||||
{
|
||||
#define CIRCLE_RESOL 32
|
||||
if (!SHC.drw_field_sphere_limit) {
|
||||
@@ -1466,7 +1466,7 @@ static float light_distance_z_get(char axis, const bool start)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_groundline_get(void)
|
||||
GPUBatch *DRW_cache_groundline_get()
|
||||
{
|
||||
if (!SHC.drw_ground_line) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1487,7 +1487,7 @@ GPUBatch *DRW_cache_groundline_get(void)
|
||||
return SHC.drw_ground_line;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_icon_inner_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_icon_inner_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_icon_inner_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1508,7 +1508,7 @@ GPUBatch *DRW_cache_light_icon_inner_lines_get(void)
|
||||
return SHC.drw_light_icon_inner_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_icon_outer_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_icon_outer_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_icon_outer_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1528,7 +1528,7 @@ GPUBatch *DRW_cache_light_icon_outer_lines_get(void)
|
||||
return SHC.drw_light_icon_outer_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_icon_sun_rays_get(void)
|
||||
GPUBatch *DRW_cache_light_icon_sun_rays_get()
|
||||
{
|
||||
if (!SHC.drw_light_icon_sun_rays) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1545,7 +1545,7 @@ GPUBatch *DRW_cache_light_icon_sun_rays_get(void)
|
||||
|
||||
/* Sun Rays */
|
||||
for (int a = 0; a < num_rays; a++) {
|
||||
float angle = (2.0f * M_PI * a) / (float)num_rays;
|
||||
float angle = (2.0f * M_PI * a) / float(num_rays);
|
||||
float s = sinf(angle) * r;
|
||||
float c = cosf(angle) * r;
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{s * 1.6f, c * 1.6f, 0.0f}, VCLASS_SCREENSPACE});
|
||||
@@ -1560,7 +1560,7 @@ GPUBatch *DRW_cache_light_icon_sun_rays_get(void)
|
||||
return SHC.drw_light_icon_sun_rays;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_point_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_point_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_point_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1581,7 +1581,7 @@ GPUBatch *DRW_cache_light_point_lines_get(void)
|
||||
return SHC.drw_light_point_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_sun_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_sun_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_sun_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1602,7 +1602,7 @@ GPUBatch *DRW_cache_light_sun_lines_get(void)
|
||||
return SHC.drw_light_sun_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_spot_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_spot_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_spot_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1644,7 +1644,7 @@ GPUBatch *DRW_cache_light_spot_lines_get(void)
|
||||
return SHC.drw_light_spot_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_spot_volume_get(void)
|
||||
GPUBatch *DRW_cache_light_spot_volume_get()
|
||||
{
|
||||
if (!SHC.drw_light_spot_volume) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1671,7 +1671,7 @@ GPUBatch *DRW_cache_light_spot_volume_get(void)
|
||||
return SHC.drw_light_spot_volume;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_area_disk_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_area_disk_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_area_disk_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1698,7 +1698,7 @@ GPUBatch *DRW_cache_light_area_disk_lines_get(void)
|
||||
return SHC.drw_light_area_disk_lines;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_light_area_square_lines_get(void)
|
||||
GPUBatch *DRW_cache_light_area_square_lines_get()
|
||||
{
|
||||
if (!SHC.drw_light_area_square_lines) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1743,7 +1743,7 @@ GPUBatch *DRW_cache_light_area_square_lines_get(void)
|
||||
/** \name Speaker
|
||||
* \{ */
|
||||
|
||||
GPUBatch *DRW_cache_speaker_get(void)
|
||||
GPUBatch *DRW_cache_speaker_get()
|
||||
{
|
||||
if (!SHC.drw_speaker) {
|
||||
float v[3];
|
||||
@@ -1769,8 +1769,8 @@ GPUBatch *DRW_cache_speaker_get(void)
|
||||
copy_v3_fl3(v, r, 0.0f, z);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
||||
for (int i = 1; i < segments; i++) {
|
||||
float x = cosf(2.0f * (float)M_PI * i / segments) * r;
|
||||
float y = sinf(2.0f * (float)M_PI * i / segments) * r;
|
||||
float x = cosf(2.0f * float(M_PI) * i / segments) * r;
|
||||
float y = sinf(2.0f * float(M_PI) * i / segments) * r;
|
||||
copy_v3_fl3(v, x, y, z);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
|
||||
@@ -1808,7 +1808,7 @@ GPUBatch *DRW_cache_speaker_get(void)
|
||||
/** \name Probe
|
||||
* \{ */
|
||||
|
||||
GPUBatch *DRW_cache_lightprobe_cube_get(void)
|
||||
GPUBatch *DRW_cache_lightprobe_cube_get()
|
||||
{
|
||||
if (!SHC.drw_lightprobe_cube) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1863,7 +1863,7 @@ GPUBatch *DRW_cache_lightprobe_cube_get(void)
|
||||
return SHC.drw_lightprobe_cube;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_lightprobe_grid_get(void)
|
||||
GPUBatch *DRW_cache_lightprobe_grid_get()
|
||||
{
|
||||
if (!SHC.drw_lightprobe_grid) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -1926,7 +1926,7 @@ GPUBatch *DRW_cache_lightprobe_grid_get(void)
|
||||
return SHC.drw_lightprobe_grid;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_lightprobe_planar_get(void)
|
||||
GPUBatch *DRW_cache_lightprobe_planar_get()
|
||||
{
|
||||
if (!SHC.drw_lightprobe_planar) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2067,7 +2067,7 @@ static const float bone_octahedral_solid_normals[8][3] = {
|
||||
{0.00000000f, 0.11043154f, 0.99388373f},
|
||||
};
|
||||
|
||||
GPUBatch *DRW_cache_bone_octahedral_get(void)
|
||||
GPUBatch *DRW_cache_bone_octahedral_get()
|
||||
{
|
||||
if (!SHC.drw_bone_octahedral) {
|
||||
uint v_idx = 0;
|
||||
@@ -2103,7 +2103,7 @@ GPUBatch *DRW_cache_bone_octahedral_get(void)
|
||||
return SHC.drw_bone_octahedral;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_octahedral_wire_get(void)
|
||||
GPUBatch *DRW_cache_bone_octahedral_wire_get()
|
||||
{
|
||||
if (!SHC.drw_bone_octahedral_wire) {
|
||||
GPUIndexBufBuilder elb;
|
||||
@@ -2128,7 +2128,7 @@ GPUBatch *DRW_cache_bone_octahedral_wire_get(void)
|
||||
return SHC.drw_bone_octahedral_wire;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_box_get(void)
|
||||
GPUBatch *DRW_cache_bone_box_get()
|
||||
{
|
||||
if (!SHC.drw_bone_box) {
|
||||
uint v_idx = 0;
|
||||
@@ -2161,7 +2161,7 @@ GPUBatch *DRW_cache_bone_box_get(void)
|
||||
return SHC.drw_bone_box;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_box_wire_get(void)
|
||||
GPUBatch *DRW_cache_bone_box_wire_get()
|
||||
{
|
||||
if (!SHC.drw_bone_box_wire) {
|
||||
GPUIndexBufBuilder elb;
|
||||
@@ -2195,7 +2195,7 @@ static void benv_lat_lon_to_co(const float lat, const float lon, float r_nor[3])
|
||||
r_nor[2] = cosf(lat);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_envelope_solid_get(void)
|
||||
GPUBatch *DRW_cache_bone_envelope_solid_get()
|
||||
{
|
||||
if (!SHC.drw_bone_envelope) {
|
||||
const int lon_res = 24;
|
||||
@@ -2246,7 +2246,7 @@ GPUBatch *DRW_cache_bone_envelope_solid_get(void)
|
||||
return SHC.drw_bone_envelope;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_envelope_outline_get(void)
|
||||
GPUBatch *DRW_cache_bone_envelope_outline_get()
|
||||
{
|
||||
if (!SHC.drw_bone_envelope_outline) {
|
||||
#define CIRCLE_RESOL 64
|
||||
@@ -2267,16 +2267,16 @@ GPUBatch *DRW_cache_bone_envelope_outline_get(void)
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
|
||||
GPU_vertbuf_data_alloc(vbo, CIRCLE_RESOL + 1);
|
||||
|
||||
v0[0] = radius * sinf((2.0f * M_PI * -2) / ((float)CIRCLE_RESOL));
|
||||
v0[1] = radius * cosf((2.0f * M_PI * -2) / ((float)CIRCLE_RESOL));
|
||||
v1[0] = radius * sinf((2.0f * M_PI * -1) / ((float)CIRCLE_RESOL));
|
||||
v1[1] = radius * cosf((2.0f * M_PI * -1) / ((float)CIRCLE_RESOL));
|
||||
v0[0] = radius * sinf((2.0f * M_PI * -2) / float(CIRCLE_RESOL));
|
||||
v0[1] = radius * cosf((2.0f * M_PI * -2) / float(CIRCLE_RESOL));
|
||||
v1[0] = radius * sinf((2.0f * M_PI * -1) / float(CIRCLE_RESOL));
|
||||
v1[1] = radius * cosf((2.0f * M_PI * -1) / float(CIRCLE_RESOL));
|
||||
|
||||
/* Output 4 verts for each position. See shader for explanation. */
|
||||
uint v = 0;
|
||||
for (int a = 0; a <= CIRCLE_RESOL; a++) {
|
||||
v2[0] = radius * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
v2[1] = radius * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
v2[0] = radius * sinf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
v2[1] = radius * cosf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos0, v, v0);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos1, v, v1);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos2, v++, v2);
|
||||
@@ -2291,7 +2291,7 @@ GPUBatch *DRW_cache_bone_envelope_outline_get(void)
|
||||
return SHC.drw_bone_envelope_outline;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_point_get(void)
|
||||
GPUBatch *DRW_cache_bone_point_get()
|
||||
{
|
||||
if (!SHC.drw_bone_point) {
|
||||
#if 0 /* old style geometry sphere */
|
||||
@@ -2354,8 +2354,8 @@ GPUBatch *DRW_cache_bone_point_get(void)
|
||||
GPU_vertbuf_data_alloc(vbo, CIRCLE_RESOL);
|
||||
|
||||
for (int a = 0; a < CIRCLE_RESOL; a++) {
|
||||
v[0] = radius * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
v[1] = radius * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
v[0] = radius * sinf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
v[1] = radius * cosf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, a, v);
|
||||
}
|
||||
|
||||
@@ -2366,7 +2366,7 @@ GPUBatch *DRW_cache_bone_point_get(void)
|
||||
return SHC.drw_bone_point;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_point_wire_outline_get(void)
|
||||
GPUBatch *DRW_cache_bone_point_wire_outline_get()
|
||||
{
|
||||
if (!SHC.drw_bone_point_wire) {
|
||||
#if 0 /* old style geometry sphere */
|
||||
@@ -2415,7 +2415,7 @@ GPUBatch *DRW_cache_bone_point_wire_outline_get(void)
|
||||
#define POS_TAIL (1 << 5)
|
||||
#define POS_BONE (1 << 6)
|
||||
|
||||
GPUBatch *DRW_cache_bone_stick_get(void)
|
||||
GPUBatch *DRW_cache_bone_stick_get()
|
||||
{
|
||||
if (!SHC.drw_bone_stick) {
|
||||
#define CIRCLE_RESOL 12
|
||||
@@ -2454,8 +2454,8 @@ GPUBatch *DRW_cache_bone_stick_get(void)
|
||||
/* circle vertices */
|
||||
flag |= COL_WIRE;
|
||||
for (int a = 0; a < CIRCLE_RESOL; a++) {
|
||||
pos[0] = radius * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
pos[1] = radius * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
|
||||
pos[0] = radius * sinf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
pos[1] = radius * cosf((2.0f * M_PI * a) / float(CIRCLE_RESOL));
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.pos, v, pos);
|
||||
GPU_vertbuf_attr_set(vbo, attr_id.flag, v, &flag);
|
||||
GPU_indexbuf_add_generic_vert(&elb, v++);
|
||||
@@ -2558,7 +2558,7 @@ static float axis_marker[8][2] = {
|
||||
#undef S_X
|
||||
#undef S_Y
|
||||
|
||||
GPUBatch *DRW_cache_bone_arrows_get(void)
|
||||
GPUBatch *DRW_cache_bone_arrows_get()
|
||||
{
|
||||
if (!SHC.drw_bone_arrows) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2578,7 +2578,7 @@ GPUBatch *DRW_cache_bone_arrows_get(void)
|
||||
/* Axis end marker */
|
||||
for (int j = 1; j < MARKER_FILL_LAYER + 1; j++) {
|
||||
for (int i = 0; i < MARKER_LEN; i++) {
|
||||
mul_v2_v2fl(p, axis_marker[i], 4.0f * j / (float)MARKER_FILL_LAYER);
|
||||
mul_v2_v2fl(p, axis_marker[i], 4.0f * j / float(MARKER_FILL_LAYER));
|
||||
GPU_vertbuf_vert_set(vbo, v++, Vert{{p[0], p[1], p[2]}, flag});
|
||||
}
|
||||
}
|
||||
@@ -2624,7 +2624,7 @@ static const float staticSine[16] = {
|
||||
} \
|
||||
((void)0)
|
||||
|
||||
GPUBatch *DRW_cache_bone_dof_sphere_get(void)
|
||||
GPUBatch *DRW_cache_bone_dof_sphere_get()
|
||||
{
|
||||
if (!SHC.drw_bone_dof_sphere) {
|
||||
int i, j, q, n = ARRAY_SIZE(staticSine);
|
||||
@@ -2677,7 +2677,7 @@ GPUBatch *DRW_cache_bone_dof_sphere_get(void)
|
||||
return SHC.drw_bone_dof_sphere;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_bone_dof_lines_get(void)
|
||||
GPUBatch *DRW_cache_bone_dof_lines_get()
|
||||
{
|
||||
if (!SHC.drw_bone_dof_lines) {
|
||||
int i, n = ARRAY_SIZE(staticSine);
|
||||
@@ -2697,7 +2697,7 @@ GPUBatch *DRW_cache_bone_dof_lines_get(void)
|
||||
|
||||
uint v = 0;
|
||||
for (i = 0; i < n * 4; i++) {
|
||||
float a = (1.0f - (i / (float)(n * 4))) * 2.0f * M_PI;
|
||||
float a = (1.0f - (i / float(n * 4))) * 2.0f * M_PI;
|
||||
float x = cosf(a);
|
||||
float y = sinf(a);
|
||||
set_vert(x, y, 0);
|
||||
@@ -2717,7 +2717,7 @@ GPUBatch *DRW_cache_bone_dof_lines_get(void)
|
||||
/** \name Camera
|
||||
* \{ */
|
||||
|
||||
GPUBatch *DRW_cache_camera_frame_get(void)
|
||||
GPUBatch *DRW_cache_camera_frame_get()
|
||||
{
|
||||
if (!SHC.drw_camera_frame) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2749,7 +2749,7 @@ GPUBatch *DRW_cache_camera_frame_get(void)
|
||||
return SHC.drw_camera_frame;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_camera_volume_get(void)
|
||||
GPUBatch *DRW_cache_camera_volume_get()
|
||||
{
|
||||
if (!SHC.drw_camera_volume) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2774,7 +2774,7 @@ GPUBatch *DRW_cache_camera_volume_get(void)
|
||||
return SHC.drw_camera_volume;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_camera_volume_wire_get(void)
|
||||
GPUBatch *DRW_cache_camera_volume_wire_get()
|
||||
{
|
||||
if (!SHC.drw_camera_volume_wire) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2798,7 +2798,7 @@ GPUBatch *DRW_cache_camera_volume_wire_get(void)
|
||||
return SHC.drw_camera_volume_wire;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_camera_tria_wire_get(void)
|
||||
GPUBatch *DRW_cache_camera_tria_wire_get()
|
||||
{
|
||||
if (!SHC.drw_camera_tria_wire) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2823,7 +2823,7 @@ GPUBatch *DRW_cache_camera_tria_wire_get(void)
|
||||
return SHC.drw_camera_tria_wire;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_camera_tria_get(void)
|
||||
GPUBatch *DRW_cache_camera_tria_get()
|
||||
{
|
||||
if (!SHC.drw_camera_tria) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -2843,7 +2843,7 @@ GPUBatch *DRW_cache_camera_tria_get(void)
|
||||
return SHC.drw_camera_tria;
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_camera_distances_get(void)
|
||||
GPUBatch *DRW_cache_camera_distances_get()
|
||||
{
|
||||
if (!SHC.drw_camera_distances) {
|
||||
GPUVertFormat format = extra_vert_format();
|
||||
@@ -3116,7 +3116,7 @@ GPUBatch *DRW_cache_particles_get_dots(Object *object, ParticleSystem *psys)
|
||||
|
||||
GPUBatch *DRW_cache_particles_get_edit_strands(Object *object,
|
||||
ParticleSystem *psys,
|
||||
struct PTCacheEdit *edit,
|
||||
PTCacheEdit *edit,
|
||||
bool use_weight)
|
||||
{
|
||||
return DRW_particles_batch_cache_get_edit_strands(object, psys, edit, use_weight);
|
||||
@@ -3124,14 +3124,14 @@ GPUBatch *DRW_cache_particles_get_edit_strands(Object *object,
|
||||
|
||||
GPUBatch *DRW_cache_particles_get_edit_inner_points(Object *object,
|
||||
ParticleSystem *psys,
|
||||
struct PTCacheEdit *edit)
|
||||
PTCacheEdit *edit)
|
||||
{
|
||||
return DRW_particles_batch_cache_get_edit_inner_points(object, psys, edit);
|
||||
}
|
||||
|
||||
GPUBatch *DRW_cache_particles_get_edit_tip_points(Object *object,
|
||||
ParticleSystem *psys,
|
||||
struct PTCacheEdit *edit)
|
||||
PTCacheEdit *edit)
|
||||
{
|
||||
return DRW_particles_batch_cache_get_edit_tip_points(object, psys, edit);
|
||||
}
|
||||
@@ -3244,7 +3244,7 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines)
|
||||
|
||||
int v = 0;
|
||||
for (int i = 0; i < segments; i++) {
|
||||
float angle = (float)(2 * M_PI) * ((float)i / (float)segments);
|
||||
float angle = float(2 * M_PI) * (float(i) / float(segments));
|
||||
float x = f10 * cosf(angle);
|
||||
float y = f10 * sinf(angle);
|
||||
|
||||
|
||||
@@ -670,7 +670,7 @@ static float particle_key_weight(const ParticleData *particle, int strand, float
|
||||
}
|
||||
|
||||
float interp = t / edit_key_seg_t;
|
||||
int index = (int)interp;
|
||||
int index = int(interp);
|
||||
interp -= floorf(interp); /* Time between 2 edit key */
|
||||
float s1 = hkeys[index].weight;
|
||||
float s2 = hkeys[index + 1].weight;
|
||||
@@ -695,7 +695,7 @@ static int particle_batch_cache_fill_segments_edit(
|
||||
for (int j = 0; j <= path->segments; j++) {
|
||||
EditStrandData *seg_data = (EditStrandData *)GPU_vertbuf_raw_step(attr_step);
|
||||
copy_v3_v3(seg_data->pos, path[j].co);
|
||||
float strand_t = (float)(j) / path->segments;
|
||||
float strand_t = float(j) / path->segments;
|
||||
if (particle) {
|
||||
float weight = particle_key_weight(particle, i, strand_t);
|
||||
/* NaN or unclamped become 1.0f */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
ARRAY_SET_ITEMS(v4, (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, 1.0)
|
||||
#endif
|
||||
#define UI_COLOR_RGBA_FROM_U8(r, g, b, a, v4) \
|
||||
ARRAY_SET_ITEMS(v4, (float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, (float)a / 255.0f)
|
||||
ARRAY_SET_ITEMS(v4, float(r) / 255.0f, float(g) / 255.0f, float(b) / 255.0f, float(a) / 255.0f)
|
||||
|
||||
/**
|
||||
* Colors & Constant.
|
||||
@@ -37,7 +37,7 @@ static ColorBand weight_ramp_copy;
|
||||
|
||||
static GPUTexture *DRW_create_weight_colorramp_texture(void);
|
||||
|
||||
void DRW_globals_update(void)
|
||||
void DRW_globals_update()
|
||||
{
|
||||
GlobalsUboStorage *gb = &G_draw.block;
|
||||
|
||||
@@ -174,11 +174,11 @@ void DRW_globals_update(void)
|
||||
|
||||
/* M_SQRT2 to be at least the same size of the old square */
|
||||
gb->size_vertex = U.pixelsize *
|
||||
max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f);
|
||||
max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * float(M_SQRT2) / 2.0f);
|
||||
gb->size_vertex_gpencil = U.pixelsize * UI_GetThemeValuef(TH_GP_VERTEX_SIZE);
|
||||
gb->size_face_dot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE);
|
||||
gb->size_edge = U.pixelsize * max_ff(1.0f, UI_GetThemeValuef(TH_EDGE_WIDTH)) / 2.0f;
|
||||
gb->size_edge_fix = U.pixelsize * (0.5f + 2.0f * (1.0f * (gb->size_edge * (float)M_SQRT1_2)));
|
||||
gb->size_edge_fix = U.pixelsize * (0.5f + 2.0f * (1.0f * (gb->size_edge * float(M_SQRT1_2))));
|
||||
|
||||
gb->pixel_fac = *DRW_viewport_pixelsize_get();
|
||||
|
||||
@@ -246,7 +246,7 @@ void DRW_globals_update(void)
|
||||
|
||||
/* ********************************* SHGROUP ************************************* */
|
||||
|
||||
void DRW_globals_free(void) {}
|
||||
void DRW_globals_free() {}
|
||||
|
||||
DRWView *DRW_view_create_with_zoffset(const DRWView *parent_view,
|
||||
const RegionView3D *rv3d,
|
||||
@@ -471,7 +471,7 @@ static void DRW_evaluate_weight_to_color(const float weight, float result[4])
|
||||
}
|
||||
}
|
||||
|
||||
static GPUTexture *DRW_create_weight_colorramp_texture(void)
|
||||
static GPUTexture *DRW_create_weight_colorramp_texture()
|
||||
{
|
||||
float pixels[256][4];
|
||||
for (int i = 0; i < 256; i++) {
|
||||
|
||||
@@ -68,7 +68,7 @@ static void create_flame_spectrum_texture(float *data)
|
||||
spec_pixels[index + 3] = MAX_FIRE_ALPHA *
|
||||
((k > FULL_ON_FIRE) ?
|
||||
1.0f :
|
||||
(k - FIRE_THRESH) / ((float)FULL_ON_FIRE - FIRE_THRESH));
|
||||
(k - FIRE_THRESH) / (float(FULL_ON_FIRE) - FIRE_THRESH));
|
||||
}
|
||||
else {
|
||||
zero_v4(&spec_pixels[index]);
|
||||
@@ -89,7 +89,7 @@ static void create_flame_spectrum_texture(float *data)
|
||||
static void create_color_ramp(const ColorBand *coba, float *data)
|
||||
{
|
||||
for (int i = 0; i < TFUNC_WIDTH; i++) {
|
||||
BKE_colorband_evaluate(coba, (float)i / TFUNC_WIDTH, &data[i * 4]);
|
||||
BKE_colorband_evaluate(coba, float(i) / TFUNC_WIDTH, &data[i * 4]);
|
||||
straight_to_premul_v4(&data[i * 4]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ DRWInstanceData *DRW_instance_data_request(DRWInstanceDataList *idatalist, uint
|
||||
/** \name Instance Data List (DRWInstanceDataList)
|
||||
* \{ */
|
||||
|
||||
DRWInstanceDataList *DRW_instance_data_list_create(void)
|
||||
DRWInstanceDataList *DRW_instance_data_list_create()
|
||||
{
|
||||
DRWInstanceDataList *idatalist = static_cast<DRWInstanceDataList *>(
|
||||
MEM_callocN(sizeof(DRWInstanceDataList), "DRWInstanceDataList"));
|
||||
@@ -570,7 +570,7 @@ struct DRWUniformAttrBuf {
|
||||
/* Last handle used to update the buffer, checked for avoiding redundant updates. */
|
||||
DRWResourceHandle last_handle;
|
||||
/* Linked list pointer used for freeing the empty unneeded buffers. */
|
||||
struct DRWUniformAttrBuf *next_empty;
|
||||
DRWUniformAttrBuf *next_empty;
|
||||
};
|
||||
|
||||
static DRWUniformAttrBuf *drw_uniform_attrs_pool_ensure(GHash *table,
|
||||
@@ -633,7 +633,7 @@ void drw_uniform_attrs_pool_update(GHash *table,
|
||||
}
|
||||
}
|
||||
|
||||
GPUUniformBuf *drw_ensure_layer_attribute_buffer(void)
|
||||
GPUUniformBuf *drw_ensure_layer_attribute_buffer()
|
||||
{
|
||||
DRWData *data = DST.vmempool;
|
||||
|
||||
@@ -696,7 +696,7 @@ DRWSparseUniformBuf *DRW_uniform_attrs_pool_find_ubo(GHash *table, const GPUUnif
|
||||
return buffer ? &buffer->ubos : nullptr;
|
||||
}
|
||||
|
||||
GHash *DRW_uniform_attrs_pool_new(void)
|
||||
GHash *DRW_uniform_attrs_pool_new()
|
||||
{
|
||||
return GPU_uniform_attr_list_hash_new("obattr_hash");
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ static void drw_state_ensure_not_reused(DRWManager *dst)
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool drw_draw_show_annotation(void)
|
||||
static bool drw_draw_show_annotation()
|
||||
{
|
||||
if (DST.draw_ctx.space_data == nullptr) {
|
||||
View3D *v3d = DST.draw_ctx.v3d;
|
||||
@@ -156,14 +156,14 @@ static bool drw_draw_show_annotation(void)
|
||||
/** \name Threading
|
||||
* \{ */
|
||||
|
||||
static void drw_task_graph_init(void)
|
||||
static void drw_task_graph_init()
|
||||
{
|
||||
BLI_assert(DST.task_graph == nullptr);
|
||||
DST.task_graph = BLI_task_graph_create();
|
||||
DST.delayed_extraction = BLI_gset_ptr_new(__func__);
|
||||
}
|
||||
|
||||
static void drw_task_graph_deinit(void)
|
||||
static void drw_task_graph_deinit()
|
||||
{
|
||||
BLI_task_graph_work_and_wait(DST.task_graph);
|
||||
|
||||
@@ -287,23 +287,23 @@ void DRW_render_viewport_size_set(const int size[2])
|
||||
DST.inv_size[1] = 1.0f / size[1];
|
||||
}
|
||||
|
||||
const float *DRW_viewport_size_get(void)
|
||||
const float *DRW_viewport_size_get()
|
||||
{
|
||||
return DST.size;
|
||||
}
|
||||
|
||||
const float *DRW_viewport_invert_size_get(void)
|
||||
const float *DRW_viewport_invert_size_get()
|
||||
{
|
||||
return DST.inv_size;
|
||||
}
|
||||
|
||||
const float *DRW_viewport_pixelsize_get(void)
|
||||
const float *DRW_viewport_pixelsize_get()
|
||||
{
|
||||
return &DST.pixsize;
|
||||
}
|
||||
|
||||
/* Not a viewport variable, we could split this out. */
|
||||
static void drw_context_state_init(void)
|
||||
static void drw_context_state_init()
|
||||
{
|
||||
if (DST.draw_ctx.obact) {
|
||||
DST.draw_ctx.object_mode = eObjectMode(DST.draw_ctx.obact->mode);
|
||||
@@ -337,7 +337,7 @@ static void drw_context_state_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_unit_state_create(void)
|
||||
static void draw_unit_state_create()
|
||||
{
|
||||
DRWObjectInfos *infos = static_cast<DRWObjectInfos *>(BLI_memblock_alloc(DST.vmempool->obinfos));
|
||||
DRWObjectMatrix *mats = static_cast<DRWObjectMatrix *>(BLI_memblock_alloc(DST.vmempool->obmats));
|
||||
@@ -362,7 +362,7 @@ static void draw_unit_state_create(void)
|
||||
DRW_handle_increment(&DST.resource_handle);
|
||||
}
|
||||
|
||||
DRWData *DRW_viewport_data_create(void)
|
||||
DRWData *DRW_viewport_data_create()
|
||||
{
|
||||
DRWData *drw_data = static_cast<DRWData *>(MEM_callocN(sizeof(DRWData), "DRWData"));
|
||||
|
||||
@@ -650,17 +650,17 @@ static void drw_manager_exit(DRWManager *dst)
|
||||
#endif
|
||||
}
|
||||
|
||||
DefaultFramebufferList *DRW_viewport_framebuffer_list_get(void)
|
||||
DefaultFramebufferList *DRW_viewport_framebuffer_list_get()
|
||||
{
|
||||
return DRW_view_data_default_framebuffer_list_get(DST.view_data_active);
|
||||
}
|
||||
|
||||
DefaultTextureList *DRW_viewport_texture_list_get(void)
|
||||
DefaultTextureList *DRW_viewport_texture_list_get()
|
||||
{
|
||||
return DRW_view_data_default_texture_list_get(DST.view_data_active);
|
||||
}
|
||||
|
||||
void DRW_viewport_request_redraw(void)
|
||||
void DRW_viewport_request_redraw()
|
||||
{
|
||||
if (DST.viewport) {
|
||||
GPU_viewport_tag_update(DST.viewport);
|
||||
@@ -750,7 +750,7 @@ static void duplidata_key_free(void *key)
|
||||
MEM_freeN(key);
|
||||
}
|
||||
|
||||
static void drw_duplidata_free(void)
|
||||
static void drw_duplidata_free()
|
||||
{
|
||||
if (DST.dupli_ghash != nullptr) {
|
||||
BLI_ghash_free(DST.dupli_ghash, duplidata_key_free, duplidata_value_free);
|
||||
@@ -825,7 +825,7 @@ void **DRW_view_layer_engine_data_ensure(DrawEngineType *engine_type,
|
||||
*/
|
||||
struct IdDdtTemplate {
|
||||
ID id;
|
||||
struct AnimData *adt;
|
||||
AnimData *adt;
|
||||
DrawDataList drawdata;
|
||||
};
|
||||
|
||||
@@ -976,7 +976,7 @@ void DRW_cache_free_old_batches(Main *bmain)
|
||||
Scene *scene;
|
||||
ViewLayer *view_layer;
|
||||
static int lasttime = 0;
|
||||
int ctime = (int)PIL_check_seconds_timer();
|
||||
int ctime = int(PIL_check_seconds_timer());
|
||||
|
||||
if (U.vbotimeout == 0 || (ctime - lasttime) < U.vbocollectrate || ctime == lasttime) {
|
||||
return;
|
||||
@@ -1014,7 +1014,7 @@ void DRW_cache_free_old_batches(Main *bmain)
|
||||
/** \name Rendering (DRW_engines)
|
||||
* \{ */
|
||||
|
||||
static void drw_engines_init(void)
|
||||
static void drw_engines_init()
|
||||
{
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) {
|
||||
PROFILE_START(stime);
|
||||
@@ -1030,7 +1030,7 @@ static void drw_engines_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_engines_cache_init(void)
|
||||
static void drw_engines_cache_init()
|
||||
{
|
||||
DRW_manager_begin_sync();
|
||||
|
||||
@@ -1098,7 +1098,7 @@ static void drw_engines_cache_populate(Object *ob)
|
||||
drw_drawdata_unlink_dupli((ID *)ob);
|
||||
}
|
||||
|
||||
static void drw_engines_cache_finish(void)
|
||||
static void drw_engines_cache_finish()
|
||||
{
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) {
|
||||
if (engine->cache_finish) {
|
||||
@@ -1109,7 +1109,7 @@ static void drw_engines_cache_finish(void)
|
||||
DRW_manager_end_sync();
|
||||
}
|
||||
|
||||
static void drw_engines_draw_scene(void)
|
||||
static void drw_engines_draw_scene()
|
||||
{
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) {
|
||||
PROFILE_START(stime);
|
||||
@@ -1128,7 +1128,7 @@ static void drw_engines_draw_scene(void)
|
||||
DRW_state_reset();
|
||||
}
|
||||
|
||||
static void drw_engines_draw_text(void)
|
||||
static void drw_engines_draw_text()
|
||||
{
|
||||
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, engine, data) {
|
||||
PROFILE_START(stime);
|
||||
@@ -1198,7 +1198,7 @@ static void drw_engines_enable_from_engine(const RenderEngineType *engine_type,
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_engines_enable_overlays(void)
|
||||
static void drw_engines_enable_overlays()
|
||||
{
|
||||
use_drw_engine((U.experimental.enable_overlay_next) ? &draw_engine_overlay_next_type :
|
||||
&draw_engine_overlay_type);
|
||||
@@ -1206,12 +1206,12 @@ static void drw_engines_enable_overlays(void)
|
||||
/**
|
||||
* Use for select and depth-drawing.
|
||||
*/
|
||||
static void drw_engines_enable_basic(void)
|
||||
static void drw_engines_enable_basic()
|
||||
{
|
||||
use_drw_engine(&draw_engine_basic_type);
|
||||
}
|
||||
|
||||
static void drw_engine_enable_image_editor(void)
|
||||
static void drw_engine_enable_image_editor()
|
||||
{
|
||||
if (DRW_engine_external_acquire_for_image_editor()) {
|
||||
use_drw_engine(&draw_engine_external_type);
|
||||
@@ -1224,7 +1224,7 @@ static void drw_engine_enable_image_editor(void)
|
||||
&draw_engine_overlay_type);
|
||||
}
|
||||
|
||||
static void drw_engines_enable_editors(void)
|
||||
static void drw_engines_enable_editors()
|
||||
{
|
||||
SpaceLink *space_data = DST.draw_ctx.space_data;
|
||||
if (!space_data) {
|
||||
@@ -1245,7 +1245,7 @@ static void drw_engines_enable_editors(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool is_compositor_enabled(void)
|
||||
static bool is_compositor_enabled()
|
||||
{
|
||||
if (DST.draw_ctx.v3d->shading.use_compositor == V3D_SHADING_USE_COMPOSITOR_DISABLED) {
|
||||
return false;
|
||||
@@ -1299,12 +1299,12 @@ static void drw_engines_enable(ViewLayer * /*view_layer*/,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void drw_engines_disable(void)
|
||||
static void drw_engines_disable()
|
||||
{
|
||||
DRW_view_data_reset(DST.view_data_active);
|
||||
}
|
||||
|
||||
static void drw_engines_data_validate(void)
|
||||
static void drw_engines_data_validate()
|
||||
{
|
||||
DRW_view_data_free_unused(DST.view_data_active);
|
||||
}
|
||||
@@ -1445,7 +1445,7 @@ static void drw_notify_view_update_offscreen(Depsgraph *depsgraph,
|
||||
/** \name Callbacks
|
||||
* \{ */
|
||||
|
||||
void DRW_draw_callbacks_pre_scene(void)
|
||||
void DRW_draw_callbacks_pre_scene()
|
||||
{
|
||||
RegionView3D *rv3d = DST.draw_ctx.rv3d;
|
||||
|
||||
@@ -1460,7 +1460,7 @@ void DRW_draw_callbacks_pre_scene(void)
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_draw_callbacks_post_scene(void)
|
||||
void DRW_draw_callbacks_post_scene()
|
||||
{
|
||||
RegionView3D *rv3d = DST.draw_ctx.rv3d;
|
||||
ARegion *region = DST.draw_ctx.region;
|
||||
@@ -1607,7 +1607,7 @@ void DRW_draw_callbacks_post_scene(void)
|
||||
}
|
||||
}
|
||||
|
||||
struct DRWTextStore *DRW_text_cache_ensure(void)
|
||||
DRWTextStore *DRW_text_cache_ensure()
|
||||
{
|
||||
BLI_assert(DST.text_store_p);
|
||||
if (*DST.text_store_p == nullptr) {
|
||||
@@ -2138,7 +2138,7 @@ void DRW_custom_pipeline_begin(DrawEngineType *draw_engine_type, Depsgraph *deps
|
||||
DRW_view_data_engine_data_get_ensure(DST.view_data_active, draw_engine_type);
|
||||
}
|
||||
|
||||
void DRW_custom_pipeline_end(void)
|
||||
void DRW_custom_pipeline_end()
|
||||
{
|
||||
DST.buffer_finish_called = false;
|
||||
|
||||
@@ -2173,7 +2173,7 @@ void DRW_custom_pipeline(DrawEngineType *draw_engine_type,
|
||||
DRW_custom_pipeline_end();
|
||||
}
|
||||
|
||||
void DRW_cache_restart(void)
|
||||
void DRW_cache_restart()
|
||||
{
|
||||
DRW_smoke_exit(DST.vmempool);
|
||||
|
||||
@@ -2375,7 +2375,7 @@ static void draw_select_framebuffer_depth_only_setup(const int size[2])
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_render_instance_buffer_finish(void)
|
||||
void DRW_render_instance_buffer_finish()
|
||||
{
|
||||
BLI_assert_msg(!DST.buffer_finish_called, "DRW_render_instance_buffer_finish called twice!");
|
||||
DST.buffer_finish_called = true;
|
||||
@@ -2883,7 +2883,7 @@ void DRW_draw_depth_object(
|
||||
GPU_framebuffer_clear_depth(depth_fb, 1.0f);
|
||||
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
||||
|
||||
struct GPUClipPlanes planes;
|
||||
GPUClipPlanes planes;
|
||||
const bool use_clipping_planes = RV3D_CLIPPING_ENABLED(v3d, rv3d);
|
||||
if (use_clipping_planes) {
|
||||
GPU_clip_distances(6);
|
||||
@@ -2908,7 +2908,7 @@ void DRW_draw_depth_object(
|
||||
else {
|
||||
batch = DRW_mesh_batch_cache_get_surface(me);
|
||||
}
|
||||
struct TaskGraph *task_graph = BLI_task_graph_create();
|
||||
TaskGraph *task_graph = BLI_task_graph_create();
|
||||
DRW_mesh_batch_cache_create_requested(task_graph, object, me, scene, false, true);
|
||||
BLI_task_graph_work_and_wait(task_graph);
|
||||
BLI_task_graph_free(task_graph);
|
||||
@@ -2919,7 +2919,7 @@ void DRW_draw_depth_object(
|
||||
|
||||
GPUUniformBuf *ubo = nullptr;
|
||||
if (use_clipping_planes) {
|
||||
ubo = GPU_uniformbuf_create_ex(sizeof(struct GPUClipPlanes), &planes, __func__);
|
||||
ubo = GPU_uniformbuf_create_ex(sizeof(GPUClipPlanes), &planes, __func__);
|
||||
GPU_batch_uniformbuf_bind(batch, "clipPlanes", ubo);
|
||||
}
|
||||
|
||||
@@ -2949,44 +2949,44 @@ void DRW_draw_depth_object(
|
||||
/** \name Draw Manager State (DRW_state)
|
||||
* \{ */
|
||||
|
||||
bool DRW_state_is_fbo(void)
|
||||
bool DRW_state_is_fbo()
|
||||
{
|
||||
return ((DST.default_framebuffer != nullptr) || DST.options.is_image_render) &&
|
||||
!DRW_state_is_depth() && !DRW_state_is_select();
|
||||
}
|
||||
|
||||
bool DRW_state_is_select(void)
|
||||
bool DRW_state_is_select()
|
||||
{
|
||||
return DST.options.is_select;
|
||||
}
|
||||
|
||||
bool DRW_state_is_material_select(void)
|
||||
bool DRW_state_is_material_select()
|
||||
{
|
||||
return DST.options.is_material_select;
|
||||
}
|
||||
|
||||
bool DRW_state_is_depth(void)
|
||||
bool DRW_state_is_depth()
|
||||
{
|
||||
return DST.options.is_depth;
|
||||
}
|
||||
|
||||
bool DRW_state_is_image_render(void)
|
||||
bool DRW_state_is_image_render()
|
||||
{
|
||||
return DST.options.is_image_render;
|
||||
}
|
||||
|
||||
bool DRW_state_is_scene_render(void)
|
||||
bool DRW_state_is_scene_render()
|
||||
{
|
||||
BLI_assert(DST.options.is_scene_render ? DST.options.is_image_render : true);
|
||||
return DST.options.is_scene_render;
|
||||
}
|
||||
|
||||
bool DRW_state_is_viewport_image_render(void)
|
||||
bool DRW_state_is_viewport_image_render()
|
||||
{
|
||||
return DST.options.is_image_render && !DST.options.is_scene_render;
|
||||
}
|
||||
|
||||
bool DRW_state_is_playback(void)
|
||||
bool DRW_state_is_playback()
|
||||
{
|
||||
if (DST.draw_ctx.evil_C != nullptr) {
|
||||
wmWindowManager *wm = CTX_wm_manager(DST.draw_ctx.evil_C);
|
||||
@@ -2995,26 +2995,26 @@ bool DRW_state_is_playback(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DRW_state_is_navigating(void)
|
||||
bool DRW_state_is_navigating()
|
||||
{
|
||||
const RegionView3D *rv3d = DST.draw_ctx.rv3d;
|
||||
return (rv3d) && (rv3d->rflag & (RV3D_NAVIGATING | RV3D_PAINTING));
|
||||
}
|
||||
|
||||
bool DRW_state_show_text(void)
|
||||
bool DRW_state_show_text()
|
||||
{
|
||||
return (DST.options.is_select) == 0 && (DST.options.is_depth) == 0 &&
|
||||
(DST.options.is_scene_render) == 0 && (DST.options.draw_text) == 0;
|
||||
}
|
||||
|
||||
bool DRW_state_draw_support(void)
|
||||
bool DRW_state_draw_support()
|
||||
{
|
||||
View3D *v3d = DST.draw_ctx.v3d;
|
||||
return (DRW_state_is_scene_render() == false) && (v3d != nullptr) &&
|
||||
((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0);
|
||||
}
|
||||
|
||||
bool DRW_state_draw_background(void)
|
||||
bool DRW_state_draw_background()
|
||||
{
|
||||
return DST.options.draw_background;
|
||||
}
|
||||
@@ -3025,7 +3025,7 @@ bool DRW_state_draw_background(void)
|
||||
/** \name Context State (DRW_context_state)
|
||||
* \{ */
|
||||
|
||||
const DRWContextState *DRW_context_state_get(void)
|
||||
const DRWContextState *DRW_context_state_get()
|
||||
{
|
||||
return &DST.draw_ctx;
|
||||
}
|
||||
@@ -3052,7 +3052,7 @@ void DRW_engine_register(DrawEngineType *draw_engine_type)
|
||||
g_registered_engines.len = BLI_listbase_count(&g_registered_engines.engines);
|
||||
}
|
||||
|
||||
void DRW_engines_register_experimental(void)
|
||||
void DRW_engines_register_experimental()
|
||||
{
|
||||
if (U.experimental.enable_eevee_next) {
|
||||
RE_engines_register(&DRW_engine_viewport_eevee_next_type);
|
||||
@@ -3062,7 +3062,7 @@ void DRW_engines_register_experimental(void)
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_engines_register(void)
|
||||
void DRW_engines_register()
|
||||
{
|
||||
RE_engines_register(&DRW_engine_viewport_eevee_type);
|
||||
RE_engines_register(&DRW_engine_viewport_workbench_type);
|
||||
@@ -3116,7 +3116,7 @@ void DRW_engines_register(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_registered_engines_free(void)
|
||||
static void drw_registered_engines_free()
|
||||
{
|
||||
DRWRegisteredDrawEngine *next;
|
||||
for (DRWRegisteredDrawEngine *type =
|
||||
@@ -3137,7 +3137,7 @@ static void drw_registered_engines_free(void)
|
||||
g_registered_engines.len = 0;
|
||||
}
|
||||
|
||||
void DRW_engines_free(void)
|
||||
void DRW_engines_free()
|
||||
{
|
||||
drw_registered_engines_free();
|
||||
|
||||
@@ -3235,7 +3235,7 @@ void DRW_render_context_disable(Render *render)
|
||||
/** \name Init/Exit (DRW_gpu_ctx)
|
||||
* \{ */
|
||||
|
||||
void DRW_gpu_context_create(void)
|
||||
void DRW_gpu_context_create()
|
||||
{
|
||||
BLI_assert(DST.system_gpu_context == nullptr); /* Ensure it's called once */
|
||||
|
||||
@@ -3249,7 +3249,7 @@ void DRW_gpu_context_create(void)
|
||||
wm_window_reset_drawable();
|
||||
}
|
||||
|
||||
void DRW_gpu_context_destroy(void)
|
||||
void DRW_gpu_context_destroy()
|
||||
{
|
||||
BLI_assert(BLI_thread_is_main());
|
||||
if (DST.system_gpu_context != nullptr) {
|
||||
@@ -3301,7 +3301,7 @@ void DRW_gpu_context_disable_ex(bool restore)
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_gpu_context_enable(void)
|
||||
void DRW_gpu_context_enable()
|
||||
{
|
||||
/* TODO: should be replace by a more elegant alternative. */
|
||||
|
||||
@@ -3311,7 +3311,7 @@ void DRW_gpu_context_enable(void)
|
||||
DRW_gpu_context_enable_ex(true);
|
||||
}
|
||||
|
||||
void DRW_gpu_context_disable(void)
|
||||
void DRW_gpu_context_disable()
|
||||
{
|
||||
DRW_gpu_context_disable_ex(true);
|
||||
}
|
||||
@@ -3351,7 +3351,7 @@ void DRW_blender_gpu_render_context_disable(void * /*re_gpu_context*/)
|
||||
|
||||
#ifdef WITH_XR_OPENXR
|
||||
|
||||
void *DRW_system_gpu_context_get(void)
|
||||
void *DRW_system_gpu_context_get()
|
||||
{
|
||||
/* XXX: There should really be no such getter, but for VR we currently can't easily avoid it.
|
||||
* OpenXR needs some low level info for the GPU context that will be used for submitting the
|
||||
@@ -3365,21 +3365,21 @@ void *DRW_system_gpu_context_get(void)
|
||||
return DST.system_gpu_context;
|
||||
}
|
||||
|
||||
void *DRW_xr_blender_gpu_context_get(void)
|
||||
void *DRW_xr_blender_gpu_context_get()
|
||||
{
|
||||
/* XXX: See comment on #DRW_system_gpu_context_get(). */
|
||||
|
||||
return DST.blender_gpu_context;
|
||||
}
|
||||
|
||||
void DRW_xr_drawing_begin(void)
|
||||
void DRW_xr_drawing_begin()
|
||||
{
|
||||
/* XXX: See comment on #DRW_system_gpu_context_get(). */
|
||||
|
||||
BLI_ticket_mutex_lock(DST.system_gpu_context_mutex);
|
||||
}
|
||||
|
||||
void DRW_xr_drawing_end(void)
|
||||
void DRW_xr_drawing_end()
|
||||
{
|
||||
/* XXX: See comment on #DRW_system_gpu_context_get(). */
|
||||
|
||||
@@ -3433,7 +3433,7 @@ void DRW_draw_state_init_gtests(eGPUShaderConfig sh_cfg)
|
||||
*
|
||||
* \{ */
|
||||
|
||||
bool DRW_gpu_context_release(void)
|
||||
bool DRW_gpu_context_release()
|
||||
{
|
||||
if (!BLI_thread_is_main()) {
|
||||
return false;
|
||||
|
||||
@@ -266,7 +266,7 @@ void DRW_state_reset_ex(DRWState state)
|
||||
drw_state_set(state);
|
||||
}
|
||||
|
||||
static void drw_state_validate(void)
|
||||
static void drw_state_validate()
|
||||
{
|
||||
/* Cannot write to stencil buffer without stencil test. */
|
||||
if (DST.state & DRW_STATE_WRITE_STENCIL_ENABLED) {
|
||||
@@ -315,7 +315,7 @@ void DRW_state_lock(DRWState state)
|
||||
}
|
||||
}
|
||||
|
||||
void DRW_state_reset(void)
|
||||
void DRW_state_reset()
|
||||
{
|
||||
DRW_state_reset_ex(DRW_STATE_DEFAULT);
|
||||
|
||||
@@ -349,7 +349,7 @@ void DRW_view_set_active(const DRWView *view)
|
||||
DST.view_active = (view != nullptr) ? ((DRWView *)view) : DST.view_default;
|
||||
}
|
||||
|
||||
const DRWView *DRW_view_get_active(void)
|
||||
const DRWView *DRW_view_get_active()
|
||||
{
|
||||
return DST.view_active;
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_update_view(void)
|
||||
static void drw_update_view()
|
||||
{
|
||||
/* TODO(fclem): update a big UBO and only bind ranges here. */
|
||||
GPU_uniformbuf_update(G_draw.view_ubo, &DST.view_active->storage);
|
||||
|
||||
@@ -633,7 +633,7 @@ struct DRWShaderLibrary {
|
||||
uint64_t libs_deps[MAX_LIB];
|
||||
};
|
||||
|
||||
DRWShaderLibrary *DRW_shader_library_create(void)
|
||||
DRWShaderLibrary *DRW_shader_library_create()
|
||||
{
|
||||
return static_cast<DRWShaderLibrary *>(
|
||||
MEM_callocN(sizeof(DRWShaderLibrary), "DRWShaderLibrary"));
|
||||
@@ -689,7 +689,7 @@ static uint64_t drw_shader_dependencies_get(const DRWShaderLibrary *lib,
|
||||
dbg_name);
|
||||
}
|
||||
else {
|
||||
deps |= 1llu << ((uint64_t)dep);
|
||||
deps |= 1llu << uint64_t(dep);
|
||||
}
|
||||
}
|
||||
return deps;
|
||||
@@ -724,7 +724,7 @@ char *DRW_shader_library_create_shader_string(const DRWShaderLibrary *lib, const
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
/* Add all dependencies recursively. */
|
||||
for (int i = MAX_LIB - 1; i > -1; i--) {
|
||||
if (lib->libs[i] && (deps & (1llu << (uint64_t)i))) {
|
||||
if (lib->libs[i] && (deps & (1llu << uint64_t(i)))) {
|
||||
deps |= lib->libs_deps[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ GPUTexture *DRW_texture_pool_query_fullscreen_ex(eGPUTextureFormat format,
|
||||
DrawEngineType *engine_type)
|
||||
{
|
||||
const float *size = DRW_viewport_size_get();
|
||||
return DRW_texture_pool_query_2d_ex((int)size[0], (int)size[1], format, usage, engine_type);
|
||||
return DRW_texture_pool_query_2d_ex(int(size[0]), int(size[1]), format, usage, engine_type);
|
||||
}
|
||||
|
||||
GPUTexture *DRW_texture_pool_query_fullscreen(eGPUTextureFormat format,
|
||||
@@ -229,7 +229,7 @@ void DRW_texture_ensure_fullscreen_2d_ex(GPUTexture **tex,
|
||||
{
|
||||
if (*(tex) == nullptr) {
|
||||
const float *size = DRW_viewport_size_get();
|
||||
*(tex) = DRW_texture_create_2d_ex((int)size[0], (int)size[1], format, usage, flags, nullptr);
|
||||
*(tex) = DRW_texture_create_2d_ex(int(size[0]), int(size[1]), format, usage, flags, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ struct PolyMaskData {
|
||||
|
||||
static void drw_select_mask_px_cb(int x, int x_end, int y, void *user_data)
|
||||
{
|
||||
struct PolyMaskData *data = static_cast<PolyMaskData *>(user_data);
|
||||
PolyMaskData *data = static_cast<PolyMaskData *>(user_data);
|
||||
BLI_bitmap *px = data->px;
|
||||
int i = (y * data->width) + x;
|
||||
do {
|
||||
@@ -224,7 +224,7 @@ uint *DRW_select_buffer_bitmap_from_poly(Depsgraph *depsgraph,
|
||||
|
||||
BLI_bitmap *buf_mask = BLI_BITMAP_NEW(buf_len, __func__);
|
||||
|
||||
struct PolyMaskData poly_mask_data;
|
||||
PolyMaskData poly_mask_data;
|
||||
poly_mask_data.px = buf_mask;
|
||||
poly_mask_data.width = (rect->xmax - rect->xmin) + 1;
|
||||
|
||||
@@ -303,7 +303,7 @@ struct SelectReadData {
|
||||
|
||||
static bool select_buffer_test_fn(const void *__restrict value, void *__restrict userdata)
|
||||
{
|
||||
struct SelectReadData *data = static_cast<SelectReadData *>(userdata);
|
||||
SelectReadData *data = static_cast<SelectReadData *>(userdata);
|
||||
uint hit_id = *(uint *)value;
|
||||
if (hit_id && hit_id >= data->id_min && hit_id < data->id_max) {
|
||||
/* Start at 1 to confirm. */
|
||||
@@ -344,14 +344,14 @@ uint DRW_select_buffer_find_nearest_to_point(Depsgraph *depsgraph,
|
||||
|
||||
const int shape[2] = {height, width};
|
||||
const int center_yx[2] = {(height - 1) / 2, (width - 1) / 2};
|
||||
struct SelectReadData data = {nullptr, id_min, id_max, 0};
|
||||
SelectReadData data = {nullptr, id_min, id_max, 0};
|
||||
BLI_array_iter_spiral_square(buf, shape, center_yx, select_buffer_test_fn, &data);
|
||||
|
||||
if (data.val_ptr) {
|
||||
size_t offset = ((size_t)data.val_ptr - (size_t)buf) / sizeof(*buf);
|
||||
size_t offset = (size_t(data.val_ptr) - size_t(buf)) / sizeof(*buf);
|
||||
int hit_x = offset % width;
|
||||
int hit_y = offset / width;
|
||||
*dist = (uint)(abs(hit_y - center_yx[0]) + abs(hit_x - center_yx[1]));
|
||||
*dist = uint(abs(hit_y - center_yx[0]) + abs(hit_x - center_yx[1]));
|
||||
}
|
||||
|
||||
MEM_freeN((void *)buf);
|
||||
@@ -376,7 +376,7 @@ bool DRW_select_buffer_elem_get(const uint sel_id,
|
||||
uint base_index = 0;
|
||||
|
||||
for (; base_index < select_ctx->objects_drawn_len; base_index++) {
|
||||
struct ObjectOffsets *base_ofs = &select_ctx->index_offsets[base_index];
|
||||
ObjectOffsets *base_ofs = &select_ctx->index_offsets[base_index];
|
||||
|
||||
if (base_ofs->face > sel_id) {
|
||||
elem_id = sel_id - base_ofs->face_start;
|
||||
@@ -428,7 +428,7 @@ uint DRW_select_buffer_context_offset_for_object_elem(Depsgraph *depsgraph,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ObjectOffsets *base_ofs = &select_ctx->index_offsets[sel_data->drawn_index];
|
||||
ObjectOffsets *base_ofs = &select_ctx->index_offsets[sel_data->drawn_index];
|
||||
|
||||
if (elem_type == SCE_SELECT_VERTEX) {
|
||||
return base_ofs->vert_start;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
/* ******************** region info ***************** */
|
||||
|
||||
void DRW_draw_region_info(void)
|
||||
void DRW_draw_region_info()
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *region = draw_ctx->region;
|
||||
@@ -89,7 +89,7 @@ static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, Vie
|
||||
return true;
|
||||
}
|
||||
|
||||
void DRW_draw_cursor(void)
|
||||
void DRW_draw_cursor()
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *region = draw_ctx->region;
|
||||
@@ -256,7 +256,7 @@ void DRW_draw_cursor_2d_ex(const ARegion *region, const float cursor[2])
|
||||
|
||||
/** \} */
|
||||
|
||||
void DRW_draw_cursor_2d(void)
|
||||
void DRW_draw_cursor_2d()
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *region = draw_ctx->region;
|
||||
@@ -275,7 +275,7 @@ void DRW_draw_cursor_2d(void)
|
||||
|
||||
/* **************************** 3D Gizmo ******************************** */
|
||||
|
||||
void DRW_draw_gizmo_3d(void)
|
||||
void DRW_draw_gizmo_3d()
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *region = draw_ctx->region;
|
||||
@@ -286,7 +286,7 @@ void DRW_draw_gizmo_3d(void)
|
||||
WM_gizmomap_draw(region->gizmo_map, draw_ctx->evil_C, WM_GIZMOMAP_DRAWSTEP_3D);
|
||||
}
|
||||
|
||||
void DRW_draw_gizmo_2d(void)
|
||||
void DRW_draw_gizmo_2d()
|
||||
{
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
ARegion *region = draw_ctx->region;
|
||||
|
||||
@@ -5085,7 +5085,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* Create a new object. */
|
||||
/* Take into account user preferences for duplicating actions. */
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags((U.dupflag & USER_DUP_ACT));
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags(U.dupflag & USER_DUP_ACT);
|
||||
|
||||
base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
ob_dst = base_new->object;
|
||||
|
||||
@@ -933,7 +933,7 @@ static void gpencil_brush_clone_init(bContext *C, tGP_BrushEditData *gso)
|
||||
/* compute midpoint of strokes on clipboard */
|
||||
for (gps = static_cast<bGPDstroke *>(gpencil_strokes_copypastebuf.first); gps; gps = gps->next) {
|
||||
if (ED_gpencil_stroke_can_use(C, gps)) {
|
||||
const float dfac = 1.0f / (float(gps->totpoints));
|
||||
const float dfac = 1.0f / float(gps->totpoints);
|
||||
float mid[3] = {0.0f};
|
||||
|
||||
bGPDspoint *pt;
|
||||
|
||||
@@ -151,7 +151,7 @@ static void gaussian_blur_1D(const Span<T> src,
|
||||
const int64_t last_pt = total_points - 1;
|
||||
|
||||
auto is_end_and_fixed = [smooth_ends, is_cyclic, last_pt](int index) {
|
||||
return !smooth_ends && !is_cyclic && (ELEM(index, 0, last_pt));
|
||||
return !smooth_ends && !is_cyclic && ELEM(index, 0, last_pt);
|
||||
};
|
||||
|
||||
/* Initialize at zero. */
|
||||
|
||||
@@ -3006,7 +3006,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
|
||||
if (ibuf->float_buffer.data) {
|
||||
|
||||
float *fp = ibuf->float_buffer.data;
|
||||
for (i = (size_t(ibuf->x)) * ibuf->y; i > 0; i--, fp += 4) {
|
||||
for (i = size_t(ibuf->x) * ibuf->y; i > 0; i--, fp += 4) {
|
||||
if (r) {
|
||||
fp[0] = 1.0f - fp[0];
|
||||
}
|
||||
@@ -3028,7 +3028,7 @@ static int image_invert_exec(bContext *C, wmOperator *op)
|
||||
else if (ibuf->byte_buffer.data) {
|
||||
|
||||
uchar *cp = ibuf->byte_buffer.data;
|
||||
for (i = (size_t(ibuf->x)) * ibuf->y; i > 0; i--, cp += 4) {
|
||||
for (i = size_t(ibuf->x) * ibuf->y; i > 0; i--, cp += 4) {
|
||||
if (r) {
|
||||
cp[0] = 255 - cp[0];
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ static void build_sequential(Object *ob,
|
||||
size_t i;
|
||||
Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
/* Frame-rate of scene. */
|
||||
const float fps = ((float(scene->r.frs_sec)) / scene->r.frs_sec_base);
|
||||
const float fps = (float(scene->r.frs_sec) / scene->r.frs_sec_base);
|
||||
|
||||
/* 1) Determine which strokes to start with (& adapt total number of strokes to build). */
|
||||
if (mmd->mode == GP_BUILD_MODE_ADDITIVE) {
|
||||
|
||||
@@ -66,7 +66,7 @@ static ListBase presets_list = {nullptr, nullptr};
|
||||
/** \name 3D Primitives
|
||||
* \{ */
|
||||
|
||||
static GPUVertFormat *preset_3d_format(void)
|
||||
static GPUVertFormat *preset_3d_format()
|
||||
{
|
||||
if (g_presets_3d.format.attr_len == 0) {
|
||||
GPUVertFormat *format = &g_presets_3d.format;
|
||||
@@ -78,7 +78,7 @@ static GPUVertFormat *preset_3d_format(void)
|
||||
return &g_presets_3d.format;
|
||||
}
|
||||
|
||||
static GPUVertFormat *preset_2d_format(void)
|
||||
static GPUVertFormat *preset_2d_format()
|
||||
{
|
||||
if (g_presets_2d.format.attr_len == 0) {
|
||||
GPUVertFormat *format = &g_presets_2d.format;
|
||||
@@ -253,10 +253,10 @@ static GPUBatch *gpu_batch_preset_panel_drag_widget(float pixelsize,
|
||||
GPU_vertbuf_attr_get_raw_data(vbo, g_presets_2d.attr_id.pos, &pos_step);
|
||||
GPU_vertbuf_attr_get_raw_data(vbo, g_presets_2d.attr_id.col, &col_step);
|
||||
|
||||
const int px = (int)pixelsize;
|
||||
const int px = int(pixelsize);
|
||||
const int px_zoom = max_ii(round_fl_to_int(width / 22.0f), 1);
|
||||
|
||||
const int box_margin = max_ii(round_fl_to_int((float)(px_zoom * 2.0f)), px);
|
||||
const int box_margin = max_ii(round_fl_to_int(float(px_zoom * 2.0f)), px);
|
||||
const int box_size = max_ii(round_fl_to_int((width / 8.0f) - px), px);
|
||||
|
||||
const int y_ofs = max_ii(round_fl_to_int(width / 2.5f), px);
|
||||
@@ -311,7 +311,7 @@ GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize,
|
||||
return g_presets_2d.batch.panel_drag_widget;
|
||||
}
|
||||
|
||||
GPUBatch *GPU_batch_preset_quad(void)
|
||||
GPUBatch *GPU_batch_preset_quad()
|
||||
{
|
||||
if (!g_presets_2d.batch.quad) {
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(preset_2d_format());
|
||||
@@ -335,7 +335,7 @@ GPUBatch *GPU_batch_preset_quad(void)
|
||||
/** \name Preset Registration Management
|
||||
* \{ */
|
||||
|
||||
void gpu_batch_presets_init(void)
|
||||
void gpu_batch_presets_init()
|
||||
{
|
||||
BLI_mutex_init(&g_presets_3d.mutex);
|
||||
|
||||
@@ -378,7 +378,7 @@ bool gpu_batch_presets_unregister(GPUBatch *preset_batch)
|
||||
return false;
|
||||
}
|
||||
|
||||
void gpu_batch_presets_exit(void)
|
||||
void gpu_batch_presets_exit()
|
||||
{
|
||||
LinkData *link;
|
||||
while ((link = static_cast<LinkData *>(BLI_pophead(&presets_list)))) {
|
||||
|
||||
@@ -47,7 +47,7 @@ GPUBatch *GPU_batch_tris_from_poly_2d_encoded(const uchar *polys_flat,
|
||||
uint i_vert = 0;
|
||||
while (i_poly != polys_len) {
|
||||
for (uint j = 0; j < 2; j++) {
|
||||
verts[i_vert][j] = min_uchar[j] + ((float)polys[i_poly][j] * range_uchar[j]);
|
||||
verts[i_vert][j] = min_uchar[j] + (float(polys[i_poly][j]) * range_uchar[j]);
|
||||
}
|
||||
i_vert++;
|
||||
i_poly++;
|
||||
@@ -201,7 +201,7 @@ GPUBatch *GPU_batch_wire_from_poly_2d_encoded(const uchar *polys_flat,
|
||||
for (uint k = 0; k < 2; k++) {
|
||||
float *pos_v2 = static_cast<float *>(GPU_vertbuf_raw_step(&pos_step));
|
||||
for (uint j = 0; j < 2; j++) {
|
||||
pos_v2[j] = min_uchar[j] + ((float)data.as_u8_pair[k][j] * range_uchar[j]);
|
||||
pos_v2[j] = min_uchar[j] + (float(data.as_u8_pair[k][j]) * range_uchar[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ static void imm_draw_circle(GPUPrimType prim_type,
|
||||
|
||||
immVertex2f(shdr_pos, x + (radius_x * cosf(0.0f)), y + (radius_y * sinf(0.0f)));
|
||||
for (int i = 1; i < nsegments; i++) {
|
||||
const float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments);
|
||||
const float angle = float(2 * M_PI) * (float(i) / float(nsegments));
|
||||
immVertex2f(shdr_pos, x + (radius_x * cosf(angle)), y + (radius_y * sinf(angle)));
|
||||
immVertex2f(shdr_pos, x + (radius_x * cosf(angle)), y + (radius_y * sinf(angle)));
|
||||
}
|
||||
@@ -159,7 +159,7 @@ static void imm_draw_circle(GPUPrimType prim_type,
|
||||
else {
|
||||
immBegin(prim_type, nsegments);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
const float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments);
|
||||
const float angle = float(2 * M_PI) * (float(i) / float(nsegments));
|
||||
immVertex2f(shdr_pos, x + (radius_x * cosf(angle)), y + (radius_y * sinf(angle)));
|
||||
}
|
||||
immEnd();
|
||||
@@ -198,12 +198,12 @@ static void imm_draw_circle_partial(GPUPrimType prim_type,
|
||||
float sweep)
|
||||
{
|
||||
/* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */
|
||||
const float angle_start = -DEG2RADF(start) + (float)M_PI_2;
|
||||
const float angle_start = -DEG2RADF(start) + float(M_PI_2);
|
||||
const float angle_end = -(DEG2RADF(sweep) - angle_start);
|
||||
nsegments += 1;
|
||||
immBegin(prim_type, nsegments);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
const float angle = interpf(angle_start, angle_end, ((float)i / (float)(nsegments - 1)));
|
||||
const float angle = interpf(angle_start, angle_end, (float(i) / float(nsegments - 1)));
|
||||
const float angle_sin = sinf(angle);
|
||||
const float angle_cos = cosf(angle);
|
||||
immVertex2f(pos, x + radius * angle_cos, y + radius * angle_sin);
|
||||
@@ -222,12 +222,12 @@ static void imm_draw_circle_partial_3d(GPUPrimType prim_type,
|
||||
float sweep)
|
||||
{
|
||||
/* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */
|
||||
const float angle_start = -DEG2RADF(start) + (float)(M_PI / 2);
|
||||
const float angle_start = -DEG2RADF(start) + float(M_PI / 2);
|
||||
const float angle_end = -(DEG2RADF(sweep) - angle_start);
|
||||
nsegments += 1;
|
||||
immBegin(prim_type, nsegments);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
const float angle = interpf(angle_start, angle_end, ((float)i / (float)(nsegments - 1)));
|
||||
const float angle = interpf(angle_start, angle_end, (float(i) / float(nsegments - 1)));
|
||||
const float angle_sin = sinf(angle);
|
||||
const float angle_cos = cosf(angle);
|
||||
immVertex3f(pos, x + rad * angle_cos, y + rad * angle_sin, z);
|
||||
@@ -262,12 +262,12 @@ static void imm_draw_disk_partial(GPUPrimType prim_type,
|
||||
CLAMP(sweep, -max_angle, max_angle);
|
||||
|
||||
/* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */
|
||||
const float angle_start = -DEG2RADF(start) + (float)M_PI_2;
|
||||
const float angle_start = -DEG2RADF(start) + float(M_PI_2);
|
||||
const float angle_end = -(DEG2RADF(sweep) - angle_start);
|
||||
nsegments += 1;
|
||||
immBegin(prim_type, nsegments * 2);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
const float angle = interpf(angle_start, angle_end, ((float)i / (float)(nsegments - 1)));
|
||||
const float angle = interpf(angle_start, angle_end, (float(i) / float(nsegments - 1)));
|
||||
const float angle_sin = sinf(angle);
|
||||
const float angle_cos = cosf(angle);
|
||||
immVertex2f(pos, x + rad_inner * angle_cos, y + rad_inner * angle_sin);
|
||||
@@ -292,12 +292,12 @@ static void imm_draw_disk_partial_3d(GPUPrimType prim_type,
|
||||
CLAMP(sweep, -max_angle, max_angle);
|
||||
|
||||
/* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */
|
||||
const float angle_start = -DEG2RADF(start) + (float)M_PI_2;
|
||||
const float angle_start = -DEG2RADF(start) + float(M_PI_2);
|
||||
const float angle_end = -(DEG2RADF(sweep) - angle_start);
|
||||
nsegments += 1;
|
||||
immBegin(prim_type, nsegments * 2);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
const float angle = interpf(angle_start, angle_end, ((float)i / (float)(nsegments - 1)));
|
||||
const float angle = interpf(angle_start, angle_end, (float(i) / float(nsegments - 1)));
|
||||
const float angle_sin = sinf(angle);
|
||||
const float angle_cos = cosf(angle);
|
||||
immVertex3f(pos, x + rad_inner * angle_cos, y + rad_inner * angle_sin, z);
|
||||
@@ -344,7 +344,7 @@ static void imm_draw_circle_3D(GPUPrimType prim_type,
|
||||
/* NOTE(Metal/AMD): For small primitives, line list more efficient than line strip. */
|
||||
immBegin(GPU_PRIM_LINES, nsegments * 2);
|
||||
|
||||
const float angle = (float)(2 * M_PI) / (float)nsegments;
|
||||
const float angle = float(2 * M_PI) / float(nsegments);
|
||||
float xprev = cosf(-angle) * radius_x;
|
||||
float yprev = sinf(-angle) * radius_y;
|
||||
const float alpha = 2.0f * cosf(angle);
|
||||
@@ -372,7 +372,7 @@ static void imm_draw_circle_3D(GPUPrimType prim_type,
|
||||
else {
|
||||
immBegin(prim_type, nsegments);
|
||||
for (int i = 0; i < nsegments; i++) {
|
||||
float angle = (float)(2 * M_PI) * ((float)i / (float)nsegments);
|
||||
float angle = float(2 * M_PI) * (float(i) / float(nsegments));
|
||||
immVertex3f(pos, x + radius_x * cosf(angle), y + radius_y * sinf(angle), 0.0f);
|
||||
}
|
||||
immEnd();
|
||||
@@ -545,20 +545,20 @@ void imm_draw_cylinder_fill_normal_3d(
|
||||
{
|
||||
immBegin(GPU_PRIM_TRIS, 6 * slices * stacks);
|
||||
for (int i = 0; i < slices; i++) {
|
||||
const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices);
|
||||
const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices);
|
||||
const float angle1 = float(2 * M_PI) * (float(i) / float(slices));
|
||||
const float angle2 = float(2 * M_PI) * (float(i + 1) / float(slices));
|
||||
const float cos1 = cosf(angle1);
|
||||
const float sin1 = sinf(angle1);
|
||||
const float cos2 = cosf(angle2);
|
||||
const float sin2 = sinf(angle2);
|
||||
|
||||
for (int j = 0; j < stacks; j++) {
|
||||
float fac1 = (float)j / (float)stacks;
|
||||
float fac2 = (float)(j + 1) / (float)stacks;
|
||||
float fac1 = float(j) / float(stacks);
|
||||
float fac2 = float(j + 1) / float(stacks);
|
||||
float r1 = base * (1.0f - fac1) + top * fac1;
|
||||
float r2 = base * (1.0f - fac2) + top * fac2;
|
||||
float h1 = height * ((float)j / (float)stacks);
|
||||
float h2 = height * ((float)(j + 1) / (float)stacks);
|
||||
float h1 = height * (float(j) / float(stacks));
|
||||
float h2 = height * (float(j + 1) / float(stacks));
|
||||
|
||||
const float v1[3] = {r1 * cos2, r1 * sin2, h1};
|
||||
const float v2[3] = {r2 * cos2, r2 * sin2, h2};
|
||||
@@ -601,20 +601,20 @@ void imm_draw_cylinder_wire_3d(
|
||||
{
|
||||
immBegin(GPU_PRIM_LINES, 6 * slices * stacks);
|
||||
for (int i = 0; i < slices; i++) {
|
||||
const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices);
|
||||
const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices);
|
||||
const float angle1 = float(2 * M_PI) * (float(i) / float(slices));
|
||||
const float angle2 = float(2 * M_PI) * (float(i + 1) / float(slices));
|
||||
const float cos1 = cosf(angle1);
|
||||
const float sin1 = sinf(angle1);
|
||||
const float cos2 = cosf(angle2);
|
||||
const float sin2 = sinf(angle2);
|
||||
|
||||
for (int j = 0; j < stacks; j++) {
|
||||
float fac1 = (float)j / (float)stacks;
|
||||
float fac2 = (float)(j + 1) / (float)stacks;
|
||||
float fac1 = float(j) / float(stacks);
|
||||
float fac2 = float(j + 1) / float(stacks);
|
||||
float r1 = base * (1.0f - fac1) + top * fac1;
|
||||
float r2 = base * (1.0f - fac2) + top * fac2;
|
||||
float h1 = height * ((float)j / (float)stacks);
|
||||
float h2 = height * ((float)(j + 1) / (float)stacks);
|
||||
float h1 = height * (float(j) / float(stacks));
|
||||
float h2 = height * (float(j + 1) / float(stacks));
|
||||
|
||||
const float v1[3] = {r1 * cos2, r1 * sin2, h1};
|
||||
const float v2[3] = {r2 * cos2, r2 * sin2, h2};
|
||||
@@ -639,20 +639,20 @@ void imm_draw_cylinder_fill_3d(
|
||||
{
|
||||
immBegin(GPU_PRIM_TRIS, 6 * slices * stacks);
|
||||
for (int i = 0; i < slices; i++) {
|
||||
const float angle1 = (float)(2 * M_PI) * ((float)i / (float)slices);
|
||||
const float angle2 = (float)(2 * M_PI) * ((float)(i + 1) / (float)slices);
|
||||
const float angle1 = float(2 * M_PI) * (float(i) / float(slices));
|
||||
const float angle2 = float(2 * M_PI) * (float(i + 1) / float(slices));
|
||||
const float cos1 = cosf(angle1);
|
||||
const float sin1 = sinf(angle1);
|
||||
const float cos2 = cosf(angle2);
|
||||
const float sin2 = sinf(angle2);
|
||||
|
||||
for (int j = 0; j < stacks; j++) {
|
||||
float fac1 = (float)j / (float)stacks;
|
||||
float fac2 = (float)(j + 1) / (float)stacks;
|
||||
float fac1 = float(j) / float(stacks);
|
||||
float fac2 = float(j + 1) / float(stacks);
|
||||
float r1 = base * (1.0f - fac1) + top * fac1;
|
||||
float r2 = base * (1.0f - fac2) + top * fac2;
|
||||
float h1 = height * ((float)j / (float)stacks);
|
||||
float h2 = height * ((float)(j + 1) / (float)stacks);
|
||||
float h1 = height * (float(j) / float(stacks));
|
||||
float h2 = height * (float(j + 1) / float(stacks));
|
||||
|
||||
const float v1[3] = {r1 * cos2, r1 * sin2, h1};
|
||||
const float v2[3] = {r2 * cos2, r2 * sin2, h2};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*/
|
||||
static bool initialized = false;
|
||||
|
||||
void GPU_init(void)
|
||||
void GPU_init()
|
||||
{
|
||||
/* can't avoid calling this multiple times, see wm_window_ghostwindow_add */
|
||||
if (initialized) {
|
||||
@@ -38,7 +38,7 @@ void GPU_init(void)
|
||||
gpu_batch_init();
|
||||
}
|
||||
|
||||
void GPU_exit(void)
|
||||
void GPU_exit()
|
||||
{
|
||||
gpu_batch_exit();
|
||||
|
||||
@@ -52,7 +52,7 @@ void GPU_exit(void)
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
bool GPU_is_init(void)
|
||||
bool GPU_is_init()
|
||||
{
|
||||
return initialized;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ GPUTexture **gpu_material_sky_texture_layer_set(
|
||||
}
|
||||
|
||||
int layer = mat->sky_builder->current_layer;
|
||||
*row = (float)layer;
|
||||
*row = float(layer);
|
||||
|
||||
if (*row == MAX_GPU_SKIES) {
|
||||
printf("Too many sky textures in shader!\n");
|
||||
@@ -196,7 +196,7 @@ GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
int layer = mat->coba_builder->current_layer;
|
||||
*row = (float)layer;
|
||||
*row = float(layer);
|
||||
|
||||
if (*row == MAX_COLOR_BAND) {
|
||||
printf("Too many color band in shader! Remove some Curve, Black Body or Color Ramp Node.\n");
|
||||
@@ -385,9 +385,9 @@ BLI_STATIC_ASSERT_ALIGN(GPUSssKernelData, 16)
|
||||
|
||||
static void sss_calculate_offsets(GPUSssKernelData *kd, int count, float exponent)
|
||||
{
|
||||
float step = 2.0f / (float)(count - 1);
|
||||
float step = 2.0f / float(count - 1);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float o = ((float)i) * step - 1.0f;
|
||||
float o = float(i) * step - 1.0f;
|
||||
float sign = (o < 0.0f) ? -1.0f : 1.0f;
|
||||
float ofs = sign * fabsf(powf(o, exponent));
|
||||
kd->kernel[i][3] = ofs;
|
||||
@@ -418,7 +418,7 @@ static float eval_integral(float x0, float x1, float param)
|
||||
float integral = 0.0f;
|
||||
|
||||
for (int i = 0; i < INTEGRAL_RESOLUTION; i++) {
|
||||
float x = x0 + range * ((float)i + 0.5f) / (float)INTEGRAL_RESOLUTION;
|
||||
float x = x0 + range * (float(i) + 0.5f) / float(INTEGRAL_RESOLUTION);
|
||||
float y = eval_profile(x, param);
|
||||
integral += y * step;
|
||||
}
|
||||
@@ -524,7 +524,7 @@ static void compute_sss_translucence_kernel(const GPUSssKernelData *kd,
|
||||
/* Last texel should be black, hence the - 1. */
|
||||
for (int i = 0; i < resolution - 1; i++) {
|
||||
/* Distance from surface. */
|
||||
float d = kd->max_radius * ((float)i + 0.00001f) / ((float)resolution);
|
||||
float d = kd->max_radius * (float(i) + 0.00001f) / float(resolution);
|
||||
|
||||
/* For each distance d we compute the radiance incoming from an hypothetical parallel plane. */
|
||||
/* Compute radius of the footprint on the hypothetical plane. */
|
||||
@@ -633,7 +633,7 @@ GPUUniformBuf *GPU_material_sss_profile_get(GPUMaterial *material,
|
||||
return material->sss_profile;
|
||||
}
|
||||
|
||||
GPUUniformBuf *GPU_material_create_sss_profile_ubo(void)
|
||||
GPUUniformBuf *GPU_material_create_sss_profile_ubo()
|
||||
{
|
||||
return GPU_uniformbuf_create(sizeof(GPUSssKernelData));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* Interface for accessing GPU-related methods for selection. The semantics are
|
||||
* similar to `glRenderMode(GL_SELECT)` from older OpenGL versions.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
@@ -57,7 +57,7 @@ struct GPUSelectState {
|
||||
bool use_cache_needs_init;
|
||||
};
|
||||
|
||||
static GPUSelectState g_select_state = {0};
|
||||
static GPUSelectState g_select_state = {false};
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -158,7 +158,7 @@ bool GPU_select_load_id(uint id)
|
||||
case ALGO_SELECT_NEXT:
|
||||
/* This shouldn't use this pipeline. */
|
||||
BLI_assert_unreachable();
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
case ALGO_GL_QUERY: {
|
||||
return gpu_select_query_load_id(id);
|
||||
@@ -170,7 +170,7 @@ bool GPU_select_load_id(uint id)
|
||||
}
|
||||
}
|
||||
|
||||
uint GPU_select_end(void)
|
||||
uint GPU_select_end()
|
||||
{
|
||||
uint hits = 0;
|
||||
|
||||
@@ -204,7 +204,7 @@ uint GPU_select_end(void)
|
||||
* Currently only used by #ALGO_GL_PICK.
|
||||
* \{ */
|
||||
|
||||
void GPU_select_cache_begin(void)
|
||||
void GPU_select_cache_begin()
|
||||
{
|
||||
BLI_assert(g_select_state.select_is_active == false);
|
||||
/* Ensure #GPU_select_cache_end is always called. */
|
||||
@@ -215,7 +215,7 @@ void GPU_select_cache_begin(void)
|
||||
g_select_state.use_cache_needs_init = true;
|
||||
}
|
||||
|
||||
void GPU_select_cache_load_id(void)
|
||||
void GPU_select_cache_load_id()
|
||||
{
|
||||
BLI_assert(g_select_state.use_cache == true);
|
||||
if (g_select_state.algorithm == ALGO_GL_PICK) {
|
||||
@@ -223,7 +223,7 @@ void GPU_select_cache_load_id(void)
|
||||
}
|
||||
}
|
||||
|
||||
void GPU_select_cache_end(void)
|
||||
void GPU_select_cache_end()
|
||||
{
|
||||
if (g_select_state.algorithm == ALGO_GL_PICK) {
|
||||
BLI_assert(g_select_state.use_cache == true);
|
||||
@@ -234,7 +234,7 @@ void GPU_select_cache_end(void)
|
||||
g_select_state.use_cache_needs_init = false;
|
||||
}
|
||||
|
||||
bool GPU_select_is_cached(void)
|
||||
bool GPU_select_is_cached()
|
||||
{
|
||||
return g_select_state.use_cache && gpu_select_pick_is_cached();
|
||||
}
|
||||
@@ -248,7 +248,7 @@ bool GPU_select_is_cached(void)
|
||||
const GPUSelectResult *GPU_select_buffer_near(const GPUSelectResult *buffer, int hits)
|
||||
{
|
||||
const GPUSelectResult *buffer_near = nullptr;
|
||||
uint depth_min = (uint)-1;
|
||||
uint depth_min = uint(-1);
|
||||
for (int i = 0; i < hits; i++) {
|
||||
if (buffer->depth < depth_min) {
|
||||
BLI_assert(buffer->id != -1);
|
||||
|
||||
@@ -72,10 +72,10 @@ static void rect_subregion_stride_calc(const rcti *src, const rcti *dst, SubRect
|
||||
src->ymax >= dst->ymax);
|
||||
BLI_assert(x >= 0 && y >= 0);
|
||||
|
||||
r_sub->start = (uint)((src_x * y) + x);
|
||||
r_sub->span = (uint)dst_x;
|
||||
r_sub->span_len = (uint)dst_y;
|
||||
r_sub->skip = (uint)(src_x - dst_x);
|
||||
r_sub->start = uint((src_x * y) + x);
|
||||
r_sub->span = uint(dst_x);
|
||||
r_sub->span_len = uint(dst_y);
|
||||
r_sub->skip = uint(src_x - dst_x);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ BLI_INLINE bool depth_is_filled(const depth_t *prev, const depth_t *curr)
|
||||
|
||||
/** Store result of #GPU_framebuffer_read_depth. */
|
||||
struct DepthBufCache {
|
||||
struct DepthBufCache *next, *prev;
|
||||
DepthBufCache *next, *prev;
|
||||
uint id;
|
||||
depth_t buf[0];
|
||||
};
|
||||
@@ -315,7 +315,7 @@ void gpu_select_pick_begin(GPUSelectResult *buffer,
|
||||
ps->buffer_len = buffer_len;
|
||||
ps->mode = mode;
|
||||
|
||||
const uint rect_len = (uint)(BLI_rcti_size_x(input) * BLI_rcti_size_y(input));
|
||||
const uint rect_len = uint(BLI_rcti_size_x(input) * BLI_rcti_size_y(input));
|
||||
ps->dst.clip_rect = *input;
|
||||
ps->dst.rect_len = rect_len;
|
||||
|
||||
@@ -340,8 +340,8 @@ void gpu_select_pick_begin(GPUSelectResult *buffer,
|
||||
ps->src.clip_rect = *input;
|
||||
ps->src.rect_len = rect_len;
|
||||
|
||||
ps->gpu.clip_readpixels[0] = (int)viewport[0];
|
||||
ps->gpu.clip_readpixels[1] = (int)viewport[1];
|
||||
ps->gpu.clip_readpixels[0] = int(viewport[0]);
|
||||
ps->gpu.clip_readpixels[1] = int(viewport[1]);
|
||||
ps->gpu.clip_readpixels[2] = BLI_rcti_size_x(&ps->src.clip_rect);
|
||||
ps->gpu.clip_readpixels[3] = BLI_rcti_size_y(&ps->src.clip_rect);
|
||||
|
||||
@@ -540,7 +540,7 @@ bool gpu_select_pick_load_id(uint id, bool end)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint gpu_select_pick_end(void)
|
||||
uint gpu_select_pick_end()
|
||||
{
|
||||
GPUPickState *ps = &g_pick_state;
|
||||
|
||||
@@ -663,7 +663,7 @@ uint gpu_select_pick_end(void)
|
||||
uint hits = 0;
|
||||
|
||||
if (depth_data_len > maxhits) {
|
||||
hits = (uint)-1;
|
||||
hits = uint(-1);
|
||||
}
|
||||
else {
|
||||
/* Leave sorting up to the caller. */
|
||||
@@ -708,7 +708,7 @@ uint gpu_select_pick_end(void)
|
||||
* Support multiple begin/end's reusing depth buffers.
|
||||
* \{ */
|
||||
|
||||
void gpu_select_pick_cache_begin(void)
|
||||
void gpu_select_pick_cache_begin()
|
||||
{
|
||||
BLI_assert(g_pick_state.use_cache == false);
|
||||
#ifdef DEBUG_PRINT
|
||||
@@ -718,7 +718,7 @@ void gpu_select_pick_cache_begin(void)
|
||||
g_pick_state.is_cached = false;
|
||||
}
|
||||
|
||||
void gpu_select_pick_cache_end(void)
|
||||
void gpu_select_pick_cache_end()
|
||||
{
|
||||
#ifdef DEBUG_PRINT
|
||||
printf("%s: with %d buffers\n", __func__, BLI_listbase_count(&g_pick_state.cache.bufs));
|
||||
@@ -729,12 +729,12 @@ void gpu_select_pick_cache_end(void)
|
||||
BLI_freelistN(&g_pick_state.cache.bufs);
|
||||
}
|
||||
|
||||
bool gpu_select_pick_is_cached(void)
|
||||
bool gpu_select_pick_is_cached()
|
||||
{
|
||||
return g_pick_state.is_cached;
|
||||
}
|
||||
|
||||
void gpu_select_pick_cache_load_id(void)
|
||||
void gpu_select_pick_cache_load_id()
|
||||
{
|
||||
BLI_assert(g_pick_state.is_cached == true);
|
||||
GPUPickState *ps = &g_pick_state;
|
||||
|
||||
@@ -57,7 +57,7 @@ struct GPUViewport {
|
||||
int active_view;
|
||||
|
||||
/* Viewport Resources. */
|
||||
struct DRWData *draw_data;
|
||||
DRWData *draw_data;
|
||||
/** Color buffers, one for each stereo view. Only one if not stereo viewport. */
|
||||
GPUTexture *color_render_tx[2];
|
||||
GPUTexture *color_overlay_tx[2];
|
||||
@@ -76,7 +76,7 @@ struct GPUViewport {
|
||||
/* TODO(@fclem): the UV-image display use the viewport but do not set any view transform for the
|
||||
* moment. The end goal would be to let the GPUViewport do the color management. */
|
||||
bool do_color_management;
|
||||
struct GPUViewportBatch batch;
|
||||
GPUViewportBatch batch;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -96,7 +96,7 @@ bool GPU_viewport_do_update(GPUViewport *viewport)
|
||||
return ret;
|
||||
}
|
||||
|
||||
GPUViewport *GPU_viewport_create(void)
|
||||
GPUViewport *GPU_viewport_create()
|
||||
{
|
||||
GPUViewport *viewport = static_cast<GPUViewport *>(
|
||||
MEM_callocN(sizeof(GPUViewport), "GPUViewport"));
|
||||
@@ -106,14 +106,14 @@ GPUViewport *GPU_viewport_create(void)
|
||||
return viewport;
|
||||
}
|
||||
|
||||
GPUViewport *GPU_viewport_stereo_create(void)
|
||||
GPUViewport *GPU_viewport_stereo_create()
|
||||
{
|
||||
GPUViewport *viewport = GPU_viewport_create();
|
||||
viewport->flag = GPU_VIEWPORT_STEREO;
|
||||
return viewport;
|
||||
}
|
||||
|
||||
struct DRWData **GPU_viewport_data_get(GPUViewport *viewport)
|
||||
DRWData **GPU_viewport_data_get(GPUViewport *viewport)
|
||||
{
|
||||
return &viewport->draw_data;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo
|
||||
/** \name Viewport Batches
|
||||
* \{ */
|
||||
|
||||
static GPUVertFormat *gpu_viewport_batch_format(void)
|
||||
static GPUVertFormat *gpu_viewport_batch_format()
|
||||
{
|
||||
if (g_viewport.format.attr_len == 0) {
|
||||
GPUVertFormat *format = &g_viewport.format;
|
||||
@@ -492,8 +492,8 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport,
|
||||
return;
|
||||
}
|
||||
|
||||
const float w = (float)GPU_texture_width(color);
|
||||
const float h = (float)GPU_texture_height(color);
|
||||
const float w = float(GPU_texture_width(color));
|
||||
const float h = float(GPU_texture_height(color));
|
||||
|
||||
/* We allow rects with min/max swapped, but we also need correctly assigned coordinates. */
|
||||
rcti sanitized_rect = *rect;
|
||||
|
||||
@@ -131,20 +131,20 @@ static bool fcc_is_data(int fcc)
|
||||
fccs[3] = fcc >> 24;
|
||||
|
||||
if (!isdigit(fccs[0]) || !isdigit(fccs[1]) || !ELEM(fccs[2], 'd', 'w')) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
if (!ELEM(fccs[3], 'b', 'c')) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
AviError AVI_print_error(AviError in_error)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((int)in_error < 0) {
|
||||
if (int(in_error) < 0) {
|
||||
error = -in_error;
|
||||
}
|
||||
else {
|
||||
@@ -200,12 +200,12 @@ bool AVI_is_avi(const char *filepath)
|
||||
movie.offset_table = nullptr;
|
||||
|
||||
if (movie.fp == nullptr) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GET_FCC(movie.fp) != FCC("RIFF") || !(movie.size = GET_FCC(movie.fp))) {
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
movie.header = &header;
|
||||
@@ -216,7 +216,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
{
|
||||
DEBUG_PRINT("bad initial header info\n");
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
movie.header->MicroSecPerFrame = GET_FCC(movie.fp);
|
||||
@@ -241,7 +241,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
if (movie.header->Streams < 1 || movie.header->Streams > 65536) {
|
||||
DEBUG_PRINT("Number of streams should be in range 1-65536\n");
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
movie.streams = (AviStreamRec *)MEM_calloc_arrayN(
|
||||
@@ -258,7 +258,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
|
||||
MEM_freeN(movie.streams);
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
movie.streams[temp].sh.Type = GET_FCC(movie.fp);
|
||||
@@ -278,7 +278,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
else {
|
||||
MEM_freeN(movie.streams);
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
movie_tracks++;
|
||||
}
|
||||
@@ -305,7 +305,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
DEBUG_PRINT("no stream format information\n");
|
||||
MEM_freeN(movie.streams);
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
movie.streams[temp].sf_size = GET_FCC(movie.fp);
|
||||
@@ -345,7 +345,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
else {
|
||||
MEM_freeN(movie.streams);
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ bool AVI_is_avi(const char *filepath)
|
||||
|
||||
MEM_freeN(movie.streams);
|
||||
fclose(movie.fp);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
BLI_fseek(movie.fp, temp, SEEK_CUR);
|
||||
}
|
||||
@@ -552,7 +552,7 @@ AviError AVI_open_movie(const char *filepath, AviMovie *movie)
|
||||
BLI_fseek(movie->fp, -4L, SEEK_CUR);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
temp = GET_FCC(movie->fp);
|
||||
size = GET_FCC(movie->fp);
|
||||
|
||||
@@ -859,7 +859,7 @@ AviError AVI_open_compress(char *filepath, AviMovie *movie, int streams, ...)
|
||||
|
||||
if (junk_pos < 2024 - 8) {
|
||||
chunk.fcc = FCC("JUNK");
|
||||
chunk.size = 2024 - 8 - (int)junk_pos;
|
||||
chunk.size = 2024 - 8 - int(junk_pos);
|
||||
|
||||
awrite(movie, &chunk, 1, sizeof(AviChunk), movie->fp, AVI_CHUNK);
|
||||
|
||||
@@ -953,8 +953,8 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...)
|
||||
|
||||
movie->entries[frame_num * (movie->header->Streams + 1) + stream + 1].ChunkId = chunk.fcc;
|
||||
movie->entries[frame_num * (movie->header->Streams + 1) + stream + 1].Flags = AVIIF_KEYFRAME;
|
||||
movie->entries[frame_num * (movie->header->Streams + 1) + stream + 1].Offset =
|
||||
(int)(BLI_ftell(movie->fp) - 12L - movie->movi_offset);
|
||||
movie->entries[frame_num * (movie->header->Streams + 1) + stream + 1].Offset = int(
|
||||
BLI_ftell(movie->fp) - 12L - movie->movi_offset);
|
||||
movie->entries[frame_num * (movie->header->Streams + 1) + stream + 1].Size = chunk.size;
|
||||
|
||||
/* Write the chunk */
|
||||
@@ -978,10 +978,10 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...)
|
||||
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].ChunkId = FCC("rec ");
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].Flags = AVIIF_LIST;
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].Offset = (int)(rec_off - 8L -
|
||||
movie->movi_offset);
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].Size = (int)(BLI_ftell(movie->fp) -
|
||||
(rec_off + 4L));
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].Offset = int(rec_off - 8L -
|
||||
movie->movi_offset);
|
||||
movie->entries[frame_num * (movie->header->Streams + 1)].Size = int(BLI_ftell(movie->fp) -
|
||||
(rec_off + 4L));
|
||||
|
||||
/* Update the record size */
|
||||
BLI_fseek(movie->fp, rec_off, SEEK_SET);
|
||||
@@ -1005,7 +1005,7 @@ AviError AVI_close_compress(AviMovie *movie)
|
||||
}
|
||||
|
||||
BLI_fseek(movie->fp, 0L, SEEK_END);
|
||||
movi_size = (int)BLI_ftell(movie->fp);
|
||||
movi_size = int(BLI_ftell(movie->fp));
|
||||
|
||||
PUT_FCC("idx1", movie->fp);
|
||||
PUT_FCCN((movie->index_entries * (movie->header->Streams + 1) * 16), movie->fp);
|
||||
@@ -1014,7 +1014,7 @@ AviError AVI_close_compress(AviMovie *movie)
|
||||
awrite(movie, &movie->entries[temp], 1, sizeof(AviIndexEntry), movie->fp, AVI_INDEXE);
|
||||
}
|
||||
|
||||
temp = (int)BLI_ftell(movie->fp);
|
||||
temp = int(BLI_ftell(movie->fp));
|
||||
|
||||
BLI_fseek(movie->fp, AVI_RIFF_SOFF, SEEK_SET);
|
||||
|
||||
|
||||
@@ -38,28 +38,26 @@ void *avi_format_convert(
|
||||
case AVI_FORMAT_RGB24:
|
||||
switch (from) {
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
buffer = avi_converter_from_avi_rgb(
|
||||
movie, stream, static_cast<unsigned char *>(buffer), size);
|
||||
buffer = avi_converter_from_avi_rgb(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
buffer = avi_converter_from_mjpeg(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
case AVI_FORMAT_RGB32:
|
||||
buffer = avi_converter_from_rgb32(
|
||||
movie, stream, static_cast<unsigned char *>(buffer), size);
|
||||
buffer = avi_converter_from_rgb32(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case AVI_FORMAT_AVI_RGB:
|
||||
buffer = avi_converter_to_avi_rgb(movie, stream, static_cast<unsigned char *>(buffer), size);
|
||||
buffer = avi_converter_to_avi_rgb(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
case AVI_FORMAT_MJPEG:
|
||||
buffer = avi_converter_to_mjpeg(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
case AVI_FORMAT_RGB32:
|
||||
buffer = avi_converter_to_rgb32(movie, stream, static_cast<unsigned char *>(buffer), size);
|
||||
buffer = avi_converter_to_rgb32(movie, stream, static_cast<uchar *>(buffer), size);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -216,8 +216,8 @@ static void std_huff_tables(j_decompress_ptr dinfo)
|
||||
|
||||
static int Decode_JPEG(uchar *inBuffer, uchar *outBuffer, uint width, uint height, size_t bufsize)
|
||||
{
|
||||
struct jpeg_decompress_struct dinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
jpeg_decompress_struct dinfo;
|
||||
jpeg_error_mgr jerr;
|
||||
|
||||
(void)width; /* unused */
|
||||
|
||||
@@ -270,8 +270,8 @@ static int Decode_JPEG(uchar *inBuffer, uchar *outBuffer, uint width, uint heigh
|
||||
static void Compress_JPEG(
|
||||
int quality, uchar *outbuffer, const uchar *inBuffer, int width, int height, size_t bufsize)
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
jpeg_compress_struct cinfo;
|
||||
jpeg_error_mgr jerr;
|
||||
uchar marker[60];
|
||||
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
@@ -443,8 +443,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, uchar *buffer, size_t
|
||||
numbytes = 0;
|
||||
Compress_JPEG(movie->streams[stream].sh.Quality / 100,
|
||||
buf + *size,
|
||||
buffer +
|
||||
(size_t)(movie->header->Height / 2) * (size_t)movie->header->Width * 3,
|
||||
buffer + size_t(movie->header->Height / 2) * size_t(movie->header->Width) * 3,
|
||||
movie->header->Width,
|
||||
movie->header->Height / 2,
|
||||
bufsize / 2);
|
||||
|
||||
@@ -98,7 +98,7 @@ AviError AVI_set_compress_option(
|
||||
break;
|
||||
|
||||
case AVI_OPTION_FRAMERATE:
|
||||
useconds = (int)(1000000 / *((double *)opt_data));
|
||||
useconds = int(1000000 / *((double *)opt_data));
|
||||
if (useconds) {
|
||||
movie->header->MicroSecPerFrame = useconds;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, uchar *buffer, con
|
||||
movie->header->Width * 3);
|
||||
}
|
||||
|
||||
for (size_t y = 0; y < (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
|
||||
for (size_t y = 0; y < size_t(movie->header->Height) * size_t(movie->header->Width) * 3;
|
||||
y += 3) {
|
||||
int i = buf[y];
|
||||
buf[y] = buf[y + 2];
|
||||
|
||||
@@ -24,7 +24,7 @@ void *avi_converter_from_rgb32(AviMovie *movie, int stream, uchar *buffer, size_
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
*size = (size_t)movie->header->Height * (size_t)movie->header->Width * 3;
|
||||
*size = size_t(movie->header->Height) * size_t(movie->header->Width) * 3;
|
||||
buf = static_cast<uchar *>(imb_alloc_pixels(
|
||||
movie->header->Height, movie->header->Width, 3, sizeof(uchar), "fromrgb32buf"));
|
||||
if (!buf) {
|
||||
@@ -54,7 +54,7 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t
|
||||
|
||||
(void)stream; /* unused */
|
||||
|
||||
*size = (size_t)movie->header->Height * (size_t)movie->header->Width * 4;
|
||||
*size = size_t(movie->header->Height) * size_t(movie->header->Width) * 4;
|
||||
buf = static_cast<uchar *>(imb_alloc_pixels(
|
||||
movie->header->Height, movie->header->Width, 4, sizeof(uchar), "torgb32buf"));
|
||||
if (!buf) {
|
||||
@@ -65,7 +65,7 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, uchar *buffer, size_t
|
||||
|
||||
to = buf;
|
||||
from = buffer;
|
||||
size_t i = (size_t)movie->header->Height * (size_t)movie->header->Width;
|
||||
size_t i = size_t(movie->header->Height) * size_t(movie->header->Width);
|
||||
|
||||
while (i--) {
|
||||
memcpy(to, from, 3);
|
||||
|
||||
@@ -537,7 +537,7 @@ void USDMeshReader::read_color_data_primvar(Mesh *mesh,
|
||||
}
|
||||
else {
|
||||
/* Check for situations that allow for a straight-forward copy by index. */
|
||||
if ((ELEM(interp, pxr::UsdGeomTokens->vertex)) ||
|
||||
if (ELEM(interp, pxr::UsdGeomTokens->vertex) ||
|
||||
(color_domain == ATTR_DOMAIN_CORNER && !is_left_handed_))
|
||||
{
|
||||
for (int i = 0; i < usd_colors.size(); i++) {
|
||||
|
||||
@@ -1234,7 +1234,7 @@ static int imagewraposa_aniso(Tex *tex,
|
||||
b *= ff;
|
||||
}
|
||||
maxd = max_ff(b, 1e-8f);
|
||||
levf = (float(M_LOG2E)) * logf(maxd);
|
||||
levf = float(M_LOG2E) * logf(maxd);
|
||||
|
||||
curmap = 0;
|
||||
maxlev = 1;
|
||||
|
||||
@@ -589,7 +589,7 @@ static int texnoise(const Tex *tex, TexResult *texres, int thread)
|
||||
div *= 3.0f;
|
||||
}
|
||||
|
||||
texres->tin = (float(val)) / div;
|
||||
texres->tin = float(val) / div;
|
||||
|
||||
BRICONT;
|
||||
return TEX_INT;
|
||||
|
||||
@@ -183,7 +183,7 @@ static void seq_cache_unlock(Scene *scene)
|
||||
|
||||
static size_t seq_cache_get_mem_total()
|
||||
{
|
||||
return (size_t(U.memcachelimit)) * 1024 * 1024;
|
||||
return size_t(U.memcachelimit) * 1024 * 1024;
|
||||
}
|
||||
|
||||
static void seq_cache_keyfree(void *val)
|
||||
|
||||
@@ -2681,7 +2681,7 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
|
||||
&use_secondary_ptr,
|
||||
&use_secondary_prop,
|
||||
0,
|
||||
RCPropFlags((RC_PROP_ALLOW_MISSING | RC_PROP_REQUIRE_BOOL))))
|
||||
RCPropFlags(RC_PROP_ALLOW_MISSING | RC_PROP_REQUIRE_BOOL)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user