示例#1
0
//-----------------------------------------------------------------------------------------------
void Game::Render() const
{
	static const double NEAR_CLIPPING_PLANE_DISTANCE = 0.1;
	static const double FAR_CLIPPING_PLANE_DISTANCE = 1000.0;

	Renderer* renderer = Renderer::GetRenderer();

	renderer->PushMatrix();

	renderer->SetPerpectiveProjection( m_horizontalFOVDegrees, m_aspectRatio, NEAR_CLIPPING_PLANE_DISTANCE, FAR_CLIPPING_PLANE_DISTANCE );

	RenderGame();
	Debug::RenderDrawings();

	renderer->PopMatrix();

	renderer->PushMatrix();

	renderer->SetOrthographicProjection( 0.0, static_cast< double >( m_screenWidth ), 0.0, static_cast< double >( m_screenHeight ), 0.0, FAR_CLIPPING_PLANE_DISTANCE );
	renderer->DisableFeature( Renderer::DEPTH_TESTING );
	renderer->DisableDepthBufferWriting();

	RenderUI();

	if( m_consoleVisible )
		m_console->Render();

	renderer->EnableDepthBufferWriting();
	renderer->EnableFeature( Renderer::DEPTH_TESTING );

	renderer->PopMatrix();
}
void MyPS2Application::RenderGame()
{
	SPS2Manager.BeginScene();
		_background_texture.Upload(TEXBUF496);
		_background_texture.Select();
		_background_sprite.Render();
		
		RenderBlocks();
		player->Render();
		ball->Render();
		RenderUI();
	SPS2Manager.EndScene();
}
// Render the scene.
void D3D1211on12::OnRender()
{
	// Record all the commands we need to render the scene into the command list.
	PopulateCommandList();

	// Execute the command list.
	ID3D12CommandList* ppCommandLists[] = { m_commandList.Get() };
	m_commandQueue->ExecuteCommandLists(_countof(ppCommandLists), ppCommandLists);

	RenderUI();

	// Present the frame.
	ThrowIfFailed(m_swapChain->Present(0, 0));

	MoveToNextFrame();
}
示例#4
0
ezResult Scene::Render(ezTime lastFrameDuration)
{ 
  // set global ubos to their global binding points
  m_CameraUBO.BindBuffer(0);
  m_TimeUBO.BindBuffer(1);
  m_GlobalSceneInfo.BindBuffer(2);

  m_ExtractGeometryTimer->Start();
  m_pVoxelTerrain->ComputeGeometryInfo();
  m_ExtractGeometryTimer->End();

  // no depth test needed so far
  glDisable(GL_DEPTH_TEST);
  glDepthMask(GL_FALSE);

  // render nice background
  m_pBackground->Draw();

  // activate depth test


  glEnable(GL_DEPTH_TEST);
  glDepthMask(GL_TRUE);

  // render processed data
  m_DrawTimer->Start();
  if(SceneConfig::g_Wireframe)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  
  if(SceneConfig::g_UseReferenceVis)
    m_pVoxelTerrain->DrawReferenceRaycast();
  else
    m_pVoxelTerrain->Draw();
   
 
  m_DrawTimer->End();
   glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

  // disable depth test
  glDisable(GL_DEPTH_TEST);
  glDepthMask(GL_FALSE);

  // and ui
  RenderUI(lastFrameDuration);

  return EZ_SUCCESS;
}
示例#5
0
void UISprite::RenderAlphaUI( float alpha )
{
	// 알파 블렌딩
	g_pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
	g_pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
	g_pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CONSTANT);
	g_pDevice->SetTextureStageState(0, D3DTSS_CONSTANT, D3DXCOLOR(0, 0, 0, alpha));
	g_pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); 
	g_pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);		 
	g_pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);	

	RenderUI();

	// 복구
	g_pDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
	g_pDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
	g_pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
}