Blender V5.0
kernel/svm/camera.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
7#include "kernel/globals.h"
8
9#include "kernel/svm/util.h"
10
12
14 ccl_private ShaderData *sd,
15 ccl_private float *stack,
16 const uint out_vector,
17 const uint out_zdepth,
18 const uint out_distance)
19{
20 float distance;
21 float zdepth;
23
24 const Transform tfm = kernel_data.cam.worldtocamera;
25 vector = transform_point(&tfm, sd->P);
26 zdepth = vector.z;
28
29 if (stack_valid(out_vector)) {
30 stack_store_float3(stack, out_vector, normalize(vector));
31 }
32
33 if (stack_valid(out_zdepth)) {
34 stack_store_float(stack, out_zdepth, zdepth);
35 }
36
37 if (stack_valid(out_distance)) {
38 stack_store_float(stack, out_distance, distance);
39 }
40}
41
unsigned int uint
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)
#define kernel_data
#define ccl_private
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_noinline
#define CCL_NAMESPACE_END
VecBase< float, D > normalize(VecOp< float, D >) RET
float distance(VecOp< float, D >, VecOp< float, D >) RET
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_camera(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, const uint out_vector, const uint out_zdepth, const uint out_distance)
ccl_device_inline float3 transform_point(const ccl_private Transform *t, const float3 a)
Definition transform.h:56
uint len