PDA

View Full Version : where to store information for 3D world



04-26-2001, 04:24 AM
my question is regarding creating scenes in a 3D world. How should I store the information that is needed to create objects in this world? I am using C to implement the world.
Any help is greatly appreciated.

dans
04-26-2001, 06:00 AM
My advice is keep to keep your data struct simple and clear. Ie dont use mfoxpos for x pos just use x. Use structures to hold your data to start with and look at more advanced techniques once you have that figured out well. Im thinking objects such as trees, cars, units etc here. Not part of world objects such as terrain rivers etc. This is still quite static you may want to look at ways on creating these data structures on the fly.

#define NUM_OBJECTS 100

typdef struct {
float x,y,z;
float velocity;
int active;
}object_t;

object_t Object[NUM_OBJECTS];

if (Object[n].alive == 1){
Object[n].x+=Object[n].velocity;
}