Difference for src/extvol.c from version 1.26 to 1.27

version 1.26version 1.27
Line 1
Line 1
 /* /*
  * extvol.c - Volume rendering helper routines etc.  * extvol.c - Volume rendering helper routines etc.
  *  *
  *  $Id: extvol.c,v 1.26 2004/02/03 03:38:22 johns Exp $  *  $Id: extvol.c,v 1.27 2004/02/03 06:00:39 johns Exp $
  */  */
  
 #include <stdio.h> #include <stdio.h>
Line 39
Line 39
 extvol * newextvol(void * voidtex, vector min, vector max,  extvol * newextvol(void * voidtex, vector min, vector max, 
                    int samples, flt (* evaluator)(flt, flt, flt)) {                     int samples, flt (* evaluator)(flt, flt, flt)) { 
   extvol * xvol;   extvol * xvol;
   texture * tex;   standard_texture * tex, * xvoltex;
      
   tex = (texture *) voidtex;   tex = (standard_texture *) voidtex;
  
   xvol = (extvol *) malloc(sizeof(extvol));   xvol = (extvol *) malloc(sizeof(extvol));
   memset(xvol, 0, sizeof(extvol));   memset(xvol, 0, sizeof(extvol));
Line 56
Line 56
   xvol->opacity = tex->opacity;     xvol->opacity = tex->opacity;  
   xvol->samples = samples;   xvol->samples = samples;
  
   xvol->tex = malloc(sizeof(texture));   xvoltex = malloc(sizeof(standard_texture));
   memset(xvol->tex, 0, sizeof(texture));   memset(xvoltex, 0, sizeof(standard_texture));
  
   xvol->tex->ctr.x = 0.0;   xvoltex->ctr.x = 0.0;
   xvol->tex->ctr.y = 0.0;   xvoltex->ctr.y = 0.0;
   xvol->tex->ctr.z = 0.0;   xvoltex->ctr.z = 0.0;
   xvol->tex->rot = xvol->tex->ctr;   xvoltex->rot = xvoltex->ctr;
   xvol->tex->scale = xvol->tex->ctr;   xvoltex->scale = xvoltex->ctr;
   xvol->tex->uaxs = xvol->tex->ctr;   xvoltex->uaxs = xvoltex->ctr;
   xvol->tex->vaxs = xvol->tex->ctr;   xvoltex->vaxs = xvoltex->ctr;
   xvol->tex->flags = RT_TEXTURE_NOFLAGS;   xvoltex->flags = RT_TEXTURE_NOFLAGS;
  
   xvol->tex->col=tex->col;   xvoltex->col=tex->col;
   xvol->tex->ambient=1.0;   xvoltex->ambient=1.0;
   xvol->tex->diffuse=0.0;   xvoltex->diffuse=0.0;
   xvol->tex->specular=0.0;   xvoltex->specular=0.0;
   xvol->tex->opacity=1.0;   xvoltex->opacity=1.0;
   xvol->tex->img=NULL;   xvoltex->img=NULL;
   xvol->tex->texfunc=(color(*)(const void *, const void *, void *))(ext_volume_texture);   xvoltex->texfunc=(color(*)(const void *, const void *, void *))(ext_volume_texture);
   xvol->tex->obj = (void *) xvol; /* XXX hack! */   xvoltex->obj = (void *) xvol; /* XXX hack! */
  
    xvol->tex = (texture *) xvoltex;
  
   return xvol;   return xvol;
 } }
  
Line 102
Line 104
   return col;   return col;
 }  } 
  
 color ext_volume_texture(const vector * hit, const texture * tex, ray * ry) { color ext_volume_texture(const vector * hit, const texture * tx, ray * ry) {
   color col, col2;   color col, col2;
   box * bx;   box * bx;
   extvol * xvol;   extvol * xvol;
Line 115
Line 117
   color diffint;    color diffint; 
   vector N, L;   vector N, L;
   flt inten;   flt inten;
    standard_texture * tex = (standard_texture *) tx;
  
     bx = (box *) tex->obj;     bx = (box *) tex->obj;
   xvol = (extvol *) tex->obj;   xvol = (extvol *) tex->obj;
Line 232
Line 235
             /* only add light if its from the front of the surface */             /* only add light if its from the front of the surface */
             /* could add back-lighting if we wanted to later.. */             /* could add back-lighting if we wanted to later.. */
             if (inten > 0.0) {             if (inten > 0.0) {
               diffint.r += inten*li->tex->col.r;               standard_texture * litex = (standard_texture *) li->tex;
               diffint.g += inten*li->tex->col.g; 
               diffint.b += inten*li->tex->col.b;               diffint.r += inten * litex->col.r;
                diffint.g += inten * litex->col.g;
                diffint.b += inten * litex->col.b;
             }             }
  
             cur = cur->next;             cur = cur->next;


Legend:
Removed in v.1.26 
changed lines
 Added in v.1.27



Made by johns using version 1.65 of cvs2html