To allow the game player or the model viewer to have a 360 degree
look around the scene skyboxes are used.
The next pictures show the sides of the box with one texture
on the back plane. The view point must be in the box to
create the illusion of the complete scene.
The pictures for the six sides of the box were free
available on the internet.
The terrain for this model consist of an two dimensional
array. For each point (x,y) there is one height value z. Such
heightmaps are often stored in .raw files.
The raw files consist of bytes representing the height
values.
Reading those values and creating polygons out of them leads
to the following result shown in the next picture.
Using the the texture mapping techniques from the last
assignments the terrain can be rendered to look very
realistic.
In the picture below you can see the skybox and the terrain at
the bottom of the cube. The color is just to show
the different sides of the cube
For this model the car of assignment 4 is used.
Since we have the height value for every point of the
terrain the collision detection for the car is not
difficult. The only thing is to set the y coordinate of
the car model to the corresponding height value stored
in the array. The only difficulty here is the
coordination transformation from the scene coordinates
to the height map coordinates and the other way
round.
Once those transformations are computed the car can
"climb" any mountain.
One thing which is more difficult is to set the car in
motion. To be able to compute the next position, the car has
got a normal vector pointing in the direction the car will
drive.
For starting the game download the source by clicking on the link and read the requirements before. To start the game just type "java JTTW".
Unfortunately I am running out of web space. So please write me an email for getting the source code.