void Board::render() { if (glutGet(GLUT_WINDOW_HEIGHT) >= 300 && glutGet(GLUT_WINDOW_WIDTH) >= 300) { renderFrame(); renderCells(); if (panel.enabled()) { panel.render(); } } }
//----------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------- bool MyVTK::nextFrame() { LOG_MSG("VTK: nextFrame"); if (!playing) return false; if (paused) return true; if (playerStream->atEnd()) { LOG_MSG("nextFrame: no more data"); stop(); return false; } TCpos_list.clear(); // DCpos_list.clear(); // bondpos_list.clear(); int k = 0; QString line; do { line = playerStream->readLine(); if (line.length() > 0) { k++; QStringList s = line.split(" ",QString::SkipEmptyParts); if (s[0].compare("T") == 0) { CELL_POS cp; cp.tag = s[1].toInt(); cp.x = s[2].toInt(); cp.y = s[3].toInt(); cp.z = s[4].toInt(); cp.diameter = s[5].toDouble(); cp.state = s[6].toDouble(); TCpos_list.append(cp); } else if (s[0].compare("E") == 0) { break; } } } while (true); // bool redo = false; // if (first_VTK) { // redo = true; // } renderCells(); char numstr[5]; sprintf(numstr,"%04d",framenum); if (save_image) { w2i->Modified(); //important jpgwriter->SetFileName((casename + numstr + ".jpg").toStdString().c_str()); jpgwriter->Write(); } framenum++; return true; }
//--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- void MyVTK::setOpacity(int position) { if (position == 100) { opacity[1] = 0.001; opacity[2] = 0.001; } else { opacity[1] = (100. - position)/100; opacity[2] = (100. - position)/100; } sprintf(msg,"opacity: %d %f",1,opacity[1]); LOG_MSG(msg); if (paused) { LOG_QMSG("renderCells"); renderCells(); } }