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


C++ Transform::GetMatrix方法代码示例

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


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

示例1: Update

void ActionMoveToPoint::Update(unsigned int Delta)
{
	if (owner)
	{
		Transform *t = owner->GetTransform();

		Vector3 ownerPos = t->Position();
		Vector3 targetPos = targetPoint->Position();

		if (Vector3::Distance(Vector3(ownerPos.x, 0, ownerPos.z), Vector3(targetPos.x, 0, targetPos.z)) < moveSpeed * 2.0f)	//ignore Y for gravity, temp fix
		{
			t->SetPosition(targetPos);
			owner->SetVelocity(Vector3(0, owner->Velocity().y, 0));
			owner->SetActionState(NULL);
			return;
		}


		float rad = atan2(ownerPos.x - targetPos.x, ownerPos.z - targetPos.z);

		Vector3 orientation = t->Orientation();
		orientation.y = rad;

		t->SetOrientation(orientation);

		Vector3 velocity = owner->Velocity();
		Vector3 nVelocity = t->GetMatrix().Forward() * moveSpeed;
		nVelocity.y = velocity.y;

		owner->SetVelocity(nVelocity);
	}
};
开发者ID:SoundAxis,项目名称:Wrench.2014,代码行数:32,代码来源:ActionMoveToPoint.cpp

示例2: MatrixFromTransform

SbMatrix tgf::MatrixFromTransform( const Transform& transform )
{
	Ptr<Matrix4x4> transformMatrix = transform.GetMatrix()->Transpose();
	float m00 = float ( transformMatrix->m[0][0] );
	float m01 = float ( transformMatrix->m[0][1] );
	float m02 = float ( transformMatrix->m[0][2] );
	float m03 = float ( transformMatrix->m[0][3] );
	float m10 = float ( transformMatrix->m[1][0] );
	float m11 = float ( transformMatrix->m[1][1] );
	float m12 = float ( transformMatrix->m[1][2] );
	float m13 = float ( transformMatrix->m[1][3] );
	float m20 = float ( transformMatrix->m[2][0] );
	float m21 = float ( transformMatrix->m[2][1] );
	float m22 = float ( transformMatrix->m[2][2] );
	float m23 = float ( transformMatrix->m[2][3] );
	float m30 = float ( transformMatrix->m[3][0] );
	float m31 = float ( transformMatrix->m[3][1] );
	float m32 = float ( transformMatrix->m[3][2] );
	float m33 = float ( transformMatrix->m[3][3] );

	SbVec3f axis1( m00, m10, m20 );
	SbVec3f axis2( m01, m11, m21 );
	//axis2.normalize();

	SbVec3f axis3( m02, m12, m22 );
	//axis3.normalize();

	return SbMatrix( axis1[0], axis2[0], axis3[0], m03,
			axis1[1], axis2[1], axis3[1], m13,
			axis1[2], axis2[2], axis3[2], m23,
			m30, m31, m32, m33 );

}
开发者ID:iat-cener,项目名称:tonatiuh,代码行数:33,代码来源:tgf.cpp

示例3: RenderSphere

void Manipulator::RenderSphere(LPD3DXEFFECT effect,
    const Matrix& projection, const Matrix& view,
    const D3DXVECTOR3& color, const Transform& world)
{
    D3DXMATRIX wvp = world.GetMatrix() * view.GetMatrix() * projection.GetMatrix();
    effect->SetMatrix(DxConstant::WordViewProjection, &wvp);
    effect->SetFloatArray(DxConstant::VertexColor, &color.x, 3);

    UINT nPasses = 0;
    effect->Begin(&nPasses, 0);
    for(UINT iPass = 0; iPass < nPasses; iPass++)
    {
        effect->BeginPass(iPass);
        m_sphere->DrawSubset(0);
        effect->EndPass();
    }
    effect->End();
}
开发者ID:karajensen,项目名称:cloth-simulator,代码行数:18,代码来源:manipulator.cpp

示例4: defined

Transform operator*(Transform const& A, Transform const& B)
{
    if (A.IsIdentity())
    {
        return B;
    }

    if (B.IsIdentity())
    {
        return A;
    }

    Transform product;

    if (A.IsRSMatrix() && B.IsRSMatrix())
    {
#if defined(GTE_USE_MAT_VEC)
        if (A.IsUniformScale())
        {
            product.SetRotation(A.GetRotation() * B.GetRotation());

            product.SetTranslation(A.GetUniformScale()*(
                A.GetRotation() * B.GetTranslationW0()) +
                A.GetTranslationW1());

            if (B.IsUniformScale())
            {
                product.SetUniformScale(
                    A.GetUniformScale() * B.GetUniformScale());
            }
            else
            {
                product.SetScale(A.GetUniformScale() * B.GetScale());
            }

            return product;
        }
#else
        if (B.IsUniformScale())
        {
            product.SetRotation(A.GetRotation() * B.GetRotation());

            product.SetTranslation(B.GetUniformScale()*(
                A.GetTranslationW0() * B.GetRotation()) + B.GetTranslationW1());

            if (A.IsUniformScale())
            {
                product.SetUniformScale(
                    A.GetUniformScale() * B.GetUniformScale());
            }
            else
            {
                product.SetScale(A.GetScale() * B.GetUniformScale());
            }

            return product;
        }
#endif
    }

    // In all remaining cases, the matrix cannot be written as R*S*X+T.
    Matrix4x4<float> matMA;
    if (A.IsRSMatrix())
    {
#if defined(GTE_USE_MAT_VEC)
        matMA = MultiplyMD(A.GetRotation(), A.GetScaleW1());
#else
        matMA = MultiplyDM(A.GetScaleW1(), A.GetRotation());
#endif
    }
    else
    {
        matMA = A.GetMatrix();
    }

    Matrix4x4<float> matMB;
    if (B.IsRSMatrix())
    {
#if defined(GTE_USE_MAT_VEC)
        matMB = MultiplyMD(B.GetRotation(), B.GetScaleW1());
#else
        matMB = MultiplyDM(B.GetScaleW1(), B.GetRotation());
#endif
    }
    else
    {
        matMB = B.GetMatrix();
    }

    product.SetMatrix(matMA * matMB);
#if defined(GTE_USE_MAT_VEC)
    product.SetTranslation(matMA * B.GetTranslationW0() +
        A.GetTranslationW1());
#else
    product.SetTranslation(A.GetTranslationW0() * matMB +
        B.GetTranslationW1());
#endif
    return product;
}
开发者ID:c0g,项目名称:FaceWarpApp,代码行数:99,代码来源:GteTransform.cpp


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