Shadowrun: Awakened 29 September 2011 - Build 871
Classes | Functions | Variables
trace.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  patch
struct  thr_io_parms
struct  thr_parms

Functions

void * thread_io (void *)
void * thread_trace (thr_parms *parms)
void thread_trace1 (thr_parms *, patch *, int depth)
void thread_trace2 (thr_parms *, patch *)
color trace (ray *)
void trace_region (scenedef, void *, int, int, int, int)
void trace_shm (scenedef, int, int, int, int)

Variables

char * global_buffer

Function Documentation

void* thread_io ( void *  )

Definition at line 92 of file trace_rest.cpp.

References thr_io_parms::buffer, thr_io_parms::iheight, thr_io_parms::iwidth, thr_io_parms::startx, thr_io_parms::starty, thr_io_parms::stopx, thr_io_parms::stopy, thr_io_parms::tga, and writetgaregion().

                               {
  thr_io_parms p;

  p= *((thr_io_parms *) parms);
  writetgaregion(p.tga, p.iwidth, p.iheight, p.startx, p.starty, 
        p.stopx, p.stopy, p.buffer);
  free(p.buffer); /* free the buffer once we are done with it.. */
  free(parms);

  return(NULL);
}
void* thread_trace ( thr_parms parms)

Definition at line 170 of file trace.serial.cpp.

References tbb::task_scheduler_init::automatic, g, scenedef::hres, jitterscale, tbb::parallel_for(), parallel_thread(), thr_parms::scene, thr_parms::startx, startx, thr_parms::starty, starty, thr_parms::stopx, stopx, thr_parms::stopy, stopy, totaly, and scenedef::vres.

Referenced by trace_shm().

{
    // shared but read-only so could be private too
    all_parms = parms;
    scene = parms->scene;
    startx = parms->startx;
    stopx = parms->stopx;
    starty = parms->starty;
    stopy = parms->stopy;
    jitterscale = 40.0*(scene.hres + scene.vres);
    totaly = parms->scene.vres-1;

    parallel_thread ();

    return(NULL);  
}
void thread_trace1 ( thr_parms ,
patch ,
int  depth 
)
void thread_trace2 ( thr_parms ,
patch  
)
color trace ( ray )

Definition at line 80 of file trace_rest.cpp.

References scenedef::background, ray::d, ray::depth, intersect_objects(), ray::intstruct, reset_intersection(), ray::scene, shader(), and VNorm().

Referenced by render_one_pixel(), shade_reflection(), and shade_transmission().

                           {
  if (primary->depth > 0) {
    VNorm(&primary->d);
    reset_intersection(primary->intstruct);
    intersect_objects(primary);
    return shader(primary);
  }

  /* if ray is truncated, return the background as its color */
  return primary->scene->background;
}
void trace_region ( scenedef  ,
void *  ,
int  ,
int  ,
int  ,
int   
)

Definition at line 123 of file trace_rest.cpp.

References MSG_0, rt_ui_message(), trace_shm(), and scenedef::verbosemode.

Referenced by renderscene().

                                                                                            {

  if (scene.verbosemode) {
    char msgtxt[2048];
    sprintf(msgtxt, "Node %3d tracing region  %4d, %4d  --->  %4d, %4d \n", 0, startx,starty,stopx,stopy);
    rt_ui_message(MSG_0, msgtxt);
  }

  trace_shm(scene, /*buffer,*/ startx, stopx, starty, stopy);
/* not used now
  writetgaregion(tga, scene.hres, scene.vres, 
                 startx, starty, stopx, stopy, global_buffer);

  if (scene.rawimage != NULL) {
    int x, y;
    int totalx = stopx - startx + 1;
    for (y=starty; y<=stopy; y++) {
      for (x=0; x<scene.hres; x++) {
        scene.rawimage[(scene.vres-y)*scene.hres*3 + x*3] = global_buffer[(y-starty)*totalx*3 + x*3 + 2];
        scene.rawimage[(scene.vres-y)*scene.hres*3 + x*3 +1] = global_buffer[(y-starty)*totalx*3 + x*3 + 1];
        scene.rawimage[(scene.vres-y)*scene.hres*3 + x*3 +2] = global_buffer[(y-starty)*totalx*3 + x*3];
      }
    }
  }
*/
}
void trace_shm ( scenedef  ,
int  ,
int  ,
int  ,
int   
)

Definition at line 104 of file trace_rest.cpp.

References thr_parms::nthr, rt_freemem(), rt_getmem(), scene, thr_parms::scene, startx, thr_parms::startx, starty, thr_parms::starty, stopx, thr_parms::stopx, stopy, thr_parms::stopy, thread_trace(), and thr_parms::tid.

Referenced by trace_region().

                                                                               {

  thr_parms * parms;

  parms = (thr_parms *) rt_getmem(sizeof(thr_parms));  

  parms->tid=0;
  parms->nthr=1;
  parms->scene=scene;
  parms->startx=startx;
  parms->stopx=stopx;
  parms->starty=starty;
  parms->stopy=stopy;

  thread_trace(parms);

  rt_freemem(parms);
}

Variable Documentation


Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net