Sign in to follow this  
rhumbaflappy

VTPPolyMethod2Ex

Recommended Posts

As anybody already had success in creating an extended polygon using method2 (polygons with more then 30 points)? I have tried everything that came into my mind, but FS keeps crashing while loading the scenery :(.Arno


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


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

Hi Arno.If you're using my TDFMacros.inc, you'll probably get a crash.I had 2 bugs I found in my coding, and they'll be corrected with the release of the next tutorial. I hadn't expected anyone to be along that far, yet! :)Also, the SDK is a little skimpy on the explanation, but you need to use VTPPolyMethod2 ( set to 31 points ) immediately followed by VTPPolyMethod2Ex ( with the extra points ).VTPPolyMethod2 31, 0, 0VTPPolyMethod2Ex 3... should set up 34 ( 31 + 3 ) points.I'll attach what I believe is a good TDFMacros.incDick

Share this post


Link to post
Share on other sites

Hi Dick,Thanks for the quick answer.We already thought there was an bug in the macro and I even tried what you describe, but it does not work for me. The file compiles correct, but when I load it into FS the loading slows down when it reaches 16% and then takes forever (so no error message). I have waited several minutes, but it will not stop loading.I have attached the code below I am trying it with. I think I have searched it for errors several times no and I can't find them. Maybe you can see the fault very fast :).ArnoPS. And yes we are working hard on the mesh now. As we already have all the data in our design programs database and many of those polygons have more then 30 points, we can accross this problem soon :).


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a][tt]include TDFMacros.incdata_base label word; DATABASE HEADER dw 1 ; World set number (must be 1) dd 5743025 ; North Bound dd 5703957 ; South Bound dd 44739242 ; East Bound dd 39146837 ; 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 ; seeds level 13 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 ; com radio data dd 0 ; adf 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 ; spare dw 0 ; spare dd 0h,0h,0h,0h ; GUID dd 0 ; product id dd 0 ; product build number dd 0 ; data pointers count dd 0 ; facility2 name list data dd 0 ; facility2 latband list data dd 0 ; facility2 object list data; TERRAIN MESH DATABASEterrain_data label word; TERRAIN MESH HEADER dd terrain_header_end - terrain_data ; end of terrain header dd 514 ; version dd 0 ; reserved 1 dd 0 ; reserved 2 dd 0 ; reserved 3 dd 0 ; reserved 4 dd 0 ; reserved 5 dd 0 ; reserved 6 dd 0 ; reserved 7 dd 0 ; reserved 8 dd 0 ; reserved 9 dd 0 ; reserved 10 dd 0 ; reserved 11 dd 0 ; reserved 12 dd 0 ; offset LMW Header dd decal_header - terrain_data ; offset VTP Header dd 0 ; reserved 13 dd 0 ; reserved 14 dd 0 ; reserved 15 dd 0 ; reserved 16 dd 0 ; reserved 17 dd 0 ; reserved 18 dd 0 ; reserved 19 dd 0 ; reserved 20 dd 0 ; reserved 21 terrain_header_end label worddecal_header label word VTPFileHeader 256, decal_list, decal_textures, decal_enddecal_data label worddata_start_0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 4, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0 VTPPolyMethod2 31, 0, 0 VTPPolyMethod2Ex 17 VTPPointXY2 6698, 10526 VTPPointXY2 6693, 10551VTPPointXY2 6684, 10576VTPPointXY2 6673, 10600 VTPPointXY2 6658, 10621VTPPointXY2 6641, 10641VTPPointXY2 6621, 10658VTPPointXY2 6600, 10673 VTPPointXY2 6576, 10684VTPPointXY2 6551, 10693VTPPointXY2 6526, 10698VTPPointXY2 6500, 10700 VTPPointXY2 6473, 10698VTPPointXY2 6448, 10693VTPPointXY2 6423, 10684VTPPointXY2 6400, 10673VTPPointXY2 6378, 10658VTPPointXY2 6358, 10641VTPPointXY2 6341, 10621VTPPointXY2 6326, 10600VTPPointXY2 6315, 10576VTPPointXY2 6306, 10551VTPPointXY2 6301, 10526VTPPointXY2 6300, 10500VTPPointXY2 6301, 10473VTPPointXY2 6306, 10448VTPPointXY2 6315, 10423VTPPointXY2 6326, 10400VTPPointXY2 6341, 10378VTPPointXY2 6358, 10358 VTPPointXY2 6378, 10341VTPPointXY2 6399, 10326VTPPointXY2 6423, 10315VTPPointXY2 6448, 10306VTPPointXY2 6473, 10301VTPPointXY2 6499, 10300 VTPPointXY2 6526, 10301VTPPointXY2 6551, 10306VTPPointXY2 6576, 10315VTPPointXY2 6599, 10326VTPPointXY2 6621, 10341VTPPointXY2 6641, 10358VTPPointXY2 6658, 10378VTPPointXY2 6673, 10399VTPPointXY2 6684, 10423VTPPointXY2 6693, 10448VTPPointXY2 6698, 10473VTPPointXY2 6700, 10499 data_end_0 label word Cell_391_109 EQU VTPCellID 0, 391, 109decal_list label word VTPIndexHeader 1, decal_groups, decal_data decal_groups label word VTPIndexEntry Cell_391_109, decal_data, data_start_0, data_end_0 decal_textures label word VTPTextureListHeader 1, texture_groups, texture_data, texture_end texture_groups label word VTPTextureListEntry texture_data, texture_start_0, texture_end_0 texture_data label wordtexture_start_0 label word VTPTextureName "0013" VTPTextureType 1, 0, 0, 4texture_end_0 label wordtexture_end label worddecal_end label word[/tt]

Share this post


Link to post
Share on other sites

I'm working on new TMF macros also, but the project is on ice at the moment because I got sidetracked with the TMFViewer. I want to get the seasons to work...As Dick, I want to make the macros close to the Terrain SDK, with a few exceptions though. The PolyEx is one of those exceptions. It's stupid to have poly and polyEx, it just confuses people and it's not necessary. Here's my method:VTP_DATA_POLY2 MACRO count, typeIF count GE 31 DB type * 32 + 31 DW count - 31ELSE DB type * 32 + countENDIF ENDMI haven't tested this, but it should work. I think the naming makes more sense as well. Now you don't have to worry about 'Ex' anymore...POLY_FAN EQU 0tPOLY_STRIP EQU 1tPOLY_LINE EQU 1tIf you put the above in, you can also use those for 'type' and the code is more readable.Hope that helps...Christian

Share this post


Link to post
Share on other sites

Hi Arno.Bad news. I can't get it to work either. I tried everything I could think of.I split your shape in half and rendered it as 2 polys... that works just fine. The fault is not BGLC, or the macros. The terrain engine locks up at 16% ( loading textures I believe ). I did not try a line with over 31 points.The SDk is a little confusing. It says if we set the bPointCount to 31, that means it's extended, and we must add the EX byte. But if we have exactly 31 points, does the next byte ( Ex ) need 1, or 0, 31, or 32???It's late here, so I'll play with it tomorrow... it acts like the point count is off!Dick

Share this post


Link to post
Share on other sites

Dick, did you see my post? You have to add a word (dw) not just a byte. If you have 31 points you have to indeed add a dw with 0. I actually got this from decompiling, so I hope I got it right. I really think my macro should work, as I got it from my decompiler, not from the SDK. There is a very small chance I have mixed something up as I have never tested this macro. I'm 99% sure it works though...Cheers, Christian

Share this post


Link to post
Share on other sites

Thanks Christian, I tried it and this works fine.I have also added the if to the macro to do the extended polygons automatically (I had thought of that already, but first wanted it to work :)).ArnoPS. Also thanks Dick of course for the help :D


Member Netherlands 2000 Scenery Team[a href=http://home.wanadoo.nl/arno.gerretsen]http://home.wanadoo.nl/arno.gerretsen/banner.jpg[/a]

Share this post


Link to post
Share on other sites

Hi Christian and Arno.Thanks Christian! I had read the post, and the change to WORD had slipped right by me!And thanks Arno! This is the best way to iron out the problems with the SDKs and the macros I released. Now you might see why I have been reluctant to pull the tutorial from the file libraries to correct the macros. Between my mistakes and Microsoft's documentation errors, the tutorial would have to be pulled every week... and nobody would know which version they had! Also, no one could experiment if the material had been delayed until I checked every possible combination of macro usage... might have been months. And my major concern was to have a common TDF language at this point, so we could communicate our studies.New macros and warnings of SDK errors will be in the next tutorial.I'm going to test VTPPolyMethod1Ex to see if the SDK error infects the Method1 extra format... Then I'll post the results here with yet another TDFMacros.inc update.Also, for anyone else reading...The TDFMacros.inc was released in that form so Arno, Christian, Lee, I, and others would have a common vocabulary to refer to exactly the types of problems we've been discovering.But, Christian is right, in that as our programming skills improve, better macros will naturally surface. They'll have shorter names, and will automatically add bits and bytes that are constants and flags that don't change. We'll have names to use, instead of cryptic numbers for flags and switches. I'm also sure derivations of C++ may be introduced, and programs such as Lee's, Christian's, and Arno's Group are developing will remove most of the tedium of BGLC/MASM hand-coding.Dick

Share this post


Link to post
Share on other sites

Hi Arno.I've found another problem with the SDK.It seems VTPMethod1 fan polygons are limited to 24 XYUV points.Also, I cannot yet get the seasonal named textures to work with either method ( comma de-limited files ), but the seasons work fine with landclass numbers or 'terraintexture.cfg' numbers.If those are both errors in the SDK, that presents a pretty large restriction for Method1 polys, as they would not display seasons, as well as being limited to 24 points.This is just south of your polygon:include TDFMacros.inc include TDFHeaders.incBGLHeader 53, 49, 5, 1, TerrainHeaderStart, decal_headerdecal_header label word VTPFileHeader 256, decal_list, decal_textures, decal_end decal_data label word data_start_0 label word VTPDataArea 1, 0, 9, 28VTPLayer 8, 0VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0VTPPolyCount 1, 0VTPPolyMethod1 24, 0, 1VTPPointXYUV 0, 0, 0, 0VTPPointXYUV 0, 25, 0, 25VTPPointXYUV 0, 50, 0, 50VTPPointXYUV 0, 75, 0, 75VTPPointXYUV 0, 100, 0, 100VTPPointXYUV 0, 125, 0, 125VTPPointXYUV 0, 150, 0, 150VTPPointXYUV 0, 175, 0, 175VTPPointXYUV 0, 200, 0, 200VTPPointXYUV 50, 200, 50, 200VTPPointXYUV 100, 200, 100, 200VTPPointXYUV 150, 200, 150, 200VTPPointXYUV 200, 200, 200, 200VTPPointXYUV 200, 150, 200, 150VTPPointXYUV 200, 100, 200, 100VTPPointXYUV 200, 50, 200, 50VTPPointXYUV 200, 0, 200, 0VTPPointXYUV 175, 0, 175, 0VTPPointXYUV 150, 0, 150, 0VTPPointXYUV 125, 0, 125, 0VTPPointXYUV 100, 0, 100, 0VTPPointXYUV 75, 0, 75, 0VTPPointXYUV 50, 0, 50, 0VTPPointXYUV 25, 0, 25, 0data_end_0 label wordCell_391_109 EQU VTPCellID 0, 391, 109 decal_list label word VTPIndexHeader 1, decal_groups, decal_datadecal_groups label word VTPIndexEntry Cell_391_109, decal_data, data_start_0, data_end_0decal_textures label word VTPTextureListHeader 1, texture_groups, texture_data, texture_endtexture_groups label word VTPTextureListEntry texture_data, texture_start_0, texture_end_0texture_data label word texture_start_0 label word VTPTextureName "029b2su2.bmp"texture_end_0 label word texture_end label word decal_end label wordI'm attaching the latest change for TDFMacros.incIt corrects the VTPPolyMethod2Ex to WORD, and I made the same change to VTPPolyMethod1Ex ( even though I can't get that to function ).Dick

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