当前位置: 首页>>代码示例>>C++>>正文


C++ GraphicsScene::Update方法代码示例

本文整理汇总了C++中GraphicsScene::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsScene::Update方法的具体用法?C++ GraphicsScene::Update怎么用?C++ GraphicsScene::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphicsScene的用法示例。


在下文中一共展示了GraphicsScene::Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Draw

void Viewport::Draw()
{
	HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "" );

	uint64_t start = Timer::GetTickCount();

	if (!m_World)
	{
		return;
	}

	Camera& camera = m_Cameras[m_CameraMode];

	GraphicsScene* pGraphicsScene = GetGraphicsScene();
	GraphicsSceneView* pSceneView = pGraphicsScene->GetSceneView( m_SceneViewId );
	BufferedDrawer* pDrawer = pGraphicsScene->GetSceneViewBufferedDrawer( m_SceneViewId );

	{
		HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Setup Viewport and Projection" );

		pSceneView->SetViewAndProjectionMatrices(
			Simd::Matrix44( const_cast<Matrix4&>( camera.GetView() ).GetArray1d() ),
			Simd::Matrix44( const_cast<Matrix4&>( camera.GetProjection() ).GetArray1d() )
		);
	}

	pGraphicsScene->SetActiveSceneView( m_SceneViewId );
	pGraphicsScene->Update( m_World.Get() );
	pGraphicsScene->SetActiveSceneView( Invalid< uint32_t >() );

	if (m_GridVisible)
	{
		m_GlobalPrimitives[GlobalPrimitives::StandardGrid]->Draw( pDrawer );
	}

	// this seems like a bad place to do this
	if (m_Tool)
	{
		HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Tool Evaluate" );
		m_Tool->Evaluate();
	}

	{
		HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "PreRender" );

		if (m_GridVisible)
		{
			m_GlobalPrimitives[GlobalPrimitives::StandardGrid]->Draw( pDrawer );
		}
	}

	{
		HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Render" );

		{
			HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Render Setup" );
			m_RenderVisitor.Reset( this, pDrawer );
		}

		{
			HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Render Walk" );
			m_Render.Raise( &m_RenderVisitor );
		}

		if (m_Tool)
		{
			HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "Render Tool" );
			m_Tool->Draw( pDrawer );
		}
	}

	{
		HELIUM_EDITOR_SCENE_RENDER_SCOPE_TIMER( "PostRender" );

		//device->Clear(NULL, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0);

		if (m_AxesVisible)
		{
			static_cast<Editor::PrimitiveAxes*>(m_GlobalPrimitives[GlobalPrimitives::ViewportAxes])->DrawViewport( pDrawer, &m_Cameras[m_CameraMode] );
		}

		if (m_Tool)
		{
			m_Tool->Draw( pDrawer );
		}

#if  VIEWPORT_REFACTOR
		if ( m_Focused )
		{
			unsigned w = 3;
			unsigned x = m_Size.x;
			unsigned y = m_Size.y;

			uint32_t color = D3DCOLOR_ARGB(255, 200, 200, 200);

			std::vector< TransformedColored > vertices;

			//   <--
			//  | \  ^
			//  v  \ |
//.........这里部分代码省略.........
开发者ID:HeliumProject,项目名称:Helium,代码行数:101,代码来源:Viewport.cpp


注:本文中的GraphicsScene::Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。