I read about the undocumented "advanced terrain statements" in Hands on Darkbasic Volume 2. But I can't get it to work with textures, only basic one color polygons.
Basically this code snippet works:
rem *** 1) Create empty terrain
make object terrain 1
rem *** 2) Load the terrain map
set terrain heightmap 1, "terrain_black_white.bmp"
rem *** 3) Create terrain
build terrain 1, 0
rem *** 4) Test it and move around
do
control camera using arrowkeys 0,5,1
loop
end
*** rem And it works!
However when trying to add textures the whole terrain becomes black...
rem *** 1) Create empty advanced terrain
make object terrain 1
rem *** 2) Load the terrain map
set terrain heightmap 1, "terrain_black_white.bmp"
rem *** 3) Create terrain
build terrain 1, 0
rem 4) >>> New Code to add Texture <<<
load image "whitetest.bmp", 1
load image "whitetest.bmp", 2
set terrain texture 1, 1, 2
rem >>> (Continues with old code)
do
control camera using arrowkeys 0,5,1
loop
end
*** rem Terrain shows as black
Question 1: How do I successfully create and texture advanced terrain? What am I doing wrong above?
---
More testing:
I tried the following workaround and succesfully got it textured:
rem *** 1) Create advanced terrain
make object terrain 1
set terrain heightmap 1, "terrain.bmp"
build terrain 1, 0
rem *** 2) Save it as an object file...
save object "mountains.dbo", 1
rem *** 3) Now load the object file ...
load object "mountains.dbo", 1
rem *** 4) Load and apply texture
load image "texture.bmp" , 1
texture object 1, 1
rem *** Position and show
position object 1, 25, 0, 100
do
turn object left 1, 1.0
loop
end
rem * Works!
However when converting terrain into an object I son't know how to find the "terrain height".
Question 2: Is there any way to find the "terrain height" of a regular Dark Basic Object?
Question 3: Is there some way to create a matrix from a terrain or object? (Then I could use "get ground height" to get the height.
-Andrew
---
-Kinetic