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

SCM Repository

[diderot] Diff of /branches/vis12/src/include/Diderot/inline-vec4.h
ViewVC logotype

Diff of /branches/vis12/src/include/Diderot/inline-vec4.h

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

revision 1942, Tue Jul 3 15:22:53 2012 UTC revision 1943, Thu Jul 5 16:29:06 2012 UTC
# Line 17  Line 17 
17  #include "Diderot/types.h"  #include "Diderot/types.h"
18  #endif  #endif
19    
20  STATIC_INLINE Diderot_vec4_t vec4 (float a, float b, float c, float d)  STATIC_INLINE Diderot_vec4_t vec4 (Diderot_real_t a, Diderot_real_t b, Diderot_real_t c, Diderot_real_t d)
21  {  {
22      return __extension__ (Diderot_vec4_t){ a, b, c, d };      return __extension__ (Diderot_vec4_t){ a, b, c, d };
23  }  }
# Line 38  Line 38 
38  {  {
39      union4i_t u;      union4i_t u;
40      u.v = v;      u.v = v;
41      return __extension__ (Diderot_vec4_t){ (float)u.i[0], (float)u.i[1], (float)u.i[2], (float)u.i[3] };      return __extension__ (Diderot_vec4_t){ (Diderot_real_t)u.i[0], (Diderot_real_t)u.i[1], (Diderot_real_t)u.i[2], (Diderot_real_t)u.i[3] };
42  }  }
43    
44  STATIC_INLINE Diderot_vec4_t scale4 (float s, Diderot_vec4_t v)  STATIC_INLINE Diderot_vec4_t scale4 (Diderot_real_t s, Diderot_vec4_t v)
45  {  {
46      return vec4(s, s, s, s) * v;      return vec4(s, s, s, s) * v;
47  }  }
# Line 58  Line 58 
58          clamp(a.r[3], b.r[3], c.r[3]));          clamp(a.r[3], b.r[3], c.r[3]));
59  }  }
60    
61  STATIC_INLINE Diderot_vec4_t lerp4 (Diderot_vec4_t a, Diderot_vec4_t b, float t)  STATIC_INLINE Diderot_vec4_t lerp4 (Diderot_vec4_t a, Diderot_vec4_t b, Diderot_real_t t)
62  {  {
63      return a + scale4(t, b - a);      return a + scale4(t, b - a);
64  }  }
# Line 81  Line 81 
81          (Diderot_int_t)TRUNC(t.r[3]) };          (Diderot_int_t)TRUNC(t.r[3]) };
82  }  }
83    
84  STATIC_INLINE float dot4 (Diderot_vec4_t u, Diderot_vec4_t v)  STATIC_INLINE Diderot_real_t dot4 (Diderot_vec4_t u, Diderot_vec4_t v)
85  {  {
86      Diderot_union4_t uv = __extension__ (Diderot_union4_t)(u*v);      Diderot_union4_t uv = __extension__ (Diderot_union4_t)(u*v);
87      return uv.r[0] + uv.r[1] + uv.r[2] + uv.r[3];      return uv.r[0] + uv.r[1] + uv.r[2] + uv.r[3];
88  }  }
89    
90  STATIC_INLINE float length4 (Diderot_vec4_t v)  STATIC_INLINE Diderot_real_t length4 (Diderot_vec4_t v)
91  {  {
92      return SQRT(dot4(v, v));      return SQRT(dot4(v, v));
93  }  }

Legend:
Removed from v.1942  
changed lines
  Added in v.1943

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