Home | History | Annotate | Download | only in ir
      1 ((function refract
      2    (signature float
      3      (parameters
      4        (declare (in) float i)
      5        (declare (in) float n)
      6        (declare (in) float eta))
      7      ((declare () float k)
      8       (assign (x) (var_ref k)
      9               (expression float - (constant float (1.0))
     10 	        (expression float * (var_ref eta)
     11 	          (expression float * (var_ref eta)
     12 		    (expression float - (constant float (1.0))
     13 		      (expression float * 
     14 		        (expression float * (var_ref n) (var_ref i))
     15 		        (expression float * (var_ref n) (var_ref i))))))))
     16       (if (expression bool < (var_ref k) (constant float (0.0)))
     17           ((return (constant float (0.0))))
     18 	  ((return (expression float -
     19 	             (expression float * (var_ref eta) (var_ref i))
     20 		     (expression float *
     21 		       (expression float +
     22 		         (expression float * (var_ref eta)
     23 			   (expression float * (var_ref n) (var_ref i)))
     24 		         (expression float sqrt (var_ref k)))
     25 		       (var_ref n))))))))
     26 
     27    (signature vec2
     28      (parameters
     29        (declare (in) vec2 i)
     30        (declare (in) vec2 n)
     31        (declare (in) float eta))
     32      ((declare () float k)
     33       (assign (x) (var_ref k)
     34               (expression float - (constant float (1.0))
     35 	        (expression float * (var_ref eta)
     36 	          (expression float * (var_ref eta)
     37 		    (expression float - (constant float (1.0))
     38 		      (expression float * 
     39 		        (expression float dot (var_ref n) (var_ref i))
     40 		        (expression float dot (var_ref n) (var_ref i))))))))
     41       (if (expression bool < (var_ref k) (constant float (0.0)))
     42           ((return (constant vec2 (0.0 0.0))))
     43 	  ((return (expression vec2 -
     44 	             (expression vec2 * (var_ref eta) (var_ref i))
     45 		     (expression vec2 *
     46 		       (expression float +
     47 		         (expression float * (var_ref eta)
     48 			   (expression float dot (var_ref n) (var_ref i)))
     49 		         (expression float sqrt (var_ref k)))
     50 		       (var_ref n))))))))
     51 
     52    (signature vec3
     53      (parameters
     54        (declare (in) vec3 i)
     55        (declare (in) vec3 n)
     56        (declare (in) float eta))
     57      ((declare () float k)
     58       (assign (x) (var_ref k)
     59               (expression float - (constant float (1.0))
     60 	        (expression float * (var_ref eta)
     61 	          (expression float * (var_ref eta)
     62 		    (expression float - (constant float (1.0))
     63 		      (expression float * 
     64 		        (expression float dot (var_ref n) (var_ref i))
     65 		        (expression float dot (var_ref n) (var_ref i))))))))
     66       (if (expression bool < (var_ref k) (constant float (0.0)))
     67           ((return (constant vec3 (0.0 0.0 0.0))))
     68 	  ((return (expression vec3 -
     69 	             (expression vec3 * (var_ref eta) (var_ref i))
     70 		     (expression vec3 *
     71 		       (expression float +
     72 		         (expression float * (var_ref eta)
     73 			   (expression float dot (var_ref n) (var_ref i)))
     74 		         (expression float sqrt (var_ref k)))
     75 		       (var_ref n))))))))
     76 
     77    (signature vec4
     78      (parameters
     79        (declare (in) vec4 i)
     80        (declare (in) vec4 n)
     81        (declare (in) float eta))
     82      ((declare () float k)
     83       (assign (x) (var_ref k)
     84               (expression float - (constant float (1.0))
     85 	        (expression float * (var_ref eta)
     86 	          (expression float * (var_ref eta)
     87 		    (expression float - (constant float (1.0))
     88 		      (expression float * 
     89 		        (expression float dot (var_ref n) (var_ref i))
     90 		        (expression float dot (var_ref n) (var_ref i))))))))
     91       (if (expression bool < (var_ref k) (constant float (0.0)))
     92           ((return (constant vec4 (0.0 0.0 0.0 0.0))))
     93 	  ((return (expression vec4 -
     94 	             (expression vec4 * (var_ref eta) (var_ref i))
     95 		     (expression vec4 *
     96 		       (expression float +
     97 		         (expression float * (var_ref eta)
     98 			   (expression float dot (var_ref n) (var_ref i)))
     99 		         (expression float sqrt (var_ref k)))
    100 		       (var_ref n))))))))
    101 
    102 ))
    103