filled out Scene::processPlane()

git-svn-id: svn://anubis/fart/trunk@166 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-28 20:39:29 +00:00
parent e40677ba77
commit 5a83786103

View File

@ -265,8 +265,39 @@ refptr<Light> Scene::processLight(refptr<Node> node)
refptr<Shape> Scene::processPlane(refptr<Node> node)
{
/* TODO: finish */
return refptr<Shape>(NULL);
Vector normal(0, 0, 1);
double dist = 0;
refptr<Material> material;
bool restore_transform = processTransforms(node);
for (Node_Iterator it = node->getChildren().begin();
it != node->getChildren().end();
it++)
{
if ( typeid(**it) == typeid(PlanePositionNode) )
{
normal = *(*it)->getVector();
dist = (*it)->getNumber();
}
else if ( typeid(**it) == typeid(MaterialNode) )
{
material = processMaterial(*it);
}
}
refptr<Shape> plane = new Plane(normal[0],
normal[1],
normal[2],
dist);
if ( ! material.isNull() )
plane->setMaterial(material);
plane->setTransform(m_transforms.top());
if (restore_transform)
m_transforms.pop();
return plane;
}
refptr<Shape> Scene::processSphere(refptr<Node> node)