本文整理汇总了C++中ON_Xform::Transpose方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Xform::Transpose方法的具体用法?C++ ON_Xform::Transpose怎么用?C++ ON_Xform::Transpose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Xform
的用法示例。
在下文中一共展示了ON_Xform::Transpose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupViewport
void CRhGLShaderProgram::SetupViewport(const ON_Viewport& vp)
{
ON_Xform mv;
bool bHaveModeView = false;
if ( m_Uniforms.rglModelViewProjectionMatrix >= 0 )
{
float ModelViewProjection[16];
ON_Xform mvp;
vp.GetXform( ON::world_cs, ON::clip_cs, mvp );
mvp.Transpose();
Mat4Dto4F( &mvp.m_xform[0][0], ModelViewProjection );
glUniformMatrix4fv( m_Uniforms.rglModelViewProjectionMatrix, 1, GL_FALSE, ModelViewProjection );
}
if ( m_Uniforms.rglModelViewMatrix >= 0 )
{
float ModelView[16];
vp.GetXform( ON::world_cs, ON::camera_cs, mv );
mv.Transpose();
bHaveModeView = true;
Mat4Dto4F( &mv.m_xform[0][0], ModelView );
glUniformMatrix4fv( m_Uniforms.rglModelViewMatrix, 1, GL_FALSE, ModelView );
}
if ( m_Uniforms.rglProjectionMatrix >= 0 )
{
float Projection[16];
ON_Xform pr;
vp.GetXform( ON::camera_cs, ON::clip_cs, pr );
pr.Transpose();
Mat4Dto4F( &pr.m_xform[0][0], Projection );
glUniformMatrix4fv( m_Uniforms.rglProjectionMatrix, 1, GL_FALSE, Projection );
}
if ( m_Uniforms.rglNormalMatrix >= 0 )
{
float NormalMatrix[9];
if ( !bHaveModeView )
{
vp.GetXform( ON::world_cs, ON::camera_cs, mv );
mv.Transpose();
bHaveModeView = true;
}
Mat4Dto3F( &mv.m_xform[0][0], NormalMatrix );
glUniformMatrix3fv( m_Uniforms.rglNormalMatrix, 1, GL_FALSE, NormalMatrix );
}
}
示例2: ON_GL
void ON_GL( ON_Viewport& viewport,
int port_left, int port_right,
int port_bottom, int port_top
)
{
// Sets viewport's port to port_* values and adjusts frustum
// so it's aspect matches the port's.
ON_Xform projectionMatrix; // camera to clip transformation
const int port_width = abs(port_right - port_left);
const int port_height = abs(port_top - port_bottom);
if ( port_width == 0 || port_height == 0 )
return;
const double port_aspect = ((double)port_width)/((double)port_height);
viewport.SetFrustumAspect( port_aspect );
viewport.SetScreenPort( port_left, port_right, port_bottom, port_top,
0, 0xff );
ON_BOOL32 bHaveCameraToClip = viewport.GetXform(
ON::camera_cs,
ON::clip_cs,
projectionMatrix
);
if ( bHaveCameraToClip ) {
projectionMatrix.Transpose();
glMatrixMode(GL_PROJECTION);
glLoadMatrixd( &projectionMatrix.m_xform[0][0] );
}
}