void RWGame::renderProfile() { #if RW_PROFILER auto& frame = perf::Profiler::get().getFrame(); constexpr float upperlimit = 30000.f; constexpr float lineHeight = 15.f; static std::vector<glm::vec4> perf_colours; if (perf_colours.size() == 0) { float c = 8.f; for (int r = 0; r < c; ++r) { for (int g = 0; g < c; ++g) { for (int b = 0; b < c; ++b) { perf_colours.push_back({ r / c, g / c, b / c, 1.f }); } } } } float xscale = renderer->getRenderer()->getViewport().x / upperlimit; TextRenderer::TextInfo ti; ti.align = TextRenderer::TextInfo::Left; ti.font = 2; ti.size = lineHeight - 2.f; ti.baseColour = glm::u8vec3(255); std::function<void(const perf::ProfileEntry&,int)> renderEntry = [&](const perf::ProfileEntry& entry, int depth) { int g = 0; for(auto& event : entry.childProfiles) { auto duration = event.end - event.start; float y = 60.f + (depth * (lineHeight + 5.f)); renderer->drawColour(perf_colours[(std::hash<std::string>()(entry.label) * (g++))%perf_colours.size()], { xscale * event.start, y, xscale * duration, lineHeight }); ti.screenPosition.x = xscale * (event.start); ti.screenPosition.y = y + 2.f; ti.text = event.label + " " + std::to_string(duration) + " us "; renderer->text.renderText(ti); renderEntry(event, depth+1); } }; renderEntry(frame, 0); ti.screenPosition = glm::vec2( xscale * (16000), 40.f); ti.text = ".16 ms"; renderer->text.renderText(ti); #endif }
/** * Used as debugging aid. Renders the given entry via OpenGL. * * @param entry The subtree to render. */ void CBspTree::renderEntry(TBspEntry* entry) { static GLubyte colorVerticalLeft[4] = {255, 0, 0, 10}; static GLubyte colorVerticalRight[4] = {0, 255, 0, 10}; static GLubyte colorHorizontalLeft[4] = {0, 0, 255, 10}; static GLubyte colorHorizontalRight[4] = {255, 255, 0, 10}; if (entry->left != NULL) { if (entry->isVertical) glColor4ubv(colorVerticalLeft); else glColor4ubv(colorHorizontalLeft); glBegin(GL_POLYGON); glVertex2f(entry->bounds.upper.x, entry->bounds.upper.y); glVertex2f(entry->bounds.lower.x, entry->bounds.upper.y); glVertex2f(entry->bounds.lower.x, entry->bounds.lower.y); glVertex2f(entry->bounds.upper.x, entry->bounds.lower.y); glEnd(); renderEntry(entry->left); }; if (entry->right != NULL) { if (entry->isVertical) glColor4ubv(colorVerticalRight); else glColor4ubv(colorHorizontalRight); glBegin(GL_POLYGON); glVertex2f(entry->bounds.upper.x, entry->bounds.upper.y); glVertex2f(entry->bounds.lower.x, entry->bounds.upper.y); glVertex2f(entry->bounds.lower.x, entry->bounds.lower.y); glVertex2f(entry->bounds.upper.x, entry->bounds.lower.y); glEnd(); renderEntry(entry->right); }; }
bool LogViewerPlugin::whatDoYouLookLike(Page* page) { std::priority_queue<model::LogEntry> entrys; this->logParser.getAllEntrys(entrys); ElementList* logEntrys = new ElementList("logEntrys"); while(!entrys.empty()) { renderEntry(entrys.top(),logEntrys); entrys.pop(); } page->addElement(logEntrys); return true; }
void MarketingunitController::create() { if (httpRequest().method() != Tf::Post) { return; } auto form = httpRequest().formItems("marketingunit"); auto marketingunit = Marketingunit::create(form); if (!marketingunit.isNull()) { QString notice = "Created successfully."; tflash(notice); redirect(urla("show", marketingunit.muid())); } else { QString error = "Failed to create."; texport(error); renderEntry(form); } }
void WorldController::create() { if (httpRequest().method() != Tf::Post) { return; } QVariantMap form = httpRequest().formItems("world"); World world = World::create(form); if (!world.isNull()) { QString notice = "Created successfully."; tflash(notice); redirect(urla("show", world.id())); } else { QString error = "Failed to create."; texport(error); renderEntry(form); } }
void AssetsunitmanagerController::create() { if (httpRequest().method() != Tf::Post) { return; } auto form = httpRequest().formItems("assetsunitmanager"); auto assetsunitmanager = Assetsunitmanager::create(form); if (!assetsunitmanager.isNull()) { QString notice = "Created successfully."; tflash(notice); redirect(urla("Cms/list_manager")); } else { QString error = "Failed to create."; texport(error); renderEntry(form); } }
void ParksController::create() { if (httpRequest().method() != Tf::Post) { return; } auto form = httpRequest().formItems("parks"); auto parks = Parks::create(form); if (!parks.isNull()) { QString notice = "Created successfully."; tflash(notice); redirect(urla("show", parks.id())); } else { QString error = "Failed to create."; texport(error); renderEntry(form); } }
void CmsController::create() { if (httpRequest().method() != Tf::Post) { return; } auto form = httpRequest().formItems("operators"); QString ID = form["operatorID"].toString(); auto operators = Operators::create(form); Cms cms; if (!operators.isNull() && cms.checkoperatorID(ID)) { QString adminID = session().value("adminID").toString(); QString notice = form["operatorID"].toString(); if(cms.insert_connection(adminID,notice)){ redirect(urla("list_operator", adminID)); } } else { QString error = "操作员编号已经存在!"; texport(error); renderEntry(form); } }
void MarketingunitController::entry() { renderEntry(); }
void WorldController::entry() { renderEntry(); }
void AssetsunitmanagerController::entry() { renderEntry(); }
void CmsController::entry() { renderEntry(); }
void CmsController::change() { renderEntry(); }
/** * Renders the areas defined currently in the tree as an debug aid using normal OpenGL calls. * A rendering context must be active and setup correctly for the output. */ void CBspTree::render(void) { renderEntry(&FRoot); }
void FortuneController::entry() { renderEntry(); }
void ParksController::entry() { renderEntry(); }