Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/test/MIP/mip_c.c
ViewVC logotype

Diff of /trunk/test/MIP/mip_c.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 445, Thu Oct 21 04:01:15 2010 UTC revision 446, Thu Oct 21 04:18:15 2010 UTC
# Line 76  Line 76 
76    
77  /* actor state representation */  /* actor state representation */
78  typedef struct {  typedef struct {
79      Diderot_vec3        pos;      Diderot_vec3_t      pos;
80      Diderot_vec3        dir;      Diderot_vec3_t      dir;
81      Diderot_real        t;      Diderot_real_t      t;
82      Diderot_real        maxval;      Diderot_real_t      maxval;
83      Diderot_real        padding[2];      Diderot_real_t      padding[2];
84  } RayCast_t;  } RayCast_t;
85    
86  void RayCast_init (GlobalState_t *glob, RayCast_t *self, int row, int col)  void RayCast_init (GlobalState_t *glob, RayCast_t *self, int row, int col)
# Line 93  Line 93 
93    
94  void RayCast_update (GlobalState_t *glob, RayCast_t *self)  void RayCast_update (GlobalState_t *glob, RayCast_t *self)
95  {  {
   // shadow state variables  
     Diderot_vec3 pos, dir;  
     Diderot_real t, maxval;  
   
96  //    pos = pos + stepSz*dir;  //    pos = pos + stepSz*dir;
97  //    if (inside (pos,F)) {  //    if (inside (pos,F)) {
98  //      real val = F@pos;  //      real val = F@pos;
# Line 106  Line 102 
102  //      stabilize;  //      stabilize;
103  //    t = t + stepSz;  //    t = t + stepSz;
104    
105      Diderot_CopyV3 (&dir, &(glob->dir));      Diderot_vec3_t dir = self->dir;
106      Diderot_vec3 _t1;      Diderot_vec3_t pos = self->pos;
107      Diderot_ScaleV3 (&_t1, glob->stepSz,, &dir);      pos = Diderot_AddV3(pos, Diderot_ScaleV3(glob->stepSz, dir));
     Diderot_CopyV3 (&pos, &(glob->pos));  
     Diderot_AddV3 (&pos, &pos, &_t);  
108    
109  /* ??? */      Diderot_Vec3_t imgPos = Diderot_TransformVec3 (pos, img->mInv);
110      if (/* ?? inside ?? */) {      if (Diderot_Inside3D(imgPos, img)) {
111          /* ?? probe ?? */          /* ?? probe ?? */
112          maxval = self->maxval;          Diderot_real_t maxval = self->maxval;
113          maxval = Diderot_max(val, maxval);          maxval = Diderot_Max(val, maxval);
114          self->maxval = maxval;          self->maxval = maxval;
115      }      }
116    
117      t = self->t;      Diderot_real_t t = self->t;
118      if (t > 20.0f) {      if (t > 20.0f) {
119          Diderot_CopyV3 (&(glob->pos), &pos);          self->pos = pos;
120            // self->t = t; /* not needed, since t has not changed */
121          RayCast_stabilize (glob, self);          RayCast_stabilize (glob, self);
122          return;          return;
123      }      }
124    
125      t = t + glob->stepSz;      t = t + glob->stepSz;
126    
127      Diderot_CopyV3 (&(glob->pos), &pos);      self->pos = pos;
128      self->t = t;      self->t = t;
     self->maxval = maxval;  
129    
130  }  }
131    

Legend:
Removed from v.445  
changed lines
  Added in v.446

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0