コード例 #1
0
//Main function pels Joints.
bool CPhysxSkeleton::InitPhysXJoints(const string& _szFileName)
{

  CXMLTreeNode l_XML;
  CXMLTreeNode l_XMLObjects;
	if(!l_XML.LoadFile(_szFileName.c_str()))
	{
		LOGGER->AddNewLog(ELL_WARNING,"CPhysxRagdoll:: No s'ha trobat el XML \"%s\"", _szFileName.c_str());
		return false;
	}

  l_XMLObjects = l_XML(1);

  int l_iNumObjects = l_XMLObjects.GetNumChildren();

  
	for(int i = 0; i < l_iNumObjects; i++)
	{
    string l_szType;
    CXMLTreeNode l_XMLObject = l_XMLObjects(i);
    if(l_XMLObject.IsComment())
	  {
		  continue;
	  }

    l_szType = l_XMLObject.GetPszISOProperty("type" ,"");
    
    if (l_szType=="spherical")
    {
      AddSphericalJoint(l_XMLObject);  
    }
    
    if (l_szType=="fixed")
    {
      AddFixedJoint(l_XMLObject);     
    }

    if (l_szType=="revolute")
    {
      AddRevoluteJoint(l_XMLObject); 
    }
  }

  return true;
  
}
コード例 #2
0
//Main function pels Joints.
bool CPhysxSkeleton::InitPhysXJoints(const std::string& _szFileName)
{

    CXMLTreeNode l_XML;
    CXMLTreeNode l_XMLObjects;
    if(!l_XML.LoadFile(_szFileName.c_str()))
    {
      LOG_WARNING_APPLICATION( "CPhysxRagdoll:: No s'ha trobat el XML \"%s\"", _szFileName.c_str());
        return false;
    }

    l_XMLObjects = l_XML(1);

    int l_iNumObjects = l_XMLObjects.GetNumChildren();


    for(int i = 0; i < l_iNumObjects; i++)
    {
        string l_szType;
        CXMLTreeNode l_XMLObject = l_XMLObjects(i);

        l_szType = l_XMLObject.GetAttribute<std::string>("type" , "");

        if (l_szType == "spherical")
        {
            AddSphericalJoint(l_XMLObject);
        }

        if (l_szType == "fixed")
        {
            AddFixedJoint(l_XMLObject);
        }

        if (l_szType == "revolute")
        {
            AddRevoluteJoint(l_XMLObject);
        }
    }

    return true;

}