Added handling of $ comment line, and 'g' empty group name

This commit is contained in:
Robert Osfield
2004-08-29 15:09:26 +00:00
parent 2f4a384fa9
commit 6a82bb28fc

View File

@@ -104,7 +104,7 @@ bool Model::readMTL(std::istream& fin)
while (fin)
{
readline(fin,line,LINE_SIZE);
if (line[0]=='#')
if (line[0]=='#' || line[0]=='$')
{
// comment line
// osg::notify(osg::NOTICE) <<"Comment: "<<line<<std::endl;
@@ -264,7 +264,7 @@ bool Model::readOBJ(std::istream& fin)
while (fin)
{
readline(fin,line,LINE_SIZE);
if (line[0]=='#')
if (line[0]=='#' || line[0]=='$')
{
// comment line
// osg::notify(osg::NOTICE) <<"Comment: "<<line<<std::endl;
@@ -397,6 +397,15 @@ bool Model::readOBJ(std::istream& fin)
currentElementList = 0; // reset the element list to force a recompute of which ElementList to use
}
}
else if (strcmp(line,"o")==0)
{
std::string objectName(""); // empty name
if (currentElementState.objectName != objectName)
{
currentElementState.objectName = objectName;
currentElementList = 0; // reset the element list to force a recompute of which ElementList to use
}
}
else if (strncmp(line,"g ",2)==0)
{
std::string groupName(line+2);
@@ -406,6 +415,15 @@ bool Model::readOBJ(std::istream& fin)
currentElementList = 0; // reset the element list to force a recompute of which ElementList to use
}
}
else if (strcmp(line,"g")==0)
{
std::string groupName(""); // empty name
if (currentElementState.groupName != groupName)
{
currentElementState.groupName = groupName;
currentElementList = 0; // reset the element list to force a recompute of which ElementList to use
}
}
else if (strncmp(line,"s ",2)==0)
{
int smoothingGroup=0;