- # loop over lights
- MOV color, ambientColor;
- MOV lightIndex.x, 0.0;
- REP nlights;
- # get light position and color from texture
- TEXC lightPos, lightIndex, texture[0], RECT; # write condition code
- TEX lightColor, lightIndex, texture[1], RECT;
- # call correct lighting function based on w component of position
- IF EQ.w; # lightPos.w == 0.0
- CAL dirlight;
- ELSE;
- CAL pointlight;
- ENDIF;
- ADD lightIndex, lightIndex, 1.0; # increment loop counter
- ENDREP;
- MOV result.color, color;
- RET;