added boolean shapes to parser

git-svn-id: svn://anubis/fart/trunk@86 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-08 23:57:57 +00:00
parent f5dc4c7f93
commit c3e31eab4a
2 changed files with 25 additions and 0 deletions

View File

@ -36,6 +36,7 @@ box return BOX;
camera return CAMERA;
color return COLOR;
height return HEIGHT;
intersect return INTERSECT;
look_at return LOOKAT;
material return MATERIAL;
multisample return MULTISAMPLE;
@ -48,6 +49,8 @@ scene return SCENE;
shininess return SHININESS;
size return SIZE;
sphere return SPHERE;
subtract return SUBTRACT;
union return UNION;
up return UP;
vfov return VFOV;
width return WIDTH;

View File

@ -55,6 +55,7 @@ int yywrap()
%token CAMERA;
%token COLOR;
%token HEIGHT;
%token INTERSECT;
%token LOOKAT;
%token MATERIAL;
%token MULTISAMPLE;
@ -67,6 +68,8 @@ int yywrap()
%token SHININESS;
%token SIZE;
%token SPHERE;
%token SUBTRACT;
%token UNION;
%token UP;
%token VFOV;
%token WIDTH;
@ -77,6 +80,13 @@ scene: /* empty */
| scene_spec { printf("Saw a scene\n"); }
;
boolean_items: shape shape boolean_items_more
;
boolean_items_more: /* empty */
| material boolean_items_more
;
box: BOX LCURLY box_items RCURLY
;
@ -97,6 +107,9 @@ camera_item: POSITION vector
| VFOV vector
;
intersect: INTERSECT LCURLY boolean_items RCURLY
;
material: MATERIAL LCURLY material_items RCURLY
;
@ -134,6 +147,9 @@ scene_item: camera
shape: plane
| sphere
| box
| union
| intersect
| subtract
;
shape_items: /* empty */
@ -147,6 +163,12 @@ sphere_items: shape_items
| RADIUS number sphere_items
;
subtract: SUBTRACT LCURLY boolean_items RCURLY
;
union: UNION LCURLY boolean_items RCURLY
;
vector: LESS number COMMA number COMMA number GREATER
;