Okay so continuing on, this is the fun part this where we put everything together in a test 3d world, we code! here we go. Now the files i'm using like i said above will most likely be different from yours.
rem Load standards
Sync On
Sync Rate 30
Backdrop On
Hide Mouse
rem Load textures, remember to include these with your media, and copy it to the same folder as your program it will save on alot of typing, if your not sure how to do this consult the help file included with DBPro, before going any further.
Load Image "Brick18.jpg", 1
Load Image "Grassy04.jpg", 2
rem Load your Bump Map, same deal as above include these in your media and make sure they are in your programs folder
Load Image "Brick18 Bump Map.Bmp", 3
rem Make a small Matrix nothing big
Make Matrix 1, 300, 300, 12, 12
Randomize Matrix 1, 20
Position Matrix 1, 0, -15, 0
Prepare Matrix Texture 1, 2, 1, 1
rem Make a cube
Make Object Cube 1, 10
Scale Object 1, 30, 90, 30
rem Texture the Cube
Texture Object 1, 1
rem Create a working light
Set Ambient Light 100
Color Light Rgb(230, 132, 0)
rem Set the Object and it's texture to reflect your bump map and set the image number to 3 so your Bump Map is loaded and is fully functional
Set Bump Mapping On 1, 3
rem Main loop to keep the program open
Do
rem Rotate the Cube constantly to test your map
XRotate Object 1, Object Angle X(1) + 1
rem Easy Camera Control
Control Camera Using Arrowkeys 0, 2, 2
rem Update the screen
Sync
Loop
Okay the first thing we do with our coding is prepare a screen refresh for us by using the
command this will activate a screen refresh, the next command
will give us 30 frames per second and keep refreshing the screen as things happen. Next thing is the
Command this will give us a blue background so we can see things a little easier, and the
Command will hide the mouse cursor so we aren't looking at the mouse cursor. Moving right along we load our media, these things have been attached to the message and are free for your use, we use the
Load Image "Brick18.jpg", 1
command for the media loading now we type in the name of our image followed by it's assigned number, do not forget to include the file type of your image as you can see above i have loaded three different images, one for the cube
Load Image "Brick18.jpg", 1
and it's bump map
Load Image "Brick18 Bump Map.bmp", 2
and one for the matrix
Load Image "Grassy04.jpg", 3
like i stated in the code block remember to move all of your collected media into your creations folder in other words your programs folder so these can be read easier and would not require us to write out the whole "C:\Program Files" thing it's just extra typing that isn't needed. Next we use the
Make Matrix 1, 300, 300, 12, 12
line, we assign the Matrix a number by saying
Make Matrix 1 then followed by the number 1, we assign 300 x 300 to the X, and Y values next we assign the segments which i have set at 12 x 12 this will give us 12 slices in the X and Y directions. Then we randomize the matrix using the
line this will allow is to assign height to our matrix we tell what matrix to effect and the random number that will give us our height, so we use 1 as our matrix number and 20 as our random number that will create hills for us. Next we re-locate the matrix by using the
Position Matrix 1, 0, -15, 0
line first we tell the command to effect matrix 1 then we say 0 for X, -15 for Y, and 0 for the Z coordinates we assigned -15 to Y so we can position the matrix below the main camera so we can walk over it. Next we will texture the matrix using the
Prepare Matrix Texture 1, 2, 1, 1
line we tell it to assign a texture to our matrix, then well tell it what image number will be used as the texture, then we actually effect the matrix by telling it we need the texture applied 1 box unit across and down. Next we make a cube to apply our bump map to by using the
line we tell it to assign the Object a number of 1 as an id number, next we apply a size to it which will be 10, next we scale the object by using the
Scale Object 1, 30, 90, 30
line to assign which object we wish to effect which will be 1 now we tell the object to scale in the X,Y,Z coordinates you can go ahead and scale the object to your liking but i picked 30, 90, 30. Now texture the cube using the
line we say we want object 1 to be textured, and the image number to texture with which is 1. Next we create an Ambient light using the
line after we key the command in we set the light percentage to 100 so we get a bright scene, next we will color the light by using the
Color Light so we say
Color Light Rgb(230, 132, 0)
Next we tell the program to give us a bump map with the use of the
line what this will do is give us a reflective surface that will update when it hits the light so we tell the program to effect the cube by using the object number of 1, then we tell the program to grab the bump map image which is 3 and apply it to the cube. Next we setup a loop by using the
line this will tell the program to keep running as long as the Escape key is not hit, inside the main loop is where we apply our motion. The first thing we want to accomplish is rotate the cube constantly here we say
XRotate Object 1, Object Angle X(1) + 1
here we tell the program to rotate our cube (Object 1) in the X Direction, followed by the the Positive X direction so the cube will be rotating. Next we can control the camera with the use of simple coding so don't assign any variables by using this
Control Camera Using Arrowkeys 0, 2, 2
here we tell the program to allow for control by the use of the arrow keys we control (Camera 0) which is the default cam for every 3d program done, then we give it a speed of 2 and a turn speed of 2. Next we refresh the screen by using the
command this will allow the program to constantly update the screen by the refresh rate we setup earlier which was
line. Then we simply tell the program to loop constantly using the
line.
Well thats it i have updated this part of the guide to give you a better example of what each of these things do by themselves. The media i used was included below but you will need Winrar to extract the file linkie
http://www.rarlab.com/download.htm. There you go enjoy the tutorial and happy coding