Jump to content
Sign in to follow this  
Guest

A Question of Correct Coding...

Recommended Posts

Guest

Hi GuysAfter learning some more about correct coding, with the use of 'Return's', I'm on the 'Earole' for some more!!!Would the way this code is written affect frame rates/smooth running of MsFsShould it be broke down into seperate Subroutines within the main RotatedCall();--------------------------------------------------------------------------------; Textured Grid: Welshpool;-------------------------------------------------------------------------------- Area( b 52:37:45.000000 -03:09:10.800000 10 ) LayerCall( :grd 25 ) Jump( : ) :grd RefPoint( rel :TagPhotoGrid 1.32101 52:37:47.049765 -03:09:9.325000 v1= 8000 v2= 500 ) RotatedCall( :display 0 0 358.547 ) Return:display LoadBitmap( 0 0 E0 0 0 0 Wpl0000.bmp ) Points( 0 -384 0 -384 -128 0 -384 -128 0 -128 -384 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256) LoadBitmap( 0 0 E0 0 0 0 Wpl0001.bmp ) Points( 0 -128 0 -384 128 0 -384 128 0 -128 -128 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) ; LoadBitmap( 0 0 E0 0 0 0 Wpl0002.bmp );Bottom Right; Points( 0; 64 0 -192; 192 0 -192; 192 0 -64; 64 0 -64; ); TexPoly( 0 32767 0 0 ; 0 0 0; 1 256 0; 2 256 255; 3 0 255 ); LoadBitmap( 0 0 0 0 0 0 Wpl0003.bmp ); Points( 0; -192 0 -64; -64 0 -64; -64 0 64; -192 0 64; ); TexPoly( 0 32767 0 0 ; 0 0 0; 1 255 0; 2 255 255; 3 0 255 ) LoadBitmap( 0 0 E0 0 0 0 Wpl0004.bmp ) Points( 0 -128 0 -128 128 0 -128 128 0 128 -128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) LoadBitmap( 0 0 E0 0 0 0 Wpl0005.bmp ) Points( 0 128 0 -128 384 0 -128 384 0 128 128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256) ; LoadBitmap( 0 0 E0 0 0 0 Wpl0006.bmp );Top left; Points( 0; -192 0 64; -64 0 64; -64 0 192; -192 0 192; ); TexPoly( 0 32767 0 0 ; 0 0 0; 1 255 0; 2 255 255; 3 0 255 ) LoadBitmap( 0 0 E0 0 0 0 Wpl0007.bmp ) Points( 0 -128 0 128 128 0 128 128 0 384 -128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256) LoadBitmap( 0 6 E0 0 0 0 Wpl0008.bmp ) Points( 0 128 0 128 384 0 128 384 0 384 128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :TagPhotoGrid EndA-----------------------------------------------------------------------The lines 'Remmed out' are squares not used in the grid of 8No Bitmapshope someone will guide meBest RegardsDave

Share this post


Link to post
Share on other sites
Guest gorchi

Dave,maybe it would be better to define points at the start, then just use LoadBitmap() and texpolys(). Otherwise You can try it Yourself with placing in scenry let's say 100 of these macros, once written as it is right now and the second time with definition of points at the top and then followed with TexPoly/LoadBitmap.Also I see taht You missed PerspectiveCall() and ShadowCall... The first one might be good to be included...Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest luissa

Hi Dave,For ground polygons I use exactely the same as you except that:1) As Goran pointed out, I would make a global Points() list2) the label :TagPhotoGrid would point to a ReturnRegards, Luisps: when RefPoint is executed you are already "inside a subroutine" that is the LayerCall(). So if the RefPoint visibility fails you should "return" instead of jumping to EndA with the "stack of address returns" incremented by one!

Share this post


Link to post
Share on other sites
Guest

Hi guys, thanks for your repliesThis is what I did in the meantime......----------------------------------------------------------------------------------------------------------------------------------------Area( b 52:37:45.000000 -03:09:10.800000 5 ) LayerCall( :grid 25 ) Jump( : ) :grid;---- RefPoint( rel :nodisplay 1.32101 52:37:47.049765 -03:09:9.325000 v1= 8000 v2= 500 ) RotatedCall( :display1 0 0 358.547 ) RotatedCall( :display2 0 0 358.547 ) RotatedCall( :display3 0 0 358.547 ) RotatedCall( :display4 0 0 358.547 ) RotatedCall( :display5 0 0 358.547 ) RotatedCall( :display6 0 0 358.547 ) Return:display1;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0000.bmp ) Points( 0 -384 0 -384 -128 0 -384 -128 0 -128 -384 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display2 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0001.bmp ) Points( 0 -128 0 -384 128 0 -384 128 0 -128 -128 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display3 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0004.bmp ) Points( 0 -128 0 -128 128 0 -128 128 0 128 -128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display4 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0005.bmp ) Points( 0 128 0 -128 384 0 -128 384 0 128 128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display5 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0007.bmp ) Points( 0 -128 0 128 128 0 128 128 0 384 -128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display6;------------------------------------------------ LoadBitmap( 0 6 E0 0 0 0 Wpl0008.bmp ) Points( 0 128 0 128 384 0 128 384 0 384 128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :nodisplay;------------------------------------------------ ReturnEndA----------------------------------------------------------------------------------------------------------------------------------------Does the globalisation of the points avoid all the seperate RotatedCall()'sAnd, goren, does the LayerCall() not replace the PerspectiveCall(), I need to stand corrected on this.... I'm just trying to consolidate what I have learn't to dateI guess the burning crucial question is!!!!, does what I have written run smoothly....and can its effect in Fs improve....Thanks for the support guysBest RegardsDave

Share this post


Link to post
Share on other sites
Guest gorchi

Hi Dave,You are right about LayerCall. If You use polygons for ground, then You should use only Layercall.But it is also true, that if You'll have all the points at the one place as one part, then You need only one RotatedCall. This is also logical, since You'll have everything as one part.And this is what it looks in my API for ground poly:;VODDATA Latitude Longitude Range Scale Rotation Not_used Not_used Not_used Not_used Visibility Altitude Scenery_complexity(0-5) Not_used Not_used;MACRODESC Apron na Brniku;DESIGNSHAPE -1152,-384, -1152,384, 1152,384, 1152,-384;DEFAULTRANGE 12000;DEFAULTSCALE 0.7;DEFAULTDENSITY Very sparse;Generated with FS Design Studio v1.6;Copyright 2002 Goran Brumen; %1 = Latitude; %2 = Longitude; %3 = Range; %4 = Scale; %5 = Rotation; %6 = Not used; %7 = Not used; %8 = Not used; %9 = Not used; %10 = Visibility range; %11 = Altitude; %12 = Scenery complexitySet( LinBuf 64 )Area( 5 %1 %2 %3 )IfVarRange( :Exit 0346 %12 5 )LayerCall( :PC02 8 )Jump( :Exit ):PC02RefPoint( rel :Skip %4 %1 %2 v1= 12000 v2= 700 )RotatedCall( :B 0 0 36.2 ):BCall32( :Part0 )Call32( :Part1 )Call32( :Part2 )Call32( :Part3 )Call32( :Part4 )Call32( :Part5 )....Return:Part0...Return...:EndEndAAlthough it is best to keep all those points at one place, in one Points() instruction, I have every polygon in its own part as You can see above. But I must also say that in groundpolys, since ShadowCall is left out (and must be!), the FPS drop is only slight (really low), more important is to have all those objects that do repaet in library BGL. I have put 10 such objects in library BGL and so I got 5 FPS...Hope it helps! Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest

Hi GorenIts always helpfulI don't quite understand where the Points() (global)instruction's would be in the routines, because the Call32() for seperate Part's would include the LoadBitmap() and Texpoly() comands, only, assumably....I 'm sure its me not thinking, clearly...RegardsDave

Share this post


Link to post
Share on other sites
Guest gorchi

Hi Dave!No problem, at this (my) API, every Part has its own points declaration and then LoadBitmap() and TexPolys. It goes something like this::Part0Points( 0 -10 0 -10 ;0 -10 0 10 ;1 10 0 10 ;2 10 0 -10 ;3 )LoadBimap( 0 W6 EF 0 200 0 LJLJ_A01.BMP )TexPoly( a 0 0 255 1 0 0 2 255 0 3 255 255 )ReturnAnd so on, every part. But please, this is just because it was simpler to make such big ground poly (after all, it uses 30 bitmaps or so) and I didn't joins all those polygons together.But still, with such anount of polygons I haven't seen any noticable FPS drop.Oh and I just remmebered. Not long ago, somebody has shown here a groundpoly api where every polygon had its own reference point which I think is really good because of smaller V2 value (my Ground poly must use a huge V2) and thus giving me more autogen and closer to the airport.Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest

Hi goren, you'll be getting fed up of me....Because of the size of your ground you included points() in each Subroutine, like this code below.....With my simpler 8No bitmaps, where would I place my points globally, look at my code below, all is this ok the way it is....Many thanks again, Dave...*********************************************************************Area( b 52:37:45.000000 -03:09:10.800000 5 ) LayerCall( :grid 25 ) Jump( : ) :grid;---- RefPoint( rel :nodisplay 1.32101 52:37:47.049765 -03:09:9.325000 v1= 8000 v2= 500 ) RotatedCall( :display1 0 0 358.547 ) RotatedCall( :display2 0 0 358.547 ) RotatedCall( :display3 0 0 358.547 ) RotatedCall( :display4 0 0 358.547 ) RotatedCall( :display5 0 0 358.547 ) RotatedCall( :display6 0 0 358.547 ) Return:display1;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0000.bmp ) Points( 0 -384 0 -384 -128 0 -384 -128 0 -128 -384 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display2 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0001.bmp ) Points( 0 -128 0 -384 128 0 -384 128 0 -128 -128 0 -128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display3 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0004.bmp ) Points( 0 -128 0 -128 128 0 -128 128 0 128 -128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display4 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0005.bmp ) Points( 0 128 0 -128 384 0 -128 384 0 128 128 0 128 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display5 ;------------------------------------------------ LoadBitmap( 0 0 E0 0 0 0 Wpl0007.bmp ) Points( 0 -128 0 128 128 0 128 128 0 384 -128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :display6;------------------------------------------------ LoadBitmap( 0 6 E0 0 0 0 Wpl0008.bmp ) Points( 0 128 0 128 384 0 128 384 0 384 128 0 384 ) TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 ) Return :nodisplay;------------------------------------------------ ReturnEndA*********************************************************************

Share this post


Link to post
Share on other sites
Guest gorchi

Hi Dave!He he.. fed up.. no no, I won't! Okay, let's see how it would look:;VODDATA Latitude Longitude Range Scale Rotation Not_usedNot_used Not_used Not_used Visibility AltitudeScenery_complexity(0-5) Not_used Not_used;MACRODESC Dave's little ground polygon :);DEFAULTRANGE 12000;DEFAULTSCALE 0.7;DEFAULTDENSITY Very sparse; %1 = Latitude; %2 = Longitude; %3 = Range; %4 = Scale; %5 = Rotation; %6 = Not used; %7 = Not used; %8 = Not used; %9 = Not used; %10 = Visibility range; %11 = Altitude; %12 = Scenery complexitySet( LinBuf 64 )Area( 5 %1 %2 %3 )IfVarRange( :Exit 0346 %12 5 )LayerCall( :PC02 8 )Jump( :Exit ):PC02RefPoint( rel :Skip %4 %1 %2 v1= 12000 v2= 700 )RotatedCall( :B 0 0 36.2 ):BPoints( 0; for texpoly no1 -384 0 -384 ;0 -128 0 -384 ;1 -128 0 -128 ;2 -384 0 -128 ;3; for texpoly no2; -128 0 -384 ;no need, is same as 1 128 0 -384 ;4 128 0 -128 ;5; -128 0 -128 ;no need is same as 2; for texpoly no3; -128 0 -128 ;no need is same as 2; 128 0 -128 ;no need, is same as 5 128 0 128 ;6 -128 0 128 ;7 ) LoadBitmap( 0 0 E0 0 0 0 Wpl0000.bmp )TexPoly( 0 32767 0 0 0 0 0 1 256 0 2 256 256 3 0 256 )LoadBitmap( 0 0 E0 0 0 0 Wpl0001.bmp )TexPoly( 0 32767 0 0 1 0 0 4 256 0 5 256 256 2 0 256 )LoadBitmap( 0 0 E0 0 0 0 Wpl0004.bmp )TexPoly( 0 32767 0 0 2 0 0 5 256 0 6 256 256 7 0 256 )...Return:EndEndAOkay, little explanation. I have joined Your parts together and eliminated duplicated points. As I have merged together points, so I had to renumber points in TexPoly instructions. They are the same, just point numbers are different. So You'll get one big part consisting of a lot of points, and LoadBitmap and TexPoly instrucztions as many as there are squares.So this is my idea of making API more efficient but who knows... Maybe this will have another bad side and this is a big v2 value, which can erase autogen at some distance. Just now I am strugling with this problem on my LJLJ airport and must say, reclaiming Autogen isn't quite easy task, just becuase of v2.I hope You understand what I wanted to do if not, we'll hear again :)Best regards,Goran BrumenFS Slovenija 2002 teamhttp://slovenia.avsim.net

Share this post


Link to post
Share on other sites
Guest

Hi GorenI'm with you nowIt's all one subroutine from the rotateCall() following the merged points10 out of 10, gorenWish I could help you with your LJLJ, this is where the Forum gets strong, with the stronger helping the strong, and the strong helping dare I say it, the Weak...Many thanksDave

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