• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

##### Share on other sites
Shader readshader(filestream f):  read whatever header punctuation and discard  s : new Shader(read effect id)  n : read num of shaders  for i : 0..n-1    s->addSubshader(readshader(f))  read whatever footer punctuation and discard

The filestream object (ifstream/ofstream in C++) is responsible for keeping track of the file position: the change is seen when you return from the recursion, so you can just pick up where you left off.

To purify your thinking, it may help to think of the shader list as itself being a "root" shader, whose children are the actual top-level shaders.

##### Share on other sites
Cheers, I feel stupid, it should have been so obvious to me to recursively call a function, I even said in the question Recursively, just shows what your brain does to you sometimes when your working on something exciting, you forget some of the obvious/easy beginners stuff, or at least I have done so a few times now.