Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/svm/svm_vector_rotate.h
- This file was added.
| /* | |||||
| * Copyright 2011-2014 Blender Foundation | |||||
| * | |||||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| * you may not use this file except in compliance with the License. | |||||
| * You may obtain a copy of the License at | |||||
| * | |||||
| * http://www.apache.org/licenses/LICENSE-2.0 | |||||
| * | |||||
| * Unless required by applicable law or agreed to in writing, software | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | |||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| * See the License for the specific language governing permissions and | |||||
| * limitations under the License. | |||||
| */ | |||||
| CCL_NAMESPACE_BEGIN | |||||
| /* Vector Rotate */ | |||||
| ccl_device void svm_node_vector_rotate(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset) | |||||
| { | |||||
| uint4 node2 = read_node(kg, offset); | |||||
| uint vector_in, origin_in, vector_out; | |||||
| uint x_offset, y_offset, z_offset; | |||||
| decode_node_uchar4(node.y, &vector_in, &origin_in, &vector_out, NULL); | |||||
| decode_node_uchar4(node.z, &x_offset, &y_offset, &z_offset, NULL); | |||||
| float x = stack_load_float_default(stack, x_offset, node2.x); | |||||
| float y = stack_load_float_default(stack, y_offset, node2.y); | |||||
| float z = stack_load_float_default(stack, z_offset, node2.z); | |||||
| float3 in = stack_load_float3(stack, vector_in); | |||||
| float3 origin = stack_load_float3(stack, origin_in); | |||||
| Transform tmat = transform_translate(origin); | |||||
| Transform rmat = transform_euler(make_float3(x, y, z)); | |||||
| Transform mat; | |||||
| mat = tmat * rmat; | |||||
| in = in - origin; | |||||
| in = transform_point(&mat, in); | |||||
| /* Output */ | |||||
| if (stack_valid(vector_out)) { | |||||
| stack_store_float3(stack, vector_out, in); | |||||
| } | |||||
| } | |||||
| CCL_NAMESPACE_END | |||||