void Scene::draw() { // Background color this->setBackgroundColor(backColor); // No object to draw if (isEmpty()) return; // Anti aliasing glEnable(GL_MULTISAMPLE); glEnable (GL_LINE_SMOOTH); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); // The main object drawObject(); // Draw groups of relationship between segments drawGroups(); // Draw the controllers if exist Controller * ctrl = ((Controller *)activeObject()->ptr["controller"]); if (ctrl) { ctrl->draw(true, true); //sp->activeOffset->activeViewer->camera()->draw(); } // Draw stacking with 3 objects if(isShowStacked) drawStacking(); // Suggestions sp->draw(); // deformer if(activeDeformer) activeDeformer->draw(); if(activeVoxelDeformer) activeVoxelDeformer->draw(); // Draw debug geometries activeObject()->drawDebug(); }
void Logstalgia::draw(float t, float dt) { if(appFinished) return; if(!settings.disable_progress) slider.logic(dt); display.setClearColour(background); display.clear(); glDisable(GL_FOG); display.mode2D(); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); profile_start("draw ip summarizer"); ipSummarizer->draw(dt, font_alpha); profile_stop(); profile_start("draw groups"); drawGroups(dt, font_alpha); profile_stop(); profile_start("draw balls"); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, balltex->textureid); for(RequestBall* ball : balls) { ball->draw(); } profile_stop(); profile_start("draw response codes"); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { RequestBall* r = *it; if(!settings.hide_response_code && r->hasBounced()) { r->drawResponseCode(); } } profile_stop(); glDisable(GL_TEXTURE_2D); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); if(settings.paddle_mode != PADDLE_NONE) { //draw paddles shadows for(auto& it: paddles) { it.second->drawShadow(); } //draw paddles for(auto& it: paddles) { it.second->draw(); } } if(settings.paddle_mode > PADDLE_SINGLE && !settings.hide_paddle_tokens) { glEnable(GL_TEXTURE_2D); //draw paddle tokens for(auto& it: paddles) { it.second->drawToken(); } } if(!settings.disable_glow) { glBlendFunc (GL_ONE, GL_ONE); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, glowtex->textureid); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { (*it)->drawGlow(); } } infowindow.draw(); glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); if(!take_screenshot && uimessage_timer>0.1f) { fontLarge.setColour(vec4(1.0f,1.0f,uimessage_timer/3.0f,uimessage_timer/3.0f)); int mwidth = fontLarge.getWidth(uimessage.c_str()); fontLarge.draw(display.width/2 - mwidth/2, display.height/2 - 20, uimessage.c_str()); uimessage_timer-=dt; } if(settings.splash > 0.0f) { int logowidth = fontLarge.getWidth("Logstalgia"); int logoheight = 105; int cwidth = fontMedium.getWidth("Website Access Log Viewer"); int awidth = fontMedium.getWidth("(C) 2008 Andrew Caudwell"); vec2 corner(display.width/2 - logowidth/2 - 30.0f, display.height/2 - 45); float logo_alpha = std::min(1.0f, settings.splash/3.0f); float logo_bg = std::min(0.2f, settings.splash/10.0f); glDisable(GL_TEXTURE_2D); glColor4f(0.0f, 0.5f, 1.0f, logo_bg); glBegin(GL_QUADS); glVertex2f(0.0f, corner.y); glVertex2f(0.0f, corner.y + logoheight); glVertex2f(display.width, corner.y + logoheight); glVertex2f(display.width, corner.y); glEnd(); glEnable(GL_TEXTURE_2D); fontLarge.alignTop(true); fontLarge.dropShadow(true); fontLarge.setColour(vec4(1.0f,1.0f,1.0f,logo_alpha)); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Logstalgia"); fontLarge.setColour(vec4(0.0f,1.0f,1.0f,logo_alpha)); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Log"); fontMedium.setColour(vec4(1.0f,1.0f,1.0f,logo_alpha)); fontMedium.draw(display.width/2 - cwidth/2,display.height/2 + 17, "Website Access Log Viewer"); fontMedium.draw(display.width/2 - awidth/2,display.height/2 + 37, "(C) 2008 Andrew Caudwell"); settings.splash -= dt; } fontMedium.setColour(vec4(1.0f,1.0f,1.0f,font_alpha)); if(info) { fontMedium.print(2,2, "FPS %d", (int) fps); fontMedium.print(2,19,"Balls: %d", balls.size()); fontMedium.print(2,36,"Queue: %d", queued_entries.size()); fontMedium.print(2,53,"Paddles: %d", paddles.size()); fontMedium.print(2,70,"Simulation Speed: %.2f", settings.simulation_speed); fontMedium.print(2,87,"Pitch Speed: %.2f", settings.pitch_speed); } else { fontMedium.draw(2,2, displaydate.c_str()); fontMedium.draw(2,19, displaytime.c_str()); } fontLarge.setColour(vec4(1.0f,1.0f,1.0f,font_alpha)); int counter_width = fontLarge.getWidth("00000000"); fontLarge.alignTop(false); fontLarge.print(display.width-10-counter_width,display.height-10, "%08d", highscore); if(!settings.disable_progress) slider.draw(dt); if(take_screenshot) { takeScreenshot(); take_screenshot = false; } }
void Logstalgia::draw(float t, float dt) { if(appFinished) return; if(!gDisableProgress) slider.logic(dt); display.setClearColour(background); display.clear(); glDisable(GL_FOG); display.mode2D(); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); profile_start("draw ip summarizer"); ipSummarizer->draw(dt, font_alpha); profile_stop(); profile_start("draw groups"); drawGroups(dt, font_alpha); profile_stop(); profile_start("draw balls"); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, balltex->textureid); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { (*it)->draw(dt); } profile_stop(); profile_start("draw response codes"); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { RequestBall* r = *it; if(gResponseCode && r->hasBounced()) { r->drawResponseCode(); } } profile_stop(); glDisable(GL_TEXTURE_2D); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); if(gPaddleMode != PADDLE_NONE) { //draw paddles shadows for(std::map<std::string, Paddle*>::iterator it= paddles.begin(); it!=paddles.end();it++) { it->second->drawShadow(); } //draw paddles for(std::map<std::string, Paddle*>::iterator it= paddles.begin(); it!=paddles.end();it++) { it->second->draw(); } } if(!gDisableGlow) { glBlendFunc (GL_ONE, GL_ONE); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, glowtex->textureid); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { (*it)->drawGlow(); } } infowindow.draw(); glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); if(uimessage_timer>0.1f) { glColor4f(1.0,1.0,uimessage_timer/3.0f,uimessage_timer/3.0f); int mwidth = fontLarge.getWidth(uimessage.c_str()); fontLarge.draw(display.width/2 - mwidth/2, display.height/2 - 20, uimessage.c_str()); uimessage_timer-=dt; } if(gSplash>0.0f) { int logowidth = fontLarge.getWidth("Logstalgia"); int logoheight = 105; int cwidth = fontMedium.getWidth("Website Access Log Viewer"); int awidth = fontMedium.getWidth("(C) 2008 Andrew Caudwell"); vec2f corner(display.width/2 - logowidth/2 - 30.0f, display.height/2 - 45); float logo_alpha = std::min(1.0f, gSplash/3.0f); float logo_bg = std::min(0.2f, gSplash/10.0f); glDisable(GL_TEXTURE_2D); glColor4f(0.0f, 0.5f, 1.0f, logo_bg); glBegin(GL_QUADS); glVertex2f(0.0f, corner.y); glVertex2f(0.0f, corner.y + logoheight); glVertex2f(display.width, corner.y + logoheight); glVertex2f(display.width, corner.y); glEnd(); glEnable(GL_TEXTURE_2D); fontLarge.alignTop(true); fontLarge.dropShadow(true); glColor4f(1,1,1,logo_alpha); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Logstalgia"); glColor4f(0,1,1,logo_alpha); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Log"); glColor4f(1,1,1,logo_alpha); fontMedium.draw(display.width/2 - cwidth/2,display.height/2 + 17, "Website Access Log Viewer"); fontMedium.draw(display.width/2 - awidth/2,display.height/2 + 37, "(C) 2008 Andrew Caudwell"); gSplash-=dt; } if(!gDisableProgress) slider.draw(dt); glColor4f(1,1,1,font_alpha); if(info) { fontMedium.print(2,2, "FPS %d", (int) fps); fontMedium.print(2,19,"Balls %03d", balls.size()); fontMedium.print(2,36,"Queue %03d", queued_entries.size()); fontMedium.print(2,53,"Paddles %03d", paddles.size()); } else { fontMedium.draw(2,2, displaydate.c_str()); fontMedium.draw(2,19, displaytime.c_str()); } glColor4f(1,1,1,font_alpha); int counter_width = fontLarge.getWidth("00000000"); fontLarge.alignTop(false); fontLarge.print(display.width-10-counter_width,display.height-10, "%08d", highscore); }
void TracePainter::drawPage(int i, int j) { // Calculate the number of components by vertical int from_component = (j == 0) ? 0 : j * components_per_page; int to_component = from_component + components_per_page - 1; if (to_component >= model->getVisibleComponents().size()) { to_component = model->getVisibleComponents().size() - 1; } timePerPage = (i > 0) ? timePerFullPage : timePerFirstPage; Time min_time = model->getMinTime(); if (i > 0) min_time = min_time + timePerFirstPage + timePerFullPage * (i - 1); Time max_time = min_time + timePerPage; if (max_time > model->getMaxTime()) { max_time = model->getMaxTime(); } // FIXME: this temporary change of model is ugly. TraceModelPtr saved_model = model; model = model->setRange(min_time, max_time); if (i == 0) { left_margin = left_margin1; } else { left_margin = left_margin2; } drawComponentsList(from_component, to_component, i == 0); QApplication::processEvents(); if (state_ == Canceled) return; painter->setClipRect(left_margin, y_unparented - lifeline_stepping / 2, width - right_margin-left_margin, components_per_page * lifeline_stepping); drawEvents(from_component, to_component); if (state_ == Canceled) return; drawStates(from_component, to_component); if (state_ == Canceled) return; drawGroups(from_component, to_component); if (state_ == Canceled) return; if (printer_flag) { // Draw timeline painter->setClipRect(0, 0, width, height); drawTimeline(painter, 0, height - (timeline_text_top+text_height)); // Draw labels with page numbers int x, y; QRect r; x = 0; y = 0; r = drawPageMarker(0, i+1, pages_horizontally, x, y, true); x = width - r.width(); y = r.height()/2; drawPageMarker(painter, i+1, pages_horizontally, x, y, true); x = 0; y = 0; r = drawPageMarker(0, j+1, pages_vertically, x, y, false); x = r.width()/2; y = height - r.height(); drawPageMarker(painter, j+1, pages_vertically, x, y, false); } model = saved_model; }