Navigation: Scripting Reference Manual > Functions & Subroutines > InitGetPreviousRay

 

InitGetPreviousRay

 

Contact Us: fredsupport@photonengr.com

 

Description

Initializes index value such that a subsequent call to GetPreviousRay() retrieves ray data for the last live ray in the ray buffer.  This provides an alternate method to using GetLastRay() although GetLastRay() is preferred due to it's ability to detect when the ray buffer is empty.

 

Syntax

InitGetPreviousRay( id )

 

Parameters

 

id As Long (or Huge_)

Returns index number required for initialization.  After execution, this variable contains the index number after that of the last ray that in the buffer. E.g. if the last live ray is index = 15 then this function returns id = 16.

 

Example

The example below shows using this command in an alternative approach to the standard ray buffer looping construction to loop backwards over the rays in the buffer.

 

Dim success As Boolean

Dim i As Long

Dim tRay as T_RAY

 

InitGetPreviousRay(i)

           While GetPreviousRay(i, ray)

 

                     Print i           'do something here

 

          Wend

 

See Also

GetFirstRay

GetPreviousRay

GetLastRay

GetNextRay

GetRay

SetRay

SetRayActive

Multi-Threaded Raytrace

 

 

 

 

 

 

Copyright © Photon Engineering, LLC