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
Functions and Procedures
procedure PrimaryRay(const x, y: Single; const ScreenWidth, ScreenHeight: Integer; 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: Integer; 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.15.0.
|