Model not showing up on screen...
Okay, so I'm about to draw my first model via scene graph, and strange, weird stuff is a happening..
I have verified that the model is being loaded, and the draw function is being performed, I have verified that the scene graph IS updating recursively, and the draw function is being called.
Weirdness..
Okay, so first we load the model...
Code:
Resource_Observer Request_Resource(const std::string & name)
{
Resource_Map::iterator it = mResources.find(name);
if (it == mResources.end())
{
Resource_Ptr Raw_Resource(new T_);
Raw_Resource->Load(name);
mResources.insert(std::make_pair(name, Raw_Resource));
Resource_Observer Resource(Raw_Resource);
return Resource;
}
else
{
return Resource_Observer(it->second);
}
}
the resource isn't being found, therefore it is loaded, this is being performed successfully...
Second, we create the geometry node...
Code:
class CGeometryNode : public CSceneNode
{
public:
CGeometryNode(boost::weak_ptr<MS3DModel> Resource_Observer)
{
Geometry = Resource_Observer;
}
~CGeometryNode() { }
void Update()
{
boost::shared_ptr<MS3DModel> geom = Geometry.lock();
if(geom)
{
geom->Draw();
}
else
{
// eep! all shared_ptr's deleted!
//
// Reload Geometry, or take other measures
}
CSceneNode::Update();
}
private:
boost::weak_ptr<MS3DModel> Geometry;
};
All the pointers remain valid, we initialize the node like this
->CGeometryNode * Geometry = new CGeometryNode(Models.Request_Resource("Data/Model.ms3d"));
The path is correct, the model is loaded, and a weak pointer is returned, a usable pointer is created out of it, here...
Code:
CGeometryNode(boost::weak_ptr<MS3DModel> Resource_Observer)
{
Geometry = Resource_Observer;
}
~CGeometryNode() { }
void Update()
{
boost::shared_ptr<MS3DModel> geom = Geometry.lock();
And at this very moment, the simple Scene graph looks like this:
Root Node->Transformation Node->Geometry Node..
In the Draw function I do this..
Code:
RootNode->Update();
This starts at the root node and works its way down recursively to draw the geometry, right now I have the transformation function just calling a loadIdentity, to avoid any more errors..
The model isn't drawing. Simply put. Or maybe it is drawing, the function is being performed, I just can't see it... But why?