Blender  V3.3
texture.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #include "blender/texture.h"
5 
7 
8 namespace {
9 
10 /* Point density helpers. */
11 
13 {
14  if (size.x != 0.0f)
15  size.x = 0.5f / size.x;
16  if (size.y != 0.0f)
17  size.y = 0.5f / size.y;
18  if (size.z != 0.0f)
19  size.z = 0.5f / size.z;
20 
21  loc = loc * size - make_float3(0.5f, 0.5f, 0.5f);
22 }
23 
24 } /* namespace */
25 
27  BL::ShaderNodeTexPointDensity &b_point_density_node,
28  float3 &loc,
29  float3 &size)
30 {
31  BL::Object b_ob(b_point_density_node.object());
32  if (!b_ob) {
33  loc = zero_float3();
34  size = zero_float3();
35  return;
36  }
37  float3 min, max;
38  b_point_density_node.calc_point_density_minmax(b_depsgraph, &min[0], &max[0]);
39  loc = (min + max) * 0.5f;
40  size = (max - min) * 0.5f;
42 }
43 
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
struct Object Object
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline float3 zero_float3()
Definition: math_float3.h:80
#define make_float3(x, y, z)
Definition: metal/compat.h:204
void density_texture_space_invert(float3 &loc, float3 &size)
Definition: texture.cpp:12
#define min(a, b)
Definition: sort.c:35
void point_density_texture_space(BL::Depsgraph &b_depsgraph, BL::ShaderNodeTexPointDensity &b_point_density_node, float3 &loc, float3 &size)
Definition: texture.cpp:26
float max