added Extrude and Polygon classes, still in progress
git-svn-id: svn://anubis/fart/trunk@269 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
ad017df3b5
commit
7d844667c3
8 files changed
+157
-1
No files matched your search
@@ -1,10 +1,12 @@
|
||||
|
||||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
|
||||
#include "Scene.h"
|
||||
#include "Light.h"
|
||||
#include "parser/parser.h"
|
||||
#include "parser/nodes.h"
|
||||
#include "util/Polygon.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -135,6 +137,10 @@ refptr<Shape> Scene::processShape(refptr<Node> node)
|
||||
{
|
||||
return processBool(node);
|
||||
}
|
||||
else if ( typeid(*node) == typeid(ExtrudeNode) )
|
||||
{
|
||||
return processExtrude(node);
|
||||
}
|
||||
|
||||
return refptr<Shape>(NULL);
|
||||
}
|
||||
@@ -539,6 +545,59 @@ refptr<Shape> Scene::processBool(refptr<Node> node)
|
||||
return shape;
|
||||
}
|
||||
|
||||
refptr<Shape> Scene::processExtrude(refptr<Node> node)
|
||||
{
|
||||
refptr<Material> material;
|
||||
Extrude * extrude = new Extrude();
|
||||
|
||||
bool restore_transform = processTransforms(node);
|
||||
|
||||
for (Node_Iterator it = node->getChildren().begin();
|
||||
it != node->getChildren().end();
|
||||
it++)
|
||||
{
|
||||
if ( typeid(**it) == typeid(PolygonNode) )
|
||||
{
|
||||
extrude->addPolygon(processPolygon(*it));
|
||||
}
|
||||
else if ( typeid(**it) == typeid(NGonNode) )
|
||||
{
|
||||
extrude->addPolygon(processNGon(*it));
|
||||
}
|
||||
else if ( typeid(**it) == typeid(OffsetNode) )
|
||||
{
|
||||
/* FIXME */
|
||||
}
|
||||
else if ( (*it)->isMaterial() )
|
||||
{
|
||||
material = processMaterial(*it);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! material.isNull() )
|
||||
extrude->setMaterial(material);
|
||||
extrude->setTransform(m_transforms.top());
|
||||
|
||||
if (restore_transform)
|
||||
m_transforms.pop();
|
||||
|
||||
return extrude;
|
||||
}
|
||||
|
||||
refptr<Polygon> Scene::processPolygon(refptr<Node> node)
|
||||
{
|
||||
refptr<Polygon> p = new Polygon();
|
||||
/* FIXME */
|
||||
return p;
|
||||
}
|
||||
|
||||
refptr<Polygon> Scene::processNGon(refptr<Node> node)
|
||||
{
|
||||
refptr<Polygon> p = new Polygon();
|
||||
/* FIXME */
|
||||
return p;
|
||||
}
|
||||
|
||||
bool Scene::processTransforms(refptr<Node> node)
|
||||
{
|
||||
bool did_any = false;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "util/Ray.h"
|
||||
#include "util/Color.h"
|
||||
#include "util/Material.h"
|
||||
#include "util/Polygon.h"
|
||||
|
||||
#include "shapes/shapes.h"
|
||||
|
||||
@@ -66,6 +67,9 @@ class Scene
|
||||
refptr<Shape> processSphere(refptr<Node> node);
|
||||
refptr<Shape> processShape(refptr<Node> node);
|
||||
refptr<Shape> processBool(refptr<Node> node);
|
||||
refptr<Shape> processExtrude(refptr<Node> node);
|
||||
refptr<Polygon> processPolygon(refptr<Node> node);
|
||||
refptr<Polygon> processNGon(refptr<Node> node);
|
||||
bool processTransforms(refptr<Node> node);
|
||||
void processCamera(refptr<Node> node);
|
||||
void processOptions(refptr<Node> node);
|
||||
|
||||
Reference in new issue
Block a user