Sign in to follow this  
Holger

How to remove specifik Area'a from BGL-source file

Recommended Posts

Hi everybody,Redrawing my greek island i realized that in some places the default (MS) coastline is situated behind the newly drawn coastline. The "new" land is flat because an underlying watermask do not allow mesh-data to be seen. In order to re-mesh this land Holger gave me some recommandations. Can be seen in this post:http://forums.avsim.net/dcboard.php?az=sho...g_id=1662&page=I have choosen the solution in which one remove the Area's (LOD13) that are changed in the redrawing process. In order to do that I de-compile the relevant HP9* file with LWMViewer and then go through the resulting BGS-source file. As Holger pointed out this requires knowledge of the structure/code of LWM files. I've been reading the LWM Tutorial by Richard Ludowise. If I'm going to get rid of the Area's (LOD13) that I changed during my redrawing there are a lot of lines in the BGL-source fil (=BGS-file) that must be deleted. For instance, if I'm going to delete Area "28,20" in Cell "433, 144" the following elements in the file-location which cover the "433, 144" Cell).....LWMDataAreaDrawPolygons 1,_Transparent_,1,28,20LWMPoly3 9, 0, _Water_, 0, 0, 0, 0 LWMPoint3 255, 158, 0LWMPoint3 211, 121, 0LWMPoint3 161, 96, 0LWMPoint3 140, 91, 0LWMPoint3 90, 96, 0LWMPoint3 1, 119, 0LWMPoint3 1, 1, 0LWMPoint3 255, 1, 0LWMPoint3 255, 158, 0LWMDataAreaFill1x1 0, _Water_, 1, 28, 20LWMDataAreaHeight 0, 0LWMDataAreaFill2x2 0, _Water_, 0, 1, 15, 0, 11LWMDataAreaHeight 0, 0LWMDataAreaFill8x8 0, _Water_, 0, 1, 4, 0, 3LWMDataAreaHeight 0, 0LWMDataAreaFill4x4 0, _Water_, 0, 1, 8, 0, 6LWMDataAreaHeight 0, 0The above is just an example. LWMDataAreaDrawPolygonsEx and LWMAreaFill16x16 must be deleted too if any and if they involve the example with Area "28,20". MY QUESTION NOW IS THIS:Is it correct that these macro's in the Sourcefile (BGS) imply

Share this post


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

Hi Lars:Your example above looked strange to me, so I tried to find Cell 433x144, Area 28,20 in HP954180.bgl. Alas, it doesn't exist and now I'm confused about your question.Are you trying to ask where an LOD13 Area starts and ends? If so, only the first block in your example would be the one to delete. The LWM decompiler is nice in this regard as it separates each Cell with an empty line.Those other blocks are LWM Data Area Fills, and they are a bit more tricky to handle than single LOD13 Areas because they use a reference system according to block size. Here's the section from the MS Terrain Vector Data SDK (p.30):"Area fills are used to cover a subsection of a cell. They can cover one of the following areas: 1x1, 2x2, 4x4, 8x8, and 16x16. Set wAttrib to 0 to fill with water and 1 to fill with land. Use wRow and wCol to define the upper left corner of the fill. The range of row and column changes with the area coverage. For a 1x1 area, the range is from 0 to 31. Likewise the range for a 4x4 area is from 0 to 7. "It would indeed be useful to have a utility that deletes LOD13 Areas (and LOD8 Cells) based on user input. Steve Greenwood's FSTFlatten package comes with the option to record the Cell/Area coordinates while slewing over an area. The detailed documentation he provides (e.g., in the "bgl-asm" folders) should help you understand the different parameters.In genreal, it's not too difficult to experiment with the LWM files. If you make mistakes BGLC usually will give error messages (in command mode) and refuse to compile or, if it does compile, you can quickly spot the problems in LWMViewer.Cheers, Holger

Share this post


Link to post
Share on other sites

Hi Holger!Sorry, I think it was in another Cell that Area 28,20 was situated. But this was only an example. My question is just this:Do I have to delete everything that implies the Area's (LOD13's) I changed on my scenery in order to get the mesh through. I'm reffering to your advice No 4 (of four possible) in this thread:http://forums.avsim.net/dcboard.php?az=sho...g_id=1662&page=If "LWMDataAreaDrawPolygons 1,_Transparent_,1,28,20" defines my changed Area shall it be deleted then?If "LWMDataAreaFill1x1 0, _Water_, 1, 28, 20LWMDataAreaHeight 0, 0" defines my changed Area shall it be deleted?In fact I'm working on a program by which you can parse through a BGS-file and delete key'ed in Areas in defined Cell's. I know what the different "LWMDataAreaFill"-types (1x1, 2x2, 4x4, 8x8, 16x16) means, my problem is just that I'm not sure about if its only the "LWMDataAreaDrawPolygons" or "LWMDataAreaFillXxX" or both that shall be deleted. I'm sorry I'm so eager and impatient but after all the help I have received from you and other guru's on this forum, I would like to contribute a little myself. ;-)CheersLars

Share this post


Link to post
Share on other sites

Hi Lars:The display of your add-on mesh is blocked by LWM3 polys or area fills with elevation set to zero. To change that you need to remove the cells that indicate type "_Water_" and 0 m elevation. Obviously, you only want to do that for those Areas for which you have created, in G2K4, a replacement set of coastlines; in LWMViewer, place your project _3.bgl file on top of the default HP9 file and write down the Cell/Area coordinates you can safely delete. In short, the answer to your question is "yes" ;-)Again, it's easy to experiment. Just start with removing one Area and look at the results. If it worked, make a backup copy of that version of the altered .bgs, then continue on with editing.Cheers, Holger

Share this post


Link to post
Share on other sites

Hi Lars.There is a problem with this approach.If you decompile the default HP file, then alter the code to delete certain areas, then recompile... what happens when another author also edits the default code for his scenery? Now there are 2 conflicting default replacements... or 3, or 4, or 5....The only reason we need to alter the default code at all is to get rid of the flattening of the default LWM polys. So why not just get rid of all the flattening by replacing the default HP BGL with a whole new BGL with all the flattens removed ( by using Edgar Knobloch's LWMConverter on the decompiled default HP bgl): http://library.avsim.net/esearch.php?CatID...Scen&DLID=43104Now you can do what ever you like in a smaller sized area without worrying about what some other terrain designer is up to in the same LOD5 area. Your scenery can be at the correct height and shape. The rest of the default LOD5 area? Well, it was wrong to begin with! So it's no worse now. And if you get really ambitious, you can correct the entire LOD5 area's HP and HL BGLs, a section or cell at a time.This way would avoid a confusion of default replacements for identical HP files.Dick

Share this post


Link to post
Share on other sites

Thank's for youe answers Holger and Dick. Standing here between THE guru's I realize that this item can be aproached in different ways. Both have their pro's and con's. But all the same I think I'll work on with me little Delphi-programming exercise.Cheers Lars ;-)

Share this post


Link to post
Share on other sites

Actually, Dick and I will be meeting tomorrow high noon on Main Street to settle this issue once and for all ;-)Cheers, Holger

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