Sign in to follow this  
Guest

New terminology for TMFs

Recommended Posts

Hi all.Here's a partial macro for LWM Polygons( Land/Water Mask ), using Microsoft's terminology, and the BGLC code for a small pond in the Sahara ( N23*13.17' E25*17.432' ).First the Macro:

; LWMMacros.inc	 //  include file for use with BGLCLWMFileHeader		Macro	Version, IndexHeader, Data, End	LOCAL	startstart	LABEL	word	UINT32 	20				;		   // Size of this header (20 bytes)	UINT32 	Version				;			// Version (must be 0x0201)	SINT32 	( OFFSET IndexHeader ) - ( OFFSET start );	// Relative offset to index	SINT32 	( OFFSET Data ) - ( OFFSET start )	;			// Relative offset to data	SINT32 	( OFFSET End ) - ( OFFSET start )	;			 // Size of all data plus headersENDMLWMDataAreaDrawPolygons	Macro	PolyCount, Attrib, Flag, Col, Row;	UINT16 wPolyCount:3	;  // The number of polygons up to 6. For 7 or more, use LWMDataAreaDrawPolygonsEx;	UINT16 wAttrib:2	;	 // Must be 3;	UINT16 wFlag:1		;	   // Must be 1!;	UINT16 wCol:5		;		// Column, 0 to 31;	UINT16 wRow:5		;		// Row, 0 to 31	UINT16	( Row * 800h ) + ( Col * 40h ) + ( Flag * 20h ) + ( Attrib * 8h ) + PolyCountEndMLWMDataAreaDrawPolygonsEx	Macro	PolyExFlag, Attrib, Flag, Col, Row, ExPolyCount;	UINT16 wPolyExFlag:3	; // Must be 7.;	UINT16 wAttrib:2	;	 // Must be 3 (transparent);	UINT16 wFlag:1		;	   // Must be 1!;	UINT16 wCol:5		;		// Column, 0 to 31.;	UINT16 wRow:5		;		// Row, 0 to 31.	UINT16	( Row * 800h ) + ( Col * 40h ) + ( Flag * 20h ) + ( Attrib * 8h ) + PolyExFlag		BYTE  ExPolyCount	;  // The number of polygons = 7 + ExPolyCountEndMLWMDataAreaHeight	Macro	Height, Fraction	  SINT16 Height	;	// integer height in meters   	-9999 is no height data!	  BYTE  Fraction; 	// number of 1/128 meter fractions to add to Height	Zero if no height data!EndMLWMPoly2			Macro	PointCount, Reserved, Attrib, Height, Fraction;	BYTE  bPointCount:6	;   // Up to 62 points;	BYTE  bReserved:1	;	 // Must be 0;	BYTE  bAttrib:1	;	   // Polygon fill attribute, 0 = water, 1 = land	BYTE	( Attrib * 80h ) + ( Attrib * 40h ) + PointCount	SINT16 	Height		;		 // Whole elevation value in meters	BYTE	Fraction		;	   // Fractional elevation value in 1/128 metersEndMLWMPoly2Ex		Macro	PointCount, Reserved, Attrib, Height, Fraction, ExPointCount;	BYTE  bPointCount:6	;   // Must be 63;   BYTE  bReserved:1	;	 // Must be 0;	BYTE  bAttrib:1	;	   // Polygon fill attribute, 0 = water, 1 = land	BYTE	( Attrib * 80h ) + ( Attrib * 40h ) + PointCount	SINT16	Height		;	   	BYTE	Fraction		;	  	BYTE	ExPointCount	;   // Number of polygon points = 63 + bExPointCountEndMLWMIndexHeader		Macro	NumberIndexEntries, Index	LOCAL	startstart	Label 	word	UINT32 	12			;			 // Size of this header (12 bytes)	UINT32 	NumberIndexEntries	;	 // Number of entries in the index	SINT32 	( OFFSET Index ) - ( OFFSET start );			 // Relative offset to the index dataENDMLWMIndexEntry		Macro	LWMCellID, start, Data, End	LWMCellID 				;	 // Location and default attributes or the cell	SINT32	( OFFSET Data ) - ( OFFSET start );	// Offset from the beginning of the data block	SINT32	( OFFSET End ) - ( OFFSET Data );	  // Size of data blockEndMLWMCellID		Macro	RunCount, IndexRun, Attrib, U, V;	UINT32 dwRunCount:9	; 	// Number of identical indices;	UINT32 dwIndexRun:1	; 	// If this 0 = single index, 1 = a series of indices;	UINT32 dwAttrib:2	;   	// The fill attribute 0 = water, 1 = land, ;					   		; 	//	2 = flatten only, 3 = transparent;	UINT32 dwU:10		;	   	// The column (from 0 to 767) in the 768x512 world grid;	UINT32 dwV:10		;	   	// The row (from 0 to 511)	UINT32	( V * 400000h ) + ( U * 1000h ) + ( Attrib * 400h ) + ( IndexRun * 200h ) + RunCountEndMLWMPoint		Macro	x, y  BYTE	x	;  BYTE	y	;EndM

And now the BGLC code using the Macro:

include LWMmacros.inc; LWM Poly Test; ===================================================================; DATA_BASEdata_base	label	word	dw	1			; world set number	dd	2667133 	; North Bound	dd	2444872 	; South Bound	dd	310192082 	; East Bound	dd	262470223 	; West Bound	dd	0			; VOR data	dw	0			; lowest VOR freq	dw	0			; highest VOR freq	dd	0			; seeds level 8 data	dd	0			; seeds level 9 data	dd	0			; seeds level 10 data	dd	0			; seeds level 11 data	dd	0			; seeds level 12 data	dd	0			; traffic data	dd	0			; minimum safe altitude data	dd	terrain_data - data_base; terrain mesh data	dd	0			; object data	dd	0			; library data	dd	0			; facilities data	dd	0			; anchor point data	dd	0			; ATIS data	dd	0			; NDB data	dd	0			; dynamic object paths data	dd	0h,0h			; minimum library id	dd	0h,0h			; maximum library id	dd	0			; miscellaneous data	dd	0			; title and description data	dd	0			; magnetic variation data	dd	0			; exception and exclusion data	dd	87654321h		; magic number	dd	0			; compression switch	dw	0			; spare	dd	0h,0h,0h,0h		; GUID	dd	0			; product id	dd	0			; product build number	dd	0			; new facility data pointers	dd	0			; new facility name list data	dd	0			; new facility band list data	dd	0			; new facility data; ===================================================================; TERRAIN_DATAterrain_data	label	word	dd	terrain_header_end - terrain_data; end of terrain header	dd	514				; version	dd	0				; unknown entry	dd	0				; unknown entry	dd	0				; elevation header	dd	0				; land class header	dd	0				; unknown header	dd	0				; class lookup header	dd	0				; season header	dd	0				; class lookup list	dd	0				; water class header	dd	0				; elevation index	dd	0				; land cover index	dd	0				; unknown index	dd	Flatten_Header - terrain_data	; flatten polygon header	dd	0				; decal header	dd	0				; reserved	dd	0				; reserved	dd	0				; main terrain data	dd	0				; reserved	dd	0				; reserved	dd	0				; reserved	dd	0				; regions header	dd	0				; reserved	dd	0				; reservedterrain_header_end	label	word; ===================================================================; Terrain Flatten HeaderFlatten_Header	label	word	LWMFileHeader	513, Flatten_List, Flatten_Start, Flatten_End; TERRAIN FLATTEN POLYGON DATAFlatten_Start	label	word; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - data_start_0	label	word	LWMDataAreaDrawPolygons	1, 3, 1, 30, 28	LWMPoly2		10, 0, 0, 622, 0		LWMPoint 131, 16		LWMPoint 173, 29		LWMPoint 189, 62		LWMPoint 193, 96		LWMPoint 178, 133		LWMPoint 134, 152		LWMPoint 84, 151		LWMPoint 53, 95		LWMPoint 79, 49		LWMPoint 114, 43data_end_0	label	word; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ===================================================================; TERRAIN FLATTEN POLYGON LISTCell_437_189	EQU	LWMCellID 1, 0, 3, 437, 189	Flatten_List	label	word		LWMIndexHeader	 1, Flatten_Groups	Flatten_Groups	label	word		LWMIndexEntry		 Cell_437_189, Flatten_Start, data_start_0, data_end_0; ===================================================================; FLATTEN_ENDFlatten_End	label	word; ===================================================================

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi all.Completed the translation of terms for LWM polygons. Area filling is an interesting twist we hadn't guessed.A couple of attachments:3d6fbe334a5ca318.txt is the completed LWMmacros.inc3d6fbe404a8e72ab.txt is the LWMtestfill.asmDick

Share this post


Link to post
Share on other sites

Thanks Dick, I can't wait til your next tutorial. :) Using the new SDK's will help ya allot I'm sure.Ken

Share this post


Link to post
Share on other sites

Actually I suspected those area filling polygons. I saw polygons that had zero points, so I always suspected that would fill a LOD13 quad (otherwise what's the use). However, I haven't guessed that they can come in different sizes...Cheers, Christian

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this