Exemplo n.º 1
0
    virtual void RenderSceneCB()
    {   
        CalcFPS();
        
        m_scale += 0.05f;

        m_pGameCamera->OnRender();

		m_gbuffer.StartFrame();

        DSGeometryPass();

		// We need stencil to be enabled in the stencil pass to get the stencil buffer
		// updated and we also need it in the light pass because we render the light
		// only if the stencil passes.
		glEnable(GL_STENCIL_TEST);

		for (unsigned int i = 0 ; i < ARRAY_SIZE_IN_ELEMENTS(m_pointLight); i++) {
			DSStencilPass(i);
			DSPointLightPass(i);
		}

		// The directional light does not need a stencil test because its volume
		// is unlimited and the final pass simply copies the texture.
		glDisable(GL_STENCIL_TEST);

		DSDirectionalLightPass();

		DSFinalPass();
        
        RenderFPS();
        
        glutSwapBuffers();
    }
Exemplo n.º 2
0
void GUI::Render(){

	int width = 0;
	int height = 0;
	glfwGetWindowSize(&width, &height);

	glDisable(GL_DEPTH_TEST);
	
	glMatrixMode(GL_PROJECTION);
	glPushMatrix();
	glLoadIdentity();
	glOrtho(0.0f, (int)width, 0.0f, (int)height, 0.0f, 10.0f);
	

	glMatrixMode(GL_MODELVIEW);
	glPushMatrix();
	glLoadIdentity();

	//Render text
	glColor3f(1, 0.5, 0);
	RenderFPS();
	//RenderPolyCount();
	RenderInfo();

	glPopMatrix();
	glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);

	glEnable(GL_DEPTH_TEST);

}
Exemplo n.º 3
0
    virtual void RenderSceneCB()
    {   
        CalcFPS();
        
        m_scale += 0.05f;

        m_pGameCamera->OnRender();

        DSGeometryPass();
        
        BeginLightPasses();

        DSPointLightsPass();

		DSDirectionalLightPass();
               
        RenderFPS();
        
        glutSwapBuffers();
    }
Exemplo n.º 4
0
    virtual void RenderSceneCB()
    {   
        m_pGameCamera->OnRender();      

        m_pipeline.SetCamera(*m_pGameCamera);
		
        GeometryPass();
        
        SSAOPass();
        
        BlurPass();
        
        LightingPass();                
		      	
        RenderFPS();     
        
        CalcFPS();
        
        OgldevBackendSwapBuffers();
    }
Exemplo n.º 5
0
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();
}
Exemplo n.º 6
0
    virtual void RenderSceneCB()
    {   
        CalcFPS();
        
        m_scale += 0.005f;

        m_pGameCamera->OnRender();

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        m_pEffect->Enable();
        m_pEffect->SetEyeWorldPos(m_pGameCamera->GetPos());
        
        Pipeline p;
        p.SetCamera(m_pGameCamera->GetPos(), m_pGameCamera->GetTarget(), m_pGameCamera->GetUp());
        p.SetPerspectiveProj(m_persProjInfo);   
        p.Rotate(0.0f, 90.0f, 0.0f);
        p.Scale(0.005f, 0.005f, 0.005f);                

        Matrix4f WVPMatrics[NUM_INSTANCES];
        Matrix4f WorldMatrices[NUM_INSTANCES];
        
        for (unsigned int i = 0 ; i < NUM_INSTANCES ; i++) {
            Vector3f Pos(m_positions[i]);
            Pos.y += sinf(m_scale) * m_velocity[i];
            p.WorldPos(Pos);        
            WVPMatrics[i] = p.GetWVPTrans().Transpose();
            WorldMatrices[i] = p.GetWorldTrans().Transpose();
        }
        
        m_pMesh->Render(NUM_INSTANCES, WVPMatrics, WorldMatrices);
        
        RenderFPS();
        
        glutSwapBuffers();
    }
Exemplo n.º 7
0
void ModelViewerRender::Render()
{
	if(!m_bInitilized) return ;//haven't initialized

	m_pDevice->getTimer()->tick();
	// Work out a frame delta time.
	const double frameDeltaTime = m_pDevice->getTimer()->GetElapsedTime() / 1000.0; // Time in seconds
	m_pRenderDevice->setRenderDeviceTime(m_pDevice->getTimer()->getTime(), frameDeltaTime);
	
	// notify the model current frame changed
	if(m_pMF1FileResource!=NULL&&m_pDynamicModel!=NULL)
		CModelControlDlg::NotifyPlayFrameChanged((int)(m_pDynamicModel->getAnimPlayedTime()/ISGPInstanceManager::DefaultSecondsPerFrame));
		
	m_pCamera->Update((float)frameDeltaTime);
	if(m_pDynamicModel!=NULL) m_pDynamicModel->update((float)frameDeltaTime);
	if(m_pStaticModel!=NULL) m_pStaticModel->update((float)frameDeltaTime);
	// update internal Camera position
	m_pRenderDevice->setViewMatrix3D( m_pCamera->GetRight(),m_pCamera->GetUp(),m_pCamera->GetDir(),m_pCamera->GetPos() );
	// calculate fps
	CalFPS(frameDeltaTime);
	
	ModelViewerConfig* pConfig=ModelViewerConfig::GetInstance();
	if(pConfig->m_bShowWireframe) glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
	else glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);

	m_pRenderDevice->setClearColor(pConfig->m_BkgndColor[0],pConfig->m_BkgndColor[1],\
		pConfig->m_BkgndColor[2],pConfig->m_BkgndColor[3]);

	m_pRenderDevice->beginScene(true,true,false);
	// render ground
	if(pConfig->m_bShowGround) RenderGround();
	// render model
	if(pConfig->m_bShowMesh)
	{
		if(m_pDynamicModel!=NULL) m_pDynamicModel->render();
		if(m_pStaticModel!=NULL) m_pStaticModel->render();
	}
	// render boundingbox
	if(pConfig->m_bShowBoundingBox&&m_pModelMF1!=NULL)
		RenderBoundingBox(m_pModelMF1->m_MeshAABBox);
	// render bones
	if(pConfig->m_bShowBones)
	{
		if(m_pDynamicModel!=NULL) RenderBones();
	}
	// render normals
	if(pConfig->m_bShowNormalLines)
	{
		if(m_pDynamicModel!=NULL) RenderDynamicNormals();
		if(m_pStaticModel!=NULL) RenderStaticNormals();
	}
	// render mesh box
	int meshcount=pConfig->m_bBoxShowVector.size();
	for(int i=0;i<meshcount&&m_pModelMF1!=NULL;++i)
	{
		// render mesh box
		if(pConfig->m_bBoxShowVector[i]==TRUE)
			RenderBoundingBox(m_pModelMF1->m_pLOD0Meshes[i].m_bbox);
	}
	
	// render coordinate axis
	RenderCoordinateAxis();
	
	// flush:draw objects
	m_pRenderDevice->FlushRenderBatch();

	// render attachment
	if(pConfig->m_bShowAttachment&&m_pModelMF1!=NULL) RenderAttachments();
	// render particle emitter
	if(pConfig->m_bShowParticleEmitter&&m_pModelMF1!=NULL) RenderParticleEmitter();
	m_pRenderDevice->FlushEditorLinesRenderBatch(true);

	m_pRenderDevice->BeginRenderText();
	RenderCoordinateLabel();
	RenderFPS();
	m_pRenderDevice->EndRenderText();

	m_pRenderDevice->endScene();
}