Shadowrun: Awakened 29 September 2011 - Build 871
Functions
trace_rest.cpp File Reference
#include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "tgafile.h"
#include "trace.h"
#include "light.h"
#include "shade.h"
#include "camera.h"
#include "util.h"
#include "intersect.h"
#include "global.h"
#include "ui.h"
#include "video.h"
Include dependency graph for trace_rest.cpp:

Go to the source code of this file.

Functions

void * thread_io (void *parms)
color trace (ray *primary)
void trace_region (scenedef scene, void *tga, int startx, int starty, int stopx, int stopy)
void trace_shm (scenedef scene, int startx, int stopx, int starty, int stopy)

Function Documentation

void* thread_io ( void *  parms)

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);
}
color trace ( ray primary)

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  scene,
void *  tga,
int  startx,
int  starty,
int  stopx,
int  stopy 
)

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  scene,
int  startx,
int  stopx,
int  starty,
int  stopy 
)

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);
}

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