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


C++ CDXUTSDKMesh::LoadAnimation方法代码示例

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


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

示例1: vEye

//--------------------------------------------------------------------------------------
// Create any D3D10 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc,
                                      void* pUserContext )
{
    HRESULT hr;

    V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) );
    V_RETURN( g_D3DSettingsDlg.OnD3D10CreateDevice( pd3dDevice ) );
    V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
                                OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
                                L"Arial", &g_pFont10 ) );
    V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) );
    g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 );

    V_RETURN( CDXUTDirectionWidget::StaticOnD3D10CreateDevice( pd3dDevice ) );

    // Read the D3DX effect file
    WCHAR str[MAX_PATH];
    V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MotionBlur10.fx" ) );
    DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
    // Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
    // Setting this flag improves the shader debugging experience, but still allows 
    // the shaders to be optimized and to run exactly the way they will run in 
    // the release configuration of this program.
    dwShaderFlags |= D3D10_SHADER_DEBUG;
    #endif
    V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL,
                                              NULL, &g_pEffect, NULL, NULL ) );

    // Obtain the technique handles
    g_pRenderScene = g_pEffect->GetTechniqueByName( "RenderScene" );
    g_pRenderSkinnedScene = g_pEffect->GetTechniqueByName( "RenderSkinnedScene" );
    g_pRenderMotionBlur = g_pEffect->GetTechniqueByName( "RenderMotionBlur" );
    g_pRenderSkinnedMotionBlur = g_pEffect->GetTechniqueByName( "RenderSkinnedMotionBlur" );

    // Obtain the parameter handles
    g_pmWorldViewProj = g_pEffect->GetVariableByName( "g_mWorldViewProj" )->AsMatrix();
    g_pmViewProj = g_pEffect->GetVariableByName( "g_mViewProj" )->AsMatrix();
    g_pmWorldView = g_pEffect->GetVariableByName( "g_mWorldView" )->AsMatrix();
    g_pmBlurViewProj = g_pEffect->GetVariableByName( "g_mBlurViewProj" )->AsMatrix();
    g_pmBlurWorld = g_pEffect->GetVariableByName( "g_mBlurWorld" )->AsMatrix();
    g_pmBoneWorld = g_pEffect->GetVariableByName( "g_mBoneWorld" )->AsMatrix();
    g_ptxDiffuse = g_pEffect->GetVariableByName( "g_txDiffuse" )->AsShaderResource();
    g_pfFrameTime = g_pEffect->GetVariableByName( "g_fFrameTime" )->AsScalar();
    g_piNumSteps = g_pEffect->GetVariableByName( "g_iNumSteps" )->AsScalar();
    g_pfFadeDist = g_pEffect->GetVariableByName( "g_fFadeDist" )->AsScalar();

    // Define our vertex data layout
    const D3D10_INPUT_ELEMENT_DESC staticlayout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    };

    D3D10_PASS_DESC PassDesc;
    g_pRenderScene->GetPassByIndex( 0 )->GetDesc( &PassDesc );
    V_RETURN( pd3dDevice->CreateInputLayout( staticlayout, 4, PassDesc.pIAInputSignature,
                                             PassDesc.IAInputSignatureSize, &g_pStaticVertexLayout ) );

    //Create the scene meshes
    g_SceneMesh.Create( pd3dDevice, L"motionblur\\WindMillStage.sdkmesh" );
    g_FanMesh.Create( pd3dDevice, L"motionblur\\Fan.sdkmesh" );
    D3DXMatrixTranslation( &g_mFanWorld, 0.0f, 3.62f, 2.012f );

    //Create the Linked Meshes
    g_pLinkedMeshes = new CDXUTSDKMesh[ g_NumLinkedMeshes ];
    if( !g_pLinkedMeshes )
        return E_OUTOFMEMORY;
    for( UINT iMesh = 0; iMesh < g_NumLinkedMeshes; iMesh++ )
    {
        g_pLinkedMeshes[iMesh].Create( pd3dDevice, g_MeshLinkages[iMesh].szMeshName );
    }

    const D3D10_INPUT_ELEMENT_DESC skinnedlayout[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "BONES", 0, DXGI_FORMAT_R32G32B32A32_UINT, 0, 44, D3D10_INPUT_PER_VERTEX_DATA, 0 },
        { "WEIGHTS", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 60, D3D10_INPUT_PER_VERTEX_DATA, 0 },
    };

    g_pRenderSkinnedScene->GetPassByIndex( 0 )->GetDesc( &PassDesc );
    V_RETURN( pd3dDevice->CreateInputLayout( skinnedlayout, 6, PassDesc.pIAInputSignature,
                                             PassDesc.IAInputSignatureSize, &g_pSkinnedVertexLayout ) );
    g_AnimMesh.Create( pd3dDevice, L"motionblur\\Warrior.sdkmesh" );
    g_AnimMesh.LoadAnimation( L"motionblur\\Warrior.sdkmesh_anim" );

    //camera
    D3DXVECTOR3 vEye( 2.0f, 1.3f, -4.0f );
    D3DXVECTOR3 vAt( 0.0f, 1.0f, -1.11f );
    g_Camera.SetViewParams( &vEye, &vAt );

    return S_OK;
//.........这里部分代码省略.........
开发者ID:marselas,项目名称:Zombie-Direct3D-Samples,代码行数:101,代码来源:MotionBlur10.cpp


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