Revision: 56252
http://sourceforge.net/p/brlcad/code/56252
Author: brlcad
Date: 2013-07-27 04:04:49 +0000 (Sat, 27 Jul 2013)
Log Message:
-----------
ws cleanup for the rest of this directory
Modified Paths:
--------------
brlcad/trunk/src/adrt/librender/camera.c
brlcad/trunk/src/adrt/librender/camera.h
brlcad/trunk/src/adrt/librender/component.c
brlcad/trunk/src/adrt/librender/cut.c
brlcad/trunk/src/adrt/librender/depth.c
brlcad/trunk/src/adrt/librender/flat.c
brlcad/trunk/src/adrt/librender/flos.c
brlcad/trunk/src/adrt/librender/grid.c
brlcad/trunk/src/adrt/librender/hit.c
brlcad/trunk/src/adrt/librender/normal.c
brlcad/trunk/src/adrt/librender/path.c
brlcad/trunk/src/adrt/librender/phong.c
brlcad/trunk/src/adrt/librender/render_util.c
brlcad/trunk/src/adrt/librender/spall.c
brlcad/trunk/src/adrt/librender/surfel.c
brlcad/trunk/src/adrt/librender/texture.h
brlcad/trunk/src/adrt/librender/texture_blend.c
brlcad/trunk/src/adrt/librender/texture_bump.c
brlcad/trunk/src/adrt/librender/texture_camo.c
brlcad/trunk/src/adrt/librender/texture_checker.c
brlcad/trunk/src/adrt/librender/texture_clouds.c
brlcad/trunk/src/adrt/librender/texture_gradient.c
brlcad/trunk/src/adrt/librender/texture_image.c
brlcad/trunk/src/adrt/librender/texture_internal.h
brlcad/trunk/src/adrt/librender/texture_mix.c
brlcad/trunk/src/adrt/librender/texture_perlin.c
brlcad/trunk/src/adrt/librender/texture_stack.c
Modified: brlcad/trunk/src/adrt/librender/camera.c
===================================================================
--- brlcad/trunk/src/adrt/librender/camera.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/camera.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -40,12 +40,13 @@
struct render_shader_s {
- const char *name;
- int (*init)(render_t *, const char *);
- void *dlh; /* dynamic library handle */
- struct render_shader_s *next;
+ const char *name;
+ int (*init)(render_t *, const char *);
+ void *dlh; /* dynamic library handle */
+ struct render_shader_s *next;
};
+
static struct render_shader_s *shaders = NULL;
void render_camera_render_thread(int cpu, genptr_t ptr); /* for
bu_parallel */
@@ -110,49 +111,50 @@
up[2] = 1;
/* Generate unitized lookector */
- VSUB2(look, camera->focus, camera->pos);
+ VSUB2(look, camera->focus, camera->pos);
VUNITIZE(look);
/* Make unitized up vector perpendicular to lookector */
VMOVE(temp, look);
- angle = VDOT( up, temp);
- VSCALE(temp, temp, angle);
- VSUB2(up, up, temp);
+ angle = VDOT(up, temp);
+ VSCALE(temp, temp, angle);
+ VSUB2(up, up, temp);
VUNITIZE(up);
/* Generate a temporary side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* Apply tilt to up vector - negate angle to make positive angles
clockwise */
s = sin(-camera->tilt * DEG2RAD);
c = cos(-camera->tilt * DEG2RAD);
- VSCALE(up, up, c);
- VSCALE(side, side, s);
- VADD2(up, up, side);
+ VSCALE(up, up, c);
+ VSCALE(side, side, s);
+ VADD2(up, up, side);
/* Create final side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* look direction */
VMOVE(camera->view_list[0].top_l, look);
/* gridsize is millimeters along the horizontal axis to display */
/* left (side) */
- VSCALE(temp, side, (camera->aspect * camera->gridsize * 0.5));
- VADD2(camera->view_list[0].pos, camera->pos, temp);
+ VSCALE(temp, side, (camera->aspect * camera->gridsize * 0.5));
+ VADD2(camera->view_list[0].pos, camera->pos, temp);
/* and (up) */
- VSCALE(temp, up, (camera->gridsize * 0.5));
- VADD2(camera->view_list[0].pos, camera->view_list[0].pos, temp);
+ VSCALE(temp, up, (camera->gridsize * 0.5));
+ VADD2(camera->view_list[0].pos, camera->view_list[0].pos, temp);
/* compute step vectors for camera position */
/* X */
- VSCALE(camera->view_list[0].step_x, side, (-camera->gridsize *
camera->aspect / (tfloat)camera->w));
+ VSCALE(camera->view_list[0].step_x, side, (-camera->gridsize *
camera->aspect / (tfloat)camera->w));
/* Y */
- VSCALE(camera->view_list[0].step_y, up, (-camera->gridsize /
(tfloat)camera->h));
+ VSCALE(camera->view_list[0].step_y, up, (-camera->gridsize /
(tfloat)camera->h));
}
+
static void
render_camera_prep_persp(render_camera_t *camera)
{
@@ -161,7 +163,7 @@
/* Generate unitized lookector */
- VSUB2(look, camera->focus, camera->pos);
+ VSUB2(look, camera->focus, camera->pos);
VUNITIZE(look);
/* Generate standard up vector */
@@ -171,23 +173,23 @@
/* Make unitized up vector perpendicular to lookector */
VMOVE(temp, look);
- angle = VDOT(up, temp);
- VSCALE(temp, temp, angle);
- VSUB2(up, up, temp);
+ angle = VDOT(up, temp);
+ VSCALE(temp, temp, angle);
+ VSUB2(up, up, temp);
VUNITIZE(up);
/* Generate a temporary side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* Apply tilt to up vector - negate angle to make positive angles
clockwise */
s = sin(-camera->tilt * DEG2RAD);
c = cos(-camera->tilt * DEG2RAD);
- VSCALE(up, up, c);
- VSCALE(side, side, s);
- VADD2(up, up, side);
+ VSCALE(up, up, c);
+ VSCALE(side, side, s);
+ VADD2(up, up, side);
/* Create final side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* Compute sine and cosine terms for field of view */
s = sin(camera->fov*DEG2RAD);
@@ -217,15 +219,16 @@
VMOVE(camera->view_list[0].top_l, topl);
/* Generate stepx and stepy vectors for sampling each pixel */
- VSUB2(camera->view_list[0].step_x, topr, topl);
- VSUB2(camera->view_list[0].step_y, botl, topl);
+ VSUB2(camera->view_list[0].step_x, topr, topl);
+ VSUB2(camera->view_list[0].step_y, botl, topl);
/* Divide stepx and stepy by the number of pixels */
- VSCALE(camera->view_list[0].step_x, camera->view_list[0].step_x, 1.0 /
camera->w);
- VSCALE(camera->view_list[0].step_y, camera->view_list[0].step_y, 1.0 /
camera->h);
+ VSCALE(camera->view_list[0].step_x, camera->view_list[0].step_x, 1.0 /
camera->w);
+ VSCALE(camera->view_list[0].step_y, camera->view_list[0].step_y, 1.0 /
camera->h);
return;
}
+
static void
render_camera_prep_persp_dof(render_camera_t *camera)
{
@@ -235,7 +238,7 @@
/* Generate unitized lookector */
- VSUB2(dof_look, camera->focus, camera->pos);
+ VSUB2(dof_look, camera->focus, camera->pos);
VUNITIZE(dof_look);
/* Generate standard up vector */
@@ -245,30 +248,30 @@
/* Make unitized up vector perpendicular to lookector */
VMOVE(temp, dof_look);
- angle = VDOT( dof_up, temp);
- VSCALE(temp, temp, angle);
- VSUB2(dof_up, dof_up, temp);
+ angle = VDOT(dof_up, temp);
+ VSCALE(temp, temp, angle);
+ VSUB2(dof_up, dof_up, temp);
VUNITIZE(dof_up);
/* Generate a temporary side vector */
- VCROSS(dof_side, dof_up, dof_look);
+ VCROSS(dof_side, dof_up, dof_look);
/* Apply tilt to up vector - negate angle to make positive angles
clockwise */
sdof = sin(-camera->tilt * DEG2RAD);
cdof = cos(-camera->tilt * DEG2RAD);
- VSCALE(dof_up, dof_up, cdof);
- VSCALE(dof_side, dof_side, sdof);
- VADD2(dof_up, dof_up, dof_side);
+ VSCALE(dof_up, dof_up, cdof);
+ VSCALE(dof_side, dof_side, sdof);
+ VADD2(dof_up, dof_up, dof_side);
/* Create final side vector */
- VCROSS(dof_side, dof_up, dof_look);
+ VCROSS(dof_side, dof_up, dof_look);
/*
* Generate a camera position, top left vector, and step vectors for each
DOF sample
*/
/* Obtain magnitude of reverse lookector */
- VSUB2(dof_look, camera->pos, camera->focus);
+ VSUB2(dof_look, camera->pos, camera->focus);
mag = MAGNITUDE(dof_look);
VUNITIZE(dof_look);
@@ -295,24 +298,22 @@
VUNITIZE(dof_botl);
VUNITIZE(dof_topr);
- VSUB2(step_x, dof_topr, dof_topl);
- VSUB2(step_y, dof_botl, dof_topl);
+ VSUB2(step_x, dof_topr, dof_topl);
+ VSUB2(step_y, dof_botl, dof_topl);
- for (i = 0; i < RENDER_CAMERA_DOF_SAMPLES; i++)
- {
- for (n = 0; n < RENDER_CAMERA_DOF_SAMPLES; n++)
- {
+ for (i = 0; i < RENDER_CAMERA_DOF_SAMPLES; i++) {
+ for (n = 0; n < RENDER_CAMERA_DOF_SAMPLES; n++) {
/* Generate virtual camera position for this depth of field sample
*/
- VSCALE(temp, step_x,
((tfloat)i/(tfloat)(RENDER_CAMERA_DOF_SAMPLES-1)));
- VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
dof_topl, temp);
- VSCALE(temp, step_y,
((tfloat)n/(tfloat)(RENDER_CAMERA_DOF_SAMPLES-1)));
- VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, temp);
+ VSCALE(temp, step_x,
((tfloat)i/(tfloat)(RENDER_CAMERA_DOF_SAMPLES-1)));
+ VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
dof_topl, temp);
+ VSCALE(temp, step_y,
((tfloat)n/(tfloat)(RENDER_CAMERA_DOF_SAMPLES-1)));
+ VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, temp);
VUNITIZE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos);
- VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, mag);
- VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, camera->focus);
+ VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, mag);
+ VADD2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos, camera->focus);
/* Generate unitized lookector */
- VSUB2(look, camera->focus,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos);
+ VSUB2(look, camera->focus,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].pos);
VUNITIZE(look);
/* Generate standard up vector */
@@ -322,23 +323,23 @@
/* Make unitized up vector perpendicular to lookector */
VMOVE(temp, look);
- angle = VDOT( up, temp);
- VSCALE(temp, temp, angle);
- VSUB2(up, up, temp);
+ angle = VDOT(up, temp);
+ VSCALE(temp, temp, angle);
+ VSUB2(up, up, temp);
VUNITIZE(up);
/* Generate a temporary side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* Apply tilt to up vector - negate angle to make positive angles
clockwise */
sfov = sin(-camera->tilt * DEG2RAD);
cfov = cos(-camera->tilt * DEG2RAD);
- VSCALE(up, up, cfov);
- VSCALE(side, side, sfov);
- VADD2(up, up, side);
+ VSCALE(up, up, cfov);
+ VSCALE(side, side, sfov);
+ VADD2(up, up, side);
/* Create final side vector */
- VCROSS(side, up, look);
+ VCROSS(side, up, look);
/* Compute sine and cosine terms for field of view */
sfov = sin(camera->fov*DEG2RAD);
@@ -366,16 +367,17 @@
VMOVE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].top_l, topl);
/* Generate stepx and stepy vectors for sampling each pixel */
- VSUB2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x,
topr, topl);
- VSUB2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y,
botl, topl);
+ VSUB2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x,
topr, topl);
+ VSUB2(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y,
botl, topl);
/* Divide stepx and stepy by the number of pixels */
- VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x, 1.0 / camera->w);
- VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y, 1.0 / camera->h);
+ VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_x, 1.0 / camera->w);
+ VSCALE(camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y,
camera->view_list[i*RENDER_CAMERA_DOF_SAMPLES+n].step_y, 1.0 / camera->h);
}
}
}
+
void
render_camera_prep(render_camera_t *camera)
{
@@ -385,14 +387,10 @@
if (camera->type == RENDER_CAMERA_ORTHOGRAPHIC)
render_camera_prep_ortho(camera);
- if (camera->type == RENDER_CAMERA_PERSPECTIVE)
- {
- if (camera->dof <= 0.0)
- {
+ if (camera->type == RENDER_CAMERA_PERSPECTIVE) {
+ if (camera->dof <= 0.0) {
render_camera_prep_persp(camera);
- }
- else
- {
+ } else {
/* Generate camera positions for depth of field - Handle this
better */
camera->view_num =
RENDER_CAMERA_DOF_SAMPLES*RENDER_CAMERA_DOF_SAMPLES;
camera->view_list = (render_camera_view_t
*)bu_malloc(sizeof(render_camera_view_t) * camera->view_num, "camera view");
@@ -422,58 +420,46 @@
res_ind = 0;
/* row, vertical */
/*
- for (i = td->tile->orig_y; i < td->tile->orig_y + td->tile->size_y; i++)
- {
+ for (i = td->tile->orig_y; i < td->tile->orig_y + td->tile->size_y; i++) {
*/
- while (1)
- {
+ while (1) {
/* Determine if this scanline should be computed by this thread */
bu_semaphore_acquire(TIE_SEM_WORKER);
- if (*td->scanline == td->tile->size_y)
- {
+ if (*td->scanline == td->tile->size_y) {
bu_semaphore_release(TIE_SEM_WORKER);
return;
- }
- else
- {
+ } else {
scanline = *td->scanline;
(*td->scanline)++;
}
bu_semaphore_release(TIE_SEM_WORKER);
v_scanline = scanline + td->tile->orig_y;
- if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_24)
- {
+ if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_24) {
res_ind = 3*scanline*td->tile->size_x;
- }
- else if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_128)
- {
+ } else if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_128) {
res_ind = 4*scanline*td->tile->size_x;
}
/* optimization if there is no depth of field being applied */
- if (td->camera->view_num == 1)
- {
- VSCALE(v1, td->camera->view_list[0].step_y, v_scanline);
- VADD2(v1, v1, td->camera->view_list[0].top_l);
+ if (td->camera->view_num == 1) {
+ VSCALE(v1, td->camera->view_list[0].step_y, v_scanline);
+ VADD2(v1, v1, td->camera->view_list[0].top_l);
}
/* scanline, horizontal, each pixel */
- for (n = td->tile->orig_x; n < td->tile->orig_x + td->tile->size_x; n++)
- {
+ for (n = td->tile->orig_x; n < td->tile->orig_x + td->tile->size_x;
n++) {
/* depth of view samples */
- if (td->camera->view_num > 1)
- {
+ if (td->camera->view_num > 1) {
VSET(accum, 0, 0, 0);
- for (d = 0; d < td->camera->view_num; d++)
- {
- VSCALE(ray.dir, td->camera->view_list[d].step_y,
v_scanline);
- VADD2(ray.dir, ray.dir, td->camera->view_list[d].top_l);
- VSCALE(v1, td->camera->view_list[d].step_x, n);
- VADD2(ray.dir, ray.dir, v1);
+ for (d = 0; d < td->camera->view_num; d++) {
+ VSCALE(ray.dir, td->camera->view_list[d].step_y,
v_scanline);
+ VADD2(ray.dir, ray.dir, td->camera->view_list[d].top_l);
+ VSCALE(v1, td->camera->view_list[d].step_x, n);
+ VADD2(ray.dir, ray.dir, v1);
VSET(pixel, (tfloat)RENDER_CAMERA_BGR,
(tfloat)RENDER_CAMERA_BGG, (tfloat)RENDER_CAMERA_BGB);
@@ -484,18 +470,15 @@
/* Compute pixel value using this ray */
td->camera->render.work(&td->camera->render, td->tie, &ray,
&pixel);
- VADD2(accum, accum, pixel);
+ VADD2(accum, accum, pixel);
}
/* Find Mean value of all views */
- VSCALE(pixel, accum, view_inv);
- }
- else
- {
- if (td->camera->type == RENDER_CAMERA_PERSPECTIVE)
- {
- VSCALE(v2, td->camera->view_list[0].step_x, n);
- VADD2(ray.dir, v1, v2);
+ VSCALE(pixel, accum, view_inv);
+ } else {
+ if (td->camera->type == RENDER_CAMERA_PERSPECTIVE) {
+ VSCALE(v2, td->camera->view_list[0].step_x, n);
+ VADD2(ray.dir, v1, v2);
VSET(pixel, (tfloat)RENDER_CAMERA_BGR,
(tfloat)RENDER_CAMERA_BGG, (tfloat)RENDER_CAMERA_BGB);
@@ -509,10 +492,10 @@
VMOVE(ray.pos, td->camera->view_list[0].pos);
VMOVE(ray.dir, td->camera->view_list[0].top_l);
- VSCALE(v1, td->camera->view_list[0].step_x, n);
- VSCALE(v2, td->camera->view_list[0].step_y, v_scanline);
- VADD2(ray.pos, ray.pos, v1);
- VADD2(ray.pos, ray.pos, v2);
+ VSCALE(v1, td->camera->view_list[0].step_x, n);
+ VSCALE(v2, td->camera->view_list[0].step_y, v_scanline);
+ VADD2(ray.pos, ray.pos, v1);
+ VADD2(ray.pos, ray.pos, v2);
VSET(pixel, (tfloat)RENDER_CAMERA_BGR,
(tfloat)RENDER_CAMERA_BGG, (tfloat)RENDER_CAMERA_BGB);
ray.depth = 0;
@@ -523,8 +506,7 @@
}
- if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_24)
- {
+ if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_24) {
if (pixel[0] > 1) pixel[0] = 1;
if (pixel[1] > 1) pixel[1] = 1;
if (pixel[2] > 1) pixel[2] = 1;
@@ -532,9 +514,7 @@
((char *)(td->res_buf))[res_ind+1] = (unsigned char)(255 *
pixel[1]);
((char *)(td->res_buf))[res_ind+2] = (unsigned char)(255 *
pixel[2]);
res_ind += 3;
- }
- else if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_128)
- {
+ } else if (td->tile->format == RENDER_CAMERA_BIT_DEPTH_128) {
tfloat alpha;
alpha = 1.0;
@@ -562,12 +542,9 @@
ind = result->ind;
/* Allocate storage for results */
- if (tile->format == RENDER_CAMERA_BIT_DEPTH_24)
- {
+ if (tile->format == RENDER_CAMERA_BIT_DEPTH_24) {
ind += 3 * (unsigned int)tile->size_x * (unsigned int)tile->size_y +
sizeof(camera_tile_t);
- }
- else if (tile->format == RENDER_CAMERA_BIT_DEPTH_128)
- {
+ } else if (tile->format == RENDER_CAMERA_BIT_DEPTH_128) {
ind += 4 * sizeof(tfloat) * (unsigned int)tile->size_x * (unsigned
int)tile->size_y + sizeof(camera_tile_t);
}
@@ -590,6 +567,7 @@
return;
}
+
struct render_shader_s *
render_shader_register(const char *name, int (*init)(render_t *, const char *))
{
@@ -605,6 +583,7 @@
return shader;
}
+
const char *
render_shader_load_plugin(const char *filename) {
#ifdef HAVE_DLFCN_H
@@ -630,6 +609,7 @@
#endif
}
+
int
render_shader_unload_plugin(render_t *r, const char *name)
{
@@ -639,14 +619,14 @@
t = s->next;
if(r && r->shader && !bu_strncmp(r->shader, name, 8)) {
meh = s->next;
- while( meh ) {
+ while(meh) {
if(render_shader_init(r, meh->name, NULL) != -1)
goto LOADED;
meh = meh->next;
}
bu_exit(-1, "Unable to find suitable shader\n");
}
-LOADED:
+ LOADED:
if(s->dlh)
bu_dlclose(s->dlh);
@@ -675,6 +655,7 @@
return -1;
}
+
int
render_shader_init(render_t *r, const char *name, const char *buf)
{
@@ -691,6 +672,7 @@
return -1;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/camera.h
===================================================================
--- brlcad/trunk/src/adrt/librender/camera.h 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/camera.h 2013-07-27 04:04:49 UTC (rev
56252)
@@ -28,12 +28,12 @@
#include "adrt.h"
#include "render.h"
-#define RENDER_CAMERA_DOF_SAMPLES 13
+#define RENDER_CAMERA_DOF_SAMPLES 13
#define RENDER_CAMERA_PERSPECTIVE 0x0
#define RENDER_CAMERA_ORTHOGRAPHIC 0x1
-#define RENDER_CAMERA_BGR 0.00
-#define RENDER_CAMERA_BGG 0.05
-#define RENDER_CAMERA_BGB 0.15
+#define RENDER_CAMERA_BGR 0.00
+#define RENDER_CAMERA_BGG 0.05
+#define RENDER_CAMERA_BGB 0.15
#define RENDER_CAMERA_BIT_DEPTH_24 0
#define RENDER_CAMERA_BIT_DEPTH_128 1
Modified: brlcad/trunk/src/adrt/librender/component.c
===================================================================
--- brlcad/trunk/src/adrt/librender/component.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/component.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -33,6 +33,7 @@
return;
}
+
static void *
component_hit(struct tie_ray_s *ray, struct tie_id_s *UNUSED(id), struct
tie_tri_s *tri, void *UNUSED(ptr))
{
@@ -42,6 +43,7 @@
return (mesh->flags & (ADRT_MESH_SELECT|ADRT_MESH_HIT)) ? mesh : NULL;
}
+
void
render_component_work(render_t *UNUSED(render), struct tie_s *tie, struct
tie_ray_s *ray, vect_t *pixel)
{
@@ -68,6 +70,7 @@
}
}
+
int
render_component_init(render_t *render, const char *UNUSED(usr)) {
render->work = render_component_work;
@@ -75,6 +78,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/cut.c
===================================================================
--- brlcad/trunk/src/adrt/librender/cut.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/cut.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -147,7 +147,7 @@
*/
/* flipped normal */
- dot = fabs(VDOT(ray->dir, hit.id.norm));
+ dot = fabs(VDOT(ray->dir, hit.id.norm));
if (hit.mesh->flags & (ADRT_MESH_SELECT|ADRT_MESH_HIT)) {
VSET(color, hit.mesh->flags & ADRT_MESH_HIT ? (tfloat)0.9 :
(tfloat)0.2, (tfloat)0.2, hit.mesh->flags & ADRT_MESH_SELECT ? (tfloat)0.9 :
(tfloat)0.2);
@@ -155,9 +155,9 @@
/* Mix actual color with white 4:1, shade 50% darker */
#if 0
VSET(color, 1.0, 1.0, 1.0);
- VSCALE(color, color, 3.0);
- VADD2(color, color, hit.mesh->attributes->color);
- VSCALE(color, color, 0.125);
+ VSCALE(color, color, 3.0);
+ VADD2(color, color, hit.mesh->attributes->color);
+ VSCALE(color, color, 0.125);
#else
VSET(color, (tfloat)0.8, (tfloat)0.8, (tfloat)0.7);
#endif
@@ -167,16 +167,16 @@
if (dot < 0) {
#endif
/* Shade using inhit */
- VSCALE((*pixel), color, (dot*0.90));
+ VSCALE((*pixel), color, (dot*0.90));
#if 0
} else {
TIE_3 vec;
fastf_t angle;
/* shade solid */
- VSUB2(vec, ray->pos, hit.id.pos);
+ VSUB2(vec, ray->pos, hit.id.pos);
VUNITIZE(vec);
angle = vec[0]*hit.mod*-hit.plane[0] + vec[1]*-hit.mod*hit.plane[1] +
vec[2]*-hit.mod*hit.plane[2];
- VSCALE((*pixel), color, (angle*0.90));
+ VSCALE((*pixel), color, (angle*0.90));
}
#endif
@@ -240,11 +240,11 @@
/* Calculate the normal to be used for the plane */
VSET(up, 0, 0, 1);
- VCROSS(d->plane, ray_dir, up);
+ VCROSS(d->plane, ray_dir, up);
VUNITIZE(d->plane);
/* Construct the plane */
- d->plane[3] = -VDOT(d->plane, ray_pos); /* up is really new ray_pos */
+ d->plane[3] = -VDOT(d->plane, ray_pos); /* up is really new ray_pos */
/* generate the shtuff for the blue line */
tie_init(&d->tie, 2, TIE_KDTREE_FAST);
Modified: brlcad/trunk/src/adrt/librender/depth.c
===================================================================
--- brlcad/trunk/src/adrt/librender/depth.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/depth.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -31,6 +31,7 @@
return;
}
+
void
render_depth_work(render_t *UNUSED(render), struct tie_s *tie, struct
tie_ray_s *ray, vect_t *pixel)
{
@@ -41,6 +42,7 @@
*pixel[0] = 0.0075 * ray->kdtree_depth;
}
+
int
render_depth_init(render_t *render, const char *UNUSED(usr))
{
@@ -49,6 +51,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/flat.c
===================================================================
--- brlcad/trunk/src/adrt/librender/flat.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/flat.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -30,6 +30,7 @@
{
}
+
void
render_flat_work(render_t *UNUSED(render), struct tie_s *tie, struct tie_ray_s
*ray, vect_t *pixel)
{
@@ -43,6 +44,7 @@
}
}
+
int
render_flat_init(render_t *render, const char *UNUSED(usr))
{
Modified: brlcad/trunk/src/adrt/librender/flos.c
===================================================================
--- brlcad/trunk/src/adrt/librender/flos.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/flos.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -41,6 +41,7 @@
render_flos_free(render_t *UNUSED(render)) {
}
+
void
render_flos_work(render_t *render, struct tie_s *tie, struct tie_ray_s *ray,
vect_t *pixel) {
struct tie_id_s id, tid;
@@ -55,24 +56,28 @@
} else
return;
- VSUB2(vec, ray->pos, id.pos);
+ VSUB2(vec, ray->pos, id.pos);
VUNITIZE(vec);
- angle = VDOT( vec, id.norm);
+ angle = VDOT(vec, id.norm);
/* Determine if direct line of sight to fragment */
VMOVE(ray->pos, rd->frag_pos);
- VSUB2(ray->dir, id.pos, rd->frag_pos);
+ VSUB2(ray->dir, id.pos, rd->frag_pos);
VUNITIZE(ray->dir);
- if (tie_work(tie, ray, &tid, render_hit, NULL))
- if (fabs (id.pos[0] - tid.pos[0]) < TIE_PREC &&
- fabs (id.pos[1] - tid.pos[1]) < TIE_PREC &&
- fabs (id.pos[2] - tid.pos[2]) < TIE_PREC)
+ if (tie_work(tie, ray, &tid, render_hit, NULL)) {
+ if (fabs (id.pos[0] - tid.pos[0]) < TIE_PREC
+ && fabs (id.pos[1] - tid.pos[1]) < TIE_PREC
+ && fabs (id.pos[2] - tid.pos[2]) < TIE_PREC)
+ {
VSET(*pixel, 1.0, 0.0, 0.0);
+ }
+ }
VSCALE(*pixel, *pixel, (0.5+angle*0.5));
}
+
int
render_flos_init(render_t *render, const char *frag_pos)
{
@@ -93,6 +98,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/grid.c
===================================================================
--- brlcad/trunk/src/adrt/librender/grid.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/grid.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -33,39 +33,41 @@
{
}
+
void
render_grid_work(render_t *UNUSED(render), struct tie_s *tie, struct tie_ray_s
*ray, vect_t *pixel)
{
- struct tie_id_s id;
- vect_t vec;
- tfloat angle;
+ struct tie_id_s id;
+ vect_t vec;
+ tfloat angle;
- if (tie_work(tie, ray, &id, render_hit, NULL) != NULL) {
- /* if X or Y lie in the grid paint it white else make it gray */
- if (fabs(GRID*id.pos[0] - (int)(GRID*id.pos[0])) < 0.2*LINE ||
fabs(GRID*id.pos[1] - (int)(GRID*id.pos[1])) < 0.2*LINE) {
- *pixel[0] = (tfloat)0.9;
- *pixel[1] = (tfloat)0.9;
- *pixel[2] = (tfloat)0.9;
- } else {
- *pixel[0] = (tfloat)0.1;
- *pixel[1] = (tfloat)0.1;
- *pixel[2] = (tfloat)0.1;
- }
+ if (tie_work(tie, ray, &id, render_hit, NULL) != NULL) {
+ /* if X or Y lie in the grid paint it white else make it gray */
+ if (fabs(GRID*id.pos[0] - (int)(GRID*id.pos[0])) < 0.2*LINE ||
fabs(GRID*id.pos[1] - (int)(GRID*id.pos[1])) < 0.2*LINE) {
+ *pixel[0] = (tfloat)0.9;
+ *pixel[1] = (tfloat)0.9;
+ *pixel[2] = (tfloat)0.9;
} else {
- return;
+ *pixel[0] = (tfloat)0.1;
+ *pixel[1] = (tfloat)0.1;
+ *pixel[2] = (tfloat)0.1;
}
+ } else {
+ return;
+ }
- VSUB2(vec, ray->pos, id.pos);
- VUNITIZE(vec);
- angle = VDOT(vec, id.norm);
- VSCALE(*pixel, *pixel, (angle*0.9));
+ VSUB2(vec, ray->pos, id.pos);
+ VUNITIZE(vec);
+ angle = VDOT(vec, id.norm);
+ VSCALE(*pixel, *pixel, (angle*0.9));
- *pixel[0] += (tfloat)0.1;
- *pixel[1] += (tfloat)0.1;
- *pixel[2] += (tfloat)0.1;
+ *pixel[0] += (tfloat)0.1;
+ *pixel[1] += (tfloat)0.1;
+ *pixel[2] += (tfloat)0.1;
}
+
int
render_grid_init(render_t *render, const char *UNUSED(usr))
{
@@ -74,6 +76,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/hit.c
===================================================================
--- brlcad/trunk/src/adrt/librender/hit.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/hit.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -24,7 +24,9 @@
#include "adrt_struct.h"
-void* render_hit(struct tie_ray_s *ray, struct tie_id_s *id, struct tie_tri_s
*tri, void *UNUSED(ptr)) {
+void *
+render_hit(struct tie_ray_s *ray, struct tie_id_s *id, struct tie_tri_s *tri,
void *UNUSED(ptr))
+{
/* Flip normal to face ray origin (via dot product check) */
if (ray->dir[0] * id->norm[0] + ray->dir[1] * id->norm[1] + ray->dir[2] *
id->norm[2] > 0)
VSCALE(id->norm, id->norm, -1.0);
@@ -32,6 +34,7 @@
return (adrt_mesh_t *)(tri->ptr);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/normal.c
===================================================================
--- brlcad/trunk/src/adrt/librender/normal.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/normal.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -26,32 +26,40 @@
#include "adrt_struct.h"
void
-render_normal_free(render_t *UNUSED(render)) {
+render_normal_free(render_t *UNUSED(render))
+{
return;
}
+
static void *
-normal_hit(struct tie_ray_s *UNUSED(ray), struct tie_id_s *UNUSED(id), struct
tie_tri_s *tri, void *UNUSED(ptr)) {
+normal_hit(struct tie_ray_s *UNUSED(ray), struct tie_id_s *UNUSED(id), struct
tie_tri_s *tri, void *UNUSED(ptr))
+{
return (adrt_mesh_t *)(tri->ptr);
}
+
void
-render_normal_work(render_t *UNUSED(render), struct tie_s *tie, struct
tie_ray_s *ray, vect_t *pixel) {
- struct tie_id_s id;
- float one[3] = { 1, 1, 1 };
+render_normal_work(render_t *UNUSED(render), struct tie_s *tie, struct
tie_ray_s *ray, vect_t *pixel)
+{
+ struct tie_id_s id;
+ float one[3] = { 1, 1, 1 };
if (tie_work(tie, ray, &id, normal_hit, NULL))
VADD2SCALE(*pixel, id.norm, one, 0.5);
return;
}
+
int
-render_normal_init(render_t *render, const char *UNUSED(usr)) {
+render_normal_init(render_t *render, const char *UNUSED(usr))
+{
render->work = render_normal_work;
render->free = render_normal_free;
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/path.c
===================================================================
--- brlcad/trunk/src/adrt/librender/path.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/path.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -44,11 +44,11 @@
/* _a is reflected ray, _b is incident ray, _c is normal */
#define MATH_VEC_REFLECT(_a, _b, _c) { \
- fastf_t _d; \
- _d = VDOT( _b, _c); \
- VSCALE(_a, _c, 2.0*_d); \
- VSUB2(_a, _b, _a); \
- VUNITIZE(_a); }
+ fastf_t _d; \
+ _d = VDOT(_b, _c); \
+ VSCALE(_a, _c, 2.0*_d); \
+ VSUB2(_a, _b, _a); \
+ VUNITIZE(_a); }
void
@@ -90,7 +90,7 @@
} else if (new_mesh->attributes->emission > 0.0) {
/* Emitting Light Source */
VMOVE(T, new_mesh->attributes->color.v);
- VSCALE(T, T, new_mesh->attributes->emission);
+ VSCALE(T, T, new_mesh->attributes->emission);
propogate = 0;
} else {
/* Diffuse */
@@ -102,7 +102,7 @@
}
if (new_ray.depth) {
- VELMUL(new_pix, new_pix, T);
+ VELMUL(new_pix, new_pix, T);
} else {
VMOVE(new_pix, T);
}
@@ -154,12 +154,13 @@
}
}
- VADD2(accum, accum, new_pix);
+ VADD2(accum, accum, new_pix);
}
- VSCALE(*pixel, accum, rd->inv_samples);
+ VSCALE(*pixel, accum, rd->inv_samples);
}
+
int
render_path_init(render_t *render, const char *samples)
{
Modified: brlcad/trunk/src/adrt/librender/phong.c
===================================================================
--- brlcad/trunk/src/adrt/librender/phong.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/phong.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -34,27 +34,29 @@
return;
}
+
void
render_phong_work(render_t *UNUSED(render), struct tie_s *tie, struct
tie_ray_s *ray, vect_t *pixel)
{
- struct tie_id_s id;
- adrt_mesh_t *mesh;
+ struct tie_id_s id;
+ adrt_mesh_t *mesh;
if ((mesh = (adrt_mesh_t*)tie_work(tie, ray, &id, render_hit, NULL)) !=
NULL) {
- vect_t vec;
+ vect_t vec;
VMOVE(*pixel, mesh->attributes->color.v);
if (mesh->texture)
mesh->texture->work(mesh->texture, mesh, ray, &id, pixel);
- VSUB2(vec, ray->pos, id.pos);
+ VSUB2(vec, ray->pos, id.pos);
VUNITIZE(vec);
- VSCALE(*pixel, *pixel, VDOT(vec, id.norm));
+ VSCALE(*pixel, *pixel, VDOT(vec, id.norm));
}
return;
}
+
int
render_phong_init(render_t *render, const char *UNUSED(usr))
{
@@ -63,6 +65,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/render_util.c
===================================================================
--- brlcad/trunk/src/adrt/librender/render_util.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/render_util.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -36,6 +36,7 @@
tfloat thickness;
};
+
struct render_shotline_s {
struct render_segment_s *seglist;
point_t in_hit;
@@ -78,6 +79,7 @@
#endif
}
+
static void* shot_hit(struct tie_ray_s *ray, struct tie_id_s *id, struct
tie_tri_s *tri, void *ptr) {
adrt_mesh_t *mesh = (adrt_mesh_t *)(tri->ptr);
struct render_shotline_s *shotline = (struct render_shotline_s *)ptr;
@@ -122,6 +124,7 @@
return NULL;
}
+
void
render_util_shotline_list(struct tie_s *tie, struct tie_ray_s *ray, void
**data, int *dlen) {
struct tie_id_s id;
@@ -172,6 +175,7 @@
bu_free(shotline.seglist, "render_util_shotline_list: shotline data");
}
+
void
render_util_spall_list(struct tie_s *UNUSED(tie), struct tie_ray_s
*UNUSED(ray), tfloat UNUSED(angle), void **UNUSED(data), int *UNUSED(dlen)) {
#if 0
@@ -264,6 +268,7 @@
#endif
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/spall.c
===================================================================
--- brlcad/trunk/src/adrt/librender/spall.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/spall.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -43,6 +43,7 @@
struct tie_s tie;
};
+
void* render_spall_hit(struct tie_ray_s *ray, struct tie_id_s *id, struct
tie_tri_s *tri, void *ptr);
void render_plane(struct tie_s *tie, struct tie_ray_s *ray, TIE_3 *pixel);
@@ -60,12 +61,14 @@
bu_free(render->data, "render data");
}
+
static void *
render_arrow_hit(struct tie_ray_s *UNUSED(ray), struct tie_id_s *UNUSED(id),
struct tie_tri_s *tri, void *UNUSED(ptr))
{
return tri;
}
+
void *
render_spall_hit(struct tie_ray_s *UNUSED(ray), struct tie_id_s *id, struct
tie_tri_s *tri, void *ptr)
{
@@ -76,6 +79,7 @@
return hit;
}
+
void
render_spall_work(render_t *render, struct tie_s *tie, struct tie_ray_s *ray,
vect_t *pixel)
{
@@ -138,7 +142,7 @@
* If the point after the splitting plane is an inhit, then just shade as
usual.
*/
- dot = VDOT( ray->dir, hit.id.norm);
+ dot = VDOT(ray->dir, hit.id.norm);
/* flip normal */
dot = fabs(dot);
@@ -174,6 +178,7 @@
*pixel[2] += (tfloat)0.1;
}
+
int
render_spall_init(render_t *render, const char *buf)
{
@@ -193,9 +198,9 @@
render->free = render_spall_free;
sscanf(buf, "(%lg %lg %lg) (%lg %lg %lg) %lg",
- &ray_pos[0], &ray_pos[1], &ray_pos[2],
- &ray_dir[0], &ray_dir[1], &ray_dir[2],
- &scan);
+ &ray_pos[0], &ray_pos[1], &ray_pos[2],
+ &ray_dir[0], &ray_dir[1], &ray_dir[2],
+ &scan);
angle = scan; /* double to fastf_t */
BU_ALLOC(render->data, struct render_spall_s);
@@ -218,7 +223,7 @@
d->plane[0] = normal[0];
d->plane[1] = normal[1];
d->plane[2] = normal[2];
- plane[3] = VDOT( normal, ray_pos); /* up is really new ray_pos */
+ plane[3] = VDOT(normal, ray_pos); /* up is really new ray_pos */
d->plane[3] = -plane[3];
/******************/
@@ -253,6 +258,7 @@
return 0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/surfel.c
===================================================================
--- brlcad/trunk/src/adrt/librender/surfel.c 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/surfel.c 2013-07-27 04:04:49 UTC (rev
56252)
@@ -76,6 +76,7 @@
}
}
+
int
render_surfel_init(render_t *render, const char *buf)
{
@@ -92,8 +93,8 @@
d->num = 0;
d->list = NULL;
/*
- d->list = (render_surfel_pt_t *)bu_malloc(d->num *
sizeof(render_surfel_pt_t), "data list");
- */
+ d->list = (render_surfel_pt_t *)bu_malloc(d->num *
sizeof(render_surfel_pt_t), "data list");
+ */
/* do something to extract num and list from buf */
return 0;
}
Modified: brlcad/trunk/src/adrt/librender/texture.h
===================================================================
--- brlcad/trunk/src/adrt/librender/texture.h 2013-07-27 03:46:32 UTC (rev
56251)
+++ brlcad/trunk/src/adrt/librender/texture.h 2013-07-27 04:04:49 UTC (rev
56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture.h
*
- * Comments -
- * Texture Library - Main Include
+ * Comments -
+ * Texture Library - Main Include
*
*/
@@ -29,22 +29,23 @@
#include "texture_internal.h"
-#define TEXTURE_BLEND 0x0200
-#define TEXTURE_BUMP 0x0201
-#define TEXTURE_CAMO 0x0202
-#define TEXTURE_CHECKER 0x0203
-#define TEXTURE_CLOUDS 0x0204
+#define TEXTURE_BLEND 0x0200
+#define TEXTURE_BUMP 0x0201
+#define TEXTURE_CAMO 0x0202
+#define TEXTURE_CHECKER 0x0203
+#define TEXTURE_CLOUDS 0x0204
#define TEXTURE_GRADIENT 0x0205
-#define TEXTURE_IMAGE 0x0206
-#define TEXTURE_MIX 0x0207
-#define TEXTURE_REFLECT 0x0208
-#define TEXTURE_STACK 0x0209
+#define TEXTURE_IMAGE 0x0206
+#define TEXTURE_MIX 0x0207
+#define TEXTURE_REFLECT 0x0208
+#define TEXTURE_STACK 0x0209
struct texture_perlin_s {
int *PV;
vect_t *RV;
};
+
BU_EXPORT extern void texture_perlin_init(struct texture_perlin_s *P);
BU_EXPORT extern void texture_perlin_free(struct texture_perlin_s *P);
BU_EXPORT extern fastf_t texture_perlin_noise3(struct texture_perlin_s *P,
vect_t V, fastf_t Size, int Depth);
@@ -55,6 +56,7 @@
vect_t color2;
};
+
BU_EXPORT extern void texture_blend_init(struct texture_s *texture, vect_t
color1, vect_t color2);
BU_EXPORT extern void texture_blend_free(struct texture_s *texture);
BU_EXPORT extern void texture_blend_work(__TEXTURE_WORK_PROTOTYPE__);
@@ -63,6 +65,7 @@
vect_t coef;
};
+
BU_EXPORT extern void texture_bump_init(struct texture_s *texture, vect_t rgb);
BU_EXPORT extern void texture_bump_free(struct texture_s *texture);
BU_EXPORT extern void texture_bump_work(__TEXTURE_WORK_PROTOTYPE__);
@@ -88,6 +91,7 @@
int tile;
};
+
BU_EXPORT extern void texture_checker_init(struct texture_s *texture, int
checker);
BU_EXPORT extern void texture_checker_free(struct texture_s *texture);
BU_EXPORT extern void texture_checker_work(__TEXTURE_WORK_PROTOTYPE__);
@@ -102,15 +106,17 @@
struct texture_perlin_s perlin;
};
+
BU_EXPORT extern void texture_cloudts_inis(struct texture_s *texture, fastf_t
size, int octaves, int absolute, vect_t scale, vect_t translate);
BU_EXPORT extern void texture_clouds_free(struct texture_s *texture);
BU_EXPORT extern void texture_clouds_work(__TEXTURE_WORK_PROTOTYPE__);
struct texture_gradient_s {
- int axis;
+ int axis;
};
+
BU_EXPORT extern void texture_gradient_init(struct texture_s *texture, int
axis);
BU_EXPORT extern void texture_gradient_free(struct texture_s *texture);
BU_EXPORT extern void texture_gradient_work(__TEXTURE_WORK_PROTOTYPE__);
@@ -122,6 +128,7 @@
unsigned char *image;
};
+
BU_EXPORT extern void texture_image_init(struct texture_s *texture, short w,
short h, unsigned char *image);
BU_EXPORT extern void texture_image_free(struct texture_s *texture);
BU_EXPORT extern void texture_image_work(__TEXTURE_WORK_PROTOTYPE__);
@@ -139,8 +146,8 @@
struct texture_stack_s {
- int num;
- struct texture_s **list;
+ int num;
+ struct texture_s **list;
};
Modified: brlcad/trunk/src/adrt/librender/texture_blend.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_blend.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_blend.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_blend.c
*
- * Comments -
- * Texture Library - Uses the R and B channels to blend 2 colors
+ * Comments -
+ * Texture Library - Uses the R and B channels to blend 2 colors
*
*/
@@ -42,11 +42,13 @@
VMOVE(sd->color2, color2);
}
+
void
texture_blend_free(struct texture_s *texture) {
bu_free(texture->data, "texture data");
}
+
void
texture_blend_work(struct texture_s *texture, void *UNUSED(mesh), struct
tie_ray_s *UNUSED(ray), struct tie_id_s *UNUSED(id), vect_t *pixel) {
struct texture_blend_s *sd;
@@ -60,6 +62,7 @@
*pixel[2] = (1.0 - coef)*sd->color1[2] + coef*sd->color2[2];
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_bump.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_bump.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_bump.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_bump.c
*
- * Comments -
- * Texture Library - Bump Mapping maps R, G, Z to surface normal X, Y, Z
+ * Comments -
+ * Texture Library - Bump Mapping maps R, G, Z to surface normal X, Y, Z
*
*/
@@ -41,11 +41,13 @@
VMOVE(sd->coef, coef);
}
+
void
texture_bump_free(struct texture_s *texture) {
bu_free(texture->data, "texture data");
}
+
void
texture_bump_work(struct texture_s *texture, void *UNUSED(mesh), struct
tie_ray_s *UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
struct texture_bump_s *sd;
@@ -59,12 +61,13 @@
n[2] = id->norm[2] + sd->coef[2]*(2* *pixel[2]-1.0);
VUNITIZE(n);
- d = VDOT( n, id->norm);
+ d = VDOT(n, id->norm);
if (d < 0)
VSCALE(n, n, -1.0);
VMOVE(id->norm, n);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_camo.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_camo.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_camo.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture.h
*
- * Comments -
- * Texture Library - Applies a 3 color camouflage
+ * Comments -
+ * Texture Library - Applies a 3 color camouflage
*
*/
@@ -32,7 +32,7 @@
void
texture_camo_init(struct texture_s *texture, fastf_t size, int octaves, int
absolute, vect_t color1, vect_t color2, vect_t color3) {
- struct texture_camo_s *sd;
+ struct texture_camo_s *sd;
BU_ALLOC(texture->data, struct texture_camo_s);
texture->free = texture_camo_free;
@@ -49,6 +49,7 @@
texture_perlin_init(&sd->perlin);
}
+
void
texture_camo_free(struct texture_s *texture) {
struct texture_camo_s *td;
@@ -58,6 +59,7 @@
bu_free(texture->data, "camo data");
}
+
void
texture_camo_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
struct texture_camo_s *td;
@@ -90,6 +92,7 @@
VMOVE(*pixel, td->color3);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_checker.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_checker.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_checker.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_checker.c
*
- * Comments -
- * Texture Library - Checker pattern with tile parameter
+ * Comments -
+ * Texture Library - Checker pattern with tile parameter
*
*/
@@ -32,7 +32,7 @@
void
texture_checker_init(struct texture_s *texture, int tile) {
- struct texture_checker_s *td;
+ struct texture_checker_s *td;
BU_ALLOC(texture->data, struct texture_checker_s);
texture->free = texture_checker_free;
@@ -42,16 +42,18 @@
td->tile = tile;
}
+
void
texture_checker_free(struct texture_s *texture) {
bu_free(texture->data, "checker data");
}
+
void
texture_checker_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
- struct texture_checker_s *td;
- vect_t pt;
- int u, v;
+ struct texture_checker_s *td;
+ vect_t pt;
+ int u, v;
td = (struct texture_checker_s *)texture->data;
@@ -67,6 +69,7 @@
*pixel[0] = *pixel[1] = *pixel[2] = u ^ v ? 1.0 : 0.0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_clouds.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_clouds.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_clouds.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_clouds.c
*
- * Comments -
- * Texture Library - Perlin Clouds
+ * Comments -
+ * Texture Library - Perlin Clouds
*
*/
@@ -48,6 +48,7 @@
texture_perlin_init(&td->perlin);
}
+
void
texture_clouds_free(struct texture_s *texture) {
struct texture_clouds_s *td;
@@ -57,6 +58,7 @@
bu_free(texture->data, "cloud data");
}
+
void
texture_clouds_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
struct texture_clouds_s *td;
@@ -82,6 +84,7 @@
*pixel[2] = fabs(0.5*texture_perlin_noise3(&td->perlin, p, td->size*1.0,
td->octaves) + 0.5);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_gradient.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_gradient.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_gradient.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_gradient.c
*
- * Comments -
- * Texture Library - Produces Gradient to be used with Blend
+ * Comments -
+ * Texture Library - Produces Gradient to be used with Blend
*
*/
@@ -42,11 +42,13 @@
td->axis = axis;
}
+
void
texture_gradient_free(struct texture_s *texture) {
bu_free(texture->data, "gradient data");
}
+
void
texture_gradient_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
struct texture_gradient_s *td;
@@ -66,6 +68,7 @@
}
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_image.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_image.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_image.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -20,8 +20,8 @@
/**
* @file librender/texture_image.c
*
- * Comments -
- * Texture Library - Projects an Image onto a Surface
+ * Comments -
+ * Texture Library - Projects an Image onto a Surface
*
*/
@@ -48,6 +48,7 @@
memcpy(td->image, image, 3*w*h);
}
+
void
texture_image_free(struct texture_s *texture) {
struct texture_image_s *td;
@@ -57,6 +58,7 @@
bu_free(texture->data, "texture data");
}
+
void
texture_image_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*UNUSED(ray), struct tie_id_s *id, vect_t *pixel) {
struct texture_image_s *td;
@@ -80,6 +82,7 @@
*pixel[2] = td->image[ind+0] / 255.0;
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_internal.h
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_internal.h 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_internal.h 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_internal.h
*
- * Comments -
- * Texture Library - Internal texture include
+ * Comments -
+ * Texture Library - Internal texture include
*
*/
@@ -47,7 +47,7 @@
/* _a is transformed vertex, _b is input vertex, _c is 4x4 transformation
matrix */
#define MATH_VEC_TRANSFORM(_a, _b, _c) { \
- fastf_t w; \
+ fastf_t w; \
_a[0] = (_b[0] * _c[0]) + (_b[1] * _c[4]) + (_b[2] * _c[8]) + _c[12]; \
_a[1] = (_b[0] * _c[1]) + (_b[1] * _c[5]) + (_b[2] * _c[9]) + _c[13]; \
_a[2] = (_b[0] * _c[2]) + (_b[1] * _c[6]) + (_b[2] * _c[10]) + _c[14]; \
Modified: brlcad/trunk/src/adrt/librender/texture_mix.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_mix.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_mix.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_mix.c
*
- * Comments -
- * Texture Library - Mix two textures
+ * Comments -
+ * Texture Library - Mix two textures
*
*/
@@ -44,11 +44,13 @@
td->coef = coef;
}
+
void
texture_mix_free(struct texture_s *texture) {
bu_free(texture->data, "texture data");
}
+
void
texture_mix_work(struct texture_s *texture, void *mesh, struct tie_ray_s *ray,
struct tie_id_s *id, vect_t *pixel) {
struct texture_mix_s *td;
@@ -63,6 +65,7 @@
VADD2((*pixel), (*pixel), t);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_perlin.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_perlin.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_perlin.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_perlin.c
*
- * Comments -
- * Texture Library - Perlin Utility
+ * Comments -
+ * Texture Library - Perlin Utility
*
*/
@@ -31,24 +31,25 @@
#include "bn.h"
-#define B 0x100
-#define BM 0xff
-#define N 0x1000
+#define B 0x100
+#define BM 0xff
+#define N 0x1000
-#define PRAND (int)(bn_randmt()*16384)
-#define S_CURVE(t) (t * t * (3.0 - 2.0 * t))
-#define AT3(rx, ry, rz) (rx*q[0] + ry*q[1] + rz*q[2]);
-#define LERP(t, a, b) (a+t*(b-a))
+#define PRAND (int)(bn_randmt()*16384)
+#define S_CURVE(t) (t * t * (3.0 - 2.0 * t))
+#define AT3(rx, ry, rz) (rx*q[0] + ry*q[1] + rz*q[2]);
+#define LERP(t, a, b) (a+t*(b-a))
-void texture_perlin_init(struct texture_perlin_s *P);
-void texture_perlin_free(struct texture_perlin_s *P);
-fastf_t texture_perlin_noise3(struct texture_perlin_s *P, vect_t V,
fastf_t Size, int Depth);
-fastf_t texture_perlin_omega(struct texture_perlin_s *P, vect_t V);
+void texture_perlin_init(struct texture_perlin_s *P);
+void texture_perlin_free(struct texture_perlin_s *P);
+fastf_t texture_perlin_noise3(struct texture_perlin_s *P, vect_t V, fastf_t
Size, int Depth);
+fastf_t texture_perlin_omega(struct texture_perlin_s *P, vect_t V);
void
-texture_perlin_init(struct texture_perlin_s *P) {
+texture_perlin_init(struct texture_perlin_s *P)
+{
int i, j, k;
P->PV = (int *)bu_malloc(sizeof(int)*(2*B+2), "PV");
@@ -76,14 +77,18 @@
}
}
+
void
-texture_perlin_free(struct texture_perlin_s *P) {
+texture_perlin_free(struct texture_perlin_s *P)
+{
bu_free(P->PV, "PV");
bu_free(P->RV, "RV");
}
+
fastf_t
-texture_perlin_noise3(struct texture_perlin_s *P, vect_t V, fastf_t Size, int
Depth) {
+texture_perlin_noise3(struct texture_perlin_s *P, vect_t V, fastf_t Size, int
Depth)
+{
int i;
fastf_t sum;
@@ -96,12 +101,14 @@
return sum;
}
+
fastf_t
-texture_perlin_omega(struct texture_perlin_s *P, vect_t V) {
- vect_t q;
- fastf_t r0[3], r1[3], sy, sz, a, b, c, d, t, u, v;
- int b0[3], b1[3], b00, b10, b01, b11;
- int i, j;
+texture_perlin_omega(struct texture_perlin_s *P, vect_t V)
+{
+ vect_t q;
+ fastf_t r0[3], r1[3], sy, sz, a, b, c, d, t, u, v;
+ int b0[3], b1[3], b00, b10, b01, b11;
+ int i, j;
for (i = 0; i < 3; i++) {
@@ -155,6 +162,7 @@
return LERP(sz, c, d);
}
+
/*
* Local Variables:
* mode: C
Modified: brlcad/trunk/src/adrt/librender/texture_stack.c
===================================================================
--- brlcad/trunk/src/adrt/librender/texture_stack.c 2013-07-27 03:46:32 UTC
(rev 56251)
+++ brlcad/trunk/src/adrt/librender/texture_stack.c 2013-07-27 04:04:49 UTC
(rev 56252)
@@ -19,8 +19,8 @@
*/
/** @file librender/texture_stack.c
*
- * Comments -
- * Texture Library - Stack textures to pipe output of one into another
+ * Comments -
+ * Texture Library - Stack textures to pipe output of one into another
*
*/
@@ -43,6 +43,7 @@
td->list = NULL;
}
+
void
texture_stack_free(struct texture_s *texture) {
struct texture_stack_s *td;
@@ -52,6 +53,7 @@
bu_free(texture->data, "texture data");
}
+
void
texture_stack_work(struct texture_s *texture, void *mesh, struct tie_ray_s
*ray, struct tie_id_s *id, vect_t *pixel) {
struct texture_stack_s *td;
@@ -63,6 +65,7 @@
td->list[i]->work(td->list[i], mesh, ray, id, pixel);
}
+
void
texture_stack_push(struct texture_s *texture, struct texture_s *texture_new) {
struct texture_stack_s *td;
@@ -73,6 +76,7 @@
td->list[td->num++] = texture_new;
}
+
/*
* Local Variables:
* mode: C
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits