Hi kaedroho,
I have been using blitzwerk terrain for a while now and absolutely love it. I use it in all my 3d projects.
I think however there may possibly still be a bug with deleting and loading terrains. my programs seem to crash a lot when deleting terrains.
sometimes they will delete and load again and work for a short while before crashing.
I'm not sure if its a bug or user error so i've modified your example project...
BLITZWERKS TERRAIN 2.02 EXAMPLE - TERRAIN LOADING
to try and highlight the problem.
here's the ammended code illustrating the problem
//BLITZWERKS TERRAIN 2.02 EXAMPLE - TERRAIN LOADING
//CREATED BY KARL HOBLEY (KAEDROHO) http://www.blitzwerks.co.uk
//CODE BELOW MAY BE USED IN COMMERCIAL AND NON COMMERCIAL PROJECTS
//CREATED AND TESTED WITH DBPRO 7.5
//This demo shows how to load a terrain. As you can see, the code is alot simpler before. And the terrain loads about 10x faster (300ms normal, 30ms load from file)
//The file came from demo 3. I simply added BT SaveTerrain g_TerrainID,"Terrain.blitz" straight after the Build terrain function.
//You can load/save terrains with parts excluded aswell. I thought that I should load the full terrain with 3 LOD levels to demonstrate the speed.
//The file does not store Textures or detailmaps.
//I designed the file to use continuous read/write for superfast loading and saving.
//The load terrain function does everything between Make Terrain and Build terrain, so changing the heightmap/scale/etc is impossible unless you make a new file.
//CONTROLS
//ARROWKEYS AND MOUSE - MOVE
// F1 - WIREFRAME ON. F2 - WIREFRAME OFF
//Setup
sync on : sync rate 0 : sync
center text screen width()/2,screen height()/2,"Loading..." : sync : cls
//Load media
global g_TextureImgID : global g_DetailmapImgID
g_TextureImgID=1 : g_DetailmapImgID=2
load image "..\Media\texture.jpg",g_TextureImgID
load image "..\Media\detail.tga",g_DetailmapImgID
gosub load
do
if spacekey() = 1
bt deleteterrain g_TerrainID
gosub load
endif
//Camera movement
Elapsedtime#=(timer()-StartTime)/3000.0+Elapsedtime#*0.7
StartTime=timer()
cx#=camera angle x()+mousemovey()/4.0
if cx#>90.0 then cx#=90.0
if cx#<-90.0 then cx#=-90.0
rotate camera cx#,camera angle y()+mousemovex()/4.0,0.0
if upkey() then move camera 1000.0*Elapsedtime#
if downkey() then move camera -1000.0*Elapsedtime#
gheight#=BT GetGroundHeight(g_TerrainID,camera position x(),camera position z())
if camera position y()-40<gheight# then position camera camera position x(),gheight#+40,camera position z()
//Wireframe
if keystate(59) then set object wireframe g_TerrainObjectID,1
if keystate(60) then set object wireframe g_TerrainObjectID,0
//FPS
text 10,10,str$(screen fps())
text 10,20,"Load time: "+str$(endbuild-startbuild)+"ms"
//Position mouse
position mouse screen width()/2,screen height()/2
//Update screen
sync
loop
load:
//Create terrain
startbuild=timer()
//Make the terrain
global g_TerrainID
global g_TerrainObjectID
g_TerrainObjectID=1
g_TerrainID=BT LoadTerrain("..\Media\terrain.blt",g_TerrainObjectID,1)
//Texture and detailmap
BT SetTerrainTexture g_TerrainID,g_TextureImgID
BT SetTerrainDetail g_TerrainID,g_DetailmapImgID
endbuild=timer()
//Setup camera
set camera range 10,10000
hide mouse
//Enable auto render
BT EnableAutoRender 1
//Main loop
StartTime=timer()
return
edit/
im using
windows xp sp 3
dbpro 7.6
\edit
thankyou
kezzla
Sometimes I like to use words out of contents