Oct 1st, 2004, 12:27 PM
C++: Neat 3D Landscaping Class
This is a very basic 3D LANDSCAPING class. It allows manual vertice allocation and indexing of at max 65535 land segments per instance. A Segment acts more like a piece of land, like a hill, the ground, a crater. There are a few things I still need to impliment like the ability to change what type of DrawPrimite ShapeStyle is used (triangle strip, list, etc)
The class is attached, but an example of how to use it is shown below.
This class is more advanced than I posted, but the basic idea here is down, and if someone wrote a map_loading routine to load data from a text file, this class would really come in handy
//Pass an initialized Device3D into the class
//You can create without the pass, and pass later usin a func inside
//Create a segment with a unique ID
//"Segment Name, VerticePosX,Y,Z, tileU, tileV
Land.AddVertice("Test",50000, 0, 50000, 0,0);
Land.AddVertice("Test",50000, 0, -50000, 1,0);
Land.AddVertice("Test",-50000, 0, 50000, 0,1);
Land.AddVertice("Test",-50000, 0, -50000, 1,1);
//Create a tiny little basic hill
//This will render every segment. This will be advanced to render
// only active marked segments, and allow z-ordering etc..
This is not a class implimentatin, just a header.
So it is compiled with whatever it is included in, not seperate.
This is why some things must be met:
To compile this and use it you will need knowledge of Dx7
You will also need to somewhere have the proper includes
Also to use the string and vectors within
using namespace std;
Otherwise I know this is portable to any project which has met the above requirements. In fact, all you really need to use this is an initialized 3D Device in Dx7.
Now, for some reason there are linking errors if the two functions declared outside the header are not qualified with __forceinline.
Do not ask me why, I have never had that problem happen before. But it won't compiler elsewise. Maybe someone can assist. But because of this I believe this class will work only in VC.
I just felt like posting something, I have a whole game engine written, but I am not prepared to give it all away as one yet.
Expecting some feedback.
DirectX9 Version coming as soon as I get a better video card.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
Click Here to Expand Forum to Full Width