Castle Game Engine: CastleRayTracer: Class TRayTracer

# Class TRayTracer
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleRayTracer ## Declaration `type TRayTracer = class(TObject)` ## Description ## Hierarchy TObject TRayTracer ## Overview ### Fields
| `Octree: TBaseTrianglesOctree;`
| `Image: TCastleImage;`
| `CamPosition: TVector3Single;`
| `CamDirection: TVector3Single;`
| `CamUp: TVector3Single;`
| `Projection: TProjection;`
| `SceneBGColor: TVector3Single;`
| `PixelsMadeNotifier: TPixelsMadeNotifierFunc;`
| `PixelsMadeNotifierData: Pointer;`
| `FirstPixel: Cardinal;`
### Methods
| `procedure AppendStats(const Stats: TStrings; const RenderingTime: Single); virtual;`
| `procedure Execute; virtual; abstract;`
| `procedure ExecuteStats(const Stats: TStrings);`
## Description ### Fields
| `Octree: TBaseTrianglesOctree;`
Scene to render. Must be set before calling Execute.
| `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.
| `CamPosition: 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.
| `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.
| `Projection: TProjection;`
Camera `projection` properties.
| `SceneBGColor: TVector3Single;`
| `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 2015-06-15 04:43:11