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...
the resource isn't being found, therefore it is loaded, this is being performed successfully...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); } }
Second, we create the geometry node...
All the pointers remain valid, we initialize the node like thisCode: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; };
->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...
And at this very moment, the simple Scene graph looks like this:Code:CGeometryNode(boost::weak_ptr<MS3DModel> Resource_Observer) { Geometry = Resource_Observer; } ~CGeometryNode() { } void Update() { boost::shared_ptr<MS3DModel> geom = Geometry.lock();
Root Node->Transformation Node->Geometry Node..
In the Draw function I do this..
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..Code:RootNode->Update();
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?



LinkBack URL
About LinkBacks





.