
Error compiling RSL
Regrettably version 4.4.6 introduced a bug that in some circumstances prevented Cutter finding
the name of a shader when an RSL document was compiled. The bug would become
evident when the RSL document had one or more function declarations preceeding
the implementation of the shader. For example, the code shown below would cause
Cutter to erroneously name the compiled shader rotate2d instead of rotate_test!
void rotate2d(float xpivot, ypivot, angle;
output float x, y)
{
// Convert to radians
float a = radians(angle);
// Translate xy relative to the pivot point
x = x  xpivot;
y = y  ypivot;
// Perform the rotation
x = x * cos(a)  y * sin(a);
y = x * sin(a) + y * cos(a);
// Translate xy relative to the pivot point
x += xpivot;
y += ypivot;
}
surface
rotate_test(float Kd = 1,
angle = 0,
spivot = 0.5,
tpivot = 0.5)
{
color surfcolor = 1;
normal n = normalize(N);
normal nf = faceforward(n, I);
float x = s, y = t;
rotate2d(spivot, tpivot, angle, x, y);
if(x > 0.5)
surfcolor = color(1,0,0);
Oi = Os;
color diffusecolor = Kd * diffuse(nf);
Ci = Oi * Cs * surfcolor * diffusecolor;
}


fig 1
