/** * Acts as the display function for the window. */ static void RenderSceneCB() { vector<glm::vec4> transformedVertices; // Clear the color buffer colorBuffer.clearColorBuffer(); angle += glm::radians(1.0f); switch (view) { case VERTICAL_SPLIT: twoViewsSplitVertically(); break; case HORIZONTAL_SPLIT: twoViewsSplitHorizontally(); break; default: renderObjects(); } // Display the color buffer colorBuffer.showColorBuffer(); } // end RenderSceneCB
bool CCSceneJS::render(const CCCameraBase *inCamera, const CCRenderPass pass, const bool alpha) { if( camera == inCamera ) { renderObjects( inCamera, pass, alpha ); return true; } return false; }
bool CCSceneBase::render(const CCCameraBase *inCamera, const CCRenderPass pass, const bool alpha) { bool rendered = false; { renderObjects( inCamera, pass, alpha ); rendered = true; } for( int i=0; i<childScenes.length; ++i ) { rendered |= childScenes.list[i]->render( inCamera, pass, alpha ); } return rendered; }
// Draws two views of the scene. One on the right and one on the left. void twoViewsSplitVertically() { float viewportWidth = (xViewportMax - xViewportMin)/2.0f; float viewportHeight = (yViewportMax - yViewportMin); projectionTransformation = glm::perspective(45.0f, ((float)viewportWidth) / ((float)viewportHeight), 0.1f, 100.0f); // Set viewport transformation viewportTransformation = glm::translate(glm::vec3(0, 0, 0.0f)) * glm::scale(glm::vec3((float)(viewportWidth) / (xNdcMax - xNdcMin), (float)(viewportHeight) / (yNdcMax - yNdcMin), 1.0f)) * glm::translate(glm::vec3(-xNdcMin, -yNdcMin, 0.0f)); renderObjects(); // TODO } // end twoViewsSplitVertically
void Renderer::renderArea(const FixedRect& area, CairoLayer layers[], double width, double height, RenderAttributes& map, AssetCache& cache) { // sort objects into acroding to z-index std::vector<NodeId> nodes; std::vector<WayId> ways; std::vector<RelId> relations; sortObjects(map, nodes, ways, relations); // transform Mercator to tile coordinates Cairo::Matrix trans = Cairo::scaling_matrix(width / (double) area.getWidth(), height / (double) area.getHeight()); trans.translate(-area.minX, -area.minY); std::list<shared_ptr<Label> > labels; std::list<shared_ptr<Shield> > shields; // render objects and collect label positions renderObjects(layers, map, trans, nodes, ways, relations, labels, shields, cache); // sort, place and render shields std::vector<shared_ptr<Shield> > placedShields; placedShields.reserve(10); shields.sort(&CompareLabels<Shield>); placeShields(shields, placedShields); renderShields(layers[LAYER_LABELS].cr, placedShields); renderLabels<Shield>(layers[LAYER_LABELS].cr, placedShields, cache); // sort, place and render labels std::vector<shared_ptr<Label> > placedLabels; placedLabels.reserve(labels.size()); labels.sort(&CompareLabels<Label>); placeLabels(labels, placedLabels); renderLabels<Label>(layers[LAYER_LABELS].cr, placedLabels, cache); compositeLayers(layers); }
int MyDirectXWindow::run() { init(); // Main message loop MSG msg = { 0 }; while (WM_QUIT != msg.message) { if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { //clean render target float clearColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; mDeviceContext->ClearRenderTargetView(mRenderTargetView, clearColor); //clean depthStencil Buffer mDeviceContext->ClearDepthStencilView(mDepthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0); //setup Camera mCamera.renderSetup(mDeviceContext); //randomic Translation to each object moveObjects(); //render Objects renderObjects(); //swap buffers mSwapChain->Present(0, 0); } } return msg.wParam; }
void Cell::renderMiddle(tileCamera& cam, float viewX, float viewY, dynamicMultilayerMap* map, window* win) { //Render Objects renderObjects(viewX, viewY, win); }
void Engine::Impl::processFrame() { glfwPollEvents(); renderObjects(); validateNoGLError(); }