catch a few error conditions for extrudes and polygons
git-svn-id: svn://anubis/fart/trunk@271 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
4c5444f053
commit
b51d11d043
@ -569,6 +569,11 @@ refptr<Shape> Scene::processExtrude(refptr<Node> node)
|
||||
else if ( typeid(**it) == typeid(OffsetNode) )
|
||||
{
|
||||
double distance = (*it)->getNumber();
|
||||
if (distance <= 0.0)
|
||||
{
|
||||
cerr << "Error: extrude distance must be positive" << endl;
|
||||
exit(3);
|
||||
}
|
||||
Vector scale(1, 1, 1);
|
||||
Vector position(0, 0, 0);
|
||||
for (Node_Iterator it2 = (*it)->getChildren().begin();
|
||||
@ -584,6 +589,11 @@ refptr<Shape> Scene::processExtrude(refptr<Node> node)
|
||||
position = * (*it2)->getVector();
|
||||
}
|
||||
}
|
||||
if (scale[0] < 0.0 || scale[1] < 0.0)
|
||||
{
|
||||
cerr << "Error: extrude scale cannot be negative" << endl;
|
||||
exit(3);
|
||||
}
|
||||
extrude->addOffset(distance, scale, position);
|
||||
}
|
||||
else if ( (*it)->isMaterial() )
|
||||
@ -619,6 +629,11 @@ refptr<Polygon> Scene::processPolygon(refptr<Node> node)
|
||||
exit(3);
|
||||
}
|
||||
}
|
||||
if (p->size() < 3)
|
||||
{
|
||||
cerr << "Error: Polygon with fewer than three points!" << endl;
|
||||
exit(3);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user