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


C++ Matrix4f类代码示例

本文整理汇总了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 );
}
开发者ID:guozanhua,项目名称:Livre,代码行数:9,代码来源:maths.cpp

示例2: GetView

Matrix4f Camera::GetView() const
{
	Matrix4f cameraRotation = m_transform.GetTransformedRot().Conjugate().ToRotationMatrix();
	Matrix4f cameraTranslation;

	cameraTranslation.InitTranslation(m_transform.GetTransformedPos() * -1);

	return cameraRotation * cameraTranslation;
}
开发者ID:TheSkyCrasher,项目名称:ENOJ2,代码行数:9,代码来源:camera.cpp

示例3: getModelViewMatrix

Matrix4f CameraSettings::getModelViewMatrix() const
{
    Matrix4f modelView;
    modelView = modelRotation_;
    modelView.set_translation( cameraPosition_ );
    modelView = cameraRotation_ * modelView;

    return modelView;
}
开发者ID:hernando,项目名称:Livre,代码行数:9,代码来源:CameraSettings.cpp

示例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();
 }
开发者ID:VMML,项目名称:Livre,代码行数:10,代码来源:communicator.cpp

示例5: DSDirectionalLightPass

	void DSDirectionalLightPass()    
    {		
        m_DSDirLightPassTech.Enable();
        m_DSDirLightPassTech.SetEyeWorldPos(m_pGameCamera->GetPos());
        Matrix4f WVP;
        WVP.InitIdentity();        
        m_DSDirLightPassTech.SetWVP(WVP);
        m_quad.Render();  
	}
开发者ID:LSilent,项目名称:OpenGL_Step_By_Step_Source,代码行数:9,代码来源:tutorial36.cpp

示例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);
}
开发者ID:UIKit0,项目名称:renderdoc,代码行数:10,代码来源:camera.cpp

示例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);
}
开发者ID:toshko3331,项目名称:TPEngine,代码行数:10,代码来源:Matrix4f.cpp

示例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;
}
开发者ID:domme,项目名称:CG-Transformations,代码行数:10,代码来源:Matrix.cpp

示例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;
}
开发者ID:guozanhua,项目名称:Livre,代码行数:10,代码来源:maths.cpp

示例10:

const Matrix4f& Pipeline::GetWPTrans()
{
	Matrix4f PersProjTrans;

	GetWorldTrans();
	PersProjTrans.InitPersProjTransform(m_persProjInfo);

	m_WPtransformation = PersProjTrans * m_Wtransformation;
	return m_WPtransformation;
}
开发者ID:FNickRU,项目名称:OGL_project,代码行数:10,代码来源:pipeline.cpp

示例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);
		}
开发者ID:spidersharma03,项目名称:spider3d,代码行数:10,代码来源:LightNode.cpp

示例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);
}
开发者ID:atoun,项目名称:repsnapper,代码行数:54,代码来源:render.cpp

示例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;
	}
开发者ID:JoshuaBrockschmidt,项目名称:doit_engine,代码行数:11,代码来源:transform.cpp

示例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;
}
开发者ID:dfannius,项目名称:gltest,代码行数:11,代码来源:MathTest.cpp

示例15: GetWorldTrans

const Matrix4f& Pipeline::GetWVOrthoPTrans()
{
    GetWorldTrans();
    GetViewTrans();

    Matrix4f P;
    P.InitOrthoProjTransform(m_orthoProjInfo);
    
    m_WVPtransformation = P * m_Vtransformation * m_Wtransformation;
    return m_WVPtransformation;
}
开发者ID:FNickRU,项目名称:OGL_project,代码行数:11,代码来源:pipeline.cpp


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