Cycles: Cleanup, whitespace around keywords

This commit is contained in:
Sergey Sharybin
2015-10-08 19:08:28 +05:00
parent 7083423eb4
commit 350cf8ea7f
10 changed files with 38 additions and 39 deletions

View File

@@ -85,7 +85,7 @@ static void mikk_get_texture_coordinate(const SMikkTSpaceContext *context, float
BL::MeshTextureFace tf = userdata->layer->data[face_num]; BL::MeshTextureFace tf = userdata->layer->data[face_num];
float3 tfuv; float3 tfuv;
switch (vert_num) { switch(vert_num) {
case 0: case 0:
tfuv = get_float3(tf.uv1()); tfuv = get_float3(tf.uv1());
break; break;

View File

@@ -88,7 +88,7 @@ static float3 get_node_output_vector(BL::Node b_node, const string& name)
static ShaderSocketType convert_socket_type(BL::NodeSocket b_socket) static ShaderSocketType convert_socket_type(BL::NodeSocket b_socket)
{ {
switch (b_socket.type()) { switch(b_socket.type()) {
case BL::NodeSocket::type_VALUE: case BL::NodeSocket::type_VALUE:
return SHADER_SOCKET_FLOAT; return SHADER_SOCKET_FLOAT;
case BL::NodeSocket::type_INT: case BL::NodeSocket::type_INT:
@@ -339,17 +339,16 @@ static ShaderNode *add_node(Scene *scene,
BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node); BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node);
AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode(); AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode();
switch (b_aniso_node.distribution()) switch(b_aniso_node.distribution()) {
{ case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN:
case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN: aniso->distribution = ustring("Beckmann");
aniso->distribution = ustring("Beckmann"); break;
break; case BL::ShaderNodeBsdfAnisotropic::distribution_GGX:
case BL::ShaderNodeBsdfAnisotropic::distribution_GGX: aniso->distribution = ustring("GGX");
aniso->distribution = ustring("GGX"); break;
break; case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY:
case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY: aniso->distribution = ustring("Ashikhmin-Shirley");
aniso->distribution = ustring("Ashikhmin-Shirley"); break;
break;
} }
node = aniso; node = aniso;

View File

@@ -68,7 +68,7 @@ static void density_particle_system_texture_space(
float3 particle_size = make_float3(radius, radius, radius); float3 particle_size = make_float3(radius, radius, radius);
for(int i = 0; i < b_particle_system.particles.length(); ++i) { for(int i = 0; i < b_particle_system.particles.length(); ++i) {
BL::Particle particle = b_particle_system.particles[i]; BL::Particle particle = b_particle_system.particles[i];
if (particle.alive_state() == BL::Particle::alive_state_ALIVE) { if(particle.alive_state() == BL::Particle::alive_state_ALIVE) {
float3 location = get_float3(particle.location()); float3 location = get_float3(particle.location());
location = transform_point(&itfm, location); location = transform_point(&itfm, location);
min = ccl::min(min, location - particle_size); min = ccl::min(min, location - particle_size);

View File

@@ -581,7 +581,7 @@ public:
ProgramName program_name, ProgramName program_name,
thread_scoped_lock& slot_locker) thread_scoped_lock& slot_locker)
{ {
switch (program_name) { switch(program_name) {
case OCL_DEV_BASE_PROGRAM: case OCL_DEV_BASE_PROGRAM:
store_something<cl_program>(platform, store_something<cl_program>(platform,
device, device,
@@ -3690,7 +3690,7 @@ string device_opencl_capabilities(void)
APPEND_STRING_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what) APPEND_STRING_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what)
vector<cl_device_id> device_ids; vector<cl_device_id> device_ids;
for (cl_uint platform = 0; platform < num_platforms; ++platform) { for(cl_uint platform = 0; platform < num_platforms; ++platform) {
cl_platform_id platform_id = platform_ids[platform]; cl_platform_id platform_id = platform_ids[platform];
result += string_printf("Platform #%u\n", platform); result += string_printf("Platform #%u\n", platform);
@@ -3715,7 +3715,7 @@ string device_opencl_capabilities(void)
num_devices, num_devices,
&device_ids[0], &device_ids[0],
NULL)); NULL));
for (cl_uint device = 0; device < num_devices; ++device) { for(cl_uint device = 0; device < num_devices; ++device) {
cl_device_id device_id = device_ids[device]; cl_device_id device_id = device_ids[device];
result += string_printf("\t\tDevice: #%u\n", device); result += string_printf("\t\tDevice: #%u\n", device);

View File

@@ -150,7 +150,7 @@ ccl_device bool is_aa_pass(ShaderEvalType type)
ccl_device bool is_light_pass(ShaderEvalType type) ccl_device bool is_light_pass(ShaderEvalType type)
{ {
switch (type) { switch(type) {
case SHADER_EVAL_AO: case SHADER_EVAL_AO:
case SHADER_EVAL_COMBINED: case SHADER_EVAL_COMBINED:
case SHADER_EVAL_SHADOW: case SHADER_EVAL_SHADOW:
@@ -262,7 +262,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
sample); sample);
} }
switch (type) { switch(type) {
/* data passes */ /* data passes */
case SHADER_EVAL_NORMAL: case SHADER_EVAL_NORMAL:
{ {

View File

@@ -144,7 +144,7 @@ template<typename T> struct texture_image {
iy = wrap_periodic(iy, height); iy = wrap_periodic(iy, height);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
/* Fall through. */ /* Fall through. */
@@ -168,7 +168,7 @@ template<typename T> struct texture_image {
niy = wrap_periodic(iy+1, height); niy = wrap_periodic(iy+1, height);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
/* Fall through. */ /* Fall through. */
@@ -208,7 +208,7 @@ template<typename T> struct texture_image {
nniy = wrap_periodic(iy+2, height); nniy = wrap_periodic(iy+2, height);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
/* Fall through. */ /* Fall through. */
@@ -279,8 +279,8 @@ template<typename T> struct texture_image {
iz = wrap_periodic(iz, depth); iz = wrap_periodic(iz, depth);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || z < 0.0f || if(x < 0.0f || y < 0.0f || z < 0.0f ||
x > 1.0f || y > 1.0f || z > 1.0f) x > 1.0f || y > 1.0f || z > 1.0f)
{ {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
@@ -310,8 +310,8 @@ template<typename T> struct texture_image {
niz = wrap_periodic(iz+1, depth); niz = wrap_periodic(iz+1, depth);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || z < 0.0f || if(x < 0.0f || y < 0.0f || z < 0.0f ||
x > 1.0f || y > 1.0f || z > 1.0f) x > 1.0f || y > 1.0f || z > 1.0f)
{ {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }
@@ -367,8 +367,8 @@ template<typename T> struct texture_image {
nniz = wrap_periodic(iz+2, depth); nniz = wrap_periodic(iz+2, depth);
break; break;
case EXTENSION_CLIP: case EXTENSION_CLIP:
if (x < 0.0f || y < 0.0f || z < 0.0f || if(x < 0.0f || y < 0.0f || z < 0.0f ||
x > 1.0f || y > 1.0f || z > 1.0f) x > 1.0f || y > 1.0f || z > 1.0f)
{ {
return make_float4(0.0f, 0.0f, 0.0f, 0.0f); return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
} }

View File

@@ -78,7 +78,7 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
int prim = mesh->tri_offset + i; int prim = mesh->tri_offset + i;
float u, v; float u, v;
switch (j) { switch(j) {
case 0: case 0:
u = 1.0f; u = 1.0f;
v = 0.0f; v = 0.0f;

View File

@@ -184,7 +184,7 @@ static ShaderEnum image_projection_init()
static const char* get_osl_interpolation_parameter(InterpolationType interpolation) static const char* get_osl_interpolation_parameter(InterpolationType interpolation)
{ {
switch (interpolation) { switch(interpolation) {
case INTERPOLATION_CLOSEST: case INTERPOLATION_CLOSEST:
return "closest"; return "closest";
case INTERPOLATION_CUBIC: case INTERPOLATION_CUBIC:
@@ -1417,10 +1417,10 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler)
image_manager = compiler.image_manager; image_manager = compiler.image_manager;
if (use_density || use_color) { if(use_density || use_color) {
if (use_density) if(use_density)
compiler.stack_assign(density_out); compiler.stack_assign(density_out);
if (use_color) if(use_color)
compiler.stack_assign(color_out); compiler.stack_assign(color_out);
if(slot == -1) { if(slot == -1) {
@@ -1470,7 +1470,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
image_manager = compiler.image_manager; image_manager = compiler.image_manager;
if (use_density || use_color) { if(use_density || use_color) {
if(slot == -1) { if(slot == -1) {
bool is_float, is_linear; bool is_float, is_linear;
slot = image_manager->add_image(filename, builtin_data, slot = image_manager->add_image(filename, builtin_data,
@@ -1488,7 +1488,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler)
compiler.parameter("mapping", transform_transpose(tfm)); compiler.parameter("mapping", transform_transpose(tfm));
compiler.parameter("use_mapping", 1); compiler.parameter("use_mapping", 1);
} }
switch (interpolation) { switch(interpolation) {
case INTERPOLATION_CLOSEST: case INTERPOLATION_CLOSEST:
compiler.parameter("interpolation", "closest"); compiler.parameter("interpolation", "closest");
break; break;

View File

@@ -121,7 +121,7 @@ int SVMCompiler::stack_size(ShaderSocketType type)
{ {
int size = 0; int size = 0;
switch (type) { switch(type) {
case SHADER_SOCKET_FLOAT: case SHADER_SOCKET_FLOAT:
case SHADER_SOCKET_INT: case SHADER_SOCKET_INT:
size = 1; size = 1;
@@ -624,7 +624,7 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
ShaderNode *node = graph->output(); ShaderNode *node = graph->output();
ShaderInput *clin = NULL; ShaderInput *clin = NULL;
switch (type) { switch(type) {
case SHADER_TYPE_SURFACE: case SHADER_TYPE_SURFACE:
clin = node->input("Surface"); clin = node->input("Surface");
break; break;
@@ -654,7 +654,7 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
if(clin->link) { if(clin->link) {
bool generate = false; bool generate = false;
switch (type) { switch(type) {
case SHADER_TYPE_SURFACE: /* generate surface shader */ case SHADER_TYPE_SURFACE: /* generate surface shader */
generate = true; generate = true;
shader->has_surface = true; shader->has_surface = true;

View File

@@ -199,7 +199,7 @@ list<Tile>::iterator TileManager::next_background_tile(int device, TileOrder til
int64_t distx = cordx; int64_t distx = cordx;
int64_t disty = cordy; int64_t disty = cordy;
switch (tile_order) { switch(tile_order) {
case TILE_CENTER: case TILE_CENTER:
distx = centx - (cur_tile.x + (cur_tile.w / 2)); distx = centx - (cur_tile.x + (cur_tile.w / 2));
disty = centy - (cur_tile.y + (cur_tile.h / 2)); disty = centy - (cur_tile.y + (cur_tile.h / 2));