ClangFormat: apply to source, most of intern
[blender.git] / intern / cycles / kernel / geom / geom_volume.h
index 1977d26..96cf35a 100644 (file)
@@ -33,41 +33,47 @@ ccl_device_inline float3 volume_normalized_position(KernelGlobals *kg,
                                                     const ShaderData *sd,
                                                     float3 P)
 {
-       /* todo: optimize this so it's just a single matrix multiplication when
-        * possible (not motion blur), or perhaps even just translation + scale */
-       const AttributeDescriptor desc = find_attribute(kg, sd, ATTR_STD_GENERATED_TRANSFORM);
+  /* todo: optimize this so it's just a single matrix multiplication when
+   * possible (not motion blur), or perhaps even just translation + scale */
+  const AttributeDescriptor desc = find_attribute(kg, sd, ATTR_STD_GENERATED_TRANSFORM);
 
-       object_inverse_position_transform(kg, sd, &P);
+  object_inverse_position_transform(kg, sd, &P);
 
-       if(desc.offset != ATTR_STD_NOT_FOUND) {
-               Transform tfm = primitive_attribute_matrix(kg, sd, desc);
-               P = transform_point(&tfm, P);
-       }
+  if (desc.offset != ATTR_STD_NOT_FOUND) {
+    Transform tfm = primitive_attribute_matrix(kg, sd, desc);
+    P = transform_point(&tfm, P);
+  }
 
-       return P;
+  return P;
 }
 
-ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc)
+ccl_device float volume_attribute_float(KernelGlobals *kg,
+                                        const ShaderData *sd,
+                                        const AttributeDescriptor desc)
 {
-       float3 P = volume_normalized_position(kg, sd, sd->P);
-       InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC)? INTERPOLATION_CUBIC: INTERPOLATION_NONE;
-       float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z, interp);
-       return average(float4_to_float3(r));
+  float3 P = volume_normalized_position(kg, sd, sd->P);
+  InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
+                                                            INTERPOLATION_NONE;
+  float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z, interp);
+  return average(float4_to_float3(r));
 }
 
-ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *sd, const AttributeDescriptor desc)
+ccl_device float3 volume_attribute_float3(KernelGlobals *kg,
+                                          const ShaderData *sd,
+                                          const AttributeDescriptor desc)
 {
-       float3 P = volume_normalized_position(kg, sd, sd->P);
-       InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC)? INTERPOLATION_CUBIC: INTERPOLATION_NONE;
-       float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z, interp);
+  float3 P = volume_normalized_position(kg, sd, sd->P);
+  InterpolationType interp = (sd->flag & SD_VOLUME_CUBIC) ? INTERPOLATION_CUBIC :
+                                                            INTERPOLATION_NONE;
+  float4 r = kernel_tex_image_interp_3d(kg, desc.offset, P.x, P.y, P.z, interp);
 
-       if(r.w > 1e-6f && r.w != 1.0f) {
-               /* For RGBA colors, unpremultiply after interpolation. */
-               return float4_to_float3(r) / r.w;
-       }
-       else {
-               return float4_to_float3(r);
-       }
+  if (r.w > 1e-6f && r.w != 1.0f) {
+    /* For RGBA colors, unpremultiply after interpolation. */
+    return float4_to_float3(r) / r.w;
+  }
+  else {
+    return float4_to_float3(r);
+  }
 }
 
 #endif