There are many tutorials and explanations of ambient occlusion on the net but, for those of you who don't know how it works, the algorithm (in a nutshell) is:
For every surface (Quads in my case), calculate whether a ray sent out from each vertex collides with any other surface. The amount of rays that are occluded are then interpreted in relation to the total amount of rays to establish how dark/light that vertex should appear.It is important to note that the rays sent out from a surface should be distributed uniformly on the unit sphere. There are many algorithms you could use to calculate the points the rays should pass through (Personally I prefer the Golden Section Spiral).
While messing around with different ideas I just lumped a lot of the code into the graphics library, which now looks really messy. And there are much more optimal ways of doing the calculations involved. Hence, I will be refactoring most of the code into proper libraries, this should take about a week.
Here are some screenshots, a video and for the executable, you can go here. Sorry about the quality of the video, I don't have fast enough internet to upload a proper one.
Lastly, generating terrain with simplex rather than perlin noise.