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