public void next() { if (affineStep == 1) { // just the basic routine if we calculate the real u for each pixel myPixel.u = perspectiveCorrectedU / myPixel.invZ; myPixel.v = perspectiveCorrectedV / myPixel.invZ; perspectiveCorrectedU += du; perspectiveCorrectedV += dv; myPixel.invZ += dz; } else { if (counter == 0) { myPixel.u = myUInStepPixels; myPixel.v = myVInStepPixels; myPixel.invZ = myInverseZInStepPixels; calculateAffineStep(); } else { myPixel.u += dau; myPixel.v += dav; myPixel.invZ += daz; } } myPixel.x++; myPixel.index++; light += dl; myPixel.light = light; myPixel.normal = null; myPixel.camPoint = null; if (++counter >= affineStep) { // reset counter counter = 0; } }