Saturday 24 November 2012

Theme Park Scene 3

Today, I have added a river to the scene. The river is created by being given four initial points as it's corners, and then this quad is subdivided using a recursive member function. The number of subdivisions can be altered via a parameter passed to the class' constructor. Each vertex is then given a random height. In order to get the river to update when the camera was not moving, I had to make use of GLUT's idle function in order to re-calculate the river's vertices and normals on each frame. This meant that I also had to call redisplay on each frame, and so at the moment all geometry is being redrawn every single frame. This is not the most efficient way of going about animating the river, but it will stay in place for the time being. Every time the river is updated, it is subdivided again. However, I wish to change this and simply generate new heights for each existing vertex inside a separate function. This will make the program more efficient. Below are some images of the river, along with an image in wireframe mode so that the subdivision of the surface can be seen.




Below is a video that shows the river as it re-generates it's vertices to create a basic water effect. It is in no way a uniform or highly realistic effect, but it works for now. Video is low quality due to the screen capture software and upload process, however when in wireframe mode the subdivisions can be seen moving.


No comments:

Post a Comment