Revision: 45777
http://brlcad.svn.sourceforge.net/brlcad/?rev=45777&view=rev
Author: kunigami
Date: 2011-08-03 21:46:31 +0000 (Wed, 03 Aug 2011)
Log Message:
-----------
changed the accumulator buffer to float so that it saves the raw components of
ap.a_color before theyre clamped. We only expand and clamp it when moving the
partial sums to scanline
Modified Paths:
--------------
brlcad/trunk/src/rt/do.c
brlcad/trunk/src/rt/view.c
Modified: brlcad/trunk/src/rt/do.c
===================================================================
--- brlcad/trunk/src/rt/do.c 2011-08-03 19:45:45 UTC (rev 45776)
+++ brlcad/trunk/src/rt/do.c 2011-08-03 21:46:31 UTC (rev 45777)
@@ -586,14 +586,16 @@
int lim = 0;
vect_t work, temp;
quat_t quat;
-
+ char *env_str;
+
/* TODO: Read from command line */
-#ifdef EXPERIMENTAL_MODE
- full_incr_mode = 1;
- full_incr_nsamples = 10;
-#endif
+ /* Read from ENV with we're going to use the experimental mode */
+ env_str = getenv("LIBRT_EXP_MODE");
+ if(env_str != NULL){
+ full_incr_mode = 1;
+ full_incr_nsamples = 10;
+ }
-
if (rt_verbosity & VERBOSE_FRAMENUMBER)
bu_log("\n...................Frame %5d...................\n",
framenumber);
@@ -836,7 +838,6 @@
/* Multiple frame buffer mode */
for(full_incr_sample = 1; full_incr_sample <= full_incr_nsamples;
full_incr_sample++){
- bu_log("sample: %zu\n", full_incr_sample);
if(full_incr_sample > 1) /* first sample was already initialized */
view_2init(&APP, framename);
do_run(pix_start, pix_end);
Modified: brlcad/trunk/src/rt/view.c
===================================================================
--- brlcad/trunk/src/rt/view.c 2011-08-03 19:45:45 UTC (rev 45776)
+++ brlcad/trunk/src/rt/view.c 2011-08-03 21:46:31 UTC (rev 45777)
@@ -128,7 +128,7 @@
colors sampled for each pixel */
static struct scanline* scanline;
-static long* psum_buffer; /* Buffer that keeps partial sums for
multi-samples modes */
+static fastf_t* psum_buffer; /* Buffer that keeps partial sums
for multi-samples modes */
static size_t pwidth; /* Width of each pixel (in bytes) */
struct mfuncs *mfHead = MF_NULL; /* Head of list of shaders */
@@ -459,17 +459,15 @@
{
RGBpixel p;
int npix, i;
- long *psum_p;
- int *tmp_pixel;
+ fastf_t *psum_p;
+ fastf_t *tmp_pixel;
+ int tmp_color;
/* Scanline buffered mode */
bu_semaphore_acquire(RT_SEM_RESULTS);
- tmp_pixel = bu_calloc(pwidth, sizeof(int), "tmp_pixel");
-
- tmp_pixel[0] = r;
- tmp_pixel[1] = g;
- tmp_pixel[2] = b;
+ tmp_pixel = bu_calloc(pwidth, sizeof(fastf_t), "tmp_pixel");
+ VMOVE(tmp_pixel, ap->a_color);
if (rpt_dist) {
for(i = 0; i < 8; i++)
tmp_pixel[i + 3] = dist[i];
@@ -484,8 +482,11 @@
/* Update the partial sums and the scanline */
for(i = 0; i < pwidth; i++){
psum_p[i] += tmp_pixel[i];
- /* round to the nearest integer */
- pixelp[i] = psum_p[i]*1.0/full_incr_sample + 0.5;
+ /* change the float interval to [0,255] and round to
+ the nearest integer */
+ tmp_color = psum_p[i]*255.0/full_incr_sample + 0.5;
+ /* clamp */
+ pixelp[i] = tmp_color < 0 ? 0 : tmp_color > 255 ? 255 : tmp_color;
}
bu_free(tmp_pixel, "tmp_pixel");
@@ -1495,7 +1496,7 @@
/* On fully incremental mode, allocate the scanline as the total
size of the image */
if(full_incr_mode && !psum_buffer)
- psum_buffer = bu_calloc(height*width*pwidth, sizeof(long), "partial
sums buffer");
+ psum_buffer = bu_calloc(height*width*pwidth, sizeof(fastf_t), "partial
sums buffer");
#ifdef RTSRV
buf_mode = BUFMODE_RTSRV; /* multi-pixel buffering */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits