Ooops
May 26, 2020, 06:40:57 PM

Author Topic: [bb] Save mesh to .asc file format by Chroma [ 1+ years ago ]  (Read 1093 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
Title : Save mesh to .asc file format
Author : Chroma
Posted : 1+ years ago

Description : This was more of an exercise for myself than anything.  Not sure how useful it is.  I'll be working on the .asc for practice.

Code :
Code: BlitzBasic
  1. ;.asc file exporter
  2. ;by Chroma
  3.  
  4. Function export_asc(mesh,file$)
  5.  
  6. check=CountSurfaces(mesh)
  7. If check=0 Then Return
  8.  
  9. surf=GetSurface(mesh,1)
  10.  
  11. ;start writing the file
  12. out=WriteFile(file$)
  13. WriteLine out,"Ambient light color: Red=0.5 Green=0.5 Blue=0.5"
  14. WriteLine out,""
  15. WriteLine out,"Named object: "+Chr$(34)+"untitled"+Chr$(34)
  16. WriteLine out,"Tri-mesh, Vertices: "+CountVertices(surf)+" Faces: "+CountTriangles(surf)
  17. WriteLine out,"Vertex list:"
  18.  
  19. ;Vertices
  20. For a=0 To CountVertices(surf)-1
  21. WriteLine out,"Vertex "+a+": X:"+VertexX(surf,a)+" Y:"+VertexY(surf,a)+" Z:"+VertexZ(surf,a)+";,"
  22. Next
  23.  
  24. ;Faces
  25. WriteLine out,"Face list:"
  26. For a=0 To CountTriangles(surf)-1
  27. WriteLine out,"Face "+a+": A:"+TriangleVertex(surf,a,0)+" B:"+TriangleVertex(surf,a,1)+" C:"+TriangleVertex(surf,a,2)+" AB:1 BC:1 CA:1"
  28. WriteLine out,"Smoothing: 1"
  29. Next
  30.  
  31. CloseFile out
  32. End Function


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal