added TEXTURE token, rule, and node type

git-svn-id: svn://anubis/fart/trunk@383 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2010-10-13 20:40:44 +00:00
parent 48e2900e1f
commit 7472d6c53c
4 changed files with 11 additions and 1 deletions

View File

@ -552,6 +552,13 @@ class SubtractNode : public Node
virtual NodeRef evaluate() { return new SubtractNode(); }
};
class TextureNode : public IdentifierNode
{
public:
TextureNode(const std::string & str) : IdentifierNode(str) {}
virtual NodeRef evaluate() { return new TextureNode(m_string); }
};
class TranslateNode : public VectorNode
{
public:

View File

@ -90,6 +90,7 @@ size return SIZE;
specular return SPECULAR;
sphere return SPHERE;
subtract return SUBTRACT;
texture return TEXTURE;
translate return TRANSLATE;
transparency return TRANSPARENCY;
union return UNION;

View File

@ -103,6 +103,7 @@ refptr<Scope> parser_scope;
%token SPECULAR;
%token SPHERE;
%token SUBTRACT;
%token TEXTURE;
%token TRANSLATE;
%token TRANSPARENCY;
%token UNION;
@ -208,6 +209,7 @@ general_item: AMBIENT vector3 { $$ = new AmbientNode($2); }
| SIZE vector3 { $$ = new SizeNode($2); }
| SPECULAR vector3 { $$ = new SpecularNode($2); }
| stmt_expression { $$ = $1; }
| TEXTURE STRING { $$ = new TextureNode($2->getString()); }
| transform_block { $$ = $1; }
| TRANSLATE vector3 { $$ = new TranslateNode($2); }
| TRANSPARENCY expression { $$ = new TransparencyNode($2); }

View File

@ -10,7 +10,7 @@ endif
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 refraction 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 texture translate transparency union up vfov width
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 match fartNumber "\(^\|\W\)\@<=[+-]\=\(\d\+\)\=\.\=\d\+\([eE][+-]\=\d\+\)\="