Blender V4.5
blackbody.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#pragma once
9
10#include "kernel/globals.h"
11
13#include "kernel/svm/util.h"
14
16
18
19/* Blackbody Node */
20
22 ccl_private ShaderData *sd,
23 ccl_private float *stack,
24 const uint temperature_offset,
25 const uint col_offset)
26{
27 /* Input */
28 const float temperature = stack_load_float(stack, temperature_offset);
29
30 float3 color_rgb = rec709_to_rgb(kg, svm_math_blackbody_color_rec709(temperature));
31 color_rgb = max(color_rgb, zero_float3());
32
33 stack_store_float3(stack, col_offset, color_rgb);
34}
35
unsigned int uint
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_blackbody(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, const uint temperature_offset, const uint col_offset)
Definition blackbody.h:21
ccl_device_inline float stack_load_float(const ccl_private float *stack, const uint a)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_noinline
#define CCL_NAMESPACE_END
ccl_device float3 rec709_to_rgb(KernelGlobals kg, const float3 rec709)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
Definition math_float3.h:15
ccl_device float3 svm_math_blackbody_color_rec709(const float t)
Definition math_util.h:207
max
Definition text_draw.cc:251