filled out Scene::processPlane()
git-svn-id: svn://anubis/fart/trunk@166 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
e40677ba77
commit
5a83786103
@ -265,8 +265,39 @@ refptr<Light> Scene::processLight(refptr<Node> node)
|
|||||||
|
|
||||||
refptr<Shape> Scene::processPlane(refptr<Node> node)
|
refptr<Shape> Scene::processPlane(refptr<Node> node)
|
||||||
{
|
{
|
||||||
/* TODO: finish */
|
Vector normal(0, 0, 1);
|
||||||
return refptr<Shape>(NULL);
|
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)
|
refptr<Shape> Scene::processSphere(refptr<Node> node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user