Unit CastleRays

Description

Calculating 3D rays that correspond to the given points on 2D screen. This is used by ray-tracing (casting a ray for each image pixel) or when picking objects (what 3D object/point is indicated by the current mouse position).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TRaysWindow Calculate primary rays for given camera settings and screen size.
Class TPerspectiveRaysWindow  
Class TFrustumRaysWindow  
Class TOrthographicRaysWindow  

Functions and Procedures

procedure PrimaryRay(const x, y: Single; const ScreenWidth, ScreenHeight: Single; const CamPosition, CamDirection, CamUp: TVector3; const Projection: TProjection; out RayOrigin, RayDirection: TVector3);

Description

Functions and Procedures

procedure PrimaryRay(const x, y: Single; const ScreenWidth, ScreenHeight: Single; const CamPosition, CamDirection, CamUp: TVector3; const Projection: TProjection; out RayOrigin, RayDirection: TVector3);

Calculate position and direction of the primary ray cast from CamPosition, going through the pixel X, Y. Takes into account camera 3D settings and screen sizes. RayDirection will always be normalized, just like from TRaysWindow.PrimaryRay.

If you want to call this many times for the same camera settings, it may be more optimal to create TRaysWindow instance first and call it's TRaysWindow.PrimaryRay method.


Generated by PasDoc 0.16.0.