Using the demo code from Dark Clouds and Blitzwerks Terrain, the following line crashes DB Pro every time.
rem init with texture number 1, and number of keyframes per day
dc init 1,5
I REM it out (and the rest of the cloud code) and it works.
Separately, the code works 100% and everything is installed properly. The terrain example works great. Separately, the cloud example works great. However, combine them and that one line (the initialization of the clouds) crashes DB Pro.
I troubleshot it down to the init line. Why does this crash DB Pro? I have the latest version of everything including DB Pro.
Here is the entire code:
//BLITZWERKS TERRAIN 2.02 EXAMPLE - REALTIME TERRAIN MODIFICATION
//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.4
//This demo shows how to use the realtime terrain modification system in BlitzTerrain.
//This system modifies terrains in realtime so you can create bomb craters or editors for your game.
//CONTROLS
//ARROWKEYS AND MOUSE - MOVE
// F1 - WIREFRAME ON. F2 - WIREFRAME OFF
//LEFT MOUSE BUTTON - RAISE TERRAIN
//RIGHT MOUSE BUTTON - LOWER TERRAIN
rem Please wait
set text font "verdana" : s$="generating clouds...please wait"
center text screen width()/2,screen height()/2,s$ : sync
SET DISPLAY MODE 800, 600, 32
rem init app at 60fps
sync on : sync rate 60
rem =======================================================
rem terrain stuff
rem =======================================================
rem global terrain stuff
global g_HeightmapImgID : global g_TextureImgID : global g_DetailmapImgID
g_HeightmapImgID=1 : g_TextureImgID=2 : g_DetailmapImgID=3
//Load media
load image "..\Media\heightmap.bmp",g_HeightmapImgID
load image "..\Media\texture.jpg",g_TextureImgID
load image "..\Media\detail.tga",g_DetailmapImgID
//Create terrain
//Make the terrain
global g_TerrainID
g_TerrainID=BT MakeTerrain()
//Set images
BT SetTerrainHeightmap g_TerrainID,g_HeightmapImgID
BT SetTerrainTexture g_TerrainID,g_TextureImgID
BT SetTerrainDetail g_TerrainID,g_DetailmapImgID
//Set some other values
BT SetTerrainScale g_TerrainID,12.0
BT SetTerrainYScale g_TerrainID,2.0
BT SetTerrainSplit g_TerrainID,8
BT SetTerrainDetailTile g_TerrainID,3.0
//LOD
BT SetTerrainLOD g_TerrainID,3 //3 LOD levels
BT SetTerrainLODDistance g_TerrainID,1,1000.0 //LOD Distances start at one and go up to 1 less the LOD level count
BT SetTerrainLODDistance g_TerrainID,2,2000.0
//Smoothing
BT SetTerrainSmoothing g_TerrainID,1
//Quad rotation
BT SetTerrainQuadRotation g_TerrainID,1
//Build
global g_TerrainObjectID
g_TerrainObjectID=1
//This command processes the heightmap and creates all the internal structures for the terrain
BT BuildTerrain g_TerrainID,g_TerrainObjectID,1
//Enable auto render
BT EnableAutoRender 1
rem =======================================================
rem Clouds
rem =======================================================
rem half-fill the sky with clouds
dc set cloudy 0.5
rem clouds at 3 km
dc set cloud height 3
rem set sky brightness to 1
brightness#=0.5
dc set brightness brightness#
rem adjust brightness based on time of day
dc set auto brightness 1
rem set wind to 30 mph at 270 degrees (heading west)
dc set wind 70,270
rem init with texture number 1, and number of keyframes per day
dc init 1,5
rem put clouds at 3km altitude
dc set cloud height 3.0
rem starting at 7am
time#=7.0
rem the update command creates the cloud texture
dc update time#
rem show texture 1 as the backdrop
texture backdrop 1
rem create a 3D object in the scene
rem load object "pelican.dbo",1
rem scale object 1,1000,1000,1000
set normalization on
rem =======================================================
//Setup camera
set camera range 10,10000
hide mouse
rem place camera for best view
position camera 0,50,-200
//Main loop
StartTime=timer()
do
rem step through the day
time#=time#+100.0/(60.0*60.0*60.0)
rem update clouds
dc update time#
//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()
//RTTMS
if mouseclick()&&1
BT RaiseTerrain g_TerrainID,BT GetTerrainSize(g_TerrainID)/2,BT GetTerrainSize(g_TerrainID)/2,400,200*Elapsedtime#
endif
if mouseclick()&&2
BT RaiseTerrain g_TerrainID,BT GetTerrainSize(g_TerrainID)/2,BT GetTerrainSize(g_TerrainID)/2,400,-200*Elapsedtime#
endif
//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())
//Position mouse
position mouse screen width()/2,screen height()/2
//Update screen
sync
loop
If you cannot use these expansions together, it makes them completely useless!
Your help is appreciated.
Mike
YOU DREAM IT - WE CREATE IT!
www.world-class-multimedia.com
For world-class virtual instruments - www.supersynths.com