In Flight Simulator scenery design, objects that can block one another must be projected in a far-to-near order. Objects must be sorted by radial distance, and then projected from far-to-near. The system that handles this process is the radsort (radial sort) system.
When the contents of a graphics database are being drawn, all items that can't be projected right away (vertical objects) are added to the radial sort lists using add object (ADDOBJ) commands; this is the pre-radsort or addobj phase. Close to the end of the scenery projection sequence, a radial sort is performed and the objects are projected far-to-near; this is the radsort phase.
In Flight Simulator, more than a single radsort list (the list of objects to be radsorted, filled by addobj-type commands) is maintained. The different radsort lists are as follows:
You set up the radsort list at BGL_INIT time by calling RADSORT_RESET in bglrad.asm. The radsort list size is initialized to a size that's dependent on the maximum image complexity settings of the 2- and 3-D windows. The complexity settings and commensurate radsort buffer size are included in the following table.
Complexity | Radsort buffer size |
0 | 200 |
1 | 200 |
2 | 400 |
3 | 400 |
4 | 600 |
Note: When compared to earlier versions of Flight Simulator, Flight Simulator 98 has four times the radsort buffer size because of it's ability to handle 256K databases (as opposed to the 64K limit in earlier versions).
The following example shows the structure of the radsort list.
radsort_buf_sizedw0;max number of objects
radsort_countdw0;current number of objects
radsort_add_ptrdw0;ptr to next open object slot
sparedw0;spare
RADSORT OBJECT RECORD 1
RADSORT OBJECT RECORD 2
RADSORT OBJECT RECORDstruct
rad_objptrdw0
rad_objsegdw0
rad_radiusdw0
rad_radius2dw0
rad_disptrdw0
rad_dissegdw0
rad_deltaxdw0,0,0
rad_deltaydw0,0,0
rad_deltazdw0,0,0
rad_pagedw0
rad_file_numberdw0
rad_lnthequword ptr 34