本文整理汇总了C++中Matrix4x4::AffineInverse方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::AffineInverse方法的具体用法?C++ Matrix4x4::AffineInverse怎么用?C++ Matrix4x4::AffineInverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4::AffineInverse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Pick
void Pick( const ZED_UINT32 p_Width, const ZED_UINT32 p_Height,
const ZED_UINT32 p_X, const ZED_UINT32 p_Y,
const Matrix4x4 &p_Projection, const Matrix4x4 &p_View,
Ray *p_Picked )
{
Vector3 RayPos, Origin, Direction;
Matrix4x4 InvView;
InvView.Copy( p_View );
InvView.AffineInverse( );
RayPos[ 0 ] = ( ( ( 2.0f * p_X )/p_Width ) - 1.0f )/
p_Projection( 0, 0 );
RayPos[ 1 ] = ( ( ( 2.0f * p_Y )/p_Height ) - 1.0f )/
p_Projection( 1, 1 );
RayPos[ 2 ] = 1.0f;
Direction[ 0 ] = RayPos[ 0 ]*InvView( 0, 0 ) +
RayPos[ 1 ]*InvView( 1, 0 ) +
RayPos[ 2 ]*InvView( 2, 0 );
Direction[ 1 ] = RayPos[ 0 ]*InvView( 0, 1 ) +
RayPos[ 1 ]*InvView( 1, 1 ) +
RayPos[ 2 ]*InvView( 2, 1 );
Direction[ 2 ] = RayPos[ 0 ]*InvView( 0, 2 ) +
RayPos[ 1 ]*InvView( 1, 2 ) +
RayPos[ 2 ]*InvView( 2, 2 );
Origin[ 0 ] = InvView( 0, 3 );
Origin[ 1 ] = InvView( 1, 3 );
Origin[ 2 ] = InvView( 2, 3 );
p_Picked->Set( Origin, Direction );
}
示例2: Detransform
void Ray::Detransform( const Matrix4x4 &p_Matrix )
{
Matrix4x4 Tmp;
Tmp.Copy( p_Matrix );
// Take the negated translation from the matrix
m_Origin[ 0 ] -= p_Matrix( 0, 3 );
m_Origin[ 1 ] -= p_Matrix( 1, 3 );
m_Origin[ 2 ] -= p_Matrix( 2, 3 );
// Get rid of the translation in the matrix
Tmp( 0, 3 ) = Tmp( 1, 3 ) = Tmp( 2, 3 ) = 0.0f;
// Invert the matrix
Tmp.AffineInverse( );
/*UNCOMMENT! m_Direction = m_Origin * Tmp;*/
}