sl 1.0 #r0 = light color #r1 = dark color #s0 = ring scale #s1 = texture cale #s2 = graininess # scale the object-space point by a factor of s1 # s1 is now useless mul r3, xy, s1 movc z s1, r3 div s1, s1, s0 # s1 holds xy.z*txtscale / ringscale # dump into a vector register for safe-keeping lc a r3, s1 mov r2, r3 liv z r2, 0 li s1, 8 mul r2, r2, s1 movc z s1, r3 lc z r2, s1 #r2 now holds PQ turb s1, r2 li v1, 16 div s1, s1, v1 # now, grab our old value and add it back in movc a v1, r2 add s1, s1, v1 # at this point, the old r2 isn't useful anymore lc y r2, s1 movc x s1, r3 lc x r2, s1 movc y s1, r3 li v1, 12.93 add s1, s1, v1 lc z r2, s1 # at this point, r2 holds (pp.x, my_t, pp.t+12.93) turb s1, r2 mul s1, s1, s0 floor v1, s1 # r -= floor(r) sub s1, s1, v1 # now, perform the "smooth steps" # we don't have hermite interpolation, so we'll settle # for quadratic li s3, 0.55 li s0, 0.2 mov v1, s1 # this gives us a quadratically increasing value between # 0 and 1 clamp v1, s0, s3 sub v1, v1, s0 li s0, 0.35 div v1, v1, s0 mul v1, v1, v1 #now, store away for safe-keeping lc a r3, v1 li s3, 0.8 li s0, 0.75 mov v1, s1 clamp v1, s0, s3 sub v1, v1, s0 li s3, 0.05 div v1, v1, s3 mul v1, v1, v1 li s0, 1 # (1 - "smoothstep(0.75, 0.8, r)" sub s0, s0, v1 movc a s3, r3 mul s0, s0, s3 li s1, 0.8 mul s0, s0, s1 li s1, 0.2 add s1, s1, s0 # s1 now holds r movc x s0, r3 li v1, 128 mul s0, s0, v1 li v1, 5 add s0, s0, v1 lc x r2, s0 movc z s0, r3 li v1, 8 mul s0, s0, v1 li v1, 3 sub s0, s0, v1 lc y r2, s0 movc y s0, r3 li v1, 128 mul s0, s0, v1 li v1, 1 add s0, s0, v1 lc z r2, s0 li s0, 1 sub s0, s0, s2 turb v1, r2 li s3, 1.3 sub s3, s3, v1 mul s3, s3, s2 add s3, s3, s0 # s2 still holds r, s3 holds r2 mul s3, s3, s3 mul s3, s3, s2 # now, mix the colors li v1, 1 sub v1, v1, s3 mul r0, r0, v1 mul r1, r1, s3 add v0, r0, r1 # and finally, perform the illumination calculations dp3 s0, L, N mul s0, s0, Kd add r1, L, V norm r1, r1 dp3 s1, r1, N pow s1, s1, S mul s1, s1, Ks add s0, s0, s1 mul v0, v0, s0 # and (last of all), modulate by dE movc r s0, v0 movc r s1, dE mul s0, s0, s1 lc r v0, s0 movc g s0, v0 movc g s1, dE mul s0, s0, s1 lc g v0, s0 movc b s0, v0 movc b s1, dE mul s0, s0, s1 lc b v0, s0 # done!