Hello, I am a student in Malcolm Kessons class and need a little help. I am trying to convert my .sl code to a slim template but running into multitude of errors.
I am following a format such as…
color a_name (float value,value; color value,value )
{
color result = color(1,1,1);
code goes here
return result;
}
When I right click in cutter and export as slim template I get no errors. It’s when I compile it and send to slim and update that I see the errors.
Code:
color js_stPattern (float kd,ka,ks,roughness,kdfront,kdrear,kofront,korear,srepeats,trepeats,colormix,iterate,green,blue; color rimwidth,rimcolor,hilitecolor,ambientcolor,diffusecolor,speccolor,surfcolor )
{
color result = color(1,1,1);
normal n = normalize(n);
normal nf = faceforward(n,I);
Oi = Os;
ambientcolor = ka * ambient();
diffusecolor = kd * diffuse(nf);
vector i = normalize(-I);
diffusecolor = -nf.i + rimcolor + surfcolor;
float dot = 1 - nf.i;
speccolor = ks * specular(nf, i, roughness) * hilitecolor;
float ss= mod(s * srepeats, 1);
float tt= mod(t * trepeats, 1);
if(n == nf) {
surfcolor = colormix;
diffusecolor = diffuse(nf) * kdfront;
Oi = Os * KdFront;
}
else {
surfcolor = color (1.0, .5, 0);
diffusecolor = diffuse(nf) * kdrear;
}
diffusecolor = diffusecolor * Kd;
Oi = Os * KdRear;
Oi = Os;
{
float r = sqrt( (tt -.1)*(tt -.1) + (ss -.1)*(ss -.1));
if (r <= t )
surfcolor = colormix;
}
{
float r = sqrt( (tt -.5)*(tt -.5) + (ss -.5)*(ss -.5) );
float i;
float class1 = srepeats;
float class2 = trepeats;
if ((ss-.5)*(ss-.5) + (tt-.5)*(tt-.5) <.05*korear/kofront)
surfcolor = color (1.0, .5, 0);
else
Oi = color (0, 0, 0);
for(i = 0; i < iterate; i = i + 1) {
if ( r * ( i * noise(i) + sin(10) ) <= class1 -= .01 )
surfcolor = color(red + (i / colormix),
green + (i / colormix * noise(1)),
blue + (i / colormix * noise(1));
}
Ci = Oi * Cs * surfcolor * (ambientcolor + diffusecolor + speccolor);
}
return result;
}