29 const float alpha = r.
w;
79 const int num_nodes = (int)node.
y;
82 const int next_offset = offset + num_nodes;
85 const int tx = (int)tex_co.
x;
86 const int ty = (int)tex_co.
y;
89 if (tx >= 0 && ty >= 0 && tx < 10) {
90 const int tile = 1001 + 10 * ty + tx;
93 for (
int i = 0;
i < num_nodes;
i++) {
95 if (tile_node.
x ==
tile) {
99 if (tile_node.
z ==
tile) {
113 offset = next_offset;
148 N /= (
N.x +
N.y +
N.z);
162 const float limit = 0.5f * (1.0f +
blend);
165 if (
N.x > limit * (
N.x +
N.y) &&
N.x > limit * (
N.x +
N.z)) {
168 else if (
N.y > limit * (
N.x +
N.y) &&
N.y > limit * (
N.y +
N.z)) {
171 else if (
N.z > limit * (
N.x +
N.z) &&
N.z > limit * (
N.y +
N.z)) {
174 else if (
blend > 0.0f) {
176 if (
N.z < (1.0f - limit) * (
N.y +
N.x)) {
177 weight.
x =
N.x / (
N.x +
N.y);
179 weight.
y = 1.0f - weight.
x;
181 else if (
N.x < (1.0f - limit) * (
N.y +
N.z)) {
182 weight.
y =
N.y / (
N.y +
N.z);
184 weight.
z = 1.0f - weight.
y;
186 else if (
N.y < (1.0f - limit) * (
N.x +
N.z)) {
187 weight.
x =
N.x / (
N.x +
N.z);
189 weight.
z = 1.0f - weight.
x;
193 weight.
x = ((2.0f - limit) *
N.x + (limit - 1.0f)) / (2.0f * limit - 1.0f);
194 weight.
y = ((2.0f - limit) *
N.y + (limit - 1.0f)) / (2.0f * limit - 1.0f);
195 weight.
z = ((2.0f - limit) *
N.z + (limit - 1.0f)) / (2.0f * limit - 1.0f);
211 const uint id = node.
y;
216 if (weight.
x > 0.0f) {
220 if (weight.
y > 0.0f) {
224 if (weight.
z > 0.0f) {
242 const uint id = node.
y;
247 const uint projection = node.
w;
256 if (projection == 0) {
bool map_to_sphere(float *r_u, float *r_v, float x, float y, float z)
bool map_to_tube(float *r_u, float *r_v, float x, float y, float z)
ccl_device float4 color_srgb_to_linear_v4(const float4 c)
ccl_device float2 direction_to_mirrorball(float3 dir)
ccl_device float2 direction_to_equirectangular(const float3 dir)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, const int id, const float x, float y)
ccl_device_noinline void svm_node_tex_image_box(KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, const uint4 node)
ccl_device_noinline int svm_node_tex_image(KernelGlobals kg, ccl_private ShaderData *, ccl_private float *stack, const uint4 node, int offset)
ccl_device_noinline void svm_node_tex_environment(KernelGlobals kg, ccl_private ShaderData *, ccl_private float *stack, const uint4 node)
CCL_NAMESPACE_BEGIN ccl_device float4 svm_image_texture(KernelGlobals kg, const int id, const float x, float y, const uint flags)
ccl_device_inline float3 texco_remap_square(const float3 co)
ccl_device_inline void stack_store_float(ccl_private float *stack, const uint a, const float f)
ccl_device_inline uint4 read_node(KernelGlobals kg, ccl_private int *const offset)
ccl_device_inline void stack_store_float3(ccl_private float *stack, const uint a, const float3 f)
ccl_device_forceinline void svm_unpack_node_uchar4(const uint i, ccl_private uint *x, ccl_private uint *y, ccl_private uint *z, ccl_private uint *w)
ccl_device_inline bool stack_valid(const uint a)
CCL_NAMESPACE_BEGIN ccl_device_inline float3 stack_load_float3(const ccl_private float *stack, const uint a)
const ThreadKernelGlobalsCPU * KernelGlobals
#define ccl_device_inline
#define ccl_device_noinline
#define CCL_NAMESPACE_END
const ccl_global KernelWorkTile * tile
ccl_device_inline void object_inverse_normal_transform(KernelGlobals kg, const ccl_private ShaderData *sd, ccl_private float3 *N)
@ NODE_IMAGE_COMPRESS_AS_SRGB
@ NODE_IMAGE_ALPHA_UNASSOCIATE
ccl_device_inline float2 safe_normalize(const float2 a)
CCL_NAMESPACE_BEGIN ccl_device_inline float4 zero_float4()
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)