Prt6 - Don't be scared it won't
bite - Sphere "AKA Ball"
Author: Ben_3D@xbdev.net
Well you can still turn back.... its going to get a little complex for a few
minutes. I wanted to show you how to generate shapes, like 3D packages do. Give
you a taste of some real sticky code :)
But don't worry I'll take you throught it hand by hand and slowly. I've tried
to rip as much of the un-necessary stuff out, and keep it in a nice easy to
swollow function.
I think if you sit down with a jar of coffee and a spoon and read through it
you might ....just maybe...hopefully...grasp it :>
Two parts? Yup, I split it into two parts.
Part1. Will give you a basic sphere, the simplest possible that uses a "TRIANGLESTRIP"
to draw the sphere. This is basically instead of generating a load of seperate
triangles to represent all the little triangles that make up our cool shape,
we just generate a load of vertex points one after the other and we can use
that.
Part2. I used "TRIANGLELIST" - its a little more complex.... hec
is a lot more complex... instead I modified the code a bit and did it so the
sphere is now made up of loads of seperate triangles. The vertex buffer holds
a complet list of seperate triangles...e.g. the first three vertex points make
up one triangle on the sphere, the next three points the next triangle etc.
Why did I do this? Well I must a reason, later on I'll show you how to make
the sphere explode outwards, e.g. all the sides of the sphere will go opposite
way so you get an explosion sort of effect...which will be cool :)
(Back Tutorials Page)
|