I honestly don't think it can (Edit: In response to the LoD comment, until direct vertex control is available). Not on a huge level anyway, or at least not until some commands are improved.
It will work for objects that you simply swap with better quality ones as they get closer, but for something complex like a land terrain, you have problems of everything having to be connected seemlessly. To do that, you have to build the land meshes on the fly. To do that, the commands have to be quick enough. As it stands at the moment, editting a memblock, then converting it to a mesh, then converting it to an object, is just too slow.
My landscape actually ran at around 160FPS on my fx5600, seeing as far as the eye could see. I mean, literally, miles, which would've been millions of polygons had LoD not been used. But when the mesh update call was issued, it took 1 whole second to do, which just obviously isn't suitable for real time. I can actually show you the code that took 1 second to complete, here ...
This function is called 18 times on an update. As you can see, everything is precalculated. All its doing is pulling info out of an array and writing it to a memblock position.
function MakeMapMesh(meshnum,mapx,mapz,m,layer)
`Define map sizes
select m
case 1
jump = 1
endcase
case 2
jump = 3
endcase
case 3
jump = 9
endcase
endselect
left = mapx-8*jump
bottom = mapz-8*jump
right = mapx+7*jump
top = mapz+7*jump
bytepoint = 12
`Go through memblock, updating heights
for loopy=0 to 15
y=bottom+loopy*jump
for loopx=0 to 15
x=left+loopx*jump
`Cycle through each vertex (3 verts per poly, 2 polys per square)
for v=1 to 6
select v
case 1: xoff=1: yoff=0: endcase
case 2: xoff=0: yoff=0: endcase
case 3: xoff=0: yoff=1: endcase
case 4: xoff=0: yoff=1: endcase
case 5: xoff=1: yoff=1: endcase
case 6: xoff=1: yoff=0: endcase
endselect
xpos = x+xoff*jump
ypos = y+yoff*jump
`Set vertex height
write memblock float m,bytepoint+4,Map(xpos,ypos).height#
`Normal Data
write memblock float m,bytepoint+12,Map(xpos,ypos).normx#
write memblock float m,bytepoint+16,Map(xpos,ypos).normy#
write memblock float m,bytepoint+20,Map(xpos,ypos).normz#
If Layer = 1
`DIFFUSE COLOUR DWORD
write memblock dword m,bytepoint+24,rgb(255,255,255)
`UV data
write memblock float m,bytepoint+28,Map(xpos,ypos).U1#
write memblock float m,bytepoint+32,Map(xpos,ypos).V1#
else
`DIFFUSE COLOUR DWORD
write memblock dword m,bytepoint+24,rgb(128,128,128)
`UV data
if xoff and Map(xpos,ypos).U2# = 0
write memblock float m,bytepoint+28,1
else
write memblock float m,bytepoint+28,Map(xpos,ypos).U2#
endif
if yoff and Map(xpos,ypos).V2# = 0
write memblock float m,bytepoint+32,1
else
write memblock float m,bytepoint+32,Map(xpos,ypos).V2#
endif
endif
bytepoint = bytepoint + 36
next v
next loopx
next loopy
make mesh from memblock meshnum,m
endfunction
... and this is called afterwards to make the parts of the map from the mesh made above ...
function MakeMapObject(objnum,meshnum,texnum,x#,y#,z#,ghost)
make object objnum,meshnum,texnum
`set object wireframe objnum,1
position object objnum,x#,y#,z#
if ghost = 1
ghost object on objnum,1
fade object objnum,50
endif
delete mesh meshnum
endfunction
As you can see, calling those functions 18 times is not much. The code is quite big, but not big enough to make a huge impact. I can only assume there is a huge back log in either the memblock commands, Make mesh from memblock, or make object.
I still think with some tweaking and more thought it might be possible though, but it'll require some clever code that executes the most CPU intensive parts on different program loops, so its a gradual update.
Tough though. Some of dbs commands dont make it easy.