Beispiel #1
0
bool World::Load(pXmlTree tree){
    if(tree==NULL) return false;

    Free();
    pXmlTreeList  tmpTreeList;
    string        str;

    gLOG.SetCurrentEntry("World");
    gLOG.Append("Loading World: %s",tree->GetData().c_str());
    gLOG.SetDeltaIndent(2);
    tmpTreeList = tree->GetSubTrees();

    for(unsigned int i=0;i<tmpTreeList->size();i++){
        if(tmpTreeList->at(i)->GetName()=="Object"){
            pWorldObject obj = new WorldObject();
            if(obj->Load(tmpTreeList->at(i))){
                AddObject(obj,true);
            }
        }else if(tmpTreeList->at(i)->GetName()=="FixJoint"){
            WorldObjectLink* link = new WorldObjectLink(tmpTreeList->at(i)->Get("ObjectA",string("")),
                                                        tmpTreeList->at(i)->Get("ObjectB",string("")));
            mObjectLinks.push_back(link);
        }

    }
    gLOG.SetDeltaIndent(-2);
    return true;
}
bool  ObjectRenderer::Load(const pXmlTree tree){
    if(tree==NULL) return false;

    gLOG.SetCurrentEntry("ObjectRenderer");
    gLOG.Append("Setting up BBoxShape for object: %s",tree->GetData().c_str());
    gLOG.SetDeltaIndent(2);

    pXmlTree bbox = tree->Find("BBoxShape");
    if(bbox!=NULL){
        pXmlTreeList tmpList = bbox->GetSubTrees();
        for(unsigned int i=0;i<tmpList->size();i++){
            pShapeStruct shape = LoadShape(tmpList->at(i));
            if(shape!=NULL) mBBoxShapes.push_back(shape);
        }
    }else{
        gLOG.SetDeltaIndent(2);
        gLOG.Append("Warning: No <BBoxShape> found");
        gLOG.SetDeltaIndent(-2);
    }
    gLOG.SetDeltaIndent(-2);

    gLOG.Append("Setting up GfxShape for object: %s",tree->GetData().c_str());
    gLOG.SetDeltaIndent(2);

    pXmlTree gfx = tree->Find("GfxShape");
    if(gfx!=NULL){
        pXmlTreeList tmpList = gfx->GetSubTrees();
        for(unsigned int i=0;i<tmpList->size();i++){
            pShapeStruct shape = LoadShape(tmpList->at(i));
            if(shape!=NULL) mShapes.push_back(shape);
        }
    }else{
        gLOG.SetDeltaIndent(2);
        gLOG.Append("Warning: No <GfxShape> found");
        gLOG.SetDeltaIndent(-2);
    }
    gLOG.SetDeltaIndent(-2);
    return true;
}