![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#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.serial.cpp:Go to the source code of this file.
Functions | |
| static void | parallel_thread (void) |
| static color_t | render_one_pixel (int x, int y, unsigned int *local_mbox, unsigned int &serial, int startx, int stopx, int starty, int stopy) |
| void * | thread_trace (thr_parms *parms) |
Variables | |
| static thr_parms * | all_parms |
| static flt | jitterscale |
| static scenedef | scene |
| static int | startx |
| static int | starty |
| static int | stopx |
| static int | stopy |
| static int | totaly |
| static void parallel_thread | ( | void | ) | [static] |
Definition at line 152 of file trace.serial.cpp.
References max_objectid(), video::next_frame(), drawing_area::put_pixel(), render_one_pixel(), startx, starty, stopx, stopy, and totaly.
Referenced by thread_trace().
{
// thread-local storage
unsigned int serial = 1;
unsigned int mboxsize = sizeof(unsigned int)*(max_objectid() + 20);
unsigned int * local_mbox = (unsigned int *) alloca(mboxsize);
memset(local_mbox,0,mboxsize);
for (int y = starty; y < stopy; y++) { {
drawing_area drawing(startx, totaly-y, stopx-startx, 1);
for (int x = startx; x < stopx; x++) {
color_t c = render_one_pixel (x, y, local_mbox, serial, startx, stopx, starty, stopy);
drawing.put_pixel(c);
} }
if(!video->next_frame()) return;
}
}
| static color_t render_one_pixel | ( | int | x, |
| int | y, | ||
| unsigned int * | local_mbox, | ||
| unsigned int & | serial, | ||
| int | startx, | ||
| int | stopx, | ||
| int | starty, | ||
| int | stopy | ||
| ) | [static] |
Definition at line 83 of file trace.serial.cpp.
References scenedef::antialiasing, color::b, camray(), ray::d, FHUGE, ray::flags, color::g, video::get_color(), ray::intstruct, jitterscale, ray::maxdist, ray::mbox, color::r, RT_RAY_REGULAR, scene, ray::scene, ray::serial, trace(), vector::x, vector::y, and vector::z.
Referenced by parallel_thread().
{
/* private vars moved inside loop */
ray primary, sample;
color col, avcol;
int R,G,B;
intersectstruct local_intersections;
int alias;
/* end private */
primary=camray(&scene, x, y);
primary.intstruct = &local_intersections;
primary.flags = RT_RAY_REGULAR;
serial++;
primary.serial = serial;
primary.mbox = local_mbox;
primary.maxdist = FHUGE;
primary.scene = &scene;
col=trace(&primary);
serial = primary.serial;
/* perform antialiasing if enabled.. */
if (scene.antialiasing > 0) {
for (alias=0; alias < scene.antialiasing; alias++) {
serial++; /* increment serial number */
sample=primary; /* copy the regular primary ray to start with */
sample.serial = serial;
{
sample.d.x+=((std::rand() % 100) - 50) / jitterscale;
sample.d.y+=((std::rand() % 100) - 50) / jitterscale;
sample.d.z+=((std::rand() % 100) - 50) / jitterscale;
}
avcol=trace(&sample);
serial = sample.serial; /* update our overall serial # */
col.r += avcol.r;
col.g += avcol.g;
col.b += avcol.b;
}
col.r /= (scene.antialiasing + 1.0);
col.g /= (scene.antialiasing + 1.0);
col.b /= (scene.antialiasing + 1.0);
}
/* Handle overexposure and underexposure here... */
R=(int) (col.r*255);
if (R > 255) R = 255;
else if (R < 0) R = 0;
G=(int) (col.g*255);
if (G > 255) G = 255;
else if (G < 0) G = 0;
B=(int) (col.b*255);
if (B > 255) B = 255;
else if (B < 0) B = 0;
return video->get_color(R, G, B);
}
| void* thread_trace | ( | thr_parms * | parms | ) |
Definition at line 170 of file trace.serial.cpp.
References scenedef::hres, jitterscale, 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.
Definition at line 74 of file trace.serial.cpp.
flt jitterscale [static] |
Definition at line 80 of file trace.serial.cpp.
Referenced by render_one_pixel(), and thread_trace().
Definition at line 75 of file trace.serial.cpp.
Referenced by main_init_parts(), render_one_pixel(), rt_background(), rt_boundmode(), rt_boundthresh(), rt_camerasetup(), rt_displaymode(), rt_newscene(), rt_outputfile(), rt_rawimage(), rt_renderscene(), rt_resolution(), rt_verbose(), and trace_shm().
int startx [static] |
Definition at line 76 of file trace.serial.cpp.
Referenced by parallel_thread(), thread_trace(), and trace_shm().
int starty [static] |
Definition at line 78 of file trace.serial.cpp.
Referenced by parallel_thread(), thread_trace(), and trace_shm().
int stopx [static] |
Definition at line 77 of file trace.serial.cpp.
Referenced by parallel_thread(), thread_trace(), and trace_shm().
int stopy [static] |
Definition at line 79 of file trace.serial.cpp.
Referenced by parallel_thread(), thread_trace(), and trace_shm().
int totaly [static] |
Definition at line 81 of file trace.serial.cpp.
Referenced by parallel_thread(), thread_trace(), and writetgaregion().
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.