Constructor. Calculates some values based on camera settings, this way many calls to PrimaryRay for the same camera settings are fast (useful for ray-tracers).
class function CreateDescendant( const ACamPosition, ACamDirection, ACamUp: TVector3Single; const APerspectiveView: boolean; const APerspectiveViewAngles: TVector2Single; const AOrthoViewDimensions: TVector4Single): TRaysWindow;
Calculate position and direction of the primary ray cast from CamPosition, going through the pixel X, Y.
X, Y coordinates start from (0, 0) if bottom left (like in typical 2D OpenGL). When they are integers and in the range of X = 0..ScreenWidth-1 (left..right), Y = 0..ScreenHeight-1 (bottom..top) it's guaranteed that resulting ray will go exactly through the middle of the appropriate pixel (on imaginary "rzutnia" = image positioned paraller to view direction). But you can provide non-integer X, Y, useful for multisampling (taking many samples within the pixel, like (X, Y) = (PixX + Random - 0.5, PixY + Random - 0.5)).
Resulting RayDirection is guaranteed to be normalized (this is in practice not costly to us, and it often helps — when ray direction is normalized, various distances from ray collisions are "real").
Camera vectors. Initialized in the constructor. Must be given already normalized. Note that CamUp may be changed in constructor, to be always perfectly orthogonal to CamDirection.