removed processNode() and processChildren()

git-svn-id: svn://anubis/fart/branches/scene-file-scripting@334 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2010-10-04 21:47:07 +00:00
parent e23b762a01
commit 74f27c2076
2 changed files with 13 additions and 59 deletions

View File

@ -19,64 +19,10 @@ void Scene::load(const char * filename)
{
refptr<Scope> scope = new Scope();
refptr<Node> node = parse(filename, scope);
processNode(node);
}
void Scene::processNode(refptr<Node> node)
{
if (node.isNull())
return;
if ( typeid(*node) == typeid(SceneNode) )
if ( ! node.isNull() )
{
processScene(node);
}
else if ( node->isShape() )
{
ShapeRef shape = processShape(node);
if ( ! shape.isNull() )
m_shapes.push_back(shape);
}
else if ( typeid(*node) == typeid(LightNode) )
{
refptr<Light> light = processLight(node);
if ( ! light.isNull() )
m_lights.push_back(light);
}
else if ( typeid(*node) == typeid(OptionsNode) )
{
processOptions(node);
}
else if (node->isTransformBlock())
{
vector<ShapeRef> shapes = processTransformBlock(node);
for (int i = 0, sz = shapes.size(); i < sz; i++)
{
m_shapes.push_back(shapes[i]);
}
}
else if ( typeid(*node) == typeid(MaterialDefinitionNode) )
{
processMaterialDefinition(node);
}
else if ( typeid(*node) == typeid(ShapeDefinitionNode) )
{
processShapeDefinition(node);
}
else
{
cerr << __FILE__ << ": " << __LINE__
<< ": error: unrecognized node!" << endl;
}
}
void Scene::processChildren(refptr<Node> node)
{
std::vector< refptr<Node> > & children = node->getChildren();
for (int i = 0, sz = children.size(); i < sz; i++)
{
processNode(children[i]);
}
}
void Scene::processScene(refptr<Node> node)
@ -100,15 +46,25 @@ void Scene::processScene(refptr<Node> node)
}
}
/* then any other scene-specific items */
for (Node_Iterator it = node->getChildren().begin();
it != node->getChildren().end();
it++)
{
if ( typeid(**it) != typeid(CameraNode) )
if ( typeid(**it) == typeid(LightNode) )
{
processNode(*it);
refptr<Light> light = processLight(*it);
if ( ! light.isNull() )
m_lights.push_back(light);
}
else if ( typeid(**it) == typeid(OptionsNode) )
{
processOptions(*it);
}
}
/* then any general items */
processGeneralItems(node);
}
ShapeRef Scene::processShape(refptr<Node> node)

View File

@ -58,8 +58,6 @@ class Scene
/* In Scene-load.cc */
void load(const char * filename);
void processNode(refptr<Node> node);
void processChildren(refptr<Node> node);
void processScene(refptr<Node> node);
refptr<Material> processMaterial(refptr<Node> node);
ShapeRef processBox(refptr<Node> node);