Jump to content
Sign in to follow this  
rhumbaflappy

Number of polygons with VTP2

Recommended Posts

Guest fumey

HelloFor a given Cell, layer and textures I have more than 127 polygons VTP2.As stated in the SDK I have created the following structure, but FS crashes.SDK : << To draw more than 127 polygons with the selected texture, repeat the same texture ID with the remaining polygons >>include TDFMacros.incinclude TDFHeaders.incBGLHeader 47, 44, 8, 5, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word datamark_v0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 7, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 127, 0; VTPPolyMethod2 4, 0, 0 VTPPointXY2 9551, 8176 VTPPointXY2 9551, 8170 VTPPointXY2 9552, 8161 VTPPointXY2 9566, 8147; the 126 remaining polygons ...;________________________________________________ VTPTextureId 0, 0 VTPPolyCount 63, 0;-------------------------------------------------;; VTPPolyMethod2 9, 0, 0 VTPPointXY2 9468, 8403 VTPPointXY2 9462, 8402 VTPPointXY2 9455, 8398 VTPPointXY2 9449, 8391 VTPPointXY2 9444, 8379 VTPPointXY2 9447, 8372 VTPPointXY2 9482, 8371 VTPPointXY2 9493, 8371 VTPPointXY2 9494, 8381; the 62 remaining polygons ...; datamark_v1 label word;----------------------------------------------Cellv_398_125 EQU VTPCellID 0, 398, 125;---------------------------------------------- VTPIndexStart label word VTPIndexHeader 1, VTPIndexData, VTPStart VTPIndexData label word VTPIndexEntry Cellv_398_125, VTPStart, datamark_v0, datamark_v1;-----------------------------TextureStart label word VTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1TextureDataStart label word texturemark_0 label word VTPTextureName "130" VTPTextureType 0, 0, 0, 0 texturemark_1 label wordTextureDataEnd label word; ------------------------------VTPEnd label wordI have also tried to repeat the layer structure but without results (FS crash).127 polygone is the maximum allowed; i have gather all my polygons (190 but obtains a message as something : 'memory limit reached').Has anyone found a solution ?ThanksChristian

Share this post


Link to post
Share on other sites
Guest fumey

Solution founded :In the VTPTextureListEntry, repeat the texture as a new texture and call it in a new VTPTextureID followed with the remaining polygons.I would happy if there is another way.Christian

Share this post


Link to post
Share on other sites
Guest fumey

Now I understand what happensIn the SDK we can read also : "Note, you can use the same Texture ID more than once in a given layer, but every occurence must be accounted for in tne texture count"There are two solutions :The first one as below, but with a big surface with many polygons, the surface is shown suddently or disappears also suddently depending of the view from the airplane, and the distance to this surface.Why ? allocation/deallocation of memory ?BGLHeader 47, 44, 8, 5, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word datamark_v0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 7, 0 VTPNumTexturesInLayer 2, 0 ; number of calls, not number of the textures VTPTextureId 0, 0 VTPPolyCount 127, 0;;; VTPPolyMethod2 4, 0, 0 VTPPointXY2 9551, 8176 VTPPointXY2 9551, 8170 VTPPointXY2 9552, 8161 VTPPointXY2 9566, 8147;; 126 remaining polys; ;________________________________________________ VTPTextureId 0, 0 'refer to the same texture as above VTPPolyCount 63, 0;;; VTPPolyMethod2 9, 0, 0 VTPPointXY2 9468, 8403 VTPPointXY2 9462, 8402 VTPPointXY2 9455, 8398 VTPPointXY2 9449, 8391 VTPPointXY2 9444, 8379 VTPPointXY2 9447, 8372 VTPPointXY2 9482, 8371 VTPPointXY2 9493, 8371 VTPPointXY2 9494, 8381;; 62 remainig polys; datamark_v1 label word;----------------------------------------------Cellv_398_125 EQU VTPCellID 0, 398, 125;---------------------------------------------- VTPIndexStart label word VTPIndexHeader 1, VTPIndexData, VTPStart VTPIndexData label word VTPIndexEntry Cellv_398_125, VTPStart, datamark_v0, datamark_v1;-----------------------------; we declare only one texture;__________________________________TextureStart label word VTPTextureListHeader 1, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1TextureDataStart label word texturemark_0 label word VTPTextureName "137" VTPTextureType 0, 0, 0, 0 texturemark_1 label wordTextureDataEnd label word; ------------------------------VTPEnd label word______________________________________________________________________________the second solution :we create textures in the VTPTextureListEntry structure as many as we call.The risk is that we can reach the limit of 127 textures per layer and more the same limit for one BGLBGLHeader 47, 44, 8, 5, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word datamark_v0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 7, 0 VTPNumTexturesInLayer 2, 0 ; number of calls VTPTextureId 0, 0 : first texture VTPPolyCount 127, 0;;; VTPPolyMethod2 4, 0, 0 VTPPointXY2 9551, 8176 VTPPointXY2 9551, 8170 VTPPointXY2 9552, 8161 VTPPointXY2 9566, 8147;; 126 remaining polys; ;________________________________________________ VTPTextureId 1, 0 ;second texture VTPPolyCount 63, 0;;; VTPPolyMethod2 9, 0, 0 VTPPointXY2 9468, 8403 VTPPointXY2 9462, 8402 VTPPointXY2 9455, 8398 VTPPointXY2 9449, 8391 VTPPointXY2 9444, 8379 VTPPointXY2 9447, 8372 VTPPointXY2 9482, 8371 VTPPointXY2 9493, 8371 VTPPointXY2 9494, 8381;; 62 remainig polys; datamark_v1 label word;----------------------------------------------Cellv_398_125 EQU VTPCellID 0, 398, 125;---------------------------------------------- VTPIndexStart label word VTPIndexHeader 1, VTPIndexData, VTPStart VTPIndexData label word VTPIndexEntry Cellv_398_125, VTPStart, datamark_v0, datamark_v1;-----------------------------; we declare 2 identical textures;__________________________________TextureStart label word VTPTextureListHeader 2, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 VTPTextureListEntry TextureDataStart, texturemark_1, texturemark_2TextureDataStart label word texturemark_0 label word VTPTextureName "137" VTPTextureType 0, 0, 0, 0 texturemark_1 label word VTPTextureName "137" VTPTextureType 0, 0, 0, 0 texturemark_2 label wordTextureDataEnd label word; ------------------------------VTPEnd label wordThanksChristian

Share this post


Link to post
Share on other sites

Hi Christian.I don't have an example as large as what you're using... but may be a third and fourth alternative:========================;Each ID# is limited as 127 polys... so you need 2 ID#s.. 0 and 1;----------------------------------------------Cellv_398_125 EQU VTPCellID 0, 398, 125;----------------------------------------------VTPIndexStart label wordVTPIndexHeader 1, VTPIndexData, VTPStartVTPIndexData label wordVTPIndexEntry Cellv_398_125, VTPStart, datamark_v0, datamark_v1;-----------------------------; we ID the same textue twice;__________________________________TextureStart label wordVTPTextureListHeader 2, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label wordVTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 ;ID#0VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 ;ID#1TextureDataStart label wordtexturemark_0 label wordVTPTextureName "137" ; this name is defined only once, but indexed twiceVTPTextureType 0, 0, 0, 0texturemark_1 label wordTextureDataEnd label word; ------------------------------VTPEnd label word=========================Another alternative might be to index an identical Cell...between datamark_v0a and datamark_v1a:;----------------------------------------------Cellv_398_125 EQU VTPCellID 0, 398, 125 ;cell is ID'd once;----------------------------------------------VTPIndexStart label wordVTPIndexHeader 2, VTPIndexData, VTPStartVTPIndexData label wordVTPIndexEntry Cellv_398_125, VTPStart, datamark_v0, datamark_v1VTPIndexEntry Cellv_398_125, VTPStart, datamark_v0a, datamark_v1a ; same Cell as above, but indexed twice to refresh the 127 poly/layer limit;-----------------------------Now the polys could be split into separate VTP indexes, that call that ID the same Cell.. giving you another 127 polys for the layer and ID# of that Cell. As far as I know, you can index the same texture or Cell as many times as you want.Of course, you can use another layer to defeat the problem as well.. but I suspect you're needing the layers as you've written them.==================I haven't tested this, but these may be alternative solutions.DickP.S.I may be able to get access to MapInfo, if you still have the mapbasic routine for shapefiles for LWMs and VTPs. :)

Share this post


Link to post
Share on other sites
Guest christian

Hi Christian>SDK : << To draw more than 127 polygons with the selected >texture, repeat the same texture ID with the remaining >polygons >> This is a whole lot of rubbish, like some other things in the SDK.I just wanted to post the correct macro here, but unfortunately I don't have it here. Please send me a private message or email (using the avsim system) as a reminder and I'll post you the correct macro on tuesday (monday, I have a day off)...In case you want to have a play beforehand: If you have more than 127 entries, you have to add an extra db into your macro, like this: second db = poly_count / 128, first db = poly_count - second db * 128.eg for 128 do 'db 0, db 1'.eg for 259 do 'db 3, db 2'.for 127 this is obvioulsy 'db 127, db 0', but the zero gets dropped.Cheers, Christian

Share this post


Link to post
Share on other sites
Guest fumey

Thanks for your comments.Sorry, I was certainly somewhat tired or blind yesterday. The two proposed solutions give the same result in FS2K.The conclusion for me : with VTP we can index the same texture as many times as we want as you say, but in VTPNumTexturesInLayer we must account the number of VTPTextureID we have in the layer else FS crashes. The SDK is good in information for this problem.It's not so easy to automatize all that.ThanksChristian

Share this post


Link to post
Share on other sites

Hi Christian.Yes, please give the example. I thought that was an unnecessary restriction, to only allow 127 polys for a texture in a cell's layer.Keeping in mind that Christian Fumey is using my TDFMacros. Is this what you mean?VTPPolyCountEx Macro TotalCount, ReservedLargeCount EQU ( ( TotalCount / 128 ) * 128 )BYTE ( Reserved * 80h ) + 127BYTE ( TotalCount - LargeCount )BYTE ( TotalCount / 128 )EndMThat makes this possible:VTPPolycountEx 256, 0for 256 polys in the layer with the same texture... to be used instead of the original form when the polycount exceeds 127.Your macro has conditional branching, so a single form covers both regular and expanded forms of VTPPolyCount? And does that reserved bit of 0 mean anything?I can't wait for your decompiler! :)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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...