erebus

diff liberebus/src/erebus.cc @ 34:d15ee526daa6

- changed the UI font, made it a bit smaller - fixed the text positioning in the status bar - added ThreadPool::clear to remove all pending jobs - fixed the TargetCamera matrix calculation to avoid singularities when the camera looks straight up or down. - fixed ommited normalization in TargetCamera's matrix calculation - added paths/sec display in the status bar
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Jun 2014 08:12:05 +0300
parents b1fc96c71bcc
children db8a90307386
line diff
     1.1 --- a/liberebus/src/erebus.cc	Sat Jun 07 14:21:56 2014 +0300
     1.2 +++ b/liberebus/src/erebus.cc	Sun Jun 08 08:12:05 2014 +0300
     1.3 @@ -133,6 +133,7 @@
     1.4  		int num_threads = erb_getopti(ctx, ERB_OPT_NUM_THREADS);
     1.5  		ctx->tpool = new ThreadPool(num_threads);
     1.6  	}
     1.7 +	ctx->tpool->clear_work();	// remove any previously pending jobs
     1.8  
     1.9  	++ctx->cur_frame;
    1.10  	ctx->cur_sample = 0;
    1.11 @@ -214,9 +215,7 @@
    1.12  int erb_get_status(struct erebus *ctx, struct erb_render_status *stat)
    1.13  {
    1.14  	long pending = ctx->tpool->pending();
    1.15 -	if(!pending) {
    1.16 -		return -1;
    1.17 -	}
    1.18 +
    1.19  	int xsz = ctx->fbimg.get_width();
    1.20  	int ysz = ctx->fbimg.get_height();
    1.21  	int xblocks = (xsz + BLKSZ - 1) / BLKSZ;
    1.22 @@ -232,9 +231,17 @@
    1.23  	if((stat->max_samples = erb_getopti(ctx, ERB_OPT_MAX_SAMPLES)) == INF_SAMPLES) {
    1.24  		stat->max_samples = stat->samples;
    1.25  
    1.26 -		stat->progress_percent = 100 * stat->blocks / stat->max_blocks;
    1.27 +		if(stat->max_blocks) {
    1.28 +			stat->progress_percent = 100 * stat->blocks / stat->max_blocks;
    1.29 +		} else {
    1.30 +			stat->progress_percent = 0;
    1.31 +		}
    1.32  	} else {
    1.33 -		stat->progress_percent = 100 * stat->samples / stat->max_samples;
    1.34 +		if(stat->max_samples) {
    1.35 +			stat->progress_percent = 100 * stat->samples / stat->max_samples;
    1.36 +		} else {
    1.37 +			stat->progress_percent = 0;
    1.38 +		}
    1.39  	}
    1.40  	return 0;
    1.41  }