added "cyl" token to parser and parser rules for cyl object

git-svn-id: svn://anubis/fart/trunk@165 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop committed 2009-02-28 20:32:23 +00:00
1 parent 0462a2e7bc
commit e40677ba77
4 files changed
+96 -7

No files matched your search

+4
View File
@@ -78,6 +78,10 @@ class ColorNode : public VectorNode
ColorNode(refptr<Vector> vector) : VectorNode(vector) {}
};
class CylNode : public Node
{
};
class DiffuseNode : public VectorNode
{
public:
+1
View File
@@ -43,6 +43,7 @@ ambient return AMBIENT;
box return BOX;
camera return CAMERA;
color return COLOR;
cyl return CYL;
diffuse return DIFFUSE;
height return HEIGHT;
intersect return INTERSECT;
+22
View File
@@ -62,6 +62,7 @@ static refptr<Node> parsed_scene_node;
%token BOX;
%token CAMERA;
%token COLOR;
%token CYL;
%token DIFFUSE;
%token HEIGHT;
%token INTERSECT;
@@ -149,6 +150,26 @@ camera_item: POSITION vector {
}
;
cyl: CYL LCURLY cyl_items RCURLY {
$$ = new CylNode();
$$->addChildren($3);
}
;
cyl_items: /* empty */
| cyl_item cyl_items {
$$ = new ItemsNode();
$$->addChild($1);
$$->addChildren($2);
}
;
cyl_item: SIZE vector {
$$ = new SizeNode($2->getVector());
}
| shape_item { $$ = $1; }
;
intersect: INTERSECT LCURLY shape shape shape_items RCURLY {
$$ = new IntersectNode();
$$->addChild($3);
@@ -289,6 +310,7 @@ scene_item: camera { $$ = $1; }
shape: plane { $$ = $1; }
| sphere { $$ = $1; }
| box { $$ = $1; }
| cyl { $$ = $1; }
| union { $$ = $1; }
| intersect { $$ = $1; }
| subtract { $$ = $1; }