# HG changeset patch # User LordOfWar # Date 2009-07-05 23:34:31 # Node ID abe4f18bd8981557ac8bdbdd639bb7dc614c3d90 # Parent 21c31a64b0b3db2c9b1e253e92e1e49fabf058e6 -added assigned_frames variable to blendjob structure -adjusted frame_num_struct_builder by adding 1 to the total amount. (line 270) reason: by example sframe = 1 eframe = 2 eframe - sframe = 1.. when in reality 2 frames should be rendered... so it is now int total = (sframe - eframe) +1; refined frame_finder() function to use the structure for total_frames data... and optimized its frame scanning so that it scanned from (for example) 0 to 249 is 250 because the computer counts 0 as one of its numbers. the statement in status_report_generator() function that adjust the hcfjob global variable to be able to increase the hcfjob by more than 1 per status_report_generator() function itteration by changing it to a while statement from an if statement. moved the declaration of the num1 and num2 variables till after hcfjob was checked, because the value of num1 is based off the hcfjob value. Added ability for status_report_generator() function to calculate the percent_done of the job and count the number of frames assigned, but not yet completed. diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -54,6 +54,7 @@ struct { int percent_done; int completed_frames; // number of completed frames + int assigned_frames; // number of assigned frames (that are not yet completed) int total_frames; // how many frames are in the animation struct frameset **frameset; // What exactly is this now? hehe @@ -266,7 +267,7 @@ void loginuser(char *username, int secre /* This function creates frame array based on the total number of frames to be rendered, which will then be parsed by function frame_farmer. */ void frame_num_struct_builder(int sframe, int eframe) { int jobnum_new = highest_jobnum + 1; - int total = sframe - eframe; + int total = (sframe - eframe) +1; // total number of frames int fcount = sframe; // Used to create all the frames in the structure from sframe to eframe int x = 0; @@ -285,7 +286,7 @@ void frame_num_struct_builder(int sframe int frame_finder(){ int your_frame = NULL; // your_frame is an interger value that will be given to the client as the frame number to render int finder_jobnum = 0; - int frameset_count = 0; // the frameset number, because frames in an animation don't start at zero + int frameset_count = 0; // the frameset number, note* frames in an animation don't start at zero short int done = 0; for(int priority = 10; priority >= 1; priority--){ // start the scan for the next job with the highest priority @@ -307,7 +308,7 @@ int frame_finder(){ break; } - while(your_frame <= (sframe - eframe)){ // Finds the frameset number with a frame that needs to be rendered + while(your_frame < blendjob[finder_jobnum].total_frames){ // Finds the frameset number with a frame that needs to be rendered if (blendjob[finder_jobnum].frameset[frameset_count].frame_status = 0) // If frame that is not assigned has been found, frameset_count is not changed break; // and frameset_count is used to give the frame number later in this funciton @@ -327,31 +328,42 @@ return your_frame; // your_frame is retu // This figures out how much of the job is done, where jobnum corresponds to the job number // This uses pointers, so when it is run it updates certain values in memory void status_report_generator(){ + + while(blendjob[(hcfjob+1)].priority = 0) //If the job after the highest consecutively finished job is finished + hcfjob+1; // adds 1 to the highest consecutively finished job and checks the next one, till the job after the hcfjob is not done + int num1 = hcfjob+1; // to scan through jobs int num2 = 0; // to scan through frames - if(blendjob[num1].priority = 0) //If the job after the highest consecutively finished job is finished - hcfjob+1; // adds 1 to the highest consecutively finished job + while(num1 <= highest_jobnum){ + if(blendjob[num1].frameset[num2].priority != 0){ // If the job is not done, scan it - while(num1 <= highest_jobnum){ - if(blendjob[num1].frameset[num2].priority != 0){ // If the job is not done, scan it + float finished_frames = 0; // variable that counts the completed frames + int pending_frames = 0; // variable that counts the assigned frames + float percent = 0; // variable that stores the percent done of the blendjob + + while(num2 <= blendjob[jobnum].total_frames){ // If + if(blendjob[jobnum].frameset[num2] = 2) + finished_frames++; - int finished_frames = 0; // variable that counts the completed frames - while(num2 <= blendjob[jobnum].total_frames){ - if(blendjob[jobnum].frameset[num2]) - finished_frames++; + if(blendjob[jobnum].frameset[num2] = 1) + pending_frames++; + + num2++; + } - num2++; + percent = (finished_frames / blendjob[num1].total_frames) * 100; + + blendjob[num1].completed_frames = finished_frames; + blendjob[num1].assigned_frames = pending_frames; + blendjob[num1].percent_done = percent; } + + num1++; } - blendjob[num1].completed_frames = finished_frames; - - num1++; } -} - // This function makes the value of the frame 2, which means its completed. void the_finisher(int frame){ blendjob[jobnum].frameset[frame]++;