예제 #1
0
파일: FBXScene.cpp 프로젝트: Malow/NDYGFX
void FBXScene::ProcessScene(FbxScene* pScene)
{
	if ( m_pSkeleton ) delete m_pSkeleton, m_pSkeleton = 0;

	FbxAxisSystem SceneAxisSystem = pScene->GetGlobalSettings().GetAxisSystem();
	FbxAxisSystem OurAxisSystem(FbxAxisSystem::Motionbuilder);

	if( SceneAxisSystem != OurAxisSystem )
	{
		OurAxisSystem.ConvertScene(pScene);
	}
	
	ProcessMaterials(pScene);
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eSkeleton);
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eMesh);	// takes time, guesstimate 50% of it
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eNurbsCurve); 

	if(m_pSkeleton)
		m_pSkeleton->BuildBoneHierarchy();

	ProcessBlendWeights();
	ProcessSkeleteonBoundingBoxes();

	ProcessAnimations(pScene);	// takes time too, other 50%
}
예제 #2
0
/**
* Newer 3D model system. Loads from an Xml file which has
* animation info along with model file name and other info.
* This can also be used to support multiple resolution and damage
* models in the future.
*/
void tc3DModel::LoadXml(const std::string& file_name)
{
    std::string fileNameWithPath = model_path; // default is "3d\\"
    fileNameWithPath += file_name;
    
    xmlFileName = file_name;

    TiXmlDocument* doc = new TiXmlDocument(fileNameWithPath.c_str());
    if (!doc->LoadFile())
    {
        delete doc;
        fprintf(stderr, "Error loading XML file %s\n", file_name.c_str());
        mesh = unknownAll;
        mesh->Enable(false);
        return;
    }

    TiXmlNode* node = doc->FirstChild("Model");

    if (!node)
    {
        delete doc;
        fprintf(stderr, "Model entry missing in XML file %s\n", file_name.c_str());
        mesh = unknownAll;
        mesh->Enable(false);
        return;
    }

    TiXmlElement* current = node->ToElement(); 
    wxASSERT(current);

    std::string modelFileName = current->Attribute("File");

#ifdef _DEBUG
    fprintf(stdout, "Loading model (%s) for xml file (%s)\n",
        modelFileName.c_str(), file_name.c_str());
#endif

    Load(modelFileName);

    LoadXmlSubmodels(doc);

    if (useSmoothing)
    {
//        osgUtil::SmoothingVisitor smoothingVisitor;
//		modelNode->accept(smoothingVisitor);
    }

    LoadXmlAnimationInfo(doc);

    LoadXmlMountInfo(doc);

    LoadXmlSmokeInfo(doc);

    LoadXmlWakeInfo(doc);

    ProcessAnimations();

    LoadXmlInfo(doc);
    
    delete doc;

    wxASSERT(mesh.get() != 0);
}