149struct DumpTraversalContext {
156void dump_subtree(DumpTraversalContext *context,
const BVHNode *node,
const BVHNode *parent =
NULL)
158 if (node->is_leaf()) {
159 fprintf(context->stream,
160 " node_%p [label=\"%d\",fillcolor=\"#ccccee\",style=filled]\n",
165 fprintf(context->stream,
166 " node_%p [label=\"%d\",fillcolor=\"#cceecc\",style=filled]\n",
170 if (parent !=
NULL) {
171 fprintf(context->stream,
" node_%p -> node_%p;\n", parent, node);
174 for (
int i = 0; i < node->num_children(); ++i) {
175 dump_subtree(context, node->get_child(i), node);
183 DumpTraversalContext context;
184 context.stream = fopen(filename,
"w");
185 if (context.stream ==
NULL) {
189 fprintf(context.stream,
"digraph BVH {\n");
190 dump_subtree(&context,
this);
191 fprintf(context.stream,
"}\n");
192 fclose(context.stream);
199 for (
int i = 0; i < depth; i++) {
203 printf(
"inner node %p\n", (
void *)
this);
215 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(int num_nodes, int num_primitives) const
void print(int depth) const
BVHNode * children[kNumMaxChildren]
void print(int depth) const
#define CCL_NAMESPACE_END
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const
virtual int num_children() const =0
float computeSubtreeSAHCost(const BVHParams &p, float probability=1.0f) const
virtual bool is_leaf() const =0
bool has_unaligned() const
virtual int num_triangles() const
virtual void print(int depth=0) const =0
virtual BVHNode * get_child(int i) const =0
void dump_graph(const char *filename)
__forceinline float safe_area() const