本文整理汇总了C++中QMatrix4x4::column方法的典型用法代码示例。如果您正苦于以下问题:C++ QMatrix4x4::column方法的具体用法?C++ QMatrix4x4::column怎么用?C++ QMatrix4x4::column使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMatrix4x4
的用法示例。
在下文中一共展示了QMatrix4x4::column方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPositionFromViewMatrix
QVector3D myCam::getPositionFromViewMatrix(QMatrix4x4 matrix)
{
QMatrix4x4 viewRot = matrix;
viewRot.setColumn(3, QVector4D(0,0,0,1));
QVector4D p = -(viewRot.transposed() * matrix.column(3));
return QVector3D(p.x(), p.y(), p.z());
}
示例2: updateState
void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
{
Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect);
QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect);
if (oldMaterial == 0 || material->color() != oldMaterial->color()) {
QVector4D c = material->color();
state.context()->functions()->glBlendColor(c.x(), c.y(), c.z(), 1.0f);
}
if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale())
program()->setUniformValue(m_fontScale_id, GLfloat(material->fontScale()));
if (oldMaterial == 0 || state.isMatrixDirty()) {
int viewportWidth = state.viewportRect().width();
QMatrix4x4 mat = state.combinedMatrix().inverted();
program()->setUniformValue(m_vecDelta_id, mat.column(0) * (qreal(2) / viewportWidth));
}
QSGDistanceFieldTextMaterialShader::updateState(state, newEffect, oldEffect);
}
示例3: render
void OculusRiftNode::render( qint64 pTimeStamp, QUuid pSourcePinId )
{
Q_UNUSED( pSourcePinId )
#if !defined( OCULUS_PLUGIN_SUPPORTED )
Q_UNUSED( pTimeStamp )
#else
fugio::Performance Perf( mNode, "drawGeometry", pTimeStamp );
if( !mNode->isInitialised() )
{
return;
}
if( !mOculusRift->hmd() )
{
return;
}
// We need to keep a reference to ourselves here as ovr_SubmitFrame can
// call the main app event loop, which can close the context and delete us!
QSharedPointer<fugio::NodeControlInterface> C = mNode->control();
mOculusRift->drawStart();
const float NearPlane = variant( mPinNearPlane ).toFloat();
const float FarPlane = variant( mPinFarPlane ).toFloat();
// float Yaw(3.141592f);
// Vector3f Pos2(0.0f,1.6f,-5.0f);
// Pos2.y = ovrHmd_GetFloat(mHMD, OVR_KEY_EYE_HEIGHT, Pos2.y);
QMatrix4x4 MatEye = variant( mPinViewMatrix ).value<QMatrix4x4>();
QVector3D TrnEye = MatEye.column( 3 ).toVector3D();
MatEye.setColumn( 3, QVector4D( 0, 0, 0, 1 ) );
const Vector3f Pos2( TrnEye.x(), TrnEye.y(), TrnEye.z() );
Matrix4f tempRollPitchYaw;
memcpy( tempRollPitchYaw.M, MatEye.constData(), sizeof( float ) * 16 );
const Matrix4f rollPitchYaw = tempRollPitchYaw;
// Render Scene to Eye Buffers
for (int eye = 0; eye < 2; eye++)
{
mOculusRift->drawEyeStart( eye );
// Get view and projection matrices
//Matrix4f rollPitchYaw = Matrix4f( MatEye.transposed().data() );
Matrix4f finalRollPitchYaw = rollPitchYaw * Matrix4f( mOculusRift->eyeRenderPos( eye ).Orientation);
Vector3f finalUp = finalRollPitchYaw.Transform(Vector3f(0, 1, 0));
Vector3f finalForward = finalRollPitchYaw.Transform(Vector3f(0, 0, -1));
Vector3f shiftedEyePos = Pos2 + rollPitchYaw.Transform( mOculusRift->eyeRenderPos( eye ).Position );
Matrix4f view = Matrix4f::LookAtRH(shiftedEyePos, shiftedEyePos + finalForward, finalUp);
Matrix4f proj = ovrMatrix4f_Projection( mOculusRift->defaultEyeFOV( eye ), NearPlane, FarPlane, ovrProjection_None );
mProjection->setVariant( QMatrix4x4( &proj.M[ 0 ][ 0 ], 4, 4 ).transposed() );
mView->setVariant( QMatrix4x4( &view.M[ 0 ][ 0 ], 4, 4 ).transposed() );
fugio::OpenGLStateInterface *CurrentState = 0;
for( QSharedPointer<fugio::PinInterface> P : mNode->enumInputPins() )
{
if( !P->isConnected() )
{
continue;
}
if( P->connectedPin().isNull() )
{
continue;
}
if( P->connectedPin()->control().isNull() )
{
continue;
}
QObject *O = P->connectedPin()->control()->qobject();
if( !O )
{
continue;
}
if( true )
{
fugio::RenderInterface *Geometry = qobject_cast<fugio::RenderInterface *>( O );
if( Geometry )
{
Geometry->render( pTimeStamp );
continue;
//.........这里部分代码省略.........
示例4: matrix
inline QMatrix4x4 matrix( const QMatrix4x4 & modelView )
{ QMatrix4x4 bilboard; bilboard.setColumn( 3, modelView.column(3) ); return bilboard; }
示例5: traceMatrix
void traceMatrix (QMatrix4x4 qm){
for (int i = 0; i < 4; i++)
std::cout << qm.column(i)[0] << " " << qm.column(i)[1] << " " << qm.column(i)[2] << " " << qm.column(i)[3] << std::endl;
}
示例6: bottomRight
QVector3D Frustum::bottomRight(QMatrix4x4 const& _m) const {
return _m * bottomRight() - _m.column(3).toVector3D();
}
示例7: topLeft
QVector3D Frustum::topLeft(QMatrix4x4 const& _m) const {
return _m * topLeft() - _m.column(3).toVector3D();
}
示例8: drawLayers
void AnimeGLWidget::drawLayers(ObjectItem *pLayerItem)
{
int selFrame = m_pEditData->getSelectFrame();
int flag = pLayerItem->data(Qt::CheckStateRole).toInt();
if (m_pEditData->getObjectModel()->isLayer(pLayerItem->getIndex()) && (flag & ObjectItem::kState_Disp))
{
FrameData d;
bool valid;
d = pLayerItem->getDisplayFrameData(selFrame, &valid);
if (valid)
{
QMatrix4x4 mat = pLayerItem->getDisplayMatrix(selFrame);
if (m_pSetting->getUseZSort())
{
DRAW_FRAMEDATA draw;
draw.mat = mat;
draw.data = d;
if (m_pSetting->getDrawFrame() && !m_pEditData->isExportPNG())
{
ObjectItem *p = m_pEditData->getObjectModel()->getItemFromIndex(m_pEditData->getSelIndex());
if (pLayerItem == p)
{
if (m_bPressCtrl)
{
draw.frameCol = QColor(0, 255, 0, 255);
}
else
{
draw.frameCol = QColor(255, 0, 0, 255);
}
}
else
{
draw.frameCol = QColor(64, 64, 64, 255);
}
}
else
{
draw.frameCol = QColor(0, 0, 0, 0);
}
m_drawList.append(draw);
}
else
{
drawFrameData(d, mat);
if (m_pSetting->getDrawFrame() && !m_pEditData->isExportPNG())
{
QColor col;
ObjectItem *p = m_pEditData->getObjectModel()->getItemFromIndex(m_pEditData->getSelIndex());
if (pLayerItem == p)
{
if (m_bPressCtrl)
{
col = QColor(0, 255, 0, 255);
}
else
{
col = QColor(255, 0, 0, 255);
}
}
else
{
col = QColor(64, 64, 64, 255);
}
drawFrame(d, mat, col);
}
}
}
}
QList<ObjectItem *> children;
for (int i = 0; i < pLayerItem->childCount(); i++)
{
ObjectItem *pChild = pLayerItem->child(i);
bool valid;
QMatrix4x4 m = pChild->getDisplayMatrix(selFrame, &valid);
if (!valid)
{
children.append(pChild);
continue;
}
int j;
for (j = 0; j < children.size(); j++)
{
QMatrix4x4 m1 = children[j]->getDisplayMatrix(selFrame, &valid);
if (!valid)
{
continue;
}
if (m.column(3).z() < m1.column(3).z())
{
children.insert(j, pChild);
break;
}
}
if (j == children.size())
//.........这里部分代码省略.........