TGC Codebase Backup



T.Ed Terrain Height Map Tiler for use with Advanced Terrain by jason p sage

17th Oct 2007 12:43
Summary

Convert the Oddnumbered "Seam Sharing" HeightMap exported from Ted for use with Advanced Terrain - when you want to Tile them. This makes the Seams line up. Simple yet ef



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    debug=0
input "How many Across? ",tileX
input "How many Down ?",tileY
input "Vertices? 32 or 64?",vwidth 

if not debug 
  load bitmap "heightmap.bmp",0
endif
img=1
y=tileY 
inversey=1
repeat 
  top=((y-1)*vwidth)-(y-1)
  bottom=top+vwidth-1  
  for x=1 to tileX
    left=((x-1)*vwidth)-(x-1)
    right=left+vwidth-1  
    if debug
      print "Top:";top;" bottom:";bottom;" left:";left," right:";right
    else
      get image img,left,top,right,bottom
      `get image img,0,0,63,63 
      save image "hm(" + STR$(inversey)+","+STR$(x)+").bmp",img
      inc img
    endif
  next
  dec y:inc inversey
  
until y=0     
if debug
  input "Hit enter to end:",a$
endif