style cleanup

This commit is contained in:
Campbell Barton 2013-10-10 17:28:01 +00:00
parent 3d4bbd278a
commit 8fd52b3433
5 changed files with 31 additions and 30 deletions

@ -19,8 +19,8 @@
#include "stdosl.h" #include "stdosl.h"
shader node_hair_bsdf( shader node_hair_bsdf(
color Color = 0.8, color Color = 0.8,
string component = "Reflection", string component = "Reflection",
float Offset = 0.0, float Offset = 0.0,
float RoughnessU = 0.1, float RoughnessU = 0.1,
float RoughnessV = 1.0, float RoughnessV = 1.0,
@ -28,29 +28,30 @@ shader node_hair_bsdf(
output closure color BSDF = 0) output closure color BSDF = 0)
{ {
float IsStrand; float IsStrand;
float roughnessh = clamp(RoughnessU, 0.001,1.0); float roughnessh = clamp(RoughnessU, 0.001, 1.0);
float roughnessv = clamp(RoughnessV, 0.001,1.0); float roughnessv = clamp(RoughnessV, 0.001, 1.0);
getattribute("geom:is_curve", IsStrand); getattribute("geom:is_curve", IsStrand);
if (!IsStrand) { if (!IsStrand) {
if (backfacing()) if (backfacing()) {
BSDF = transparent(); BSDF = transparent();
else { }
if (component == "Reflection") else {
BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0); if (component == "Reflection")
else BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0); else
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0);
} }
} }
else { else {
if (backfacing()) if (backfacing()) {
BSDF = transparent(); BSDF = transparent();
else { }
if (component == "Reflection") else {
BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, dPdu, -Offset); if (component == "Reflection")
else BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, dPdu, -Offset);
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, dPdu, -Offset); else
BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, dPdu, -Offset);
} }
} }
} }

@ -44,8 +44,8 @@ float sky_perez_function(float lam[9], float theta, float gamma)
} }
color sky_radiance_old(normal dir, color sky_radiance_old(normal dir,
float sunphi, float suntheta, color radiance, float sunphi, float suntheta, color radiance,
float config_x[9], float config_y[9], float config_z[9]) float config_x[9], float config_y[9], float config_z[9])
{ {
/* convert vector to spherical coordinates */ /* convert vector to spherical coordinates */
vector spherical = sky_spherical_coordinates(dir); vector spherical = sky_spherical_coordinates(dir);
@ -76,7 +76,7 @@ float sky_radiance_internal(float config[9], float theta, float gamma)
float expM = exp(config[4] * gamma); float expM = exp(config[4] * gamma);
float rayM = cgamma * cgamma; float rayM = cgamma * cgamma;
float mieM = (1.0 + rayM) / pow((1.0 + config[8]*config[8] - 2.0*config[8]*cgamma), 1.5); float mieM = (1.0 + rayM) / pow((1.0 + config[8] * config[8] - 2.0 * config[8] * cgamma), 1.5);
float zenith = sqrt(ctheta); float zenith = sqrt(ctheta);
return (1.0 + config[0] * exp(config[1] / (ctheta + 0.01))) * return (1.0 + config[0] * exp(config[1] / (ctheta + 0.01))) *
@ -84,8 +84,8 @@ float sky_radiance_internal(float config[9], float theta, float gamma)
} }
color sky_radiance_new(normal dir, color sky_radiance_new(normal dir,
float sunphi, float suntheta, color radiance, float sunphi, float suntheta, color radiance,
float config_x[9], float config_y[9], float config_z[9]) float config_x[9], float config_y[9], float config_z[9])
{ {
/* convert vector to spherical coordinates */ /* convert vector to spherical coordinates */
vector spherical = sky_spherical_coordinates(dir); vector spherical = sky_spherical_coordinates(dir);
@ -104,7 +104,7 @@ color sky_radiance_new(normal dir,
float z = sky_radiance_internal(config_z, theta, gamma) * radiance[2]; float z = sky_radiance_internal(config_z, theta, gamma) * radiance[2];
/* convert to RGB and adjust strength */ /* convert to RGB and adjust strength */
return xyz_to_rgb(x, y, z) * (M_2PI/683); return xyz_to_rgb(x, y, z) * (M_2PI / 683);
} }
shader node_sky_texture( shader node_sky_texture(

@ -26,7 +26,7 @@ shader node_subsurface_scattering(
normal Normal = N, normal Normal = N,
output closure color BSSRDF = 0) output closure color BSSRDF = 0)
{ {
if(Falloff == "Gaussian") if (Falloff == "Gaussian")
BSSRDF = Color * bssrdf_gaussian(N, Scale * Radius, TextureBlur); BSSRDF = Color * bssrdf_gaussian(N, Scale * Radius, TextureBlur);
else else
BSSRDF = Color * bssrdf_cubic(N, Scale * Radius, TextureBlur, Sharpness); BSSRDF = Color * bssrdf_cubic(N, Scale * Radius, TextureBlur, Sharpness);

@ -89,7 +89,7 @@ static TexSnapshot secondary_snap = {0};
static CursorSnapshot cursor_snap = {0}; static CursorSnapshot cursor_snap = {0};
/* delete overlay cursor textures to preserve memory and invalidate all overlay flags */ /* delete overlay cursor textures to preserve memory and invalidate all overlay flags */
void paint_cursor_delete_textures() void paint_cursor_delete_textures(void)
{ {
glDeleteTextures(1, &primary_snap.overlay_texture); glDeleteTextures(1, &primary_snap.overlay_texture);
glDeleteTextures(1, &secondary_snap.overlay_texture); glDeleteTextures(1, &secondary_snap.overlay_texture);

@ -4685,7 +4685,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, 1000.0); RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_text(prop, "Scale", RNA_def_property_ui_text(prop, "Scale",
"Instead of automatically normalizing to 0..1, " "Instead of automatically normalizing to 0..1, "
"apply a user scale to the derivative map."); "apply a user scale to the derivative map");
/* stamp */ /* stamp */