|3D Cubes in Lingo|
|Part 01 - 'the simple wireframe cube'|
You need to start somewhere, and a nice simple 3d wireframe of a cube is where I started.
This was adapted from my original 3d wireframe shape program, which is why there is a similar background graphic and the same controls. I started this because I was testing out a new version of Director and couldn't think of something better to do. This is basically the step before I stripped out the line drawing code and adapted it to control the points of quads.
I seem to be quite happily amused by a simple spinning wireframe cube ('Wheeeee! look at at it spin').
|Part 02 - 'the textured cube'|
By using quads I can easily draw a textured face with a 3d perspective. The wire drawing code stored 2 points for each line. To draw a quad I need to store 4 points that define a face going clockwise around its corners.
The slightly complicated bit was z-sorting the faces, so I drew the rear ones first and the near faces on top of them. With a certain amount of transparency on the faces you started not to notice the need for z-sorting, but I didnt want to cheat. With a succesful z-sort completed I could take advantage of the cube shape and only draw the front 3 faces as you can only see 3 faces of a solid cube (unless you can take your eyes out of your head or other similar trickery). Only drawing 3 of the 6 faces would speed up drawing a frame, but I wanted to able to alter the opacity of the faces and see the faces on the other side of the cube, so I draw all of them. Its pretty fast anyway so I don't really need any optimisation.
I'm going to find out where I got the picture of a cow from. I'm pretty sure it was a 'free' stock photo website. Anyway its a great picture of a cow!
I have added some preloading code. This prevents script errors when I'm accessing bitmaps in lingo that need to be in memory.
The cow picture came from here http://stock.d2.hu/. The image is 'little cow' taken by mammuth.
|Part 04 - 'the video feedback cube'|
Here I experimented with using the area I was using to display the spinning cube as the image for the cube faces. This resulted in some great patterns and some headache inducing optical effects (not recommended if you have a hangover)
Where's part 3? I haven't included it as it was mostly the same as part 4 but wasn't as much fun. It was using the original background which was designed deliberatly dull and so you couldn't really see what was going on, it was just a murky mess.
I have added some preloading code, it should work like a dream!
|Philip Bignell 2002|