|
From: Mike D. <o3d...@us...> - 2004-07-22 05:01:46
|
Update of /cvsroot/grappelmann/spaceplane In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5251 Modified Files: model_loader.cpp Log Message: - tree is now correctly built (albeit very sparse) Index: model_loader.cpp =================================================================== RCS file: /cvsroot/grappelmann/spaceplane/model_loader.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** model_loader.cpp 21 Jul 2004 19:34:51 -0000 1.1 --- model_loader.cpp 22 Jul 2004 05:01:37 -0000 1.2 *************** *** 45,52 **** parser->parse(filename); DOMDocument* domDocument = parser->getDocument(); if(domDocument->getDocumentElement() == NULL) { cout << "empty document" << endl; return false; ! } else if(!_convertDOMNode(domDocument->getDocumentElement())) { cout << "couldn't dump dom document" << endl; return false; --- 45,54 ---- parser->parse(filename); DOMDocument* domDocument = parser->getDocument(); + SceneObject* sceneRoot = NULL; + if(domDocument->getDocumentElement() == NULL) { cout << "empty document" << endl; return false; ! } else if((sceneRoot = _convertDOMNode(domDocument->getDocumentElement())) == NULL) { cout << "couldn't dump dom document" << endl; return false; *************** *** 80,90 **** // some sensible defaults - SceneObject* scene = NULL; - // if we don't have a parent, make one - // normally used for the root node, but right now we're not parsing everything, - // so we could land up with a sparse tree if(parent == NULL) { parent = new SceneObject(); } try { --- 82,89 ---- // some sensible defaults if(parent == NULL) { parent = new SceneObject(); } + SceneObject* scene = NULL; try { *************** *** 104,108 **** if(scene == NULL) { cout << "<X3DLoader::_convertDOMNode>\tempty scene" << endl; ! return NULL; } --- 103,110 ---- if(scene == NULL) { cout << "<X3DLoader::_convertDOMNode>\tempty scene" << endl; ! ! // *** NOTE *** This is a little 'hack', so we can avoid a scene with mostly dummy nodes ! scene = parent; ! //return NULL; } *************** *** 114,118 **** // dump the child SceneObject* child = _convertDOMNode(curChild, scene, curLevel + 1); ! if(child != NULL) { scene->addChild(child); } --- 116,120 ---- // dump the child SceneObject* child = _convertDOMNode(curChild, scene, curLevel + 1); ! if((child != NULL) && (child != scene)) { scene->addChild(child); } *************** *** 122,129 **** curChild = nextChild; } ! } else { cout << "<X3DLoader::_convertDOMNode>\tignoring scene without attributes" << endl; scene = new SceneObject(); } } else if(domNode->getNodeType() == DOMNode::ATTRIBUTE_NODE) { --- 124,133 ---- curChild = nextChild; } ! } /* ! else { cout << "<X3DLoader::_convertDOMNode>\tignoring scene without attributes" << endl; scene = new SceneObject(); } + */ } else if(domNode->getNodeType() == DOMNode::ATTRIBUTE_NODE) { *************** *** 189,196 **** // done, return return mesh; ! } else { SceneObject* dummy = new SceneObject(); return dummy; } return NULL; --- 193,204 ---- // done, return return mesh; ! } ! ! /* ! else { SceneObject* dummy = new SceneObject(); return dummy; } + */ return NULL; *************** *** 230,233 **** --- 238,244 ---- /* $Log$ + Revision 1.2 2004/07/22 05:01:37 o3dozone + - tree is now correctly built (albeit very sparse) + Revision 1.1 2004/07/21 19:34:51 o3dozone - model loader initial import |