Ohh, hadn't properly checked the code :) Your Blend settings are not correct, and texture and brush indexes start at 0 not 1...This works:
Fredborg
Graphics3D 640,480,0,2 Dim ChunkStart(100) :Global chunkebene=0 cube = CreateSphere(16) Global tex$ = "RuinT00.tga" ;<--- Replace with whatever ExportIt(cube) Function ExportIt(mesh) ;I call this function name$="sample.b3d" file=WriteFile(name$) If file=0 Then Return ChunkBegin(file,"BB3D") WriteInt(file,1) ;version ChunkBegin(file,"TEXS") ;-----Textures------------- WriteStringC(file,tex$) ;name (a field of texturenames) masked=4+1 WriteInt(file,masked) ;flags (alpha..) WriteInt(file,2) ;<------- This WAS wrong, 2 is the default Blend of a Texture WriteFloat(file,0) ;X ;def:0 WriteFloat(file,0) ;Y WriteFloat(file,1) ;X Scale ;def:1 WriteFloat(file,1) ;Y Scale WriteFloat(file,0) ;Rotation ChunkEnd(file) ;-----Textures end--------- ChunkBegin(file,"BRUS") ;+++++Brush++++++++++++++++ WriteInt(file,1) ;1 textures per brush WriteStringC(file,"Default") ;Dname WriteFloat(file,1) ;Dred WriteFloat(file,1) ;Dgreen WriteFloat(file,1) ;Dblue WriteFloat(file,1) ;Dalpha WriteFloat(file,0) ;Dshininess WriteInt(file,1) ;Dblend <---- 1 is the Default Blend of a Brush WriteInt(file,0) ;DFX WriteInt(file,0) ;DTextureNr <---- Starts from 0 NOT 1 ChunkEnd(file) ;End of BRUS chunk ChunkBegin(file,"NODE" ) ;+++++Entities+++++++++++++ WriteStringC(file,"TheEntity") ;name WriteFloat(file,0) ;x WriteFloat(file,0) ;y WriteFloat(file,0) ;z WriteFloat(file,1) ;x_scale WriteFloat(file,1) ;y_scale WriteFloat(file,1) ;z_scale WriteFloat(file,1) ;rot_w WriteFloat(file,0) ;rot_x WriteFloat(file,0) ;rot_y WriteFloat(file,0) ;rot_z ChunkBegin(file,"MESH") ;+++++Meshes+++++++++++++++ WriteInt(file,-1) ;no 'entity' brush ChunkBegin(file,"VRTS" ) ;+++++Vertexes+++++++++++++ WriteInt(file,1 ) ;flags - 0=no 1=with normals / 2=with color WriteInt(file,1 ) ;1 tex_coord sets WriteInt(file,2 ) ;2 coords per set surfaceanz=CountSurfaces(mesh) For k=1 To surfaceanz surf=GetSurface(mesh,k ) vertexanz=CountVertices( surf )-1 For j=0 To vertexanz TFormPoint VertexX(surf,j),VertexY(surf,j),VertexZ(surf,j),0,0 WriteFloat(file,TFormedX() ) ;X WriteFloat(file,TFormedY() ) ;Y WriteFloat(file,TFormedZ() ) ;Z WriteFloat(file,VertexNX#(surf,j)) ;<---- This was wrong WriteFloat(file,VertexNY#(surf,j)) ;<---- This was wrong WriteFloat(file,VertexNZ#(surf,j)) ;<---- This was wrong WriteFloat(file,VertexU( surf,j ) );TextureU WriteFloat(file,VertexV( surf,j ) );TextureV Next Next ChunkEnd(file) ;-----Vertexes end--------- first_vert=0 surfaceanz=CountSurfaces(mesh) For k=1 To surfaceanz surf=GetSurface( mesh,k ) trisanz=CountTriangles( surf )-1 ChunkBegin(file,"TRIS" ) ;++++++Tris++++++++++++++++ WriteInt(file,0 ) ;<---- Brush for this surface. Starts from 0 NOT 1 For j=0 To trisanz WriteInt(file,first_vert+TriangleVertex( surf,j,0 ) ) WriteInt(file,first_vert+TriangleVertex( surf,j,1 ) ) WriteInt(file,first_vert+TriangleVertex( surf,j,2 ) ) Next ChunkEnd(file) ;-----Tris end------------ first_vert=first_vert+CountVertices( surf ) Next ChunkEnd(file) ;-----Mesh end------------ ChunkEnd(file) ;-----Entity end---------- ChunkEnd(file) ;-----BB3D end------------ CloseFile file End FunctionThe remaining functions are correct.
Fredborg