本文整理汇总了C++中Matrix4f类的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4f类的具体用法?C++ Matrix4f怎么用?C++ Matrix4f使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Matrix4f类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRotationAndEyePositionFromModelView
void getRotationAndEyePositionFromModelView( const Matrix4f& modelViewMatrix,
Matrix3f& rotationMatrix,
Vector3f& eye )
{
Matrix4f iMv;
modelViewMatrix.inverse( iMv );
iMv.get_sub_matrix( rotationMatrix, 0, 0 );
iMv.get_translation( eye );
}
示例2: GetView
Matrix4f Camera::GetView() const
{
Matrix4f cameraRotation = m_transform.GetTransformedRot().Conjugate().ToRotationMatrix();
Matrix4f cameraTranslation;
cameraTranslation.InitTranslation(m_transform.GetTransformedPos() * -1);
return cameraRotation * cameraTranslation;
}
示例3: getModelViewMatrix
Matrix4f CameraSettings::getModelViewMatrix() const
{
Matrix4f modelView;
modelView = modelRotation_;
modelView.set_translation( cameraPosition_ );
modelView = cameraRotation_ * modelView;
return modelView;
}
示例4: onCamera
// Generic camera (from REST) in meters
void onCamera( const ::zeq::Event& event )
{
const auto& matrix = ::zeq::hbp::deserializeCamera( event );
Matrix4f modelViewMatrix;
modelViewMatrix.set( matrix.begin(), matrix.end(), false );
auto cameraSettings = _config.getFrameData().getCameraSettings();
cameraSettings->setModelViewMatrix( modelViewMatrix );
_config.postRedraw();
}
示例5: DSDirectionalLightPass
void DSDirectionalLightPass()
{
m_DSDirLightPassTech.Enable();
m_DSDirLightPassTech.SetEyeWorldPos(m_pGameCamera->GetPos());
Matrix4f WVP;
WVP.InitIdentity();
m_DSDirLightPassTech.SetWVP(WVP);
m_quad.Render();
}
示例6:
const Matrix4f Camera::GetMatrix()
{
Matrix4f p = Matrix4f::Translation(pos);
Matrix4f r = Matrix4f::RotationXYZ(angles);
if(order == ORDER_TRANS_ROT)
return r.Mul(p);
return p.Mul(r);
}
示例7: Matrix4f
Matrix4f Matrix4f::Translate(Vector3f vector)
{
Matrix4f translatedMatrix = Matrix4f().InitializeIdentity();
translatedMatrix.Set(3,0,vector.GetX());
translatedMatrix.Set(3,1,vector.GetY());
translatedMatrix.Set(3,2,vector.GetZ());
return ((*this) * translatedMatrix);
}
示例8: zero
static Matrix4f zero(void)
{
Matrix4f zeroMatrix;
for(int x = 0; x < 4; x++)
for(int y = 0; y < 4; y++)
zeroMatrix.setValue(x, y, 0.0f);
return zeroMatrix;
}
示例9: computeModelViewMatrix
Matrix4f computeModelViewMatrix( const Matrix3f& rotationMatrix, const Vector3f& eye )
{
Matrix4f rotationTranspose = Matrix4f::IDENTITY;
rotationTranspose.set_sub_matrix( rotationMatrix, 0, 0 );
rotationTranspose = transpose( rotationTranspose );
Matrix4f modelViewMatrix = Matrix4f::IDENTITY;
modelViewMatrix.set_translation( -eye );
return rotationTranspose * modelViewMatrix;
}
示例10:
const Matrix4f& Pipeline::GetWPTrans()
{
Matrix4f PersProjTrans;
GetWorldTrans();
PersProjTrans.InitPersProjTransform(m_persProjInfo);
m_WPtransformation = PersProjTrans * m_Wtransformation;
return m_WPtransformation;
}
示例11: render
void LightNode::render()
{
//printf("%s%s\n" , "Rendering " , getName() );
//TO DO---> View matrix and World Matrix can be stored, and send to the Renderer directly
Matrix4f& viewMat = sceneManager->getActiveCamera()->getViewMatrix();
Matrix4f temp;
temp.multiply(globalTransform);
sceneManager->getRenderer()->setTransform(temp , WORLD);
sceneManager->getRenderer()->addLight(lightData);
}
示例12: dragp
bool Render::on_motion_notify_event(GdkEventMotion* event)
{
bool redraw=true;
Vector2f dragp(event->x, event->y);
Vector2f delta = m_downPoint - dragp;
double factor = 0.3;
Vector3d delta3f(-delta.x*factor, delta.y*factor, 0);
get_model()->setMeasuresPoint(Vector2d((10.+event->x)/(get_width()-20),
(10.+get_height()-event->y)/(get_height()-20)));
if (event->state & GDK_BUTTON1_MASK) { // move or rotate
if (event->state & GDK_SHIFT_MASK) { // move object
if (false);//delta3f.x<1 && delta3f.y<1) redraw=false;
else {
Shape *shape;
TreeObject *object;
if (!m_view->get_selected_stl(object, shape))
return true;
if (!object && !shape)
return true;
Transform3D *transf;
if (!shape)
transf = &object->transform3D;
else
transf = &shape->transform3D;
transf->move(delta3f);
m_downPoint = dragp;
//m_view->get_model()->CalcBoundingBoxAndCenter();
}
}
else { // rotate
m_arcBall->dragAccumulate(event->x, event->y, &m_transform);
}
if (redraw) queue_draw();
return true;
}
else {
if (event->state & GDK_BUTTON2_MASK) { // zoom
double factor = 1.0 + 0.01 * (delta.x - delta.y);
m_zoom *= factor;
}
else if (event->state & GDK_BUTTON3_MASK) { // pan
Matrix4f matrix;
memcpy(&matrix.m00, &m_transform.M[0], sizeof(Matrix4f));
Vector3f m_transl = matrix.getTranslation();
m_transl += delta3f;
matrix.setTranslation(m_transl);
memcpy(&m_transform.M[0], &matrix.m00, sizeof(Matrix4f));
}
m_downPoint = dragp;
if (redraw) queue_draw();
return true;
}
return Gtk::DrawingArea::on_motion_notify_event (event);
}
示例13: getTransformation
Matrix4f Transform::getProjectedTransformation() {
Matrix4f transMat = getTransformation();
Matrix4f proMat = Matrix4f();
proMat.initProjection(Transform::fov,
Transform::width,
Transform::height,
Transform::zNear,
Transform::zFar );
return proMat*transMat;
}
示例14: TestMatrixInverse
void TestMatrixInverse()
{
Vector3f rot( .6f, 1.2f, 1.8f );
Matrix4f m;
m.SetRotation( rot );
Matrix4f n = m.OrthonormalInverse();
std::cout << "Original matrix" << std::endl << m;
std::cout << "Inverse" << std::endl << n;
std::cout << "Product" << std::endl << n * m;
}
示例15: GetWorldTrans
const Matrix4f& Pipeline::GetWVOrthoPTrans()
{
GetWorldTrans();
GetViewTrans();
Matrix4f P;
P.InitOrthoProjTransform(m_orthoProjInfo);
m_WVPtransformation = P * m_Vtransformation * m_Wtransformation;
return m_WVPtransformation;
}