Blender V5.3
white_noise.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
8#include "kernel/svm/util.h"
9#include "util/hash.h"
10
12
14 ccl_private float *ccl_restrict stack,
16{
17 const float3 vector = stack_load(stack, node.vector);
18 const float w = stack_load(stack, node.w);
19
20 if (stack_valid(node.color_offset)) {
21 float3 color;
22 switch (node.dimensions) {
23 case 1:
24 color = hash_float_to_float3(w);
25 break;
26 case 2:
28 break;
29 case 3:
31 break;
32 case 4:
34 break;
35 default:
36 color = make_float3(1.0f, 0.0f, 1.0f);
38 break;
39 }
40 stack_store_float3(stack, node.color_offset, color);
41 }
42
43 if (stack_valid(node.value_offset)) {
44 float value;
45 switch (node.dimensions) {
46 case 1:
47 value = hash_float_to_float(w);
48 break;
49 case 2:
51 break;
52 case 3:
54 break;
55 case 4:
57 break;
58 default:
59 value = 0.0f;
61 break;
62 }
63 stack_store_float(stack, node.value_offset, value);
64 }
65}
66
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_inline bool stack_valid(const uint a)
ccl_device_inline T stack_load(const ccl_private float *stack, const uint a)
#define kernel_assert(cond)
#define ccl_restrict
#define ccl_private
#define ccl_global
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
float hash_float_to_float(float k)
ccl_device_inline float3 hash_float_to_float3(const float k)
Definition hash.h:300
ccl_device_inline float hash_float3_to_float(const float3 k)
Definition hash.h:227
ccl_device_inline float3 hash_float2_to_float3(const float2 k)
Definition hash.h:307
ccl_device_inline float hash_float2_to_float(const float2 k)
Definition hash.h:222
ccl_device_inline float hash_float4_to_float(const float4 k)
Definition hash.h:232
ccl_device_inline float3 hash_float4_to_float3(const float4 k)
Definition hash.h:314
ccl_device_inline float3 hash_float3_to_float3(const float3 k)
Definition hash.h:283
#define make_float2
#define make_float4
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_tex_white_noise(ccl_private float *ccl_restrict stack, const ccl_global SVMNodeTexWhiteNoise &ccl_restrict node)
Definition white_noise.h:13