Cleanup: use C-style code comments, format

This commit is contained in:
Campbell Barton 2023-03-03 15:55:33 +11:00
parent 37c0b0b2b8
commit b4eef99973
7 changed files with 31 additions and 32 deletions

View File

@ -9,18 +9,18 @@
#include "sky_model.h"
/* Constants */
static const float rayleigh_scale = 8e3f; // Rayleigh scale height (m)
static const float mie_scale = 1.2e3f; // Mie scale height (m)
static const float mie_coeff = 2e-5f; // Mie scattering coefficient (m^-1)
static const float mie_G = 0.76f; // aerosols anisotropy
static const float sqr_G = mie_G * mie_G; // squared aerosols anisotropy
static const float earth_radius = 6360e3f; // radius of Earth (m)
static const float atmosphere_radius = 6420e3f; // radius of atmosphere (m)
static const int steps = 32; // segments of primary ray
static const int num_wavelengths = 21; // number of wavelengths
static const int min_wavelength = 380; // lowest sampled wavelength (nm)
static const int max_wavelength = 780; // highest sampled wavelength (nm)
// step between each sampled wavelength (nm)
static const float rayleigh_scale = 8e3f; /* Rayleigh scale height (m). */
static const float mie_scale = 1.2e3f; /* Mie scale height (m). */
static const float mie_coeff = 2e-5f; /* Mie scattering coefficient (m^-1). */
static const float mie_G = 0.76f; /* aerosols anisotropy. */
static const float sqr_G = mie_G * mie_G; /* squared aerosols anisotropy. */
static const float earth_radius = 6360e3f; /* radius of Earth (m). */
static const float atmosphere_radius = 6420e3f; /* radius of atmosphere (m). */
static const int steps = 32; /* segments of primary ray. */
static const int num_wavelengths = 21; /* number of wavelengths. */
static const int min_wavelength = 380; /* lowest sampled wavelength (nm). */
static const int max_wavelength = 780; /* highest sampled wavelength (nm). */
/* Step between each sampled wavelength (nm). */
static const float step_lambda = (max_wavelength - min_wavelength) / (num_wavelengths - 1);
/* Sun irradiance on top of the atmosphere (W*m^-2*nm^-1) */
static const float irradiance[] = {

View File

@ -1070,7 +1070,7 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip)
strip->start = (p1 * nLen) + mstrip->start;
strip->end = (p2 * nLen) + mstrip->start;
// Recompute the playback scale, given the new start & end frame of the strip.
/* Recompute the playback scale, given the new start & end frame of the strip. */
const double action_len = strip->actend - strip->actstart;
const double repeated_len = action_len * strip->repeat;
const double strip_len = strip->end - strip->start;

View File

@ -28,13 +28,13 @@ TEST(nla_strip, BKE_nlastrip_recalculate_blend)
EXPECT_FLOAT_EQ(strip.blendin, 4.0);
EXPECT_FLOAT_EQ(strip.blendout, 5.0);
/* Scaling a strip down affects the blend-in value before the blend-out value. */
/* Scaling a strip down affects the blend-in value before the blend-out value. */
strip.end = 7;
BKE_nlastrip_recalculate_blend(&strip);
EXPECT_FLOAT_EQ(strip.blendin, 1.0);
EXPECT_FLOAT_EQ(strip.blendout, 5.0);
/* Scaling a strip down to nothing updates the blend in/out values accordingly. */
/* Scaling a strip down to nothing updates the blend in/out values accordingly. */
strip.end = 1.1;
BKE_nlastrip_recalculate_blend(&strip);
EXPECT_FLOAT_EQ(strip.blendin, 0.0);
@ -53,15 +53,15 @@ TEST(nla_strip, BKE_nlastrips_add_strip)
strip2.start = 5;
strip2.end = 10;
/* can't add a null NLA strip to an NLA Track. */
EXPECT_FALSE(BKE_nlastrips_add_strip(&strips, NULL));
/* Can't add a null NLA strip to an NLA Track. */
EXPECT_FALSE(BKE_nlastrips_add_strip(&strips, nullptr));
/* can't add an NLA strip to an NLA Track that overlaps another NLA strip. */
/* Can't add an NLA strip to an NLA Track that overlaps another NLA strip. */
EXPECT_FALSE(BKE_nlastrips_add_strip(&strips, &strip2));
strip2.start = 15;
strip2.end = 20;
/* can add an NLA strip to an NLA Track that doesn't overlaps another NLA strip. */
/* Can add an NLA strip to an NLA Track that doesn't overlaps another NLA strip. */
EXPECT_TRUE(BKE_nlastrips_add_strip(&strips, &strip2));
}
@ -120,11 +120,11 @@ TEST(nla_track, BKE_nlatrack_new_tail)
NlaTrack *trackB = BKE_nlatrack_new_tail(&adt.nla_tracks, false);
NlaTrack *trackA = BKE_nlatrack_new_tail(&adt.nla_tracks, false);
// Expect that Track B was added before track A
/* Expect that Track B was added before track A. */
EXPECT_EQ(1, BLI_findindex(&adt.nla_tracks, trackA));
EXPECT_EQ(0, BLI_findindex(&adt.nla_tracks, trackB));
// Free the tracks
/* Free the tracks. */
BKE_nlatrack_remove_and_free(&adt.nla_tracks, trackA, false);
BKE_nlatrack_remove_and_free(&adt.nla_tracks, trackB, false);
}
@ -135,11 +135,11 @@ TEST(nla_track, BKE_nlatrack_new_head)
NlaTrack *trackB = BKE_nlatrack_new_head(&adt.nla_tracks, false);
NlaTrack *trackA = BKE_nlatrack_new_head(&adt.nla_tracks, false);
// Expect that Track A was added before track B
/* Expect that Track A was added before track B. */
EXPECT_EQ(0, BLI_findindex(&adt.nla_tracks, trackA));
EXPECT_EQ(1, BLI_findindex(&adt.nla_tracks, trackB));
// Free the tracks
/* Free the tracks. */
BKE_nlatrack_remove_and_free(&adt.nla_tracks, trackA, false);
BKE_nlatrack_remove_and_free(&adt.nla_tracks, trackB, false);
}

View File

@ -180,7 +180,7 @@ float BLI_voxel_sample_tricubic(const float *data,
const float dx = xf - (float)x, dy = yf - (float)y, dz = zf - (float)z;
float u[4], v[4], w[4];
if (bspline) { // B-Spline
if (bspline) { /* B-Spline. */
u[0] = (((-1.0f / 6.0f) * dx + 0.5f) * dx - 0.5f) * dx + (1.0f / 6.0f);
u[1] = ((0.5f * dx - 1.0f) * dx) * dx + (2.0f / 3.0f);
u[2] = ((-0.5f * dx + 0.5f) * dx + 0.5f) * dx + (1.0f / 6.0f);
@ -194,7 +194,7 @@ float BLI_voxel_sample_tricubic(const float *data,
w[2] = ((-0.5f * dz + 0.5f) * dz + 0.5f) * dz + (1.0f / 6.0f);
w[3] = (1.0f / 6.0f) * dz * dz * dz;
}
else { // Catmull-Rom
else { /* Catmull-Rom. */
u[0] = ((-0.5f * dx + 1.0f) * dx - 0.5f) * dx;
u[1] = ((1.5f * dx - 2.5f) * dx) * dx + 1.0f;
u[2] = ((-1.5f * dx + 2.0f) * dx + 0.5f) * dx;

View File

@ -370,7 +370,7 @@ void animviz_motionpath_compute_range(Object *ob, Scene *scene)
if (ED_keylist_selected_keys_frame_range(keylist, &frame_range)) {
break;
}
ATTR_FALLTHROUGH; // Fall through if there were no selected keys found.
ATTR_FALLTHROUGH; /* Fall through if there were no selected keys found. */
case MOTIONPATH_RANGE_KEYS_ALL:
ED_keylist_all_keys_frame_range(keylist, &frame_range);
break;

View File

@ -32,9 +32,9 @@
#include <iostream>
/* TfToken objects are not cheap to construct, so we do it once. */
/* `TfToken` objects are not cheap to construct, so we do it once. */
namespace usdtokens {
// Materials
/* Materials. */
static const pxr::TfToken clearcoat("clearcoat", pxr::TfToken::Immortal);
static const pxr::TfToken clearcoatRoughness("clearcoatRoughness", pxr::TfToken::Immortal);
static const pxr::TfToken diffuse_color("diffuseColor", pxr::TfToken::Immortal);

View File

@ -530,7 +530,7 @@ class TestBlendLibDataLibrariesLoad(TestBlendLibLinkHelper):
# Simple link of a single Object, and reload.
self.reset_blender()
return output_lib_path
def do_libload(self, **load_kwargs):
@ -639,7 +639,6 @@ class TestBlendLibDataLibrariesLoadLibOverride(TestBlendLibDataLibrariesLoad):
assert bpy.data.collections[1].override_library is not None
assert bpy.data.collections[1].override_library.reference == bpy.data.collections[-1]
def test_libload_liboverride_runtime(self):
output_lib_path = self.do_libload_init()
self.do_libload(filepath=output_lib_path, link=True,
@ -657,7 +656,7 @@ class TestBlendLibDataLibrariesLoadLibOverride(TestBlendLibDataLibrariesLoad):
# Only explicitely linked data gets a liboverride, without any handling of hierarchy/dependencies.
assert bpy.data.collections[0].library is None
assert bpy.data.collections[0].is_runtime_data == True
assert bpy.data.collections[0].is_runtime_data is True
assert bpy.data.collections[0].override_library is not None
assert bpy.data.collections[0].override_library.reference == bpy.data.collections[-1]
@ -679,7 +678,7 @@ class TestBlendLibDataLibrariesLoadLibOverride(TestBlendLibDataLibrariesLoad):
# Only explicitely linked data gets a liboverride, without any handling of hierarchy/dependencies.
assert bpy.data.collections[0].library is None
assert bpy.data.collections[0].is_runtime_data == True
assert bpy.data.collections[0].is_runtime_data is True
assert bpy.data.collections[0].override_library is not None
assert bpy.data.collections[0].override_library.reference == bpy.data.collections[-1]