Esempio n. 1
0
void				load_obj(t_object *obj, char *filename)
{
	int				fd;
	char			*line;

	ft_exit((fd = open(filename, O_RDONLY)) < 0, "Can't read file");
	obj->vertex_buffer_size = obj->index_buffer_size = obj->normal_buffer_size
	= obj->tex_buffer_size = 0;
	while (get_next_line(fd, &line) > 0)
	{
		if (ft_strlen(line) < 3 || line[0] == '#')
			;
		else if (line[0] == 'o')
			ft_strcpy((char *)obj->name, line + 2);
		else if (line[0] == 'v' && line[1] == ' ')
			load_vertex(obj, line + 1);
		else if (line[0] == 'v' && line[1] == 'n')
			load_normal(obj, line + 2);
		else if (line[0] == 'v' && line[1] == 't')
			load_tex(obj, line + 2);
		else if (line[0] == 'f' && line[1] == ' ')
			load_index(obj, line + 1);
		ft_memdel((void **)&line);
	}
	close(fd);
	print_obj(obj);
}
Esempio n. 2
0
/** 
 * import umdraw mesh list
 */
bool UMSoftwareIO::import_mesh_list(UMMeshList& dst, const umio::UMObjectPtr src, const umstring& absolute_file_path)
{
	if (!src) return false;

	bool result = false;
	umio::UMMesh::IDToMeshMap::iterator it = src->mutable_mesh_map().begin();
	for (; it != src->mutable_mesh_map().end(); ++it)
	{
		umio::UMMesh& ummesh = it->second;

		UMMeshPtr mesh(std::make_shared<UMMesh>());
		dst.push_back(mesh);
		result = true;
		
		sort_by_material(ummesh);
		load_material(absolute_file_path, mesh, ummesh);
		load_vertex_index(mesh, ummesh);
		load_vertex(mesh, ummesh);
		load_normal(mesh, ummesh);
		load_uv(mesh, ummesh);
		load_skin(mesh, ummesh);
		mesh->update_box();
	}
	return result;
}
Esempio n. 3
0
int load_ppustate(u8* dest, load_ptr *src, int actualsize, int expectedsize)
{
	int retval;
	retval= load_normal(dest,src,actualsize,expectedsize);
	if (actualsize<expectedsize)
	{
		nextx=scrollX;
	}
	return retval;
}
Esempio n. 4
0
int load_vram4(u8* dest, load_ptr *src, int actualsize, int expectedsize)
{
	if (fourscreen==0)
	{
		return load_writeonly(dest,src,actualsize,expectedsize);
	}
	else
	{
		return load_normal(dest,src,actualsize,expectedsize);
	}
}
Esempio n. 5
0
int load_deref(u8* dest, load_ptr *src, int actualsize, int expectedsize)
{
	u8 **dest_ptr= (u8**)dest;
	u8 *dest2=*dest_ptr;
	return load_normal(dest2,src, actualsize, expectedsize);
}