Hi Arno,
I understand. You assume APIs where the standard was indeed as follows:
Code:
; %1 Latitude
; %2 Longitude
; %3 Range
; %4 Scale
; %5 Heading
; %6 User
; %7 User
; %8 User
; %9 Shadow
; %10 V1 value
; %11 Elevation
; %12 Scenery complexity
For ASD macros one could freely choose the macro parameters as in this example:
Code:
;ASDesign Compatible Macro
;Name=Fence_green, Type=General Objects, Bitmap=fence_green.jpg, \
;Latitude, Longitude, Range=30, \
;Density=2, Visibility=10000, Elevation=0, Rotation=0, \
;Scale=1, Width=2, Height=2, Length=20, Texture=fence_green.bmp, \
; Fence using selectable texture
; Author: Luis Vieira de Sa
; Texture: Luis Feliz-Tirado
;
; Macro Parameters:
; 1 = latitude
; 2 = longitude
; 3 = range
; 4 = scenery complexity ( 0 ... 5 )
; 5 = visibility (in meters)
; 6 = elevation
; 7 = rotation
; 8 = scale
; 9 = width (not used, except for footprint)
; 10 = height
; 11 = length
; 12 = texture
UVar( $V2 int[%11] )
UVar( $H0 0 ) ; ground
UVar( $H1 %10 ) ; height
UVar( $WN [ -0.5 * %11 ] ) ; negative
UVar( $WP [ 0.5 * %11 ] ) ; positive
; each section of the fence will have a 2:1 ratio (width:height)
Uvar( $Tiling int[ (%11 / %10 / 2) + 0.5 ] )
; now form the Texture Mapping value
UVar( $T [$Tiling] )
; add 5 pixels to repeat the post at the right end
UVar( $T [$T + (5 / 256)] )
Area( 5 %1 %2 %3 )
IfVarRange( : 346 %4 5 )
PerspectiveCall( :pcall )
Jump( : )
:pcall
mif( %6 )
RefPoint( abs :return %8 %1 %2 v1= %5 E= %6 v2= [$V2] )
melse
RefPoint( rel :return %8 %1 %2 v1= %5 v2= [$V2] )
mifend
RotatedCall( :start 0 0 [%7 + 90] )
:return
Return
:start
BGLVersion( 0800 )
TextureList( 0
6 FF 255 255 255 0 50.0 "%12"
)
MaterialList( 0
0.75 0.75 0.75 1.00 0.25 0.25 0.25 1.00 0 0 0 1.00 0 0 0 1.00 0 )
VertexList( 0
[$WN] [$H1] 0 0 0 -1 0 1
[$WN] [$H0] 0 0 0 -1 0 0
[$WP] [$H0] 0 0 0 -1 [$T] 0
[$WP] [$H1] 0 0 0 -1 [$T] 1
[$WP] [$H1] 0 0 0 1 [$T] 1
[$WP] [$H0] 0 0 0 1 [$T] 0
[$WN] [$H0] 0 0 0 1 0 0
[$WN] [$H1] 0 0 0 1 0 1
)
SetMaterial( 0 0 )
DrawTriList( 0
0 1 2
0 2 3
4 5 6
4 6 7
)
EndVersion
Return
EndA
If you look to the VertexList you see a reference to [$WN] which in turn depends on parameter %11 through
Code:
UVar( $WN [ -0.5 * %11 ] ) ; negative
If a user wants to convert the macro into a FSX Library Object the best way would be to place it and decompile it back in order to get a clean input (without variables) to your ModelConverter.
You say: "To be able to do the placement in the same ASM you would even have to use the FS2002 MakeMDL".
I never used MakeMDL so excuse me if ask something that may be obvious, but MakeMDL also takes ASM files as input? I thought it could be only used from inside gmax or in a command line to compile a x file.
In my question on the previous post I was attempting to place an object without going through the "MDL phase". I will rephrase my concern hoping that you (or someone else) can give me a tip or say a definitive "no way to achieve". I agree that that the "FSX way" to put objects in the sim is to get a MDL and than use FSX's BGLComp for placing it. However this is, in certain way, a limitation. In fact I can only customize the "placement". I can customize lat, lon, alt, pitch, bank, heading, complexity, scale and AGL (I think I did not miss any parameter). The model, the MDL, is fixed. As per the example code above you will guess that I am looking for ways to produce fences. If we take a fence section in its simpler form we can think of 4 parameters: length, height, texture and heading. Only the last one is customizable as it is fixed in the XML placement file. The first 3 parameters are coded in the MDL. I could have a set of MDLs with different textures and solve the problem for that particular parameter. Same for height. With difficulty I can have several MDLs for all the possible lengths.
On the contrary if I have the fence in ASM format, I can have variables for length, height and texture. Before compiling I would just need to fill these variables with the desirable values.
As far as I read in this site BGLC_9.EXE will take an ASM and can produce a BGL or a MDL. I assume by adding "placement BGL codes" into the ASM before compiling it with BGLC_9.EXE like the ones I found in the house.asm example from the FS8 SDK
Code:
; DATABASE HEADER *******************************************
DATABASE_HEADER:
dw 0001 ; 00 World set number
dd 0004FB2EAH ; 02 North bound (N 47 00' 0.3203'')
dd 0004FB2D6H ; 06 South bound (N 46 59' 59.6725'')
dd 0EFA4FA50H ; 10 East bound (W 22 59' 59.9998'')
dd 0EFA4FA4EH ; 14 West bound (W 23 00' 0.0004'')
dd 0 ; 18 VOR DATA pointer
dw 0 ; 22 Lowest VOR channel (108.00 MHz)
dw 0 ; 24 Highest VOR channel (108.00 MHz)
dd 0 ; 26 Seed level 8 pointer
dd 0 ; 30 Seed level 9 pointer
dd 0 ; 34 Seed level 10 pointer
dd 0 ; 38 Seed level 11 pointer
dd 0 ; 42 Seed level 12 pointer
dd 0 ; 46 Seed level 13 pointer
dd 0 ; 50 Seed level 14 pointer
dd 0 ; 54 Seed level 15 pointer
dd (offset OBJECT_DATA) - (offset DATABASE_HEADER) ; 58 OBJECT DATA pointer
dd 0 ; 62 LIBRARY DATA pointer
dd 0 ; 66 FACILITY DATA pointer
dd 0 ; 70 Old Anchor Point
dd 0 ; 74 COM RADIO DATA pointer
dd 0 ; 78 ADF RADIO DATA pointer
dd 0 ; 82 DYNAMIC OBJECT DATA pointer
dw 0 ; 86 Library minimum 1
dw 0 ; 88 Library minimum 2
dw 0 ; 90 Library minimum 3
dw 0 ; 92 Library minimum 4
dw 0 ; 94 Library maximum 1
dw 0 ; 96 Library maximum 2
dw 0 ; 98 Library maximum 3
dw 0 ; 100 Library maximum 4
dd 0 ; 102 (0x66) MISCELANEOUS DATA pointer
dd 0 ; 106 (0x6A) TITLE & DESC. DATA pointer
dd 0 ; 110 (0x6E) MAG. VAR. DATA pointer
dd 0 ; 114 (0x72) EXCEPTION DATA pointer
dd 000000000h ; 118 (0x76) Magic Number
dd 000000000h ; 122 (0x7A) Spare2 (32 bits)
dw 0000h ; 126 (0x7E) Spare3 (16 bits)
; OBJECT DATA *********************************************** 00000080
OBJECT_DATA:
LATBAND_START
LATBAND_REL 027D9H,027DAH,OBJ_00008A ; N 46 59 53 N 47 00 09
LATBAND_END
OBJ_00008A:
; OBJECT_1 Object Start = 0000008AH, Size = 00001852H, End = 000018DCH
NEAR_FAR_HUGE_OBJECT_HEADER 0004FB2E0H, 0EFA4FA4FH, Object_1_End
IFIN1 Label_Obj_1_32, image_complex, 2, 32767
ADDOBJ Label_Obj_1_38 ;(offset 14)
SHADOW_CALL Label_Obj_1_38
Label_Obj_1_32: ;(0x000000aa)
BGL_JUMP_32 Object_1_End
Label_Obj_1_38: ;(0x000000b0)
SCALE_AGL Label_Obj_1_80, 10000, 11, 131072, 0004FB2E0H, 7282, 0EFA4FA4FH, -23302, 0, 0 ; (N 46 59 60 W 23 00 00)
INSTANCE_CALL Label_Obj_1_82, 00000h, 00000h, 0471ch
........................ etc ..........
the BGL that I will end up can be directly usable. Or not?
If I want to follow the "FSX way to do things" and noting that I want to start with a line in SBuilderX and end up with a fence, I would need to create a MDL for each fence section giving the points, the texture that I set through the SBuilderX interface. I do not know of such a tool. That the reason way I am trying to explore the possibility of using BGLC_9/ASM.
Sorry for this long post (and, may be, for being out of topic).
Best Regards,
Luis
EDITED AFTER SOME EXPERIMENTATION: I completely mixed things. The placement that I was referring to is FS8!!! So I really need to created a MDL and then use XML placement! And I said " ...I do not know of such a tool". The tool is clearly BGLC_9. I compiled my ASD macro and then I dissambled it with BGL_Analyse getting a SCA file. ModelConverterX imported that SCA. I exported and got the ASM. Now what I have to do when I need to compile is fill that basic ASM with the data that I need and then BGLC_9 followed by BGLComp.