예제 #1
0
heightfield
heightfield_create_from_file(camera cam, char *heightmap_filename,
			     float sizex, float sizey, float sizez)
{
  heightfield hf;
  assert(heightmap_filename);

  hf = (heightfield)malloc(sizeof(struct heightfield));

  object3d_init(&hf->obj, matrix4_identity, NULL, NULL);
  hf->sizex = sizex;
  hf->sizey = sizey;
  hf->sizez = sizez;
  hf->patch_sizex = 17;
  hf->cam = cam;

  object3d_set_world_matrix(SF_OBJECT3D(hf), matrix4_identity);

  hf->zvalues = create_zvalues(hf, heightmap_filename);
  if(!hf->zvalues) {
    free(hf);
    fprintf(stderr, "heightfield_create_from_file: Can't create mesh\n");
    return NULL;
  }

  hf->quadtree = quadtree_create(-hf->sizex/2, -hf->sizey/2, hf->sizex/2, hf->sizey/2, 4);
  quadtree_foreach_leaf(hf->quadtree, hf, quadtree_fill);

  return hf;  
}
예제 #2
0
파일: noviceserver.c 프로젝트: a1406/ndproj
static NEINT32 init_mapobj_tree()
{
	quadbox_t box = get_mapbox();
	mapobj_tree = quadtree_create(box, QTREE_DEPTH_MIN, QBOX_OVERLAP_MIN);
	ne_mutex_init(&map_lock);
	return (0);
}