Cleanup: clang-format

This commit is contained in:
Aaron Carlisle 2021-12-07 23:12:13 -05:00
parent 47b36ddcce
commit b71e29b3da
30 changed files with 86 additions and 54 deletions

View File

@ -146,16 +146,15 @@ fisheye_equisolid_to_direction(float u, float v, float lens, float fov, float wi
return make_float3(cosf(theta), -cosf(phi) * sinf(theta), sinf(phi) * sinf(theta));
}
ccl_device_inline float3
fisheye_lens_polynomial_to_direction(float u, float v, float coeff0, float4 coeffs,
float fov, float width, float height)
ccl_device_inline float3 fisheye_lens_polynomial_to_direction(
float u, float v, float coeff0, float4 coeffs, float fov, float width, float height)
{
u = (u - 0.5f) * width;
v = (v - 0.5f) * height;
float r = sqrtf(u * u + v * v);
float r2 = r*r;
float4 rr = make_float4(r, r2, r2*r, r2*r2);
float r2 = r * r;
float4 rr = make_float4(r, r2, r2 * r, r2 * r2);
float theta = -(coeff0 + dot(coeffs, rr));
if (fabsf(theta) > 0.5f * fov)
@ -169,16 +168,16 @@ fisheye_lens_polynomial_to_direction(float u, float v, float coeff0, float4 coef
return make_float3(cosf(theta), -cosf(phi) * sinf(theta), sinf(phi) * sinf(theta));
}
ccl_device float2 direction_to_fisheye_lens_polynomial(float3 dir, float coeff0, float4 coeffs,
float width, float height)
ccl_device float2 direction_to_fisheye_lens_polynomial(
float3 dir, float coeff0, float4 coeffs, float width, float height)
{
float theta = -safe_acosf(dir.x);
float r = (theta - coeff0) / coeffs.x;
for (int i=0; i<20; i++) {
float r2 = r*r;
float4 rr = make_float4(r, r2, r2*r, r2*r2);
for (int i = 0; i < 20; i++) {
float r2 = r * r;
float4 rr = make_float4(r, r2, r2 * r, r2 * r2);
r = (theta - (coeff0 + dot(coeffs, rr))) / coeffs.x;
}
@ -190,7 +189,6 @@ ccl_device float2 direction_to_fisheye_lens_polynomial(float3 dir, float coeff0,
return make_float2(u, v);
}
/* Mirror Ball <-> Cartesion direction */
ccl_device float3 mirrorball_to_direction(float u, float v)
@ -237,9 +235,13 @@ ccl_device_inline float3 panorama_to_direction(ccl_constant KernelCamera *cam, f
case PANORAMA_FISHEYE_EQUIDISTANT:
return fisheye_to_direction(u, v, cam->fisheye_fov);
case PANORAMA_FISHEYE_LENS_POLYNOMIAL:
return fisheye_lens_polynomial_to_direction(
u, v, cam->fisheye_lens_polynomial_bias, cam->fisheye_lens_polynomial_coefficients, cam->fisheye_fov,
cam->sensorwidth, cam->sensorheight);
return fisheye_lens_polynomial_to_direction(u,
v,
cam->fisheye_lens_polynomial_bias,
cam->fisheye_lens_polynomial_coefficients,
cam->fisheye_fov,
cam->sensorwidth,
cam->sensorheight);
case PANORAMA_FISHEYE_EQUISOLID:
default:
return fisheye_equisolid_to_direction(
@ -257,9 +259,11 @@ ccl_device_inline float2 direction_to_panorama(ccl_constant KernelCamera *cam, f
case PANORAMA_FISHEYE_EQUIDISTANT:
return direction_to_fisheye(dir, cam->fisheye_fov);
case PANORAMA_FISHEYE_LENS_POLYNOMIAL:
return direction_to_fisheye_lens_polynomial(
dir, cam->fisheye_lens_polynomial_bias, cam->fisheye_lens_polynomial_coefficients,
cam->sensorwidth, cam->sensorheight);
return direction_to_fisheye_lens_polynomial(dir,
cam->fisheye_lens_polynomial_bias,
cam->fisheye_lens_polynomial_coefficients,
cam->sensorwidth,
cam->sensorheight);
case PANORAMA_FISHEYE_EQUISOLID:
default:
return direction_to_fisheye_equisolid(

View File

@ -426,8 +426,8 @@ void Camera::update(Scene *scene)
latitude_min - latitude_max,
-latitude_min + M_PI_2_F);
kcam->fisheye_lens_polynomial_bias = fisheye_polynomial_k0;
kcam->fisheye_lens_polynomial_coefficients = make_float4(fisheye_polynomial_k1, fisheye_polynomial_k2,
fisheye_polynomial_k3, fisheye_polynomial_k4);
kcam->fisheye_lens_polynomial_coefficients = make_float4(
fisheye_polynomial_k1, fisheye_polynomial_k2, fisheye_polynomial_k3, fisheye_polynomial_k4);
switch (stereo_eye) {
case STEREO_LEFT:

View File

@ -226,7 +226,8 @@ class Shader : public SocketDeclaration {
bool matches(const bNodeSocket &socket) const override;
};
class ShaderBuilder : public SocketDeclarationBuilder<Shader> {};
class ShaderBuilder : public SocketDeclarationBuilder<Shader> {
};
/* -------------------------------------------------------------------- */
/** \name #FloatBuilder Inline Methods

View File

@ -38,8 +38,7 @@ void register_node_type_cmp_group()
/* NOTE: Cannot use sh_node_type_base for node group, because it would map the node type
* to the shared NODE_GROUP integer type id. */
node_type_base_custom(
&ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, 0);
node_type_base_custom(&ntype, "CompositorNodeGroup", "Group", NODE_CLASS_GROUP, 0);
ntype.type = NODE_GROUP;
ntype.poll = cmp_node_poll_default;
ntype.poll_instance = node_group_poll_instance;

View File

@ -297,8 +297,8 @@ static bool node_poll_cryptomatte(bNodeType *UNUSED(ntype),
}
if (scene == nullptr) {
*r_disabled_hint =
TIP_("The node tree must be the compositing node tree of any scene in the file");
*r_disabled_hint = TIP_(
"The node tree must be the compositing node tree of any scene in the file");
}
return scene != nullptr;
}

View File

@ -113,7 +113,8 @@ static bool geometry_node_tree_socket_type_valid(bNodeTreeType *UNUSED(ntreetype
SOCK_MATERIAL);
}
void register_node_tree_type_geo(){
void register_node_tree_type_geo()
{
bNodeTreeType *tt = ntreeType_Geometry = static_cast<bNodeTreeType *>(
MEM_callocN(sizeof(bNodeTreeType), "geometry node tree type"));
tt->type = NTREE_GEOMETRY;

View File

@ -22,7 +22,8 @@
#include "node_common.h"
#include "node_geometry_util.hh"
void register_node_type_geo_group(){
void register_node_type_geo_group()
{
static bNodeType ntype;
node_type_base_custom(&ntype, "GeometryNodeGroup", "Group", NODE_CLASS_GROUP, 0);

View File

@ -410,7 +410,8 @@ static void node_geo_exec(GeoNodeExecParams params)
} // namespace blender::nodes::node_geo_image_texture_cc
void register_node_type_geo_image_texture(){
void register_node_type_geo_image_texture()
{
namespace file_ns = blender::nodes::node_geo_image_texture_cc;
static bNodeType ntype;

View File

@ -75,7 +75,8 @@ static void sh_node_clamp_build_multi_function(blender::nodes::NodeMultiFunction
}
}
void register_node_type_sh_clamp(){
void register_node_type_sh_clamp()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER, 0);

View File

@ -152,7 +152,8 @@ static void sh_node_curve_vec_build_multi_function(
builder.construct_and_set_matching_fn<CurveVecFunction>(*cumap);
}
void register_node_type_sh_curve_vec(){
void register_node_type_sh_curve_vec()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0);
@ -328,7 +329,8 @@ static void sh_node_curve_rgb_build_multi_function(
builder.construct_and_set_matching_fn<CurveRGBFunction>(*cumap);
}
void register_node_type_sh_curve_rgb(){
void register_node_type_sh_curve_rgb()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0);
@ -471,7 +473,8 @@ static void sh_node_curve_float_build_multi_function(
builder.construct_and_set_matching_fn<CurveFloatFunction>(*cumap);
}
void register_node_type_sh_curve_float(){
void register_node_type_sh_curve_float()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_CURVE_FLOAT, "Float Curve", NODE_CLASS_CONVERTER, 0);

View File

@ -307,7 +307,8 @@ static void sh_node_map_range_build_multi_function(
}
}
void register_node_type_sh_map_range(){
void register_node_type_sh_map_range()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER, 0);

View File

@ -161,7 +161,8 @@ static void sh_node_math_build_multi_function(blender::nodes::NodeMultiFunctionB
}
}
void register_node_type_sh_math(){
void register_node_type_sh_math()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);

View File

@ -183,7 +183,8 @@ static void sh_node_mix_rgb_build_multi_function(blender::nodes::NodeMultiFuncti
builder.construct_and_set_matching_fn<MixRGBFunction>(clamp, mix_type);
}
void register_node_type_sh_mix_rgb(){
void register_node_type_sh_mix_rgb()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);

View File

@ -172,7 +172,8 @@ static void sh_node_valtorgb_build_multi_function(
builder.construct_and_set_matching_fn<ColorBandFunction>(*color_band);
}
void register_node_type_sh_valtorgb(){
void register_node_type_sh_valtorgb()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTER, 0);
@ -221,7 +222,8 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat,
return GPU_stack_link(mat, node, "rgbtobw", in, out);
}
void register_node_type_sh_rgbtobw(){
void register_node_type_sh_rgbtobw()
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTER, 0);

View File

@ -103,7 +103,8 @@ static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctio
builder.set_matching_fn(fn);
}
void register_node_type_sh_seprgb(){
void register_node_type_sh_seprgb()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0);
@ -162,7 +163,8 @@ static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFuncti
builder.set_matching_fn(fn);
}
void register_node_type_sh_combrgb(){
void register_node_type_sh_combrgb()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER, 0);

View File

@ -88,7 +88,8 @@ static void sh_node_sepxyz_build_multi_function(blender::nodes::NodeMultiFunctio
builder.set_matching_fn(separate_fn);
}
void register_node_type_sh_sepxyz(){
void register_node_type_sh_sepxyz()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_SEPXYZ, "Separate XYZ", NODE_CLASS_CONVERTER, 0);
@ -128,7 +129,8 @@ static void sh_node_combxyz_build_multi_function(blender::nodes::NodeMultiFuncti
builder.set_matching_fn(fn);
}
void register_node_type_sh_combxyz(){
void register_node_type_sh_combxyz()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_COMBXYZ, "Combine XYZ", NODE_CLASS_CONVERTER, 0);

View File

@ -268,7 +268,8 @@ static void sh_node_brick_build_multi_function(blender::nodes::NodeMultiFunction
} // namespace blender::nodes
void register_node_type_sh_tex_brick(){
void register_node_type_sh_tex_brick()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -123,7 +123,8 @@ static void sh_node_tex_checker_build_multi_function(
} // namespace blender::nodes
void register_node_type_sh_tex_checker(){
void register_node_type_sh_tex_checker()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_CHECKER, "Checker Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -160,7 +160,8 @@ static void sh_node_gradient_tex_build_multi_function(
} // namespace blender::nodes
void register_node_type_sh_tex_gradient(){
void register_node_type_sh_tex_gradient()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -174,7 +174,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
}
/* node type definition */
void register_node_type_sh_tex_image(){
void register_node_type_sh_tex_image()
{
static bNodeType ntype;
sh_node_type_base(&ntype, SH_NODE_TEX_IMAGE, "Image Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -181,7 +181,8 @@ static void sh_node_magic_tex_build_multi_function(
} // namespace blender::nodes
void register_node_type_sh_tex_magic(){
void register_node_type_sh_tex_magic()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -533,7 +533,8 @@ static void sh_node_musgrave_build_multi_function(
} // namespace blender::nodes
void register_node_type_sh_tex_musgrave(){
void register_node_type_sh_tex_musgrave()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -250,7 +250,8 @@ static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunction
} // namespace blender::nodes
/* node type definition */
void register_node_type_sh_tex_noise(){
void register_node_type_sh_tex_noise()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -1329,7 +1329,8 @@ static void sh_node_voronoi_build_multi_function(blender::nodes::NodeMultiFuncti
} // namespace blender::nodes
void register_node_type_sh_tex_voronoi(){
void register_node_type_sh_tex_voronoi()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -218,7 +218,8 @@ static void sh_node_wave_tex_build_multi_function(
} // namespace blender::nodes
void register_node_type_sh_tex_wave(){
void register_node_type_sh_tex_wave()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE, 0);

View File

@ -191,7 +191,8 @@ static void sh_node_noise_build_multi_function(blender::nodes::NodeMultiFunction
} // namespace blender::nodes
void register_node_type_sh_tex_white_noise(){
void register_node_type_sh_tex_white_noise()
{
static bNodeType ntype;
sh_fn_node_type_base(

View File

@ -49,7 +49,8 @@ static void sh_node_value_build_multi_function(blender::nodes::NodeMultiFunction
builder.construct_and_set_matching_fn<blender::fn::CustomMF_Constant<float>>(value->value);
}
void register_node_type_sh_value(){
void register_node_type_sh_value()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);

View File

@ -279,7 +279,8 @@ static void sh_node_vector_math_build_multi_function(
builder.set_matching_fn(fn);
}
void register_node_type_sh_vect_math(){
void register_node_type_sh_vect_math()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0);

View File

@ -205,7 +205,8 @@ static void node_shader_update_vector_rotate(bNodeTree *ntree, bNode *node)
ntree, sock_angle, !ELEM(node->custom1, NODE_VECTOR_ROTATE_TYPE_EULER_XYZ));
}
void register_node_type_sh_vector_rotate(){
void register_node_type_sh_vector_rotate()
{
static bNodeType ntype;
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR, 0);

View File

@ -21,7 +21,6 @@
* \ingroup texnodes
*/
#include "NOD_texture.h"
#include "node_texture_util.h"