// create for(i = 0; i < bvh->numfaces; i++) // 1024 ) bvh->numfaces { tree = (Tree *)MEM_callocN(sizeof(Tree), "Tree"); if(!tree) { // TODO printf("help!\n"); } tree->prevLeaf = bvh->leaf_tree; tree->nextLeaf = NULL; if (bvh->leaf_tree) { bvh->leaf_tree->nextLeaf = tree; } else { bvh->leaf_tree = tree; } if (!bvh->leaf_root) { bvh->leaf_root = tree; } } for (leaf = bvh->leaf_root; leaf; leaf = leaf->nextLeaf) { count++; } printf("count: %d\n", count); // only coutns 2!!