Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/embree/kernels/bvh/bvh_node_base.h
9906 views
1
// Copyright 2009-2021 Intel Corporation
2
// SPDX-License-Identifier: Apache-2.0
3
4
#pragma once
5
6
#include "bvh_node_ref.h"
7
8
namespace embree
9
{
10
11
/*! BVHN Base Node */
12
template<typename NodeRef, int N>
13
struct BaseNode_t
14
{
15
/*! Clears the node. */
16
__forceinline void clear()
17
{
18
for (size_t i=0; i<N; i++)
19
children[i] = NodeRef::emptyNode;
20
}
21
22
/*! Returns reference to specified child */
23
__forceinline NodeRef& child(size_t i) { assert(i<N); return children[i]; }
24
__forceinline const NodeRef& child(size_t i) const { assert(i<N); return children[i]; }
25
26
/*! verifies the node */
27
__forceinline bool verify() const
28
{
29
for (size_t i=0; i<N; i++) {
30
if (child(i) == NodeRef::emptyNode) {
31
for (; i<N; i++) {
32
if (child(i) != NodeRef::emptyNode)
33
return false;
34
}
35
break;
36
}
37
}
38
return true;
39
}
40
41
NodeRef children[N]; //!< Pointer to the N children (can be a node or leaf)
42
};
43
}
44
45