Jump to content
Sign in to follow this  
Guest

More than 127 VTP polys in a BGL?

Recommended Posts

Guest

I'm trying to create streams and rivers in my scenery. The poly count is greater then 127. The VTP SDK says that you can create more then 127 VTP polys by repeating the same texture id with the remaining polygons. Using Ground2K I get the following BGLC code...BGLHeader 41, 38, -119, -122, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word datamark_v0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 16, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 127, 0.. All of the 127 polygon (lines actually) definitions.. VTPTextureId 0, 0 VTPPolyCount 48, 0.. The other 48 polygon definitions.. datamark_v1 label word;----------------------------------------------Cellv_125_142 EQU VTPCellID 0, 125, 142;---------------------------------------------- VTPIndexStart label word VTPIndexHeader 1, VTPIndexData, VTPStart VTPIndexData label word VTPIndexEntry Cellv_125_142, 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 "1024" VTPTextureType 0, 0, 0, 0 texturemark_1 label wordTextureDataEnd label word; ------------------------------VTPEnd label wordThis code looks correct to me. However, when loading into FS9, the program quits without error while loading the terrain. So I decided to break up the file into two bglc files. One with the 127 polys in it and the other with the 48 polys in it. After doing so, FS9 ran just fine.So is this code correct? Can we have more then 127 VTP polys by respecifing the texture? Lee Steffensen

Share this post


Link to post
Share on other sites

Hi Lee.It's going back a ways, but I believe someone did find we could have more than 127 polys... I'll look for it.EDITED:http://forums.avsim.net/dcboard.php?az=sho...=8950&mode=fullhttp://forums.avsim.net/dcboard.php?az=sho...=9891&mode=fullChristian Stock and Winfried Orthmann both came to the conclusion we could use the Reserved bit, then just add a line with the count in BYTES.But I never persued the macro definition, but to use 175 VTP polys...The reserved bit is set to 1, followed my the multiple of 128 that can be deducted wholely into the number... in other words the VTPPolyCount contains the remainder of the count/128, and the following BYTE contains the dividend. ( 175 / 128 = 1 with a remainder of 47 ):VTPPolyCount 47, 1BYTE 1If you had 3006 polys:( 3006 / 128 = 23 with a remainder of 62 ):VTPPolyCount 62, 1BYTE 23I hope this is right. :-eek Dick

Share this post


Link to post
Share on other sites
Guest

Thanks Dick, this did indeed work! To facilitate this, I created a new macro to create the necessary code.VTPPolyCountEx Macro Count IF Count GT 127 BYTE 80h + (Count MOD 128) BYTE ((Count - (Count MOD 128)) / 128) ELSE BYTE Count ENDIFEndMIt's been tested and works great.Count can be any value from 1 to 32767 which is now what I believe the maximum poly count can be for a layer. I'll have to modify my BGLC assember files that Ground 2K creates to use this. But if I want more then 127 polys per layer, then so be it. Once again, the SDK is not 100% accurate!Lee.

Share this post


Link to post
Share on other sites

Hi Lee.Once a new SDK is released, hopefully we'll have new/corrected info, and a revised TDFMacros.inc can be made. I'd rather wait for that before I revise the macro set.Christian Stock and Winfried Orthmann both have suggested changes to the macros. ( I believe there may be other reserved bits in 'count' structures that may be altered ). These changes would veer away from the SDK a bit, and I have so far resisted these changes... but I would consider a major revision with the release of a new SDK.Dick

Share this post


Link to post
Share on other sites
Guest gorchi

Lee,in Your one BGL solution You could try to change instructionVTPNumTexturesInLayer 1, 0.to VTPNumTexturesInLayer 2, 0 or any other number and then it should work (at least it does work for me)! What is next texture ID is irrelevant, it can be the same or any other...Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest

Thanks for the tip Goran. If I understand you correctly, I would need to place another texture record to the list and then point the second set of polys to the second texture? Then I would just continue the process if more poly groups in the layer were needed?Lee.

Share this post


Link to post
Share on other sites
Guest gorchi

Lee,it's better to explain You on Your example:========================BGLHeader 41, 38, -119, -122, TerrainHeaderStart, VTPHeaderVTPHeader label word VTPFileHeader 256, VTPIndexStart, TextureStart, VTPEndVTPStart label word datamark_v0 label word VTPDataArea 1, 1, 0, 0 VTPLayer 16, 0 VTPNumTexturesInLayer 2, 0 ;<< using 2 textures,although the same texture VTPTextureId 0, 0 ; <http://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest

Thanks Goran, that helps a lot. It also makes sense. The VTPNumTexturesInLayer record tells the scenery engine how many VTPTextureId records to expect. Ground2k is setting the value to one (in my example) instead of the correct value of two. Again thanks!Lee.

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...