These examples cover the basic FRED scripting commands involving RayTrace Controls: "Add" - add a raytrace control, "Find" - find a raytrace control, "Get" - retrieve raytrace control attributes, "Init" - initialize a raytrace control structure, "Set" - set raytrace control attributes.
The following structures are required for RayTrace Controls:
Raytrace controls establish power cutoff thresholds, ancestry, allowed specular/scatter operations, and intersection count control.
"Add" a RayTrace control Add a RayTrace control using a T_RAYTRACECTRL structure. Be sure to initialize the declared structure before the "Add" operation. See T_RAYTRACECTRL for default values. In this example, all defaults are accepted except that the number of consecutive intersections with the same object is reset to 10000 from the default 100:
Dim rtc1 As T_RAYTRACECTRL InitRaytraceCtrl rtc1 rtc1.NumConsecIntersectCutoff=10000 id = AddRaytraceCtrl ( rtc1 )
"Find" a RayTrace control In the same way materials, coatings, scatter models, names, groups, etc., can be "found", use FindRaytraceCtrl command to find the identifier of a specific Raytrace control:
rcid= FindRaytraceCtrl ("Transmit Scatter")
"Get" RayTrace control attributes Retrieve the Raytrace control attributes with the T_RAYTRACECTRL structure:
Dim RC As T_RAYTRACECTRL For i=0 To GetRaytraceCtrlCount()-1 GetRaytraceCtrl i, RC Print "Raytrace control ", RC.name, " has specular ancestry of ", RC.SpecularAncestryCutoff Next i
"Init" a Raytrace control Always initialize a Raytrace control structure before assigning it to the Tree. This insures that the new control has the proper set of defaults:
Dim rc1 As T_RAYTRACECTRL InitRaytraceCtrl rc1
"Set" RayTrace control attributes Always use a "Get" before attempting to "Set" or change specific attributes of a structure. This example changes only the allowTIR condition of a Raytrace control:
Dim rcG As T_RAYTRACECTRL GetRaytraceCtrl FindRaytraceCtrl("Special RTC"), rcG rcG.allowTIR=True SetRaytraceCtrl FindRaytraceCtrl("Special RTC"), rcG See Also….
|