bool model::Load(char * objfile, char * mtlname) { char buffer[256]; strcpy(filename, objfile); FILE * file = fopen(filename, "r"); strcpy(mtllib, mtlname); if(file == NULL) { MessageBox(NULL, objfile, "Model file not found:", MB_OK); return false; } while(fscanf(file, "%s", buffer) != EOF) { if(!strcmp("#", buffer))skipComment(file); if(!strcmp("mtllib", buffer))loadMaterialLib(file); if(!strcmp("v", buffer))loadVertex(file); if(!strcmp("vt", buffer))loadTexCoord(file); if(!strcmp("vn", buffer))loadNormal(file); if(!strcmp("f", buffer))loadFace(file); if(!strcmp("s", buffer));//fscanf(file, "%s", buffer); if(!strcmp("usemtl", buffer));//useMaterial(file); } fclose(file); loaded = true; return true; }
void Shader::init() { initPointers(); loadVertex(); if (d_n_geometry != 0) loadGeometry(); loadFragment(); compile(); link(); }
/************************************************* Function: call_heavygraph Description: The main function for contig step . its processes are as below: 1. Solve repeat 2. Merge bubble(clean bubble is optional for multikmer) 3. Remove weak edge and low coverage edge 4. Cut tips 5. Iterate multikmer(optional) Input: @see display_contig_usage () Output: The files below: 1. *.contig 2. *.ContigIndex 3. *.update.edge 4. *.Arc 5. *.read [optional] 6. *.preGraphBasic [optional] Return: None. *************************************************/ int call_heavygraph ( int argc, char ** argv ) { time_t start_t, stop_t, time_bef, time_aft; time ( &start_t ); boolean ret; fprintf ( stderr, "\n********************\n" ); fprintf ( stderr, "Contig\n" ); fprintf ( stderr, "********************\n\n" ); initenv ( argc, argv ); loadVertex ( graphfile ); loadEdge ( graphfile ); if ( repeatSolve ) { ret = loadPathBin ( graphfile ); } swapedge(); sortedge(); freshArc(); if ( repeatSolve ) { time ( &time_bef ); // ret = loadPathBin (graphfile); if ( ret ) { solveReps (); } else { fprintf ( stderr, "Repeat solving can't be done...\n" ); } time ( &time_aft ); fprintf ( stderr, "Time spent on solving repeat: %ds.\n", ( int ) ( time_aft - time_bef ) ); } //edgecvg_bar(edge_array,num_ed,graphfile,100); if ( !iter && M > 0 ) { time ( &time_bef ); bubblePinch ( 0.90, graphfile, M, 0, 1 ); time ( &time_aft ); fprintf ( stderr, "Time spent on pinching bubbles: %ds.\n", ( int ) ( time_aft - time_bef ) ); } if ( iter && cleanBubble && M > 0 ) { time ( &time_bef ); clean = 1; long long oldpinCounter = 0; long long min = 10; int times = 0; while ( min >= 10 ) { times++; if ( times >= 4 ) { break; } bubblePinch ( 0.90, graphfile, M, 1, 0 ); min = pinCounter; fprintf ( stderr, "%lld clean bubbles merged.\n", pinCounter ); } time ( &time_aft ); fprintf ( stderr, "Time spent on pinching clean bubbles: %ds.\n", ( int ) ( time_aft - time_bef ) ); clean = 0; } if ( deLowEdge ) { removeWeakEdges ( 2 * overlaplen, 1 ); removeLowCovEdges ( 2 * overlaplen, deLowEdge, !iter ); } cutTipsInGraph ( 0, 0, !iter ); if ( iter ) { Iterate ( shortrdsfile, graphfile, maxk, M ); //keepReadFile, if ( M > 0 ) { time ( &time_bef ); bubblePinch ( 0.90, graphfile, M, 1, 0 ); time ( &time_aft ); fprintf ( stderr, "Time spent on pinching bubbles: %ds.\n", ( int ) ( time_aft - time_bef ) ); } freshpreGraphBasic ( iter, maxk, graphfile ); } //output_graph(graphfile); output_contig ( edge_array, num_ed, graphfile, overlaplen + 1 ); output_updated_edges ( graphfile ); output_heavyArcs ( graphfile ); if ( vt_array ) { free ( ( void * ) vt_array ); vt_array = NULL; } if ( edge_array ) { free_edge_array ( edge_array, num_ed_limit ); edge_array = NULL; } destroyArcMem (); time ( &stop_t ); fprintf ( stderr, "\nTime spent on constructing contig: %dm.\n\n", ( int ) ( stop_t - start_t ) / 60 ); return 0; }