136struct DumpTraversalContext {
143void dump_subtree(DumpTraversalContext *context,
145 const BVHNode *parent =
nullptr)
149 " node_%p [label=\"%d\",fillcolor=\"#ccccee\",style=filled]\n",
155 " node_%p [label=\"%d\",fillcolor=\"#cceecc\",style=filled]\n",
159 if (parent !=
nullptr) {
160 fprintf(
context->stream,
" node_%p -> node_%p;\n", parent, node);
164 dump_subtree(context, node->
get_child(
i), node);
172 DumpTraversalContext context;
173 context.stream = fopen(filename,
"w");
174 if (context.stream ==
nullptr) {
178 fprintf(context.stream,
"digraph BVH {\n");
179 dump_subtree(&context,
this);
180 fprintf(context.stream,
"}\n");
181 fclose(context.stream);
188 for (
int i = 0;
i < depth;
i++) {
192 printf(
"inner node %p\n", (
void *)
this);
204 for (
int i = 0;
i < depth;
i++) {
@ BVH_STAT_TRIANGLE_COUNT
@ BVH_STAT_CHILDNODE_COUNT
@ BVH_STAT_ALIGNED_INNER_COUNT
@ BVH_STAT_ALIGNED_LEAF_COUNT
@ BVH_STAT_UNALIGNED_COUNT
@ BVH_STAT_UNALIGNED_LEAF_COUNT
@ BVH_STAT_UNALIGNED_INNER_COUNT
__forceinline float cost(const int num_nodes, const int num_primitives) const
void print(const int depth) const override
unique_ptr< BVHNode > children[kNumMaxChildren]
void print(const int depth) const override
#define CCL_NAMESPACE_END
#define assert(assertion)
int context(const bContext *C, const char *member, bContextDataResult *result)
float computeSubtreeSAHCost(const BVHParams &p, const float probability=1.0f) const
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const
virtual int num_children() const =0
BVHNode(const BoundBox &bounds)
virtual bool is_leaf() const =0
bool has_unaligned() const
virtual int num_triangles() const
virtual BVHNode * get_child(const int i) const =0
void dump_graph(const char *filename)
__forceinline float safe_area() const