void Sample::think(double time) { static bool oddStep = true; // // CUDA Compute // // PASS 0 (compute): compute the volume scalar field for the next time step simulateOpenCL( /*dt =*/ 0.5f, oddStep); // 0.5 happens to be numerically stable for this simple explicit heat propagator // // OpenGL Visualize // // Update any camera changes viewUpdate(); // PASS 1: Frontface distance renderGLFrontface(); // PASS 2: Volume raycasting renderGLVolume(oddStep); oddStep = !oddStep; // ...Draw the UI renderUI(getWidth(), getHeight(), time - m_prevTime); m_prevTime = time; }
void Game::render(float interpolation) { fpsCounter.countFrame(); map->renderOnBack(); player->draw(); //draw bullets float now = SDL_GetTicks(); for (std::vector<Bullet*>::size_type i = 0; i < bullets->size(); i++) { Bullet *b = bullets->at(i); if ((now - b->getTime()) > 1000) { bullets->erase(bullets->begin() + i); delete b; i--; } else { b->draw(); } } double factor = 1 / (sfactor * 1000.0f); map->renderOnFront(); //camera float x = (float) -mousex * factor + (float) screen->w / 2.0f * factor - player->getX() * worldScale; float y = (float) mousey * factor - (float) screen->h / 2.0f * factor - (float) player->getY() * worldScale; view = glm::mat4(); view = glm::scale(view, glm::vec3(sfactor, sfactor, 0)); view = glm::translate(view, glm::vec3(x, y, 0)); glUniformMatrix4fv(viewTrans, 1, GL_FALSE, glm::value_ptr(view)); renderUI(); SDL_Flip(screen); SDL_GL_SwapBuffers(); }
void Client::render(ui::Frame &f) { const Clamped &gameFocusFactor = uiState.gameFocusFactor, &pageFocusFactor = uiState.pageFocusFactor; if (uiState.gameFocused() && game) { renderGame(f); } else { if (!game) { f.drawSprite(resources.getTexture(ui::TextureID::MenuBackground), {0, 0}, {0, 0, 1600, 900}); } else { renderGame(f); f.drawRect( {0, 0, 1600, 900}, mixColors(style.menu.gameOverlayColor, sf::Color(255, 255, 255, 0), gameFocusFactor)); } f.withAlpha( linearTween(1, 0, gameFocusFactor) * (game ? linearTween(style.menu.menuInGameFade, 1, pageFocusFactor) : linearTween(style.menu.menuNormalFade, 1, pageFocusFactor)), [&]() { renderUI(f); }); } }
static int update(void* userData, PDUI* uiFuncs, PDReader* inEvents, PDWriter* writer) { uint32_t event; DissassemblyData* data = (DissassemblyData*)userData; data->requestDisassembly = false; while ((event = PDRead_getEvent(inEvents)) != 0) { switch (event) { case PDEventType_setDisassembly: { setDisassemblyCode(data, inEvents); break; } case PDEventType_setExceptionLocation: { uint64_t location = 0; PDRead_findU64(inEvents, &location, "address", 0); if (location != data->location) { data->location = location; data->requestDisassembly = true; } PDRead_findU8(inEvents, &data->locationSize, "address_size", 0); break; } case PDEventType_setRegisters: { updateRegisters(data, inEvents); break; } } } renderUI(data, uiFuncs); if (data->requestDisassembly) { int pc = (int)(data->pc) & ~(BlockSize - 1); PDWrite_eventBegin(writer, PDEventType_getDisassembly); PDWrite_u64(writer, "address_start", (uint64_t)pc); PDWrite_u32(writer, "instruction_count", (uint32_t)BlockSize / 3); PDWrite_eventEnd(writer); } return 0; }
void gameLoop(XStuff* xs, GameState* gs, InputState* is) { checkResize(xs,gs); preFrame(gs); handleInput(gs, is); setUpView(gs); // update world state // depth and picking pre-pass glDepthFunc(GL_LESS); glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); depthPrepass(xs, gs, is); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer); checkCursor(gs, is); glBindFramebuffer(GL_FRAMEBUFFER, gs->framebuffer); // clear color buffer for actual rendering //glClear(GL_COLOR_BUFFER_BIT); glerr("pre shader create 1d"); glDepthFunc(GL_LEQUAL); glerr("pre shader create e"); renderFrame(xs, gs, is); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, gs->framebuffer); // draw to the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); shadingPass(gs); renderUI(xs, gs); gs->screen.resized = 0; glXSwapBuffers(xs->display, xs->clientWin); }
void CScenePlay::renderScene() { // レイヤーの描画 mainLayer->Render(); minimapLayer->Render(); // バックバッファにレンダーターゲットを設定 CGraphicsManager::setRenderTargetToBackBuffer(); // レイヤーテクスチャーの貼られた板ポリの描画 mainLayer->board->Render(Camera2D.get()); minimapLayer->board->Render(Camera2D.get()); // UIの描画 renderUI(); #ifdef _DEBUG // デバッグ描画 renderDebug(); #endif renderFPS = renderFPSCount.getFrameRate_(); }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(viewer[0], viewer[1], viewer[2], reference[0], reference[1], reference[2], 0.0, 1.0, 0.0); drawRink(); drawGoal(); drawShotMeter(); drawPuck(); moveStick(); renderUI(); if (textNum != 999){ renderPuckText(); } glFlush(); glutSwapBuffers(); /*Display next buffer*/ }
static int update(void* userData, PDUI* uiFuncs, PDReader* inEvents, PDWriter* writer) { uint32_t event; DissassemblyData* data = (DissassemblyData*)userData; while ((event = PDRead_getEvent(inEvents)) != 0) { switch (event) { case PDEventType_setDisassembly: { setDisassemblyCode(data, inEvents); break; } case PDEventType_setExceptionLocation: { PDRead_findU64(inEvents, &data->location, "address", 0); PDRead_findU8(inEvents, &data->locationSize, "address_size", 0); break; } case PDEventType_setRegisters: updateRegisters(data, inEvents); break; } } renderUI(data, uiFuncs); // Temporary req PDWrite_eventBegin(writer, PDEventType_getDisassembly); PDWrite_u64(writer, "address_start", 0); PDWrite_u32(writer, "instruction_count", (uint32_t)10); PDWrite_eventEnd(writer); return 0; }
void display(){ if(exitting) { exit(0); return; } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClearColor(0.0f,0.0f,0.0f,0.0f); // Black Background glPushMatrix(); gluLookAt(cam.getCamX(), cam.getCamY(), cam.getCamZ(), cam.getLookAtX(), cam.getLookAtY(), cam.getLookAtZ(), 0.0, 1.0, 0.0); place_lights(); if(!gameOver) { if(starting) { glPushMatrix(); //glTranslatef(.5,.5,.5); drawIntroScreen(); glPopMatrix(); } glPushMatrix(); scene.draw(); glPopMatrix(); glPushMatrix(); if(placingTower){ setMaterial(Exp); glNormal3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON);{ glVertex3f(worldX - GRID_SIZE*2.0, 0.001, worldZ - GRID_SIZE*2.0); glVertex3f(worldX - GRID_SIZE*2.0, 0.001, worldZ + GRID_SIZE*2.0); glVertex3f(worldX + GRID_SIZE*2.0, 0.001, worldZ + GRID_SIZE*2.0); glVertex3f(worldX + GRID_SIZE*2.0, 0.001, worldZ - GRID_SIZE*2.0); }glEnd(); } if(towerSelected){ setMaterial(Exp); glNormal3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON);{ glVertex3f(towerSelect->getX() - GRID_SIZE*2.0 + P1_POSX, 0.001, towerSelect->getZ() - GRID_SIZE*2.0 + P1_POSZ); glVertex3f(towerSelect->getX() - GRID_SIZE*2.0 + P1_POSX, 0.001, towerSelect->getZ() + GRID_SIZE*2.0 + P1_POSZ); glVertex3f(towerSelect->getX() + GRID_SIZE*2.0 + P1_POSX, 0.001, towerSelect->getZ() + GRID_SIZE*2.0 + P1_POSZ); glVertex3f(towerSelect->getX() + GRID_SIZE*2.0 + P1_POSX, 0.001, towerSelect->getZ() - GRID_SIZE*2.0 + P1_POSZ); }glEnd(); } p1.draw(placingTower); // GL_RENDER for normal, GL_SELECT for picking. opponent.player.draw(false); //drawProjectiles(); glPopMatrix(); vfc::extractPlanes(); glColor3f(0.8, 0.5, 0.3); float lx = tlx*2.0*GRID_SIZE - GRID_SIZE*float(GRID_WIDTH) + GRID_SIZE + (GRID_SIZE * 2); float lz = tly*2.0*GRID_SIZE - GRID_SIZE*float(GRID_HEIGHT) + GRID_SIZE + (GRID_SIZE * 2); // draw root directories glPushMatrix(); glTranslatef(0.0, 2 * GRID_SIZE, 1.0 * GRID_HEIGHT * GRID_SIZE + (GRID_SIZE * 8)); glPushMatrix(); glScalef(0.25, 0.25, 0.25); glCallList(vtd_dl::rootDL); glPopMatrix(); glTranslatef(GRID_WIDTH * GRID_SIZE * 3, 0.0, 0.0); glPushMatrix(); glScalef(0.25, 0.25, 0.25); glCallList(vtd_dl::rootDL); glPopMatrix(); glPopMatrix(); if(!starting){ glPushMatrix(); renderUI(GW, GH,&p1,&opponent.player,((CYCLE_TIME-last_cycle)/1000.0), GL_RENDER); glPopMatrix(); } drawMouseBox(clicked); } else { if(winner == COMPUTER_WIN) drawBlueScreen(); else drawWinScreen(); } glPopMatrix(); glutSwapBuffers(); }
void Renderer::endRender() { renderUI(); swapBuffers(); }
void Window::renderAll(Cell board[], const int amoutOfCells) { renderBoard(board, amoutOfCells); renderUI(); }
LeftHandMenu::LeftHandMenu(cor::DeviceList *devices, CommLayer *comm, GroupData *groups, QWidget *parent) : QWidget(parent) { mNumberOfShownLights = 0; mLastScrollValue = 0; mAlwaysOpen = false; mSelectedLights = devices; mComm = comm; mGroups = groups; mParentSize = parent->size(); auto width = int(mParentSize.width() * 0.66f); this->setGeometry(width * -1, 0, width, parent->height()); mIsIn = false; mNumberOfRooms = 0; mSpacer = new QWidget(this); mSpacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mSpacer->setStyleSheet("border: none; background-color:rgb(33,32,32);"); mWidget = new QWidget(this); mWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mWidget->setStyleSheet("border: none; background-color:rgba(0,0,0,0);"); mScrollArea = new QScrollArea(this); mScrollArea->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QScroller::grabGesture(mScrollArea->viewport(), QScroller::LeftMouseButtonGesture); mScrollArea->setWidget(mWidget); mScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mScrollArea->horizontalScrollBar()->setEnabled(false); // -------------- // Setup Main Palette // ------------- mMainPalette = new cor::LightVectorWidget(6, 2, true, this); mMainPalette->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mMainPalette->setFixedHeight(this->height() * 0.1); mMainPalette->setStyleSheet("background-color:rgb(33,32,32);"); //--------------- // Setup Buttons //--------------- mSingleColorButton = new LeftHandButton("Single Color", EPage::colorPage, ":/images/colorWheel_icon.png", this, this); mSingleColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(mSingleColorButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage))); mSingleColorButton->shouldHightlght(true); mSettingsButton = new LeftHandButton("Settings", EPage::settingsPage, ":/images/settingsgear.png", this, this); mSettingsButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(mSettingsButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage))); PresetPalettes palettes; cor::Light light; light.routine = ERoutine::multiBars; light.palette = palettes.palette(EPalette::water); light.speed = 100; mMultiColorButton = new LeftHandButton("Multi Color", EPage::palettePage, cor::lightToJson(light), this, this); mMultiColorButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(mMultiColorButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage))); cor::Light moodLight; moodLight.routine = ERoutine::multiFade; moodLight.palette = palettes.palette(EPalette::fire); moodLight.speed = 100; mMoodButton = new LeftHandButton("Moods", EPage::moodPage, cor::lightToJson(moodLight), this, this); mMoodButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); connect(mMoodButton, SIGNAL(pressed(EPage)), this, SLOT(buttonPressed(EPage))); mNewGroupButton = new AddNewGroupButton(mWidget); mNewGroupButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(mNewGroupButton, SIGNAL(pressed()), this, SLOT(newGroupButtonPressed())); mRenderThread = new QTimer(this); connect(mRenderThread, SIGNAL(timeout()), this, SLOT(renderUI())); connect(this, SIGNAL(changedDeviceCount()), this, SLOT(deviceCountChanged())); }