Blender
V2.93
intern
cycles
bvh
bvh/bvh.h
Go to the documentation of this file.
1
/*
2
* Adapted from code copyright 2009-2010 NVIDIA Corporation
3
* Modifications Copyright 2011, Blender Foundation.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#ifndef __BVH_H__
19
#define __BVH_H__
20
21
#include "
bvh/bvh_params.h
"
22
#include "
util/util_array.h
"
23
#include "
util/util_types.h
"
24
#include "
util/util_vector.h
"
25
26
CCL_NAMESPACE_BEGIN
27
28
class
BoundBox
;
29
class
BVHNode
;
30
class
BVHParams
;
31
class
Device
;
32
class
DeviceScene
;
33
class
Geometry
;
34
class
LeafNode
;
35
class
Object
;
36
class
Progress
;
37
class
Stats
;
38
39
#define BVH_ALIGN 4096
40
#define TRI_NODE_SIZE 3
41
/* Packed BVH
42
*
43
* BVH stored as it will be used for traversal on the rendering device. */
44
45
struct
PackedBVH
{
46
/* BVH nodes storage, one node is 4x int4, and contains two bounding boxes,
47
* and child, triangle or object indexes depending on the node type */
48
array<int4>
nodes
;
49
/* BVH leaf nodes storage. */
50
array<int4>
leaf_nodes
;
51
/* object index to BVH node index mapping for instances */
52
array<int>
object_node
;
53
/* Mapping from primitive index to index in triangle array. */
54
array<uint>
prim_tri_index
;
55
/* Continuous storage of triangle vertices. */
56
array<float4>
prim_tri_verts
;
57
/* primitive type - triangle or strand */
58
array<int>
prim_type
;
59
/* visibility visibilitys for primitives */
60
array<uint>
prim_visibility
;
61
/* mapping from BVH primitive index to true primitive index, as primitives
62
* may be duplicated due to spatial splits. -1 for instances. */
63
array<int>
prim_index
;
64
/* mapping from BVH primitive index, to the object id of that primitive. */
65
array<int>
prim_object
;
66
/* Time range of BVH primitive. */
67
array<float2>
prim_time
;
68
69
/* index of the root node. */
70
int
root_index
;
71
72
PackedBVH
()
73
{
74
root_index
= 0;
75
}
76
};
77
78
/* BVH */
79
80
class
BVH
{
81
public
:
82
BVHParams
params
;
83
vector<Geometry *>
geometry
;
84
vector<Object *>
objects
;
85
86
static
BVH
*
create
(
const
BVHParams
&
params
,
87
const
vector<Geometry *>
&
geometry
,
88
const
vector<Object *>
&
objects
,
89
Device
*device);
90
virtual
~BVH
()
91
{
92
}
93
94
protected
:
95
BVH
(
const
BVHParams
&
params
,
96
const
vector<Geometry *>
&
geometry
,
97
const
vector<Object *>
&
objects
);
98
};
99
100
CCL_NAMESPACE_END
101
102
#endif
/* __BVH_H__ */
bvh_params.h
BVHParams
Definition:
bvh_params.h:46
BVH
Definition:
bvh/bvh.h:80
BVH::~BVH
virtual ~BVH()
Definition:
bvh/bvh.h:90
BVH::geometry
vector< Geometry * > geometry
Definition:
bvh/bvh.h:83
BVH::create
static BVH * create(const BVHParams ¶ms, const vector< Geometry * > &geometry, const vector< Object * > &objects, Device *device)
Definition:
bvh.cpp:85
BVH::BVH
BVH(const BVHParams ¶ms, const vector< Geometry * > &geometry, const vector< Object * > &objects)
Definition:
bvh.cpp:78
BVH::params
BVHParams params
Definition:
bvh/bvh.h:82
BVH::objects
vector< Object * > objects
Definition:
bvh/bvh.h:84
DeviceScene
Definition:
scene.h:71
Device
Definition:
device.h:293
Geometry
Definition:
geometry.h:68
LeafNode
Definition:
bvh_node.h:218
Progress
Definition:
util_progress.h:33
Stats
Definition:
util_stats.h:25
array< int4 >
vector< Geometry * >
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
kernel_compat_cuda.h:23
CCL_NAMESPACE_BEGIN
Definition:
blender_python.cpp:54
BVHNode
Definition:
BLI_kdopbvh.c:79
BoundBox
Definition:
DNA_object_types.h:104
Object
Definition:
DNA_object_types.h:239
PackedBVH
Definition:
bvh/bvh.h:45
PackedBVH::prim_index
array< int > prim_index
Definition:
bvh/bvh.h:63
PackedBVH::prim_type
array< int > prim_type
Definition:
bvh/bvh.h:58
PackedBVH::nodes
array< int4 > nodes
Definition:
bvh/bvh.h:48
PackedBVH::prim_visibility
array< uint > prim_visibility
Definition:
bvh/bvh.h:60
PackedBVH::prim_tri_verts
array< float4 > prim_tri_verts
Definition:
bvh/bvh.h:56
PackedBVH::prim_time
array< float2 > prim_time
Definition:
bvh/bvh.h:67
PackedBVH::leaf_nodes
array< int4 > leaf_nodes
Definition:
bvh/bvh.h:50
PackedBVH::PackedBVH
PackedBVH()
Definition:
bvh/bvh.h:72
PackedBVH::prim_tri_index
array< uint > prim_tri_index
Definition:
bvh/bvh.h:54
PackedBVH::prim_object
array< int > prim_object
Definition:
bvh/bvh.h:65
PackedBVH::root_index
int root_index
Definition:
bvh/bvh.h:70
PackedBVH::object_node
array< int > object_node
Definition:
bvh/bvh.h:52
util_array.h
util_types.h
util_vector.h
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1