Path: blob/master/thirdparty/embree/kernels/bvh/bvh_node_base.h
9906 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "bvh_node_ref.h"67namespace embree8{910/*! BVHN Base Node */11template<typename NodeRef, int N>12struct BaseNode_t13{14/*! Clears the node. */15__forceinline void clear()16{17for (size_t i=0; i<N; i++)18children[i] = NodeRef::emptyNode;19}2021/*! Returns reference to specified child */22__forceinline NodeRef& child(size_t i) { assert(i<N); return children[i]; }23__forceinline const NodeRef& child(size_t i) const { assert(i<N); return children[i]; }2425/*! verifies the node */26__forceinline bool verify() const27{28for (size_t i=0; i<N; i++) {29if (child(i) == NodeRef::emptyNode) {30for (; i<N; i++) {31if (child(i) != NodeRef::emptyNode)32return false;33}34break;35}36}37return true;38}3940NodeRef children[N]; //!< Pointer to the N children (can be a node or leaf)41};42}434445