static void quadtree_render(quadtree_node node, heightfield hf) { if(node->childs[0] == NULL || node->childs[1] == NULL || node->childs[2] == NULL || node->childs[3] == NULL) { s_patch *patch = (s_patch *)node->data; int i = calc_lod(hf, &patch->pos); object3d_to_opengl(patch->obj[i]); return; } if(frustum2d_bbox_is_into(hf->ftm2d, &node->childs[0]->box)) quadtree_render(node->childs[0], hf); if(frustum2d_bbox_is_into(hf->ftm2d, &node->childs[1]->box)) quadtree_render(node->childs[1], hf); if(frustum2d_bbox_is_into(hf->ftm2d, &node->childs[2]->box)) quadtree_render(node->childs[2], hf); if(frustum2d_bbox_is_into(hf->ftm2d, &node->childs[3]->box)) quadtree_render(node->childs[3], hf); }
void test_phase() { struct conf*c; BITTYPE mask1=0,mask2=0,bits1=0,bits2=0; double rf,lod; assert(c = calloc(1,sizeof(struct conf))); c->nvar = 1; string2bits("1100111111",&mask1); string2bits("1110111111",&mask2); string2bits("1010011011",&bits1); string2bits("1100011110",&bits2); printf("mask1=0x%016llx bits1=0x%016llx mask2=0x%016llx bits1=0x%016llx\n",(long long unsigned)mask1, (long long unsigned)bits1, (long long unsigned)mask2, (long long unsigned)bits2); calc_lod(c,&mask1,&bits1,&mask2,&bits2,&rf,&lod); printf("rf=%f lod=%f\n",rf,lod); }