Code
Introduction
This page contains links to any coding projects I'm currently undertaking. All are pretty well 'work in progress' so treat them as such.

Ray
This is my first attempt at building a raytracer. It's quite neat internally as it's object oriented - the principle being that when the scene casts a ray through itself, it doesn't need to know what kind of objects it's testing for - all it cares about is whether it's hit one, and if it has, what colour the point on the surface of the object we can see. So therefore, we define a virtual Object class, specifying two methods - intersects() and surfaceNormal() and then derive all our object classes from this. Then, all the scene has to do is traverse a list of all the objects, calling the intersects() method on each one, determine the closest, find out the colour, and bingo, the point is traced.

Please note that this code was written before I'd learnt about the STL, so therefore I've re-implemented a linked list structure. There's also some skeleton code for more object and light types than the tracer currently supports but the existing types (planes and spheres, point and direction lights) should give a good enough idea of what is going on to show that the principle works.

Currently, shadows, textures, lighting, objects and colouring works. There is, as yet, no support for reflection or refraction (or indeed anything that requires recursive tracing) or bump-mapping (though this would be trivial to work in).

The tracer, by default, produces a TGA file in the directory it's executing in. There are two projects in the workspace provided - Debug and Debug simple. These are exactly the same functionally, they just trace different scenes. Debug uses core.cpp and Debug simple uses simple.cpp. I hope it's obvious what each one is rendering from the source code.

There are known issues with not all the vector and point objects being deleted after use, and there are a few interesting rounding errors leading to some jitter within the scene. Other than that, it seems to work quite well.

Click here to download a zip file containing a Visual C++ 6.0 project of the tracer.

Particle
Bit of a misleading name, given that it's a scrolling starfield. It's my first proper DirectX app. It needs DirectX of some sort to run, and to the best of my knowledge doesn't crash.

It uses locks on the drawing surface to enable pixel-by-pixel access to the surface.

It might need to be run in 16bit mode, I can't remember. The Visual C++ 6.0 project are provided in the the zip, which can be downloaded here

MavDOOM
This is my third year project from my time at Manchester University. Parts of the code were written by Matt Craven.

I was largely responsible for the network code in the project.

It requires OpenGL and GNU Maverik to compile and run. This will probably need a Linux box, but an IRIX one might work.

You can get the source code here and the project report as a gz compressed postscript file here.

(please note the mavdoom links are currently broken. I am aware of this and am working on it)

Notes
This page and all contents are (C) 2001 Chris Whitworth unless otherwise stated. All code has no warranty, and I don't guarantee it's going to work, do what I say or even not blow your computer up or cause you to lose all your data. I have no idea if this will stand up in a court of law. If you feel lucky, try me.