Help New export Ase To B3D

Blitz3D Forums/Blitz3D Programming/Help New export Ase To B3D

DareDevil(Posted 2006) [#1]
pleace HELP! HEEELLPP!!!

i have a create this exporter, have a problem for load object, MAV and crash the program.... what is?

I have verified the program with dump.bb the return no problem :(

Help!!!

Thanks all




;=====================================================================
;----------------------------------------------------------------
; Vincenzo Caldarulo
; nickname : VinsentX
; e-mail: enzo_light@...
; main Programmer V&D Software Multimedia
;----------------------------------------------------------------
;=====================================================================
;****************************
;-------------------------
; 3DMax Ase export to B3D
; Support Converter:
;
; - Default Map
; - Light Map
; - Reflect Map
; - Bump (Dot3)
;-------------------------
;****************************
;
Const Ver# = 2.00
Const Max_Vertex% = 65000
;===>

;=======================================
;---------------------------------------
; Costanti texture
;---------------------------------------
;=======================================
Const tex_color = 1 ; Color texture
Const tex_alpha = 2 ; Alpha texture (Include alpha channel data)
Const tex_mask = 4 ; Masked texture (black is transparent)
Const tex_mipmap = 8 ; Create texture mipmaps
Const tex_clampu = 16 ; Restrict U texture coords from "bleeding over"
Const tex_clampv = 32 ; Restrict V texture coords from "bleeding over"
Const tex_envshpere = 64 ; Load texture as a spherical environment map
Const tex_void = 128 ; <void>
Const tex_vram = 256 ; Force texture graphics to vram
Const tex_highcolor = 512 ; Forces texture graphics to be 32-bits per pixel

Const blend_Alp = 1 ; non miscelare oppure Alpha (alpha quando usato con il flag Alpha - non raccomandato nel multitexturing - vedi sotto)
Const blend_Mul = 2 ; Moltiplicazione (Default)
Const blend_Add = 3 ; Additivo
Const blend_Dot = 4 ; Dot-3


;=======================================
;---------------------------------------
; Strutture di dati
;---------------------------------------
;=======================================
;===>
Type RGBA
Field R# ;
Field G# ;
Field B# ;
Field A# ;
End Type
;===>
Type Vector
Field X# ;
Field Y# ;
Field Z# ;
End Type
;===>
Type Face
Field A% ;
Field B% ;
Field C% ;
End Type
;===>
Type UV
Field U# ;
Field V# ;
Field W# ;
End Type
;===>
Type Material
Field Nome$ ;
Field Col.RGBA ;
Field Shines# ;
;
Field OnDifu% ; Variabile di verifica presenza materiale
Field Difuse$ ; Nome texture
Field D_UV_OffsetX ; Texture Offset X
Field D_UV_OffsetY ; Y
Field D_UV_TilingX ; Texture Tiling X
Field D_UV_TilingY ; Y
;
Field OnSelf% ; Variabile di verifica presenza materiale
Field SelfI$ ;
Field S_UV_OffsetX ; Texture Offset X
Field S_UV_OffsetY ; Y
Field S_UV_TilingX ; Texture Tiling X
Field S_UV_TilingY ; Y
;
Field OnEnvi% ; Variabile di verifica presenza materiale
Field Enviroment$ ;
Field E_UV_OffsetX ; Texture Offset X
Field E_UV_OffsetY ; Y
Field E_UV_TilingX ; Texture Tiling X
Field E_UV_TilingY ; Y
;
Field OnBump% ; Variabile di verifica presenza materiale
Field Bump$ ;
Field B_UV_OffsetX ; Texture Offset X
Field B_UV_OffsetY ; Y
Field B_UV_TilingX ; Texture Tiling X
Field B_UV_TilingY ; Y
End Type
;===>
Type Obj
;
Field IdMaterial% ;
;
Field NVertex ;
Field CntVertex ;
Field VertexList.Vector ;
;
Field NFace ;
Field CntFace ;
Field FaceList.Face ;
;
Field Normal.Vector ;
;
Field CH1_NVertex ;
Field CH1_VList.UV ;
Field CH1_NFace ;
Field CH1_FList.Face ;
;
Field CH2_NVertex ;
Field CH2_VList.UV ;
Field CH2_NFace ;
Field CH2_FList.Face ;
;
End Type

Type Mesh
;
Field Nome$ ;
;
Field Nobj% ;
Field CNTObj% ;
Field Oggetto.Obj ;
;
Field NMaterial% ;
Field CNTMaterial% ;
Field Materiali.Material;
;
End Type

Type FB3D
Field vx#, vy#, vz# ;
Field nx#, ny#, nz# ;
Field r#, g#, b#, a# ;
Field u1#, v1#, w1# ;
Field u2#, v2#, w2# ;
End Type


;=======================================
;---------------------------------------
; Variabili Principali
;---------------------------------------
;=======================================
;===>
Global AseObj.Mesh = New Mesh
Global FileLog
Global ObjExp
Dim VertB3D.FB3D(Max_Vertex)

;===>
AppTitle ("V&D Software - Export file 3DSMAX Ase to B3D - Version "+Ver#)

Include "b3dfile.bb"

Graphics3D 800,600,32,2

;===>
Const Simb1 = 32 ; 32 = ASC(" ")
Const Simb2 = 125; 125 = ASC("}")

;===>
Flag$ = Input$( "Texture in VRam? (s/N)" )
If (Lower(Flag$)="s") TexFlag = TexFlag + tex_vram Else TexFlag = TexFlag + 0
;===>
Flag$ = Input$( "MipMapping? (s/N)" )
If (Lower(Flag$)="s") TexFlag = TexFlag + tex_mipmap Else TexFlag = TexFlag + 0
;===>
Flag$ = Input$( "HightColor? (s/N)" )
If (Lower(Flag$)="s") TexFlag = TexFlag + tex_highcolor Else TexFlag = TexFlag + 0
;===>
Cls
Text 0,00,"V&D Software - Ver."+Ver +" - Inizio esportazione"
Text 0,30,"Conversione in corso......"
Text 0,60,"Importazione File ASE ......"

;Flip

Global time1 = MilliSecs()
;Stop
LogDebug("Open")
Convert_Ase_B3d("Obj\Obj.ASE","Obj\Obj.B3D")
LogDebug();close file log

Global time2 = MilliSecs()

;;cool dragon model!
;dragon=LoadMesh( "imp.x" )
;EntityFX dragon,1
;PositionMesh dragon,0,0,0
;dragonbump = LoadTexture("imp_dot3.png")
;TextureBlend dragonbump,4
;;ScaleTexture dragonbump,.25,.25
;dragonskin = LoadTexture("imp_d.png")
;TextureBlend dragonskin,2
;EntityTexture dragon,dragonbump,0,1
;EntityTexture dragon,dragonskin,0,2

;Global ObjExp = dragon

;=====================================================================
;=====================================================================
; -------------------------------
; Creation de la caméra
; -------------------------------
Global Mouse_X_Speed#, Mouse_Y_Speed#
Global Camera
Global Camera_VelX#, Camera_VelZ#
Global Camera_Pitch#, Camera_Yaw#

Global Cam_spx# = 3.682*100
Global Cam_spy# = -6.992*100
Global Cam_spz# = 2.663*100
Global Cam_srx# = 73.275
Global Cam_sry# = 2.499
Global Cam_srz# = 27.786
Global Cam_fov# = Sqr(50)

Camera=CreateCamera()
RotateEntity camera,0,0,0
;PositionEntity camera,290,-600,2380 ; da inc a metri x100
PositionEntity camera,0,0,0 ; da inc a metri x100
CameraRange camera,0.1,10000
;formula del fov camera Zoom =Sqrt(Fov)
;CameraZoom camera, sqr(50) ; 1 = 10 di fov // 7.5 = 50 di fov
CameraZoom camera, 1 ; 1 = 10 di fov // 7.5 = 50 di fov
; -------------------------------
; Chargement de l'objet
; -------------------------------
Stop
ObjExp=LoadMesh( "obj\Obj.b3d" )
;ObjExp=LoadAnimMesh( "Obj.b3d" )
;Animate ObjExp, 1
RotateEntity ObjExp,0,0,0
PositionEntity ObjExp,0,0,0
EntityShininess ObjExp,1
PointEntity Camera,ObjExp

temp = CreateSphere(8)
EntityAlpha temp,0.5
Dither True

;===>
LightCA = 128
LightDOT3=(256-LightCA)/2
AmbientLight LightCA, LightCA, LightCA
;===>
;pivot=CreatePivot()
;mylight = CreateSphere(2)
;light=CreateLight(1,mylight)
;LightRange light,200
;===>
font=LoadFont( "Arial",20 )
SetFont font
;===>
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
;rotateentity camera,-2.7,178,180
SetBuffer BackBuffer()

While KeyDown(1)=0

;mylight
; Dist#=32
; rot#=rot#+0.1
; xrot#=Cos(rot)*Dist
; zrot#=Sin(rot)*Dist
; yrot#=Cos(rot/4)*Dist
; PointEntity mylight,ObjExp
; PositionEntity mylight,EntityX(ObjExp)+xrot,1.5+yrot,EntityZ(ObjExp)+zrot
;
; PositionEntity pivot, 0, 0, 0
; RotateEntity pivot,-EntityPitch(mylight),EntityYaw(mylight)+180,0
; MoveEntity pivot, 0, 0, 1
; r#=(EntityX(Pivot)+1.0) * 128
; g#=(EntityZ(Pivot)+1.0) * 128
; b#=(EntityY(Pivot)+1.0) * 128
; EntityColor ObjExp,r,g,b





; if keyhit(47) then ; 47 = "V"
; PositionEntity camera,Cam_spx#,Cam_spy#,Cam_spz# ; da inc a metri x100
; rotateentity camera,Cam_srx#,Cam_sry#,Cam_srz#
; CameraZoom camera, Cam_fov#
; end if
Procedure_Freelook(1.05,0.2)
UpdateWorld()
RenderWorld()
time_dif = time2-time1
Text 0,0,"V&D Software - Ver."+Ver +" - Esportazione avvenuta con successo"
Text 0,15,"px:"+EntityX(Camera)+"py:"+EntityY(Camera)+"pz:"+EntityZ(Camera)
Text 0,30,"rx:"+EntityPitch(Camera)+"ry:"+EntityYaw(Camera)+"rz:"+EntityRoll(Camera)
Text 0,45,"Time to export"
Text 0,60,"Millisecs "+time_dif+" secs "+(time_dif/1000)
tris = TrisRendered()
Text 0,75,"Triangoli renderiz.:"+tris

Text 0,105,"R : "+r#
Text 0,120,"G : "+g#
Text 0,135,"B : "+b#

Flip
Wend

End
;===============================
; -------------------------
; Fonction Freelook
; -------------------------
Function Procedure_Freelook(Velocity#,Speed#)
AngMax = 89
Mouse_X_Speed=MouseXSpeed()*0.5
Mouse_Y_Speed=MouseYSpeed()*0.5

MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
Camera_Pitch=Camera_Pitch+Mouse_Y_Speed
Camera_Yaw=Camera_Yaw-Mouse_X_Speed

If Camera_Pitch<-AngMax Then Camera_Pitch=-AngMax
If Camera_Pitch>AngMax Then Camera_Pitch=AngMax

RotateEntity camera,Camera_Pitch,Camera_Yaw,0

If KeyDown(Key_ArrowPad_Left) Camera_VelX=Camera_VelX-Speed# ElseIf KeyDown(Key_ArrowPad_Right) Camera_VelX=Camera_VelX+Speed#
; If KeyDown(Key_ArrowPad_Down) Camera_VelZ=Camera_VelZ-Speed# ElseIf KeyDown(Key_ArrowPad_Up) Camera_VelZ=Camera_VelZ+Speed#
If MouseDown(2) Camera_VelZ=Camera_VelZ-Speed# ElseIf MouseDown(1) Camera_VelZ=Camera_VelZ+Speed#

Camera_VelX=Camera_VelX/Velocity#
Camera_VelZ=Camera_VelZ/Velocity#
MoveEntity camera,Camera_VelX,0,Camera_VelZ
End Function
;===============================
;---------------------------
; Scrittura stringa
;---------------------------
Function ReadStringN$(f,sep$)
s$ = "";
SepVal = Asc(sep$)

While Not Eof(f)
let = ReadByte(f);

If (let = SepVal And s$ <> "")
Return s
Else
If ((let >= Simb1) And (let <= Simb2) And (let <> SepVal) And (let <> 34)); the code 34 = " from ascii table
s$ = s$ + Chr(let)
Else
If (s$ <> "") Return s
End If
End If
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function EstractName$(str_nome$)
s$ = ""
lun = Len(str_nome)
;===>
For xc = lun To 1 Step -1
s$ = Mid(str_nome,xc,1)
If ((s$ = "\") Or (xc=1))
s$ = Mid(str_nome,xc+1,lun-xc);
Exit
End If
Next
;===>
Return s$
;===>
End Function
;==============================
;---------------------------
; Scrittura stringa
;---------------------------
Function Convert_Ase_B3d(LoadFile$,SaveFile$)
;===>
infile = OpenFile(LoadFile$)
While Not Eof(infile)
LoadAse(infile)
Wend
CloseFile infile
;===>
;Stop
OutFile = WriteFile(SaveFile$)
If Not OutFile RuntimeError "Apertura file in scrittura fallita!!"
WriteBB3D(OutFile)
CloseFile OutFile
;===>
End Function
;==============================
;---------------------------
; Scrittura stringa
;---------------------------
Function LoadAse(ASE)
OpenP = 0
S$=""
I%=0
F#=0
Ogg%=0

While Not Eof(ASE)
chunk$ = ReadStringN(ASE," ")
;===>
If (chunk$ = "*GEOMOBJECT") Then
;stop
While Not Eof(ASE)
cluster$ = ReadStringN(ASE," ")
;Stop
;===>
If (cluster$ = "{")
OpenP = OpenP+1
End If
;===>
If (cluster$ = "}") Then
OpenP = OpenP-1
End If
;===>
If (OpenP <= 0)
If (XYZ_Count_vertex>2)
Return 2
Else
Return 0
End If
End If
;===>
If (cluster$ = "*NODE_NAME") Then
;Stop
S$ = ReadStringN(ASE," ")
AseObj\nome = s$
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite("Nome oggetto : " + AseObj\nome)
Text 0,120,"Importo "+(Ogg/2)+" Materiali"
End If
;===>
If (cluster$ = "*TM_POS") Then
End If
;===>
If (cluster$ = "*TM_ROTAXIS") Then
End If
;===>
If (cluster$ = "*TM_ROTANGLE") Then
End If
;===>
If (cluster$ = "*TM_SCALE") Then
End If
;===>
If cluster$ = "*MATERIAL_REF" Then
I% = ReadStringN(ASE," ")
AseObj\Oggetto\IdMaterial% = I%
End If
;===>
If (cluster$ = "*MESH") Then
AseObj\Oggetto.obj = New obj
While Not Eof(ASE)
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="}") Exit
;===>
If (cluster1$ = "*MESH_NUMVERTEX") Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\NVertex = I
LogWrite("Numero di Vertici : " + AseObj\Oggetto\NVertex)
End If
;===>
If (cluster1$ = "*MESH_NUMFACES") Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\NFace = I
LogWrite("Numero di Face : " + AseObj\Oggetto\NFace)
End If
;===>
If (cluster1$ = "*MESH_VERTEX_LIST") Then
;Stop
MESH_VERTEX_LIST(ASE)
End If
;===>
If (cluster1$ = "*MESH_FACE_LIST") Then
;Stop
MESH_FACE_LIST(ASE)
End If
;===>
If cluster1$ = "*MESH_NUMTVERTEX" Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\CH1_NVertex = I
LogWrite("")
LogWrite("Numero di Vertici UV CH_1: " + AseObj\Oggetto\CH1_NVertex)
End If
;===>
If cluster1$ = "*MESH_TVERTLIST" Then
;Stop
MESH_TVERTLIST(ASE)
End If
;===>
If cluster1$ = "*MESH_NUMTVFACES" Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\CH1_NFace = I
LogWrite("")
LogWrite("Numero di Facce UV CH_1: " + AseObj\Oggetto\CH1_NFace)
End If
;===>
If cluster1$ = "*MESH_TFACELIST" Then
;Stop
MESH_TFACELIST(ASE)
End If
;===>
; Lettura UV Channel 2
If cluster1$ = "*MESH_MAPPINGCHANNEL" Then
While Not Eof(ASE)
chunk1$ = ReadStringN(ASE," ")
;===>
If (chunk1$="}") Exit
;===>
If chunk1$ = "*MESH_NUMTVERTEX" Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\CH2_NVertex = I
LogWrite("")
LogWrite("Numero di Vertici UV CH_2: " + AseObj\Oggetto\CH2_NVertex)
End If
;===>
If chunk1$ = "*MESH_TVERTLIST" Then
;Stop
MESH_TVERTLIST1(ASE)
End If
;===>
If chunk1$ = "*MESH_NUMTVFACES" Then
;Stop
I% = ReadStringN(ASE," ")
AseObj\Oggetto\CH2_NFace = I
LogWrite("")
LogWrite("Numero di Facce UV CH_2: " + AseObj\Oggetto\CH2_NFace)
End If
;===>
If chunk1$ = "*MESH_TFACELIST" Then
;Stop
MESH_TFACELIST1(ASE)
End If
;===>
Wend
End If
;===>
If (cluster1$ = "*MESH_NORMALS") Then
;Stop
MESH_NORMALS(ASE)
End If
;===>
Wend
End If
;===>
Wend
End If
;===>
; Chunck *MATERIAL_LIST
If chunk$ = "*MATERIAL_LIST" Then
OpenP = 0
While Not Eof(ASE)
cluster$ = ReadStringN(ASE," ")
;===>
If (cluster$ = "{")
OpenP = OpenP+1
End If
If (cluster$ = "}") Then
OpenP = OpenP-1
End If
If (OpenP <= 0)
If (MAT_Count=>0)
Return 1
Else
Return 0
End If
End If
;===>
If (cluster$ = "*MATERIAL_COUNT") Then
cnt = ReadStringN(ASE," ")
AseObj\NMaterial = cnt
LogWrite("")
LogWrite("Numero di Materiali: " + AseObj\NMaterial)
Text 0,90,"Importo "+AseObj\NMaterial+" Materiali"
End If
;===>
; Inizializza il materiale
If (cluster$ = "*MATERIAL") Then
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
Id_mat = ReadStringN(ASE," ")
AseObj\Materiali.Material = New Material
AseObj\Materiali\Col.RGBA = New RGBA
;===>
End If
;===>
If (cluster$ = "*MATERIAL_NAME") Then
a$ = ReadStringN(ASE," ")
AseObj\Materiali\nome$ = a$
LogWrite("")
LogWrite("Materiale: " + AseObj\Materiali\nome)
End If
;===>
If (cluster$ = "*MATERIAL_DIFFUSE") Then
; If (cluster$ = "*MATERIAL_AMBIENT") Then
;===>
R# = ReadStringN(ASE," ")
G# = ReadStringN(ASE," ")
B# = ReadStringN(ASE," ")
;===>
AseObj\Materiali\Col\R# = R#
AseObj\Materiali\Col\G# = G#
AseObj\Materiali\Col\B# = B#
LogWrite("R: " + AseObj\Materiali\Col\R# + " G: " + AseObj\Materiali\Col\G# + " B: " + AseObj\Materiali\Col\B# )
;===>
End If
;===>
If (cluster$ = "*MATERIAL_SHINE") Then
F# = ReadStringN(ASE," ")
AseObj\Materiali\Shines# = F#
End If
;===>
If (cluster$ = "*MATERIAL_TRANSPARENCY") Then
;===>
F# = ReadStringN(ASE," ")
AseObj\Materiali\Col\A# = 1.0-F#
LogWrite("Numero di Vertex : " + AseObj\Materiali\Col\A#)
;===>
End If
;********************************************
;==========================
;
;===>
If (cluster$ = "*MAP_DIFFUSE") Then
;===>
While Not Eof(ASE)
;===>
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="}") Exit
;===>
If (cluster1$="*BITMAP")
name$ = ReadStringN(ASE,"")
AseObj\Materiali\Difuse$ = EstractName$(name$);
LogWrite("Numero di Vertex : " + AseObj\Materiali\Difuse$)
End If
;===>
If (cluster1$="*UVW_U_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\D_UV_OffsetX = F#
LogWrite("U_OFFSET : " + AseObj\Materiali\D_UV_OffsetX)
End If
;===>
If (cluster1$="*UVW_V_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\D_UV_OffsetY = F#
LogWrite("V_OFFSET : " + AseObj\Materiali\D_UV_OffsetY)
End If
;===>
If (cluster1$="*UVW_U_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\D_UV_TilingX = F#
LogWrite("U_TILING : " + AseObj\Materiali\D_UV_TilingX)
End If
;===>
If (cluster1$="*UVW_V_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\D_UV_TilingY = F#
LogWrite("V_TILING : " + AseObj\Materiali\D_UV_TilingY)
End If
;===>
Wend
End If
;********************************************
;==========================
;
;===>
If (cluster$ = "*MAP_SELFILLUM") Then
;===>
While Not Eof(ASE)
;===>
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="}") Exit
;===>
If (cluster1$="*BITMAP")
name$ = ReadStringN(ASE,"")
AseObj\Materiali\SelfI$ = EstractName$(name$);
LogWrite("Numero di Vertex : " + AseObj\Materiali\SelfI$)
End If
;===>
If (cluster1$="*UVW_U_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\S_UV_OffsetX = F#
LogWrite("U_OFFSET : " + AseObj\Materiali\S_UV_OffsetX)
End If
;===>
If (cluster1$="*UVW_V_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\S_UV_OffsetY = F#
LogWrite("V_OFFSET : " + AseObj\Materiali\S_UV_OffsetY)
End If
;===>
If (cluster1$="*UVW_U_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\S_UV_TilingX = F#
LogWrite("U_TILING : " + AseObj\Materiali\S_UV_TilingX)
End If
;===>
If (cluster1$="*UVW_V_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\S_UV_TilingY = F#
LogWrite("V_TILING : " + AseObj\Materiali\S_UV_TilingY)
End If
;===>
Wend
End If
;===>
;********************************************
;==========================
;
;===>
If (cluster$ = "*MAP_BUMP") Then
;===>
While Not Eof(ASE)
;===>
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="}") Exit
;===>
If (cluster1$="*BITMAP")
name$ = ReadStringN(ASE,"")
AseObj\Materiali\Bump$ = EstractName$(name$);
LogWrite("Numero di Vertex : " + AseObj\Materiali\Bump$)
End If
;===>
If (cluster1$="*UVW_U_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\B_UV_OffsetX = F#
LogWrite("U_OFFSET : " + AseObj\Materiali\B_UV_OffsetX)
End If
;===>
If (cluster1$="*UVW_V_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\B_UV_OffsetY = F#
LogWrite("V_OFFSET : " + AseObj\Materiali\B_UV_OffsetY)
End If
;===>
If (cluster1$="*UVW_U_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\B_UV_TilingX = F#
LogWrite("U_TILING : " + AseObj\Materiali\B_UV_TilingX)
End If
;===>
If (cluster1$="*UVW_V_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\B_UV_TilingY = F#
LogWrite("V_TILING : " + AseObj\Materiali\B_UV_TilingY)
End If
;===>
Wend
End If
;===>
;********************************************
;==========================
;
;===>
If (cluster$ = "*MAP_Env") Then
;===>
While Not Eof(ASE)
;===>
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="}") Exit
;===>
If (cluster1$="*BITMAP")
name$ = ReadStringN(ASE,"")
AseObj\Materiali\Enviroment$ = EstractName$(name$);
LogWrite("Numero di Vertex : " + AseObj\Materiali\Enviroment$)
End If
;===>
If (cluster1$="*UVW_U_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\E_UV_OffsetX = F#
LogWrite("U_OFFSET : " + AseObj\Materiali\E_UV_OffsetX)
End If
;===>
If (cluster1$="*UVW_V_OFFSET")
F# = ReadStringN(ASE,"");
AseObj\Materiali\E_UV_OffsetY = F#
LogWrite("V_OFFSET : " + AseObj\Materiali\E_UV_OffsetY)
End If
;===>
If (cluster1$="*UVW_U_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\E_UV_TilingX = F#
LogWrite("U_TILING : " + AseObj\Materiali\E_UV_TilingX)
End If
;===>
If (cluster1$="*UVW_V_TILING")
F# = ReadStringN(ASE,"");
AseObj\Materiali\E_UV_TilingY = F#
LogWrite("V_TILING : " + AseObj\Materiali\E_UV_TilingY)
End If
;===>
Wend
End If
;===>
Wend
End If

Wend

End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_NORMALS(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Poligon Normal")
LogWrite("")
;===>
While Not Eof(ASE)
;===>
cluster1$ = ReadStringN(ASE," ")
;===>
If (cluster1$="*MESH_VERTEXNORMAL")
;===>
AseObj\Oggetto\Normal.Vector = New Vector
;===>
No$ = ReadStringN(ASE," ")
X# = ReadStringN(ASE," ")
Y# = ReadStringN(ASE," ")
Z# = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\Normal\X# = X#
AseObj\Oggetto\Normal\Y# = Y#
AseObj\Oggetto\Normal\Z# = Z#
;===>
LogWrite("X = "+AseObj\Oggetto\Normal\X#+" Y = "+AseObj\Oggetto\Normal\Y#+" Z = "+AseObj\Oggetto\Normal\Z#)
;===>

End If
If (cluster1$="}") Exit
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_VERTEX_LIST(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Vertex List")
LogWrite("")
;===>
AseObj\Oggetto\CntVertex = 0
;===>
While Not Eof(ASE)
;===>
cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_VERTEX")

;===>
AseObj\Oggetto\VertexList.Vector = New Vector
;===>
No$ = ReadStringN(ASE," ")
X# = ReadStringN(ASE," ")
Y# = ReadStringN(ASE," ")
Z# = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\VertexList\X# = X#
AseObj\Oggetto\VertexList\Y# = Y#
AseObj\Oggetto\VertexList\Z# = Z#
;===>
LogWrite("n "+AseObj\Oggetto\CntVertex+" - X = "+AseObj\Oggetto\VertexList\X#+" Y = "+AseObj\Oggetto\VertexList\Y#+" Z = "+AseObj\Oggetto\VertexList\Z#)
AseObj\Oggetto\CntVertex = AseObj\Oggetto\CntVertex + 1
;===>
End If
;===>
If (cluster2$="}") Exit
;===>
Wend
;===>
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_FACE_LIST(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Face List")
LogWrite("")
;===>
While Not Eof(ASE)
;===>
cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_FACE")
;===>
AseObj\Oggetto\FaceList.Face = New Face
;===>
No$ = ReadStringN(ASE," ")
No$ = ReadStringN(ASE," ")
A% = ReadStringN(ASE," ") : No$ = ReadStringN(ASE," ")
B% = ReadStringN(ASE," ") : No$ = ReadStringN(ASE," ")
C% = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\FaceList\A% = A
AseObj\Oggetto\FaceList\B% = B
AseObj\Oggetto\FaceList\C% = C
;===>
LogWrite("n "+AseObj\Oggetto\CntFace+" - A = "+AseObj\Oggetto\FaceList\A%+" B = "+AseObj\Oggetto\FaceList\B%+" C = "+AseObj\Oggetto\FaceList\C%)
AseObj\Oggetto\CntFace = AseObj\Oggetto\CntFace +1 ;
;===>
End If
;===>
If (cluster2$="}") Exit
;===>
Wend
;===>
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_TVERTLIST(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Vertex UV CH1")
LogWrite("")
;===>
While Not Eof(ASE)
;===>
cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_TVERT")
;===>
AseObj\Oggetto\CH1_VList.UV = New UV
;===>
No$ = ReadStringN(ASE," ")
U# = ReadStringN(ASE," ")
V# = ReadStringN(ASE," ")
W# = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\CH1_VList\U = U
AseObj\Oggetto\CH1_VList\V = V
AseObj\Oggetto\CH1_VList\W = W
LogWrite("U = "+AseObj\Oggetto\CH1_VList\U+" V = "+AseObj\Oggetto\CH1_VList\V+" W = "+AseObj\Oggetto\CH1_VList\W)
;===>
End If
If (cluster2$="}") Exit
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_TFACELIST(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Face UV CH1")
LogWrite("")
;===>
While Not Eof(ASE)
;===>
cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_TFACE")
;===>
AseObj\Oggetto\CH1_FList.Face = New Face
;===>
No$ = ReadStringN(ASE," ")
A% = ReadStringN(ASE," ")
B% = ReadStringN(ASE," ")
C% = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\CH1_FList\A% = A%
AseObj\Oggetto\CH1_FList\B% = B%
AseObj\Oggetto\CH1_FList\C% = C%
LogWrite("A = "+AseObj\Oggetto\CH1_FList\A+" B = "+AseObj\Oggetto\CH1_FList\B+" C = "+AseObj\Oggetto\CH1_FList\C)
;===>
End If
If (cluster2$="}") Exit
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_TVERTLIST1(ASE)
;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Vertex UV CH2")
LogWrite("")
;===>
While Not Eof(ASE)
;===>

cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_TVERT")
;===>
AseObj\Oggetto\CH2_VList.UV = New UV
;===>
No$ = ReadStringN(ASE," ")
U# = ReadStringN(ASE," ")
V# = ReadStringN(ASE," ")
W# = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\CH2_VList\U = U
AseObj\Oggetto\CH2_VList\V = V
AseObj\Oggetto\CH2_VList\W = W
LogWrite("U = "+AseObj\Oggetto\CH2_VList\U+" V = "+AseObj\Oggetto\CH2_VList\V+" W = "+AseObj\Oggetto\CH2_VList\W)
;===>
End If
If (cluster2$="}") Exit
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function MESH_TFACELIST1(ASE)

;===>
LogWrite("")
LogWrite("===========================")
LogWrite("---------------------------")
LogWrite(" Face UV CH2")
LogWrite("")
;===>
While Not Eof(ASE)
;===>
cluster2$ = ReadStringN(ASE," ")
;===>
If (cluster2$="*MESH_TFACE")
;===>
AseObj\Oggetto\CH2_FList.Face = New Face
;===>
No$ = ReadStringN(ASE," ")
A% = ReadStringN(ASE," ")
B% = ReadStringN(ASE," ")
C% = ReadStringN(ASE," ")
;===>
AseObj\Oggetto\CH2_FList\A% = A%
AseObj\Oggetto\CH2_FList\B% = B%
AseObj\Oggetto\CH2_FList\C% = C%
LogWrite("A = "+AseObj\Oggetto\CH2_FList\A+" B = "+AseObj\Oggetto\CH2_FList\B+" C = "+AseObj\Oggetto\CH2_FList\C)
;===>
End If
If (cluster2$="}") Exit
Wend
End Function
;==============================
;---------------------------
;
;---------------------------
Function WriteBB3D( File )
;Stop
mat = 0

LogWrite("")
LogWrite("")
LogWrite("===================================================")
LogWrite("------------------------------------------------")
LogWrite(" Inzio Esportazione")
LogWrite("------------------------------------------------")
LogWrite("")

;===>
b3dSetFile( file )
b3dBeginChunk( "BB3D" )
b3dWriteInt( 1 ) ;version
;===>
;Iniziamo con la giostra ;-)
;
;======================
; Scrittura texture
;===>
;Stop
AseObj\Materiali.Material = First Material
For AseObj\Materiali.Material = Each Material
NMap=0
;===>
b3dBeginChunk( "TEXS" )
;===============================
;===> Default map
If ( AseObj\Materiali\Difuse$<>"")
NMap=NMap+1
b3dWriteString( AseObj\Materiali\Difuse$ )
b3dWriteInt( 1 + TexFlag ) ;textureflag
b3dWriteInt( 2 ) ;textureblend
b3dWriteFloat( AseObj\Materiali\D_UV_OffsetX# ) ;x_pos
b3dWriteFloat( AseObj\Materiali\D_UV_OffsetY# ) ;y_pos
b3dWriteFloat( AseObj\Materiali\D_UV_TilingX# ) ;x_scale
b3dWriteFloat(-AseObj\Materiali\D_UV_TilingY# ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
EndIf
;===============================
;===> ReflectMap
If ( AseObj\Materiali\Enviroment$<>"")
NMap=NMap+1
b3dWriteString( AseObj\Materiali\Enviroment$ )
b3dWriteInt( 64 + TexFlag ) ;textureflag
b3dWriteInt( 2 ) ;textureblend
b3dWriteFloat( AseObj\Materiali\E_UV_OffsetX# ) ;x_pos
b3dWriteFloat( AseObj\Materiali\E_UV_OffsetY# ) ;y_pos
b3dWriteFloat( AseObj\Materiali\E_UV_TilingX# ) ;x_scale
b3dWriteFloat(-AseObj\Materiali\E_UV_TilingY# ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
EndIf
;===============================
;===> Light Map
If ( AseObj\Materiali\SelfI$<>"")
NMap=NMap+1
b3dWriteString( AseObj\Materiali\SelfI$ )
b3dWriteInt( 65536 + TexFlag ) ;textureflag for 2nd ! uv channel [65536=normal, 65584=clamp u,v and so on ...]
b3dWriteInt( 2 ) ;textureblend
b3dWriteFloat( AseObj\Materiali\S_UV_OffsetX# ) ;x_pos
b3dWriteFloat( AseObj\Materiali\S_UV_OffsetY# ) ;y_pos
b3dWriteFloat( AseObj\Materiali\S_UV_TilingX# ) ;x_scale
b3dWriteFloat(-AseObj\Materiali\S_UV_TilingY# ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
EndIf
;===============================
;===> Bump Map
If ( AseObj\Materiali\Bump$<>"")
NMap=NMap+1
b3dWriteString( AseObj\Materiali\Bump$ )
b3dWriteInt( 65536 + TexFlag) ;textureflag for 2nd ! uv channel [65536=normal, 65584=clamp u,v and so on ...]
b3dWriteInt( 4 ) ;textureblend
b3dWriteFloat( AseObj\Materiali\B_UV_OffsetX# ) ;x_pos
b3dWriteFloat( AseObj\Materiali\B_UV_OffsetY# ) ;y_pos
b3dWriteFloat( AseObj\Materiali\B_UV_TilingX# ) ;x_scale
b3dWriteFloat(-AseObj\Materiali\B_UV_TilingY# ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
EndIf
;===============================
;===> Log
LogWrite("------------");Name Object
LogWrite("Texture");Name Object
LogWrite(" DefMap -> "+AseObj\Materiali\Difuse$) ;Name Object
LogWrite(" RefMap -> "+AseObj\Materiali\Enviroment$) ;Name Object
LogWrite(" LigMap -> "+AseObj\Materiali\SelfI$) ;Name Object
LogWrite(" BumpMap -> "+AseObj\Materiali\Bump$) ;Name Object
;===>
b3dEndChunk() ;end of TEXS chunk
;======================
; Scrittura Brush
;===>
b3dBeginChunk( "BRUS" )
;===============================
;===> Multi Texture
b3dWriteInt( NMap ) ;textures per brush[1]
b3dWriteString( AseObj\Materiali\Nome$ );name
b3dWriteFloat( AseObj\Materiali\col\R ) ;red
b3dWriteFloat( AseObj\Materiali\col\G ) ;green
b3dWriteFloat( AseObj\Materiali\col\B ) ;blue
b3dWriteFloat( AseObj\Materiali\col\A ) ;alpha
b3dWriteFloat( AseObj\Materiali\Shines );shininess
b3dWriteInt( 1 ) ;blend
b3dWriteInt( 0 ) ;FX
If (NMap=1 ) b3dWriteInt( mat+0 ) : mat = mat+1
If (NMap=2 ) b3dWriteInt( mat+0 ) : b3dWriteInt( mat+1 ) : mat = mat+2
If (NMap=3 ) b3dWriteInt( mat+0 ) : b3dWriteInt( mat+1 ) : b3dWriteInt( mat+2 ) : mat = mat+3
If (NMap=4 ) b3dWriteInt( mat+0 ) : b3dWriteInt( mat+1 ) : b3dWriteInt( mat+2 ) : b3dWriteInt( mat+3 ) : mat = mat+4
;===============================
;===> Log
LogWrite("------------");Name Object
LogWrite("Brush");Name Object
LogWrite(" ->"+AseObj\Materiali\Nome$);Name Object
;===>
b3dEndChunk() ;end of Brush chunk
;===>
Next
;======================
; Scrittura Mesh come sub Object
;===>
For AseObj\Oggetto.obj = Each obj
LogWrite("Mesh");Name Object
b3dBeginChunk( "NODE" );------------sub nodes
;===>
b3dWriteString( AseObj\Nome$ );name
b3dWriteFloat( 0 ) ;x_pos XYZ_px#
b3dWriteFloat( 0 ) ;y_pos XYZ_py#
b3dWriteFloat( 0 ) ;y_pos XYZ_pz#
b3dWriteFloat( 1 ) ;x_scale XYZ_sx#
b3dWriteFloat( 1 ) ;y_scale XYZ_sy#
b3dWriteFloat( 1 ) ;z_scale XYZ_sz#
b3dWriteFloat( 1 ) ;rot_w XYZ_aw#
b3dWriteFloat( 0 ) ;rot_x XYZ_ax#
b3dWriteFloat( 0 ) ;rot_y XYZ_ay#
b3dWriteFloat( 0 ) ;rot_z XYZ_az#
;===>
WriteMESH1()
b3dEndChunk() ;end of NODE chunk
Next



;===>
; chiusura file B3D
b3dEndChunk() ;end of BB3D chunk


End Function
;==============================
;---------------------------
;
;---------------------------
Function WriteMESH1()
;=========================================================================
;----------------------------------------------------------------------
;Convertiamo il formato standard in formato compatibile BLITZ 3D
;----------------------------------------------------------------------
;=========================================================================
;Stop
NVertex = 0
CntVertex = AseObj\Oggetto\CntVertex
;===>
AseObj\Oggetto\FaceList = First Face
AseObj\Oggetto\CH1_FList = First Face
AseObj\Oggetto\CH2_FList = First Face
;===>
For ciclo = 0 To AseObj\Oggetto\NFace
;===>
; Prendiamoci i vertici inbase alle faccie
ID_VL_A = AseObj\Oggetto\FaceList\a : ID_VL_B = AseObj\Oggetto\FaceList\b : ID_VL_C = AseObj\Oggetto\FaceList\c
;===>
; Prendiamoci le UV CH-1 in base alle faccie
ID_UV1_A = AseObj\Oggetto\CH1_FList\a : ID_UV1_B = AseObj\Oggetto\CH1_FList\b : ID_UV1_C = AseObj\Oggetto\CH1_FList\c
;===>
; Prendiamoci le UV CH-2 in base alle faccie
ID_UV2_A = AseObj\Oggetto\CH2_FList\a : ID_UV2_B = AseObj\Oggetto\CH2_FList\b : ID_UV2_C = AseObj\Oggetto\CH2_FList\c
;********************************************
;===>
;Puntiamo All'oggetto Vertex List (A)
AseObj\Oggetto\VertexList = First Vector
For Cic=0 To ID_VL_A : AseObj\Oggetto\VertexList = After AseObj\Oggetto\VertexList :Next
;Puntiamo All'UV CH-1
AseObj\Oggetto\CH1_VList = First UV
For Cic=0 To ID_UV1_A : AseObj\Oggetto\CH1_VList = After AseObj\Oggetto\CH1_VList :Next
;Puntiamo All'UV CH-2
AseObj\Oggetto\CH2_VList = First UV
For Cic=0 To ID_UV2_A : AseObj\Oggetto\CH2_VList = After AseObj\Oggetto\CH2_VList :Next
;===>
If VertB3D(ID_VL_A)=Null Then
;===>
VertB3D(ID_VL_A) = New FB3D
;===>
;kk=AseObj\Oggetto\VertexList\X#
;yy=VertB3D(ID_VL_A)\vx#
VertB3D(ID_VL_A)\vx# = AseObj\Oggetto\VertexList\X# ;
VertB3D(ID_VL_A)\vy# = AseObj\Oggetto\VertexList\Y# ;
VertB3D(ID_VL_A)\vz# = AseObj\Oggetto\VertexList\Z# ;
;
VertB3D(ID_VL_A)\nx# = AseObj\Oggetto\Normal\X# ;
VertB3D(ID_VL_A)\ny# = AseObj\Oggetto\Normal\Y# ;
VertB3D(ID_VL_A)\nz# = AseObj\Oggetto\Normal\Z# ;
;
VertB3D(ID_VL_A)\r# = 1 ;
VertB3D(ID_VL_A)\g# = 1 ;
VertB3D(ID_VL_A)\b# = 1 ;
VertB3D(ID_VL_A)\a# = 0.5 ;
;
VertB3D(ID_VL_A)\u1# = AseObj\Oggetto\CH1_VList\u ;
VertB3D(ID_VL_A)\v1# = AseObj\Oggetto\CH1_VList\v ;
VertB3D(ID_VL_A)\w1# = AseObj\Oggetto\CH1_VList\w ;
;
VertB3D(ID_VL_A)\u2# = AseObj\Oggetto\CH2_VList\u ;
VertB3D(ID_VL_A)\v2# = AseObj\Oggetto\CH2_VList\v ;
VertB3D(ID_VL_A)\w2# = AseObj\Oggetto\CH2_VList\w ;
;===>
NVertex = NVertex + 1
;===>
EndIf
;********************************************
;===>
;Puntiamo All'oggetto Vertex List (B)
AseObj\Oggetto\VertexList = First Vector
For Cic=0 To ID_VL_B : AseObj\Oggetto\VertexList = After AseObj\Oggetto\VertexList :Next
;Puntiamo All'UV CH-1
AseObj\Oggetto\CH1_VList = First UV
For Cic=0 To ID_UV1_B : AseObj\Oggetto\CH1_VList = After AseObj\Oggetto\CH1_VList :Next
;Puntiamo All'UV CH-2
AseObj\Oggetto\CH2_VList = First UV
For Cic=0 To ID_UV2_B : AseObj\Oggetto\CH2_VList = After AseObj\Oggetto\CH2_VList :Next
;===>
If VertB3D(ID_VL_B)=Null Then
;===>
VertB3D(ID_VL_B) = New FB3D
;===>
VertB3D(ID_VL_B)\vx# = AseObj\Oggetto\VertexList\X# ;
VertB3D(ID_VL_B)\vy# = AseObj\Oggetto\VertexList\Y# ;
VertB3D(ID_VL_B)\vz# = AseObj\Oggetto\VertexList\Z# ;
;
VertB3D(ID_VL_B)\nx# = AseObj\Oggetto\Normal\X# ;
VertB3D(ID_VL_B)\ny# = AseObj\Oggetto\Normal\Y# ;
VertB3D(ID_VL_B)\nz# = AseObj\Oggetto\Normal\Z# ;
;
VertB3D(ID_VL_B)\r# = 1 ;
VertB3D(ID_VL_B)\g# = 1 ;
VertB3D(ID_VL_B)\b# = 1 ;
VertB3D(ID_VL_B)\a# = 0.5 ;
;
VertB3D(ID_VL_B)\u1# = AseObj\Oggetto\CH1_VList\u ;
VertB3D(ID_VL_B)\v1# = AseObj\Oggetto\CH1_VList\v ;
VertB3D(ID_VL_B)\w1# = AseObj\Oggetto\CH1_VList\w ;
;
VertB3D(ID_VL_B)\u2# = AseObj\Oggetto\CH2_VList\u ;
VertB3D(ID_VL_B)\v2# = AseObj\Oggetto\CH2_VList\v ;
VertB3D(ID_VL_B)\w2# = AseObj\Oggetto\CH2_VList\w ;
;===>
NVertex = NVertex + 1
;===>
EndIf
;********************************************
;===>
;Puntiamo All'oggetto Vertex List (C)
AseObj\Oggetto\VertexList = First Vector
For Cic=0 To ID_VL_C : AseObj\Oggetto\VertexList = After AseObj\Oggetto\VertexList :Next
;Puntiamo All'UV CH-1
AseObj\Oggetto\CH1_VList = First UV
For Cic=0 To ID_UV1_C : AseObj\Oggetto\CH1_VList = After AseObj\Oggetto\CH1_VList :Next
;Puntiamo All'UV CH-2
AseObj\Oggetto\CH2_VList = First UV
For Cic=0 To ID_UV2_C : AseObj\Oggetto\CH2_VList = After AseObj\Oggetto\CH2_VList :Next
;===>
If VertB3D(ID_VL_C)=Null Then
;===>
VertB3D(ID_VL_C) = New FB3D
;===>
VertB3D(ID_VL_C)\vx# = AseObj\Oggetto\Normal\X# ;
VertB3D(ID_VL_C)\vy# = AseObj\Oggetto\Normal\Y# ;
VertB3D(ID_VL_C)\vz# = AseObj\Oggetto\Normal\Z# ;
;
VertB3D(ID_VL_C)\nx# = AseObj\Oggetto\Normal\X# ;
VertB3D(ID_VL_C)\ny# = AseObj\Oggetto\Normal\Y# ;
VertB3D(ID_VL_C)\nz# = AseObj\Oggetto\Normal\Z# ;
;
VertB3D(ID_VL_C)\r# = 1 ;
VertB3D(ID_VL_C)\g# = 1 ;
VertB3D(ID_VL_C)\b# = 1 ;
VertB3D(ID_VL_C)\a# = 0.5 ;
;
VertB3D(ID_VL_C)\u1# = AseObj\Oggetto\CH1_VList\u ;
VertB3D(ID_VL_C)\v1# = AseObj\Oggetto\CH1_VList\v ;
VertB3D(ID_VL_C)\w1# = AseObj\Oggetto\CH1_VList\w ;
;
VertB3D(ID_VL_C)\u2# = AseObj\Oggetto\CH2_VList\u ;
VertB3D(ID_VL_C)\v2# = AseObj\Oggetto\CH2_VList\v ;
VertB3D(ID_VL_C)\w2# = AseObj\Oggetto\CH2_VList\w ;
;===>
NVertex = NVertex + 1
;===>
EndIf
;********************************************
;===>
; Puntiamo al successivo gruppo
AseObj\Oggetto\FaceList = After AseObj\Oggetto\FaceList
AseObj\Oggetto\CH1_FList = After AseObj\Oggetto\CH1_FList
AseObj\Oggetto\CH2_FList = After AseObj\Oggetto\CH2_FList
;===>
Next
;----------------------------------------------------------------------
;=========================================================================

LogWrite("Mesh");Name Object
b3dBeginChunk( "MESH" )
b3dWriteInt( 0 ) ;no 'entity' brush-<---the brush!!
;===>
b3dBeginChunk( "VRTS" )
b3dWriteInt( 3 ) ;flags - 0=no 1=normal 2=Vertex color
b3dWriteInt( 2 ) ;texture coords per vertex (eg: 1 for simple U/V) max=8
b3dWriteInt( 3 ) ;components per set (eg: 2 for simple U/V) max=4
;===>
;Stop
aa = NVertex
bb = AseObj\Oggetto\NVertex

For ciclo = 0 To AseObj\Oggetto\NVertex-1
;===>
;===> XYZ Vertex
b3dWriteFloat( VertB3D(ciclo)\vx# ); VX
b3dWriteFloat( VertB3D(ciclo)\vy# ); VY
b3dWriteFloat( VertB3D(ciclo)\vz# ); VZ
;===> XYZ Normal
b3dWriteFloat( VertB3D(ciclo)\nx# ); NX
b3dWriteFloat( VertB3D(ciclo)\ny# ); NY
b3dWriteFloat( VertB3D(ciclo)\nz# ); NZ
;===> Vertex Color
b3dWriteFloat( VertB3D(ciclo)\r# ); Vertex Color R
b3dWriteFloat( VertB3D(ciclo)\g# ); Vertex Color G
b3dWriteFloat( VertB3D(ciclo)\b# ); Vertex Color B
b3dWriteFloat( VertB3D(ciclo)\a# ); Vertex Color A
;===> UVW CH-1
b3dWriteFloat( u0# ) ; CH-1 -> U
b3dWriteFloat( v0# ) ; CH-1 -> V
b3dWriteFloat( w0# ) ; CH-1 -> W
;===> UVW CH-2
b3dWriteFloat( u1# ) ; CH-2 -> U
b3dWriteFloat( v1# ) ; CH-2 -> V
b3dWriteFloat( w1# ) ; CH-2 -> W
;===>
Next
b3dEndChunk() ;end of VRTS chunk
;===>
b3dBeginChunk( "TRIS" )
b3dWriteInt( AseObj\Oggetto\IdMaterial ) ;flags - 0=no 1=normal 2=Vertex color
;===>
;Stop
aa = AseObj\Oggetto\CntFace
bb = AseObj\Oggetto\NFace
;===>
For AseObj\Oggetto\FaceList = Each Face
;===>
b3dWriteInt( AseObj\Oggetto\FaceList\A )
b3dWriteInt( AseObj\Oggetto\FaceList\B )
b3dWriteInt( AseObj\Oggetto\FaceList\C )
;===>
Next
;===>
b3dEndChunk() ;end of TRIS chunk
;===>
b3dEndChunk() ;end of MESH chunk
;===>

End Function

;=========================================================================
;=========================================================================
;=========================================================================
;---------------------------
;
;---------------------------
Function LogDebug(Logs$="")
Select Logs$
Case "Open"
FileLog = WriteFile("mydata.dat")
Default
CloseFile( FileLog )
End Select
End Function
;==============================
;---------------------------
;
;---------------------------
Function LogWrite(Logs$="")
; +Chr$(10)+Chr$(13) = Accapo
WriteLine( FileLog, Logs$ )
End Function


Scherererer(Posted 2006) [#2]
Try putting it into debug mode and then running it, it should then show you what line the problem is at.


IPete2(Posted 2006) [#3]
Or...


email Fredbourg (creator of Gile[s]) who has already generated import/export for ASE in Blitz.

IPete2.


DareDevil(Posted 2006) [#4]
the my problem is Mav and crash blitz

thanks bye