Blender
V3.3
intern
cycles
bvh
bvh/bvh.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: Apache-2.0
2
* Adapted from code copyright 2009-2010 NVIDIA Corporation
3
* Modifications Copyright 2011-2022 Blender Foundation. */
4
5
#ifndef __BVH_H__
6
#define __BVH_H__
7
8
#include "
bvh/params.h
"
9
#include "
util/array.h
"
10
#include "
util/types.h
"
11
#include "
util/vector.h
"
12
13
CCL_NAMESPACE_BEGIN
14
15
class
BoundBox
;
16
class
BVHNode
;
17
class
BVHParams
;
18
class
Device
;
19
class
DeviceScene
;
20
class
Geometry
;
21
class
LeafNode
;
22
class
Object
;
23
class
Progress
;
24
class
Stats
;
25
26
#define BVH_ALIGN 4096
27
#define TRI_NODE_SIZE 3
28
/* Packed BVH
29
*
30
* BVH stored as it will be used for traversal on the rendering device. */
31
32
struct
PackedBVH
{
33
/* BVH nodes storage, one node is 4x int4, and contains two bounding boxes,
34
* and child, triangle or object indexes depending on the node type */
35
array<int4>
nodes
;
36
/* BVH leaf nodes storage. */
37
array<int4>
leaf_nodes
;
38
/* object index to BVH node index mapping for instances */
39
array<int>
object_node
;
40
/* primitive type - triangle or strand */
41
array<int>
prim_type
;
42
/* Visibility visibilities for primitives. */
43
array<uint>
prim_visibility
;
44
/* mapping from BVH primitive index to true primitive index, as primitives
45
* may be duplicated due to spatial splits. -1 for instances. */
46
array<int>
prim_index
;
47
/* mapping from BVH primitive index, to the object id of that primitive. */
48
array<int>
prim_object
;
49
/* Time range of BVH primitive. */
50
array<float2>
prim_time
;
51
52
/* index of the root node. */
53
int
root_index
;
54
55
PackedBVH
()
56
{
57
root_index
= 0;
58
}
59
};
60
61
/* BVH */
62
63
class
BVH
{
64
public
:
65
BVHParams
params
;
66
vector<Geometry *>
geometry
;
67
vector<Object *>
objects
;
68
69
static
BVH
*
create
(
const
BVHParams
&
params
,
70
const
vector<Geometry *>
&
geometry
,
71
const
vector<Object *>
&
objects
,
72
Device
*device);
73
virtual
~BVH
()
74
{
75
}
76
77
virtual
void
replace_geometry
(
const
vector<Geometry *>
&
geometry
,
78
const
vector<Object *>
&
objects
)
79
{
80
this->geometry =
geometry
;
81
this->objects =
objects
;
82
}
83
84
protected
:
85
BVH
(
const
BVHParams
&
params
,
86
const
vector<Geometry *>
&
geometry
,
87
const
vector<Object *>
&
objects
);
88
};
89
90
CCL_NAMESPACE_END
91
92
#endif
/* __BVH_H__ */
BVHParams
Definition:
params.h:54
BVH
Definition:
bvh/bvh.h:63
BVH::~BVH
virtual ~BVH()
Definition:
bvh/bvh.h:73
BVH::geometry
vector< Geometry * > geometry
Definition:
bvh/bvh.h:66
BVH::replace_geometry
virtual void replace_geometry(const vector< Geometry * > &geometry, const vector< Object * > &objects)
Definition:
bvh/bvh.h:77
BVH::create
static BVH * create(const BVHParams ¶ms, const vector< Geometry * > &geometry, const vector< Object * > &objects, Device *device)
Definition:
bvh.cpp:77
BVH::BVH
BVH(const BVHParams ¶ms, const vector< Geometry * > &geometry, const vector< Object * > &objects)
Definition:
bvh.cpp:70
BVH::params
BVHParams params
Definition:
bvh/bvh.h:65
BVH::objects
vector< Object * > objects
Definition:
bvh/bvh.h:67
DeviceScene
Definition:
scene.h:59
Device
Definition:
device/device.h:105
Geometry
Definition:
scene/geometry.h:37
LeafNode
Definition:
bvh/node.h:205
Progress
Definition:
progress.h:20
Stats
Definition:
util/stats.h:12
array< int4 >
vector< Geometry * >
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
cuda/compat.h:9
array.h
vector.h
CCL_NAMESPACE_BEGIN
Definition:
python.cpp:37
params.h
BVHNode
Definition:
BLI_kdopbvh.c:63
BoundBox
Definition:
DNA_object_types.h:89
Object
Definition:
DNA_object_types.h:242
PackedBVH
Definition:
bvh/bvh.h:32
PackedBVH::prim_index
array< int > prim_index
Definition:
bvh/bvh.h:46
PackedBVH::prim_type
array< int > prim_type
Definition:
bvh/bvh.h:41
PackedBVH::nodes
array< int4 > nodes
Definition:
bvh/bvh.h:35
PackedBVH::prim_visibility
array< uint > prim_visibility
Definition:
bvh/bvh.h:43
PackedBVH::prim_time
array< float2 > prim_time
Definition:
bvh/bvh.h:50
PackedBVH::leaf_nodes
array< int4 > leaf_nodes
Definition:
bvh/bvh.h:37
PackedBVH::PackedBVH
PackedBVH()
Definition:
bvh/bvh.h:55
PackedBVH::prim_object
array< int > prim_object
Definition:
bvh/bvh.h:48
PackedBVH::root_index
int root_index
Definition:
bvh/bvh.h:53
PackedBVH::object_node
array< int > object_node
Definition:
bvh/bvh.h:39
types.h
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1