Cleanup: style
This commit is contained in:
@@ -120,7 +120,7 @@ static void studiolight_free(struct StudioLight *sl)
|
||||
STUDIOLIGHT_DELETE_ICON(sl->icon_id_matcap_flipped);
|
||||
#undef STUDIOLIGHT_DELETE_ICON
|
||||
|
||||
for (int index = 0 ; index < 6 ; index ++) {
|
||||
for (int index = 0; index < 6; index++) {
|
||||
IMB_SAFE_FREE(sl->radiance_cubemap_buffers[index]);
|
||||
}
|
||||
GPU_TEXTURE_SAFE_FREE(sl->equirectangular_radiance_gputexture);
|
||||
@@ -152,7 +152,7 @@ static struct StudioLight *studiolight_create(int flag)
|
||||
sl->icon_id_irradiance = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE);
|
||||
}
|
||||
|
||||
for (int index = 0 ; index < 6 ; index ++) {
|
||||
for (int index = 0; index < 6; index++) {
|
||||
sl->radiance_cubemap_buffers[index] = NULL;
|
||||
}
|
||||
|
||||
@@ -193,9 +193,9 @@ static void studiolight_calculate_radiance_buffer(
|
||||
float xf;
|
||||
float *color = colbuf;
|
||||
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++, yf += add_y) {
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++, yf += add_y) {
|
||||
xf = start_x;
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++, xf += add_x) {
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++, xf += add_x) {
|
||||
direction[index_x] = xf;
|
||||
direction[index_y] = yf;
|
||||
direction[index_z] = z;
|
||||
@@ -234,7 +234,7 @@ static void studiolight_create_equirectangular_radiance_gputexture(StudioLight *
|
||||
|
||||
float *offset4 = ibuf->rect_float;
|
||||
float *offset3 = sl->gpu_matcap_3components;
|
||||
for (int i = 0 ; i < ibuf->x * ibuf->y; i++) {
|
||||
for (int i = 0; i < ibuf->x * ibuf->y; i++) {
|
||||
copy_v3_v3(offset3, offset4);
|
||||
offset3 += 3;
|
||||
offset4 += 4;
|
||||
@@ -336,8 +336,8 @@ BLI_INLINE void studiolight_evaluate_radiance_buffer(
|
||||
float angle;
|
||||
float *radiance_color = radiance_buffer->rect_float;
|
||||
float direction[3];
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++) {
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++) {
|
||||
// calculate light direction;
|
||||
direction[zoffset] = zvalue;
|
||||
direction[xoffset] = (x / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f;
|
||||
@@ -345,7 +345,7 @@ BLI_INLINE void studiolight_evaluate_radiance_buffer(
|
||||
normalize_v3(direction);
|
||||
angle = fmax(0.0f, dot_v3v3(direction, normal));
|
||||
madd_v3_v3fl(color, radiance_color, angle);
|
||||
(*hits) ++;
|
||||
(*hits)++;
|
||||
radiance_color += 4;
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,7 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s
|
||||
}
|
||||
case 11:
|
||||
{
|
||||
coef = (0.9461746957575601f * nz * nx * (-1.0f +7.0f*ny2)) / -24.0f;
|
||||
coef = (0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2)) / -24.0f;
|
||||
break;
|
||||
}
|
||||
case 12:
|
||||
@@ -514,7 +514,7 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
coef = ((105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f) / -24.0f;
|
||||
coef = ((105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f) / -24.0f;
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
@@ -621,7 +621,7 @@ static void studiolight_apply_spherical_harmonics_windowing(StudioLight *sl, flo
|
||||
|
||||
/* Apply windowing lambda */
|
||||
index = 0;
|
||||
for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++) {
|
||||
for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) {
|
||||
float s = 1.0f / (1.0f + lambda * SQUARE(level) * SQUARE(level + 1.0f));
|
||||
|
||||
for (int m = -1; m <= level; m++) {
|
||||
@@ -666,9 +666,9 @@ BLI_INLINE void studiolight_sample_spherical_harmonics(StudioLight *sl, float co
|
||||
const float nz4 = SQUARE(nz2);
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[9], 2.5033429417967046f * nx * nz * (nx2 - nz2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[10], -1.7701307697799304f * nz * ny * (3.0f * nx2 - nz2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[11], 0.9461746957575601f * nz * nx * (-1.0f + 7.0f*ny2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[11], 0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[12], -0.6690465435572892f * nz * ny * (-3.0f + 7.0f * ny2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[13], (105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f);
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[13], (105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f);
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[14], -0.6690465435572892f * nx * ny * (-3.0f + 7.0f * ny2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[15], 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2));
|
||||
madd_v3_v3fl(color, sl->spherical_harmonics_coefs[16], -1.7701307697799304f * nx * ny * (nx2 - 3.0f * nz2));
|
||||
@@ -683,7 +683,7 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl)
|
||||
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
|
||||
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED);
|
||||
|
||||
for (int comp = 0; comp < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; comp ++) {
|
||||
for (int comp = 0; comp < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; comp++) {
|
||||
studiolight_calculate_spherical_harmonics_coefficient(sl, comp);
|
||||
}
|
||||
|
||||
@@ -705,8 +705,8 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl)
|
||||
static float texel_coord_solid_angle(float a_U, float a_V, int a_Size)
|
||||
{
|
||||
//scale up to [-1, 1] range (inclusive), offset by 0.5 to point to texel center.
|
||||
float u = (2.0f * ((float)a_U + 0.5f) / (float)a_Size ) - 1.0f;
|
||||
float v = (2.0f * ((float)a_V + 0.5f) / (float)a_Size ) - 1.0f;
|
||||
float u = (2.0f * ((float)a_U + 0.5f) / (float)a_Size) - 1.0f;
|
||||
float v = (2.0f * ((float)a_V + 0.5f) / (float)a_Size) - 1.0f;
|
||||
|
||||
float resolution_inv = 1.0f / a_Size;
|
||||
|
||||
@@ -729,8 +729,8 @@ BLI_INLINE void studiolight_evaluate_specular_radiance_buffer(
|
||||
float angle;
|
||||
float *radiance_color = radiance_buffer->rect_float;
|
||||
float direction[3];
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y ++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x ++) {
|
||||
for (int y = 0; y < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; y++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE; x++) {
|
||||
// calculate light direction;
|
||||
float u = (x / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f;
|
||||
float v = (y / (float)STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE) - 0.5f;
|
||||
@@ -823,10 +823,10 @@ static void studiolight_calculate_irradiance_equirectangular_image(StudioLight *
|
||||
|
||||
float *colbuf = MEM_mallocN(STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH * STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * sizeof(float[4]), __func__);
|
||||
float *color = colbuf;
|
||||
for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT ; y ++) {
|
||||
for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y++) {
|
||||
float yf = y / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT;
|
||||
|
||||
for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH ; x ++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x++) {
|
||||
float xf = x / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH;
|
||||
float dir[3];
|
||||
equirectangular_to_direction(dir, xf, yf);
|
||||
@@ -875,8 +875,8 @@ static void studiolight_calculate_light_direction(StudioLight *sl)
|
||||
/* go over every pixel, determine light, if higher calc direction off the light */
|
||||
float new_light;
|
||||
float *color = ibuf->rect_float;
|
||||
for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y ++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x ++) {
|
||||
for (int y = 0; y < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT; y++) {
|
||||
for (int x = 0; x < STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH; x++) {
|
||||
new_light = color[0] + color[1] + color[2];
|
||||
if (new_light > best_light) {
|
||||
float u = x / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH;
|
||||
|
||||
@@ -70,7 +70,7 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
||||
}
|
||||
if (flag != 0) {
|
||||
DEG_graph_id_tag_update(bmain,
|
||||
(::Depsgraph*)graph,
|
||||
(::Depsgraph *)graph,
|
||||
id_node->id_orig,
|
||||
flag);
|
||||
}
|
||||
|
||||
@@ -67,8 +67,7 @@ void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx)
|
||||
* the workbench_taa_draw_screen_end will fill the history buffer
|
||||
* for the other iterations.
|
||||
*/
|
||||
if (effect_info->jitter_index == 1)
|
||||
{
|
||||
if (effect_info->jitter_index == 1) {
|
||||
GPU_framebuffer_bind(dfbl->color_only_fb);
|
||||
DRW_transform_to_display(tx);
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata)
|
||||
{
|
||||
result = 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
result = 32;
|
||||
}
|
||||
}
|
||||
@@ -288,11 +287,9 @@ void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata)
|
||||
void workbench_taa_view_updated(WORKBENCH_Data *vedata)
|
||||
{
|
||||
WORKBENCH_StorageList *stl = vedata->stl;
|
||||
if (stl)
|
||||
{
|
||||
if (stl) {
|
||||
WORKBENCH_EffectInfo *effect_info = stl->effects;
|
||||
if (effect_info)
|
||||
{
|
||||
if (effect_info) {
|
||||
effect_info->view_updated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,14 +176,15 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
|
||||
material->shgrp = grp;
|
||||
|
||||
/* Depth */
|
||||
if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR)
|
||||
{
|
||||
material->shgrp_object_outline = DRW_shgroup_create(e_data.object_outline_texture_sh, psl->object_outline_pass);
|
||||
if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR) {
|
||||
material->shgrp_object_outline = DRW_shgroup_create(
|
||||
e_data.object_outline_texture_sh, psl->object_outline_pass);
|
||||
GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
|
||||
DRW_shgroup_uniform_texture(material->shgrp_object_outline, "image", tex);
|
||||
}
|
||||
else {
|
||||
material->shgrp_object_outline = DRW_shgroup_create(e_data.object_outline_sh, psl->object_outline_pass);
|
||||
material->shgrp_object_outline = DRW_shgroup_create(
|
||||
e_data.object_outline_sh, psl->object_outline_pass);
|
||||
}
|
||||
material->object_id = engine_object_data->object_id;
|
||||
DRW_shgroup_uniform_int(material->shgrp_object_outline, "object_id", &material->object_id, 1);
|
||||
|
||||
@@ -129,8 +129,7 @@ uint workbench_material_get_hash(WORKBENCH_MaterialData *material_template)
|
||||
result += BLI_ghashutil_uinthash_v4_murmur(input);
|
||||
|
||||
/* add texture reference */
|
||||
if (material_template->ima)
|
||||
{
|
||||
if (material_template->ima) {
|
||||
result += BLI_ghashutil_inthash_p_murmur(material_template->ima);
|
||||
}
|
||||
|
||||
@@ -182,10 +181,10 @@ int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *i
|
||||
return color_type;
|
||||
}
|
||||
|
||||
void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material)
|
||||
void workbench_material_shgroup_uniform(
|
||||
WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material)
|
||||
{
|
||||
if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR)
|
||||
{
|
||||
if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR) {
|
||||
GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
|
||||
DRW_shgroup_uniform_texture(grp, "image", tex);
|
||||
}
|
||||
|
||||
@@ -1444,7 +1444,7 @@ static void icon_draw_size(
|
||||
di->data.texture.w, di->data.texture.h, alpha, rgb);
|
||||
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else if (di->type== ICON_TYPE_MONO_TEXTURE) {
|
||||
else if (di->type == ICON_TYPE_MONO_TEXTURE) {
|
||||
/* icon that matches text color, assumed to be white */
|
||||
float text_color[4];
|
||||
UI_GetThemeColor4fv(TH_TEXT, text_color);
|
||||
|
||||
@@ -3528,7 +3528,7 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush, Unified
|
||||
}
|
||||
|
||||
if ((sd->flags & SCULPT_DYNTOPO_COLLAPSE) ||
|
||||
(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY))
|
||||
(brush->sculpt_tool == SCULPT_TOOL_SIMPLIFY))
|
||||
{
|
||||
mode |= PBVH_Collapse;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/** \file blender/makesrna/intern/rna_light.c
|
||||
/** \file blender/makesrna/intern/rna_lamp.c
|
||||
* \ingroup RNA
|
||||
*/
|
||||
|
||||
|
||||
@@ -243,11 +243,11 @@ bNode *ntreeShaderOutputNode(bNodeTree *ntree, int target)
|
||||
if (output_node == NULL) {
|
||||
output_node = node;
|
||||
}
|
||||
else if(output_node->custom1 == SHD_OUTPUT_ALL) {
|
||||
else if (output_node->custom1 == SHD_OUTPUT_ALL) {
|
||||
output_node = node;
|
||||
}
|
||||
else if ((node->flag & NODE_DO_OUTPUT) &&
|
||||
!(output_node->flag & NODE_DO_OUTPUT))
|
||||
!(output_node->flag & NODE_DO_OUTPUT))
|
||||
{
|
||||
output_node = node;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user