private void repositionStartEnd() { counter = 0; dx = end.getPoint().x - start.getPoint().x; dz = (end.getInverseDepth() - start.getInverseDepth()) / dx; du = (end.getPerspectiveCorrectTexturePoint().x - start.getPerspectiveCorrectTexturePoint().x) / dx; dv = (end.getPerspectiveCorrectTexturePoint().y - start.getPerspectiveCorrectTexturePoint().y) / dx; dl = (end.getLightning() - start.getLightning()) / dx; xend = end.getPoint().x; myPixel.x = (int) start.getPoint().x; myInverseZInStepPixels = start.getInverseDepth(); light = start.getLightning(); myPerspectiveCorrectedUInStepPixels = start.getPerspectiveCorrectTexturePoint().x; myPerspectiveCorrectedVInStepPixels = start.getPerspectiveCorrectTexturePoint().y; myUInStepPixels = myPerspectiveCorrectedUInStepPixels / myInverseZInStepPixels; myVInStepPixels = myPerspectiveCorrectedVInStepPixels / myInverseZInStepPixels; if (affineStep == 1) { myPixel.invZ = start.getInverseDepth(); perspectiveCorrectedU = start.getPerspectiveCorrectTexturePoint().x; perspectiveCorrectedV = start.getPerspectiveCorrectTexturePoint().y; } }
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; } }