Exemple #1
0
/** 
 * import umdraw camera list
 * @param [out] dst distination mesh list
 * @param [in] src source object
 */
bool UMSoftwareIO::import_camera_list(
	UMCameraList& dst,
	const umio::UMObjectPtr src,
	int initial_width,
	int initial_height)
{
	if (!src) return false;

	umio::UMCamera::IDToCameraMap::iterator it = src->mutable_camera_map().begin();
	for (; it != src->mutable_camera_map().end(); ++it)
	{
		umio::UMCamera& umcamera = it->second;
		UMCameraPtr camera(std::make_shared<UMCamera>(false, initial_width, initial_height));
		dst.push_back(camera);
		load_camera(camera, umcamera);
	}
	return true;
}
Exemple #2
0
int parse_line(FILE* f)
{
  char buf[64*1024];

  if (feof(f)) return 1;
  fgets(buf, 64*1024, f);

  if (strlen(buf)<2) return 1;
  
  int res;
  switch (buf[0]) {
    case 'c': res = load_camera(buf+2); break;
    case 'l': res = load_light(buf+2); break;
    case 't': res = load_triangle(buf+2); break;
    default: res = 0;
  }

  return res;
}
Exemple #3
0
scene_t *scene_load(char *name,char *path,int texture_mode) {
    FILE *file;
    char buffer[128];
    scene_t *scene;
    file = fopen(name,"r");
    if(!file) return NULL;
    scene = (scene_t*)malloc(sizeof(scene_t));
    memset(scene,0,sizeof(scene_t));
    while(fscanf(file,"%s",buffer) != EOF) {
        if(buffer[0] == '#') skeep_comment(file);
        else if(!strcmp(buffer,"land")) {       // load land
            if(!load_land(scene,file,path,texture_mode)) return NULL;
        } else if(!strcmp(buffer,"camera")) {   // load camera
            if(!load_camera(scene,file,path)) return NULL;
        } else if(!strcmp(buffer,"sky")) {      // load sky
            if(!load_sky(scene,file,path,texture_mode)) return NULL;
        } else if(!strcmp(buffer,"object")) {   // load object
            if(!load_object(scene,file,path,texture_mode)) return NULL;
        } else return NULL;
    }
    fclose(file);
    return scene;
}