本文整理汇总了C++中GraphicsScene::AllocateSceneView方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsScene::AllocateSceneView方法的具体用法?C++ GraphicsScene::AllocateSceneView怎么用?C++ GraphicsScene::AllocateSceneView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsScene
的用法示例。
在下文中一共展示了GraphicsScene::AllocateSceneView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BindToWorld
void Viewport::BindToWorld( World* newWorld )
{
if (newWorld && newWorld != m_World)
{
GraphicsScene* pGraphicsScene;
// Release the old scene view if we have one.
if ( m_World && IsValid(m_SceneViewId) )
{
pGraphicsScene = GetGraphicsScene();
pGraphicsScene->ReleaseSceneView( m_SceneViewId );
}
// Set up the new scene view.
m_World = newWorld;
pGraphicsScene = GetGraphicsScene();
m_SceneViewId = pGraphicsScene->AllocateSceneView();
OnResize();
}
}
示例2: _tWinMain
//.........这里部分代码省略.........
RenderResourceManager& rRenderResourceManager = RenderResourceManager::GetStaticInstance();
rRenderResourceManager.Initialize();
rRenderResourceManager.UpdateMaxViewportSize( displayWidth, displayHeight );
//// Create a scene definition
SceneDefinitionPtr spSceneDefinition;
gAssetLoader->LoadObject( AssetPath( TXT( "/ExampleGames/Empty/Scenes/TestScene:SceneDefinition" ) ), spSceneDefinition );
EntityDefinitionPtr spEntityDefinition;
gAssetLoader->LoadObject( AssetPath( TXT( "/ExampleGames/Empty/Scenes/TestScene:TestBull_Entity" ) ), spEntityDefinition );
DynamicDrawer& rDynamicDrawer = DynamicDrawer::GetStaticInstance();
HELIUM_VERIFY( rDynamicDrawer.Initialize() );
RRenderContextPtr spMainRenderContext = pRenderer->GetMainContext();
HELIUM_ASSERT( spMainRenderContext );
WorldManager& rWorldManager = WorldManager::GetStaticInstance();
HELIUM_VERIFY( rWorldManager.Initialize() );
// Create a world
WorldPtr spWorld( rWorldManager.CreateWorld( spSceneDefinition ) );
HELIUM_ASSERT( spWorld );
HELIUM_TRACE( TraceLevels::Info, TXT( "Created world \"%s\".\n" ), *spSceneDefinition->GetPath().ToString() );
//Slice *pRootSlice = spWorld->GetRootSlice();
//Entity *pEntity = pRootSlice->CreateEntity(spEntityDefinition);
GraphicsScene* pGraphicsScene = spWorld->GetComponents().GetFirst<GraphicsManagerComponent>()->GetGraphicsScene();
HELIUM_ASSERT( pGraphicsScene );
GraphicsSceneView* pMainSceneView = NULL;
if( pGraphicsScene )
{
uint32_t mainSceneViewId = pGraphicsScene->AllocateSceneView();
if( IsValid( mainSceneViewId ) )
{
float32_t aspectRatio =
static_cast< float32_t >( displayWidth ) / static_cast< float32_t >( displayHeight );
RSurface* pDepthStencilSurface = rRenderResourceManager.GetDepthStencilSurface();
HELIUM_ASSERT( pDepthStencilSurface );
pMainSceneView = pGraphicsScene->GetSceneView( mainSceneViewId );
HELIUM_ASSERT( pMainSceneView );
pMainSceneView->SetRenderContext( spMainRenderContext );
pMainSceneView->SetDepthStencilSurface( pDepthStencilSurface );
pMainSceneView->SetAspectRatio( aspectRatio );
pMainSceneView->SetViewport( 0, 0, displayWidth, displayHeight );
pMainSceneView->SetClearColor( Color( 0x00202020 ) );
//spMainCamera->SetSceneViewId( mainSceneViewId );
#if MULTI_WINDOW
uint32_t subSceneViewId = pGraphicsScene->AllocateSceneView();
if( IsValid( subSceneViewId ) )
{
GraphicsSceneView* pSubSceneView = pGraphicsScene->GetSceneView( subSceneViewId );
HELIUM_ASSERT( pSubSceneView );
pSubSceneView->SetRenderContext( spSubRenderContext );
pSubSceneView->SetDepthStencilSurface( pDepthStencilSurface );
pSubSceneView->SetAspectRatio( aspectRatio );
pSubSceneView->SetViewport( 0, 0, displayWidth, displayHeight );
pSubSceneView->SetClearColor( Color( 0x00202020 ) );
//spSubCamera->SetSceneViewId( subSceneViewId );
}