Class TRayTracer

Unit

Declaration

type TRayTracer = class(TObject)

Description

Hierarchy

Overview

Fields

Public Octree: TBaseTrianglesOctree;
Public Image: TCastleImage;
Public CamPosition: TVector3;
Public CamDirection: TVector3;
Public CamUp: TVector3;
Public Projection: TProjection;
Public SceneBGColor: TVector3;
Public Background: TAbstractBackgroundNode;
Public PixelsMadeNotifier: TPixelsMadeNotifierFunc;
Public PixelsMadeNotifierData: Pointer;
Public FirstPixel: Cardinal;

Methods

Public procedure Execute; virtual; abstract;
Public procedure ExecuteStats(const Stats: TStrings);

Description

Fields

Public Octree: TBaseTrianglesOctree;

Scene to render. Must be set before calling Execute.

Public Image: TCastleImage;

Image where the ray-tracer result will be stored. Must be set before calling Execute.

We will not resize given here Image. Instead we will use it's current size — so you just have to set Image size as appropriate before calling this method.

For every pixel, we calculate it's color and store it by TCastleImage.Color[X, Y, 0] := xxx method. We don't modify alpha channel of the image.

Using TRGBFloatImage class is advised if you want the full color information. Otherwise color precision is lost beyond 8 bits, and values above 1.0 are clamped.

Public CamPosition: TVector3;

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Public CamDirection: TVector3;

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Public CamUp: TVector3;

Camera view. CamDirection and CamUp do not have to be normalized — we will correct them here if needed. CamUp will be automatically corrected to be orthogonal to CamDirection if necessary, you only make sure it's not parallel to CamDirection.

Public Projection: TProjection;

Camera projection properties.

Public SceneBGColor: TVector3;

Default background color, if scene doesn't have Background node with skyColor.

Public Background: TAbstractBackgroundNode;

Scene Background node.

Public PixelsMadeNotifier: TPixelsMadeNotifierFunc;

Callback notified (if assigned) about writing each image pixel. This way you can display somewhere, or store to file, partially generated image. This callback gets information (in PixelsMadeCount) about how many pixels were generated (this includes also pixels skipped in case FirstPixel > 0).

The pixels are written in the order of TSwapScanCurve for TClassicRayTracer, and in order dependent on TPathTracer.SFCurveClass for TPathTracer. When shadow cache will be implemented to TClassicRayTracer, then configurable SFCurveClass may be done also for TClassicRayTracer.

Remember that pixels not done yet have the same content as they had when you Execute method started. In other words, if you set PixelsMadeNotifier <> nil, then often it's desirable to initialize Image content with some color (e.g. black) before calling Execute. Otherwise at the time of Execute call, the pixels not done yet will have undefined colors.

Public PixelsMadeNotifierData: Pointer;
 
Public FirstPixel: Cardinal;

Initial pixel to start rendering from. By setting this to something > 0, you can (re-)start rendering from the middle. Useful to finish the job of a previous terminated ray-tracer process.

Must be in [0 .. Image.Width * Image.Height] range. Setting to Image.Width * Image.Height makes the ray-tracer do nothing.

Methods

Public procedure Execute; virtual; abstract;

Do ray-tracing, writing a ray-traced image into the Image.

Public procedure ExecuteStats(const Stats: TStrings);

Do ray-tracing, like Execute, additionally gathering some statistics. The statistics will be added to the given string list.


Generated by PasDoc 0.16.0.