There is a single pointer in the BGL file header that points to object data. The pointer references a label named OBJECT_DATA; this is illustrated in the example in the topic BGL File Header. Object entities are used to group large sections of object-oriented scenery designs into large groups called objects. The scenery display system’s front-end processor scans scenery BGL files on disk and pulls in object entities that are within viewing range in order to display them. Objects, in this context, are pieces of scenery defined by the OBJECT command. The following example shows the definition of three small towns as three polygons on the ground, each of a shape that represents the outline of the town; the example illustrates how objects at the OBJECT_DATA label are designed.
OBJECT_DATA:
rel_base= OBJECT_DATA
LATBAND_REL21eah,232fh,OBJ_LIST_0001
EOL
;
;CHAMPAIGN-AREA TOWNS
;
obj_list_0001:
object_champaign
object_rantoul
object_paxton
EOL
In the preceding example, the rel_base pointer is set to the beginning of this data section; this pointer is the absolute reference for any absolute type references in this data section. After the pointer, there are a list of LATBAND_REL commands. (In this example, there is only one in the list.) This command defines the latitude range of this particular scenery. (The macro for this opcode is defined in the following example.) Notice that the first two arguments are the latitude minimum and latitude maximum as expressed in one-half kilometer units from the equator. These values must be set to the maximum extent of all the designs within the object. The final argument in the LATBAND_REL command is a pointer to the list of objects followed by an EOL (end of list) command.
LATBAND_RELmacrolatmin,latmax,band_addr
db21
dwlatmin;;lat min (inclusive) 512M units
dwlatmax;;lat max (exclusive)
ddband_addr-rel_base;;32-bit rel_base relative ptr
endm
LARGE_OBJECT_HEADERmacrolatitude,longitude,object_end
LOCALopcode
opcodedb5
ddlatitude,longitude
db100;;image power
dwobject_end-opcode
endm
;OBJECT HEADER OPCODE DEFINITIONS -
;OpFormatDefinition
;-----------------------------------------------------------------
;4db 4NEAR SMALL BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;db 0;10 byte count
;db 0,0,0,0....;11 data (up to 246-bytes)
;5db 5NEAR LARGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dw 0;10 byte count
;db 0,0,0,0....;12 data (up to 65525-bytes)
;6db 6NEAR HUGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dd 0;10 byte count
;db 0,0,0,0....;14 data (up to 2^32-13 bytes)
;7db 7FAR SMALL BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;db 0;10 byte count
;db 0,0,0,0....;11 data (up to 246-bytes)
;8db 8FAR LARGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dw 0;10 byte count
;db 0,0,0,0....;12 data (up to 65525-bytes)
;9db 9FAR HUGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dd 0;10 byte count
;db 0,0,0,0....;14 data (up to 2^32-13 bytes)
;10db 10NEAR/FAR SMALL BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;db 0;10 byte count
;db 0,0,0,0....;11 data (up to 246-bytes)
;11db 11NEAR/FAR LARGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dw 0;10 byte count
;db 0,0,0,0....;12 data (up to 65525-bytes)
;12db 12NEAR/FAR HUGE BYTE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 image power
;dd 0;10 byte count
;db 0,0,0,0....;14 data (up to 2^32-13 bytes)
;FS5.1 Front-end processor extensions
;13db 13LARGE RANGE OBJ;00 opcode
;dd 0;01 latitude iiii M units
;dd 0;05 longitude 32-bit pseudo
;db 0;09 range lower limit (range units inclusive)
;db 0;10 range upper limit (range units inclusive)
;dw 0;11 byte count
;db 0,0,0,0....;13 data (up to 65525 bytes)
In the first example in this topic, the objects in the list are actually macros that expand into the object definitions of the three towns. In terms of design, the simplest of the three towns is Paxton. The object definition of Paxton is shown in the following example.
object_paxtonmacro
localobject_end,skip0,skip1
LARGE_OBJECT_HEADER 4496256 , 3243937467 , object_end
SCALE_AGLobject_end,0,0, 65536 , 4496256 ,0, 3243937467 ,0,0,0
RESLIST0, 18
VERTEX-98 ,0, 1178;40.46983740379057 , 271.9025498413474
VERTEX 376 ,0, 1048;40.46866876056525 , 271.908143064608
VERTEX 342 ,0, 890;40.46724551869769 , 271.9077399287615
VERTEX 635 ,0, 695;40.46549036989792 , 271.9111994037282
VERTEX 758 ,0, 144;40.46053404175777 , 271.9126523765405
VERTEX 1127 ,0, 35;40.45955251485556 , 271.9170085075491
VERTEX 1545 ,0,-401;40.45563148156998 , 271.9219482735196
VERTEX 1599 ,0,-1116;40.44919582487605 , 271.9225865100124
VERTEX 1408 ,0,-1484;40.44588539301547 , 271.9203324933404
VERTEX 1068 ,0,-1233;40.44814172817471 , 271.916313528373
VERTEX 286 ,0,-1310;40.44744818372147 , 271.9070800072864
VERTEX 129 ,0,-1217;40.44828510743794 , 271.9052286204077
VERTEX-390 ,0,-1196;40.44847747307541 , 271.8990953358493
VERTEX-271 ,0,-656;40.45333110326252 , 271.9004980968321
VERTEX-954 ,0,-427;40.45538960511671 , 271.8924384641783
VERTEX-1101 ,0,-44;40.45884154168983 , 271.8907039038163
VERTEX-884 ,0, 740;40.4658916011002 , 271.8932636178678
VERTEX-190 ,0, 887;40.46722071748886 , 271.9014615196164
SCOLORC_GRAY
CONCAVE
FACET0,32767,0,0, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17
object_end:
endm
An object requires some information at the beginning of its definition to specify its location and size; this information is called the object header. In the preceding example, there is a LARGE_OBJECT_HEADER at the beginning of the object. The example prior to this one shows the large object header format. This instruction defines the object’s code size, in bytes, and its center latitude and longitude. This information enables the graphics system front-end processor to determine the location of the object in the world and whether or not it is in projection range. This information also indicates where in the file this object ends, so it can be retrieved if it is in range or ignored if it is out of range. To assemble this BGL code and compute the object size in bytes, the label object_end is placed at the end of the last instruction in the object.
The BGL graphics code is what actually defines the object. In the preceding example, the object design begins with a SCALE command followed by a reserve point list of vertices that define the polygon shape on the ground. The RESLIST command arguments indicate that the first reserve point number is 0, and that there are 18 reserved points. Eighteen vertex commands follow. Notice that the Y value for each is set to 0, indicating that the altitude is 0 and that the polygon is flat on the ground. The surface color command (SCOLOR) sets the color to gray, the CONCAVE command indicates that this polygon is concave (so the simple convex shader can not be used), and, finally, the FACET command specifies that vertex 0 to 17 be used to draw the polygon.