So heres my World Class in .CPP Form
Code:
#include "World.h"
std::vector<Object*> Scene_Objects;
std::vector<Object*>::iterator Iter;
void World::AddObjectToWorld()
{
Scene_Objects.push_back(new Object);
}
void World::RemoveObjectFromWorld()
{
for (Iter = Scene_Objects.begin(); Iter!=Scene_Objects.end();)
{
if ((*Iter)->MarkedForDeletion)
{
delete *Iter;
Iter = Scene_Objects.erase(Iter);
}
else
{
++Iter;
}
}
};
void World::RemoveAllObjectsFromWorld()
{
for ( size_t i = 0; i < Scene_Objects.size( ); ++i )
{
delete Scene_Objects[i];
Scene_Objects.clear();
}
};
Just a couple functions to manage my Scene_Objects vector, (which will ultimately be sent to the render for final rendering)
Here is my Object Class, its quite simple, but It needs something else, I'm quite sure of it...
Code:
#include "MS3D.h"
#ifndef OBJECT_H
#define OBJECT_H
class Object
{
public:
bool MarkedForDeletion;
struct Location
{
float locx;
float locy;
float locz;
};
};
#endif
And here is the final object (inherits the object class)
Code:
#ifndef C_CROSS_H
#define C_CROSS_H
#include "Object.h"
class Cross : public Object
{
public:
MS3DModel *Model1;
};
#endif
Now, back up there in the um, World class, I have an AddObjectToScene function, that creates a new object, is there any way I can set Cross = to Object, or do I have to switch a few parameters to make this work?