For my sheer enjoyment, I adapted scropyo's example to use BlitzTerrain
rem Advanced Terrain System - Example 2
_________CODE_TOP_____________:
set display mode 1024,768,32
sync on
backdrop on
autocam off
set global collision off
hide mouse
treetex$="tree002b.bmp"
hgtmapsize=256
terrscale=1000
terrheightscale=100
landsize=hgtmapsize*terrscale
watersize=landsize:waterheight=300
skysize=landsize*2
gosub create_terrain
gosub make_sky
gosub make_trees
gosub set_ambient
gosub make_walker
gosub makecompass
gosub putcompass
x#=landsize/2:z#=x#
active=100
gosub Resetcam
update terrain 1
sync rate 0
_______THE_DO_LOOP_______:
do
oldx#=x#
oldz#=z#
if inkey$()="f" and fpsflag=1 then sync rate 60:fpsflag=0:wait 50
if inkey$()="f" and fpsflag=0 then sync rate 0:fpsflag=1:wait 50
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
if active=100
th#=bt getgroundheight(1,x#,z#)
gosub walker_control
position object active,x#,th#,z#
yrotate object active,a#
endif
gosub camera_control
gosub information
position object 99,x#,0,z#
scroll object texture 99,0.00002,0.00002
gosub compass
bt setcurrentcamera 0
bt updateterraincull terrainid
bt updateterrainlod terrainid
bt renderterrain terrainid
sync
loop
______MOVEMENT_CONTROL______:
compass:
rotate limb 1002,0,0,0,a#
return
walker_control:
if upkey()=1 and s#<6 then s#=s#+0.3
if downkey()=1 and s#>-6 then s#=s#-0.3
if leftkey()=1 then a#=wrapvalue(a#-2)
if rightkey()=1 then a#=wrapvalue(a#+2)
if inkey$()="-" then s#=0.0
if inkey$()="." then s#=60.0
return
_______WORLD_BUILD_________:
create_terrain:
load image "terrain_texture.jpg",1
load image "detail_texture.tga",2
load image "HeightMap.bmp",3746
terrainid = bt maketerrain()
bt setterrainheightmap terrainid, 3746
bt setterraintexture terrainid,1
bt setterraindetail terrainid,2
bt setterrainscale terrainid,terrscale
bt setterrainyscale terrainid, terrheightscale
bt setterrainsplit terrainid,16
bt setterraindetailtile terrainid,8
rem apply terrain lod
bt setterrainlod terrainid, 3
bt setterrainloddistance terrainid, 1, 350.0
bt setterrainloddistance terrainid, 2, 500.0
rem apply smoothing and quad rotation
bt setterrainsmoothing terrainid, 1
bt setterrainquadrotation terrainid, 1
bt buildterrain terrainid, 1,1
set object 1,1,1,1,1,1,1,1
return
make_sky:
rem sky texture
load image "sky_texture.bmp",20
make object sphere 99,skysize,10,10
scale object 99,100,50,100
set object 99,1,1,0,1,1,1,1
texture object 99,20
scale object texture 99,3,3
return
make_trees:
load image treetex$,10,1
make object plain 1000,600,800
texture object 1000,10
set object 1000,1,1,0,1,1,1
set object transparency 1000,6
hide object 1000
randomize 100
maxtrees=1200:treeplanes=maxtrees*3
for n=1001 to treeplanes step 3
instance object n,1000
instance object n+1,1000
instance object n+2,1000
yrotate object n+1,60
yrotate object n+2,120
posx#=1000+rnd(254000):posz#=1000+rnd(254000)
gosub heightcheck
hsize=rnd(100)
position object n,posx#,hcheck#+hsize+300,posz#
position object n+1,posx#,hcheck#+hsize+300,posz#
position object n+2,posx#,hcheck#+hsize+300,posz#
next n
return
set_ambient:
set ambient light 100
fog on
fog color rgb(200,200,200)
fog distance 260000
return
makecompass:
make object plain 1002,40,30
load image "arrow.bmp",24
texture object 1002,24
set object 1002,1,1,0,1,1,1,1
xrotate object 1002,90
fix object pivot 1002
disable object zdepth 1002
return
putcompass:
compx#=newxvalue(cx#,ca#,240)
compz#=newzvalue(cz#,ca#,240)
comp2z#=compz#+sin(ca#)*-160
comp2x#=compx#+cos(ca#)*160
position object 1002,comp2x#,cy#-120,comp2z#
lock object on 1002
return
_________CHARACTERS__________:
make_walker:
make object sphere 100,10
set object 100,1,1,0,1,1,1,1
return
_______INFORMATION______:
information:
set cursor 0,0
print " fps = ",screen fps ( )
print " polygon count = ",statistic(1)
print " terrainsize = ",landsize," x ",landsize
print " whole trees = ",maxtrees
print " tree planes = ",treeplanes
print
print " x# = ",x#
print " z# = ",z#
print " camera height = ",camhgt#
print
print
print " control with arrow keys"
print " - = stop"
print " . = faster"
print " f = toggle fps limit (60 or 0)"
print " < = reset camera position"
Print " z and x = high camera views"
print " R mouse + mousemove y = pitch camera"
print " L mouse + mousemove y = camera distance"
print " mouse wheel = change camera height"
return
______CAMERA__ROUTINES___:
camera_control:
if inkey$()="<" then gosub Resetcam
if inkey$()="z" then camhgt#=2000.0:camrot=0:camdist=-4000:set camera range 200,skysize*1.1
if inkey$()="x" then camhgt#=5000.0:camrot=0:camdist=-6000:set camera range 200,skysize*1.1
if mouseclick()=2
mymousey=mousemovey()
if mymousey>0 then cax#=cax#+1.0
if mymousey<0 then cax#=cax#-1.0
endif
if mouseclick()=1
mymousey=mousemovey()
if mymousey>0 then camdist=camdist+5
if mymousey<0 then camdist=camdist-5
endif
mymousez=mousemovez()
if mymousez>0 then camhgt#=camhgt#-2.0
if mymousez<0 then camhgt#=camhgt#+2.0
rem Position camera at the back of the character
cay#=wrapvalue(a#+camrot)
cx#=newxvalue(x#,cay#,camdist)
cz#=newzvalue(z#,cay#,camdist)
cth#=bt getgroundheight(1,cx#,cz#)
if cth#<camhgt# then cy#=th#
if cth#>camhgt# then cy#=cth#
position camera cx#,cy#+camhgt#,cz#
xrotate camera cax#
yrotate camera cay#
return
rem camera reset
Resetcam:
set camera range 1,skysize
camdist=-260
camhgt#=100
cax#=0.0:cay#=0.0
xrotate camera cax#
yrotate camera cay#
return
______CONTROL_ROUTINES___:
rem --- check terrain height-----
heightcheck:
hcheck#=bt getgroundheight(terrainid,posx#,posz#)
return
end
How you don't mind, but Advanced Terrain sucks, but it's an amazing example, thanks, I learned a bit from it.