Ejemplo n.º 1
0
void Console::ReadHistory() {
    File *file = FileOpenForRead( "history.txt" );
    if ( file ) {
        history.clear();
        while( file->AtEnd() == false ) {
            history.push_back( file->ReadLine() );
        }
        history.push_back( "" );
        delete file;
        historyPos = (int)history.size() - 1;
    }
}
Ejemplo n.º 2
0
	Model * CreateModelFromObjFile( const std::string & filename ) {
		File *file = FileOpenForRead( filename );
		ParseState ps;
		while ( file->AtEnd() == false && ps.mode != Mode_Failed ) {
			string line = file->ReadLine();
			vector< Token > tokens = TokenizeString( line.c_str() );
			ps.ProcessLine( tokens );
		}
		delete file;
		if ( ps.mode == Mode_Failed ) {
			return NULL;
		}
		Model *m = new Model( filename );
		m->SetPrimitive( Primitive_Triangles );
		VertexBuffer & vb = m->GetVertexBuffer();
		vb.SetVarying( ps.varying );
		//Output( "model %s varying = %d", filename.c_str(), ps.varying );
		vb.SetData( (int)ps.vbdata.size() * sizeof( float ), &ps.vbdata[0] );
		m->GetIndexBuffer().SetData( (int)ps.ibdata.size() * sizeof( ushort ), &ps.ibdata[0] );
		return m;
	}