// Cross.osl
shader
Cross(
float s = 0
[[
int lockgeom = 0,
string widget = "null",
]],
float t = 0
[[
int lockgeom = 0,
string widget = "null",
]],
float s_offset = 0.5,
float s_width = 0.2,
float t_offset = 0.5,
float t_width = 0.2,
color base_color = color(1,1,1),
color pat_color = color(1,0,0),
output color resultRGB = 0)
{
float ss = s - floor(s);
float tt = t - floor(t);
float left = s_offset - s_width/2;
float right = s_offset + s_width/2;
float top = t_offset + t_width/2;
float bottom = t_offset - t_width/2;
//
if(ss >= left && ss <= right || tt >= bottom && tt <= top)
resultRGB = pat_color;
else
resultRGB = base_color;
}