# HG changeset patch # User John Tsiombikas # Date 1397514963 -10800 # Node ID 6b11a3f8706eeb8a1a9773b4eff0fe16f25867b0 # Parent 252999cd1a3fe2d085c827fb0c689018d764d21c foo diff -r 252999cd1a3f -r 6b11a3f8706e src/scene.cc --- a/src/scene.cc Tue Apr 15 00:59:37 2014 +0300 +++ b/src/scene.cc Tue Apr 15 01:36:03 2014 +0300 @@ -254,3 +254,33 @@ } return hit && hit->obj; } + +bool Scene::load(const char *fname) +{ + FILE *fp = fopen(fname, "r"); + if(!fp) { + return false; + } + bool res = load(fp); + fclose(fp); + return res; +} + +bool Scene::save(const char *fname) const +{ + FILE *fp = fopen(fname, "w"); + if(!fp) { + return false; + } + bool res = save(fp); + fclose(fp); + return res; +} + +bool Scene::load(FILE *fp) +{ + char *block; + while((block = get_next_block(fp))) { + + } +} diff -r 252999cd1a3f -r 6b11a3f8706e src/scene.h --- a/src/scene.h Tue Apr 15 00:59:37 2014 +0300 +++ b/src/scene.h Tue Apr 15 01:36:03 2014 +0300 @@ -70,6 +70,12 @@ int get_selection(int idx = 0) const; bool intersect(const Ray &ray, RayHit *hit = 0) const; + + bool load(const char *fname); + bool save(const char *fname) const; + + bool load(FILE *fp); + bool save(FILE *fp) const; }; #endif // SCENE_H_