added color token to parser for specifying both diffuse and ambient color in a material, added ColorNode, switched color nodes to inherit from VectorNode
git-svn-id: svn://anubis/fart/trunk@163 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
44ba550f68
commit
1924bea5cf
@ -58,8 +58,10 @@ class VectorNode : public Node
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class AmbientNode : public Node
|
class AmbientNode : public VectorNode
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
AmbientNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BoxNode : public Node
|
class BoxNode : public Node
|
||||||
@ -70,8 +72,16 @@ class CameraNode : public Node
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiffuseNode : public Node
|
class ColorNode : public VectorNode
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
ColorNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class DiffuseNode : public VectorNode
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DiffuseNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class HeightNode : public IntegerNode
|
class HeightNode : public IntegerNode
|
||||||
@ -201,8 +211,10 @@ class SizeNode : public VectorNode
|
|||||||
SizeNode(refptr<Vector> vector) : VectorNode(vector) {}
|
SizeNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpecularNode : public Node
|
class SpecularNode : public VectorNode
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
SpecularNode(refptr<Vector> vector) : VectorNode(vector) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class SphereNode : public Node
|
class SphereNode : public Node
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
ambient return AMBIENT;
|
ambient return AMBIENT;
|
||||||
box return BOX;
|
box return BOX;
|
||||||
camera return CAMERA;
|
camera return CAMERA;
|
||||||
|
color return COLOR;
|
||||||
diffuse return DIFFUSE;
|
diffuse return DIFFUSE;
|
||||||
height return HEIGHT;
|
height return HEIGHT;
|
||||||
intersect return INTERSECT;
|
intersect return INTERSECT;
|
||||||
|
@ -61,6 +61,7 @@ static refptr<Node> parsed_scene_node;
|
|||||||
%token AMBIENT;
|
%token AMBIENT;
|
||||||
%token BOX;
|
%token BOX;
|
||||||
%token CAMERA;
|
%token CAMERA;
|
||||||
|
%token COLOR;
|
||||||
%token DIFFUSE;
|
%token DIFFUSE;
|
||||||
%token HEIGHT;
|
%token HEIGHT;
|
||||||
%token INTERSECT;
|
%token INTERSECT;
|
||||||
@ -175,12 +176,10 @@ light_item: POSITION vector {
|
|||||||
$$->addChild($2);
|
$$->addChild($2);
|
||||||
}
|
}
|
||||||
| DIFFUSE vector {
|
| DIFFUSE vector {
|
||||||
$$ = new DiffuseNode();
|
$$ = new DiffuseNode($2->getVector());
|
||||||
$$->addChild($2);
|
|
||||||
}
|
}
|
||||||
| SPECULAR vector {
|
| SPECULAR vector {
|
||||||
$$ = new SpecularNode();
|
$$ = new SpecularNode($2->getVector());
|
||||||
$$->addChild($2);
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -198,17 +197,17 @@ material_items: /* empty */
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
material_item: AMBIENT vector {
|
material_item: COLOR vector {
|
||||||
$$ = new AmbientNode();
|
$$ = new ColorNode($2->getVector());
|
||||||
$$->addChild($2);
|
}
|
||||||
|
| AMBIENT vector {
|
||||||
|
$$ = new AmbientNode($2->getVector());
|
||||||
}
|
}
|
||||||
| DIFFUSE vector {
|
| DIFFUSE vector {
|
||||||
$$ = new DiffuseNode();
|
$$ = new DiffuseNode($2->getVector());
|
||||||
$$->addChild($2);
|
|
||||||
}
|
}
|
||||||
| SPECULAR vector {
|
| SPECULAR vector {
|
||||||
$$ = new SpecularNode();
|
$$ = new SpecularNode($2->getVector());
|
||||||
$$->addChild($2);
|
|
||||||
}
|
}
|
||||||
| REFLECTANCE number {
|
| REFLECTANCE number {
|
||||||
$$ = new ReflectanceNode($2->getNumber());
|
$$ = new ReflectanceNode($2->getNumber());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user