int to = slotHeight * (id + 1);
if (id == splitCount - 1) {
to = heightPx;
}
BackwardRayTracer logic = getLogic();
Vect3 rayDirection = new Vect3();
Camera camera = scene.getCamera();
Ray ray = new Ray(new Vect3(camera.getPosition()), rayDirection);
Vect3 vertAdd = new Vect3(camera.getViewPaneHeightVector());
Vect.scale(vertAdd, 1.0 / (heightPx - 1), vertAdd);
Vect3 horzAdd = new Vect3(camera.getViewPaneWidthVector());
Vect.scale(horzAdd, 1.0 / (widthPx - 1), horzAdd);
for (int i = from; i < to; i++) {
for (int j = 0; j < widthPx; j++) {
Vect.subtract(camera.getViewPaneEdge(), ray.getOrigin(), rayDirection);
Vect.addMultiple(rayDirection, vertAdd, i, rayDirection);
Vect.addMultiple(rayDirection, horzAdd, j, rayDirection);
rayDirection.normalize();
long color = logic.shoot(ray);
lbuf[i * widthPx + j] = color;
}
}
}