export ASE to B3D Help me!!

Blitz3D Forums/Blitz3D Programming/export ASE to B3D Help me!!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

i have created the convert format ASE (ASCII Max) to B3D, have a problem visualizzation object, help me!!
the dump not result problem, the file load correct, not visualization object

excuse for the my english

Thanks all

Bye ;)

;---------------------------
;
;---------------------------

Function WriteBB3D( file, state$ )
select state$
;-------------------
case "Init"
b3dSetFile( file )

b3dBeginChunk( "BB3D" )
b3dWriteInt( 1 ) ;version
;-------------------
case "Material"
stop

b3dBeginChunk( "TEXS" )
for Id_mat = 0 to MAT_Count
;===> Diffuse map
b3dWriteString( MatTex0$(Id_mat) )
b3dWriteInt( 1 ) ;textureflag
b3dWriteInt( 2 ) ;textureblend
b3dWriteFloat( 0 ) ;x_pos
b3dWriteFloat( 0 ) ;y_pos
b3dWriteFloat( 1 ) ;x_scale
b3dWriteFloat( 1 ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
;===> Light Map
b3dWriteString( MatTex1$(Id_mat) )
b3dWriteInt( 65536) ;textureflag for 2nd ! uv channel [65536=normal, 65584=clamp u,v and so on ...]
b3dWriteInt( 2 ) ;textureblend
b3dWriteFloat( 0 ) ;x_pos
b3dWriteFloat( 0 ) ;y_pos
b3dWriteFloat( 1 ) ;x_scale
b3dWriteFloat( 1 ) ;y_scale
b3dWriteFloat( 0 ) ;rotation
;===>
next
b3dEndChunk() ;end of TEXS chunk

b3dBeginChunk( "BRUS" )
b3dWriteInt( 2 ) ;textures per brush[1]
for Id_mat = 0 to MAT_Count
mat = Id_mat*2
;===>
b3dWriteString( MatName$(Id_mat) ) ;name
b3dWriteFloat( MatR(Id_mat) ) ;red
b3dWriteFloat( MatG(Id_mat) ) ;green
b3dWriteFloat( MatB(Id_mat) ) ;blue
b3dWriteFloat( MatA(Id_mat) ) ;alpha
b3dWriteFloat( MatShine(Id_mat) ) ;shininess
b3dWriteInt( 2 ) ;blend
b3dWriteInt( 1 ) ;FX
b3dWriteInt( mat+0 ) ;texture_id 0
b3dWriteInt( mat+1 ) ;texture_id 1
;===>
next
b3dEndChunk() ;end of BRUS chunk

;-------------------
case "Mesh"
stop

b3dBeginChunk( "NODE" )
b3dWriteString( "ob" )
b3dWriteFloat( XYZ_px ) ;x_pos
b3dWriteFloat( XYZ_py ) ;y_pos
b3dWriteFloat( XYZ_pz ) ;y_pos
b3dWriteFloat( XYZ_sx ) ;x_scale
b3dWriteFloat( XYZ_sy ) ;y_scale
b3dWriteFloat( XYZ_sz ) ;z_scale
b3dWriteFloat( XYZ_pw ) ;rot_w
b3dWriteFloat( XYZ_px ) ;rot_x
b3dWriteFloat( XYZ_py ) ;rot_y
b3dWriteFloat( XYZ_pz ) ;rot_z
WriteMESH1(curObj)
b3dEndChunk() ;End of NODE chunk
;-------------------
case "End"
b3dEndChunk() ;end of BB3D chunk
End Select
End Function


Function WriteMESH1(curobj )

n_verts = XYZ_Count_vertex
n_tris = (XYZ_Count_face-1)

b3dBeginChunk( "MESH" )
b3dWriteInt( -1 ) ;no 'entity' brush

b3dBeginChunk( "VRTS" )
b3dWriteInt( 0 ) ;flags - 0=no 1=normal 2=Vertex color
b3dWriteInt( 2 ) ;0 tex_coord sets
b3dWriteInt( 2 ) ;0 coords per set

For j=0 To n_tris
For k=0 To 2
;===> Id di ricostruzione triangoli
Id_Vert = XYZ_face(j,k)
Id_UV0 = UVW_face(j,k)
Id_UV1 = UVW_face1(j,k)
;===> XYZ Vertex
b3dWriteFloat( XYZ_vertex(Id_Vert,0) ); X
b3dWriteFloat( XYZ_vertex(Id_Vert,1) ); Y
b3dWriteFloat( XYZ_vertex(Id_Vert,2) ); Z
;===> XYZ Vertex
;b3dWriteFloat( XYZ_normal(Id_Vert,0) ); X
;b3dWriteFloat( XYZ_normal(Id_Vert,1) ); Y
;b3dWriteFloat( XYZ_normal(Id_Vert,2) ); Z
;===> UVW 0 Default Map
b3dWriteFloat( UVW_vertex(Id_UV0,0) ) ; U
b3dWriteFloat( UVW_vertex(Id_UV0,1) ) ; V
;===> UVW 1 Light Map
b3dWriteFloat( UVW_vertex1(Id_UV1,0) ); U
b3dWriteFloat( UVW_vertex1(Id_UV1,1) ); V
;===>
Next
Next
b3dEndChunk() ;end of VRTS chunk


b3dBeginChunk( "TRIS" )
b3dWriteInt( 0 ) ;brush for these triangles

For j=0 To n_tris
;===>
Tris_v = j*3
b3dWriteInt( Tris_v+0 ); X
b3dWriteInt( Tris_v+1 ); Y
b3dWriteInt( Tris_v+2 ); Z
;===>
Next

b3dEndChunk() ;end of TRIS chunk

b3dEndChunk() ;end of MESH chunk

End Function