bool sub-objects using relative coordinates, shape definitions using relative coordinates, this allows transform blocks in each, and shape references to combine absolute transform with the relative transform

git-svn-id: svn://anubis/fart/trunk@287 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2010-07-09 19:37:05 +00:00
1 parent b4a2c8ef8e
commit b0dfa2ee1f
7 files changed
+46 -30

No files matched your search

+6 -7
View File
@@ -532,6 +532,7 @@ refptr<Shape> Scene::processBool(refptr<Node> node)
refptr<Material> material;
bool restore_transform = processTransforms(node);
m_transforms.push(Transform());
for (Node_Iterator it = node->getChildren().begin();
it != node->getChildren().end();
@@ -559,11 +560,6 @@ refptr<Shape> Scene::processBool(refptr<Node> node)
{
processShapeDefinition(*it);
}
else
{
cerr << "Error: unknown boolean object item" << endl;
exit(3);
}
}
if (shapes.size() < 2)
@@ -589,8 +585,9 @@ refptr<Shape> Scene::processBool(refptr<Node> node)
if ( ! material.isNull() )
shape->setMaterial(material);
shape->setTransform(m_transforms.top());
m_transforms.pop();
shape->setTransform(m_transforms.top());
if (restore_transform)
m_transforms.pop();
@@ -715,7 +712,7 @@ refptr<Shape> Scene::processShapeRef(refptr<Node> node)
!= m_shape_definitions.end())
{
refptr<Shape> shape = m_shape_definitions[node->getString()]->clone();
shape->setTransform(m_transforms.top());
shape->setTransform(m_transforms.top() * shape->getTransform());
return shape;
}
cerr << "Error: no shape definition for '" << node->getString()
@@ -766,6 +763,8 @@ bool Scene::processTransforms(refptr<Node> node)
void Scene::processShapeDefinition(refptr<Node> node)
{
m_transforms.push(Transform());
m_shape_definitions[node->getString()]
= processShape(node->getChildren()[0]);
m_transforms.pop();
}