OpenShadingLanguage 1.01
# Compiled by oslc 1.6.2
light rectanglelight%emit{1}
param	float	intensity	1		%read{42,42} %write{2147483647,-1}
param	color	lightcolor	1 1 1		%read{42,42} %write{2147483647,-1}
param	float	falloff	2		%read{43,43} %write{2147483647,-1}
param	float	xsize	1		%read{2,32} %write{2147483647,-1} %derivs
param	float	ysize	1		%read{1,34} %write{2147483647,-1} %derivs
param	float	samples	16		%read{4,13} %write{2147483647,-1} %derivs
oparam	float	__nonspecular	1		%read{18,18} %write{2147483647,-1}
global	normal	N	%read{0,15} %write{2147483647,-1} %derivs
global	point	Ps	%read{15,46} %write{2147483647,-1} %derivs
global	color	Cl	%read{49,53} %write{49,53}
local	float	xsamples	%read{13,52} %write{4,12} %derivs
local	float	ysamples	%read{21,52} %write{5,14} %derivs
local	float	i	%read{19,51} %write{19,51} %derivs
local	float	j	%read{19,51} %write{19,51} %derivs
local	color	c	%read{19,51} %write{19,51}
local	vector	l	%read{19,51} %write{19,51}
local	vector	ln	%read{19,51} %write{19,51}
local	vector	Nn	%read{39,39} %write{0,0}
local	float	x	%read{19,51} %write{19,51} %derivs
local	float	y	%read{19,51} %write{19,51} %derivs
local	float	dist	%read{19,51} %write{19,51}
local	point	p	%read{16,51} %write{15,51} %derivs
local	float	___298_dot	%read{19,51} %write{19,51}
temp	float	$tmp1	%read{2,2} %write{1,1}
const	float	$const2	4		%read{1,6} %write{2147483647,-1}
temp	int	$tmp2	%read{3,3} %write{2,2}
const	int	$const3	1		%read{5,9} %write{2147483647,-1}
temp	float	$tmp3	%read{7,7} %write{6,6}
temp	int	$tmp4	%read{8,8} %write{7,7}
temp	float	$tmp5	%read{12,12} %write{11,11} %derivs
temp	float	$tmp6	%read{14,14} %write{13,13} %derivs
temp	int	$tmp7	%read{17,17} %write{16,16}
const	string	$const4	"__nonspecular"		%read{18,18} %write{2147483647,-1}
const	int	$const5	0		%read{20,40} %write{2147483647,-1}
temp	int	$tmp8	%read{19,51} %write{19,51}
temp	int	$tmp9	%read{22,50} %write{22,50}
temp	float	$tmp10	%read{26,26} %write{25,25} %derivs
temp	float	$tmp11	%read{27,27} %write{26,26} %derivs
temp	float	$tmp12	%read{29,29} %write{28,28} %derivs
temp	float	$tmp13	%read{30,30} %write{29,29} %derivs
const	string	$const6	"shader"		%read{35,35} %write{2147483647,-1}
const	float	$const7	0.5		%read{31,33} %write{2147483647,-1}
temp	float	$tmp14	%read{32,32} %write{31,31} %derivs
temp	float	$tmp15	%read{35,35} %write{32,32} %derivs
temp	float	$tmp16	%read{34,34} %write{33,33} %derivs
temp	float	$tmp17	%read{35,35} %write{34,34} %derivs
const	float	$const8	0		%read{35,35} %write{2147483647,-1}
temp	int	$tmp18	%read{41,41} %write{40,40}
temp	float	$tmp19	%read{45,45} %write{44,44}
temp	float	$tmp20	%read{44,44} %write{43,43}
temp	color	$tmp21	%read{47,47} %write{46,46}
const	float	$const9	1		%read{50,51} %write{2147483647,-1}
temp	float	$tmp22	%read{53,53} %write{52,52}
code ___main___
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:26
#     float x, y, dist;
	normalize	Nn N 	%filename{"D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl"} %line{26} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:31
#         xsamples = samples;
	mul		$tmp1 $const2 ysize 	%line{31} %argrw{"wrr"}
	gt		$tmp2 xsize $tmp1 	%argrw{"wrr"}
	if		$tmp2 6 15 	%argrw{"r"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:32
#         ysamples = 1;
	assign		xsamples samples 	%line{32} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:33
#     } else if (ysize > 4 * xsize) {
	assign		ysamples $const3 	%line{33} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:34
#         xsamples = 1;
	mul		$tmp3 $const2 xsize 	%line{34} %argrw{"wrr"}
	gt		$tmp4 ysize $tmp3 	%argrw{"wrr"}
	if		$tmp4 11 15 	%argrw{"r"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:35
#         ysamples = samples;
	assign		xsamples $const3 	%line{35} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:36
#     } else {
	assign		ysamples samples 	%line{36} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:38
#         ysamples = floor(samples/xsamples);
	sqrt		$tmp5 samples 	%line{38} %argrw{"wr"}
	floor		xsamples $tmp5 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:39
#     }
	div		$tmp6 samples xsamples 	%line{39} %argrw{"wrr"}
	floor		ysamples $tmp6 	%argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:42
# 
	add		p Ps N 	%line{42} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:69
# }
	emit		$tmp7 p 	%line{69} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:44
# 		setmessage ("__nonspecular", __nonspecular);
	if		$tmp7 54 54 	%line{44} %argrw{"r"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:45
#         for (j = 0; j < ysamples; j += 1)  {
	setmessage	$const4 __nonspecular 	%line{45} %argrw{"rr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:46
#             for (i = 0; i < xsamples; i += 1)  {
	for		$tmp8 21 22 51 52 	%line{46} %argrw{"r"}
	assign		j $const5 	%argrw{"wr"}
	lt		$tmp8 j ysamples 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:47
#                 /* Compute point (x,y) on unit square */
	for		$tmp9 24 25 50 51 	%line{47} %argrw{"r"}
	assign		i $const5 	%argrw{"wr"}
	lt		$tmp9 i xsamples 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:49
#                 y = (j + random()) / ysamples;
	random		$tmp10 	%line{49} %argrw{"w"}
	add		$tmp11 i $tmp10 	%argrw{"wrr"}
	div		x $tmp11 xsamples 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:50
#                 /* Compute point p on rectangle */
	random		$tmp12 	%line{50} %argrw{"w"}
	add		$tmp13 j $tmp12 	%argrw{"wrr"}
	div		y $tmp13 ysamples 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:52
#                 /* Compute distance from point p to surface point Ps */
	sub		$tmp14 x $const7 	%line{52} %argrw{"wrr"}
	mul		$tmp15 $tmp14 xsize 	%argrw{"wrr"}
	sub		$tmp16 y $const7 	%argrw{"wrr"}
	mul		$tmp17 $tmp16 ysize 	%argrw{"wrr"}
	point		p $const6 $tmp15 $tmp17 $const8 	%argrw{"wrrrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:54
#                 dist = length(l);
	sub		l p Ps 	%line{54} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:55
#                 ln = l / dist;
	length		dist l 	%line{55} %argrw{"wr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:56
#                 /* Compute light from point p to surface point Ps */
	div		ln l dist 	%line{56} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:58
# 	        if (dot > 0) {
	dot		___298_dot ln Nn 	%line{58} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:59
#                     c = intensity * lightcolor;
	gt		$tmp18 ___298_dot $const5 	%line{59} %argrw{"wrr"}
	if		$tmp18 50 50 	%argrw{"r"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:60
#                     c *= pow(dist, -falloff);   /* distance falloff */
	mul		c intensity lightcolor 	%line{60} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:61
#                     c *= transmission(Ps, p);   /* ray traced occlusion */
	neg		$tmp20 falloff 	%line{61} %argrw{"wr"}
	pow		$tmp19 dist $tmp20 	%argrw{"wrr"}
	mul		c c $tmp19 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:62
#                     c *= dot;   /* Lambert's cosine law at the surface */
	transmission	$tmp21 Ps p 	%line{62} %argrw{"wrr"} %argderivs{1,2}
	mul		c c $tmp21 	%argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:63
#                     Cl += c;
	mul		c c ___298_dot 	%line{63} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:64
#                 }
	add		Cl Cl c 	%line{64} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:47
#                 /* Compute point (x,y) on unit square */
	add		i i $const9 	%line{47} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:46
#             for (i = 0; i < xsamples; i += 1)  {
	add		j j $const9 	%line{46} %argrw{"wrr"}
# D:\\xrt.git\\src\\osl\\shaders\\rectanglelight.osl:68
#     }
	mul		$tmp22 xsamples ysamples 	%line{68} %argrw{"wrr"}
	div		Cl Cl $tmp22 	%argrw{"wrr"}
	end
