Blender  V2.93
svm_sepcomb_vector.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2014 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 /* Vector combine / separate, used for the RGB and XYZ nodes */
20 
22  ShaderData *sd, float *stack, uint in_offset, uint vector_index, uint out_offset)
23 {
24  float vector = stack_load_float(stack, in_offset);
25 
26  if (stack_valid(out_offset))
27  stack_store_float(stack, out_offset + vector_index, vector);
28 }
29 
31  ShaderData *sd, float *stack, uint ivector_offset, uint vector_index, uint out_offset)
32 {
33  float3 vector = stack_load_float3(stack, ivector_offset);
34 
35  if (stack_valid(out_offset)) {
36  if (vector_index == 0)
37  stack_store_float(stack, out_offset, vector.x);
38  else if (vector_index == 1)
39  stack_store_float(stack, out_offset, vector.y);
40  else
41  stack_store_float(stack, out_offset, vector.z);
42  }
43 }
44 
unsigned int uint
Definition: BLI_sys_types.h:83
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(float *stack, uint a)
ccl_device_inline float stack_load_float(float *stack, uint a)
ccl_device_inline void stack_store_float(float *stack, uint a, float f)
ccl_device_inline bool stack_valid(uint a)
#define ccl_device
#define CCL_NAMESPACE_END
ShaderData
CCL_NAMESPACE_BEGIN ccl_device void svm_node_combine_vector(ShaderData *sd, float *stack, uint in_offset, uint vector_index, uint out_offset)
ccl_device void svm_node_separate_vector(ShaderData *sd, float *stack, uint ivector_offset, uint vector_index, uint out_offset)