added "refraction" to parser, added RefractionNode node type

git-svn-id: svn://anubis/fart/trunk@373 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2010-10-11 15:36:02 +00:00
parent ed58d2ec7a
commit 3594dace7f
4 changed files with 14 additions and 1 deletions

View File

@ -410,6 +410,16 @@ class ReflectanceNode : public NumberNode
} }
}; };
class RefractionNode : public NumberNode
{
public:
RefractionNode(NodeRef e) : NumberNode(e) {}
virtual NodeRef evaluate()
{
return new RefractionNode(m_expr->evaluate());
}
};
class RotateNode : public VectorNode class RotateNode : public VectorNode
{ {
public: public:

View File

@ -76,6 +76,7 @@ polygon return POLYGON;
position return POSITION; position return POSITION;
radius return RADIUS; radius return RADIUS;
reflectance return REFLECTANCE; reflectance return REFLECTANCE;
refraction return REFRACTION;
rotate return ROTATE; rotate return ROTATE;
scale return SCALE; scale return SCALE;
scene return SCENE; scene return SCENE;

View File

@ -94,6 +94,7 @@ refptr<Scope> parser_scope;
%token POSITION; %token POSITION;
%token RADIUS; %token RADIUS;
%token REFLECTANCE; %token REFLECTANCE;
%token REFRACTION;
%token ROTATE; %token ROTATE;
%token SCALE; %token SCALE;
%token SCENE; %token SCENE;
@ -197,6 +198,7 @@ general_item: AMBIENT vector3 { $$ = new AmbientNode($2); }
} }
| RADIUS expression { $$ = new RadiusNode($2); } | RADIUS expression { $$ = new RadiusNode($2); }
| REFLECTANCE expression { $$ = new ReflectanceNode($2); } | REFLECTANCE expression { $$ = new ReflectanceNode($2); }
| REFRACTION expression { $$ = new RefractionNode($2); }
| ROTATE expression COMMA vector3 { $$ = new RotateNode($2, $4); } | ROTATE expression COMMA vector3 { $$ = new RotateNode($2, $4); }
| SCALE expression { $$ = new ScaleNode(new ScaleScalarNode($2)); } | SCALE expression { $$ = new ScaleNode(new ScaleScalarNode($2)); }
| SCALE vector2 { $$ = new ScaleNode($2); } | SCALE vector2 { $$ = new ScaleNode($2); }

View File

@ -10,7 +10,7 @@ endif
syn case match syn case match
syn keyword fartKeywords ambient ambient_occlusion color define diffuse exposure height jitter look_at material max_depth multisample ngon offset polygon position radius reflectance rotate scale shininess size specular translate transparency union up vfov width syn keyword fartKeywords ambient ambient_occlusion color define diffuse exposure height jitter look_at material max_depth multisample ngon offset polygon position radius reflectance refraction rotate scale shininess size specular translate transparency union up vfov width
syn keyword fartObjects box camera cyl extrude intersect light options plane scene shape sphere subtract union syn keyword fartObjects box camera cyl extrude intersect light options plane scene shape sphere subtract union
syn keyword fartControl for while if else elsif local syn keyword fartControl for while if else elsif local
syn match fartNumber "\(^\|\W\)\@<=[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\=" syn match fartNumber "\(^\|\W\)\@<=[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="