Lines 886-892
Link Here
|
886 |
if(!dataSrc.ok()) |
886 |
if(!dataSrc.ok()) |
887 |
{ |
887 |
{ |
888 |
dataSrc.setError(); |
888 |
dataSrc.setError(); |
889 |
return false; |
889 |
return NULL; |
890 |
} |
890 |
} |
891 |
|
891 |
|
892 |
// allocate a new core keyframe instance |
892 |
// allocate a new core keyframe instance |
Lines 1338-1350
Link Here
|
1338 |
if(stricmp(skeleton->Attribute("MAGIC"),Cal::SKELETON_XMLFILE_MAGIC)!=0) |
1338 |
if(stricmp(skeleton->Attribute("MAGIC"),Cal::SKELETON_XMLFILE_MAGIC)!=0) |
1339 |
{ |
1339 |
{ |
1340 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1340 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1341 |
return false; |
1341 |
return NULL; |
1342 |
} |
1342 |
} |
1343 |
|
1343 |
|
1344 |
if(atoi(skeleton->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1344 |
if(atoi(skeleton->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1345 |
{ |
1345 |
{ |
1346 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1346 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1347 |
return false; |
1347 |
return NULL; |
1348 |
} |
1348 |
} |
1349 |
|
1349 |
|
1350 |
skeleton = skeleton->NextSiblingElement(); |
1350 |
skeleton = skeleton->NextSiblingElement(); |
Lines 1353-1371
Link Here
|
1353 |
if(!skeleton || stricmp(skeleton->Value(),"SKELETON")!=0) |
1353 |
if(!skeleton || stricmp(skeleton->Value(),"SKELETON")!=0) |
1354 |
{ |
1354 |
{ |
1355 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1355 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1356 |
return false; |
1356 |
return NULL; |
1357 |
} |
1357 |
} |
1358 |
|
1358 |
|
1359 |
if(skeleton->Attribute("MAGIC")!=NULL && stricmp(skeleton->Attribute("MAGIC"),Cal::SKELETON_XMLFILE_MAGIC)!=0) |
1359 |
if(skeleton->Attribute("MAGIC")!=NULL && stricmp(skeleton->Attribute("MAGIC"),Cal::SKELETON_XMLFILE_MAGIC)!=0) |
1360 |
{ |
1360 |
{ |
1361 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1361 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1362 |
return false; |
1362 |
return NULL; |
1363 |
} |
1363 |
} |
1364 |
|
1364 |
|
1365 |
if(skeleton->Attribute("VERSION")!=NULL && atoi(skeleton->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1365 |
if(skeleton->Attribute("VERSION")!=NULL && atoi(skeleton->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1366 |
{ |
1366 |
{ |
1367 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1367 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1368 |
return false; |
1368 |
return NULL; |
1369 |
} |
1369 |
} |
1370 |
|
1370 |
|
1371 |
|
1371 |
|
Lines 1383-1389
Link Here
|
1383 |
if(stricmp(bone->Value(),"BONE")!=0) |
1383 |
if(stricmp(bone->Value(),"BONE")!=0) |
1384 |
{ |
1384 |
{ |
1385 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1385 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1386 |
return false; |
1386 |
return NULL; |
1387 |
} |
1387 |
} |
1388 |
|
1388 |
|
1389 |
std::string strName=bone->Attribute("NAME"); |
1389 |
std::string strName=bone->Attribute("NAME"); |
Lines 1395-1401
Link Here
|
1395 |
if(!translation || stricmp( translation->Value(),"TRANSLATION")!=0) |
1395 |
if(!translation || stricmp( translation->Value(),"TRANSLATION")!=0) |
1396 |
{ |
1396 |
{ |
1397 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1397 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1398 |
return false; |
1398 |
return NULL; |
1399 |
} |
1399 |
} |
1400 |
|
1400 |
|
1401 |
float tx, ty, tz; |
1401 |
float tx, ty, tz; |
Lines 1404-1416
Link Here
|
1404 |
if(!node) |
1404 |
if(!node) |
1405 |
{ |
1405 |
{ |
1406 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1406 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1407 |
return false; |
1407 |
return NULL; |
1408 |
} |
1408 |
} |
1409 |
TiXmlText* translationdata = node->ToText(); |
1409 |
TiXmlText* translationdata = node->ToText(); |
1410 |
if(!translationdata) |
1410 |
if(!translationdata) |
1411 |
{ |
1411 |
{ |
1412 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1412 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1413 |
return false; |
1413 |
return NULL; |
1414 |
} |
1414 |
} |
1415 |
str.clear(); |
1415 |
str.clear(); |
1416 |
str << translationdata->Value(); |
1416 |
str << translationdata->Value(); |
Lines 1422-1428
Link Here
|
1422 |
if(!rotation || stricmp(rotation->Value(),"ROTATION")!=0) |
1422 |
if(!rotation || stricmp(rotation->Value(),"ROTATION")!=0) |
1423 |
{ |
1423 |
{ |
1424 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1424 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1425 |
return false; |
1425 |
return NULL; |
1426 |
} |
1426 |
} |
1427 |
|
1427 |
|
1428 |
float rx, ry, rz, rw; |
1428 |
float rx, ry, rz, rw; |
Lines 1431-1443
Link Here
|
1431 |
if(!node) |
1431 |
if(!node) |
1432 |
{ |
1432 |
{ |
1433 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1433 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1434 |
return false; |
1434 |
return NULL; |
1435 |
} |
1435 |
} |
1436 |
TiXmlText* rotationdata = node->ToText(); |
1436 |
TiXmlText* rotationdata = node->ToText(); |
1437 |
if(!rotationdata) |
1437 |
if(!rotationdata) |
1438 |
{ |
1438 |
{ |
1439 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1439 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1440 |
return false; |
1440 |
return NULL; |
1441 |
} |
1441 |
} |
1442 |
str.clear(); |
1442 |
str.clear(); |
1443 |
str << rotationdata->Value(); |
1443 |
str << rotationdata->Value(); |
Lines 1450-1456
Link Here
|
1450 |
if(!rotation || stricmp(translationBoneSpace->Value(),"LOCALTRANSLATION")!=0) |
1450 |
if(!rotation || stricmp(translationBoneSpace->Value(),"LOCALTRANSLATION")!=0) |
1451 |
{ |
1451 |
{ |
1452 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1452 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1453 |
return false; |
1453 |
return NULL; |
1454 |
} |
1454 |
} |
1455 |
|
1455 |
|
1456 |
float txBoneSpace, tyBoneSpace, tzBoneSpace; |
1456 |
float txBoneSpace, tyBoneSpace, tzBoneSpace; |
Lines 1459-1471
Link Here
|
1459 |
if(!node) |
1459 |
if(!node) |
1460 |
{ |
1460 |
{ |
1461 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1461 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1462 |
return false; |
1462 |
return NULL; |
1463 |
} |
1463 |
} |
1464 |
TiXmlText* translationBoneSpacedata = node->ToText(); |
1464 |
TiXmlText* translationBoneSpacedata = node->ToText(); |
1465 |
if(!translationBoneSpacedata) |
1465 |
if(!translationBoneSpacedata) |
1466 |
{ |
1466 |
{ |
1467 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1467 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1468 |
return false; |
1468 |
return NULL; |
1469 |
} |
1469 |
} |
1470 |
str.clear(); |
1470 |
str.clear(); |
1471 |
str << translationBoneSpacedata->Value(); |
1471 |
str << translationBoneSpacedata->Value(); |
Lines 1477-1483
Link Here
|
1477 |
if(!rotationBoneSpace || stricmp(rotationBoneSpace->Value(),"LOCALROTATION")!=0) |
1477 |
if(!rotationBoneSpace || stricmp(rotationBoneSpace->Value(),"LOCALROTATION")!=0) |
1478 |
{ |
1478 |
{ |
1479 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1479 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1480 |
return false; |
1480 |
return NULL; |
1481 |
} |
1481 |
} |
1482 |
|
1482 |
|
1483 |
float rxBoneSpace, ryBoneSpace, rzBoneSpace, rwBoneSpace; |
1483 |
float rxBoneSpace, ryBoneSpace, rzBoneSpace, rwBoneSpace; |
Lines 1486-1498
Link Here
|
1486 |
if(!node) |
1486 |
if(!node) |
1487 |
{ |
1487 |
{ |
1488 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1488 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1489 |
return false; |
1489 |
return NULL; |
1490 |
} |
1490 |
} |
1491 |
TiXmlText* rotationBoneSpacedata = node->ToText(); |
1491 |
TiXmlText* rotationBoneSpacedata = node->ToText(); |
1492 |
if(!rotationBoneSpacedata) |
1492 |
if(!rotationBoneSpacedata) |
1493 |
{ |
1493 |
{ |
1494 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1494 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1495 |
return false; |
1495 |
return NULL; |
1496 |
} |
1496 |
} |
1497 |
str.clear(); |
1497 |
str.clear(); |
1498 |
str << rotationBoneSpacedata->Value(); |
1498 |
str << rotationBoneSpacedata->Value(); |
Lines 1504-1510
Link Here
|
1504 |
if(!parent ||stricmp(parent->Value(),"PARENTID")!=0) |
1504 |
if(!parent ||stricmp(parent->Value(),"PARENTID")!=0) |
1505 |
{ |
1505 |
{ |
1506 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1506 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1507 |
return false; |
1507 |
return NULL; |
1508 |
} |
1508 |
} |
1509 |
|
1509 |
|
1510 |
|
1510 |
|
Lines 1514-1526
Link Here
|
1514 |
if(!node) |
1514 |
if(!node) |
1515 |
{ |
1515 |
{ |
1516 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1516 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1517 |
return false; |
1517 |
return NULL; |
1518 |
} |
1518 |
} |
1519 |
TiXmlText* parentid = node->ToText(); |
1519 |
TiXmlText* parentid = node->ToText(); |
1520 |
if(!parentid) |
1520 |
if(!parentid) |
1521 |
{ |
1521 |
{ |
1522 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1522 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1523 |
return false; |
1523 |
return NULL; |
1524 |
} |
1524 |
} |
1525 |
parentId = atoi(parentid->Value()); |
1525 |
parentId = atoi(parentid->Value()); |
1526 |
|
1526 |
|
Lines 1566-1572
Link Here
|
1566 |
{ |
1566 |
{ |
1567 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1567 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1568 |
delete pCoreBone; |
1568 |
delete pCoreBone; |
1569 |
return false; |
1569 |
return NULL; |
1570 |
} |
1570 |
} |
1571 |
|
1571 |
|
1572 |
TiXmlNode *node= child->FirstChild(); |
1572 |
TiXmlNode *node= child->FirstChild(); |
Lines 1574-1587
Link Here
|
1574 |
{ |
1574 |
{ |
1575 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1575 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1576 |
delete pCoreBone; |
1576 |
delete pCoreBone; |
1577 |
return false; |
1577 |
return NULL; |
1578 |
} |
1578 |
} |
1579 |
TiXmlText* childid = node->ToText(); |
1579 |
TiXmlText* childid = node->ToText(); |
1580 |
if(!childid) |
1580 |
if(!childid) |
1581 |
{ |
1581 |
{ |
1582 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1582 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1583 |
delete pCoreBone; |
1583 |
delete pCoreBone; |
1584 |
return false; |
1584 |
return NULL; |
1585 |
} |
1585 |
} |
1586 |
|
1586 |
|
1587 |
int childId = atoi(childid->Value()); |
1587 |
int childId = atoi(childid->Value()); |
Lines 1633-1639
Link Here
|
1633 |
if(!animation) |
1633 |
if(!animation) |
1634 |
{ |
1634 |
{ |
1635 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1635 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1636 |
return false; |
1636 |
return NULL; |
1637 |
} |
1637 |
} |
1638 |
|
1638 |
|
1639 |
if(stricmp(animation->Value(),"HEADER")==0) |
1639 |
if(stricmp(animation->Value(),"HEADER")==0) |
Lines 1641-1653
Link Here
|
1641 |
if(stricmp(animation->Attribute("MAGIC"),Cal::ANIMATION_XMLFILE_MAGIC)!=0) |
1641 |
if(stricmp(animation->Attribute("MAGIC"),Cal::ANIMATION_XMLFILE_MAGIC)!=0) |
1642 |
{ |
1642 |
{ |
1643 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1643 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1644 |
return false; |
1644 |
return NULL; |
1645 |
} |
1645 |
} |
1646 |
|
1646 |
|
1647 |
if(atoi(animation->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1647 |
if(atoi(animation->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1648 |
{ |
1648 |
{ |
1649 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1649 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1650 |
return false; |
1650 |
return NULL; |
1651 |
} |
1651 |
} |
1652 |
|
1652 |
|
1653 |
animation = animation->NextSiblingElement(); |
1653 |
animation = animation->NextSiblingElement(); |
Lines 1656-1674
Link Here
|
1656 |
if(!animation || stricmp(animation->Value(),"ANIMATION")!=0) |
1656 |
if(!animation || stricmp(animation->Value(),"ANIMATION")!=0) |
1657 |
{ |
1657 |
{ |
1658 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1658 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1659 |
return false; |
1659 |
return NULL; |
1660 |
} |
1660 |
} |
1661 |
|
1661 |
|
1662 |
if(animation->Attribute("MAGIC") !=NULL && stricmp(animation->Attribute("MAGIC"),Cal::ANIMATION_XMLFILE_MAGIC)!=0) |
1662 |
if(animation->Attribute("MAGIC") !=NULL && stricmp(animation->Attribute("MAGIC"),Cal::ANIMATION_XMLFILE_MAGIC)!=0) |
1663 |
{ |
1663 |
{ |
1664 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1664 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1665 |
return false; |
1665 |
return NULL; |
1666 |
} |
1666 |
} |
1667 |
|
1667 |
|
1668 |
if(animation->Attribute("VERSION")!=NULL && atoi(animation->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1668 |
if(animation->Attribute("VERSION")!=NULL && atoi(animation->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1669 |
{ |
1669 |
{ |
1670 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1670 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1671 |
return false; |
1671 |
return NULL; |
1672 |
} |
1672 |
} |
1673 |
|
1673 |
|
1674 |
int trackCount= atoi(animation->Attribute("NUMTRACKS")); |
1674 |
int trackCount= atoi(animation->Attribute("NUMTRACKS")); |
Lines 1880-1886
Link Here
|
1880 |
if(!mesh) |
1880 |
if(!mesh) |
1881 |
{ |
1881 |
{ |
1882 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1882 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1883 |
return false; |
1883 |
return NULL; |
1884 |
} |
1884 |
} |
1885 |
|
1885 |
|
1886 |
if(stricmp(mesh->Value(),"HEADER")==0) |
1886 |
if(stricmp(mesh->Value(),"HEADER")==0) |
Lines 1888-1900
Link Here
|
1888 |
if(stricmp(mesh->Attribute("MAGIC"),Cal::MESH_XMLFILE_MAGIC)!=0) |
1888 |
if(stricmp(mesh->Attribute("MAGIC"),Cal::MESH_XMLFILE_MAGIC)!=0) |
1889 |
{ |
1889 |
{ |
1890 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1890 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1891 |
return false; |
1891 |
return NULL; |
1892 |
} |
1892 |
} |
1893 |
|
1893 |
|
1894 |
if(atoi(mesh->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1894 |
if(atoi(mesh->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1895 |
{ |
1895 |
{ |
1896 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1896 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1897 |
return false; |
1897 |
return NULL; |
1898 |
} |
1898 |
} |
1899 |
|
1899 |
|
1900 |
mesh = mesh->NextSiblingElement(); |
1900 |
mesh = mesh->NextSiblingElement(); |
Lines 1902-1920
Link Here
|
1902 |
if(!mesh || stricmp(mesh->Value(),"MESH")!=0) |
1902 |
if(!mesh || stricmp(mesh->Value(),"MESH")!=0) |
1903 |
{ |
1903 |
{ |
1904 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1904 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1905 |
return false; |
1905 |
return NULL; |
1906 |
} |
1906 |
} |
1907 |
|
1907 |
|
1908 |
if(mesh->Attribute("MAGIC")!=NULL && stricmp(mesh->Attribute("MAGIC"),Cal::MESH_XMLFILE_MAGIC)!=0) |
1908 |
if(mesh->Attribute("MAGIC")!=NULL && stricmp(mesh->Attribute("MAGIC"),Cal::MESH_XMLFILE_MAGIC)!=0) |
1909 |
{ |
1909 |
{ |
1910 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1910 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1911 |
return false; |
1911 |
return NULL; |
1912 |
} |
1912 |
} |
1913 |
|
1913 |
|
1914 |
if(mesh->Attribute("VERSION")!=NULL && atoi(mesh->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1914 |
if(mesh->Attribute("VERSION")!=NULL && atoi(mesh->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
1915 |
{ |
1915 |
{ |
1916 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1916 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
1917 |
return false; |
1917 |
return NULL; |
1918 |
} |
1918 |
} |
1919 |
|
1919 |
|
1920 |
// get the number of submeshes |
1920 |
// get the number of submeshes |
Lines 1937-1943
Link Here
|
1937 |
if(!submesh || stricmp(submesh->Value(),"SUBMESH")!=0) |
1937 |
if(!submesh || stricmp(submesh->Value(),"SUBMESH")!=0) |
1938 |
{ |
1938 |
{ |
1939 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1939 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1940 |
return false; |
1940 |
return NULL; |
1941 |
} |
1941 |
} |
1942 |
|
1942 |
|
1943 |
// get the material thread id of the submesh |
1943 |
// get the material thread id of the submesh |
Lines 1986-1992
Link Here
|
1986 |
{ |
1986 |
{ |
1987 |
delete pCoreSubmesh; |
1987 |
delete pCoreSubmesh; |
1988 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1988 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1989 |
return false; |
1989 |
return NULL; |
1990 |
} |
1990 |
} |
1991 |
|
1991 |
|
1992 |
CalCoreSubmesh::Vertex Vertex; |
1992 |
CalCoreSubmesh::Vertex Vertex; |
Lines 1996-2002
Link Here
|
1996 |
{ |
1996 |
{ |
1997 |
delete pCoreSubmesh; |
1997 |
delete pCoreSubmesh; |
1998 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1998 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
1999 |
return false; |
1999 |
return NULL; |
2000 |
} |
2000 |
} |
2001 |
|
2001 |
|
2002 |
node = pos->FirstChild(); |
2002 |
node = pos->FirstChild(); |
Lines 2004-2017
Link Here
|
2004 |
{ |
2004 |
{ |
2005 |
delete pCoreSubmesh; |
2005 |
delete pCoreSubmesh; |
2006 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2006 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2007 |
return false; |
2007 |
return NULL; |
2008 |
} |
2008 |
} |
2009 |
TiXmlText* posdata = node->ToText(); |
2009 |
TiXmlText* posdata = node->ToText(); |
2010 |
if(!posdata) |
2010 |
if(!posdata) |
2011 |
{ |
2011 |
{ |
2012 |
delete pCoreSubmesh; |
2012 |
delete pCoreSubmesh; |
2013 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2013 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2014 |
return false; |
2014 |
return NULL; |
2015 |
} |
2015 |
} |
2016 |
str.clear(); |
2016 |
str.clear(); |
2017 |
str << posdata->Value(); |
2017 |
str << posdata->Value(); |
Lines 2022-2028
Link Here
|
2022 |
{ |
2022 |
{ |
2023 |
delete pCoreSubmesh; |
2023 |
delete pCoreSubmesh; |
2024 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2024 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2025 |
return false; |
2025 |
return NULL; |
2026 |
} |
2026 |
} |
2027 |
|
2027 |
|
2028 |
node = norm->FirstChild(); |
2028 |
node = norm->FirstChild(); |
Lines 2030-2043
Link Here
|
2030 |
{ |
2030 |
{ |
2031 |
delete pCoreSubmesh; |
2031 |
delete pCoreSubmesh; |
2032 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2032 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2033 |
return false; |
2033 |
return NULL; |
2034 |
} |
2034 |
} |
2035 |
TiXmlText* normdata = node->ToText(); |
2035 |
TiXmlText* normdata = node->ToText(); |
2036 |
if(!normdata) |
2036 |
if(!normdata) |
2037 |
{ |
2037 |
{ |
2038 |
delete pCoreSubmesh; |
2038 |
delete pCoreSubmesh; |
2039 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2039 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2040 |
return false; |
2040 |
return NULL; |
2041 |
} |
2041 |
} |
2042 |
str.clear(); |
2042 |
str.clear(); |
2043 |
str << normdata->Value(); |
2043 |
str << normdata->Value(); |
Lines 2051-2064
Link Here
|
2051 |
{ |
2051 |
{ |
2052 |
delete pCoreSubmesh; |
2052 |
delete pCoreSubmesh; |
2053 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2053 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2054 |
return false; |
2054 |
return NULL; |
2055 |
} |
2055 |
} |
2056 |
TiXmlText* collapseid = node->ToText(); |
2056 |
TiXmlText* collapseid = node->ToText(); |
2057 |
if(!collapseid) |
2057 |
if(!collapseid) |
2058 |
{ |
2058 |
{ |
2059 |
delete pCoreSubmesh; |
2059 |
delete pCoreSubmesh; |
2060 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2060 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2061 |
return false; |
2061 |
return NULL; |
2062 |
} |
2062 |
} |
2063 |
Vertex.collapseId = atoi(collapseid->Value()); |
2063 |
Vertex.collapseId = atoi(collapseid->Value()); |
2064 |
|
2064 |
|
Lines 2067-2073
Link Here
|
2067 |
{ |
2067 |
{ |
2068 |
delete pCoreSubmesh; |
2068 |
delete pCoreSubmesh; |
2069 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2069 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2070 |
return false; |
2070 |
return NULL; |
2071 |
} |
2071 |
} |
2072 |
|
2072 |
|
2073 |
node = collapseCount->FirstChild(); |
2073 |
node = collapseCount->FirstChild(); |
Lines 2075-2088
Link Here
|
2075 |
{ |
2075 |
{ |
2076 |
delete pCoreSubmesh; |
2076 |
delete pCoreSubmesh; |
2077 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2077 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2078 |
return false; |
2078 |
return NULL; |
2079 |
} |
2079 |
} |
2080 |
TiXmlText* collapseCountdata = node->ToText(); |
2080 |
TiXmlText* collapseCountdata = node->ToText(); |
2081 |
if(!collapseCountdata) |
2081 |
if(!collapseCountdata) |
2082 |
{ |
2082 |
{ |
2083 |
delete pCoreSubmesh; |
2083 |
delete pCoreSubmesh; |
2084 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2084 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2085 |
return false; |
2085 |
return NULL; |
2086 |
} |
2086 |
} |
2087 |
Vertex.faceCollapseCount= atoi(collapseCountdata->Value()); |
2087 |
Vertex.faceCollapseCount= atoi(collapseCountdata->Value()); |
2088 |
collapse = collapseCount->NextSiblingElement(); |
2088 |
collapse = collapseCount->NextSiblingElement(); |
Lines 2106-2112
Link Here
|
2106 |
{ |
2106 |
{ |
2107 |
delete pCoreSubmesh; |
2107 |
delete pCoreSubmesh; |
2108 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2108 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2109 |
return false; |
2109 |
return NULL; |
2110 |
} |
2110 |
} |
2111 |
|
2111 |
|
2112 |
node = texcoord->FirstChild(); |
2112 |
node = texcoord->FirstChild(); |
Lines 2114-2127
Link Here
|
2114 |
{ |
2114 |
{ |
2115 |
delete pCoreSubmesh; |
2115 |
delete pCoreSubmesh; |
2116 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2116 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2117 |
return false; |
2117 |
return NULL; |
2118 |
} |
2118 |
} |
2119 |
TiXmlText* texcoorddata = node->ToText(); |
2119 |
TiXmlText* texcoorddata = node->ToText(); |
2120 |
if(!texcoorddata) |
2120 |
if(!texcoorddata) |
2121 |
{ |
2121 |
{ |
2122 |
delete pCoreSubmesh; |
2122 |
delete pCoreSubmesh; |
2123 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2123 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2124 |
return false; |
2124 |
return NULL; |
2125 |
} |
2125 |
} |
2126 |
str.clear(); |
2126 |
str.clear(); |
2127 |
str << texcoorddata->Value(); |
2127 |
str << texcoorddata->Value(); |
Lines 2161-2167
Link Here
|
2161 |
{ |
2161 |
{ |
2162 |
delete pCoreSubmesh; |
2162 |
delete pCoreSubmesh; |
2163 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2163 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2164 |
return false; |
2164 |
return NULL; |
2165 |
} |
2165 |
} |
2166 |
|
2166 |
|
2167 |
node = influence->FirstChild(); |
2167 |
node = influence->FirstChild(); |
Lines 2169-2182
Link Here
|
2169 |
{ |
2169 |
{ |
2170 |
delete pCoreSubmesh; |
2170 |
delete pCoreSubmesh; |
2171 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2171 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2172 |
return false; |
2172 |
return NULL; |
2173 |
} |
2173 |
} |
2174 |
TiXmlText* influencedata = node->ToText(); |
2174 |
TiXmlText* influencedata = node->ToText(); |
2175 |
if(!influencedata) |
2175 |
if(!influencedata) |
2176 |
{ |
2176 |
{ |
2177 |
delete pCoreSubmesh; |
2177 |
delete pCoreSubmesh; |
2178 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2178 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2179 |
return false; |
2179 |
return NULL; |
2180 |
} |
2180 |
} |
2181 |
|
2181 |
|
2182 |
Vertex.vectorInfluence[influenceId].boneId = atoi(influence->Attribute("ID")); |
2182 |
Vertex.vectorInfluence[influenceId].boneId = atoi(influence->Attribute("ID")); |
Lines 2202-2222
Link Here
|
2202 |
{ |
2202 |
{ |
2203 |
delete pCoreSubmesh; |
2203 |
delete pCoreSubmesh; |
2204 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2204 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2205 |
return false; |
2205 |
return NULL; |
2206 |
} |
2206 |
} |
2207 |
node = physique->FirstChild(); |
2207 |
node = physique->FirstChild(); |
2208 |
if(!node) |
2208 |
if(!node) |
2209 |
{ |
2209 |
{ |
2210 |
delete pCoreSubmesh; |
2210 |
delete pCoreSubmesh; |
2211 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2211 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2212 |
return false; |
2212 |
return NULL; |
2213 |
} |
2213 |
} |
2214 |
TiXmlText* physiquedata = node->ToText(); |
2214 |
TiXmlText* physiquedata = node->ToText(); |
2215 |
if(!physiquedata) |
2215 |
if(!physiquedata) |
2216 |
{ |
2216 |
{ |
2217 |
delete pCoreSubmesh; |
2217 |
delete pCoreSubmesh; |
2218 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2218 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2219 |
return false; |
2219 |
return NULL; |
2220 |
} |
2220 |
} |
2221 |
|
2221 |
|
2222 |
physicalProperty.weight = (float) atof(physiquedata->Value()); |
2222 |
physicalProperty.weight = (float) atof(physiquedata->Value()); |
Lines 2241-2247
Link Here
|
2241 |
{ |
2241 |
{ |
2242 |
delete pCoreSubmesh; |
2242 |
delete pCoreSubmesh; |
2243 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2243 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2244 |
return false; |
2244 |
return NULL; |
2245 |
} |
2245 |
} |
2246 |
str.clear(); |
2246 |
str.clear(); |
2247 |
str << spring->Attribute("VERTEXID"); |
2247 |
str << spring->Attribute("VERTEXID"); |
Lines 2266-2272
Link Here
|
2266 |
{ |
2266 |
{ |
2267 |
delete pCoreSubmesh; |
2267 |
delete pCoreSubmesh; |
2268 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2268 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2269 |
return false; |
2269 |
return NULL; |
2270 |
} |
2270 |
} |
2271 |
|
2271 |
|
2272 |
int tmp[3]; |
2272 |
int tmp[3]; |
Lines 2336-2342
Link Here
|
2336 |
if(!material) |
2336 |
if(!material) |
2337 |
{ |
2337 |
{ |
2338 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2338 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2339 |
return false; |
2339 |
return NULL; |
2340 |
} |
2340 |
} |
2341 |
|
2341 |
|
2342 |
if(stricmp(material->Value(),"HEADER")==0) |
2342 |
if(stricmp(material->Value(),"HEADER")==0) |
Lines 2344-2356
Link Here
|
2344 |
if(stricmp(material->Attribute("MAGIC"),Cal::MATERIAL_XMLFILE_MAGIC)!=0) |
2344 |
if(stricmp(material->Attribute("MAGIC"),Cal::MATERIAL_XMLFILE_MAGIC)!=0) |
2345 |
{ |
2345 |
{ |
2346 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2346 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2347 |
return false; |
2347 |
return NULL; |
2348 |
} |
2348 |
} |
2349 |
|
2349 |
|
2350 |
if(atoi(material->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
2350 |
if(atoi(material->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
2351 |
{ |
2351 |
{ |
2352 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
2352 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
2353 |
return false; |
2353 |
return NULL; |
2354 |
} |
2354 |
} |
2355 |
|
2355 |
|
2356 |
material = material->NextSiblingElement(); |
2356 |
material = material->NextSiblingElement(); |
Lines 2359-2377
Link Here
|
2359 |
if(!material||stricmp(material->Value(),"MATERIAL")!=0) |
2359 |
if(!material||stricmp(material->Value(),"MATERIAL")!=0) |
2360 |
{ |
2360 |
{ |
2361 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2361 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2362 |
return false; |
2362 |
return NULL; |
2363 |
} |
2363 |
} |
2364 |
|
2364 |
|
2365 |
if(material->Attribute("MAGIC")!=NULL && stricmp(material->Attribute("MAGIC"),Cal::MATERIAL_XMLFILE_MAGIC)!=0) |
2365 |
if(material->Attribute("MAGIC")!=NULL && stricmp(material->Attribute("MAGIC"),Cal::MATERIAL_XMLFILE_MAGIC)!=0) |
2366 |
{ |
2366 |
{ |
2367 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2367 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2368 |
return false; |
2368 |
return NULL; |
2369 |
} |
2369 |
} |
2370 |
|
2370 |
|
2371 |
if(material->Attribute("VERSION") != NULL && atoi(material->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
2371 |
if(material->Attribute("VERSION") != NULL && atoi(material->Attribute("VERSION")) < Cal::EARLIEST_COMPATIBLE_FILE_VERSION ) |
2372 |
{ |
2372 |
{ |
2373 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
2373 |
CalError::setLastError(CalError::INCOMPATIBLE_FILE_VERSION, __FILE__, __LINE__, strFilename); |
2374 |
return false; |
2374 |
return NULL; |
2375 |
} |
2375 |
} |
2376 |
|
2376 |
|
2377 |
CalCoreMaterialPtr pCoreMaterial = new CalCoreMaterial(); |
2377 |
CalCoreMaterialPtr pCoreMaterial = new CalCoreMaterial(); |
Lines 2385-2391
Link Here
|
2385 |
if(!ambient ||stricmp(ambient->Value(),"AMBIENT")!=0) |
2385 |
if(!ambient ||stricmp(ambient->Value(),"AMBIENT")!=0) |
2386 |
{ |
2386 |
{ |
2387 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2387 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2388 |
return false; |
2388 |
return NULL; |
2389 |
} |
2389 |
} |
2390 |
|
2390 |
|
2391 |
CalCoreMaterial::Color ambientColor; |
2391 |
CalCoreMaterial::Color ambientColor; |
Lines 2393-2405
Link Here
|
2393 |
if(!node) |
2393 |
if(!node) |
2394 |
{ |
2394 |
{ |
2395 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2395 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2396 |
return false; |
2396 |
return NULL; |
2397 |
} |
2397 |
} |
2398 |
TiXmlText* ambientdata = node->ToText(); |
2398 |
TiXmlText* ambientdata = node->ToText(); |
2399 |
if(!ambientdata) |
2399 |
if(!ambientdata) |
2400 |
{ |
2400 |
{ |
2401 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2401 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2402 |
return false; |
2402 |
return NULL; |
2403 |
} |
2403 |
} |
2404 |
str << ambientdata->Value(); |
2404 |
str << ambientdata->Value(); |
2405 |
str >> r >> g >> b >> a; |
2405 |
str >> r >> g >> b >> a; |
Lines 2412-2418
Link Here
|
2412 |
if(!diffuse || stricmp(diffuse->Value(),"DIFFUSE")!=0) |
2412 |
if(!diffuse || stricmp(diffuse->Value(),"DIFFUSE")!=0) |
2413 |
{ |
2413 |
{ |
2414 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2414 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2415 |
return false; |
2415 |
return NULL; |
2416 |
} |
2416 |
} |
2417 |
|
2417 |
|
2418 |
CalCoreMaterial::Color diffuseColor; |
2418 |
CalCoreMaterial::Color diffuseColor; |
Lines 2420-2432
Link Here
|
2420 |
if(!node) |
2420 |
if(!node) |
2421 |
{ |
2421 |
{ |
2422 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2422 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2423 |
return false; |
2423 |
return NULL; |
2424 |
} |
2424 |
} |
2425 |
TiXmlText* diffusedata = node->ToText(); |
2425 |
TiXmlText* diffusedata = node->ToText(); |
2426 |
if(!diffusedata) |
2426 |
if(!diffusedata) |
2427 |
{ |
2427 |
{ |
2428 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2428 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2429 |
return false; |
2429 |
return NULL; |
2430 |
} |
2430 |
} |
2431 |
str.clear(); |
2431 |
str.clear(); |
2432 |
str << diffusedata->Value(); |
2432 |
str << diffusedata->Value(); |
Lines 2441-2447
Link Here
|
2441 |
if(!specular||stricmp(specular->Value(),"SPECULAR")!=0) |
2441 |
if(!specular||stricmp(specular->Value(),"SPECULAR")!=0) |
2442 |
{ |
2442 |
{ |
2443 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2443 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2444 |
return false; |
2444 |
return NULL; |
2445 |
} |
2445 |
} |
2446 |
|
2446 |
|
2447 |
CalCoreMaterial::Color specularColor; |
2447 |
CalCoreMaterial::Color specularColor; |
Lines 2449-2461
Link Here
|
2449 |
if(!node) |
2449 |
if(!node) |
2450 |
{ |
2450 |
{ |
2451 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2451 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2452 |
return false; |
2452 |
return NULL; |
2453 |
} |
2453 |
} |
2454 |
TiXmlText* speculardata = node->ToText(); |
2454 |
TiXmlText* speculardata = node->ToText(); |
2455 |
if(!speculardata) |
2455 |
if(!speculardata) |
2456 |
{ |
2456 |
{ |
2457 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2457 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2458 |
return false; |
2458 |
return NULL; |
2459 |
} |
2459 |
} |
2460 |
str.clear(); |
2460 |
str.clear(); |
2461 |
str << speculardata->Value(); |
2461 |
str << speculardata->Value(); |
Lines 2469-2475
Link Here
|
2469 |
if(!shininess||stricmp(shininess->Value(),"SHININESS")!=0) |
2469 |
if(!shininess||stricmp(shininess->Value(),"SHININESS")!=0) |
2470 |
{ |
2470 |
{ |
2471 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2471 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2472 |
return false; |
2472 |
return NULL; |
2473 |
} |
2473 |
} |
2474 |
|
2474 |
|
2475 |
float fshininess; |
2475 |
float fshininess; |
Lines 2477-2489
Link Here
|
2477 |
if(!node) |
2477 |
if(!node) |
2478 |
{ |
2478 |
{ |
2479 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2479 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2480 |
return false; |
2480 |
return NULL; |
2481 |
} |
2481 |
} |
2482 |
TiXmlText* shininessdata = node->ToText(); |
2482 |
TiXmlText* shininessdata = node->ToText(); |
2483 |
if(!shininessdata) |
2483 |
if(!shininessdata) |
2484 |
{ |
2484 |
{ |
2485 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2485 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2486 |
return false; |
2486 |
return NULL; |
2487 |
} |
2487 |
} |
2488 |
fshininess = (float)atof(shininessdata->Value()); |
2488 |
fshininess = (float)atof(shininessdata->Value()); |
2489 |
|
2489 |
|
Lines 2502-2508
Link Here
|
2502 |
if(!map||stricmp(map->Value(),"MAP")!=0) |
2502 |
if(!map||stricmp(map->Value(),"MAP")!=0) |
2503 |
{ |
2503 |
{ |
2504 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2504 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2505 |
return false; |
2505 |
return NULL; |
2506 |
} |
2506 |
} |
2507 |
|
2507 |
|
2508 |
|
2508 |
|
Lines 2510-2523
Link Here
|
2510 |
if(!node) |
2510 |
if(!node) |
2511 |
{ |
2511 |
{ |
2512 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2512 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2513 |
return false; |
2513 |
return NULL; |
2514 |
} |
2514 |
} |
2515 |
|
2515 |
|
2516 |
TiXmlText* mapfile = node->ToText(); |
2516 |
TiXmlText* mapfile = node->ToText(); |
2517 |
if(!mapfile) |
2517 |
if(!mapfile) |
2518 |
{ |
2518 |
{ |
2519 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2519 |
CalError::setLastError(CalError::INVALID_FILE_FORMAT, __FILE__, __LINE__, strFilename); |
2520 |
return false; |
2520 |
return NULL; |
2521 |
} |
2521 |
} |
2522 |
|
2522 |
|
2523 |
MatFileName.push_back(mapfile->Value()); |
2523 |
MatFileName.push_back(mapfile->Value()); |