From Sebastien Kuntz, added support for external refernces to vertex/fragment
program files.
This commit is contained in:
parent
d8caec91a4
commit
1e3b346a52
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user