Navigation: Scripting Reference Manual > Functions & Subroutines > GetNextRay

 

GetNextRay

 

Contact Us: fredsupport@photonengr.com

 

Description

Retrieves ray data for the next live ray in the ray buffer.  Generally used after GetFirstRay or GetFirstFilteredRay.  Note that when used after GetFirstFilteredRay the same filter that was applied to getting the first ray will apply to all next rays until reset by calling the (unfiltered) GetFirstRay or GetLastRay command.

 

Depending on the number of rays traced, it may be necessary to dimension ray index and ray counter variables as data type Huge_ instead of Long.  Please see Multi-threaded Raytracing for more information.

 

Syntax

success = GetNextRay( id, tr )

 

Parameters

success (Boolean)

Returns True is successful and False if a problem is encountered.

 

id As Long (or Huge_)

Index number of the ray that was most recently accessed (i.e. as a result of a prior call to GetFirstRay or GetNextRay).  After execution, this variable contains the index number of the ray that was retrieved (i.e. the next ray in the buffer).

 

tr As T_RAY

Structure to be loaded with ray data.

 

Example

The example below shows the standard ray buffer looping construction.

 

Dim success As Boolean

Dim curRay As Long

Dim tRay as T_RAY

 

success = GetFirstRay( curRay, tRay )

While success

          'Do something with tRay structure here...

          success = GetNextRay( curRay, tRay )

Wend

 

See Also

GetFirstRay

GetPreviousRay

Get LastRay

GetRay

SetRay

SetRayActive

Multi-Threaded Raytrace

 

 

 

 

 

 

Copyright © Photon Engineering, LLC