lightmap.bb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Include "../start.bb"
  2. Global Log=WriteFile("log.txt")
  3. camera=CreateCamera()
  4. map=LoadAnimMesh("level.x")
  5. litemap=LoadAnimMesh("lightmap.x")
  6. t=LoadTexture("lightmap.bmp")
  7. MapVertices(map,litemap,t)
  8. FreeEntity litemap
  9. FreeTexture t
  10. MoveEntity camera,0,200,-500
  11. PointEntity camera,map
  12. While Not KeyHit(1)
  13. TurnEntity map,0,0.1,0
  14. UpdateWorld
  15. RenderWorld
  16. Flip
  17. Wend
  18. End
  19. ;=====================
  20. Function MapVertices(model,copy,texture)
  21. WriteLine Log,"Limb "+EntityName(model)+" contains "+CountChildren(model)+" children, "+CountSurfaces(model)+" surfaces.
  22. For n=1 To CountSurfaces(model)
  23. surf=GetSurface(model,n)
  24. WriteLine Log,"Limb "+EntityName(model)+", surface "+n+" contains "+CountVertices(surf)+" vertices."
  25. Next
  26. For n=1 To CountSurfaces(model)
  27. WriteLine Log,"Testing surface "+n
  28. surf=GetSurface(model,n)
  29. lsurf=GetSurface(copy,n)
  30. For v=0 To CountVertices(surf)-1
  31. WriteLine Log,"Testing vertex "+v+1
  32. tu#=VertexU#(lsurf,v)
  33. tv#=VertexV#(lsurf,v)
  34. tw#=VertexW#(lsurf,v)
  35. VertexTexCoords surf,v,tu,tv,tw,1
  36. Next
  37. Next
  38. WriteLine Log,""
  39. TextureCoords texture,1
  40. EntityTexture model,texture,0,1
  41. For e=1 To CountChildren(Model)
  42. limb=GetChild(model,e)
  43. limb2=GetChild(copy,e)
  44. MapVertices(limb,limb2,texture)
  45. Next
  46. End Function