Jump to content
Sign in to follow this  
Guest Claviateur

Need help in this code plz :)

Recommended Posts

Guest Claviateur

Hi,As I heard on this forum, in order to avoid having a textured polygon exclude autogen, one must move the refpoint to a place where there is no autogen (sea for exemple) and then use transformcall to bring it back. Now I am using Architect2002 and it compiles with FreeSC. So I do not know how to edit the code so it will make the transformcall happen with FreeSC.here is the code of my textured polygon grid compiled in architect throuhg FreeSC:Area( b 33:49:2.241296 35:29:23.355961 20 ) RefPoint( rel :TagPhotoGrid 0.304800 33:49:2.241296 35:29:23.355961 v1= 37040 v2= 5797 ) RotatedCall( :rot 0 0 0.00 ) Jump( : ):rot LoadBitmap( 0 128 0 0 0 0 olba0000.bmp ) Points( 0 -6340 0 -9510 -3170 0 -9510 -3170 0 -6340 -6340 0 -6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0001.bmp ) Points( 0 -3170 0 -9510 0 0 -9510 0 0 -6340 -3170 0 -6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0004.bmp ) Points( 0 -6340 0 -6340 -3170 0 -6340 -3170 0 -3170 -6340 0 -3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0005.bmp ) Points( 0 -3170 0 -6340 0 0 -6340 0 0 -3170 -3170 0 -3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0006.bmp ) Points( 0 0 0 -6340 3170 0 -6340 3170 0 -3170 0 0 -3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0009.bmp ) Points( 0 -3170 0 -3170 0 0 -3170 0 0 0 -3170 0 0 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0010.bmp ) Points( 0 0 0 -3170 3170 0 -3170 3170 0 0 0 0 0 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0013.bmp ) Points( 0 -3170 0 0 0 0 0 0 0 3170 -3170 0 3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0014.bmp ) Points( 0 0 0 0 3170 0 0 3170 0 3170 0 0 3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0015.bmp ) Points( 0 3170 0 0 6340 0 0 6340 0 3170 3170 0 3170 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0016.bmp ) Points( 0 -6340 0 3170 -3170 0 3170 -3170 0 6340 -6340 0 6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0017.bmp ) Points( 0 -3170 0 3170 0 0 3170 0 0 6340 -3170 0 6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0018.bmp ) Points( 0 0 0 3170 3170 0 3170 3170 0 6340 0 0 6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0019.bmp ) Points( 0 3170 0 3170 6340 0 3170 6340 0 6340 3170 0 6340 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0020.bmp ) Points( 0 -6340 0 6340 -3170 0 6340 -3170 0 9510 -6340 0 9510 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0021.bmp ) Points( 0 -3170 0 6340 0 0 6340 0 0 9510 -3170 0 9510 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) LoadBitmap( 0 128 0 0 0 0 olba0022.bmp ) Points( 0 0 0 6340 3170 0 6340 3170 0 9510 0 0 9510 ) TexPoly( 0 32767 0 0 0 0 0 1 255 0 2 255 255 3 0 255 ) Return:TagPhotoGrid EndAThanks!Michel

Share this post


Link to post
Share on other sites
Guest luissa

Hi Michel,The following will move the RefPoint 500 meters WEST of its present position. The TransformCall will move the polygons 500 meters back to EAST. Therefore they will be placed in the same position. FS "will think" that the polys are in the sea (I assume you have sea to the west of your airport).GPR( 33:49:2.241296 35:29:23.355961 )Area( b d 0 -500 20 ) RefPoint( rel :TagPhotoGrid 0.304800 d 0 -500 v1= 37040 v2= 5797 ) UVar( $XShift [ 500 / 0.3048 ] ) TransformCall( :rot [$XShift] 0 0 0 0 0 0 0 0 ) Jump( : ) :rot LoadBitmap( 0 128 0 0 0 0 olba0000.bmp ) ; and the rest unchangedA further note: test polygon visibility when you are passing the polygons coming from WEST. If they disappear try to increase v2 parameter, eg, use say 10000 instead of 5797. I hope that FSC compiles this. Otherwise try SCASM for this particular file.Attention: < and > in UVar() and TransformCall() above are square brackets!Regards, Luis

Share this post


Link to post
Share on other sites
Guest Claviateur

Thanks so much Luis, I tried the code you gave me, I changed the <> to square braquets but while compiling with FreeSc I got this error:Undefined Function 'gpr'I then noticed in the manual of FreSC that the command is grp so I corrected it but then I got an error in line 61 wish isNumber of parameters is invalid for:RefPoint( rel :TagPhotoGrid 0.304800 d 0 -500 v1= 37040 v2= 5797 ) Any idea please?Thanks :)Michel

Share this post


Link to post
Share on other sites

I think you need to use SCASM then, FreeSC doesn't has that function it seems.One note, in principle this shifting might work OK, but because your refpoint isn't in the middle of the polygon anymore your visibility checks will also work from that new RefPoint, so that means you need a bigger range (v1 and v2), where the increase in v2 basically means a little drop in fps.As long as the shift is only a couple of houndreds meters the problem will not be that big, but once you start shifting over kilometers you will see the effect.Arno


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

Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest Claviateur

Hi Arno,thanks for the reply. Actually the compiling error is in the RefPoint line and it mentions that the Number of parameters is invalid for:RefPoint( rel :TagPhotoGrid 0.304800 d 0 -500 v1= 37040 v2= 5797 )As for the V2 you are right but I hink I can shift the airport no more then 1 kilometer west and will see how the thing will work. The only thing I am triyng to understand now is wish one(s) of the RefPoint parameters above are not acceptedCheersMichel

Share this post


Link to post
Share on other sites

Oeps :), I'd better stay awake while reading your post, I missed a part of it :D.Strange, as far as I can see now the RefPoint command is OK, I don't see any missing parameters. Are you sure FreeSC also supports the d option for calculating displacements?When I am at home tonight I will have a look at the source I have made using these commands, to see if I can find a difference.Arno


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

Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest Claviateur

Sure no problem I will wait if you wish to try the code :) As a matter of fact I am new to hand coding so I do not know if FreeSC supports that but I am trying to see if the FreeSC help speaks about it somehowThanks arno :)Michel

Share this post


Link to post
Share on other sites

I had a look and my RefPoints look the same (same number of parameters, I only also had the E= 0, but that is because I used abs and not rel as RefPoint type).I also tried to compile my sca file with FreeSC, but then I got a lot of parse errors, you I didn't get the the actual compiling. But I think FreeSC doesn't support this type of RefPoint then.Arno


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

Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest Claviateur

Hi Arno,Thanks for the test, I will ask the FreeSC developer about it and see if there is a way to apply this technique to FreeSC. Actually I could have compiled the whole thing with Scasm but Architect2002 has many objects in it that are done to be compiled with FreeSC so I will see how I can make a compromize between bothCheers!Michel

Share this post


Link to post
Share on other sites
Guest luissa

Hi Michel,The problem here is that FSC does not support "d delta_north delta_east" shifts with regard to a GRP - general RefPoint. So either you compile that file with SCASM or you use this new one. I am plenty confident that FSC compiles it (but I did not test it). Kind Regards,LuisArea( b 33:49:2.241296 35:29:23.355961 20 );in the following 2 lines paste in your original latitude and longitudeUvar( $Lat0 33:49:2.241296 )Uvar( $Lon0 35:29:23.355961 );then your ScaleUvar( $Scale 0.304800 );now the latitude and longitude where you want to place your RefPoint();in the present case shifted 30 seconds to the East and same latitudeUvar( $Lat1 33:49:2.241296 )Uvar( $Lon1 35:28:53.355961 );now evalute the shift in delta_unitsUvar( $DX [111120 / $Scale * cos($Lat1) * [$Lon1 - $Lon0] ] )Uvar( $DY [111120 / $Scale * [$Lat1 - $Lat0] ] );finally the modified RefPoint() and the reposition TransformCall()RefPoint( rel :TagPhotoGrid [$Scale] [$Lat1] [$Lon1] v1= 37040 v2= 5797 )TransformCall( :rot [$DX] 0 [$DY] 0 0 0 0 0 0 )Jump( : ):rotLoadBitmap( 0 128 0 0 0 0 olba0000.bmp )Points( 0; the rest unchanged

Share this post


Link to post
Share on other sites
Guest Claviateur

Hi Luis :)Thanks so much, I really apreciate your help. I will try this code with FreeSC :)CheersMichel

Share this post


Link to post
Share on other sites
Guest Claviateur

Hi Luis,I got some parse errors when I tried to compile with FreeSC. Do I have to change the <> to square brakets? I noticed that there are square braquets in the code along with <> so I do not know if I have to modify or keep them? I got the parse errors in the following lines:Uvar( $DX <111120 / $Scale etc...Uvar( $DY <111120 / $Scale etc...RefPoint( rel :TagPhotoGrid etc...TransformCall etc...Cheers!Michel

Share this post


Link to post
Share on other sites
Guest luissa

Michel,Yes. I can not write square brackets in these forum pages. It has to do with html tags.Regards,Luis

Share this post


Link to post
Share on other sites
Guest Claviateur

Hi Luis,Thanks for your continuous help, I changed all <> to square braquets and the good news is that the code compiles without errors :)I went to FS to see the result and here I attach a screenshot showing what I got. The photogrid is moved to the shifted coord I entered as you requested but it was not brought back to its original place by the tansformcall.Here I paste the code that compiled ok (<> are square braquets indeed);Textured Grid: TestArea( b 33:49:2.241296 35:29:23.355961 20 ) ;in the following 2 lines paste in your original latitude and longitudeUvar( $Lat0 33:49:2.241296 )Uvar( $Lon0 35:29:23.355961 ) ;then your ScaleUvar( $Scale 0.304800 ) ;now the latitude and longitude where you want to place your RefPoint();in the present case shifted 30 seconds to the East and same latitude;Here I entered my shifted refpoint coordUvar( $Lat1 33:49:2.241296 )Uvar( $Lon1 35:26:53.146721 ) ;now evalute the shift in delta_unitsUvar( $DX [111120 / $Scale * cos($Lat1) * [$Lon1 - $Lon0] ] )Uvar( $DY [111120 / $Scale * [$Lat1 - $Lat0] ] ) ;finally the modified RefPoint() and the reposition TransformCall()RefPoint( rel :TagPhotoGrid [$Scale] [$Lat1] [$Lon1] v1= 37040 v2= 5797 )TransformCall( :rot [$DX] 0 [$DY] 0 0 0 0 0 0 ) Jump( : ):rot LoadBitmap( 0 128 0 0 0 0 olba0000.bmp ) Points( 0 -6340 0 -9510 etc...Cheers!Michel

Share this post


Link to post
Share on other sites
Guest luissa

Hi,>Thanks for your continuous help, I changed all <> to square >braquets and the good news is that the code compiles without >errors :) I am as happy as you are ...>I went to FS to see the result and here I attach a >screenshot showing what I got. The photogrid is moved to the >shifted coord I entered as you requested but it was not >brought back to its original place by the tansformcall. I am sorry! It seems I made a mistake! I think the TransformCall() is shifting the polygons in the wrong direction. Please edit the following line (longitude0 - longitude1). $DX will be positive and will move the polys to the East.>Uvar( $DX [111120 / $Scale * cos($Lat1) * [$Lon0 - $Lon1] ] >) Looking to your screenshot, I think you moved the polys more than needed. As Arno noted, you may have V2= problems. Please see my comment in my initial post.Regards,Luis

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