diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_mesh.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/blender/blender_shader.cpp | 48 | ||||
-rw-r--r-- | intern/cycles/blender/blender_texture.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 18 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/shaders/node_environment_texture.osl | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_attribute.h | 11 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_voxel.h | 9 | ||||
-rw-r--r-- | intern/cycles/render/mesh_displace.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/nodes.cpp | 60 | ||||
-rw-r--r-- | intern/cycles/render/nodes.h | 1 | ||||
-rw-r--r-- | intern/cycles/render/svm.cpp | 6 | ||||
-rw-r--r-- | intern/cycles/render/tile.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 19 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 7 |
19 files changed, 117 insertions, 100 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 7135e938afb..c2ccef548c7 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -85,7 +85,7 @@ static void mikk_get_texture_coordinate(const SMikkTSpaceContext *context, float BL::MeshTextureFace tf = userdata->layer->data[face_num]; float3 tfuv; - switch (vert_num) { + switch(vert_num) { case 0: tfuv = get_float3(tf.uv1()); break; diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 04d05ee7b3c..088748cc0ae 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -1194,7 +1194,8 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name, void if(b_node.is_a(&RNA_ShaderNodeTexPointDensity)) { BL::ShaderNodeTexPointDensity b_point_density_node(b_node); int length; - b_point_density_node.calc_point_density(b_scene, &length, &pixels); + int settings = background ? 1 : 0; /* 1 - render settings, 0 - vewport settings. */ + b_point_density_node.calc_point_density(b_scene, settings, &length, &pixels); } } diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 42aab52e294..11bb18a888b 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -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) { - switch (b_socket.type()) { + switch(b_socket.type()) { case BL::NodeSocket::type_VALUE: return SHADER_SOCKET_FLOAT; case BL::NodeSocket::type_INT: @@ -107,8 +107,15 @@ static ShaderSocketType convert_socket_type(BL::NodeSocket b_socket) } } -static void set_default_value(ShaderInput *input, BL::NodeSocket b_sock, BL::BlendData b_data, BL::ID b_id) +template <class SocketType> +static void set_default_value(ShaderInput *input, + SocketType b_sock, + BL::BlendData b_data, + BL::ID b_id) { + /* TODO(sergey): Use static assert to check SocketType is either BL::NodeSocket + * or BL::NodeSocketInterface. + */ /* copy values for non linked inputs */ switch(input->type) { case SHADER_SOCKET_FLOAT: { @@ -283,7 +290,7 @@ static ShaderNode *add_node(Scene *scene, else if(b_node.is_a(&RNA_ShaderNodeVectorTransform)) { BL::ShaderNodeVectorTransform b_vector_transform_node(b_node); VectorTransformNode *vtransform = new VectorTransformNode(); - vtransform->type = VectorTransformNode::type_enum[b_vector_transform_node.type()]; + vtransform->type = VectorTransformNode::type_enum[b_vector_transform_node.vector_type()]; vtransform->convert_from = VectorTransformNode::convert_space_enum[b_vector_transform_node.convert_from()]; vtransform->convert_to = VectorTransformNode::convert_space_enum[b_vector_transform_node.convert_to()]; node = vtransform; @@ -332,17 +339,16 @@ static ShaderNode *add_node(Scene *scene, BL::ShaderNodeBsdfAnisotropic b_aniso_node(b_node); AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode(); - switch (b_aniso_node.distribution()) - { - case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN: - aniso->distribution = ustring("Beckmann"); - break; - case BL::ShaderNodeBsdfAnisotropic::distribution_GGX: - aniso->distribution = ustring("GGX"); - break; - case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY: - aniso->distribution = ustring("Ashikhmin-Shirley"); - break; + switch(b_aniso_node.distribution()) { + case BL::ShaderNodeBsdfAnisotropic::distribution_BECKMANN: + aniso->distribution = ustring("Beckmann"); + break; + case BL::ShaderNodeBsdfAnisotropic::distribution_GGX: + aniso->distribution = ustring("GGX"); + break; + case BL::ShaderNodeBsdfAnisotropic::distribution_ASHIKHMIN_SHIRLEY: + aniso->distribution = ustring("Ashikhmin-Shirley"); + break; } node = aniso; @@ -633,11 +639,12 @@ static ShaderNode *add_node(Scene *scene, if(b_image.is_updated()) { scene->image_manager->tag_reload_image(env->filename, env->builtin_data, - INTERPOLATION_LINEAR, + (InterpolationType)b_env_node.interpolation(), EXTENSION_REPEAT); } } env->color_space = EnvironmentTextureNode::color_space_enum[(int)b_env_node.color_space()]; + env->interpolation = (InterpolationType)b_env_node.interpolation(); env->projection = EnvironmentTextureNode::projection_enum[(int)b_env_node.projection()]; get_tex_mapping(&env->tex_mapping, b_env_node.texture_mapping()); node = env; @@ -767,7 +774,7 @@ static ShaderNode *add_node(Scene *scene, point_density->filename, point_density->builtin_data, point_density->interpolation, - EXTENSION_REPEAT); + EXTENSION_CLIP); } node = point_density; } @@ -911,7 +918,8 @@ static void add_nodes(Scene *scene, * Do this even if the node group has no internal tree, * so that links have something to connect to and assert won't fail. */ - for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) { + int input_index = 0; + for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input, ++input_index) { ProxyNode *proxy = new ProxyNode(convert_socket_type(*b_input)); graph->add(proxy); @@ -920,7 +928,11 @@ static void add_nodes(Scene *scene, input_map[b_input->ptr.data] = proxy->inputs[0]; - set_default_value(proxy->inputs[0], *b_input, b_data, b_ntree); + /* Use default value from corresponding socket interface since it's + * not copied from group to actual group node. + */ + BL::NodeSocketInterface socket_interface = b_group_ntree.inputs[input_index]; + set_default_value(proxy->inputs[0], socket_interface, b_data, b_ntree); } for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) { ProxyNode *proxy = new ProxyNode(convert_socket_type(*b_output)); diff --git a/intern/cycles/blender/blender_texture.cpp b/intern/cycles/blender/blender_texture.cpp index cb4dd1792d0..18f66560b10 100644 --- a/intern/cycles/blender/blender_texture.cpp +++ b/intern/cycles/blender/blender_texture.cpp @@ -68,10 +68,12 @@ static void density_particle_system_texture_space( float3 particle_size = make_float3(radius, radius, radius); for(int i = 0; i < b_particle_system.particles.length(); ++i) { BL::Particle particle = b_particle_system.particles[i]; - float3 location = get_float3(particle.location()); - location = transform_point(&itfm, location); - min = ccl::min(min, location - particle_size); - max = ccl::max(max, location + particle_size); + if(particle.alive_state() == BL::Particle::alive_state_ALIVE) { + float3 location = get_float3(particle.location()); + location = transform_point(&itfm, location); + min = ccl::min(min, location - particle_size); + max = ccl::max(max, location + particle_size); + } } /* Calculate texture space from the particle bounds. */ loc = (min + max) * 0.5f; diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index a7157e2b041..7f16a73d966 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -581,7 +581,7 @@ public: ProgramName program_name, thread_scoped_lock& slot_locker) { - switch (program_name) { + switch(program_name) { case OCL_DEV_BASE_PROGRAM: store_something<cl_program>(platform, device, @@ -3690,7 +3690,7 @@ string device_opencl_capabilities(void) APPEND_STRING_INFO(clGetDeviceInfo, id, "\t\t\tDevice " name, what) 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]; result += string_printf("Platform #%u\n", platform); @@ -3715,7 +3715,7 @@ string device_opencl_capabilities(void) num_devices, &device_ids[0], 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]; result += string_printf("\t\tDevice: #%u\n", device); diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 2b305e5488d..0cb56461f29 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -150,7 +150,7 @@ ccl_device bool is_aa_pass(ShaderEvalType type) ccl_device bool is_light_pass(ShaderEvalType type) { - switch (type) { + switch(type) { case SHADER_EVAL_AO: case SHADER_EVAL_COMBINED: case SHADER_EVAL_SHADOW: @@ -262,7 +262,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, sample); } - switch (type) { + switch(type) { /* data passes */ case SHADER_EVAL_NORMAL: { diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index ed145b4a967..04c4cf35587 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -144,7 +144,7 @@ template<typename T> struct texture_image { iy = wrap_periodic(iy, height); break; 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); } /* Fall through. */ @@ -168,7 +168,7 @@ template<typename T> struct texture_image { niy = wrap_periodic(iy+1, height); break; 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); } /* Fall through. */ @@ -208,7 +208,7 @@ template<typename T> struct texture_image { nniy = wrap_periodic(iy+2, height); break; 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); } /* Fall through. */ @@ -279,7 +279,9 @@ template<typename T> struct texture_image { iz = wrap_periodic(iz, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ @@ -308,7 +310,9 @@ template<typename T> struct texture_image { niz = wrap_periodic(iz+1, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ @@ -363,7 +367,9 @@ template<typename T> struct texture_image { nniz = wrap_periodic(iz+2, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index cb6f2311ad8..aa2befd6e98 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -104,7 +104,7 @@ public: const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy, const OSL::Vec3 &dPdz, int nchannels, float *result); -#if OSL_LIBRARY_VERSION_CODE >= 10700 +#if OSL_LIBRARY_VERSION_CODE >= 10600 bool texture(ustring filename, TextureHandle * /*texture_handle*/, TexturePerthread * /*texture_thread_info*/, @@ -117,6 +117,7 @@ public: float * /*dresultds*/, float * /*dresultdt*/) { + /* TODO(sergey): Support derivatives. */ return texture(filename, options, sg, @@ -141,6 +142,7 @@ public: float * /*dresultdt*/, float * /*dresultdr*/) { + /* TODO(sergey): Support derivatives. */ return texture3d(filename, options, sg, diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl index 14f0226a0e5..3a0b782c98e 100644 --- a/intern/cycles/kernel/shaders/node_environment_texture.osl +++ b/intern/cycles/kernel/shaders/node_environment_texture.osl @@ -45,6 +45,7 @@ shader node_environment_texture( vector Vector = P, string filename = "", string projection = "Equirectangular", + string interpolation = "linear", string color_space = "sRGB", int is_float = 1, int use_alpha = 1, @@ -64,7 +65,7 @@ shader node_environment_texture( p = environment_texture_direction_to_mirrorball(p); /* todo: use environment for better texture filtering of equirectangular */ - Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha); + Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "interp", interpolation, "alpha", Alpha); if (use_alpha) { Color = color_unpremultiply(Color, Alpha); diff --git a/intern/cycles/kernel/svm/svm_attribute.h b/intern/cycles/kernel/svm/svm_attribute.h index 025ae96f59d..63bbb27d873 100644 --- a/intern/cycles/kernel/svm/svm_attribute.h +++ b/intern/cycles/kernel/svm/svm_attribute.h @@ -22,6 +22,8 @@ ccl_device void svm_node_attr_init(KernelGlobals *kg, ShaderData *sd, uint4 node, NodeAttributeType *type, NodeAttributeType *mesh_type, AttributeElement *elem, int *offset, uint *out_offset) { + *out_offset = node.z; + *type = (NodeAttributeType)node.w; if(ccl_fetch(sd, object) != OBJECT_NONE) { /* find attribute by unique id */ uint id = node.y; @@ -32,6 +34,12 @@ ccl_device void svm_node_attr_init(KernelGlobals *kg, ShaderData *sd, uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset); while(attr_map.x != id) { + if(UNLIKELY(attr_map.x == ATTR_STD_NONE)) { + *elem = ATTR_ELEMENT_NONE; + *offset = 0; + *mesh_type = (NodeAttributeType)node.w; + return; + } attr_offset += ATTR_PRIM_TYPES; attr_map = kernel_tex_fetch(__attributes_map, attr_offset); } @@ -47,9 +55,6 @@ ccl_device void svm_node_attr_init(KernelGlobals *kg, ShaderData *sd, *offset = 0; *mesh_type = (NodeAttributeType)node.w; } - - *out_offset = node.z; - *type = (NodeAttributeType)node.w; } ccl_device void svm_node_attr(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node) diff --git a/intern/cycles/kernel/svm/svm_voxel.h b/intern/cycles/kernel/svm/svm_voxel.h index bbb687dfce5..31cad5ec887 100644 --- a/intern/cycles/kernel/svm/svm_voxel.h +++ b/intern/cycles/kernel/svm/svm_voxel.h @@ -43,15 +43,6 @@ ccl_device void svm_node_tex_voxel(KernelGlobals *kg, tfm.w = read_node_float(kg, offset); co = transform_point(&tfm, co); } - if(co.x < 0.0f || co.y < 0.0f || co.z < 0.0f || - co.x > 1.0f || co.y > 1.0f || co.z > 1.0f) - { - if (stack_valid(density_out_offset)) - stack_store_float(stack, density_out_offset, 0.0f); - if (stack_valid(color_out_offset)) - stack_store_float3(stack, color_out_offset, make_float3(0.0f, 0.0f, 0.0f)); - return; - } float4 r = kernel_tex_image_interp_3d(id, co.x, co.y, co.z); if (stack_valid(density_out_offset)) stack_store_float(stack, density_out_offset, r.w); diff --git a/intern/cycles/render/mesh_displace.cpp b/intern/cycles/render/mesh_displace.cpp index 1ba0c7f7291..801fffc774c 100644 --- a/intern/cycles/render/mesh_displace.cpp +++ b/intern/cycles/render/mesh_displace.cpp @@ -78,7 +78,7 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me int prim = mesh->tri_offset + i; float u, v; - switch (j) { + switch(j) { case 0: u = 1.0f; v = 0.0f; diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 7ed07ab6453..bb76383c5cf 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -182,6 +182,21 @@ static ShaderEnum image_projection_init() return enm; } +static const char* get_osl_interpolation_parameter(InterpolationType interpolation) +{ + switch(interpolation) { + case INTERPOLATION_CLOSEST: + return "closest"; + case INTERPOLATION_CUBIC: + return "cubic"; + case INTERPOLATION_SMART: + return "smart"; + case INTERPOLATION_LINEAR: + default: + return "linear"; + } +} + ShaderEnum ImageTextureNode::color_space_enum = color_space_init(); ShaderEnum ImageTextureNode::projection_enum = image_projection_init(); @@ -362,22 +377,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler) compiler.parameter("projection_blend", projection_blend); compiler.parameter("is_float", is_float); compiler.parameter("use_alpha", !alpha_out->links.empty()); - - switch (interpolation) { - case INTERPOLATION_CLOSEST: - compiler.parameter("interpolation", "closest"); - break; - case INTERPOLATION_CUBIC: - compiler.parameter("interpolation", "cubic"); - break; - case INTERPOLATION_SMART: - compiler.parameter("interpolation", "smart"); - break; - case INTERPOLATION_LINEAR: - default: - compiler.parameter("interpolation", "linear"); - break; - } + compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation)); switch(extension) { case EXTENSION_EXTEND: @@ -421,6 +421,7 @@ EnvironmentTextureNode::EnvironmentTextureNode() filename = ""; builtin_data = NULL; color_space = ustring("Color"); + interpolation = INTERPOLATION_LINEAR; projection = ustring("Equirectangular"); animated = false; @@ -434,7 +435,7 @@ EnvironmentTextureNode::~EnvironmentTextureNode() if(image_manager) { image_manager->remove_image(filename, builtin_data, - INTERPOLATION_LINEAR, + interpolation, EXTENSION_REPEAT); } } @@ -477,7 +478,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler) 0, is_float_bool, is_linear, - INTERPOLATION_LINEAR, + interpolation, EXTENSION_REPEAT, use_alpha); is_float = (int)is_float_bool; @@ -546,7 +547,7 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) 0, is_float_bool, is_linear, - INTERPOLATION_LINEAR, + interpolation, EXTENSION_REPEAT, use_alpha); is_float = (int)is_float_bool; @@ -564,6 +565,9 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) compiler.parameter("color_space", "Linear"); else compiler.parameter("color_space", "sRGB"); + + compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation)); + compiler.parameter("is_float", is_float); compiler.parameter("use_alpha", !alpha_out->links.empty()); compiler.add(this, "node_environment_texture"); @@ -1381,7 +1385,7 @@ PointDensityTextureNode::~PointDensityTextureNode() image_manager->remove_image(filename, builtin_data, interpolation, - EXTENSION_REPEAT); + EXTENSION_CLIP); } } @@ -1413,10 +1417,10 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; - if (use_density || use_color) { - if (use_density) + if(use_density || use_color) { + if(use_density) compiler.stack_assign(density_out); - if (use_color) + if(use_color) compiler.stack_assign(color_out); if(slot == -1) { @@ -1425,7 +1429,7 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler) false, 0, is_float, is_linear, interpolation, - EXTENSION_REPEAT, + EXTENSION_CLIP, true); } @@ -1466,14 +1470,14 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler) image_manager = compiler.image_manager; - if (use_density || use_color) { + if(use_density || use_color) { if(slot == -1) { bool is_float, is_linear; slot = image_manager->add_image(filename, builtin_data, false, 0, is_float, is_linear, interpolation, - EXTENSION_REPEAT, + EXTENSION_CLIP, true); } @@ -1484,7 +1488,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler) compiler.parameter("mapping", transform_transpose(tfm)); compiler.parameter("use_mapping", 1); } - switch (interpolation) { + switch(interpolation) { case INTERPOLATION_CLOSEST: compiler.parameter("interpolation", "closest"); break; @@ -1675,7 +1679,7 @@ void ConvertNode::compile(SVMCompiler& compiler) compiler.stack_assign(in); compiler.stack_assign(out); - compiler.add_node(NODE_VALUE_V, in->stack_offset); + compiler.add_node(NODE_VALUE_V, out->stack_offset); compiler.add_node(NODE_VALUE_V, in->value); } } diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 5065e68345a..39709c26398 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -116,6 +116,7 @@ public: void *builtin_data; ustring color_space; ustring projection; + InterpolationType interpolation; bool animated; static ShaderEnum color_space_enum; diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index d0bd34915df..e81b2f3a827 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -121,7 +121,7 @@ int SVMCompiler::stack_size(ShaderSocketType type) { int size = 0; - switch (type) { + switch(type) { case SHADER_SOCKET_FLOAT: case SHADER_SOCKET_INT: size = 1; @@ -624,7 +624,7 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty ShaderNode *node = graph->output(); ShaderInput *clin = NULL; - switch (type) { + switch(type) { case SHADER_TYPE_SURFACE: clin = node->input("Surface"); break; @@ -654,7 +654,7 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty if(clin->link) { bool generate = false; - switch (type) { + switch(type) { case SHADER_TYPE_SURFACE: /* generate surface shader */ generate = true; shader->has_surface = true; diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp index 7e68ce84d94..1bec39431d8 100644 --- a/intern/cycles/render/tile.cpp +++ b/intern/cycles/render/tile.cpp @@ -199,7 +199,7 @@ list<Tile>::iterator TileManager::next_background_tile(int device, TileOrder til int64_t distx = cordx; int64_t disty = cordy; - switch (tile_order) { + switch(tile_order) { case TILE_CENTER: distx = centx - (cur_tile.x + (cur_tile.w / 2)); disty = centy - (cur_tile.y + (cur_tile.h / 2)); diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index af992bf5a3c..9baa66abad9 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -358,27 +358,20 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, int bounds[4], const int mouse_ungrab_xy[2]) { GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; - GHOST_Rect bounds_rect, bounds_win; - GHOST_TInt32 mouse_ungrab_xy_global[2]; + GHOST_Rect bounds_rect; + GHOST_TInt32 mouse_xy[2]; if (bounds) { - /* if this is X11 specific we need a function that converts */ - window->getClientBounds(bounds_win); - window->clientToScreen(bounds[0], bounds_win.getHeight() - bounds[1], bounds_rect.m_l, bounds_rect.m_t); - window->clientToScreen(bounds[2], bounds_win.getHeight() - bounds[3], bounds_rect.m_r, bounds_rect.m_b); - + bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]); } - if (mouse_ungrab_xy) { - if (bounds == NULL) - window->getClientBounds(bounds_win); - window->clientToScreen(mouse_ungrab_xy[0], bounds_win.getHeight() - mouse_ungrab_xy[1], - mouse_ungrab_xy_global[0], mouse_ungrab_xy_global[1]); + mouse_xy[0] = mouse_ungrab_xy[0]; + mouse_xy[1] = mouse_ungrab_xy[1]; } return window->setCursorGrab(mode, bounds ? &bounds_rect : NULL, - mouse_ungrab_xy ? mouse_ungrab_xy_global : NULL); + mouse_ungrab_xy ? mouse_xy : NULL); } diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index b9686e5af9b..37c2ac12315 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1317,6 +1317,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y; window->getCursorGrabInitPos(x_warp, y_warp); + window->screenToClientIntern(x_warp, y_warp, x_warp, y_warp); window->getCursorGrabAccum(x_accum, y_accum); x_accum += [event deltaX]; @@ -1368,6 +1369,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) //Post event window->getCursorGrabInitPos(x_cur, y_cur); + window->screenToClientIntern(x_cur, y_cur, x_cur, y_cur); window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y); pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y)); break; diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 9c7b5c3fee7..204d61de3df 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -1463,12 +1463,9 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode if (mode != GHOST_kGrabDisable) { //No need to perform grab without warp as it is always on in OS X if (mode != GHOST_kGrabNormal) { - GHOST_TInt32 x_old,y_old; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - m_systemCocoa->getCursorPosition(x_old,y_old); - screenToClientIntern(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]); - //Warp position is stored in client (window base) coordinates + m_systemCocoa->getCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]); setCursorGrabAccum(0, 0); if (mode == GHOST_kGrabHide) { @@ -1486,7 +1483,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode } else { if (m_cursorGrab==GHOST_kGrabHide) { - //No need to set again cursor position, as it has not changed for Cocoa + m_systemCocoa->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]); setWindowCursorVisibility(true); } |