-
Notifications
You must be signed in to change notification settings - Fork 32
/
jiTraceAOVs.oso
104 lines (104 loc) · 5.13 KB
/
jiTraceAOVs.oso
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
OpenShadingLanguage 1.00
# Compiled by oslc 1.11.6
# options:
shader jiTraceAOVs
param string trace_component "P" %meta{string,help,"The name of the component to reflect. OSL globals such as P, N, u, v as well as arbitrary userdata such as Pref are supported."} %read{11,25} %write{2147483647,-1}
param color trace_color 1 1 1 %meta{string,help,"The color to be used if trace_component is not found."} %read{29,29} %write{2147483647,-1}
param string traceset "" %meta{string,help,"The name of the traceset (optional). Can be used to exclude all geo of an environment if it contains multiple shapes."} %read{2,3} %write{2147483647,-1}
param int inclusive 1 %meta{string,widget,"checkBox"} %meta{string,help,"ON is inclusive. OFF is exclusive."} %read{0,0} %write{2147483647,-1}
oparam color out 0 0 0 %read{2147483647,-1} %write{24,29}
global point P %read{9,19} %write{2147483647,-1} %derivs
global vector I %read{5,8} %write{2147483647,-1} %derivs
global normal N %read{5,20} %write{2147483647,-1} %derivs
local color out_component %read{28,28} %write{25,25}
local string traceset_name %read{9,9} %write{2,3}
local int hit %read{10,10} %write{9,9}
local point ___338_trace_P %read{19,19} %write{18,18}
local int ___339_trace_msg %read{26,26} %write{25,25}
const int $const1 1 %read{0,26} %write{2147483647,-1}
temp int $tmp1 %read{1,1} %write{0,0}
const string $const2 "-%s" %read{2,2} %write{2147483647,-1}
temp vector $tmp2 %read{9,9} %write{8,8} %derivs
const string $const3 "reflect" %read{4,4} %write{2147483647,-1}
temp float $tmp3 %read{6,6} %write{5,5} %derivs
temp float $tmp4 %read{7,7} %write{6,6} %derivs
const float $const5 2 %read{6,6} %write{2147483647,-1}
temp vector $tmp5 %read{8,8} %write{7,7} %derivs
const string $const6 "traceset" %read{9,9} %write{2147483647,-1}
const string $const7 "distance" %read{11,11} %write{2147483647,-1}
temp int $tmp6 %read{12,12} %write{11,11}
temp int $tmp7 %read{13,17} %write{12,16}
const int $const8 0 %read{12,15} %write{2147483647,-1}
const string $const9 "dist" %read{14,14} %write{2147483647,-1}
temp int $tmp8 %read{15,15} %write{14,14}
temp int $tmp9 %read{16,16} %write{15,15}
temp int $tmp10 %read{2147483647,-1} %write{18,18}
const string $const10 "trace" %read{18,25} %write{2147483647,-1}
const string $const11 "P" %read{18,18} %write{2147483647,-1}
temp float $tmp11 %read{23,23} %write{22,22}
temp vector $tmp12 %read{21,21} %write{19,19}
temp normal $tmp13 %read{21,21} %write{20,20}
temp vector $tmp14 %read{22,22} %write{21,21}
temp float $tmp15 %read{24,24} %write{23,23}
const float $const13 100 %read{23,23} %write{2147483647,-1}
temp int $tmp16 %read{27,27} %write{26,26}
code ___main___
# jiTraceAOVs.osl:23
# if (inclusive < 1)
lt $tmp1 inclusive $const1 %filename{"jiTraceAOVs.osl"} %line{23} %argrw{"wrr"}
if $tmp1 3 4 %argrw{"r"}
# jiTraceAOVs.osl:24
# traceset_name = format("-%s", traceset);
format traceset_name $const2 traceset %line{24} %argrw{"wrr"}
# jiTraceAOVs.osl:26
# traceset_name = traceset;
assign traceset_name traceset %line{26} %argrw{"wr"}
# jiTraceAOVs.osl:29
# int hit = trace(P, reflect(I,N), "traceset", traceset_name);
functioncall $const3 9 %line{29} %argrw{"r"}
# /opt/solidangle/mtoa/2019/osl/include/stdosl.h:212
# vector reflect (vector I, vector N) { return I - 2*dot(N,I)*N; }
dot $tmp3 N I %filename{"/opt/solidangle/mtoa/2019/osl/include/stdosl.h"} %line{212} %argrw{"wrr"}
mul $tmp4 $const5 $tmp3 %argrw{"wrr"}
mul $tmp5 $tmp4 N %argrw{"wrr"}
sub $tmp2 I $tmp5 %argrw{"wrr"}
# jiTraceAOVs.osl:29
# int hit = trace(P, reflect(I,N), "traceset", traceset_name);
trace hit P $tmp2 $const6 traceset_name %filename{"jiTraceAOVs.osl"} %line{29} %argrw{"wrrrr"} %argderivs{1,2}
# jiTraceAOVs.osl:30
# if (hit)
if hit 30 30 %line{30} %argrw{"r"}
# jiTraceAOVs.osl:33
# if (trace_component == "distance" || trace_component == "dist")
eq $tmp6 trace_component $const7 %line{33} %argrw{"wrr"}
neq $tmp7 $tmp6 $const8 %argrw{"wrr"}
if $tmp7 14 17 %argrw{"r"}
eq $tmp8 trace_component $const9 %argrw{"wrr"}
neq $tmp9 $tmp8 $const8 %argrw{"wrr"}
assign $tmp7 $tmp9 %argrw{"wr"}
if $tmp7 25 30 %argrw{"r"}
# jiTraceAOVs.osl:36
# getmessage("trace", "P", trace_P);
getmessage $tmp10 $const10 $const11 ___338_trace_P %line{36} %argrw{"wrrw"}
# jiTraceAOVs.osl:37
# out = length( (trace_P - P) * abs(N)) / 100;
sub $tmp12 ___338_trace_P P %line{37} %argrw{"wrr"}
abs $tmp13 N %argrw{"wr"}
mul $tmp14 $tmp12 $tmp13 %argrw{"wrr"}
length $tmp11 $tmp14 %argrw{"wr"}
div $tmp15 $tmp11 $const13 %argrw{"wrr"}
assign out $tmp15 %argrw{"wr"}
# jiTraceAOVs.osl:42
# int trace_msg = getmessage("trace", trace_component, out_component);
getmessage ___339_trace_msg $const10 trace_component out_component %line{42} %argrw{"wrrw"}
# jiTraceAOVs.osl:44
# if (trace_msg == 1)
eq $tmp16 ___339_trace_msg $const1 %line{44} %argrw{"wrr"}
if $tmp16 29 30 %argrw{"r"}
# jiTraceAOVs.osl:45
# out = out_component;
assign out out_component %line{45} %argrw{"wr"}
# jiTraceAOVs.osl:47
# out = trace_color;
assign out trace_color %line{47} %argrw{"wr"}
end