added shape definitions into parser, not using them yet
git-svn-id: svn://anubis/fart/trunk@283 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
340742d27b
commit
5308913bdb
@ -90,6 +90,7 @@ class Scene
|
|||||||
|
|
||||||
/* private data */
|
/* private data */
|
||||||
std::vector< refptr<Shape> > m_shapes;
|
std::vector< refptr<Shape> > m_shapes;
|
||||||
|
std::vector< refptr<Shape> > m_shape_definitions;
|
||||||
std::vector< refptr<Light> > m_lights;
|
std::vector< refptr<Light> > m_lights;
|
||||||
std::stack<Transform> m_transforms;
|
std::stack<Transform> m_transforms;
|
||||||
double m_view_plane_dist;
|
double m_view_plane_dist;
|
||||||
|
@ -288,6 +288,18 @@ class SceneNode : public Node
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShapeDefinitionNode : public IdentifierNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ShapeDefinitionNode(const std::string & str) : IdentifierNode(str) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class ShapeRefNode : public IdentifierNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ShapeRefNode(const std::string & str) : IdentifierNode(str) {}
|
||||||
|
};
|
||||||
|
|
||||||
class ShininessNode : public NumberNode
|
class ShininessNode : public NumberNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -68,6 +68,7 @@ reflectance return REFLECTANCE;
|
|||||||
rotate return ROTATE;
|
rotate return ROTATE;
|
||||||
scale return SCALE;
|
scale return SCALE;
|
||||||
scene return SCENE;
|
scene return SCENE;
|
||||||
|
shape return SHAPE;
|
||||||
shininess return SHININESS;
|
shininess return SHININESS;
|
||||||
size return SIZE;
|
size return SIZE;
|
||||||
specular return SPECULAR;
|
specular return SPECULAR;
|
||||||
|
@ -87,6 +87,7 @@ static refptr<Node> parsed_scene_node;
|
|||||||
%token ROTATE;
|
%token ROTATE;
|
||||||
%token SCALE;
|
%token SCALE;
|
||||||
%token SCENE;
|
%token SCENE;
|
||||||
|
%token SHAPE;
|
||||||
%token SHININESS;
|
%token SHININESS;
|
||||||
%token SIZE;
|
%token SIZE;
|
||||||
%token SPECULAR;
|
%token SPECULAR;
|
||||||
@ -435,6 +436,7 @@ scene_item: camera { $$ = $1; }
|
|||||||
| light { $$ = $1; }
|
| light { $$ = $1; }
|
||||||
| transform_block { $$ = $1; }
|
| transform_block { $$ = $1; }
|
||||||
| material_definition { $$ = $1; }
|
| material_definition { $$ = $1; }
|
||||||
|
| shape_definition { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
shape: plane { $$ = $1; }
|
shape: plane { $$ = $1; }
|
||||||
@ -445,6 +447,16 @@ shape: plane { $$ = $1; }
|
|||||||
| intersect { $$ = $1; }
|
| intersect { $$ = $1; }
|
||||||
| subtract { $$ = $1; }
|
| subtract { $$ = $1; }
|
||||||
| extrude { $$ = $1; }
|
| extrude { $$ = $1; }
|
||||||
|
| shape_ref { $$ = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
|
shape_definition: DEFINE SHAPE IDENTIFIER shape {
|
||||||
|
$$ = new ShapeDefinitionNode($3->getString());
|
||||||
|
$$->addChild($4);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
shape_ref: SHAPE IDENTIFIER { $$ = new ShapeRefNode($2->getString()); }
|
||||||
;
|
;
|
||||||
|
|
||||||
shape_item: material { $$ = $1; }
|
shape_item: material { $$ = $1; }
|
||||||
@ -522,6 +534,7 @@ transform_block_items: /* empty */
|
|||||||
transform_block_item: transform_block { $$ = $1; }
|
transform_block_item: transform_block { $$ = $1; }
|
||||||
| light { $$ = $1; }
|
| light { $$ = $1; }
|
||||||
| shape { $$ = $1; }
|
| shape { $$ = $1; }
|
||||||
|
| shape_definition { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
union: UNION LCURLY bool_items RCURLY {
|
union: UNION LCURLY bool_items RCURLY {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user