added transform_block to parser, {Translate,Rotate,Scale}BlockNode nodes
git-svn-id: svn://anubis/fart/trunk@118 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
0e22a21637
commit
0fea65d4ef
@ -166,12 +166,27 @@ class RotateNode : public VectorNode
|
|||||||
double m_angle;
|
double m_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RotateBlockNode : public RotateNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RotateBlockNode(double angle, refptr<Vector> vector)
|
||||||
|
: RotateNode(angle, vector)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ScaleNode : public VectorNode
|
class ScaleNode : public VectorNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScaleNode(refptr<Vector> vector) : VectorNode(vector) {}
|
ScaleNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ScaleBlockNode : public ScaleNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScaleBlockNode(refptr<Vector> vector) : ScaleNode(vector) {}
|
||||||
|
};
|
||||||
|
|
||||||
class SceneNode : public Node
|
class SceneNode : public Node
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
@ -210,6 +225,12 @@ class TranslateNode : public VectorNode
|
|||||||
TranslateNode(refptr<Vector> vector) : VectorNode(vector) {}
|
TranslateNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TranslateBlockNode : public TranslateNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TranslateBlockNode(refptr<Vector> vector) : TranslateNode(vector) {}
|
||||||
|
};
|
||||||
|
|
||||||
class UnionNode : public Node
|
class UnionNode : public Node
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
@ -283,6 +283,7 @@ scene_item: camera { $$ = $1; }
|
|||||||
| shape { $$ = $1; }
|
| shape { $$ = $1; }
|
||||||
| options { $$ = $1; }
|
| options { $$ = $1; }
|
||||||
| light { $$ = $1; }
|
| light { $$ = $1; }
|
||||||
|
| transform_block { $$ = $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
shape: plane { $$ = $1; }
|
shape: plane { $$ = $1; }
|
||||||
@ -342,6 +343,33 @@ transform: TRANSLATE vector {
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
transform_block: TRANSLATE vector LCURLY transform_block_items RCURLY {
|
||||||
|
$$ = new TranslateBlockNode($2->getVector());
|
||||||
|
$$->addChildren($4);
|
||||||
|
}
|
||||||
|
| ROTATE number COMMA vector LCURLY transform_block_items RCURLY {
|
||||||
|
$$ = new RotateBlockNode($2->getNumber(), $4->getVector());
|
||||||
|
$$->addChildren($6);
|
||||||
|
}
|
||||||
|
| SCALE vector LCURLY transform_block_items RCURLY {
|
||||||
|
$$ = new ScaleBlockNode($2->getVector());
|
||||||
|
$$->addChildren($4);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
transform_block_items: /* empty */
|
||||||
|
| transform_block_item transform_block_items {
|
||||||
|
$$ = new ItemsNode();
|
||||||
|
$$->addChild($1);
|
||||||
|
$$->addChildren($2);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
transform_block_item: transform_block { $$ = $1; }
|
||||||
|
| light { $$ = $1; }
|
||||||
|
| shape { $$ = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
union: UNION LCURLY shape shape shape_items RCURLY {
|
union: UNION LCURLY shape shape shape_items RCURLY {
|
||||||
$$ = new UnionNode();
|
$$ = new UnionNode();
|
||||||
$$->addChild($3);
|
$$->addChild($3);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user