virtual void RenderSceneCB() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_pGameCamera->OnRender(); Pipeline p; p.WorldPos(-3.0f, 0.0f, 0.0f); p.Scale(2.0f, 2.0f, 2.0f); p.Rotate(-90.0f, 15.0f, 0.0f); p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp()); p.SetPerspectiveProj(m_persProjInfo); m_lightingEffect.SetEyeWorldPos(m_pGameCamera->GetPos()); m_lightingEffect.SetVP(p.GetVPTrans()); m_lightingEffect.SetWorldMatrix(p.GetWorldTrans()); m_lightingEffect.SetTessellationLevel(m_tessellationLevel); m_pMesh->Render(NULL); p.WorldPos(3.0f, 0.0f, 0.0f); p.Rotate(-90.0f, -15.0f, 0.0f); m_lightingEffect.SetVP(p.GetVPTrans()); m_lightingEffect.SetWorldMatrix(p.GetWorldTrans()); m_lightingEffect.SetTessellationLevel(1.0f); m_pMesh->Render(NULL); glutSwapBuffers(); }
virtual void RenderSceneCB() { long long TimeNowMillis = GetCurrentTimeMillis(); assert(TimeNowMillis >= m_currentTimeMillis); unsigned int DeltaTimeMillis = (unsigned int)(TimeNowMillis - m_currentTimeMillis); m_currentTimeMillis = TimeNowMillis; m_pGameCamera->OnRender(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_pLightingTechnique->Enable(); m_pTexture->Bind(COLOR_TEXTURE_UNIT); m_pNormalMap->Bind(NORMAL_TEXTURE_UNIT); Pipeline p; p.Scale(20.0f, 20.0f, 1.0f); p.Rotate(90.0f, 0.0, 0.0f); p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp()); p.SetPerspectiveProj(m_persProjInfo); m_pLightingTechnique->SetWVP(p.GetWVPTrans()); m_pLightingTechnique->SetWorldMatrix(p.GetWorldTrans()); m_pGround->Render(); m_particleSystem.Render(DeltaTimeMillis, p.GetVPTrans(), m_pGameCamera->GetPos()); glutSwapBuffers(); }
void Chunks::Render(Pipeline p, StaticShadowVolumeShader* shadowShader) { shadowShader->Enable(); shadowShader->SetVP(p.GetVPTrans()); shadowShader->SetWorldMatrix(p.GetWorldTrans()); for (int i = 0; i < VIEW_DISTANCE / CHUNK_SIZE_X * 2; i++) { for (int j = 0; j < VIEW_DISTANCE / CHUNK_SIZE_Z * 2; ++j) { Get(i,j)->Render(); } } }