///////////////////////////////////////////////// // IPostProcessingRenderable bool c_system_bloom::Render(Enums::postprocess_render_stage render_stage) { if(!m_members.m_flags.is_enabled) return false; bool applied = false; do { if(!g_bloom_defaults.flags.is_enabled_bit) break; // the bloom can be placed either before or after the HUD if(g_bloom_globals_current->flags.apply_after_hud_bit) { if(render_stage != Enums::_postprocess_render_stage_pre_ui) break; } else { if(render_stage != Enums::_postprocess_render_stage_pre_hud) break; } applied = RenderBloom(c_post_processing_main::Instance().Globals().render_device); }while(false); return applied; }
void TextureUpdate(void) { if (textures_done) { if (!RenderBloom()) return; CTexture* t; for (t = tHead; t; t = t->_next) { if (t->_my_id != TEXTURE_BLOOM) continue; do_bloom(t); return; } } for (CTexture* t = tHead; t; t = t->_next) { if (!t->_ready) { t->Rebuild(); return; } } textures_done = true; }
// --------------------------------------------------------------- bool MyPVRDemo::RenderScene() { // --- Work out DT unsigned long ulPrevTime = m_ulCurrTime; m_ulCurrTime = PVRShellGetTime(); m_fDT = ((float)m_ulCurrTime - (float)ulPrevTime) * 0.001f; // Calculate a new light matrix PVRTVec3 vLightPos = PVRTVec4(m_vLightPos, 1.0f) * PVRTMat4::RotationY(m_fLightAngle); m_mxLightView = PVRTMat4::LookAtRH(vLightPos, PVRTVec3(0,25,0), PVRTVec3(0,1,0)); // --- Render the scene from the light's POV RenderShadowScene(); // --- Clear buffers glViewport(0, 0, PVRShellGet(prefWidth), PVRShellGet(prefHeight)); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); PVRTMat4 mxCam = m_mxCam * PVRTMat4::RotationY(m_fAngleY); PVRTMat4 mxModel = PVRTMat4::Identity(); // --- Draw the Statue glUseProgram(m_StatueShader.uiID); glBindTexture(GL_TEXTURE_2D, m_tex[enumTEXTURE_StatueNormals]); RenderStatue(mxModel, mxCam, vLightPos, &m_StatueShader); // --- Draw the Statue reflected glCullFace(GL_FRONT); PVRTMat4 mxModelRefl = PVRTMat4::Scale(1,-1,1) * mxModel; RenderStatue(mxModelRefl, mxCam, vLightPos, &m_StatueShader); glCullFace(GL_BACK); // --- Draw the Floor (with shadow) RenderCurch(mxCam); // --- Render the bloom effect RenderBloom(mxModel, mxCam, vLightPos); // --- Increment the camera angle m_fAngleY += 0.5f * m_fDT; // --- Increment the light angle m_fLightAngle += 0.5f * m_fDT; return true; }