Blender  V3.3
kernel/svm/camera.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
7 
10  ccl_private float *stack,
11  uint out_vector,
12  uint out_zdepth,
13  uint out_distance)
14 {
15  float distance;
16  float zdepth;
17  float3 vector;
18 
19  Transform tfm = kernel_data.cam.worldtocamera;
20  vector = transform_point(&tfm, sd->P);
21  zdepth = vector.z;
22  distance = len(vector);
23 
24  if (stack_valid(out_vector))
25  stack_store_float3(stack, out_vector, normalize(vector));
26 
27  if (stack_valid(out_zdepth))
28  stack_store_float(stack, out_zdepth, zdepth);
29 
30  if (stack_valid(out_distance))
31  stack_store_float(stack, out_distance, distance);
32 }
33 
unsigned int uint
Definition: BLI_sys_types.h:67
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_noinline
Definition: cuda/compat.h:40
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
#define kernel_data
const KernelGlobalsCPU *ccl_restrict KernelGlobals
int len
Definition: draw_manager.c:108
CCL_NAMESPACE_END CCL_NAMESPACE_BEGIN ccl_device_inline float3 transform_point(ccl_private const Transform *t, const float3 a)
CCL_NAMESPACE_BEGIN ccl_device_noinline void svm_node_camera(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint out_vector, uint out_zdepth, uint out_distance)
ccl_device_inline void stack_store_float3(ccl_private float *stack, uint a, float3 f)
ccl_device_inline void stack_store_float(ccl_private float *stack, uint a, float f)
ccl_device_inline bool stack_valid(uint a)
ShaderData
Definition: kernel/types.h:925
T distance(const T &a, const T &b)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)