Blender
V2.93
intern
cycles
blender
blender_texture.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2011-2015 Blender Foundation
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#include "
blender/blender_texture.h
"
18
19
CCL_NAMESPACE_BEGIN
20
21
namespace
{
22
23
/* Point density helpers. */
24
25
void
density_texture_space_invert
(
float3
&loc,
float3
&
size
)
26
{
27
if
(
size
.x != 0.0f)
28
size
.x = 0.5f /
size
.x;
29
if
(
size
.y != 0.0f)
30
size
.y = 0.5f /
size
.y;
31
if
(
size
.z != 0.0f)
32
size
.z = 0.5f /
size
.z;
33
34
loc = loc *
size
-
make_float3
(0.5f, 0.5f, 0.5f);
35
}
36
37
}
/* namespace */
38
39
void
point_density_texture_space
(
BL::Depsgraph
&b_depsgraph,
40
BL::ShaderNodeTexPointDensity &b_point_density_node,
41
float3
&loc,
42
float3
&
size
)
43
{
44
BL::Object
b_ob(b_point_density_node.object());
45
if
(!b_ob) {
46
loc =
zero_float3
();
47
size
=
zero_float3
();
48
return
;
49
}
50
float3
min
,
max
;
51
b_point_density_node.calc_point_density_minmax(b_depsgraph, &
min
[0], &
max
[0]);
52
loc = (
min
+
max
) * 0.5f;
53
size
= (
max
-
min
) * 0.5f;
54
density_texture_space_invert
(loc,
size
);
55
}
56
57
CCL_NAMESPACE_END
Depsgraph
struct Depsgraph Depsgraph
Definition:
DEG_depsgraph.h:51
Object
struct Object Object
point_density_texture_space
void point_density_texture_space(BL::Depsgraph &b_depsgraph, BL::ShaderNodeTexPointDensity &b_point_density_node, float3 &loc, float3 &size)
Definition:
blender_texture.cpp:39
blender_texture.h
size
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition:
btDbvt.cpp:52
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
kernel_compat_cuda.h:23
make_float3
#define make_float3(x, y, z)
Definition:
kernel_compat_opencl.h:109
CCL_NAMESPACE_BEGIN
Definition:
blender_python.cpp:54
CCL_NAMESPACE_BEGIN::density_texture_space_invert
void density_texture_space_invert(float3 &loc, float3 &size)
Definition:
blender_texture.cpp:25
min
#define min(a, b)
Definition:
sort.c:51
float3
Definition:
sky_float3.h:34
max
float max
Definition:
transform_gizmo_3d.c:107
zero_float3
ccl_device_inline float3 zero_float3()
Definition:
util_math_float3.h:94
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1