From d718d6b4493429a1e688e874fd76963f98e3d034 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 31 Aug 2021 13:36:28 +1000 Subject: Cleanup: Use C style comments for descriptive text --- source/blender/blenkernel/intern/armature_test.cc | 6 +- source/blender/blenkernel/intern/dynamicpaint.c | 16 ++--- source/blender/blenkernel/intern/effect.c | 4 +- source/blender/blenkernel/intern/fluid.c | 10 +-- source/blender/blenkernel/intern/fmodifier.c | 2 +- source/blender/blenkernel/intern/freestyle.c | 2 +- source/blender/blenkernel/intern/pbvh_bmesh.c | 2 +- source/blender/blenkernel/intern/text.c | 6 +- source/blender/blenlib/intern/winstuff_dir.c | 4 +- .../blender/blenlib/tests/BLI_delaunay_2d_test.cc | 2 +- source/blender/blenloader/intern/readblenentry.c | 2 +- source/blender/compositor/COM_defines.h | 10 +-- .../compositor/intern/COM_ExecutionGroup.cc | 9 +-- source/blender/compositor/nodes/COM_GlareNode.cc | 6 +- .../compositor/nodes/COM_KeyingScreenNode.cc | 2 +- .../blender/compositor/nodes/COM_ViewLevelsNode.cc | 2 +- .../blender/compositor/nodes/COM_ZCombineNode.cc | 9 +-- .../operations/COM_BilateralBlurOperation.cc | 12 ++-- .../operations/COM_ColorCorrectionOperation.cc | 2 +- .../COM_ConvertDepthToRadiusOperation.cc | 10 +-- .../operations/COM_GlareStreaksOperation.cc | 14 ++-- .../compositor/operations/COM_ScaleOperation.cc | 8 +-- .../COM_ScreenLensDistortionOperation.cc | 2 +- .../COM_VariableSizeBokehBlurOperation.cc | 76 +++++++++++----------- .../blender/io/usd/intern/usd_reader_material.cc | 2 +- source/blender/modifiers/intern/MOD_collision.c | 8 +-- .../nodes/node_composite_doubleEdgeMask.c | 2 +- source/blender/render/intern/multires_bake.c | 2 +- 28 files changed, 119 insertions(+), 113 deletions(-) diff --git a/source/blender/blenkernel/intern/armature_test.cc b/source/blender/blenkernel/intern/armature_test.cc index 99eb064d061..2994563175f 100644 --- a/source/blender/blenkernel/intern/armature_test.cc +++ b/source/blender/blenkernel/intern/armature_test.cc @@ -176,9 +176,9 @@ class BKE_armature_find_selected_bones_test : public testing::Test { bone2.childbase = {nullptr, nullptr}; bone3.childbase = {nullptr, nullptr}; - BLI_addtail(&arm.bonebase, &bone1); // bone1 is root bone - BLI_addtail(&arm.bonebase, &bone2); // bone2 is root bone - BLI_addtail(&bone2.childbase, &bone3); // bone3 has bone2 as parent + BLI_addtail(&arm.bonebase, &bone1); /* bone1 is root bone. */ + BLI_addtail(&arm.bonebase, &bone2); /* bone2 is root bone. */ + BLI_addtail(&bone2.childbase, &bone3); /* bone3 has bone2 as parent. */ /* Make sure the armature & its bones are visible, to make them selectable. */ arm.layer = bone1.layer = bone2.layer = bone3.layer = 1; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 8f94c407cae..0dc4f64cec1 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3978,7 +3978,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( total_sample = gaussianTotal; } - /* Supersampling */ + /* Super-sampling */ for (ss = 0; ss < samples; ss++) { float ray_start[3], ray_dir[3]; float sample_factor = 0.0f; @@ -3999,7 +3999,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( float hitCoord[3]; int hitTri = -1; - /* Supersampling factor */ + /* Super-sampling factor. */ if (samples > 1 && surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { sample_factor = gaussianFactors[ss]; } @@ -4240,25 +4240,25 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( numOfHits++; } - /* apply sample strength */ + /* Apply sample strength. */ brushStrength += sampleStrength; - } // end supersampling + } /* End super-sampling. */ - /* if any sample was inside paint range */ + /* If any sample was inside paint range. */ if (brushStrength > 0.0f || depth > 0.0f) { - /* apply supersampling results */ + /* Apply super-sampling results. */ if (samples > 1) { brushStrength /= total_sample; } CLAMP(brushStrength, 0.0f, 1.0f); if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) { - /* Get final pixel color and alpha */ + /* Get final pixel color and alpha. */ paintColor[0] /= numOfHits; paintColor[1] /= numOfHits; paintColor[2] /= numOfHits; } - /* get final object space depth */ + /* Get final object space depth. */ else if (ELEM(surface->type, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WAVE)) { depth /= bData->bNormal[index].normal_scale * total_sample; } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 334118ddf3f..a88339082fe 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -481,7 +481,9 @@ static void eff_tri_ray_hit(void *UNUSED(userData), hit->index = 1; } -// get visibility of a wind ray +/** + * Get visibility of a wind ray. + */ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, EffectorData *efd, diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 87c1f99fd73..5a5e1208ff0 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1580,7 +1580,7 @@ static void emit_from_particles(Object *flow_ob, /* initialize particle cache */ if (psys->part->type == PART_HAIR) { - // TODO: PART_HAIR not supported whatsoever + /* TODO: PART_HAIR not supported whatsoever. */ totchild = 0; } else { @@ -1674,9 +1674,9 @@ static void emit_from_particles(Object *flow_ob, if (ffs->flags & FLUID_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO)) { madd_v3_v3fl(&bb->velocity[index * 3], &particle_vel[p * 3], ffs->vel_multi); } - } // particles loop + } /* particles loop */ } - else if (valid_particles > 0) { // FLUID_FLOW_USE_PART_SIZE + else if (valid_particles > 0) { /* #FLUID_FLOW_USE_PART_SIZE */ int min[3], max[3], res[3]; /* setup loop bounds */ @@ -3171,7 +3171,7 @@ static void update_effectors_task_cb(void *__restrict userdata, if ((data->fuel && MAX2(data->density[index], data->fuel[index]) < FLT_EPSILON) || (data->density && data->density[index] < FLT_EPSILON) || (data->phi_obs_in && data->phi_obs_in[index] < 0.0f) || - data->flags[index] & 2) // mantaflow convention: 2 == FlagObstacle + data->flags[index] & 2) /* Manta-flow convention: `2 == FlagObstacle`. */ { continue; } @@ -4253,7 +4253,7 @@ static float calc_voxel_transp( { const size_t index = manta_get_index(pixel[0], res[0], pixel[1], res[1], pixel[2]); - // T_ray *= T_vox + /* `T_ray *= T_vox`. */ *t_ray *= expf(input[index] * correct); if (result[index] < 0.0f) { diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 641c003d456..5aa3815729f 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -580,7 +580,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], if (loopbreaker == (maxloop - 1)) { CLOG_ERROR(&LOG, "binary search was taking too long"); - // include debug info + /* Include debug info. */ CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index aa3b4f1ef5e..d9b3faf8623 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -34,7 +34,7 @@ #include "BKE_lib_id.h" #include "BKE_linestyle.h" -// function declarations +/* Function declarations. */ static FreestyleLineSet *alloc_lineset(void); static void copy_lineset(FreestyleLineSet *new_lineset, FreestyleLineSet *lineset, const int flag); static FreestyleModuleConfig *alloc_module(void); diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 93cffcf7164..c30f94a4cf6 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -914,7 +914,7 @@ static void long_edge_queue_edge_add_recursive( for (int i = 0; i < ARRAY_SIZE(l_adjacent); i++) { float len_sq_other = BM_edge_calc_length_squared(l_adjacent[i]->e); if (len_sq_other > max_ff(len_sq_cmp, limit_len_sq)) { - // edge_queue_insert(eq_ctx, l_adjacent[i]->e, -len_sq_other); + // edge_queue_insert(eq_ctx, l_adjacent[i]->e, -len_sq_other); long_edge_queue_edge_add_recursive( eq_ctx, l_adjacent[i]->radial_next, l_adjacent[i], len_sq_other, limit_len); } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 6b7b3213a83..f67bf68010d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -342,9 +342,9 @@ int txt_extended_ascii_as_utf8(char **str) return added; } -// this function removes any control characters from -// a textline and fixes invalid utf-8 sequences - +/** + * Removes any control characters from a text-line and fixes invalid UTF8 sequences. + */ static void cleanup_textline(TextLine *tl) { int i; diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c index 2dc41bfc54c..6f99ea075bb 100644 --- a/source/blender/blenlib/intern/winstuff_dir.c +++ b/source/blender/blenlib/intern/winstuff_dir.c @@ -24,7 +24,7 @@ #ifdef WIN32 -/* standalone for inclusion in binaries other than blender */ +/* Standalone for inclusion in binaries other than Blender. */ # ifdef USE_STANDALONE # define MEM_mallocN(size, str) ((void)str, malloc(size)) # define MEM_callocN(size, str) ((void)str, calloc(size, 1)) @@ -33,7 +33,7 @@ # include "MEM_guardedalloc.h" # endif -# define WIN32_SKIP_HKEY_PROTECTION // need to use HKEY +# define WIN32_SKIP_HKEY_PROTECTION /* Need to use `HKEY`. */ # include "BLI_utildefines.h" # include "BLI_winstuff.h" # include "utfconv.h" diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index f221036419e..70e3a99e57a 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -1842,7 +1842,7 @@ void text_test( std::copy(b_before_arcs_in.vert.begin(), b_before_arcs_in.vert.end(), b_vert.begin()); std::copy(b_before_arcs_in.face.begin(), b_before_arcs_in.face.end(), b_face.begin()); if (num_arc_points > 0) { - b_face[0].pop_last(); // We'll add center point back between arcs for outer face. + b_face[0].pop_last(); /* We'll add center point back between arcs for outer face. */ for (int arc = 0; arc < narcs; ++arc) { int arc_origin_vert; int arc_terminal_vert; diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index f67ff0f7ac7..f88b470809c 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -50,7 +50,7 @@ #include "readfile.h" -#include "BLI_sys_types.h" // needed for intptr_t +#include "BLI_sys_types.h" /* Needed for `intptr_t`. */ #ifdef WIN32 # include "BLI_winstuff.h" diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index e270eeb3386..73c4343a230 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -95,11 +95,11 @@ constexpr DataType COM_num_channels_data_type(const int num_channels) } } -// configurable items - -// chunk size determination - -// chunk order +/* Configurable items. + * + * Chunk size determination. + * + * Chunk order. */ /** * \brief The order of chunks to be scheduled * \ingroup Execution diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index a45c453d7ed..505a4066a25 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -446,7 +446,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo MEM_freeN(memoryBuffers); } if (this->m_bTree) { - // status report is only performed for top level Execution Groups. + /* Status report is only performed for top level Execution Groups. */ float progress = this->m_chunks_finished; progress /= this->m_chunks_len; this->m_bTree->progress(this->m_bTree->prh, progress); @@ -494,7 +494,7 @@ void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNu MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) { - // we assume that this method is only called from complex execution groups. + /* We assume that this method is only called from complex execution groups. */ NodeOperation *operation = this->getOutputOperation(); if (operation->get_flags().is_write_buffer_operation) { WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; @@ -510,8 +510,9 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area if (this->m_flags.single_threaded) { return scheduleChunkWhenPossible(graph, 0, 0); } - // find all chunks inside the rect - // determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers + /* Find all chunks inside the rect + * determine `minxchunk`, `minychunk`, `maxxchunk`, `maxychunk` + * where x and y are chunk-numbers. */ int indexx, indexy; int minx = max_ii(area->xmin - m_viewerBorder.xmin, 0); diff --git a/source/blender/compositor/nodes/COM_GlareNode.cc b/source/blender/compositor/nodes/COM_GlareNode.cc index 0537074552a..cd0b5306be1 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -46,13 +46,13 @@ void GlareNode::convertToOperations(NodeConverter &converter, case 3: glareoperation = new GlareGhostOperation(); break; - case 2: // streaks + case 2: /* Streaks. */ glareoperation = new GlareStreaksOperation(); break; - case 1: // fog glow + case 1: /* Fog glow. */ glareoperation = new GlareFogGlowOperation(); break; - case 0: // simple star + case 0: /* Simple star. */ glareoperation = new GlareSimpleStarOperation(); break; } diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc index cbe4f165a45..43574d02d80 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc @@ -38,7 +38,7 @@ void KeyingScreenNode::convertToOperations(NodeConverter &converter, NodeOutput *outputScreen = this->getOutputSocket(0); - // always connect the output image + /* Always connect the output image. */ KeyingScreenOperation *operation = new KeyingScreenOperation(); operation->setMovieClip(clip); operation->setTrackingObject(keyingscreen_data->tracking_object); diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc index dc454b95080..5a03972c89d 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc @@ -34,7 +34,7 @@ void ViewLevelsNode::convertToOperations(NodeConverter &converter, { NodeInput *input = this->getInputSocket(0); if (input->isLinked()) { - // add preview to inputSocket; + /* Add preview to input-socket. */ /* calculate mean operation */ { diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cc b/source/blender/compositor/nodes/COM_ZCombineNode.cc index a76049ff249..ddf66740578 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cc +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cc @@ -58,8 +58,9 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, } else { /* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */ - // not full anti alias, use masking for Z combine. be aware it uses anti aliasing. - // step 1 create mask + /* not full anti alias, use masking for Z combine. be aware it uses anti aliasing. */ + + /* Step 1 create mask. */ NodeOperation *maskoperation; if (this->getbNode()->custom1) { maskoperation = new MathGreaterThanOperation(); @@ -76,13 +77,13 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); } - // step 2 anti alias mask bit of an expensive operation, but does the trick + /* Step 2 anti alias mask bit of an expensive operation, but does the trick. */ AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); converter.addOperation(antialiasoperation); converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); - // use mask to blend between the input colors. + /* use mask to blend between the input colors. */ ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation(); diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc index 0c1bb688d4e..44680c3acd1 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc @@ -43,8 +43,8 @@ void BilateralBlurOperation::initExecution() void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *data) { - // read the determinator color at x, y, this will be used as the reference color for the - // determinator + /* Read the determinator color at x, y, + * this will be used as the reference color for the determinator. */ float determinatorReferenceColor[4]; float determinator[4]; float tempColor[4]; @@ -67,14 +67,14 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d */ for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) { for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) { - // read determinator + /* Read determinator. */ this->m_inputDeterminatorProgram->read(determinator, xi, yi, data); deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) + fabsf(determinatorReferenceColor[1] - determinator[1]) + - fabsf(determinatorReferenceColor[2] - - determinator[2])); // do not take the alpha channel into account + /* Do not take the alpha channel into account. */ + fabsf(determinatorReferenceColor[2] - determinator[2])); if (deltaColor < sigmacolor) { - // add this to the blur + /* Add this to the blur. */ this->m_inputColorProgram->read(tempColor, xi, yi, data); add_v4_v4(blurColor, tempColor); blurDivider += 1.0f; diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc index b50145b106d..d3557e541c0 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc @@ -132,7 +132,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], g = color_correct_powf_safe(g * gain + lift, invgamma, g); b = color_correct_powf_safe(b * gain + lift, invgamma, b); - // mix with mask + /* Mix with mask. */ r = mvalue * inputImageColor[0] + value * r; g = mvalue * inputImageColor[1] + value * g; b = mvalue * inputImageColor[2] + value * b; diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc index 57027c11949..a9c58b55d73 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc @@ -58,7 +58,7 @@ void ConvertDepthToRadiusOperation::initExecution() this->m_inputOperation = this->getInputSocketReader(0); float focalDistance = determineFocalDistance(); if (focalDistance == 0.0f) { - focalDistance = 1e10f; /* if the dof is 0.0 then set it to be far away */ + focalDistance = 1e10f; /* If the DOF is 0.0 then set it to be far away. */ } this->m_inverseFocalDistance = 1.0f / focalDistance; this->m_aspect = (this->getWidth() > this->getHeight()) ? @@ -66,9 +66,9 @@ void ConvertDepthToRadiusOperation::initExecution() (this->getWidth() / (float)this->getHeight()); this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop; const float minsz = MIN2(getWidth(), getHeight()); - this->m_dof_sp = minsz / - ((cam_sensor / 2.0f) / - this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov); + this->m_dof_sp = + minsz / ((cam_sensor / 2.0f) / + this->m_cam_lens); /* <- == `aspect * MIN2(img->x, img->y) / tan(0.5f * fov)` */ if (this->m_blurPostOperation) { m_blurPostOperation->setSigma(MIN2(m_aperture * 128.0f, this->m_maxRadius)); @@ -91,7 +91,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], /* bug T6656 part 2b, do not re-scale. */ #if 0 bcrad = 0.5f * fabs(aperture * (dof_sp * (cam_invfdist - iZ) - 1.0f)); - // scale crad back to original maximum and blend + /* Scale crad back to original maximum and blend. */ crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad); #endif radius = 0.5f * fabsf(this->m_aperture * diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index 0af4eb43624..5ca64b02586 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -47,15 +47,15 @@ void GlareStreaksOperation::generateGlare(float *data, const float p4 = pow(4.0, (double)n); const float vxp = vx * p4, vyp = vy * p4; const float wt = pow((double)settings->fade, (double)p4); - const float cmo = 1.0f - - (float)pow((double)settings->colmod, - (double)n + - 1); // colormodulation amount relative to current pass + + /* Color-modulation amount relative to current pass. */ + const float cmo = 1.0f - (float)pow((double)settings->colmod, (double)n + 1); + float *tdstcol = tdst.getBuffer(); for (y = 0; y < tsrc.getHeight() && (!breaked); y++) { for (x = 0; x < tsrc.getWidth(); x++, tdstcol += 4) { - // first pass no offset, always same for every pass, exact copy, - // otherwise results in uneven brightness, only need once + /* First pass no offset, always same for every pass, exact copy, + * otherwise results in uneven brightness, only need once. */ if (n == 0) { tsrc.read(c1, x, y); } @@ -65,7 +65,7 @@ void GlareStreaksOperation::generateGlare(float *data, tsrc.readBilinear(c2, x + vxp, y + vyp); tsrc.readBilinear(c3, x + vxp * 2.0f, y + vyp * 2.0f); tsrc.readBilinear(c4, x + vxp * 3.0f, y + vyp * 3.0f); - // modulate color to look vaguely similar to a color spectrum + /* Modulate color to look vaguely similar to a color spectrum. */ c2[1] *= cmo; c2[2] *= cmo; diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index bbb6de2f39e..0161b837915 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -213,12 +213,12 @@ void ScaleAbsoluteOperation::executePixelSampled(float output[4], this->m_inputXOperation->readSampled(scaleX, x, y, effective_sampler); this->m_inputYOperation->readSampled(scaleY, x, y, effective_sampler); - const float scx = scaleX[0]; // target absolute scale - const float scy = scaleY[0]; // target absolute scale + const float scx = scaleX[0]; /* Target absolute scale. */ + const float scy = scaleY[0]; /* Target absolute scale. */ const float width = this->getWidth(); const float height = this->getHeight(); - // div + /* Divide. */ float relativeXScale = scx / width; float relativeYScale = scy / height; @@ -244,7 +244,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, const float scy = scaleY[0]; const float width = this->getWidth(); const float height = this->getHeight(); - // div + /* Divide. */ float relateveXScale = scx / width; float relateveYScale = scy / height; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index 1f503051349..628da686a42 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -369,7 +369,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) { m_k[1] = max_ff(min_ff(distortion, 1.0f), -0.999f); - // smaller dispersion range for somewhat more control + /* Smaller dispersion range for somewhat more control. */ float d = 0.25f * max_ff(min_ff(dispersion, 1.0f), 0.0f); m_k[0] = max_ff(min_ff((m_k[1] + d), 1.0f), -0.999f); m_k[2] = max_ff(min_ff((m_k[1] - d), 1.0f), -0.999f); diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index 6af6f5a6244..b8274576cb5 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -28,11 +28,11 @@ namespace blender::compositor { VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, ResizeMode::None); // do not resize the bokeh image. - this->addInputSocket(DataType::Value); // radius + this->addInputSocket(DataType::Color, ResizeMode::None); /* Do not resize the bokeh image. */ + this->addInputSocket(DataType::Value); /* Radius. */ #ifdef COM_DEFOCUS_SEARCH - this->addInputSocket(DataType::Color, - ResizeMode::None); // inverse search radius optimization structure. + /* Inverse search radius optimization structure. */ + this->addInputSocket(DataType::Color, ResizeMode::None); #endif this->addOutputSocket(DataType::Color); flags.complex = true; @@ -438,10 +438,10 @@ void VariableSizeBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer * } #ifdef COM_DEFOCUS_SEARCH -// InverseSearchRadiusOperation +/* #InverseSearchRadiusOperation. */ InverseSearchRadiusOperation::InverseSearchRadiusOperation() { - this->addInputSocket(DataType::Value, ResizeMode::None); // radius + this->addInputSocket(DataType::Value, ResizeMode::None); /* Radius. */ this->addOutputSocket(DataType::Color); this->flags.complex = true; this->m_inputRadius = nullptr; @@ -472,37 +472,39 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) offset += 4; } } - // for (x = rect->xmin; x < rect->xmax ; x++) { - // for (y = rect->ymin; y < rect->ymax ; y++) { - // int rx = x * DIVIDER; - // int ry = y * DIVIDER; - // float radius = 0.0f; - // float maxx = x; - // float maxy = y; - - // for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) { - // for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) { - // this->m_inputRadius->read(temp, rx+x2, ry+y2, PixelSampler::Nearest); - // if (radius < temp[0]) { - // radius = temp[0]; - // maxx = x2; - // maxy = y2; - // } - // } - // } - // int impactRadius = ceil(radius / DIVIDER); - // for (int x2 = x - impactRadius ; x2 < x + impactRadius ; x2 ++) { - // for (int y2 = y - impactRadius ; y2 < y + impactRadius ; y2 ++) { - // data->read(temp, x2, y2); - // temp[0] = MIN2(temp[0], maxx); - // temp[1] = MIN2(temp[1], maxy); - // temp[2] = MAX2(temp[2], maxx); - // temp[3] = MAX2(temp[3], maxy); - // data->writePixel(x2, y2, temp); - // } - // } - // } - // } +# if 0 + for (x = rect->xmin; x < rect->xmax; x++) { + for (y = rect->ymin; y < rect->ymax; y++) { + int rx = x * DIVIDER; + int ry = y * DIVIDER; + float radius = 0.0f; + float maxx = x; + float maxy = y; + + for (int x2 = 0; x2 < DIVIDER; x2++) { + for (int y2 = 0; y2 < DIVIDER; y2++) { + this->m_inputRadius->read(temp, rx + x2, ry + y2, PixelSampler::Nearest); + if (radius < temp[0]) { + radius = temp[0]; + maxx = x2; + maxy = y2; + } + } + } + int impactRadius = ceil(radius / DIVIDER); + for (int x2 = x - impactRadius; x2 < x + impactRadius; x2++) { + for (int y2 = y - impactRadius; y2 < y + impactRadius; y2++) { + data->read(temp, x2, y2); + temp[0] = MIN2(temp[0], maxx); + temp[1] = MIN2(temp[1], maxy); + temp[2] = MAX2(temp[2], maxx); + temp[3] = MAX2(temp[3], maxy); + data->writePixel(x2, y2, temp); + } + } + } + } +# endif return data; } diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc index 02ed7c35e57..93e433e231c 100644 --- a/source/blender/io/usd/intern/usd_reader_material.cc +++ b/source/blender/io/usd/intern/usd_reader_material.cc @@ -264,7 +264,7 @@ void compute_node_loc(const int column, float *r_locx, float *r_locy, NodePlacem r_ctx->column_offsets[column] += r_ctx->vertical_step + 10.0f; } -} // End anonymous namespace. +} // namespace USDMaterialReader::USDMaterialReader(const USDImportParams ¶ms, Main *bmain) : params_(params), bmain_(bmain) diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index d94e9a988c6..521a93b199f 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -170,10 +170,10 @@ static void deformVerts(ModifierData *md, mul_m4_v3(ob->obmat, collmd->x[i].co); } - collmd->xnew = MEM_dupallocN(collmd->x); // frame end position - collmd->current_x = MEM_dupallocN(collmd->x); // inter-frame - collmd->current_xnew = MEM_dupallocN(collmd->x); // inter-frame - collmd->current_v = MEM_dupallocN(collmd->x); // inter-frame + collmd->xnew = MEM_dupallocN(collmd->x); /* Frame end position. */ + collmd->current_x = MEM_dupallocN(collmd->x); /* Inter-frame. */ + collmd->current_xnew = MEM_dupallocN(collmd->x); /* Inter-frame. */ + collmd->current_v = MEM_dupallocN(collmd->x); /* Inter-frame. */ collmd->mvert_num = mvert_num; diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c index cc42781ee70..6f68b187775 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c @@ -40,7 +40,7 @@ static bNodeSocketTemplate cmp_node_doubleedgemask_out[] = { void register_node_type_cmp_doubleedgemask(void) { - static bNodeType ntype; // allocate a node type data structure + static bNodeType ntype; /* Allocate a node type data structure. */ cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out); diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c index 0452be68822..930c7580f32 100644 --- a/source/blender/render/intern/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c @@ -978,7 +978,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, #if 0 /* **************** Ambient Occlusion Baker **************** */ -// must be a power of two +/* Must be a power of two. */ # define MAX_NUMBER_OF_AO_RAYS 1024 static unsigned short ao_random_table_1[MAX_NUMBER_OF_AO_RAYS]; -- cgit v1.2.3