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


C++ Matrix3f::FromEulerAnglesZXY方法代码示例

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


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

示例1: OnIdle

//----------------------------------------------------------------------------
void Skinning::OnIdle ()
{
    MeasureTime();
    MoveCamera();

    m_fTime = GetTimeInSeconds();

    Matrix3f kTemp;

    // create some arbitrary skinning transformations

    const float fFactor = Mathf::PI/1.25f;
    int iDiv = (int)(m_fTime/fFactor);
    // the angle now ranges from -factor/4 to +factor/4
    float fAngle = Mathf::FAbs(m_fTime-iDiv*fFactor-fFactor/2.0f)-
        fFactor/4.0f;

    for( int i = 0; i < 4; i++ )
    {
        if ( (int)(m_fTime/fFactor+0.25f)%2 )
        {
            kTemp.FromEulerAnglesZXY (Mathf::FAbs((float)i-1.5f)*fAngle,
                0,0);
        }
        else
        {
            kTemp.FromEulerAnglesZXY (((float)i-1.5f)*fAngle,
                0,0);
        }

        m_akSkinMat[i][0][0] = kTemp[0][0];
        m_akSkinMat[i][0][1] = kTemp[0][1];
        m_akSkinMat[i][0][2] = kTemp[0][2];
        m_akSkinMat[i][0][3] = 0.0f;

        m_akSkinMat[i][1][0] = kTemp[1][0];
        m_akSkinMat[i][1][1] = kTemp[1][1];
        m_akSkinMat[i][1][2] = kTemp[1][2];
        m_akSkinMat[i][1][3] = 10*Mathf::Sin(m_fTime+0.5f*(float)i);

        m_akSkinMat[i][2][0] = kTemp[2][0];
        m_akSkinMat[i][2][1] = kTemp[2][1];
        m_akSkinMat[i][2][2] = kTemp[2][2];
        m_akSkinMat[i][2][3] = 0.0f;

        m_akSkinMat[i][3][0] = 0.0f;
        m_akSkinMat[i][3][1] = 0.0f;
        m_akSkinMat[i][3][2] = 0.0f;
        m_akSkinMat[i][3][3] = 1.0f;
    }

    // Set the skinning matrices in the shader
    if ( m_bShaderEnabled )
    {
        m_spkTriMesh->GetVertexConst("SkinningMat[0]")->
            SetData(m_akSkinMat[0]);
        m_spkTriMesh->GetVertexConst("SkinningMat[1]")->
            SetData(m_akSkinMat[1]);
        m_spkTriMesh->GetVertexConst("SkinningMat[2]")->
            SetData(m_akSkinMat[2]);
        m_spkTriMesh->GetVertexConst("SkinningMat[3]")->
            SetData(m_akSkinMat[3]);
    } 

    if ( MoveObject() )
        m_spkScene->UpdateGS(0.0f);

    ms_spkRenderer->ClearBuffers();
    if ( ms_spkRenderer->BeginScene() )
    {
        if ( m_bInitialized )
        {
            ms_spkRenderer->Draw(m_spkScene);
            DrawFrameRate(8,GetHeight()-8,ColorRGB::WHITE);
        }
        else
        {
            ms_spkRenderer->Draw(8,32,ColorRGB::WHITE,
                "Load of skinning.wvs failed." );
            ms_spkRenderer->Draw(8,48,ColorRGB::WHITE,
                "Make sure these files are in the same directory as the "
                "executable.");
        }

        ms_spkRenderer->EndScene();
    }
    ms_spkRenderer->DisplayBackBuffer();

    UpdateClicks();
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:91,代码来源:Skinning.cpp


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