made parser/parser.yy:parse() a method of class Scene so no global g_scene is needed

git-svn-id: svn://anubis/fart/trunk@100 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-11 17:08:38 +00:00
parent 8b9b6332cc
commit ee64558db6
2 changed files with 3 additions and 4 deletions

View File

@ -46,6 +46,7 @@ class Scene
void renderPixel(int x, int y, unsigned char * pixel); void renderPixel(int x, int y, unsigned char * pixel);
Color traceRay(const Ray & ray); Color traceRay(const Ray & ray);
std::vector<ShapeDistance> getRayHits(const Ray & ray); std::vector<ShapeDistance> getRayHits(const Ray & ray);
int parse(const char * fileName);
/* rendering parameters */ /* rendering parameters */
int m_width; int m_width;

View File

@ -47,8 +47,6 @@ enum Node_Type
Node_Options Node_Options
}; };
static Scene * g_scene;
#define YYSTYPE refptr<Node> #define YYSTYPE refptr<Node>
%} %}
@ -289,9 +287,8 @@ vector: LESS number COMMA number COMMA number GREATER {
%% %%
int parse(Scene * scene, const char * fileName) int Scene::parse(const char * fileName)
{ {
g_scene = scene;
yyin = fopen(fileName, "r"); yyin = fopen(fileName, "r");
if (yyin == NULL) if (yyin == NULL)
{ {
@ -299,6 +296,7 @@ int parse(Scene * scene, const char * fileName)
return -1; return -1;
} }
yyparse(); yyparse();
return 0;
} }
Node::Node() Node::Node()