From Sebastien Kuntz, added support for external refernces to vertex/fragment

program files.
This commit is contained in:
Robert Osfield 2003-09-12 08:45:12 +00:00
parent d8caec91a4
commit 1e3b346a52
2 changed files with 39 additions and 0 deletions

View File

@ -45,6 +45,25 @@ bool FragmentProgram_readLocalData(Object& obj, Input& fr)
}
fragmentProgram.setFragmentProgram(code);
}
if( fr.matchSequence("file %s")) {
std::string filename = fr[1].getStr();
fr += 2;
iteratorAdvanced = true;
ifstream vfstream( filename.c_str() );
if( vfstream ) {
ostringstream vstream;
char ch;
/* xxx better way to transfer a ifstream to a string?? */
while( vfstream.get(ch)) vstream.put(ch);
fragmentProgram.setFragmentProgram( vstream.str() );
}
}
return iteratorAdvanced;
}

View File

@ -45,6 +45,26 @@ bool VertexProgram_readLocalData(Object& obj, Input& fr)
}
vertexProgram.setVertexProgram(code);
}
if( fr.matchSequence("file %s")) {
std::string filename = fr[1].getStr();
fr+=2;
iteratorAdvanced = true;
ifstream vfstream( filename.c_str() );
if( vfstream ) {
ostringstream vstream;
char ch;
/* xxx better way to transfer a ifstream to a string?? */
while( vfstream.get(ch)) vstream.put(ch);
vertexProgram.setVertexProgram( vstream.str() );
}
}
return iteratorAdvanced;
}