Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TRayTracer
Unit
CastleRayTracer
Declaration
type TRayTracer = class(TObject)
Description
Hierarchy
Overview
Fields
Methods
 |
procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); virtual; |
 |
procedure Execute; virtual; abstract; |
 |
procedure ExecuteStats(const Stats: TStrings); |
Description
Fields
 |
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.SetColorRGB method. So make sure SetColorRGB is implemented for your image class (it's implemented in all 3 classes TRGBImage, TRGBAlphaImage, TRGBFloatImage, so usually just don't worry about that). 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.
|
 |
CamDirection: TVector3Single; |
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 .
|
 |
CamUp: TVector3Single; |
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.
|
 |
PerspectiveView: boolean; |
Camera projection properties. See TCastleSceneManager.PerspectiveView for specification.
|
 |
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 (e.g. to all SceneBGColor) before calling Execute. Otherwise at the time of Execute call, the pixels not done yet will have undefined colors.
|
 |
PixelsMadeNotifierData: Pointer; |
|
 |
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
 |
procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); virtual; |
|
 |
procedure Execute; virtual; abstract; |
Do ray-tracing, writing a ray-traced image into the Image.
|
 |
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.13.0 on 2014-10-26 05:15:14
|