本文整理汇总了C++中AssetLoader::LoadObject方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetLoader::LoadObject方法的具体用法?C++ AssetLoader::LoadObject怎么用?C++ AssetLoader::LoadObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetLoader
的用法示例。
在下文中一共展示了AssetLoader::LoadObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tWinMain
//.........这里部分代码省略.........
windowData.hSubWnd = hSubWnd;
SetWindowLongPtr( hSubWnd, GWLP_USERDATA, reinterpret_cast< LONG_PTR >( &windowData ) );
ShowWindow( hSubWnd, nCmdShow );
UpdateWindow( hSubWnd );
#endif
HELIUM_VERIFY( D3D9Renderer::CreateStaticInstance() );
Renderer* pRenderer = Renderer::GetStaticInstance();
HELIUM_ASSERT( pRenderer );
pRenderer->Initialize();
Renderer::ContextInitParameters contextInitParams;
contextInitParams.pWindow = hMainWnd;
contextInitParams.displayWidth = displayWidth;
contextInitParams.displayHeight = displayHeight;
contextInitParams.bVsync = bVsync;
HELIUM_VERIFY( pRenderer->CreateMainContext( contextInitParams ) );
#if MULTI_WINDOW
contextInitParams.pWindow = hSubWnd;
RRenderContextPtr spSubRenderContext = pRenderer->CreateSubContext( contextInitParams );
HELIUM_ASSERT( spSubRenderContext );
#endif
Input::Initialize(&hMainWnd, false);
{
AssetPath prePassShaderPath;
HELIUM_VERIFY( prePassShaderPath.Set(
HELIUM_PACKAGE_PATH_CHAR_STRING TXT( "Shaders" ) HELIUM_OBJECT_PATH_CHAR_STRING TXT( "PrePass.hlsl" ) ) );
AssetPtr spPrePassShader;
HELIUM_VERIFY( AssetLoader::GetStaticInstance()->LoadObject( prePassShaderPath, spPrePassShader ) );
HELIUM_ASSERT( spPrePassShader.Get() );
}
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);
示例2: main
int main( int argc, const char* argv[] )
#endif
{
HELIUM_TRACE_SET_LEVEL( TraceLevels::Debug );
Helium::GetComponentsDefaultHeap();
Helium::GetBulletDefaultHeap();
#if HELIUM_TOOLS
Helium::GetEditorSupportDefaultHeap();
#endif
int32_t result = 0;
{
// Initialize a GameSystem instance.
CommandLineInitializationImpl commandLineInitialization;
MemoryHeapPreInitializationImpl memoryHeapPreInitialization;
AssetLoaderInitializationImpl assetLoaderInitialization;
ConfigInitializationImpl configInitialization;
#if HELIUM_DIRECT3D
WindowManagerInitializationImpl windowManagerInitialization( hInstance, nCmdShow );
#else
WindowManagerInitializationImpl windowManagerInitialization;
#endif
RendererInitializationImpl rendererInitialization;
//NullRendererInitialization rendererInitialization;
AssetPath systemDefinitionPath( "/ExampleGames/PhysicsDemo:System" );
GameSystem* pGameSystem = GameSystem::CreateStaticInstance();
HELIUM_ASSERT( pGameSystem );
bool bSystemInitSuccess = pGameSystem->Initialize(
commandLineInitialization,
memoryHeapPreInitialization,
assetLoaderInitialization,
configInitialization,
windowManagerInitialization,
rendererInitialization,
systemDefinitionPath);
if( bSystemInitSuccess )
{
World *pWorld = NULL;
{
AssetLoader *pAssetLoader = AssetLoader::GetStaticInstance();
SceneDefinitionPtr spSceneDefinition;
AssetPath scenePath( TXT( "/ExampleGames/PhysicsDemo/Scenes/TestScene:SceneDefinition" ) );
pAssetLoader->LoadObject(scenePath, spSceneDefinition );
HELIUM_ASSERT( !spSceneDefinition->GetAllFlagsSet( Asset::FLAG_BROKEN ) );
pWorld = pGameSystem->LoadScene(spSceneDefinition.Get());
}
HELIUM_ASSERT( pWorld );
if ( pWorld )
{
AssetLoader *pAssetLoader = AssetLoader::GetStaticInstance();
EntityDefinitionPtr spCubeDefinition;
EntityDefinitionPtr spSphereDefinition;
AssetPath spCubePath( TXT( "/ExampleGames/PhysicsDemo:Cube" ) );
AssetPath spSpherePath( TXT( "/ExampleGames/PhysicsDemo:Sphere" ) );
pAssetLoader->LoadObject(spCubePath, spCubeDefinition );
pAssetLoader->LoadObject(spSpherePath, spSphereDefinition );
Helium::StrongPtr< ParameterSet_InitLocated > locatedParamSet( new ParameterSet_InitLocated() );
locatedParamSet->m_Position = Simd::Vector3::Zero;
locatedParamSet->m_Rotation = Simd::Quat::IDENTITY;
Simd::Vector3 &position = locatedParamSet->m_Position;
Simd::Quat &rotation = locatedParamSet->m_Rotation;
for (int i = 0; i < 25; ++i)
{
position = Simd::Vector3(
50.0f * static_cast<float>(i / 5) - 100.0f + Helium::Ran(-10.0f, 10.0f),
Helium::Ran(150.0f, 200.0f),
50.0f * static_cast<float>(i % 5) - 100.0f + Helium::Ran(-10.0f, 10.0f));
pWorld->GetRootSlice()->CreateEntity(spCubeDefinition, locatedParamSet.Get());
}
for (int i = 0; i < 25; ++i)
{
position = Simd::Vector3(
50.0f * static_cast<float>(i / 5) - 100.0f + Helium::Ran(-10.0f, 10.0f),
Helium::Ran(250.0f, 300.0f),
50.0f * static_cast<float>(i % 5) - 100.0f + Helium::Ran(-10.0f, 10.0f));
pWorld->GetRootSlice()->CreateEntity(spSphereDefinition, locatedParamSet.Get());
}
for (int i = 0; i < 25; ++i)
{
position = Simd::Vector3(
50.0f * static_cast<float>(i / 5) - 100.0f + Helium::Ran(-10.0f, 10.0f),
//.........这里部分代码省略.........
示例3: Initialize
//.........这里部分代码省略.........
vertexElements[0].type = RENDERER_VERTEX_DATA_TYPE_FLOAT32_2;
vertexElements[0].semantic = RENDERER_VERTEX_SEMANTIC_POSITION;
vertexElements[0].semanticIndex = 0;
vertexElements[0].bufferIndex = 0;
vertexElements[1].type = RENDERER_VERTEX_DATA_TYPE_UINT8_4_NORM;
vertexElements[1].semantic = RENDERER_VERTEX_SEMANTIC_COLOR;
vertexElements[1].semanticIndex = 0;
vertexElements[1].bufferIndex = 0;
vertexElements[2].type = RENDERER_VERTEX_DATA_TYPE_FLOAT16_2;
vertexElements[2].semantic = RENDERER_VERTEX_SEMANTIC_TEXCOORD;
vertexElements[2].semanticIndex = 0;
vertexElements[2].bufferIndex = 0;
m_spScreenVertexDescription = pRenderer->CreateVertexDescription( vertexElements, 3 );
HELIUM_ASSERT( m_spScreenVertexDescription );
// Create configuration-dependent render resources.
PostConfigUpdate();
// Attempt to load the depth-only pre-pass shader.
// TODO: XXX TMC: Migrate to a more data-driven solution.
AssetLoader* pAssetLoader = AssetLoader::GetInstance();
HELIUM_ASSERT( pAssetLoader );
#ifdef HELIUM_DIRECT3D
AssetPath prePassShaderPath;
HELIUM_VERIFY( prePassShaderPath.Set( HELIUM_PACKAGE_PATH_CHAR_STRING "Shaders" HELIUM_OBJECT_PATH_CHAR_STRING "PrePass.hlsl" ) );
AssetPtr spPrePassShader;
HELIUM_VERIFY( pAssetLoader->LoadObject( prePassShaderPath, spPrePassShader ) );
Shader* pPrePassShader = Reflect::SafeCast< Shader >( spPrePassShader.Get() );
if ( HELIUM_VERIFY( pPrePassShader ) )
{
size_t loadId = pPrePassShader->BeginLoadVariant( RShader::TYPE_VERTEX, 0 );
HELIUM_ASSERT( IsValid( loadId ) );
if ( IsValid( loadId ) )
{
while ( !pPrePassShader->TryFinishLoadVariant( loadId, m_spPrePassVertexShader ) )
{
pAssetLoader->Tick();
}
}
}
// Attempt to load the simple world-space, simple screen-space, and screen-space text shaders.
// TODO: XXX TMC: Migrate to a more data-driven solution.
AssetPath shaderPath;
HELIUM_VERIFY( shaderPath.Set( HELIUM_PACKAGE_PATH_CHAR_STRING "Shaders" HELIUM_OBJECT_PATH_CHAR_STRING "Simple.hlsl" ) );
AssetPtr spShader;
HELIUM_VERIFY( pAssetLoader->LoadObject( shaderPath, spShader ) );
Shader* pShader = Reflect::SafeCast< Shader >( spShader.Get() );
if ( HELIUM_VERIFY( pShader ) )
{
size_t loadId = pShader->BeginLoadVariant( RShader::TYPE_VERTEX, 0 );
HELIUM_ASSERT( IsValid( loadId ) );
if ( IsValid( loadId ) )
{
while ( !pShader->TryFinishLoadVariant( loadId, m_spSimpleWorldSpaceVertexShader ) )
{