upgrade from tinyxml to tinyxml2
This commit is contained in:
@@ -59,10 +59,7 @@ SET(BulletRobotics_SRCS
|
|||||||
../../examples/Utils/b3ReferenceFrameHelper.hpp
|
../../examples/Utils/b3ReferenceFrameHelper.hpp
|
||||||
../../examples/Utils/ChromeTraceUtil.cpp
|
../../examples/Utils/ChromeTraceUtil.cpp
|
||||||
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp
|
../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
|
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ INCLUDE_DIRECTORIES(
|
|||||||
${BULLET_PHYSICS_SOURCE_DIR}/src
|
${BULLET_PHYSICS_SOURCE_DIR}/src
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletFileLoader
|
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletFileLoader
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletWorldImporter
|
${BULLET_PHYSICS_SOURCE_DIR}/Extras/Serialize/BulletWorldImporter
|
||||||
|
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/tinyxml2
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_LIBRARY(
|
ADD_LIBRARY(
|
||||||
@@ -10,12 +11,7 @@ ADD_LIBRARY(
|
|||||||
btBulletXmlWorldImporter.h
|
btBulletXmlWorldImporter.h
|
||||||
string_split.cpp
|
string_split.cpp
|
||||||
string_split.h
|
string_split.h
|
||||||
tinyxml.cpp
|
${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
tinyxml.h
|
|
||||||
tinystr.cpp
|
|
||||||
tinystr.h
|
|
||||||
tinyxmlerror.cpp
|
|
||||||
tinyxmlparser.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(BulletXmlWorldImporter PROPERTIES VERSION ${BULLET_VERSION})
|
SET_TARGET_PROPERTIES(BulletXmlWorldImporter PROPERTIES VERSION ${BULLET_VERSION})
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ subject to the following restrictions:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "btBulletXmlWorldImporter.h"
|
#include "btBulletXmlWorldImporter.h"
|
||||||
#include "tinyxml.h"
|
#include "tinyxml2.h"
|
||||||
#include "btBulletDynamicsCommon.h"
|
#include "btBulletDynamicsCommon.h"
|
||||||
#include "string_split.h"
|
#include "string_split.h"
|
||||||
|
using namespace tinyxml2;
|
||||||
|
|
||||||
struct MyLocalCaster
|
struct MyLocalCaster
|
||||||
{
|
{
|
||||||
@@ -43,12 +44,12 @@ btBulletXmlWorldImporter::~btBulletXmlWorldImporter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static int get_double_attribute_by_name(const TiXmlElement* pElement, const char* attribName,double* value)
|
static int get_double_attribute_by_name(const XMLElement* pElement, const char* attribName,double* value)
|
||||||
{
|
{
|
||||||
if ( !pElement )
|
if ( !pElement )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const TiXmlAttribute* pAttrib=pElement->FirstAttribute();
|
const XMLAttribute* pAttrib=pElement->FirstAttribute();
|
||||||
while (pAttrib)
|
while (pAttrib)
|
||||||
{
|
{
|
||||||
if (pAttrib->Name()==attribName)
|
if (pAttrib->Name()==attribName)
|
||||||
@@ -60,16 +61,16 @@ static int get_double_attribute_by_name(const TiXmlElement* pElement, const char
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int get_int_attribute_by_name(const TiXmlElement* pElement, const char* attribName,int* value)
|
static int get_int_attribute_by_name(const XMLElement* pElement, const char* attribName,int* value)
|
||||||
{
|
{
|
||||||
if ( !pElement )
|
if ( !pElement )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const TiXmlAttribute* pAttrib=pElement->FirstAttribute();
|
const XMLAttribute* pAttrib=pElement->FirstAttribute();
|
||||||
while (pAttrib)
|
while (pAttrib)
|
||||||
{
|
{
|
||||||
if (!strcmp(pAttrib->Name(),attribName))
|
if (!strcmp(pAttrib->Name(),attribName))
|
||||||
if (pAttrib->QueryIntValue(value)==TIXML_SUCCESS)
|
if (pAttrib->QueryIntValue(value)==XML_SUCCESS)
|
||||||
return 1;
|
return 1;
|
||||||
// if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) printf( " d=%1.1f", dval);
|
// if (pAttrib->QueryDoubleValue(&dval)==TIXML_SUCCESS) printf( " d=%1.1f", dval);
|
||||||
pAttrib=pAttrib->Next();
|
pAttrib=pAttrib->Next();
|
||||||
@@ -84,7 +85,7 @@ void stringToFloatArray(const std::string& string, btAlignedObjectArray<float>&
|
|||||||
bullet_utils::split( pieces, string, " ");
|
bullet_utils::split( pieces, string, " ");
|
||||||
for ( int i = 0; i < pieces.size(); ++i)
|
for ( int i = 0; i < pieces.size(); ++i)
|
||||||
{
|
{
|
||||||
assert(pieces[i]!="");
|
btAssert(pieces[i]!="");
|
||||||
floats.push_back((float)atof(pieces[i].c_str()));
|
floats.push_back((float)atof(pieces[i].c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ static btVector3FloatData TextToVector3Data(const char* txt)
|
|||||||
btAssert(txt);
|
btAssert(txt);
|
||||||
btAlignedObjectArray<float> floats;
|
btAlignedObjectArray<float> floats;
|
||||||
stringToFloatArray(txt, floats);
|
stringToFloatArray(txt, floats);
|
||||||
assert(floats.size()==4);
|
btAssert(floats.size()==4);
|
||||||
|
|
||||||
btVector3FloatData vec4;
|
btVector3FloatData vec4;
|
||||||
vec4.m_floats[0] = floats[0];
|
vec4.m_floats[0] = floats[0];
|
||||||
@@ -105,13 +106,13 @@ static btVector3FloatData TextToVector3Data(const char* txt)
|
|||||||
return vec4;
|
return vec4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,btAlignedObjectArray<btVector3FloatData>& vectors)
|
void btBulletXmlWorldImporter::deSerializeVector3FloatData(XMLNode* pParent,btAlignedObjectArray<btVector3FloatData>& vectors)
|
||||||
{
|
{
|
||||||
TiXmlNode* flNode = pParent->FirstChild("m_floats");
|
XMLNode* flNode = pParent->FirstChildElement("m_floats");
|
||||||
btAssert(flNode);
|
btAssert(flNode);
|
||||||
while (flNode && flNode->FirstChild())
|
while (flNode && flNode->FirstChildElement())
|
||||||
{
|
{
|
||||||
TiXmlText* pText = flNode->FirstChild()->ToText();
|
XMLText* pText = flNode->FirstChildElement()->ToText();
|
||||||
// printf("value = %s\n",pText->Value());
|
// printf("value = %s\n",pText->Value());
|
||||||
btVector3FloatData vec4 = TextToVector3Data(pText->Value());
|
btVector3FloatData vec4 = TextToVector3Data(pText->Value());
|
||||||
vectors.push_back(vec4);
|
vectors.push_back(vec4);
|
||||||
@@ -122,20 +123,20 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
|
|
||||||
|
|
||||||
#define SET_INT_VALUE(xmlnode, targetdata, argname) \
|
#define SET_INT_VALUE(xmlnode, targetdata, argname) \
|
||||||
btAssert((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement());\
|
btAssert((xmlnode)->FirstChildElement(#argname) && (xmlnode)->FirstChildElement(#argname)->ToElement());\
|
||||||
if ((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement())\
|
if ((xmlnode)->FirstChildElement(#argname) && (xmlnode)->FirstChildElement(#argname)->ToElement())\
|
||||||
(targetdata)->argname= (int)atof(xmlnode->FirstChild(#argname)->ToElement()->GetText());
|
(targetdata)->argname= (int)atof(xmlnode->FirstChildElement(#argname)->ToElement()->GetText());
|
||||||
|
|
||||||
|
|
||||||
#define SET_FLOAT_VALUE(xmlnode, targetdata, argname) \
|
#define SET_FLOAT_VALUE(xmlnode, targetdata, argname) \
|
||||||
btAssert((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement());\
|
btAssert((xmlnode)->FirstChildElement(#argname) && (xmlnode)->FirstChildElement(#argname)->ToElement());\
|
||||||
if ((xmlnode)->FirstChild(#argname) && (xmlnode)->FirstChild(#argname)->ToElement())\
|
if ((xmlnode)->FirstChildElement(#argname) && (xmlnode)->FirstChildElement(#argname)->ToElement())\
|
||||||
(targetdata)->argname= (float)atof(xmlnode->FirstChild(#argname)->ToElement()->GetText());
|
(targetdata)->argname= (float)atof(xmlnode->FirstChildElement(#argname)->ToElement()->GetText());
|
||||||
|
|
||||||
|
|
||||||
#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype) \
|
#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype) \
|
||||||
{\
|
{\
|
||||||
TiXmlNode* node = xmlnode->FirstChild(#argname);\
|
XMLNode* node = xmlnode->FirstChildElement(#argname);\
|
||||||
btAssert(node);\
|
btAssert(node);\
|
||||||
if (node)\
|
if (node)\
|
||||||
{\
|
{\
|
||||||
@@ -148,11 +149,11 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
|
|
||||||
#define SET_VECTOR4_VALUE(xmlnode, targetdata, argname) \
|
#define SET_VECTOR4_VALUE(xmlnode, targetdata, argname) \
|
||||||
{\
|
{\
|
||||||
TiXmlNode* flNode = xmlnode->FirstChild(#argname);\
|
XMLNode* flNode = xmlnode->FirstChildElement(#argname);\
|
||||||
btAssert(flNode);\
|
btAssert(flNode);\
|
||||||
if (flNode && flNode->FirstChild())\
|
if (flNode && flNode->FirstChildElement())\
|
||||||
{\
|
{\
|
||||||
const char* txt= flNode->FirstChild()->ToElement()->GetText();\
|
const char* txt= flNode->FirstChildElement()->ToElement()->GetText();\
|
||||||
btVector3FloatData vec4 = TextToVector3Data(txt);\
|
btVector3FloatData vec4 = TextToVector3Data(txt);\
|
||||||
(targetdata)->argname.m_floats[0] = vec4.m_floats[0];\
|
(targetdata)->argname.m_floats[0] = vec4.m_floats[0];\
|
||||||
(targetdata)->argname.m_floats[1] = vec4.m_floats[1];\
|
(targetdata)->argname.m_floats[1] = vec4.m_floats[1];\
|
||||||
@@ -164,22 +165,22 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
|
|
||||||
#define SET_MATRIX33_VALUE(n, targetdata, argname) \
|
#define SET_MATRIX33_VALUE(n, targetdata, argname) \
|
||||||
{\
|
{\
|
||||||
TiXmlNode* xmlnode = n->FirstChild(#argname);\
|
XMLNode* xmlnode = n->FirstChildElement(#argname);\
|
||||||
btAssert(xmlnode);\
|
btAssert(xmlnode);\
|
||||||
if (xmlnode)\
|
if (xmlnode)\
|
||||||
{\
|
{\
|
||||||
TiXmlNode* eleNode = xmlnode->FirstChild("m_el");\
|
XMLNode* eleNode = xmlnode->FirstChildElement("m_el");\
|
||||||
btAssert(eleNode);\
|
btAssert(eleNode);\
|
||||||
if (eleNode&& eleNode->FirstChild())\
|
if (eleNode&& eleNode->FirstChildElement())\
|
||||||
{\
|
{\
|
||||||
const char* txt= eleNode->FirstChild()->ToElement()->GetText();\
|
const char* txt= eleNode->FirstChildElement()->ToElement()->GetText();\
|
||||||
btVector3FloatData vec4 = TextToVector3Data(txt);\
|
btVector3FloatData vec4 = TextToVector3Data(txt);\
|
||||||
(targetdata)->argname.m_el[0].m_floats[0] = vec4.m_floats[0];\
|
(targetdata)->argname.m_el[0].m_floats[0] = vec4.m_floats[0];\
|
||||||
(targetdata)->argname.m_el[0].m_floats[1] = vec4.m_floats[1];\
|
(targetdata)->argname.m_el[0].m_floats[1] = vec4.m_floats[1];\
|
||||||
(targetdata)->argname.m_el[0].m_floats[2] = vec4.m_floats[2];\
|
(targetdata)->argname.m_el[0].m_floats[2] = vec4.m_floats[2];\
|
||||||
(targetdata)->argname.m_el[0].m_floats[3] = vec4.m_floats[3];\
|
(targetdata)->argname.m_el[0].m_floats[3] = vec4.m_floats[3];\
|
||||||
\
|
\
|
||||||
TiXmlNode* n1 = eleNode->FirstChild()->NextSibling();\
|
XMLNode* n1 = eleNode->FirstChildElement()->NextSibling();\
|
||||||
btAssert(n1);\
|
btAssert(n1);\
|
||||||
if (n1)\
|
if (n1)\
|
||||||
{\
|
{\
|
||||||
@@ -190,7 +191,7 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
(targetdata)->argname.m_el[1].m_floats[2] = vec4.m_floats[2];\
|
(targetdata)->argname.m_el[1].m_floats[2] = vec4.m_floats[2];\
|
||||||
(targetdata)->argname.m_el[1].m_floats[3] = vec4.m_floats[3];\
|
(targetdata)->argname.m_el[1].m_floats[3] = vec4.m_floats[3];\
|
||||||
\
|
\
|
||||||
TiXmlNode* n2 = n1->NextSibling();\
|
XMLNode* n2 = n1->NextSibling();\
|
||||||
btAssert(n2);\
|
btAssert(n2);\
|
||||||
if (n2)\
|
if (n2)\
|
||||||
{\
|
{\
|
||||||
@@ -208,7 +209,7 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
|
|
||||||
#define SET_TRANSFORM_VALUE(n, targetdata, argname) \
|
#define SET_TRANSFORM_VALUE(n, targetdata, argname) \
|
||||||
{\
|
{\
|
||||||
TiXmlNode* trNode = n->FirstChild(#argname);\
|
XMLNode* trNode = n->FirstChildElement(#argname);\
|
||||||
btAssert(trNode);\
|
btAssert(trNode);\
|
||||||
if (trNode)\
|
if (trNode)\
|
||||||
{\
|
{\
|
||||||
@@ -218,7 +219,7 @@ void btBulletXmlWorldImporter::deSerializeVector3FloatData(TiXmlNode* pParent,bt
|
|||||||
}\
|
}\
|
||||||
|
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeCollisionShapeData(TiXmlNode* pParent, btCollisionShapeData* colShapeData)
|
void btBulletXmlWorldImporter::deSerializeCollisionShapeData(XMLNode* pParent, btCollisionShapeData* colShapeData)
|
||||||
{
|
{
|
||||||
SET_INT_VALUE(pParent,colShapeData,m_shapeType)
|
SET_INT_VALUE(pParent,colShapeData,m_shapeType)
|
||||||
colShapeData->m_name = 0;
|
colShapeData->m_name = 0;
|
||||||
@@ -226,17 +227,17 @@ void btBulletXmlWorldImporter::deSerializeCollisionShapeData(TiXmlNode* pParent,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
|
|
||||||
btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16);
|
btConvexHullShapeData* convexHullData = (btConvexHullShapeData*)btAlignedAlloc(sizeof(btConvexHullShapeData), 16);
|
||||||
|
|
||||||
TiXmlNode* xmlConvexInt = pParent->FirstChild("m_convexInternalShapeData");
|
XMLNode* xmlConvexInt = pParent->FirstChildElement("m_convexInternalShapeData");
|
||||||
btAssert(xmlConvexInt);
|
btAssert(xmlConvexInt);
|
||||||
|
|
||||||
TiXmlNode* xmlColShape = xmlConvexInt ->FirstChild("m_collisionShapeData");
|
XMLNode* xmlColShape = xmlConvexInt ->FirstChildElement("m_collisionShapeData");
|
||||||
btAssert(xmlColShape);
|
btAssert(xmlColShape);
|
||||||
|
|
||||||
deSerializeCollisionShapeData(xmlColShape,&convexHullData->m_convexInternalShapeData.m_collisionShapeData);
|
deSerializeCollisionShapeData(xmlColShape,&convexHullData->m_convexInternalShapeData.m_collisionShapeData);
|
||||||
@@ -249,7 +250,7 @@ void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent
|
|||||||
//#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype)
|
//#define SET_POINTER_VALUE(xmlnode, targetdata, argname, pointertype)
|
||||||
|
|
||||||
{
|
{
|
||||||
TiXmlNode* node = pParent->FirstChild("m_unscaledPointsFloatPtr");
|
XMLNode* node = pParent->FirstChildElement("m_unscaledPointsFloatPtr");
|
||||||
btAssert(node);
|
btAssert(node);
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
@@ -268,7 +269,7 @@ void btBulletXmlWorldImporter::deSerializeConvexHullShapeData(TiXmlNode* pParent
|
|||||||
m_pointerLookup.insert(cast.m_ptr,convexHullData);
|
m_pointerLookup.insert(cast.m_ptr,convexHullData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
@@ -276,10 +277,10 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
|
|||||||
int numChildren = 0;
|
int numChildren = 0;
|
||||||
btAlignedObjectArray<btCompoundShapeChildData>* compoundChildArrayPtr = new btAlignedObjectArray<btCompoundShapeChildData>;
|
btAlignedObjectArray<btCompoundShapeChildData>* compoundChildArrayPtr = new btAlignedObjectArray<btCompoundShapeChildData>;
|
||||||
{
|
{
|
||||||
TiXmlNode* transNode = pParent->FirstChild("m_transform");
|
XMLNode* transNode = pParent->FirstChildElement("m_transform");
|
||||||
TiXmlNode* colShapeNode = pParent->FirstChild("m_childShape");
|
XMLNode* colShapeNode = pParent->FirstChildElement("m_childShape");
|
||||||
TiXmlNode* marginNode = pParent->FirstChild("m_childMargin");
|
XMLNode* marginNode = pParent->FirstChildElement("m_childMargin");
|
||||||
TiXmlNode* childTypeNode = pParent->FirstChild("m_childShapeType");
|
XMLNode* childTypeNode = pParent->FirstChildElement("m_childShapeType");
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
while (transNode && colShapeNode && marginNode && childTypeNode)
|
while (transNode && colShapeNode && marginNode && childTypeNode)
|
||||||
@@ -305,10 +306,10 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
|
|||||||
compoundChildArrayPtr->at(i).m_childMargin = (float)atof(marginNode->ToElement()->GetText());
|
compoundChildArrayPtr->at(i).m_childMargin = (float)atof(marginNode->ToElement()->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
transNode = transNode->NextSibling("m_transform");
|
transNode = transNode->NextSiblingElement("m_transform");
|
||||||
colShapeNode = colShapeNode->NextSibling("m_childShape");
|
colShapeNode = colShapeNode->NextSiblingElement("m_childShape");
|
||||||
marginNode = marginNode->NextSibling("m_childMargin");
|
marginNode = marginNode->NextSiblingElement("m_childMargin");
|
||||||
childTypeNode = childTypeNode->NextSibling("m_childShapeType");
|
childTypeNode = childTypeNode->NextSiblingElement("m_childShapeType");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,24 +327,24 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeChildData(TiXmlNode* pPar
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeCompoundShapeData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
|
|
||||||
btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16);
|
btCompoundShapeData* compoundData = (btCompoundShapeData*) btAlignedAlloc(sizeof(btCompoundShapeData),16);
|
||||||
|
|
||||||
TiXmlNode* xmlColShape = pParent ->FirstChild("m_collisionShapeData");
|
XMLNode* xmlColShape = pParent ->FirstChildElement("m_collisionShapeData");
|
||||||
btAssert(xmlColShape);
|
btAssert(xmlColShape);
|
||||||
deSerializeCollisionShapeData(xmlColShape,&compoundData->m_collisionShapeData);
|
deSerializeCollisionShapeData(xmlColShape,&compoundData->m_collisionShapeData);
|
||||||
|
|
||||||
SET_INT_VALUE(pParent, compoundData,m_numChildShapes);
|
SET_INT_VALUE(pParent, compoundData,m_numChildShapes);
|
||||||
|
|
||||||
TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData");
|
XMLNode* xmlShapeData = pParent->FirstChildElement("m_collisionShapeData");
|
||||||
btAssert(xmlShapeData );
|
btAssert(xmlShapeData );
|
||||||
|
|
||||||
{
|
{
|
||||||
TiXmlNode* node = pParent->FirstChild("m_childShapePtr");\
|
XMLNode* node = pParent->FirstChildElement("m_childShapePtr");\
|
||||||
btAssert(node);
|
btAssert(node);
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -351,7 +352,7 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
|
|||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
cast.m_int = (int) atof(txt);
|
cast.m_int = (int) atof(txt);
|
||||||
compoundData->m_childShapePtr = (btCompoundShapeChildData*) cast.m_ptr;
|
compoundData->m_childShapePtr = (btCompoundShapeChildData*) cast.m_ptr;
|
||||||
node = node->NextSibling("m_childShapePtr");
|
node = node->NextSiblingElement("m_childShapePtr");
|
||||||
}
|
}
|
||||||
//SET_POINTER_VALUE(xmlColShape, *compoundData,m_childShapePtr,btCompoundShapeChildData*);
|
//SET_POINTER_VALUE(xmlColShape, *compoundData,m_childShapePtr,btCompoundShapeChildData*);
|
||||||
|
|
||||||
@@ -363,14 +364,14 @@ void btBulletXmlWorldImporter::deSerializeCompoundShapeData(TiXmlNode* pParent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
|
|
||||||
btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16);
|
btStaticPlaneShapeData* planeData = (btStaticPlaneShapeData*) btAlignedAlloc(sizeof(btStaticPlaneShapeData),16);
|
||||||
|
|
||||||
TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData");
|
XMLNode* xmlShapeData = pParent->FirstChildElement("m_collisionShapeData");
|
||||||
btAssert(xmlShapeData );
|
btAssert(xmlShapeData );
|
||||||
deSerializeCollisionShapeData(xmlShapeData,&planeData->m_collisionShapeData);
|
deSerializeCollisionShapeData(xmlShapeData,&planeData->m_collisionShapeData);
|
||||||
|
|
||||||
@@ -383,7 +384,7 @@ void btBulletXmlWorldImporter::deSerializeStaticPlaneShapeData(TiXmlNode* pParen
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
btContactSolverInfo solverInfo;
|
btContactSolverInfo solverInfo;
|
||||||
//btVector3 gravity(0,0,0);
|
//btVector3 gravity(0,0,0);
|
||||||
@@ -393,7 +394,7 @@ void btBulletXmlWorldImporter::deSerializeDynamicsWorldData(TiXmlNode* pParent)
|
|||||||
//gravity and world info
|
//gravity and world info
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
@@ -402,7 +403,7 @@ void btBulletXmlWorldImporter::deSerializeConvexInternalShapeData(TiXmlNode* pPa
|
|||||||
btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16);
|
btConvexInternalShapeData* convexShape = (btConvexInternalShapeData*) btAlignedAlloc(sizeof(btConvexInternalShapeData),16);
|
||||||
memset(convexShape,0,sizeof(btConvexInternalShapeData));
|
memset(convexShape,0,sizeof(btConvexInternalShapeData));
|
||||||
|
|
||||||
TiXmlNode* xmlShapeData = pParent->FirstChild("m_collisionShapeData");
|
XMLNode* xmlShapeData = pParent->FirstChildElement("m_collisionShapeData");
|
||||||
btAssert(xmlShapeData );
|
btAssert(xmlShapeData );
|
||||||
|
|
||||||
deSerializeCollisionShapeData(xmlShapeData,&convexShape->m_collisionShapeData);
|
deSerializeCollisionShapeData(xmlShapeData,&convexShape->m_collisionShapeData);
|
||||||
@@ -433,7 +434,7 @@ enum btTypedConstraintType
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
get_int_attribute_by_name(pParent->ToElement(),"pointer",&cast.m_int);
|
||||||
@@ -441,7 +442,7 @@ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* p
|
|||||||
btGeneric6DofConstraintData2* dof6Data = (btGeneric6DofConstraintData2*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData2),16);
|
btGeneric6DofConstraintData2* dof6Data = (btGeneric6DofConstraintData2*)btAlignedAlloc(sizeof(btGeneric6DofConstraintData2),16);
|
||||||
|
|
||||||
|
|
||||||
TiXmlNode* n = pParent->FirstChild("m_typeConstraintData");
|
XMLNode* n = pParent->FirstChildElement("m_typeConstraintData");
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbA,btRigidBodyData*);
|
SET_POINTER_VALUE(n,dof6Data->m_typeConstraintData,m_rbA,btRigidBodyData*);
|
||||||
@@ -473,7 +474,7 @@ void btBulletXmlWorldImporter::deSerializeGeneric6DofConstraintData(TiXmlNode* p
|
|||||||
m_pointerLookup.insert(cast.m_ptr,dof6Data);
|
m_pointerLookup.insert(cast.m_ptr,dof6Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
MyLocalCaster cast;
|
MyLocalCaster cast;
|
||||||
|
|
||||||
@@ -485,7 +486,7 @@ void btBulletXmlWorldImporter::deSerializeRigidBodyFloatData(TiXmlNode* pParent)
|
|||||||
|
|
||||||
btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16);
|
btRigidBodyData* rbData = (btRigidBodyData*)btAlignedAlloc(sizeof(btRigidBodyData),16);
|
||||||
|
|
||||||
TiXmlNode* n = pParent->FirstChild("m_collisionObjectData");
|
XMLNode* n = pParent->FirstChildElement("m_collisionObjectData");
|
||||||
|
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
@@ -661,14 +662,14 @@ void btBulletXmlWorldImporter::fixupCollisionDataPointers(btCollisionShapeData*
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::auto_serialize_root_level_children(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
int numChildren = 0;
|
int numChildren = 0;
|
||||||
btAssert(pParent);
|
btAssert(pParent);
|
||||||
if (pParent)
|
if (pParent)
|
||||||
{
|
{
|
||||||
TiXmlNode*pChild;
|
XMLNode*pChild;
|
||||||
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling(), numChildren++)
|
for ( pChild = pParent->FirstChildElement(); pChild != 0; pChild = pChild->NextSibling(), numChildren++)
|
||||||
{
|
{
|
||||||
// printf("child Name=%s\n", pChild->Value());
|
// printf("child Name=%s\n", pChild->Value());
|
||||||
if (!strcmp(pChild->Value(),"btVector3FloatData"))
|
if (!strcmp(pChild->Value(),"btVector3FloatData"))
|
||||||
@@ -848,15 +849,15 @@ void btBulletXmlWorldImporter::auto_serialize_root_level_children(TiXmlNode* pPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void btBulletXmlWorldImporter::auto_serialize(TiXmlNode* pParent)
|
void btBulletXmlWorldImporter::auto_serialize(XMLNode* pParent)
|
||||||
{
|
{
|
||||||
// TiXmlElement* root = pParent->FirstChildElement("bullet_physics");
|
// XMLElement* root = pParent->FirstChildElement("bullet_physics");
|
||||||
if (pParent)
|
if (pParent)
|
||||||
{
|
{
|
||||||
TiXmlNode*pChild;
|
XMLNode*pChild;
|
||||||
for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling())
|
for ( pChild = pParent->FirstChildElement(); pChild != 0; pChild = pChild->NextSibling())
|
||||||
{
|
{
|
||||||
if (pChild->Type()==TiXmlNode::TINYXML_ELEMENT)
|
//if (pChild->Type()==XMLNode::TINYXML_ELEMENT)
|
||||||
{
|
{
|
||||||
// printf("root Name=%s\n", pChild->Value());
|
// printf("root Name=%s\n", pChild->Value());
|
||||||
auto_serialize_root_level_children(pChild);
|
auto_serialize_root_level_children(pChild);
|
||||||
@@ -873,9 +874,9 @@ void btBulletXmlWorldImporter::auto_serialize(TiXmlNode* pParent)
|
|||||||
|
|
||||||
bool btBulletXmlWorldImporter::loadFile(const char* fileName)
|
bool btBulletXmlWorldImporter::loadFile(const char* fileName)
|
||||||
{
|
{
|
||||||
TiXmlDocument doc(fileName);
|
XMLDocument doc;
|
||||||
|
|
||||||
bool loadOkay = doc.LoadFile();
|
bool loadOkay = doc.LoadFile(fileName);
|
||||||
//dump_to_stdout(&doc,0);
|
//dump_to_stdout(&doc,0);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ subject to the following restrictions:
|
|||||||
#include "LinearMath/btScalar.h"
|
#include "LinearMath/btScalar.h"
|
||||||
|
|
||||||
class btDynamicsWorld;
|
class btDynamicsWorld;
|
||||||
class TiXmlNode;
|
|
||||||
|
namespace tinyxml2
|
||||||
|
{
|
||||||
|
class XMLNode;
|
||||||
|
};
|
||||||
|
|
||||||
struct btConvexInternalShapeData;
|
struct btConvexInternalShapeData;
|
||||||
struct btCollisionShapeData;
|
struct btCollisionShapeData;
|
||||||
#ifdef BT_USE_DOUBLE_PRECISION
|
#ifdef BT_USE_DOUBLE_PRECISION
|
||||||
@@ -40,6 +45,8 @@ struct btCompoundShapeChildData;
|
|||||||
#include "LinearMath/btAlignedObjectArray.h"
|
#include "LinearMath/btAlignedObjectArray.h"
|
||||||
#include "btWorldImporter.h"
|
#include "btWorldImporter.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class btBulletXmlWorldImporter : public btWorldImporter
|
class btBulletXmlWorldImporter : public btWorldImporter
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -52,28 +59,28 @@ protected:
|
|||||||
int m_fileVersion;
|
int m_fileVersion;
|
||||||
bool m_fileOk;
|
bool m_fileOk;
|
||||||
|
|
||||||
void auto_serialize_root_level_children(TiXmlNode* pParent);
|
void auto_serialize_root_level_children(tinyxml2::XMLNode* pParent);
|
||||||
void auto_serialize(TiXmlNode* pParent);
|
void auto_serialize(tinyxml2::XMLNode* pParent);
|
||||||
|
|
||||||
void deSerializeVector3FloatData(TiXmlNode* pParent,btAlignedObjectArray<btVector3FloatData>& vectors);
|
void deSerializeVector3FloatData(tinyxml2::XMLNode* pParent,btAlignedObjectArray<btVector3FloatData>& vectors);
|
||||||
|
|
||||||
void fixupCollisionDataPointers(btCollisionShapeData* shapeData);
|
void fixupCollisionDataPointers(btCollisionShapeData* shapeData);
|
||||||
void fixupConstraintData(btTypedConstraintData2* tcd);
|
void fixupConstraintData(btTypedConstraintData2* tcd);
|
||||||
|
|
||||||
//collision shapes data
|
//collision shapes data
|
||||||
void deSerializeCollisionShapeData(TiXmlNode* pParent,btCollisionShapeData* colShapeData);
|
void deSerializeCollisionShapeData(tinyxml2::XMLNode* pParent,btCollisionShapeData* colShapeData);
|
||||||
void deSerializeConvexInternalShapeData(TiXmlNode* pParent);
|
void deSerializeConvexInternalShapeData(tinyxml2::XMLNode* pParent);
|
||||||
void deSerializeStaticPlaneShapeData(TiXmlNode* pParent);
|
void deSerializeStaticPlaneShapeData(tinyxml2::XMLNode* pParent);
|
||||||
void deSerializeCompoundShapeData(TiXmlNode* pParent);
|
void deSerializeCompoundShapeData(tinyxml2::XMLNode* pParent);
|
||||||
void deSerializeCompoundShapeChildData(TiXmlNode* pParent);
|
void deSerializeCompoundShapeChildData(tinyxml2::XMLNode* pParent);
|
||||||
void deSerializeConvexHullShapeData(TiXmlNode* pParent);
|
void deSerializeConvexHullShapeData(tinyxml2::XMLNode* pParent);
|
||||||
void deSerializeDynamicsWorldData(TiXmlNode* parent);
|
void deSerializeDynamicsWorldData(tinyxml2::XMLNode* parent);
|
||||||
|
|
||||||
///bodies
|
///bodies
|
||||||
void deSerializeRigidBodyFloatData(TiXmlNode* pParent);
|
void deSerializeRigidBodyFloatData(tinyxml2::XMLNode* pParent);
|
||||||
|
|
||||||
///constraints
|
///constraints
|
||||||
void deSerializeGeneric6DofConstraintData(TiXmlNode* pParent);
|
void deSerializeGeneric6DofConstraintData(tinyxml2::XMLNode* pParent);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
btBulletXmlWorldImporter(btDynamicsWorld* world);
|
btBulletXmlWorldImporter(btDynamicsWorld* world);
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
includedirs {
|
includedirs {
|
||||||
"../BulletWorldImporter",
|
"../BulletWorldImporter",
|
||||||
"../BulletFileLoader",
|
"../BulletFileLoader",
|
||||||
"../../../src"
|
"../../../src",
|
||||||
|
"../../../examples/ThirdPartyLibs/tinyxml2"
|
||||||
}
|
}
|
||||||
|
|
||||||
files {
|
files {
|
||||||
"**.cpp",
|
"**.cpp",
|
||||||
"**.h"
|
"**.h",
|
||||||
|
"../../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIXML_USE_STL
|
|
||||||
|
|
||||||
#include "tinystr.h"
|
|
||||||
|
|
||||||
// Error value for find primitive
|
|
||||||
const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
|
|
||||||
|
|
||||||
|
|
||||||
// Null rep.
|
|
||||||
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
|
|
||||||
|
|
||||||
|
|
||||||
void TiXmlString::reserve (size_type cap)
|
|
||||||
{
|
|
||||||
if (cap > capacity())
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.init(length(), cap);
|
|
||||||
memcpy(tmp.start(), data(), length());
|
|
||||||
swap(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString& TiXmlString::assign(const char* str, size_type len)
|
|
||||||
{
|
|
||||||
size_type cap = capacity();
|
|
||||||
if (len > cap || cap > 3*(len + 8))
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.init(len);
|
|
||||||
memcpy(tmp.start(), str, len);
|
|
||||||
swap(tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memmove(start(), str, len);
|
|
||||||
set_size(len);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString& TiXmlString::append(const char* str, size_type len)
|
|
||||||
{
|
|
||||||
size_type newsize = length() + len;
|
|
||||||
if (newsize > capacity())
|
|
||||||
{
|
|
||||||
reserve (newsize + capacity());
|
|
||||||
}
|
|
||||||
memmove(finish(), str, len);
|
|
||||||
set_size(newsize);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.reserve(a.length() + b.length());
|
|
||||||
tmp += a;
|
|
||||||
tmp += b;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const char* b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
|
|
||||||
tmp.reserve(a.length() + b_len);
|
|
||||||
tmp += a;
|
|
||||||
tmp.append(b, b_len);
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString operator + (const char* a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
|
|
||||||
tmp.reserve(a_len + b.length());
|
|
||||||
tmp.append(a, a_len);
|
|
||||||
tmp += b;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // TIXML_USE_STL
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIXML_USE_STL
|
|
||||||
|
|
||||||
#ifndef TIXML_STRING_INCLUDED
|
|
||||||
#define TIXML_STRING_INCLUDED
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* The support for explicit isn't that universal, and it isn't really
|
|
||||||
required - it is used to check that the TiXmlString class isn't incorrectly
|
|
||||||
used. Be nice to old compilers and macro it here:
|
|
||||||
*/
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
|
|
||||||
// Microsoft visual studio, version 6 and higher.
|
|
||||||
#define TIXML_EXPLICIT explicit
|
|
||||||
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
|
|
||||||
// GCC version 3 and higher.s
|
|
||||||
#define TIXML_EXPLICIT explicit
|
|
||||||
#else
|
|
||||||
#define TIXML_EXPLICIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
TiXmlString is an emulation of a subset of the std::string template.
|
|
||||||
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
|
|
||||||
Only the member functions relevant to the TinyXML project have been implemented.
|
|
||||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
|
||||||
a string and there's no more room, we allocate a buffer twice as big as we need.
|
|
||||||
*/
|
|
||||||
class TiXmlString
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
// The size type used
|
|
||||||
typedef size_t size_type;
|
|
||||||
|
|
||||||
// Error value for find primitive
|
|
||||||
static const size_type npos; // = -1;
|
|
||||||
|
|
||||||
|
|
||||||
// TiXmlString empty constructor
|
|
||||||
TiXmlString () : rep_(&nullrep_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString copy constructor
|
|
||||||
TiXmlString ( const TiXmlString & copy) : rep_(0)
|
|
||||||
{
|
|
||||||
init(copy.length());
|
|
||||||
memcpy(start(), copy.data(), length());
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString constructor, based on a string
|
|
||||||
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
|
|
||||||
{
|
|
||||||
init( static_cast<size_type>( strlen(copy) ));
|
|
||||||
memcpy(start(), copy, length());
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString constructor, based on a string
|
|
||||||
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
|
|
||||||
{
|
|
||||||
init(len);
|
|
||||||
memcpy(start(), str, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString destructor
|
|
||||||
~TiXmlString ()
|
|
||||||
{
|
|
||||||
quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString& operator = (const char * copy)
|
|
||||||
{
|
|
||||||
return assign( copy, (size_type)strlen(copy));
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString& operator = (const TiXmlString & copy)
|
|
||||||
{
|
|
||||||
return assign(copy.start(), copy.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (const char * suffix)
|
|
||||||
{
|
|
||||||
return append(suffix, static_cast<size_type>( strlen(suffix) ));
|
|
||||||
}
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (char single)
|
|
||||||
{
|
|
||||||
return append(&single, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (const TiXmlString & suffix)
|
|
||||||
{
|
|
||||||
return append(suffix.data(), suffix.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert a TiXmlString into a null-terminated char *
|
|
||||||
const char * c_str () const { return rep_->str; }
|
|
||||||
|
|
||||||
// Convert a TiXmlString into a char * (need not be null terminated).
|
|
||||||
const char * data () const { return rep_->str; }
|
|
||||||
|
|
||||||
// Return the length of a TiXmlString
|
|
||||||
size_type length () const { return rep_->size; }
|
|
||||||
|
|
||||||
// Alias for length()
|
|
||||||
size_type size () const { return rep_->size; }
|
|
||||||
|
|
||||||
// Checks if a TiXmlString is empty
|
|
||||||
bool empty () const { return rep_->size == 0; }
|
|
||||||
|
|
||||||
// Return capacity of string
|
|
||||||
size_type capacity () const { return rep_->capacity; }
|
|
||||||
|
|
||||||
|
|
||||||
// single char extraction
|
|
||||||
const char& at (size_type index) const
|
|
||||||
{
|
|
||||||
assert( index < length() );
|
|
||||||
return rep_->str[ index ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// [] operator
|
|
||||||
char& operator [] (size_type index) const
|
|
||||||
{
|
|
||||||
assert( index < length() );
|
|
||||||
return rep_->str[ index ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a char in a string. Return TiXmlString::npos if not found
|
|
||||||
size_type find (char lookup) const
|
|
||||||
{
|
|
||||||
return find(lookup, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a char in a string from an offset. Return TiXmlString::npos if not found
|
|
||||||
size_type find (char tofind, size_type offset) const
|
|
||||||
{
|
|
||||||
if (offset >= length()) return npos;
|
|
||||||
|
|
||||||
for (const char* p = c_str() + offset; *p != '\0'; ++p)
|
|
||||||
{
|
|
||||||
if (*p == tofind) return static_cast< size_type >( p - c_str() );
|
|
||||||
}
|
|
||||||
return npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear ()
|
|
||||||
{
|
|
||||||
//Lee:
|
|
||||||
//The original was just too strange, though correct:
|
|
||||||
// TiXmlString().swap(*this);
|
|
||||||
//Instead use the quit & re-init:
|
|
||||||
quit();
|
|
||||||
init(0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
|
|
||||||
function DOES NOT clear the content of the TiXmlString if any exists.
|
|
||||||
*/
|
|
||||||
void reserve (size_type cap);
|
|
||||||
|
|
||||||
TiXmlString& assign (const char* str, size_type len);
|
|
||||||
|
|
||||||
TiXmlString& append (const char* str, size_type len);
|
|
||||||
|
|
||||||
void swap (TiXmlString& other)
|
|
||||||
{
|
|
||||||
Rep* r = rep_;
|
|
||||||
rep_ = other.rep_;
|
|
||||||
other.rep_ = r;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void init(size_type sz) { init(sz, sz); }
|
|
||||||
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
|
|
||||||
char* start() const { return rep_->str; }
|
|
||||||
char* finish() const { return rep_->str + rep_->size; }
|
|
||||||
|
|
||||||
struct Rep
|
|
||||||
{
|
|
||||||
size_type size, capacity;
|
|
||||||
char str[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
void init(size_type sz, size_type cap)
|
|
||||||
{
|
|
||||||
if (cap)
|
|
||||||
{
|
|
||||||
// Lee: the original form:
|
|
||||||
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
|
|
||||||
// doesn't work in some cases of new being overloaded. Switching
|
|
||||||
// to the normal allocation, although use an 'int' for systems
|
|
||||||
// that are overly picky about structure alignment.
|
|
||||||
const size_type bytesNeeded = sizeof(Rep) + cap;
|
|
||||||
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
|
|
||||||
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
|
|
||||||
|
|
||||||
rep_->str[ rep_->size = sz ] = '\0';
|
|
||||||
rep_->capacity = cap;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rep_ = &nullrep_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
if (rep_ != &nullrep_)
|
|
||||||
{
|
|
||||||
// The rep_ is really an array of ints. (see the allocator, above).
|
|
||||||
// Cast it back before delete, so the compiler won't incorrectly call destructors.
|
|
||||||
delete [] ( reinterpret_cast<int*>( rep_ ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rep * rep_;
|
|
||||||
static Rep nullrep_;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
return ( a.length() == b.length() ) // optimization on some platforms
|
|
||||||
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
|
|
||||||
}
|
|
||||||
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
return strcmp(a.c_str(), b.c_str()) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
|
|
||||||
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
|
|
||||||
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
|
|
||||||
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
|
|
||||||
|
|
||||||
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
|
|
||||||
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
|
|
||||||
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
|
|
||||||
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const char* b);
|
|
||||||
TiXmlString operator + (const char* a, const TiXmlString & b);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
|
|
||||||
Only the operators that we need for TinyXML have been developped.
|
|
||||||
*/
|
|
||||||
class TiXmlOutStream : public TiXmlString
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
// TiXmlOutStream << operator.
|
|
||||||
TiXmlOutStream & operator << (const TiXmlString & in)
|
|
||||||
{
|
|
||||||
*this += in;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlOutStream << operator.
|
|
||||||
TiXmlOutStream & operator << (const char * in)
|
|
||||||
{
|
|
||||||
*this += in;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif // TIXML_STRING_INCLUDED
|
|
||||||
#endif // TIXML_USE_STL
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "tinyxml.h"
|
|
||||||
|
|
||||||
// The goal of the seperate error file is to make the first
|
|
||||||
// step towards localization. tinyxml (currently) only supports
|
|
||||||
// english error messages, but the could now be translated.
|
|
||||||
//
|
|
||||||
// It also cleans up the code a bit.
|
|
||||||
//
|
|
||||||
|
|
||||||
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
|
|
||||||
{
|
|
||||||
"No error",
|
|
||||||
"Error",
|
|
||||||
"Failed to open file",
|
|
||||||
"Error parsing Element.",
|
|
||||||
"Failed to read Element name",
|
|
||||||
"Error reading Element value.",
|
|
||||||
"Error reading Attributes.",
|
|
||||||
"Error: empty tag.",
|
|
||||||
"Error reading end tag.",
|
|
||||||
"Error parsing Unknown.",
|
|
||||||
"Error parsing Comment.",
|
|
||||||
"Error parsing Declaration.",
|
|
||||||
"Error document empty.",
|
|
||||||
"Error null (0) or unexpected EOF found in input stream.",
|
|
||||||
"Error parsing CDATA.",
|
|
||||||
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
|
|
||||||
};
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -338,15 +338,8 @@ SET(BulletExampleBrowser_SRCS
|
|||||||
../ThirdPartyLibs/stb_image/stb_image.h
|
../ThirdPartyLibs/stb_image/stb_image.h
|
||||||
|
|
||||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
../ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
|
|
||||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
InProcessExampleBrowser.cpp
|
InProcessExampleBrowser.cpp
|
||||||
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -164,14 +164,11 @@ project "App_BulletExampleBrowser"
|
|||||||
"../RigidBody/RigidBodySoftContact.cpp",
|
"../RigidBody/RigidBodySoftContact.cpp",
|
||||||
"../ThirdPartyLibs/stb_image/*",
|
"../ThirdPartyLibs/stb_image/*",
|
||||||
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.*",
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.*",
|
||||||
"../ThirdPartyLibs/tinyxml/*",
|
|
||||||
"../ThirdPartyLibs/BussIK/*",
|
"../ThirdPartyLibs/BussIK/*",
|
||||||
"../GyroscopicDemo/GyroscopicSetup.cpp",
|
"../GyroscopicDemo/GyroscopicSetup.cpp",
|
||||||
"../GyroscopicDemo/GyroscopicSetup.h",
|
"../GyroscopicDemo/GyroscopicSetup.h",
|
||||||
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
"../ThirdPartyLibs/tinyxml2/tinyxml2.h",
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
}
|
}
|
||||||
if (hasCL and findOpenGL3()) then
|
if (hasCL and findOpenGL3()) then
|
||||||
files {
|
files {
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ subject to the following restrictions:
|
|||||||
#include <stdio.h> //fopen
|
#include <stdio.h> //fopen
|
||||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../../ThirdPartyLibs/tinyxml/tinyxml.h"
|
#include "../../ThirdPartyLibs/tinyxml2/tinyxml2.h"
|
||||||
|
using namespace tinyxml2;
|
||||||
|
|
||||||
#include "Bullet3Common/b3FileUtils.h"
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
#include "LinearMath/btHashMap.h"
|
#include "LinearMath/btHashMap.h"
|
||||||
@@ -90,14 +91,14 @@ void tokenize(const std::string& str, AddToken& tokenAdder, const std::string& d
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void readFloatArray(TiXmlElement* source, btAlignedObjectArray<float>& floatArray, int& componentStride)
|
void readFloatArray(XMLElement* source, btAlignedObjectArray<float>& floatArray, int& componentStride)
|
||||||
{
|
{
|
||||||
int numVals, stride;
|
int numVals, stride;
|
||||||
TiXmlElement* array = source->FirstChildElement("float_array");
|
XMLElement* array = source->FirstChildElement("float_array");
|
||||||
if(array)
|
if(array)
|
||||||
{
|
{
|
||||||
componentStride = 1;
|
componentStride = 1;
|
||||||
if (source->FirstChildElement("technique_common")->FirstChildElement("accessor")->QueryIntAttribute("stride", &stride)!= TIXML_NO_ATTRIBUTE)
|
if (source->FirstChildElement("technique_common")->FirstChildElement("accessor")->QueryIntAttribute("stride", &stride)!= XML_NO_ATTRIBUTE)
|
||||||
{
|
{
|
||||||
componentStride = stride;
|
componentStride = stride;
|
||||||
}
|
}
|
||||||
@@ -140,11 +141,11 @@ btVector4 getVector4FromXmlText(const char* text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGraphicsShape>& visualShapes, btHashMap<btHashString,int>& name2Shape, float extraScaling)
|
void readLibraryGeometries(XMLDocument& doc, btAlignedObjectArray<GLInstanceGraphicsShape>& visualShapes, btHashMap<btHashString,int>& name2Shape, float extraScaling)
|
||||||
{
|
{
|
||||||
btHashMap<btHashString,TiXmlElement* > allSources;
|
btHashMap<btHashString,XMLElement* > allSources;
|
||||||
btHashMap<btHashString,VertexSource> vertexSources;
|
btHashMap<btHashString,VertexSource> vertexSources;
|
||||||
for(TiXmlElement* geometry = doc.RootElement()->FirstChildElement("library_geometries")->FirstChildElement("geometry");
|
for(XMLElement* geometry = doc.RootElement()->FirstChildElement("library_geometries")->FirstChildElement("geometry");
|
||||||
geometry != NULL; geometry = geometry->NextSiblingElement("geometry"))
|
geometry != NULL; geometry = geometry->NextSiblingElement("geometry"))
|
||||||
{
|
{
|
||||||
btAlignedObjectArray<btVector3> vertexPositions;
|
btAlignedObjectArray<btVector3> vertexPositions;
|
||||||
@@ -152,11 +153,11 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
btAlignedObjectArray<int> indices;
|
btAlignedObjectArray<int> indices;
|
||||||
|
|
||||||
const char* geometryName = geometry->Attribute("id");
|
const char* geometryName = geometry->Attribute("id");
|
||||||
for (TiXmlElement* mesh = geometry->FirstChildElement("mesh");(mesh != NULL); mesh = mesh->NextSiblingElement("mesh"))
|
for (XMLElement* mesh = geometry->FirstChildElement("mesh");(mesh != NULL); mesh = mesh->NextSiblingElement("mesh"))
|
||||||
{
|
{
|
||||||
TiXmlElement* vertices2 = mesh->FirstChildElement("vertices");
|
XMLElement* vertices2 = mesh->FirstChildElement("vertices");
|
||||||
|
|
||||||
for (TiXmlElement* source = mesh->FirstChildElement("source");source != NULL;source = source->NextSiblingElement("source"))
|
for (XMLElement* source = mesh->FirstChildElement("source");source != NULL;source = source->NextSiblingElement("source"))
|
||||||
{
|
{
|
||||||
const char* srcId= source->Attribute("id");
|
const char* srcId= source->Attribute("id");
|
||||||
// printf("source id=%s\n",srcId);
|
// printf("source id=%s\n",srcId);
|
||||||
@@ -165,7 +166,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
const char* vertexId = vertices2->Attribute("id");
|
const char* vertexId = vertices2->Attribute("id");
|
||||||
//printf("vertices id=%s\n",vertexId);
|
//printf("vertices id=%s\n",vertexId);
|
||||||
VertexSource vs;
|
VertexSource vs;
|
||||||
for(TiXmlElement* input = vertices2->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input"))
|
for(XMLElement* input = vertices2->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input"))
|
||||||
{
|
{
|
||||||
const char* sem = input->Attribute("semantic");
|
const char* sem = input->Attribute("semantic");
|
||||||
std::string semName(sem);
|
std::string semName(sem);
|
||||||
@@ -187,7 +188,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
}
|
}
|
||||||
vertexSources.insert(vertexId,vs);
|
vertexSources.insert(vertexId,vs);
|
||||||
|
|
||||||
for (TiXmlElement* primitive = mesh->FirstChildElement("triangles"); primitive; primitive = primitive->NextSiblingElement("triangles"))
|
for (XMLElement* primitive = mesh->FirstChildElement("triangles"); primitive; primitive = primitive->NextSiblingElement("triangles"))
|
||||||
{
|
{
|
||||||
std::string positionSourceName;
|
std::string positionSourceName;
|
||||||
std::string normalSourceName;
|
std::string normalSourceName;
|
||||||
@@ -199,7 +200,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
int numIndices = 0;
|
int numIndices = 0;
|
||||||
{
|
{
|
||||||
|
|
||||||
for (TiXmlElement* input = primitive->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input"))
|
for (XMLElement* input = primitive->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input"))
|
||||||
{
|
{
|
||||||
const char* sem = input->Attribute("semantic");
|
const char* sem = input->Attribute("semantic");
|
||||||
std::string semName(sem);
|
std::string semName(sem);
|
||||||
@@ -241,7 +242,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
}
|
}
|
||||||
btAlignedObjectArray<float> positionFloatArray;
|
btAlignedObjectArray<float> positionFloatArray;
|
||||||
int posStride=1;
|
int posStride=1;
|
||||||
TiXmlElement** sourcePtr = allSources[positionSourceName.c_str()];
|
XMLElement** sourcePtr = allSources[positionSourceName.c_str()];
|
||||||
if (sourcePtr)
|
if (sourcePtr)
|
||||||
{
|
{
|
||||||
readFloatArray(*sourcePtr,positionFloatArray, posStride);
|
readFloatArray(*sourcePtr,positionFloatArray, posStride);
|
||||||
@@ -334,7 +335,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray<GLInstanceGr
|
|||||||
}//for each geometry
|
}//for each geometry
|
||||||
}
|
}
|
||||||
|
|
||||||
void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, const btMatrix4x4& parentTransMat)
|
void readNodeHierarchy(XMLElement* node,btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances, const btMatrix4x4& parentTransMat)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -343,7 +344,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
|
|
||||||
///todo(erwincoumans) we probably have to read the elements 'translate', 'scale', 'rotate' and 'matrix' in-order and accumulate them...
|
///todo(erwincoumans) we probably have to read the elements 'translate', 'scale', 'rotate' and 'matrix' in-order and accumulate them...
|
||||||
{
|
{
|
||||||
for (TiXmlElement* transElem = node->FirstChildElement("matrix");transElem;transElem=node->NextSiblingElement("matrix"))
|
for (XMLElement* transElem = node->FirstChildElement("matrix");transElem;transElem=node->NextSiblingElement("matrix"))
|
||||||
{
|
{
|
||||||
if (transElem->GetText())
|
if (transElem->GetText())
|
||||||
{
|
{
|
||||||
@@ -367,7 +368,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
for (TiXmlElement* transElem = node->FirstChildElement("translate");transElem;transElem=node->NextSiblingElement("translate"))
|
for (XMLElement* transElem = node->FirstChildElement("translate");transElem;transElem=node->NextSiblingElement("translate"))
|
||||||
{
|
{
|
||||||
if (transElem->GetText())
|
if (transElem->GetText())
|
||||||
{
|
{
|
||||||
@@ -381,7 +382,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
for(TiXmlElement* scaleElem = node->FirstChildElement("scale");
|
for(XMLElement* scaleElem = node->FirstChildElement("scale");
|
||||||
scaleElem!= NULL; scaleElem= node->NextSiblingElement("scale"))
|
scaleElem!= NULL; scaleElem= node->NextSiblingElement("scale"))
|
||||||
{
|
{
|
||||||
if (scaleElem->GetText())
|
if (scaleElem->GetText())
|
||||||
@@ -394,7 +395,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
for(TiXmlElement* rotateElem = node->FirstChildElement("rotate");
|
for(XMLElement* rotateElem = node->FirstChildElement("rotate");
|
||||||
rotateElem!= NULL; rotateElem= node->NextSiblingElement("rotate"))
|
rotateElem!= NULL; rotateElem= node->NextSiblingElement("rotate"))
|
||||||
{
|
{
|
||||||
if (rotateElem->GetText())
|
if (rotateElem->GetText())
|
||||||
@@ -411,7 +412,7 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
|
|
||||||
nodeTrans = parentTransMat*nodeTrans;
|
nodeTrans = parentTransMat*nodeTrans;
|
||||||
|
|
||||||
for (TiXmlElement* instanceGeom = node->FirstChildElement("instance_geometry");
|
for (XMLElement* instanceGeom = node->FirstChildElement("instance_geometry");
|
||||||
instanceGeom!=0;
|
instanceGeom!=0;
|
||||||
instanceGeom=instanceGeom->NextSiblingElement("instance_geometry"))
|
instanceGeom=instanceGeom->NextSiblingElement("instance_geometry"))
|
||||||
{
|
{
|
||||||
@@ -432,22 +433,22 @@ void readNodeHierarchy(TiXmlElement* node,btHashMap<btHashString,int>& name2Shap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(TiXmlElement* childNode = node->FirstChildElement("node");
|
for(XMLElement* childNode = node->FirstChildElement("node");
|
||||||
childNode!= NULL; childNode = childNode->NextSiblingElement("node"))
|
childNode!= NULL; childNode = childNode->NextSiblingElement("node"))
|
||||||
{
|
{
|
||||||
readNodeHierarchy(childNode,name2Shape,visualShapeInstances, nodeTrans);
|
readNodeHierarchy(childNode,name2Shape,visualShapeInstances, nodeTrans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void readVisualSceneInstanceGeometries(TiXmlDocument& doc, btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances)
|
void readVisualSceneInstanceGeometries(XMLDocument& doc, btHashMap<btHashString,int>& name2Shape, btAlignedObjectArray<ColladaGraphicsInstance>& visualShapeInstances)
|
||||||
{
|
{
|
||||||
btHashMap<btHashString,TiXmlElement* > allVisualScenes;
|
btHashMap<btHashString,XMLElement* > allVisualScenes;
|
||||||
|
|
||||||
TiXmlElement* libVisualScenes = doc.RootElement()->FirstChildElement("library_visual_scenes");
|
XMLElement* libVisualScenes = doc.RootElement()->FirstChildElement("library_visual_scenes");
|
||||||
if (libVisualScenes==0)
|
if (libVisualScenes==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
{
|
{
|
||||||
for(TiXmlElement* scene = libVisualScenes->FirstChildElement("visual_scene");
|
for(XMLElement* scene = libVisualScenes->FirstChildElement("visual_scene");
|
||||||
scene != NULL; scene = scene->NextSiblingElement("visual_scene"))
|
scene != NULL; scene = scene->NextSiblingElement("visual_scene"))
|
||||||
{
|
{
|
||||||
const char* sceneName = scene->Attribute("id");
|
const char* sceneName = scene->Attribute("id");
|
||||||
@@ -455,16 +456,16 @@ void readVisualSceneInstanceGeometries(TiXmlDocument& doc, btHashMap<btHashStrin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement* scene = 0;
|
XMLElement* scene = 0;
|
||||||
{
|
{
|
||||||
TiXmlElement* scenes = doc.RootElement()->FirstChildElement("scene");
|
XMLElement* scenes = doc.RootElement()->FirstChildElement("scene");
|
||||||
if (scenes)
|
if (scenes)
|
||||||
{
|
{
|
||||||
TiXmlElement* instanceSceneReference = scenes->FirstChildElement("instance_visual_scene");
|
XMLElement* instanceSceneReference = scenes->FirstChildElement("instance_visual_scene");
|
||||||
if (instanceSceneReference)
|
if (instanceSceneReference)
|
||||||
{
|
{
|
||||||
const char* instanceSceneUrl = instanceSceneReference->Attribute("url");
|
const char* instanceSceneUrl = instanceSceneReference->Attribute("url");
|
||||||
TiXmlElement** sceneInstancePtr = allVisualScenes[instanceSceneUrl+1];//skip #
|
XMLElement** sceneInstancePtr = allVisualScenes[instanceSceneUrl+1];//skip #
|
||||||
if (sceneInstancePtr)
|
if (sceneInstancePtr)
|
||||||
{
|
{
|
||||||
scene = *sceneInstancePtr;
|
scene = *sceneInstancePtr;
|
||||||
@@ -475,7 +476,7 @@ void readVisualSceneInstanceGeometries(TiXmlDocument& doc, btHashMap<btHashStrin
|
|||||||
|
|
||||||
if (scene)
|
if (scene)
|
||||||
{
|
{
|
||||||
for(TiXmlElement* node = scene->FirstChildElement("node");
|
for(XMLElement* node = scene->FirstChildElement("node");
|
||||||
node != NULL; node = node->NextSiblingElement("node"))
|
node != NULL; node = node->NextSiblingElement("node"))
|
||||||
{
|
{
|
||||||
btMatrix4x4 identity;
|
btMatrix4x4 identity;
|
||||||
@@ -488,11 +489,11 @@ void readVisualSceneInstanceGeometries(TiXmlDocument& doc, btHashMap<btHashStrin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getUnitMeterScalingAndUpAxisTransform(TiXmlDocument& doc, btTransform& tr, float& unitMeterScaling, int clientUpAxis)
|
void getUnitMeterScalingAndUpAxisTransform(XMLDocument& doc, btTransform& tr, float& unitMeterScaling, int clientUpAxis)
|
||||||
{
|
{
|
||||||
///todo(erwincoumans) those up-axis transformations have been quickly coded without rigorous testing
|
///todo(erwincoumans) those up-axis transformations have been quickly coded without rigorous testing
|
||||||
|
|
||||||
TiXmlElement* unitMeter = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("unit");
|
XMLElement* unitMeter = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("unit");
|
||||||
if (unitMeter)
|
if (unitMeter)
|
||||||
{
|
{
|
||||||
const char* meterText = unitMeter->Attribute("meter");
|
const char* meterText = unitMeter->Attribute("meter");
|
||||||
@@ -500,7 +501,7 @@ void getUnitMeterScalingAndUpAxisTransform(TiXmlDocument& doc, btTransform& tr,
|
|||||||
unitMeterScaling = atof(meterText);
|
unitMeterScaling = atof(meterText);
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement* upAxisElem = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("up_axis");
|
XMLElement* upAxisElem = doc.RootElement()->FirstChildElement("asset")->FirstChildElement("up_axis");
|
||||||
if (upAxisElem)
|
if (upAxisElem)
|
||||||
{
|
{
|
||||||
switch (clientUpAxis)
|
switch (clientUpAxis)
|
||||||
@@ -573,8 +574,8 @@ void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray<GLIn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlDocument doc(filename);
|
XMLDocument doc;
|
||||||
if (!doc.LoadFile())
|
if (!doc.LoadFile(filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//We need units to be in meter, so apply a scaling using the asset/units meter
|
//We need units to be in meter, so apply a scaling using the asset/units meter
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "BulletMJCFImporter.h"
|
#include "BulletMJCFImporter.h"
|
||||||
#include "../../ThirdPartyLibs/tinyxml/tinyxml.h"
|
#include "../../ThirdPartyLibs/tinyxml2/tinyxml2.h"
|
||||||
#include "Bullet3Common/b3FileUtils.h"
|
#include "Bullet3Common/b3FileUtils.h"
|
||||||
#include "Bullet3Common/b3HashMap.h"
|
#include "Bullet3Common/b3HashMap.h"
|
||||||
#include "LinearMath/btQuickprof.h"
|
#include "LinearMath/btQuickprof.h"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
|
#include "BulletCollision/CollisionShapes/btConvexHullShape.h"
|
||||||
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
|
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
|
||||||
#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
|
#include "BulletCollision/CollisionShapes/btTriangleMesh.h"
|
||||||
|
using namespace tinyxml2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sourceFileLocation(TiXmlElement* e)
|
std::string sourceFileLocation(XMLElement* e)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
//no C++11 snprintf etc
|
//no C++11 snprintf etc
|
||||||
@@ -241,7 +241,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
return buf;
|
return buf;
|
||||||
#else
|
#else
|
||||||
char row[1024];
|
char row[1024];
|
||||||
sprintf(row,"%d",e->Row());
|
sprintf(row,"%d",e->GetLineNum());
|
||||||
std::string str = m_sourceFileName.c_str() + std::string(":") + std::string(row);
|
std::string str = m_sourceFileName.c_str() + std::string(":") + std::string(row);
|
||||||
return str;
|
return str;
|
||||||
#endif
|
#endif
|
||||||
@@ -261,7 +261,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseCompiler(TiXmlElement* root_xml, MJCFErrorLogger* logger)
|
void parseCompiler(XMLElement* root_xml, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
const char* meshDirStr = root_xml->Attribute("meshdir");
|
const char* meshDirStr = root_xml->Attribute("meshdir");
|
||||||
@@ -284,10 +284,10 @@ struct BulletMJCFImporterInternalData
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseAssets(TiXmlElement* root_xml, MJCFErrorLogger* logger)
|
void parseAssets(XMLElement* root_xml, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
// <mesh name="index0" file="index0.stl"/>
|
// <mesh name="index0" file="index0.stl"/>
|
||||||
for (TiXmlElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement())
|
for (XMLElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement())
|
||||||
{
|
{
|
||||||
std::string n = child_xml->Value();
|
std::string n = child_xml->Value();
|
||||||
if (n=="mesh")
|
if (n=="mesh")
|
||||||
@@ -307,11 +307,11 @@ struct BulletMJCFImporterInternalData
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool parseDefaults(MyMJCFDefaults& defaults, TiXmlElement* root_xml, MJCFErrorLogger* logger)
|
bool parseDefaults(MyMJCFDefaults& defaults, XMLElement* root_xml, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
bool handled= false;
|
bool handled= false;
|
||||||
//rudimentary 'default' support, would need more work for better feature coverage
|
//rudimentary 'default' support, would need more work for better feature coverage
|
||||||
for (TiXmlElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement())
|
for (XMLElement* child_xml = root_xml->FirstChildElement() ; child_xml ; child_xml = child_xml->NextSiblingElement())
|
||||||
{
|
{
|
||||||
std::string n = child_xml->Value();
|
std::string n = child_xml->Value();
|
||||||
|
|
||||||
@@ -413,9 +413,9 @@ struct BulletMJCFImporterInternalData
|
|||||||
handled=true;
|
handled=true;
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
bool parseRootLevel(MyMJCFDefaults& defaults, TiXmlElement* root_xml,MJCFErrorLogger* logger)
|
bool parseRootLevel(MyMJCFDefaults& defaults, XMLElement* root_xml,MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
for (TiXmlElement* rootxml = root_xml->FirstChildElement() ; rootxml ; rootxml = rootxml->NextSiblingElement())
|
for (XMLElement* rootxml = root_xml->FirstChildElement() ; rootxml ; rootxml = rootxml->NextSiblingElement())
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
std::string n = rootxml->Value();
|
std::string n = rootxml->Value();
|
||||||
@@ -473,7 +473,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parseJoint(MyMJCFDefaults& defaults, TiXmlElement* link_xml, int modelIndex, int parentLinkIndex, int linkIndex, MJCFErrorLogger* logger, const btTransform& parentToLinkTrans, btTransform& jointTransOut)
|
bool parseJoint(MyMJCFDefaults& defaults, XMLElement* link_xml, int modelIndex, int parentLinkIndex, int linkIndex, MJCFErrorLogger* logger, const btTransform& parentToLinkTrans, btTransform& jointTransOut)
|
||||||
{
|
{
|
||||||
bool jointHandled = false;
|
bool jointHandled = false;
|
||||||
const char* jType = link_xml->Attribute("type");
|
const char* jType = link_xml->Attribute("type");
|
||||||
@@ -649,7 +649,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
*/
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool parseGeom(MyMJCFDefaults& defaults, TiXmlElement* link_xml, int modelIndex, int linkIndex, MJCFErrorLogger* logger, btVector3& inertialShift)
|
bool parseGeom(MyMJCFDefaults& defaults, XMLElement* link_xml, int modelIndex, int linkIndex, MJCFErrorLogger* logger, btVector3& inertialShift)
|
||||||
{
|
{
|
||||||
UrdfLink** linkPtrPtr = m_models[modelIndex]->m_links.getAtIndex(linkIndex);
|
UrdfLink** linkPtrPtr = m_models[modelIndex]->m_links.getAtIndex(linkIndex);
|
||||||
if (linkPtrPtr==0)
|
if (linkPtrPtr==0)
|
||||||
@@ -963,7 +963,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
return handledGeomType;
|
return handledGeomType;
|
||||||
}
|
}
|
||||||
|
|
||||||
btTransform parseTransform(TiXmlElement* link_xml, MJCFErrorLogger* logger)
|
btTransform parseTransform(XMLElement* link_xml, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
btTransform tr;
|
btTransform tr;
|
||||||
tr.setIdentity();
|
tr.setIdentity();
|
||||||
@@ -1090,7 +1090,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
return orgChildLinkIndex;
|
return orgChildLinkIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool parseBody(MyMJCFDefaults& defaults, TiXmlElement* link_xml, int modelIndex, int orgParentLinkIndex, MJCFErrorLogger* logger)
|
bool parseBody(MyMJCFDefaults& defaults, XMLElement* link_xml, int modelIndex, int orgParentLinkIndex, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
MyMJCFDefaults curDefaults = defaults;
|
MyMJCFDefaults curDefaults = defaults;
|
||||||
|
|
||||||
@@ -1142,7 +1142,7 @@ struct BulletMJCFImporterInternalData
|
|||||||
jointTrans.setIdentity();
|
jointTrans.setIdentity();
|
||||||
bool skipFixedJoint = false;
|
bool skipFixedJoint = false;
|
||||||
|
|
||||||
for (TiXmlElement* xml = link_xml->FirstChildElement() ; xml ; xml = xml->NextSiblingElement())
|
for (XMLElement* xml = link_xml->FirstChildElement() ; xml ; xml = xml->NextSiblingElement())
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
std::string n = xml->Value();
|
std::string n = xml->Value();
|
||||||
@@ -1482,16 +1482,16 @@ bool BulletMJCFImporter::loadMJCF(const char* fileName, MJCFErrorLogger* logger,
|
|||||||
|
|
||||||
bool BulletMJCFImporter::parseMJCFString(const char* xmlText, MJCFErrorLogger* logger)
|
bool BulletMJCFImporter::parseMJCFString(const char* xmlText, MJCFErrorLogger* logger)
|
||||||
{
|
{
|
||||||
TiXmlDocument xml_doc;
|
XMLDocument xml_doc;
|
||||||
xml_doc.Parse(xmlText);
|
xml_doc.Parse(xmlText);
|
||||||
if (xml_doc.Error())
|
if (xml_doc.Error())
|
||||||
{
|
{
|
||||||
logger->reportError(xml_doc.ErrorDesc());
|
logger->reportError(xml_doc.ErrorStr());
|
||||||
xml_doc.ClearError();
|
xml_doc.ClearError();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *mujoco_xml = xml_doc.FirstChildElement("mujoco");
|
XMLElement *mujoco_xml = xml_doc.FirstChildElement("mujoco");
|
||||||
if (!mujoco_xml)
|
if (!mujoco_xml)
|
||||||
{
|
{
|
||||||
logger->reportWarning("Cannot find <mujoco> root element");
|
logger->reportWarning("Cannot find <mujoco> root element");
|
||||||
@@ -1507,28 +1507,28 @@ bool BulletMJCFImporter::parseMJCFString(const char* xmlText, MJCFErrorLogger* l
|
|||||||
//<compiler>,<option>,<size>,<default>,<body>,<keyframe>,<contactpair>,
|
//<compiler>,<option>,<size>,<default>,<body>,<keyframe>,<contactpair>,
|
||||||
//<light>, <camera>,<constraint>,<tendon>,<actuator>,<customfield>,<textfield>
|
//<light>, <camera>,<constraint>,<tendon>,<actuator>,<customfield>,<textfield>
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = mujoco_xml->FirstChildElement("default"); link_xml; link_xml = link_xml->NextSiblingElement("default"))
|
for (XMLElement* link_xml = mujoco_xml->FirstChildElement("default"); link_xml; link_xml = link_xml->NextSiblingElement("default"))
|
||||||
{
|
{
|
||||||
m_data->parseDefaults(m_data->m_globalDefaults,link_xml,logger);
|
m_data->parseDefaults(m_data->m_globalDefaults,link_xml,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = mujoco_xml->FirstChildElement("compiler"); link_xml; link_xml = link_xml->NextSiblingElement("compiler"))
|
for (XMLElement* link_xml = mujoco_xml->FirstChildElement("compiler"); link_xml; link_xml = link_xml->NextSiblingElement("compiler"))
|
||||||
{
|
{
|
||||||
m_data->parseCompiler(link_xml,logger);
|
m_data->parseCompiler(link_xml,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = mujoco_xml->FirstChildElement("asset"); link_xml; link_xml = link_xml->NextSiblingElement("asset"))
|
for (XMLElement* link_xml = mujoco_xml->FirstChildElement("asset"); link_xml; link_xml = link_xml->NextSiblingElement("asset"))
|
||||||
{
|
{
|
||||||
m_data->parseAssets(link_xml,logger);
|
m_data->parseAssets(link_xml,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = mujoco_xml->FirstChildElement("body"); link_xml; link_xml = link_xml->NextSiblingElement("body"))
|
for (XMLElement* link_xml = mujoco_xml->FirstChildElement("body"); link_xml; link_xml = link_xml->NextSiblingElement("body"))
|
||||||
{
|
{
|
||||||
m_data->parseRootLevel(m_data->m_globalDefaults, link_xml,logger);
|
m_data->parseRootLevel(m_data->m_globalDefaults, link_xml,logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = mujoco_xml->FirstChildElement("worldbody"); link_xml; link_xml = link_xml->NextSiblingElement("worldbody"))
|
for (XMLElement* link_xml = mujoco_xml->FirstChildElement("worldbody"); link_xml; link_xml = link_xml->NextSiblingElement("worldbody"))
|
||||||
{
|
{
|
||||||
m_data->parseRootLevel(m_data->m_globalDefaults, link_xml,logger);
|
m_data->parseRootLevel(m_data->m_globalDefaults, link_xml,logger);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "UrdfParser.h"
|
#include "UrdfParser.h"
|
||||||
|
|
||||||
#include "../../ThirdPartyLibs/tinyxml/tinyxml.h"
|
#include "../../ThirdPartyLibs/tinyxml2/tinyxml2.h"
|
||||||
#include "urdfStringSplit.h"
|
#include "urdfStringSplit.h"
|
||||||
#include "urdfLexicalCast.h"
|
#include "urdfLexicalCast.h"
|
||||||
|
using namespace tinyxml2;
|
||||||
|
|
||||||
UrdfParser::UrdfParser()
|
UrdfParser::UrdfParser()
|
||||||
:m_parseSDF(false),
|
:m_parseSDF(false),
|
||||||
@@ -74,7 +75,7 @@ static bool parseVector3(btVector3& vec3, const std::string& vector_str, ErrorLo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseMaterial(UrdfMaterial& material, TiXmlElement *config, ErrorLogger* logger)
|
bool UrdfParser::parseMaterial(UrdfMaterial& material, XMLElement *config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!config->Attribute("name"))
|
if (!config->Attribute("name"))
|
||||||
@@ -86,7 +87,7 @@ bool UrdfParser::parseMaterial(UrdfMaterial& material, TiXmlElement *config, Err
|
|||||||
material.m_name = config->Attribute("name");
|
material.m_name = config->Attribute("name");
|
||||||
|
|
||||||
// texture
|
// texture
|
||||||
TiXmlElement *t = config->FirstChildElement("texture");
|
XMLElement *t = config->FirstChildElement("texture");
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
if (t->Attribute("filename"))
|
if (t->Attribute("filename"))
|
||||||
@@ -102,7 +103,7 @@ bool UrdfParser::parseMaterial(UrdfMaterial& material, TiXmlElement *config, Err
|
|||||||
|
|
||||||
// color
|
// color
|
||||||
{
|
{
|
||||||
TiXmlElement *c = config->FirstChildElement("color");
|
XMLElement *c = config->FirstChildElement("color");
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
if (c->Attribute("rgba"))
|
if (c->Attribute("rgba"))
|
||||||
@@ -118,7 +119,7 @@ bool UrdfParser::parseMaterial(UrdfMaterial& material, TiXmlElement *config, Err
|
|||||||
|
|
||||||
{
|
{
|
||||||
// specular (non-standard)
|
// specular (non-standard)
|
||||||
TiXmlElement *s = config->FirstChildElement("specular");
|
XMLElement *s = config->FirstChildElement("specular");
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
if (s->Attribute("rgb"))
|
if (s->Attribute("rgb"))
|
||||||
@@ -133,7 +134,7 @@ bool UrdfParser::parseMaterial(UrdfMaterial& material, TiXmlElement *config, Err
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseTransform(btTransform& tr, TiXmlElement* xml, ErrorLogger* logger, bool parseSDF )
|
bool UrdfParser::parseTransform(btTransform& tr, XMLElement* xml, ErrorLogger* logger, bool parseSDF )
|
||||||
{
|
{
|
||||||
tr.setIdentity();
|
tr.setIdentity();
|
||||||
|
|
||||||
@@ -207,13 +208,13 @@ bool UrdfParser::parseTransform(btTransform& tr, TiXmlElement* xml, ErrorLogger*
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorLogger* logger)
|
bool UrdfParser::parseInertia(UrdfInertia& inertia, XMLElement* config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
inertia.m_linkLocalFrame.setIdentity();
|
inertia.m_linkLocalFrame.setIdentity();
|
||||||
inertia.m_mass = 0.f;
|
inertia.m_mass = 0.f;
|
||||||
if(m_parseSDF)
|
if(m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement* pose = config->FirstChildElement("pose");
|
XMLElement* pose = config->FirstChildElement("pose");
|
||||||
if (pose)
|
if (pose)
|
||||||
{
|
{
|
||||||
parseTransform(inertia.m_linkLocalFrame, pose,logger,m_parseSDF);
|
parseTransform(inertia.m_linkLocalFrame, pose,logger,m_parseSDF);
|
||||||
@@ -223,7 +224,7 @@ bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorL
|
|||||||
|
|
||||||
|
|
||||||
// Origin
|
// Origin
|
||||||
TiXmlElement *o = config->FirstChildElement("origin");
|
XMLElement *o = config->FirstChildElement("origin");
|
||||||
if (o)
|
if (o)
|
||||||
{
|
{
|
||||||
if (!parseTransform(inertia.m_linkLocalFrame,o,logger))
|
if (!parseTransform(inertia.m_linkLocalFrame,o,logger))
|
||||||
@@ -232,7 +233,7 @@ bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *mass_xml = config->FirstChildElement("mass");
|
XMLElement *mass_xml = config->FirstChildElement("mass");
|
||||||
if (!mass_xml)
|
if (!mass_xml)
|
||||||
{
|
{
|
||||||
logger->reportError("Inertial element must have a mass element");
|
logger->reportError("Inertial element must have a mass element");
|
||||||
@@ -252,7 +253,7 @@ bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorL
|
|||||||
inertia.m_mass = urdfLexicalCast<double>(mass_xml->Attribute("value"));
|
inertia.m_mass = urdfLexicalCast<double>(mass_xml->Attribute("value"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *inertia_xml = config->FirstChildElement("inertia");
|
XMLElement *inertia_xml = config->FirstChildElement("inertia");
|
||||||
if (!inertia_xml)
|
if (!inertia_xml)
|
||||||
{
|
{
|
||||||
logger->reportError("Inertial element must have inertia element");
|
logger->reportError("Inertial element must have inertia element");
|
||||||
@@ -260,12 +261,12 @@ bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorL
|
|||||||
}
|
}
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement* ixx = inertia_xml->FirstChildElement("ixx");
|
XMLElement* ixx = inertia_xml->FirstChildElement("ixx");
|
||||||
TiXmlElement* ixy = inertia_xml->FirstChildElement("ixy");
|
XMLElement* ixy = inertia_xml->FirstChildElement("ixy");
|
||||||
TiXmlElement* ixz = inertia_xml->FirstChildElement("ixz");
|
XMLElement* ixz = inertia_xml->FirstChildElement("ixz");
|
||||||
TiXmlElement* iyy = inertia_xml->FirstChildElement("iyy");
|
XMLElement* iyy = inertia_xml->FirstChildElement("iyy");
|
||||||
TiXmlElement* iyz = inertia_xml->FirstChildElement("iyz");
|
XMLElement* iyz = inertia_xml->FirstChildElement("iyz");
|
||||||
TiXmlElement* izz = inertia_xml->FirstChildElement("izz");
|
XMLElement* izz = inertia_xml->FirstChildElement("izz");
|
||||||
if (ixx && ixy && ixz && iyy && iyz && izz)
|
if (ixx && ixy && ixz && iyy && iyz && izz)
|
||||||
{
|
{
|
||||||
inertia.m_ixx = urdfLexicalCast<double>(ixx->GetText());
|
inertia.m_ixx = urdfLexicalCast<double>(ixx->GetText());
|
||||||
@@ -324,20 +325,21 @@ bool UrdfParser::parseInertia(UrdfInertia& inertia, TiXmlElement* config, ErrorL
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger* logger)
|
bool UrdfParser::parseGeometry(UrdfGeometry& geom, XMLElement* g, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
// btAssert(g);
|
// btAssert(g);
|
||||||
if (g==0)
|
if (g==0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TiXmlElement *shape = g->FirstChildElement();
|
XMLElement *shape = g->FirstChildElement();
|
||||||
if (!shape)
|
if (!shape)
|
||||||
{
|
{
|
||||||
logger->reportError("Geometry tag contains no child element.");
|
logger->reportError("Geometry tag contains no child element.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string type_name = shape->ValueTStr().c_str();
|
//const std::string type_name = shape->ValueTStr().c_str();
|
||||||
|
const std::string type_name = shape->Value();
|
||||||
if (type_name == "sphere")
|
if (type_name == "sphere")
|
||||||
{
|
{
|
||||||
geom.m_type = URDF_GEOM_SPHERE;
|
geom.m_type = URDF_GEOM_SPHERE;
|
||||||
@@ -355,7 +357,7 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
geom.m_type = URDF_GEOM_BOX;
|
geom.m_type = URDF_GEOM_BOX;
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement* size = shape->FirstChildElement("size");
|
XMLElement* size = shape->FirstChildElement("size");
|
||||||
if (0==size)
|
if (0==size)
|
||||||
{
|
{
|
||||||
logger->reportError("box requires a size child element");
|
logger->reportError("box requires a size child element");
|
||||||
@@ -386,12 +388,12 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
|
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
if (TiXmlElement* scale = shape->FirstChildElement("radius"))
|
if (XMLElement* scale = shape->FirstChildElement("radius"))
|
||||||
{
|
{
|
||||||
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
||||||
geom.m_capsuleRadius = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
geom.m_capsuleRadius = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
||||||
}
|
}
|
||||||
if (TiXmlElement* scale = shape->FirstChildElement("length"))
|
if (XMLElement* scale = shape->FirstChildElement("length"))
|
||||||
{
|
{
|
||||||
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
||||||
geom.m_capsuleHeight = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
geom.m_capsuleHeight = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
||||||
@@ -413,12 +415,12 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
geom.m_hasFromTo = false;
|
geom.m_hasFromTo = false;
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
if (TiXmlElement* scale = shape->FirstChildElement("radius"))
|
if (XMLElement* scale = shape->FirstChildElement("radius"))
|
||||||
{
|
{
|
||||||
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
||||||
geom.m_capsuleRadius = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
geom.m_capsuleRadius = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
||||||
}
|
}
|
||||||
if (TiXmlElement* scale = shape->FirstChildElement("length"))
|
if (XMLElement* scale = shape->FirstChildElement("length"))
|
||||||
{
|
{
|
||||||
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
||||||
geom.m_capsuleHeight = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
geom.m_capsuleHeight = m_urdfScaling * urdfLexicalCast<double>(scale->GetText());
|
||||||
@@ -442,11 +444,11 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
|
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
if (TiXmlElement* scale = shape->FirstChildElement("scale"))
|
if (XMLElement* scale = shape->FirstChildElement("scale"))
|
||||||
{
|
{
|
||||||
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
parseVector3(geom.m_meshScale,scale->GetText(),logger);
|
||||||
}
|
}
|
||||||
if (TiXmlElement* filename = shape->FirstChildElement("uri"))
|
if (XMLElement* filename = shape->FirstChildElement("uri"))
|
||||||
{
|
{
|
||||||
fn = filename->GetText();
|
fn = filename->GetText();
|
||||||
}
|
}
|
||||||
@@ -498,8 +500,8 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
geom.m_type = URDF_GEOM_PLANE;
|
geom.m_type = URDF_GEOM_PLANE;
|
||||||
if (this->m_parseSDF)
|
if (this->m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement *n = shape->FirstChildElement("normal");
|
XMLElement *n = shape->FirstChildElement("normal");
|
||||||
TiXmlElement *s = shape->FirstChildElement("size");
|
XMLElement *s = shape->FirstChildElement("size");
|
||||||
|
|
||||||
if ((0==n)||(0==s))
|
if ((0==n)||(0==s))
|
||||||
{
|
{
|
||||||
@@ -535,14 +537,14 @@ bool UrdfParser::parseGeometry(UrdfGeometry& geom, TiXmlElement* g, ErrorLogger*
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool UrdfParser::parseCollision(UrdfCollision& collision, TiXmlElement* config, ErrorLogger* logger)
|
bool UrdfParser::parseCollision(UrdfCollision& collision, XMLElement* config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
collision.m_linkLocalFrame.setIdentity();
|
collision.m_linkLocalFrame.setIdentity();
|
||||||
|
|
||||||
if(m_parseSDF)
|
if(m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement* pose = config->FirstChildElement("pose");
|
XMLElement* pose = config->FirstChildElement("pose");
|
||||||
if (pose)
|
if (pose)
|
||||||
{
|
{
|
||||||
parseTransform(collision.m_linkLocalFrame, pose,logger,m_parseSDF);
|
parseTransform(collision.m_linkLocalFrame, pose,logger,m_parseSDF);
|
||||||
@@ -550,14 +552,14 @@ bool UrdfParser::parseCollision(UrdfCollision& collision, TiXmlElement* config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Origin
|
// Origin
|
||||||
TiXmlElement *o = config->FirstChildElement("origin");
|
XMLElement *o = config->FirstChildElement("origin");
|
||||||
if (o)
|
if (o)
|
||||||
{
|
{
|
||||||
if (!parseTransform(collision.m_linkLocalFrame, o,logger))
|
if (!parseTransform(collision.m_linkLocalFrame, o,logger))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Geometry
|
// Geometry
|
||||||
TiXmlElement *geom = config->FirstChildElement("geometry");
|
XMLElement *geom = config->FirstChildElement("geometry");
|
||||||
if (!parseGeometry(collision.m_geometry,geom,logger))
|
if (!parseGeometry(collision.m_geometry,geom,logger))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -575,12 +577,12 @@ bool UrdfParser::parseCollision(UrdfCollision& collision, TiXmlElement* config,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement* config, ErrorLogger* logger)
|
bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, XMLElement* config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
visual.m_linkLocalFrame.setIdentity();
|
visual.m_linkLocalFrame.setIdentity();
|
||||||
if(m_parseSDF)
|
if(m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement* pose = config->FirstChildElement("pose");
|
XMLElement* pose = config->FirstChildElement("pose");
|
||||||
if (pose)
|
if (pose)
|
||||||
{
|
{
|
||||||
parseTransform(visual.m_linkLocalFrame, pose,logger,m_parseSDF);
|
parseTransform(visual.m_linkLocalFrame, pose,logger,m_parseSDF);
|
||||||
@@ -588,14 +590,14 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Origin
|
// Origin
|
||||||
TiXmlElement *o = config->FirstChildElement("origin");
|
XMLElement *o = config->FirstChildElement("origin");
|
||||||
if (o)
|
if (o)
|
||||||
{
|
{
|
||||||
if (!parseTransform(visual.m_linkLocalFrame, o,logger))
|
if (!parseTransform(visual.m_linkLocalFrame, o,logger))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Geometry
|
// Geometry
|
||||||
TiXmlElement *geom = config->FirstChildElement("geometry");
|
XMLElement *geom = config->FirstChildElement("geometry");
|
||||||
if (!parseGeometry(visual.m_geometry,geom,logger))
|
if (!parseGeometry(visual.m_geometry,geom,logger))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -609,7 +611,7 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
visual.m_geometry.m_hasLocalMaterial = false;
|
visual.m_geometry.m_hasLocalMaterial = false;
|
||||||
|
|
||||||
// Material
|
// Material
|
||||||
TiXmlElement *mat = config->FirstChildElement("material");
|
XMLElement *mat = config->FirstChildElement("material");
|
||||||
//todo(erwincoumans) skip materials in SDF for now (due to complexity)
|
//todo(erwincoumans) skip materials in SDF for now (due to complexity)
|
||||||
if (mat)
|
if (mat)
|
||||||
{
|
{
|
||||||
@@ -630,7 +632,7 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
}
|
}
|
||||||
model.m_materials.insert(matPtr->m_name.c_str(),matPtr);
|
model.m_materials.insert(matPtr->m_name.c_str(),matPtr);
|
||||||
{
|
{
|
||||||
TiXmlElement *diffuse = mat->FirstChildElement("diffuse");
|
XMLElement *diffuse = mat->FirstChildElement("diffuse");
|
||||||
if (diffuse) {
|
if (diffuse) {
|
||||||
std::string diffuseText = diffuse->GetText();
|
std::string diffuseText = diffuse->GetText();
|
||||||
btVector4 rgba(1,0,0,1);
|
btVector4 rgba(1,0,0,1);
|
||||||
@@ -642,7 +644,7 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TiXmlElement *specular = mat->FirstChildElement("specular");
|
XMLElement *specular = mat->FirstChildElement("specular");
|
||||||
if (specular) {
|
if (specular) {
|
||||||
std::string specularText = specular->GetText();
|
std::string specularText = specular->GetText();
|
||||||
btVector3 rgba(1,1,1);
|
btVector3 rgba(1,1,1);
|
||||||
@@ -665,9 +667,9 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
|
|
||||||
// try to parse material element in place
|
// try to parse material element in place
|
||||||
|
|
||||||
TiXmlElement *t = mat->FirstChildElement("texture");
|
XMLElement *t = mat->FirstChildElement("texture");
|
||||||
TiXmlElement *c = mat->FirstChildElement("color");
|
XMLElement *c = mat->FirstChildElement("color");
|
||||||
TiXmlElement *s = mat->FirstChildElement("specular");
|
XMLElement *s = mat->FirstChildElement("specular");
|
||||||
if (t||c||s)
|
if (t||c||s)
|
||||||
{
|
{
|
||||||
if (parseMaterial(visual.m_geometry.m_localMaterial, mat,logger))
|
if (parseMaterial(visual.m_geometry.m_localMaterial, mat,logger))
|
||||||
@@ -692,7 +694,7 @@ bool UrdfParser::parseVisual(UrdfModel& model, UrdfVisual& visual, TiXmlElement*
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *config, ErrorLogger* logger)
|
bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, XMLElement *config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
const char* linkName = config->Attribute("name");
|
const char* linkName = config->Attribute("name");
|
||||||
if (!linkName)
|
if (!linkName)
|
||||||
@@ -705,7 +707,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
if (m_parseSDF) {
|
if (m_parseSDF) {
|
||||||
|
|
||||||
|
|
||||||
TiXmlElement* pose = config->FirstChildElement("pose");
|
XMLElement* pose = config->FirstChildElement("pose");
|
||||||
if (0==pose)
|
if (0==pose)
|
||||||
{
|
{
|
||||||
link.m_linkTransformInWorld.setIdentity();
|
link.m_linkTransformInWorld.setIdentity();
|
||||||
@@ -730,7 +732,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
</contact>
|
</contact>
|
||||||
</audio_source>
|
</audio_source>
|
||||||
#endif
|
#endif
|
||||||
TiXmlElement* ci = config->FirstChildElement("audio_source");
|
XMLElement* ci = config->FirstChildElement("audio_source");
|
||||||
if (ci)
|
if (ci)
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_flags |= SDFAudioSource::SDFAudioSourceValid;
|
link.m_audioSource.m_flags |= SDFAudioSource::SDFAudioSourceValid;
|
||||||
@@ -741,41 +743,41 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
link.m_audioSource.m_uri = fn;
|
link.m_audioSource.m_uri = fn;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (TiXmlElement* filename_xml = ci->FirstChildElement("uri"))
|
if (XMLElement* filename_xml = ci->FirstChildElement("uri"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_uri = filename_xml->GetText();
|
link.m_audioSource.m_uri = filename_xml->GetText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TiXmlElement* pitch_xml = ci->FirstChildElement("pitch"))
|
if (XMLElement* pitch_xml = ci->FirstChildElement("pitch"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_pitch = urdfLexicalCast<double>(pitch_xml->GetText());
|
link.m_audioSource.m_pitch = urdfLexicalCast<double>(pitch_xml->GetText());
|
||||||
}
|
}
|
||||||
if (TiXmlElement* gain_xml = ci->FirstChildElement("gain"))
|
if (XMLElement* gain_xml = ci->FirstChildElement("gain"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_gain = urdfLexicalCast<double>(gain_xml->GetText());
|
link.m_audioSource.m_gain = urdfLexicalCast<double>(gain_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TiXmlElement* attack_rate_xml = ci->FirstChildElement("attack_rate"))
|
if (XMLElement* attack_rate_xml = ci->FirstChildElement("attack_rate"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_attackRate = urdfLexicalCast<double>(attack_rate_xml->GetText());
|
link.m_audioSource.m_attackRate = urdfLexicalCast<double>(attack_rate_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TiXmlElement* decay_rate_xml = ci->FirstChildElement("decay_rate"))
|
if (XMLElement* decay_rate_xml = ci->FirstChildElement("decay_rate"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_decayRate = urdfLexicalCast<double>(decay_rate_xml->GetText());
|
link.m_audioSource.m_decayRate = urdfLexicalCast<double>(decay_rate_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TiXmlElement* sustain_level_xml = ci->FirstChildElement("sustain_level"))
|
if (XMLElement* sustain_level_xml = ci->FirstChildElement("sustain_level"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_sustainLevel = urdfLexicalCast<double>(sustain_level_xml->GetText());
|
link.m_audioSource.m_sustainLevel = urdfLexicalCast<double>(sustain_level_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TiXmlElement* release_rate_xml = ci->FirstChildElement("release_rate"))
|
if (XMLElement* release_rate_xml = ci->FirstChildElement("release_rate"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_releaseRate = urdfLexicalCast<double>(release_rate_xml->GetText());
|
link.m_audioSource.m_releaseRate = urdfLexicalCast<double>(release_rate_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TiXmlElement* loop_xml = ci->FirstChildElement("loop"))
|
if (XMLElement* loop_xml = ci->FirstChildElement("loop"))
|
||||||
{
|
{
|
||||||
std::string looptxt = loop_xml->GetText();
|
std::string looptxt = loop_xml->GetText();
|
||||||
if (looptxt == "true")
|
if (looptxt == "true")
|
||||||
@@ -783,7 +785,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
link.m_audioSource.m_flags |= SDFAudioSource::SDFAudioSourceLooping;
|
link.m_audioSource.m_flags |= SDFAudioSource::SDFAudioSourceLooping;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TiXmlElement* forceThreshold_xml = ci->FirstChildElement("collision_force_threshold"))
|
if (XMLElement* forceThreshold_xml = ci->FirstChildElement("collision_force_threshold"))
|
||||||
{
|
{
|
||||||
link.m_audioSource.m_collisionForceThreshold= urdfLexicalCast<double>(forceThreshold_xml->GetText());
|
link.m_audioSource.m_collisionForceThreshold= urdfLexicalCast<double>(forceThreshold_xml->GetText());
|
||||||
}
|
}
|
||||||
@@ -794,11 +796,11 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
//optional 'contact' parameters
|
//optional 'contact' parameters
|
||||||
TiXmlElement* ci = config->FirstChildElement("contact");
|
XMLElement* ci = config->FirstChildElement("contact");
|
||||||
if (ci)
|
if (ci)
|
||||||
{
|
{
|
||||||
|
|
||||||
TiXmlElement *damping_xml = ci->FirstChildElement("inertia_scaling");
|
XMLElement *damping_xml = ci->FirstChildElement("inertia_scaling");
|
||||||
if (damping_xml)
|
if (damping_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -819,7 +821,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TiXmlElement *friction_xml = ci->FirstChildElement("lateral_friction");
|
XMLElement *friction_xml = ci->FirstChildElement("lateral_friction");
|
||||||
if (friction_xml)
|
if (friction_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -839,7 +841,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TiXmlElement *rolling_xml = ci->FirstChildElement("rolling_friction");
|
XMLElement *rolling_xml = ci->FirstChildElement("rolling_friction");
|
||||||
if (rolling_xml)
|
if (rolling_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -862,7 +864,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TiXmlElement *restitution_xml = ci->FirstChildElement("restitution");
|
XMLElement *restitution_xml = ci->FirstChildElement("restitution");
|
||||||
if (restitution_xml)
|
if (restitution_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -886,7 +888,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TiXmlElement *spinning_xml = ci->FirstChildElement("spinning_friction");
|
XMLElement *spinning_xml = ci->FirstChildElement("spinning_friction");
|
||||||
if (spinning_xml)
|
if (spinning_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -908,7 +910,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
TiXmlElement *friction_anchor = ci->FirstChildElement("friction_anchor");
|
XMLElement *friction_anchor = ci->FirstChildElement("friction_anchor");
|
||||||
if (friction_anchor)
|
if (friction_anchor)
|
||||||
{
|
{
|
||||||
link.m_contactInfo.m_flags |= URDF_CONTACT_HAS_FRICTION_ANCHOR;
|
link.m_contactInfo.m_flags |= URDF_CONTACT_HAS_FRICTION_ANCHOR;
|
||||||
@@ -916,7 +918,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
||||||
TiXmlElement *stiffness_xml = ci->FirstChildElement("stiffness");
|
XMLElement *stiffness_xml = ci->FirstChildElement("stiffness");
|
||||||
if (stiffness_xml)
|
if (stiffness_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -939,7 +941,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
||||||
TiXmlElement *damping_xml = ci->FirstChildElement("damping");
|
XMLElement *damping_xml = ci->FirstChildElement("damping");
|
||||||
if (damping_xml)
|
if (damping_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -964,7 +966,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inertial (optional)
|
// Inertial (optional)
|
||||||
TiXmlElement *i = config->FirstChildElement("inertial");
|
XMLElement *i = config->FirstChildElement("inertial");
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
if (!parseInertia(link.m_inertia, i,logger))
|
if (!parseInertia(link.m_inertia, i,logger))
|
||||||
@@ -997,7 +999,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Multiple Visuals (optional)
|
// Multiple Visuals (optional)
|
||||||
for (TiXmlElement* vis_xml = config->FirstChildElement("visual"); vis_xml; vis_xml = vis_xml->NextSiblingElement("visual"))
|
for (XMLElement* vis_xml = config->FirstChildElement("visual"); vis_xml; vis_xml = vis_xml->NextSiblingElement("visual"))
|
||||||
{
|
{
|
||||||
UrdfVisual visual;
|
UrdfVisual visual;
|
||||||
visual.m_sourceFileLocation = sourceFileLocation(vis_xml);
|
visual.m_sourceFileLocation = sourceFileLocation(vis_xml);
|
||||||
@@ -1017,7 +1019,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
|
|
||||||
|
|
||||||
// Multiple Collisions (optional)
|
// Multiple Collisions (optional)
|
||||||
for (TiXmlElement* col_xml = config->FirstChildElement("collision"); col_xml; col_xml = col_xml->NextSiblingElement("collision"))
|
for (XMLElement* col_xml = config->FirstChildElement("collision"); col_xml; col_xml = col_xml->NextSiblingElement("collision"))
|
||||||
{
|
{
|
||||||
UrdfCollision col;
|
UrdfCollision col;
|
||||||
col.m_sourceFileLocation = sourceFileLocation(col_xml);
|
col.m_sourceFileLocation = sourceFileLocation(col_xml);
|
||||||
@@ -1036,7 +1038,7 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseJointLimits(UrdfJoint& joint, TiXmlElement* config, ErrorLogger* logger)
|
bool UrdfParser::parseJointLimits(UrdfJoint& joint, XMLElement* config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
joint.m_lowerLimit = 0.f;
|
joint.m_lowerLimit = 0.f;
|
||||||
joint.m_upperLimit = -1.f;
|
joint.m_upperLimit = -1.f;
|
||||||
@@ -1047,22 +1049,22 @@ bool UrdfParser::parseJointLimits(UrdfJoint& joint, TiXmlElement* config, ErrorL
|
|||||||
|
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
{
|
{
|
||||||
TiXmlElement *lower_xml = config->FirstChildElement("lower");
|
XMLElement *lower_xml = config->FirstChildElement("lower");
|
||||||
if (lower_xml) {
|
if (lower_xml) {
|
||||||
joint.m_lowerLimit = urdfLexicalCast<double>(lower_xml->GetText());
|
joint.m_lowerLimit = urdfLexicalCast<double>(lower_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *upper_xml = config->FirstChildElement("upper");
|
XMLElement *upper_xml = config->FirstChildElement("upper");
|
||||||
if (upper_xml) {
|
if (upper_xml) {
|
||||||
joint.m_upperLimit = urdfLexicalCast<double>(upper_xml->GetText());
|
joint.m_upperLimit = urdfLexicalCast<double>(upper_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *effort_xml = config->FirstChildElement("effort");
|
XMLElement *effort_xml = config->FirstChildElement("effort");
|
||||||
if (effort_xml) {
|
if (effort_xml) {
|
||||||
joint.m_effortLimit = urdfLexicalCast<double>(effort_xml->GetText());
|
joint.m_effortLimit = urdfLexicalCast<double>(effort_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *velocity_xml = config->FirstChildElement("velocity");
|
XMLElement *velocity_xml = config->FirstChildElement("velocity");
|
||||||
if (velocity_xml) {
|
if (velocity_xml) {
|
||||||
joint.m_velocityLimit = urdfLexicalCast<double>(velocity_xml->GetText());
|
joint.m_velocityLimit = urdfLexicalCast<double>(velocity_xml->GetText());
|
||||||
}
|
}
|
||||||
@@ -1105,18 +1107,18 @@ bool UrdfParser::parseJointLimits(UrdfJoint& joint, TiXmlElement* config, ErrorL
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseJointDynamics(UrdfJoint& joint, TiXmlElement* config, ErrorLogger* logger)
|
bool UrdfParser::parseJointDynamics(UrdfJoint& joint, XMLElement* config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
joint.m_jointDamping = 0;
|
joint.m_jointDamping = 0;
|
||||||
joint.m_jointFriction = 0;
|
joint.m_jointFriction = 0;
|
||||||
|
|
||||||
if (m_parseSDF) {
|
if (m_parseSDF) {
|
||||||
TiXmlElement *damping_xml = config->FirstChildElement("damping");
|
XMLElement *damping_xml = config->FirstChildElement("damping");
|
||||||
if (damping_xml) {
|
if (damping_xml) {
|
||||||
joint.m_jointDamping = urdfLexicalCast<double>(damping_xml->GetText());
|
joint.m_jointDamping = urdfLexicalCast<double>(damping_xml->GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *friction_xml = config->FirstChildElement("friction");
|
XMLElement *friction_xml = config->FirstChildElement("friction");
|
||||||
if (friction_xml) {
|
if (friction_xml) {
|
||||||
joint.m_jointFriction = urdfLexicalCast<double>(friction_xml->GetText());
|
joint.m_jointFriction = urdfLexicalCast<double>(friction_xml->GetText());
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1155,7 @@ bool UrdfParser::parseJointDynamics(UrdfJoint& joint, TiXmlElement* config, Erro
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger* logger)
|
bool UrdfParser::parseJoint(UrdfJoint& joint, XMLElement *config, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -1168,7 +1170,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
joint.m_parentLinkToJointTransform.setIdentity();
|
joint.m_parentLinkToJointTransform.setIdentity();
|
||||||
|
|
||||||
// Get transform from Parent Link to Joint Frame
|
// Get transform from Parent Link to Joint Frame
|
||||||
TiXmlElement *origin_xml = config->FirstChildElement("origin");
|
XMLElement *origin_xml = config->FirstChildElement("origin");
|
||||||
if (origin_xml)
|
if (origin_xml)
|
||||||
{
|
{
|
||||||
if (!parseTransform(joint.m_parentLinkToJointTransform, origin_xml,logger))
|
if (!parseTransform(joint.m_parentLinkToJointTransform, origin_xml,logger))
|
||||||
@@ -1180,7 +1182,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Parent Link
|
// Get Parent Link
|
||||||
TiXmlElement *parent_xml = config->FirstChildElement("parent");
|
XMLElement *parent_xml = config->FirstChildElement("parent");
|
||||||
if (parent_xml)
|
if (parent_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -1204,7 +1206,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get Child Link
|
// Get Child Link
|
||||||
TiXmlElement *child_xml = config->FirstChildElement("child");
|
XMLElement *child_xml = config->FirstChildElement("child");
|
||||||
if (child_xml)
|
if (child_xml)
|
||||||
{
|
{
|
||||||
if (m_parseSDF)
|
if (m_parseSDF)
|
||||||
@@ -1263,14 +1265,14 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
if (joint.m_type != URDFFloatingJoint && joint.m_type != URDFFixedJoint)
|
if (joint.m_type != URDFFloatingJoint && joint.m_type != URDFFixedJoint)
|
||||||
{
|
{
|
||||||
// axis
|
// axis
|
||||||
TiXmlElement *axis_xml = config->FirstChildElement("axis");
|
XMLElement *axis_xml = config->FirstChildElement("axis");
|
||||||
if (!axis_xml){
|
if (!axis_xml){
|
||||||
logger->reportWarning("urdfdom: no axis elemement for Joint, defaulting to (1,0,0) axis");
|
logger->reportWarning("urdfdom: no axis elemement for Joint, defaulting to (1,0,0) axis");
|
||||||
logger->reportWarning(joint.m_name.c_str());
|
logger->reportWarning(joint.m_name.c_str());
|
||||||
joint.m_localJointAxis.setValue(1,0,0);
|
joint.m_localJointAxis.setValue(1,0,0);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
TiXmlElement *xyz_xml = axis_xml->FirstChildElement("xyz");
|
XMLElement *xyz_xml = axis_xml->FirstChildElement("xyz");
|
||||||
if (xyz_xml) {
|
if (xyz_xml) {
|
||||||
if (!parseVector3(joint.m_localJointAxis,std::string(xyz_xml->GetText()),logger))
|
if (!parseVector3(joint.m_localJointAxis,std::string(xyz_xml->GetText()),logger))
|
||||||
{
|
{
|
||||||
@@ -1282,7 +1284,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *limit_xml = axis_xml->FirstChildElement("limit");
|
XMLElement *limit_xml = axis_xml->FirstChildElement("limit");
|
||||||
if (limit_xml)
|
if (limit_xml)
|
||||||
{
|
{
|
||||||
if (joint.m_type != URDFContinuousJoint)
|
if (joint.m_type != URDFContinuousJoint)
|
||||||
@@ -1308,7 +1310,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *prop_xml = axis_xml->FirstChildElement("dynamics");
|
XMLElement *prop_xml = axis_xml->FirstChildElement("dynamics");
|
||||||
if (prop_xml)
|
if (prop_xml)
|
||||||
{
|
{
|
||||||
if (!parseJointDynamics(joint, prop_xml,logger))
|
if (!parseJointDynamics(joint, prop_xml,logger))
|
||||||
@@ -1327,7 +1329,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
if (joint.m_type != URDFFloatingJoint && joint.m_type != URDFFixedJoint)
|
if (joint.m_type != URDFFloatingJoint && joint.m_type != URDFFixedJoint)
|
||||||
{
|
{
|
||||||
// axis
|
// axis
|
||||||
TiXmlElement *axis_xml = config->FirstChildElement("axis");
|
XMLElement *axis_xml = config->FirstChildElement("axis");
|
||||||
if (!axis_xml){
|
if (!axis_xml){
|
||||||
logger->reportWarning("urdfdom: no axis elemement for Joint, defaulting to (1,0,0) axis");
|
logger->reportWarning("urdfdom: no axis elemement for Joint, defaulting to (1,0,0) axis");
|
||||||
logger->reportWarning(joint.m_name.c_str());
|
logger->reportWarning(joint.m_name.c_str());
|
||||||
@@ -1349,7 +1351,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get limit
|
// Get limit
|
||||||
TiXmlElement *limit_xml = config->FirstChildElement("limit");
|
XMLElement *limit_xml = config->FirstChildElement("limit");
|
||||||
if (limit_xml)
|
if (limit_xml)
|
||||||
{
|
{
|
||||||
if (!parseJointLimits(joint, limit_xml,logger))
|
if (!parseJointLimits(joint, limit_xml,logger))
|
||||||
@@ -1376,7 +1378,7 @@ bool UrdfParser::parseJoint(UrdfJoint& joint, TiXmlElement *config, ErrorLogger*
|
|||||||
joint.m_jointFriction = 0;
|
joint.m_jointFriction = 0;
|
||||||
|
|
||||||
// Get Dynamics
|
// Get Dynamics
|
||||||
TiXmlElement *prop_xml = config->FirstChildElement("dynamics");
|
XMLElement *prop_xml = config->FirstChildElement("dynamics");
|
||||||
if (prop_xml)
|
if (prop_xml)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1491,16 +1493,16 @@ bool UrdfParser::initTreeAndRoot(UrdfModel& model, ErrorLogger* logger)
|
|||||||
bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceFixedBase)
|
bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceFixedBase)
|
||||||
{
|
{
|
||||||
|
|
||||||
TiXmlDocument xml_doc;
|
XMLDocument xml_doc;
|
||||||
xml_doc.Parse(urdfText);
|
xml_doc.Parse(urdfText);
|
||||||
if (xml_doc.Error())
|
if (xml_doc.Error())
|
||||||
{
|
{
|
||||||
logger->reportError(xml_doc.ErrorDesc());
|
logger->reportError(xml_doc.ErrorStr());
|
||||||
xml_doc.ClearError();
|
xml_doc.ClearError();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *robot_xml = xml_doc.FirstChildElement("robot");
|
XMLElement *robot_xml = xml_doc.FirstChildElement("robot");
|
||||||
if (!robot_xml)
|
if (!robot_xml)
|
||||||
{
|
{
|
||||||
logger->reportError("expected a robot element");
|
logger->reportError("expected a robot element");
|
||||||
@@ -1519,7 +1521,7 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceF
|
|||||||
|
|
||||||
|
|
||||||
// Get all Material elements
|
// Get all Material elements
|
||||||
for (TiXmlElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material"))
|
for (XMLElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material"))
|
||||||
{
|
{
|
||||||
UrdfMaterial* material = new UrdfMaterial;
|
UrdfMaterial* material = new UrdfMaterial;
|
||||||
|
|
||||||
@@ -1543,7 +1545,7 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceF
|
|||||||
// logger->printMessage(msg);
|
// logger->printMessage(msg);
|
||||||
|
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link"))
|
for (XMLElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link"))
|
||||||
{
|
{
|
||||||
UrdfLink* link = new UrdfLink;
|
UrdfLink* link = new UrdfLink;
|
||||||
|
|
||||||
@@ -1592,7 +1594,7 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger, bool forceF
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all Joint elements
|
// Get all Joint elements
|
||||||
for (TiXmlElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint"))
|
for (XMLElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint"))
|
||||||
{
|
{
|
||||||
UrdfJoint* joint = new UrdfJoint;
|
UrdfJoint* joint = new UrdfJoint;
|
||||||
|
|
||||||
@@ -1651,16 +1653,16 @@ void UrdfParser::activateModel(int modelIndex)
|
|||||||
bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
||||||
{
|
{
|
||||||
|
|
||||||
TiXmlDocument xml_doc;
|
XMLDocument xml_doc;
|
||||||
xml_doc.Parse(sdfText);
|
xml_doc.Parse(sdfText);
|
||||||
if (xml_doc.Error())
|
if (xml_doc.Error())
|
||||||
{
|
{
|
||||||
logger->reportError(xml_doc.ErrorDesc());
|
logger->reportError(xml_doc.ErrorStr());
|
||||||
xml_doc.ClearError();
|
xml_doc.ClearError();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TiXmlElement *sdf_xml = xml_doc.FirstChildElement("sdf");
|
XMLElement *sdf_xml = xml_doc.FirstChildElement("sdf");
|
||||||
if (!sdf_xml)
|
if (!sdf_xml)
|
||||||
{
|
{
|
||||||
logger->reportError("expected an sdf element");
|
logger->reportError("expected an sdf element");
|
||||||
@@ -1668,9 +1670,9 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//apparently, SDF doesn't require a "world" element, optional? URDF does.
|
//apparently, SDF doesn't require a "world" element, optional? URDF does.
|
||||||
TiXmlElement *world_xml = sdf_xml->FirstChildElement("world");
|
XMLElement *world_xml = sdf_xml->FirstChildElement("world");
|
||||||
|
|
||||||
TiXmlElement* robot_xml = 0;
|
XMLElement* robot_xml = 0;
|
||||||
|
|
||||||
if (!world_xml)
|
if (!world_xml)
|
||||||
{
|
{
|
||||||
@@ -1687,7 +1689,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
UrdfModel* localModel = new UrdfModel;
|
UrdfModel* localModel = new UrdfModel;
|
||||||
m_tmpModels.push_back(localModel);
|
m_tmpModels.push_back(localModel);
|
||||||
|
|
||||||
TiXmlElement* stat = robot_xml->FirstChildElement("static");
|
XMLElement* stat = robot_xml->FirstChildElement("static");
|
||||||
if (0!=stat)
|
if (0!=stat)
|
||||||
{
|
{
|
||||||
int val = int(atof(stat->GetText()));
|
int val = int(atof(stat->GetText()));
|
||||||
@@ -1707,7 +1709,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
}
|
}
|
||||||
localModel->m_name = name;
|
localModel->m_name = name;
|
||||||
|
|
||||||
TiXmlElement* pose_xml = robot_xml->FirstChildElement("pose");
|
XMLElement* pose_xml = robot_xml->FirstChildElement("pose");
|
||||||
if (0==pose_xml)
|
if (0==pose_xml)
|
||||||
{
|
{
|
||||||
localModel->m_rootTransformInWorld.setIdentity();
|
localModel->m_rootTransformInWorld.setIdentity();
|
||||||
@@ -1718,7 +1720,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all Material elements
|
// Get all Material elements
|
||||||
for (TiXmlElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material"))
|
for (XMLElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material"))
|
||||||
{
|
{
|
||||||
UrdfMaterial* material = new UrdfMaterial;
|
UrdfMaterial* material = new UrdfMaterial;
|
||||||
|
|
||||||
@@ -1742,7 +1744,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
// logger->printMessage(msg);
|
// logger->printMessage(msg);
|
||||||
|
|
||||||
|
|
||||||
for (TiXmlElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link"))
|
for (XMLElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link"))
|
||||||
{
|
{
|
||||||
UrdfLink* link = new UrdfLink;
|
UrdfLink* link = new UrdfLink;
|
||||||
|
|
||||||
@@ -1791,7 +1793,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get all Joint elements
|
// Get all Joint elements
|
||||||
for (TiXmlElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint"))
|
for (XMLElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint"))
|
||||||
{
|
{
|
||||||
UrdfJoint* joint = new UrdfJoint;
|
UrdfJoint* joint = new UrdfJoint;
|
||||||
|
|
||||||
@@ -1828,7 +1830,7 @@ bool UrdfParser::loadSDF(const char* sdfText, ErrorLogger* logger)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UrdfParser::sourceFileLocation(TiXmlElement* e)
|
std::string UrdfParser::sourceFileLocation(XMLElement* e)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
//no C++11 etc, no snprintf
|
//no C++11 etc, no snprintf
|
||||||
@@ -1838,7 +1840,7 @@ std::string UrdfParser::sourceFileLocation(TiXmlElement* e)
|
|||||||
return buf;
|
return buf;
|
||||||
#else
|
#else
|
||||||
char row[1024];
|
char row[1024];
|
||||||
sprintf(row,"%d",e->Row());
|
sprintf(row,"%d",e->GetLineNum());
|
||||||
std::string str = m_urdf2Model.m_sourceFile.c_str() + std::string(":") + std::string(row);
|
std::string str = m_urdf2Model.m_sourceFile.c_str() + std::string(":") + std::string(row);
|
||||||
return str;
|
return str;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -240,6 +240,11 @@ struct UrdfModel
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace tinyxml2
|
||||||
|
{
|
||||||
|
class XMLElement;
|
||||||
|
};
|
||||||
|
|
||||||
class UrdfParser
|
class UrdfParser
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -252,17 +257,17 @@ protected:
|
|||||||
int m_activeSdfModel;
|
int m_activeSdfModel;
|
||||||
|
|
||||||
btScalar m_urdfScaling;
|
btScalar m_urdfScaling;
|
||||||
bool parseTransform(btTransform& tr, class TiXmlElement* xml, ErrorLogger* logger, bool parseSDF = false);
|
bool parseTransform(btTransform& tr, tinyxml2::XMLElement* xml, ErrorLogger* logger, bool parseSDF = false);
|
||||||
bool parseInertia(UrdfInertia& inertia, class TiXmlElement* config, ErrorLogger* logger);
|
bool parseInertia(UrdfInertia& inertia, tinyxml2::XMLElement* config, ErrorLogger* logger);
|
||||||
bool parseGeometry(UrdfGeometry& geom, class TiXmlElement* g, ErrorLogger* logger);
|
bool parseGeometry(UrdfGeometry& geom, tinyxml2::XMLElement* g, ErrorLogger* logger);
|
||||||
bool parseVisual(UrdfModel& model, UrdfVisual& visual, class TiXmlElement* config, ErrorLogger* logger);
|
bool parseVisual(UrdfModel& model, UrdfVisual& visual, tinyxml2::XMLElement* config, ErrorLogger* logger);
|
||||||
bool parseCollision(UrdfCollision& collision, class TiXmlElement* config, ErrorLogger* logger);
|
bool parseCollision(UrdfCollision& collision, tinyxml2::XMLElement* config, ErrorLogger* logger);
|
||||||
bool initTreeAndRoot(UrdfModel& model, ErrorLogger* logger);
|
bool initTreeAndRoot(UrdfModel& model, ErrorLogger* logger);
|
||||||
bool parseMaterial(UrdfMaterial& material, class TiXmlElement *config, ErrorLogger* logger);
|
bool parseMaterial(UrdfMaterial& material, tinyxml2::XMLElement *config, ErrorLogger* logger);
|
||||||
bool parseJointLimits(UrdfJoint& joint, TiXmlElement* config, ErrorLogger* logger);
|
bool parseJointLimits(UrdfJoint& joint, tinyxml2::XMLElement* config, ErrorLogger* logger);
|
||||||
bool parseJointDynamics(UrdfJoint& joint, TiXmlElement* config, ErrorLogger* logger);
|
bool parseJointDynamics(UrdfJoint& joint, tinyxml2::XMLElement* config, ErrorLogger* logger);
|
||||||
bool parseJoint(UrdfJoint& link, TiXmlElement *config, ErrorLogger* logger);
|
bool parseJoint(UrdfJoint& link, tinyxml2::XMLElement *config, ErrorLogger* logger);
|
||||||
bool parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *config, ErrorLogger* logger);
|
bool parseLink(UrdfModel& model, UrdfLink& link, tinyxml2::XMLElement *config, ErrorLogger* logger);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -333,7 +338,7 @@ public:
|
|||||||
return m_urdf2Model;
|
return m_urdf2Model;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string sourceFileLocation(TiXmlElement* e);
|
std::string sourceFileLocation(tinyxml2::XMLElement* e);
|
||||||
|
|
||||||
void setSourceFile(const std::string& sourceFile)
|
void setSourceFile(const std::string& sourceFile)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,10 +43,7 @@ myfiles =
|
|||||||
"../../examples/Utils/b3ResourcePath.h",
|
"../../examples/Utils/b3ResourcePath.h",
|
||||||
"../../examples/Utils/RobotLoggingUtil.cpp",
|
"../../examples/Utils/RobotLoggingUtil.cpp",
|
||||||
"../../examples/Utils/RobotLoggingUtil.h",
|
"../../examples/Utils/RobotLoggingUtil.h",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
|
|||||||
@@ -77,10 +77,7 @@ SharedMemoryCommands.h
|
|||||||
../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||||
../Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
../Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
||||||
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../ThirdPartyLibs/tinyxml/tinystr.cpp
|
../ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp
|
../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp
|
||||||
../ThirdPartyLibs/stb_image/stb_image.cpp
|
../ThirdPartyLibs/stb_image/stb_image.cpp
|
||||||
../MultiThreading/b3ThreadSupportInterface.cpp
|
../MultiThreading/b3ThreadSupportInterface.cpp
|
||||||
|
|||||||
@@ -39,12 +39,8 @@ project ("pybullet_tinyRendererPlugin")
|
|||||||
"../../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../../ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
"../../../ThirdPartyLibs/stb_image/stb_image.h",
|
"../../../ThirdPartyLibs/stb_image/stb_image.h",
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinystr.h",
|
"../../../ThirdPartyLibs/tinyxml2/tinyxml2.h",
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinyxml.h",
|
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../../OpenGLWindow/SimpleCamera.cpp",
|
"../../../OpenGLWindow/SimpleCamera.cpp",
|
||||||
"../../../OpenGLWindow/SimpleCamera.h",
|
"../../../OpenGLWindow/SimpleCamera.h",
|
||||||
"../../../Utils/b3Clock.cpp",
|
"../../../Utils/b3Clock.cpp",
|
||||||
|
|||||||
@@ -91,10 +91,7 @@ myfiles =
|
|||||||
"../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
"../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
"../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
||||||
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
"../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
||||||
"../ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
|
|
||||||
|
|||||||
@@ -132,10 +132,7 @@ myfiles =
|
|||||||
"../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
"../../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
"../../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
||||||
"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
"../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
||||||
"../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,10 +126,7 @@ myfiles =
|
|||||||
"../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
"../../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
"../../Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
||||||
"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
"../../Importers/ImportMeshUtility/b3ImportMeshUtility.cpp",
|
||||||
"../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../../ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIXML_USE_STL
|
|
||||||
|
|
||||||
#include "tinystr.h"
|
|
||||||
|
|
||||||
// Error value for find primitive
|
|
||||||
const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
|
|
||||||
|
|
||||||
|
|
||||||
// Null rep.
|
|
||||||
TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
|
|
||||||
|
|
||||||
|
|
||||||
void TiXmlString::reserve (size_type cap)
|
|
||||||
{
|
|
||||||
if (cap > capacity())
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.init(length(), cap);
|
|
||||||
memcpy(tmp.start(), data(), length());
|
|
||||||
swap(tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString& TiXmlString::assign(const char* str, size_type len)
|
|
||||||
{
|
|
||||||
size_type cap = capacity();
|
|
||||||
if (len > cap || cap > 3*(len + 8))
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.init(len);
|
|
||||||
memcpy(tmp.start(), str, len);
|
|
||||||
swap(tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
memmove(start(), str, len);
|
|
||||||
set_size(len);
|
|
||||||
}
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString& TiXmlString::append(const char* str, size_type len)
|
|
||||||
{
|
|
||||||
size_type newsize = length() + len;
|
|
||||||
if (newsize > capacity())
|
|
||||||
{
|
|
||||||
reserve (newsize + capacity());
|
|
||||||
}
|
|
||||||
memmove(finish(), str, len);
|
|
||||||
set_size(newsize);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
tmp.reserve(a.length() + b.length());
|
|
||||||
tmp += a;
|
|
||||||
tmp += b;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const char* b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
|
|
||||||
tmp.reserve(a.length() + b_len);
|
|
||||||
tmp += a;
|
|
||||||
tmp.append(b, b_len);
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString operator + (const char* a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
TiXmlString tmp;
|
|
||||||
TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
|
|
||||||
tmp.reserve(a_len + b.length());
|
|
||||||
tmp.append(a, a_len);
|
|
||||||
tmp += b;
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // TIXML_USE_STL
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef TIXML_USE_STL
|
|
||||||
|
|
||||||
#ifndef TIXML_STRING_INCLUDED
|
|
||||||
#define TIXML_STRING_INCLUDED
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
/* The support for explicit isn't that universal, and it isn't really
|
|
||||||
required - it is used to check that the TiXmlString class isn't incorrectly
|
|
||||||
used. Be nice to old compilers and macro it here:
|
|
||||||
*/
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
|
|
||||||
// Microsoft visual studio, version 6 and higher.
|
|
||||||
#define TIXML_EXPLICIT explicit
|
|
||||||
#elif defined(__GNUC__) && (__GNUC__ >= 3 )
|
|
||||||
// GCC version 3 and higher.s
|
|
||||||
#define TIXML_EXPLICIT explicit
|
|
||||||
#else
|
|
||||||
#define TIXML_EXPLICIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
TiXmlString is an emulation of a subset of the std::string template.
|
|
||||||
Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
|
|
||||||
Only the member functions relevant to the TinyXML project have been implemented.
|
|
||||||
The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
|
|
||||||
a string and there's no more room, we allocate a buffer twice as big as we need.
|
|
||||||
*/
|
|
||||||
class TiXmlString
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
// The size type used
|
|
||||||
typedef size_t size_type;
|
|
||||||
|
|
||||||
// Error value for find primitive
|
|
||||||
static const size_type npos; // = -1;
|
|
||||||
|
|
||||||
|
|
||||||
// TiXmlString empty constructor
|
|
||||||
TiXmlString () : rep_(&nullrep_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString copy constructor
|
|
||||||
TiXmlString ( const TiXmlString & copy) : rep_(0)
|
|
||||||
{
|
|
||||||
init(copy.length());
|
|
||||||
memcpy(start(), copy.data(), length());
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString constructor, based on a string
|
|
||||||
TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
|
|
||||||
{
|
|
||||||
init( static_cast<size_type>( strlen(copy) ));
|
|
||||||
memcpy(start(), copy, length());
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString constructor, based on a string
|
|
||||||
TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
|
|
||||||
{
|
|
||||||
init(len);
|
|
||||||
memcpy(start(), str, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlString destructor
|
|
||||||
~TiXmlString ()
|
|
||||||
{
|
|
||||||
quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString& operator = (const char * copy)
|
|
||||||
{
|
|
||||||
return assign( copy, (size_type)strlen(copy));
|
|
||||||
}
|
|
||||||
|
|
||||||
TiXmlString& operator = (const TiXmlString & copy)
|
|
||||||
{
|
|
||||||
return assign(copy.start(), copy.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (const char * suffix)
|
|
||||||
{
|
|
||||||
return append(suffix, static_cast<size_type>( strlen(suffix) ));
|
|
||||||
}
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (char single)
|
|
||||||
{
|
|
||||||
return append(&single, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// += operator. Maps to append
|
|
||||||
TiXmlString& operator += (const TiXmlString & suffix)
|
|
||||||
{
|
|
||||||
return append(suffix.data(), suffix.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Convert a TiXmlString into a null-terminated char *
|
|
||||||
const char * c_str () const { return rep_->str; }
|
|
||||||
|
|
||||||
// Convert a TiXmlString into a char * (need not be null terminated).
|
|
||||||
const char * data () const { return rep_->str; }
|
|
||||||
|
|
||||||
// Return the length of a TiXmlString
|
|
||||||
size_type length () const { return rep_->size; }
|
|
||||||
|
|
||||||
// Alias for length()
|
|
||||||
size_type size () const { return rep_->size; }
|
|
||||||
|
|
||||||
// Checks if a TiXmlString is empty
|
|
||||||
bool empty () const { return rep_->size == 0; }
|
|
||||||
|
|
||||||
// Return capacity of string
|
|
||||||
size_type capacity () const { return rep_->capacity; }
|
|
||||||
|
|
||||||
|
|
||||||
// single char extraction
|
|
||||||
const char& at (size_type index) const
|
|
||||||
{
|
|
||||||
assert( index < length() );
|
|
||||||
return rep_->str[ index ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// [] operator
|
|
||||||
char& operator [] (size_type index) const
|
|
||||||
{
|
|
||||||
assert( index < length() );
|
|
||||||
return rep_->str[ index ];
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a char in a string. Return TiXmlString::npos if not found
|
|
||||||
size_type find (char lookup) const
|
|
||||||
{
|
|
||||||
return find(lookup, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a char in a string from an offset. Return TiXmlString::npos if not found
|
|
||||||
size_type find (char tofind, size_type offset) const
|
|
||||||
{
|
|
||||||
if (offset >= length()) return npos;
|
|
||||||
|
|
||||||
for (const char* p = c_str() + offset; *p != '\0'; ++p)
|
|
||||||
{
|
|
||||||
if (*p == tofind) return static_cast< size_type >( p - c_str() );
|
|
||||||
}
|
|
||||||
return npos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear ()
|
|
||||||
{
|
|
||||||
//Lee:
|
|
||||||
//The original was just too strange, though correct:
|
|
||||||
// TiXmlString().swap(*this);
|
|
||||||
//Instead use the quit & re-init:
|
|
||||||
quit();
|
|
||||||
init(0,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function to reserve a big amount of data when we know we'll need it. Be aware that this
|
|
||||||
function DOES NOT clear the content of the TiXmlString if any exists.
|
|
||||||
*/
|
|
||||||
void reserve (size_type cap);
|
|
||||||
|
|
||||||
TiXmlString& assign (const char* str, size_type len);
|
|
||||||
|
|
||||||
TiXmlString& append (const char* str, size_type len);
|
|
||||||
|
|
||||||
void swap (TiXmlString& other)
|
|
||||||
{
|
|
||||||
Rep* r = rep_;
|
|
||||||
rep_ = other.rep_;
|
|
||||||
other.rep_ = r;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void init(size_type sz) { init(sz, sz); }
|
|
||||||
void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
|
|
||||||
char* start() const { return rep_->str; }
|
|
||||||
char* finish() const { return rep_->str + rep_->size; }
|
|
||||||
|
|
||||||
struct Rep
|
|
||||||
{
|
|
||||||
size_type size, capacity;
|
|
||||||
char str[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
void init(size_type sz, size_type cap)
|
|
||||||
{
|
|
||||||
if (cap)
|
|
||||||
{
|
|
||||||
// Lee: the original form:
|
|
||||||
// rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
|
|
||||||
// doesn't work in some cases of new being overloaded. Switching
|
|
||||||
// to the normal allocation, although use an 'int' for systems
|
|
||||||
// that are overly picky about structure alignment.
|
|
||||||
const size_type bytesNeeded = sizeof(Rep) + cap;
|
|
||||||
const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
|
|
||||||
rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
|
|
||||||
|
|
||||||
rep_->str[ rep_->size = sz ] = '\0';
|
|
||||||
rep_->capacity = cap;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rep_ = &nullrep_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit()
|
|
||||||
{
|
|
||||||
if (rep_ != &nullrep_)
|
|
||||||
{
|
|
||||||
// The rep_ is really an array of ints. (see the allocator, above).
|
|
||||||
// Cast it back before delete, so the compiler won't incorrectly call destructors.
|
|
||||||
delete [] ( reinterpret_cast<int*>( rep_ ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rep * rep_;
|
|
||||||
static Rep nullrep_;
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
inline bool operator == (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
return ( a.length() == b.length() ) // optimization on some platforms
|
|
||||||
&& ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
|
|
||||||
}
|
|
||||||
inline bool operator < (const TiXmlString & a, const TiXmlString & b)
|
|
||||||
{
|
|
||||||
return strcmp(a.c_str(), b.c_str()) < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
|
|
||||||
inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
|
|
||||||
inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
|
|
||||||
inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
|
|
||||||
|
|
||||||
inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
|
|
||||||
inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
|
|
||||||
inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
|
|
||||||
inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
|
|
||||||
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
|
|
||||||
TiXmlString operator + (const TiXmlString & a, const char* b);
|
|
||||||
TiXmlString operator + (const char* a, const TiXmlString & b);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
|
|
||||||
Only the operators that we need for TinyXML have been developped.
|
|
||||||
*/
|
|
||||||
class TiXmlOutStream : public TiXmlString
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
// TiXmlOutStream << operator.
|
|
||||||
TiXmlOutStream & operator << (const TiXmlString & in)
|
|
||||||
{
|
|
||||||
*this += in;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TiXmlOutStream << operator.
|
|
||||||
TiXmlOutStream & operator << (const char * in)
|
|
||||||
{
|
|
||||||
*this += in;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
} ;
|
|
||||||
|
|
||||||
#endif // TIXML_STRING_INCLUDED
|
|
||||||
#endif // TIXML_USE_STL
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
www.sourceforge.net/projects/tinyxml
|
|
||||||
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any
|
|
||||||
damages arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any
|
|
||||||
purpose, including commercial applications, and to alter it and
|
|
||||||
redistribute it freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must
|
|
||||||
not claim that you wrote the original software. If you use this
|
|
||||||
software in a product, an acknowledgment in the product documentation
|
|
||||||
would be appreciated but is not required.
|
|
||||||
|
|
||||||
2. Altered source versions must be plainly marked as such, and
|
|
||||||
must not be misrepresented as being the original software.
|
|
||||||
|
|
||||||
3. This notice may not be removed or altered from any source
|
|
||||||
distribution.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "tinyxml.h"
|
|
||||||
|
|
||||||
// The goal of the seperate error file is to make the first
|
|
||||||
// step towards localization. tinyxml (currently) only supports
|
|
||||||
// english error messages, but the could now be translated.
|
|
||||||
//
|
|
||||||
// It also cleans up the code a bit.
|
|
||||||
//
|
|
||||||
|
|
||||||
const char* TiXmlBase::errorString[ TiXmlBase::TIXML_ERROR_STRING_COUNT ] =
|
|
||||||
{
|
|
||||||
"No error",
|
|
||||||
"Error",
|
|
||||||
"Failed to open file",
|
|
||||||
"Error parsing Element.",
|
|
||||||
"Failed to read Element name",
|
|
||||||
"Error reading Element value.",
|
|
||||||
"Error reading Attributes.",
|
|
||||||
"Error: empty tag.",
|
|
||||||
"Error reading end tag.",
|
|
||||||
"Error parsing Unknown.",
|
|
||||||
"Error parsing Comment.",
|
|
||||||
"Error parsing Declaration.",
|
|
||||||
"Error document empty.",
|
|
||||||
"Error null (0) or unexpected EOF found in input stream.",
|
|
||||||
"Error parsing CDATA.",
|
|
||||||
"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
|
|
||||||
};
|
|
||||||
File diff suppressed because it is too large
Load Diff
2826
examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
Normal file
2826
examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2314
examples/ThirdPartyLibs/tinyxml2/tinyxml2.h
Normal file
2314
examples/ThirdPartyLibs/tinyxml2/tinyxml2.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -54,10 +54,7 @@ SET(RobotSimulator_SRCS
|
|||||||
../../examples/Utils/b3ResourcePath.h
|
../../examples/Utils/b3ResourcePath.h
|
||||||
../../examples/Utils/RobotLoggingUtil.cpp
|
../../examples/Utils/RobotLoggingUtil.cpp
|
||||||
../../examples/Utils/RobotLoggingUtil.h
|
../../examples/Utils/RobotLoggingUtil.h
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp
|
../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
||||||
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
|
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
|
||||||
|
|||||||
@@ -64,10 +64,7 @@ SET(pybullet_SRCS
|
|||||||
../../examples/Utils/RobotLoggingUtil.cpp
|
../../examples/Utils/RobotLoggingUtil.cpp
|
||||||
../../examples/Utils/RobotLoggingUtil.h
|
../../examples/Utils/RobotLoggingUtil.h
|
||||||
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp
|
../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
||||||
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
|
../../examples/ThirdPartyLibs/stb_image/stb_image.cpp
|
||||||
|
|||||||
@@ -136,10 +136,7 @@ if not _OPTIONS["no-enet"] then
|
|||||||
"../../examples/Utils/b3ResourcePath.h",
|
"../../examples/Utils/b3ResourcePath.h",
|
||||||
"../../examples/Utils/RobotLoggingUtil.cpp",
|
"../../examples/Utils/RobotLoggingUtil.cpp",
|
||||||
"../../examples/Utils/RobotLoggingUtil.h",
|
"../../examples/Utils/RobotLoggingUtil.h",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../examples/ThirdPartyLibs/stb_image/stb_image.cpp",
|
"../../examples/ThirdPartyLibs/stb_image/stb_image.cpp",
|
||||||
|
|||||||
5
setup.py
5
setup.py
@@ -77,10 +77,7 @@ sources = ["examples/pybullet/pybullet.c"]\
|
|||||||
+["examples/Utils/ChromeTraceUtil.cpp"]\
|
+["examples/Utils/ChromeTraceUtil.cpp"]\
|
||||||
+["examples/Utils/b3Clock.cpp"]\
|
+["examples/Utils/b3Clock.cpp"]\
|
||||||
+["examples/Utils/b3Quickprof.cpp"]\
|
+["examples/Utils/b3Quickprof.cpp"]\
|
||||||
+["examples/ThirdPartyLibs/tinyxml/tinystr.cpp"]\
|
+["examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp"]\
|
||||||
+["examples/ThirdPartyLibs/tinyxml/tinyxml.cpp"]\
|
|
||||||
+["examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp"]\
|
|
||||||
+["examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp"]\
|
|
||||||
+["examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp"]\
|
+["examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp"]\
|
||||||
+["examples/ThirdPartyLibs/stb_image/stb_image.cpp"]\
|
+["examples/ThirdPartyLibs/stb_image/stb_image.cpp"]\
|
||||||
+["examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp"]\
|
+["examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp"]\
|
||||||
|
|||||||
@@ -84,11 +84,8 @@ ENDIF()
|
|||||||
../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||||
../../examples/Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
../../examples/Importers/ImportColladaDemo/ColladaGraphicsInstance.h
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp
|
../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_TEST(Test_BulletInverseForwardDynamics_PASS Test_BulletInverseForwardDynamics)
|
ADD_TEST(Test_BulletInverseForwardDynamics_PASS Test_BulletInverseForwardDynamics)
|
||||||
|
|||||||
@@ -125,10 +125,7 @@
|
|||||||
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
"../../examples/Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
"../../examples/Importers/ImportColladaDemo/ColladaGraphicsInstance.h",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/urdf/boost_replacement/lexical_cast.h",
|
"../../examples/ThirdPartyLibs/urdf/boost_replacement/lexical_cast.h",
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,7 @@ ENDIF()
|
|||||||
../../examples/TinyRenderer/tgaimage.cpp
|
../../examples/TinyRenderer/tgaimage.cpp
|
||||||
../../examples/TinyRenderer/our_gl.cpp
|
../../examples/TinyRenderer/our_gl.cpp
|
||||||
../../examples/TinyRenderer/TinyRenderer.cpp
|
../../examples/TinyRenderer/TinyRenderer.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp
|
../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp
|
|
||||||
../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp
|
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp
|
||||||
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h
|
||||||
../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp
|
||||||
|
|||||||
@@ -211,10 +211,7 @@ project ("Test_PhysicsServerLoopBack")
|
|||||||
"../../examples/Utils/b3Clock.h",
|
"../../examples/Utils/b3Clock.h",
|
||||||
"../../examples/Utils/ChromeTraceUtil.cpp",
|
"../../examples/Utils/ChromeTraceUtil.cpp",
|
||||||
"../../examples/Utils/ChromeTraceUtil.h",
|
"../../examples/Utils/ChromeTraceUtil.h",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
@@ -298,10 +295,7 @@ end
|
|||||||
"../../examples/Utils/b3Clock.cpp",
|
"../../examples/Utils/b3Clock.cpp",
|
||||||
"../../examples/Utils/ChromeTraceUtil.cpp",
|
"../../examples/Utils/ChromeTraceUtil.cpp",
|
||||||
"../../examples/Utils/ChromeTraceUtil.h",
|
"../../examples/Utils/ChromeTraceUtil.h",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
@@ -405,10 +399,7 @@ project ("Test_PhysicsServerInProcessExampleBrowser")
|
|||||||
"../../examples/Utils/b3ResourcePath.h",
|
"../../examples/Utils/b3ResourcePath.h",
|
||||||
"../../examples/Utils/RobotLoggingUtil.cpp",
|
"../../examples/Utils/RobotLoggingUtil.cpp",
|
||||||
"../../examples/Utils/RobotLoggingUtil.h",
|
"../../examples/Utils/RobotLoggingUtil.h",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinystr.cpp",
|
"../../examples/ThirdPartyLibs/tinyxml2/tinyxml2.cpp",
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxml.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlerror.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/tinyxml/tinyxmlparser.cpp",
|
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.cpp",
|
||||||
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
"../../examples/ThirdPartyLibs/Wavefront/tiny_obj_loader.h",
|
||||||
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
"../../examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp",
|
||||||
|
|||||||
Reference in New Issue
Block a user