void ParticleSystem::Render(int deltaTime, const glm::mat4x4& mvp, const glm::vec3& camPos){ mTime += deltaTime; UpdateParticles(deltaTime); RenderParticles(mvp,camPos); mCurrVB = mCurrTFB; mCurrTFB = (mCurrTFB + 1) & 0x1; }
void M2EffectRender::Render() { if (ExistParticle_) { RenderParticles(); ID3DX11EffectBlendVariable* pBlendVar = Effect_->GetVariableByName("SrcColorBlendingAdd")->AsBlend(); pBlendVar->AsBlend()->SetBlendState(0, GetApp()->blendStates_->BlendDisabled()); ParticleData_.gpRenderParticles->GetPassByIndex(0)->Apply(0, D3D11Context()); } if (ExistRibbon_) { RenderRibbons(); ID3DX11EffectBlendVariable* pBlendVar = Effect_->GetVariableByName("SrcColorBlendingAdd")->AsBlend(); pBlendVar->AsBlend()->UndoSetBlendState(0); ID3DX11EffectDepthStencilVariable* pDepthStencilVar = Effect_->GetVariableByName("EnableDepth")->AsDepthStencil(); pDepthStencilVar->AsDepthStencil()->UndoSetDepthStencilState(0); RibbonData_.gpRenderParticles->GetPassByIndex(0)->Apply(0, D3D11Context()); } //pBlendVar->SetBlendState(0, GetApp()->blendStates_->BlendDisabled());*/ }
void VPostProcessTranslucencies::Execute() { INSERT_PERF_MARKER_SCOPE("VPostProcessTranslucencies"); VisRenderContext_cl *pContext = VisRenderContext_cl::GetCurrentContext(); IVisVisibilityCollector_cl *pVisCollector = pContext->GetVisibilityCollector(); VASSERT(pVisCollector != NULL); const VisEntityCollection_cl *pVisibleForeGroundEntities = pVisCollector->GetVisibleForeGroundEntities(); m_VisibilityObjectCollector.HandleVisibleVisibilityObjects(); #ifndef _VISION_MOBILE RenderingOptimizationHelpers_cl::SetShaderPreference(96); #endif // Get a pointer to the collection of visible mesh buffer objects const VisMeshBufferObjectCollection_cl *pVisibleMeshBuffer = &m_VisibilityObjectCollector.GetMeshBufferObjectCollection(); // Get a pointer to the collection of visible particle groups const VisParticleGroupCollection_cl *pVisibleParticleGroups = &m_VisibilityObjectCollector.GetParticleGroupCollection(); // Mask out entities which are "always in foreground" MaskOutForegroundEntities(*pVisibleForeGroundEntities); if (pVisCollector->GetInterleavedTranslucencySorter() == NULL) { // --- Traditional transparency sorting (default) const VisStaticGeometryInstanceCollection_cl *pVisibleTransparentGeoInstances = pVisCollector->GetVisibleStaticGeometryInstancesForPass(VPT_TransparentPass); const VisEntityCollection_cl *pVisibleEntities = pVisCollector->GetVisibleEntitiesForPass(VPT_TransparentPass); VisionRenderLoop_cl::RenderHook(*pVisibleMeshBuffer, pVisibleParticleGroups, VRH_PRE_TRANSPARENT_PASS_GEOMETRY, true); // render transparent pass surface shaders on translucent static geometry instances Vision::RenderLoopHelper.RenderStaticGeometrySurfaceShaders(*pVisibleTransparentGeoInstances, VPT_TransparentPass); VisionRenderLoop_cl::RenderHook(*pVisibleMeshBuffer, pVisibleParticleGroups, VRH_PRE_TRANSPARENT_PASS_ENTITIES, true); // Render transparent pass shaders on entities DrawEntitiesShaders(*pVisibleEntities, VPT_TransparentPass); VisionRenderLoop_cl::RenderHook(*pVisibleMeshBuffer, pVisibleParticleGroups, VRH_POST_TRANSPARENT_PASS_GEOMETRY, true); VisionRenderLoop_cl::RenderHook(*pVisibleMeshBuffer, pVisibleParticleGroups, VRH_DECALS, true); RenderParticles(pVisibleMeshBuffer, pVisibleParticleGroups); } else { // --- Interleaved transparency sorting pVisCollector->GetInterleavedTranslucencySorter()->OnRender(pVisCollector, true); } // Render visible foreground entities (see DrawForegroundEntities) DrawTransparentForegroundEntities(*pVisibleForeGroundEntities); // Coronas and flares will be still rendered after the other interleaved sorted objects were rendered (lensflare and coronas don't must be always rendered "on top") VisionRenderLoop_cl::RenderHook(*pVisibleMeshBuffer, pVisibleParticleGroups, VRH_CORONAS_AND_FLARES, true); }
void Explosion::RenderSmoke() { // Actualiza sist. particulas StepParticles(); // Pinta el sist. particulas RenderParticles(); }
void Renderer::RenderGameObjects() { RenderBalls(); RenderTiles(); RenderPaddles(); RenderBullets(); RenderBonusBoxes(); RenderParticles(); }
void ParticleSystem::Render(int DeltaTimeMillis, const Matrix4f& VP, const Vector3f& CameraPos) { m_time += DeltaTimeMillis; UpdateParticles(DeltaTimeMillis); RenderParticles(VP, CameraPos); m_currVB = m_currTFB; m_currTFB = (m_currTFB + 1) & 0x1; }
void ParticleSystem::Render(int DeltaTimeMillis, const glm::vec3 CameraPos, const glm::mat4 VP) { m_time += DeltaTimeMillis; UpdateParticles(DeltaTimeMillis); RenderParticles(VP, CameraPos); m_currVB = m_currTFB; m_currTFB = (m_currTFB + 1) & 0x1; }
void LunaticDraw(void) { char s[32]; dword d; // add all the sprites to the list if (gameMode != GAMEMODE_PIC) { RenderGuys(1); RenderBullets(); RenderParticles(); RenderItAll(&curWorld, curMap, MAP_SHOWLIGHTS | MAP_SHOWITEMS | MAP_SHOWWALLS); RenderSpecialXes(gamemgl, curMap, worldNum); RenderMessage(); PlayerRenderInterface(gamemgl); if (gameMode == GAMEMODE_MENU) RenderPauseMenu(); if (gameMode == GAMEMODE_RAGE) ShowRage(gamemgl); } else { // nothing to do } if (showStats) { sprintf(s, "QFPS %02.2f", frmRate); Print(0, 180, s, 6, 0); sprintf(s, "VFPS %02.2f", ((float) visFrameCount / (float) ((timeGetTime() - gameStartTime) / 1000))); Print(0, 10, s, 6, 0); sprintf(s, "GFPS %02.2f", ((float) updFrameCount / (float) ((timeGetTime() - gameStartTime) / 1000))); Print(0, 50, s, 6, 0); sprintf(s, "Runs %d", numRunsToMakeUp); Print(0, 100, s, 6, 0); } // update statistics d = timeGetTime(); if (d - tickerTime > 999) { frmRate = (frmRate * 3 + ((float) visFrms / ((float) (d - tickerTime) / 1000.0f))) / 4; visFrms = 0; tickerTime = d; } gamemgl->Flip(); CDMessingTime += garbageTime; garbageTime = 0; visFrameCount++; visFrms++; }
void UnifiedWindow::UseWithoutVBO() { /************************************************************************/ /* CPU simulation without vbo rendering */ /************************************************************************/ float x, y, z; //float r = SPHERE_RADIUS * fc->particleSpacing * sphere_size_factor_; float r = fc->particleRadius; int size = 3; const uint numParticles = myFluid->particles().size(); for (int i = 0; i < numParticles; ++i) { UnifiedParticle &p = myFluid->particles()[i]; x = myFluid->particles()[i].position_.x; y = myFluid->particles()[i].position_.y; z = myFluid->particles()[i].position_.z; RenderParticles(p.type_, x, y, z, r); } }
void GameManager::Render() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear screen and depth buffer RenderFPS(); RenderEnviroment(true); RenderEnemies(true); RenderBullets(true); RenderPlayer(true); RenderParticles(true); RenderText(true); checkGLErrors(); Utility::I()->SwapSDLGLBuffers(); }
/*!**************************************************************************** @Function RenderScene @Return bool true if no error occured @Description Main rendering loop function of the program. The shell will call this function every frame. eglSwapBuffers() will be performed by PVRShell automatically. PVRShell will also manage important OS events. Will also manage relevent OS events. The user has access to these events through an abstraction layer provided by PVRShell. ******************************************************************************/ bool OGLES2ParticleSystem::RenderScene() { HandleInput(); UpdateParticles(); UpdateFramerateCounter(); float time_delta = PVRShellGetTime() / 10000.0f; PVRTVec3 vFrom = PVRTVec3((float) sin(time_delta) * 50.0f, 30.0f, (float) cos(time_delta) * 50.0f); m_mView = PVRTMat4::LookAtRH(vFrom, PVRTVec3(0.0f, 5.0f, 0.0f), PVRTVec3(0.0f, 1.0f, 0.0f)); m_mViewProjection = m_mProjection * m_mView; // Clear colour and depth buffers glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Enables depth testing glEnable(GL_DEPTH_TEST); // Render floor RenderFloor(); for (unsigned int i=0; i < g_cuiNumSpheres; i++) RenderSphere(g_caSpheres[i].aPosition, g_caSpheres[i].fRadius); // Render particles RenderParticles(); // Display info text. char lower_buffer[64]; unsigned int numParticles = m_pParticleSystem->GetNumberOfParticles(); sprintf(lower_buffer, "No. of Particles: %d", numParticles); m_Print3D.DisplayDefaultTitle("Particle System", NULL, ePVRTPrint3DSDKLogo); m_Print3D.Print3D(2.0f, 90.0f, 1.0f, 0xFFFFFFFF, "No. of Particles: %d", numParticles); m_Print3D.Flush(); return true; }
void DrawParticles(R3Scene *scene) { // Get current time (in seconds) since start of execution double current_time = GetTime(); static double previous_time = 0; static double time_lost_taking_videos = 0; // for switching back and forth // between recording and not // recording smoothly // program just started up? if (previous_time == 0) previous_time = current_time; // time passed since starting double delta_time = current_time - previous_time; if (save_video) { // in video mode, the time that passes only depends on the frame rate ... delta_time = VIDEO_FRAME_DELAY; // ... but we need to keep track how much time we gained and lost so that we can arbitrarily switch back and forth ... time_lost_taking_videos += (current_time - previous_time) - VIDEO_FRAME_DELAY; } else { // real time simulation delta_time = current_time - previous_time; } // Update particles UpdateParticles(scene, current_time - time_lost_taking_videos, delta_time, integration_type); // Generate new particles GenerateParticles(scene, current_time - time_lost_taking_videos, delta_time); // Render particles if (show_particles) RenderParticles(scene, current_time - time_lost_taking_videos, delta_time); // Remember previous time previous_time = current_time; }
/* * Display Function. * (Global vailiables used are, MODEL, D_PARAM and PARTICLE.) */ void Display(void){ int width, height; // Load data of particles. loadresult(&model, Ar, DLC, &disp); loadmeshdata("meshdata.txt", &model, mesh2, &disp); // Render starts here. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); width = glutGet(GLUT_WINDOW_WIDTH); height = glutGet(GLUT_WINDOW_HEIGHT); glViewport(0, 0, width, height); // アニメーションの描画 ------------------------------ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(30.0, (double)width / (double)height, 2.9, 10000.0); glMatrixMode(GL_MODELVIEW); glPushMatrix(); Polarview(&disp); // ポーラービュー設定 glTranslatef(-0.5*(float)model.sizey, -0.5*(float)model.sizez, -0.5*(float)model.sizex); //RenderSolidCarbon(&model); // カーボン描画 RenderBasis(&model); // 基盤の描画 RenderFlame(&model); // フレーム描画 RenderParticles(&model, Ar, DLC, &disp); // 粒子の描画 glPopMatrix(); //----------------------------------------------------------- // ステップ数などの描画-------------------------------------- glViewport(0, height - 80, 200, 80); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 2.5, 0.0, 1.0, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glDisable(GL_LIGHTING); glPushMatrix(); RenderText(&disp, &model); glPopMatrix(); glEnable(GL_LIGHTING); //----------------------------------------------------------- // 操作盤の描画---------------------------------------------- glViewport(width - 280, 0, 280, 101); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 280, 0.0, 101, -1.0, 1.0); glMatrixMode(GL_MODELVIEW); glDisable(GL_LIGHTING); glPushMatrix(); RenderMenu(&model, &disp); glPopMatrix(); glEnable(GL_LIGHTING); //----------------------------------------------------------- glutSwapBuffers(); };