• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Matrix4f函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Matrix4f函数的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4f函数的具体用法?C++ Matrix4f怎么用?C++ Matrix4f使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Matrix4f函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: h3dSetNodeFlags

void SceneGraphComponent::setSerializedState(GameState& state)
{
	int nodeFlags;
	if (state.readInt32(&nodeFlags))
		return;

	if (m_hordeID > 0) {
		h3dSetNodeFlags(m_hordeID, nodeFlags, true );
	}

	float read_transformation[16];
	for (int i = 0; i < 16; i++) {
		if (state.readFloat(&read_transformation[i]))
			return;
	}
	setTransformation(read_transformation);

	// set last transformation (i. e. one frame ago)
	for (int i = 0; i < 16; i++) {
		if (state.readFloat(&read_transformation[i]))
			return;
	}
	memcpy(m_net_lasttransformation, read_transformation, sizeof(float) * 16);

	// calculate trajectory
	Vec3f t, r, s, lt, lr, ls;

	Matrix4f(m_transformation).decompose(t, r, s);
	Matrix4f(m_net_lasttransformation).decompose(lt, lr, ls);

	if ((s != ls) || (r != lr) || (t != lt))
	{
		if ((t - lt).length() > m_net_maxTrajection) {
			m_net_traject_translation.x = 0;
			m_net_traject_translation.y = 0;
			m_net_traject_translation.z = 0;
			m_net_traject_rotation.x = 0;
			m_net_traject_rotation.y = 0;
			m_net_traject_rotation.z = 0;
			m_net_traject_scale.x = 0;
			m_net_traject_scale.y = 0;
			m_net_traject_scale.z = 0;
		} else {
			m_net_traject_translation = t - lt;
			m_net_traject_rotation = r - lr;
			m_net_traject_scale = s - ls;
		}
		m_net_applyTrajection = true;
	} else
		m_net_applyTrajection = false;

	float remotefps;

	if (state.readFloat(&remotefps))	// to be able to traject accordingly to remote speed (reduces entity "jumping")
		return;

	m_net_traject_speedup = remotefps / GameEngine::FPS();

	//printf("speedup = %f\n", m_net_traject_speedup);
}
开发者ID:CZdravko,项目名称:Horde,代码行数:60,代码来源:SceneGraphComponent.cpp


示例2: trans

void SceneGraphComponent::traject()
{
	// apply trajections
	if (m_net_applyTrajection) {

		// apply translation
		m_transformation[12] += m_net_traject_translation.x * m_net_traject_speedup;
		m_transformation[13] += m_net_traject_translation.y * m_net_traject_speedup;
		m_transformation[14] += m_net_traject_translation.z * m_net_traject_speedup;

		// apply rotation
		Matrix4f trans( Matrix4f(m_transformation) * 
			Matrix4f(Quaternion(
				m_net_traject_rotation.x * m_net_traject_speedup,
				m_net_traject_rotation.y * m_net_traject_speedup,
				m_net_traject_rotation.z * m_net_traject_speedup
			)) );
		memcpy( m_transformation, trans.x, sizeof( float ) * 16 );

		// TODO: apply scale

		sendTransformation();

		GameEvent event(GameEvent::E_SET_TRANSFORMATION, GameEventData(m_transformation, 16), this);
		m_owner->executeEvent(&event);
	}
}
开发者ID:CZdravko,项目名称:Horde,代码行数:27,代码来源:SceneGraphComponent.cpp


示例3: Matrix4f

void SceneGraphComponent::setScale(const Vec3f *scale)
{
	/*Vec3f tr,rotation,sc;
	Matrix4f(m_transformation).decompose(tr,rotation,sc);	
	
	Matrix4f trans = Matrix4f::ScaleMat( scale->x, scale->y, scale->z );
	trans = trans * Matrix4f(Quaternion(rotation.x, rotation.y, rotation.z));
	trans.translate(m_transformation[12], m_transformation[13], m_transformation[14]);
	
	GameEvent event(GameEvent::E_SET_TRANSFORMATION, GameEventData(trans.x, 16), 0);*/

	Vec3f tr,rotation,sc;
	Matrix4f(m_transformation).decompose(tr,rotation,sc);	
	
	Matrix4f trans = Matrix4f::ScaleMat( scale->x, scale->y, scale->z );
	trans = trans * Matrix4f(Quaternion(rotation.x, rotation.y, rotation.z));
	trans.translate(tr.x, tr.y, tr.z);
	
	GameEvent event(GameEvent::E_SET_TRANSFORMATION, GameEventData(trans.x, 16), this);
	if (m_owner->checkEvent(&event))
	{
		// Apply the new transformation
		memcpy( m_transformation, trans.x, sizeof( float ) * 16 );
		// Send it to horde
		sendTransformation();
		//and to the other components
		m_owner->executeEvent(&event);
	}
}
开发者ID:CZdravko,项目名称:Horde,代码行数:29,代码来源:SceneGraphComponent.cpp


示例4: Matrix4f

Matrix4f Node::getGlobalTransform(bool with_scale) const
{
    Matrix4f ret;

    Matrix4f self_mat;

    if(with_scale) {
        const Transformf* trans = static_cast<const Transformf*>(this);
        self_mat = Matrix4f(*trans);
    } else {
        self_mat = Matrix4f(rotation,position);
    }

    if(parent() != 0)
    {
        if(parent()->type() == ParentOfNode::NODE)
        {
            const Node* parentNode = static_cast<const Node*>(parent());
            ret = parentNode->getGlobalTransform(with_scale) * self_mat;
        }
        else
        {
            ret = self_mat;
        }
    }
    else
    {
        logWarn("trying to access globalTransform on unlinked node");
    }
    return ret;
}
开发者ID:smatcher,项目名称:S5old,代码行数:31,代码来源:node.cpp


示例5: test_eigensolver_generic

void test_eigensolver_generic()
{
  int s = 0;
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( eigensolver(Matrix4f()) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) );
    TEST_SET_BUT_UNUSED_VARIABLE(s)

    // some trivial but implementation-wise tricky cases
    CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
    CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
    CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
    CALL_SUBTEST_4( eigensolver(Matrix2d()) );
  }

  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) );
  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) );
  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) );
  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) );

  // Test problem size constructors
  CALL_SUBTEST_5(EigenSolver<MatrixXf> tmp(s));

  // regression test for bug 410
  CALL_SUBTEST_2(
  {
     MatrixXd A(1,1);
     A(0,0) = std::sqrt(-1.); // is Not-a-Number
     Eigen::EigenSolver<MatrixXd> solver(A);
     VERIFY_IS_EQUAL(solver.info(), NumericalIssue);
  }
  );
开发者ID:Aerobota,项目名称:eigen,代码行数:34,代码来源:eigensolver_generic.cpp


示例6: test_eigensolver_generic

void test_eigensolver_generic()
{
  int s = 0;
  for(int i = 0; i < g_repeat; i++) {
    CALL_SUBTEST_1( eigensolver(Matrix4f()) );
    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
    CALL_SUBTEST_2( eigensolver(MatrixXd(s,s)) );

    // some trivial but implementation-wise tricky cases
    CALL_SUBTEST_2( eigensolver(MatrixXd(1,1)) );
    CALL_SUBTEST_2( eigensolver(MatrixXd(2,2)) );
    CALL_SUBTEST_3( eigensolver(Matrix<double,1,1>()) );
    CALL_SUBTEST_4( eigensolver(Matrix2d()) );
  }

  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) );
  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);
  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) );
  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) );
  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) );

  // Test problem size constructors
  CALL_SUBTEST_5(EigenSolver<MatrixXf> tmp(s));

  // regression test for bug 410
  CALL_SUBTEST_2(
  {
     MatrixXd A(1,1);
     A(0,0) = std::sqrt(-1.);
     Eigen::EigenSolver<MatrixXd> solver(A);
     MatrixXd V(1, 1);
     V(0,0) = solver.eigenvectors()(0,0).real();
  }
  );
开发者ID:b3sigma,项目名称:eigen,代码行数:34,代码来源:eigensolver_generic.cpp


示例7: CalculateCameraTimeWarpMatrix

Matrix4f CalculateCameraTimeWarpMatrix( const Quatf &from, const Quatf &to )
{
    Matrix4f		lastSensorMatrix = Matrix4f( to ).Transposed();
    Matrix4f		lastViewMatrix = Matrix4f( from ).Transposed();
	Matrix4f		timeWarp = ( lastSensorMatrix * lastViewMatrix.Inverted() );

	return timeWarp;
}
开发者ID:1107979819,项目名称:OculusVRStudy,代码行数:8,代码来源:AppRender.cpp


示例8: D3DCOLOR_RGBA

void DistortionRenderer::RenderBothDistortionMeshes(void)
{
	Device->BeginScene();

	D3DCOLOR clearColor = D3DCOLOR_RGBA(
		(int)(RState.ClearColor[0] * 255.0f),
		(int)(RState.ClearColor[1] * 255.0f),
		(int)(RState.ClearColor[2] * 255.0f),
		(int)(RState.ClearColor[3] * 255.0f));

	Device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_STENCIL | D3DCLEAR_ZBUFFER, clearColor, 0, 0);

	for (int eye=0; eye<2; eye++)
	{
		FOR_EACH_EYE * e = &eachEye[eye];
		D3DVIEWPORT9 vp;
        vp.X=0; vp.Y=0;
        vp.Width=ScreenSize.w;	vp.Height=ScreenSize.h;
        vp.MinZ=0; vp.MaxZ = 1;

		Device->SetViewport(&vp);
		Device->SetStreamSource( 0, e->dxVerts,0, sizeof(ovrDistortionVertex) );
		Device->SetVertexDeclaration( VertexDecl ); 
		Device->SetIndices( e->dxIndices );
		Device->SetPixelShader( PixelShader );
		Device->SetTexture( 0, e->texture);

		//Choose which vertex shader, with associated additional inputs
		if (RState.DistortionCaps & ovrDistortionCap_TimeWarp)
		{          
			Device->SetVertexShader( VertexShaderTimewarp );  

            ovrMatrix4f timeWarpMatrices[2];            
            ovrHmd_GetEyeTimewarpMatrices(HMD, (ovrEyeType)eye,
                                          RState.EyeRenderPoses[eye], timeWarpMatrices);

			//Need to transpose the matrices
			timeWarpMatrices[0] = Matrix4f(timeWarpMatrices[0]).Transposed();
			timeWarpMatrices[1] = Matrix4f(timeWarpMatrices[1]).Transposed();

            // Feed identity like matrices in until we get proper timewarp calculation going on
			Device->SetVertexShaderConstantF(4, (float *) &timeWarpMatrices[0],4);
			Device->SetVertexShaderConstantF(20,(float *) &timeWarpMatrices[1],4);
        }
		else
		{
			Device->SetVertexShader( VertexShader );  
		}

		//Set up vertex shader constants
		Device->SetVertexShaderConstantF( 0, ( FLOAT* )&(e->UVScaleOffset[0]), 1 );
		Device->SetVertexShaderConstantF( 2, ( FLOAT* )&(e->UVScaleOffset[1]), 1 );

		Device->DrawIndexedPrimitive( D3DPT_TRIANGLELIST,0,0,e->numVerts,0,e->numIndices/3);
	}

	Device->EndScene();
}
开发者ID:ArthurTorrente,项目名称:4A_Anim_Numerique_Genetic_Algorithm,代码行数:58,代码来源:CAPI_D3D9_Util.cpp


示例9: Matrix4f

	void Camera::computeViewMatrix( void)
	{
		Matrix4f rotMatrix;
		rotMatrix *= Matrix4f().RotateX(m_pitchInDegrees);
		rotMatrix *= Matrix4f().RotateY(m_yawInDegrees);
		rotMatrix *= Matrix4f().RotateZ(m_rollInDegrees);
	
		LookAt(m_position.XYZ, (m_position + rotMatrix.GetXYZRow(2)).XYZ, rotMatrix.GetXYZRow(1).XYZ);
	}
开发者ID:JJoosten,项目名称:IndyFramework,代码行数:9,代码来源:Camera.cpp


示例10: getTransformation

Matrix4f RenderingEngine::getProjectedTransformation(Transform transform)
{
    Matrix4f transformationMatrix = getTransformation(transform);
    Matrix4f projectionMatrix = (*Matrix4f().initProjection((float)FOV, (float)m_iWidth, (float)m_iHeight, (float)zNear, (float)zFar));
	Matrix4f cameraRotation = Camera::mainCamera->transform.rotation.toRotationMatrix();
	Matrix4f cameraTranslation = (*Matrix4f().initTranslation(-Camera::mainCamera->transform.position.x, -Camera::mainCamera->transform.position.y, -Camera::mainCamera->transform.position.z));

    return projectionMatrix * cameraRotation * cameraTranslation * transformationMatrix;
}
开发者ID:Spirrwell,项目名称:AMEngine,代码行数:9,代码来源:renderingengine.cpp


示例11: m_plane

RenderingEngine::RenderingEngine(const Window& window) :
	m_plane(Mesh("plane.obj")),
	m_window(&window),
	m_tempTarget(window.GetWidth(), window.GetHeight(), 0, GL_TEXTURE_2D, GL_NEAREST, GL_RGBA, GL_RGBA, false, GL_COLOR_ATTACHMENT0),
	m_planeMaterial("renderingEngine_filterPlane", m_tempTarget, 1, 8),
	m_defaultShader("forward-ambient"),
	m_shadowMapShader("shadowMapGenerator"),
	m_nullFilter("filter-null"),
	m_gausBlurFilter("filter-gausBlur7x1"),
	m_fxaaFilter("filter-fxaa"),
	m_altCameraTransform(Vector3f(0,0,0), Quaternion(Vector3f(0,1,0),ToRadians(180.0f))),
	m_altCamera(Matrix4f().InitIdentity(), &m_altCameraTransform)
{
	SetSamplerSlot("diffuse",   0);
	SetSamplerSlot("normalMap", 1);
	SetSamplerSlot("dispMap",   2);
	SetSamplerSlot("shadowMap", 3);
	SetSamplerSlot("roughMap",	4);
	
	SetSamplerSlot("filterTexture", 0);
	
	SetVector3f("ambient", Vector3f(0.2f, 0.2f, 0.2f));
	
	SetFloat("fxaaSpanMax", 8.0f);
	SetFloat("fxaaReduceMin", 1.0f/128.0f);
	SetFloat("fxaaReduceMul", 1.0f/8.0f);
	SetFloat("fxaaAspectDistortion", 150.0f);

	SetTexture("displayTexture", Texture(m_window->GetWidth(), m_window->GetHeight(), 0, GL_TEXTURE_2D, GL_LINEAR, GL_RGBA, GL_RGBA, true, GL_COLOR_ATTACHMENT0));

	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	glFrontFace(GL_CW);
	glCullFace(GL_BACK);
	glEnable(GL_CULL_FACE);
	glEnable(GL_DEPTH_TEST);
	//glEnable(GL_DEPTH_CLAMP);
	//glEnable(GL_MULTISAMPLE);
	//glEnable(GL_FRAMEBUFFER_SRGB);
	                  
	//m_planeMaterial("renderingEngine_filterPlane", m_tempTarget, 1, 8);
	m_planeTransform.SetScale(1.0f);
	m_planeTransform.Rotate(Quaternion(Vector3f(1,0,0), ToRadians(90.0f)));
	m_planeTransform.Rotate(Quaternion(Vector3f(0,0,1), ToRadians(180.0f)));
	
	for(int i = 0; i < NUM_SHADOW_MAPS; i++)
	{
		int shadowMapSize = 1 << (i + 1);
		m_shadowMaps[i] = Texture(shadowMapSize, shadowMapSize, 0, GL_TEXTURE_2D, GL_LINEAR, GL_RG32F, GL_RGBA, true, GL_COLOR_ATTACHMENT0);
		m_shadowMapTempTargets[i] = Texture(shadowMapSize, shadowMapSize, 0, GL_TEXTURE_2D, GL_LINEAR, GL_RG32F, GL_RGBA, true, GL_COLOR_ATTACHMENT0);
	}
	
	m_lightMatrix = Matrix4f().InitScale(Vector3f(0,0,0));	
}
开发者ID:ClockTeam,项目名称:ClockworkEngine,代码行数:54,代码来源:renderingEngine.cpp


示例12: test_matrix_power

void test_matrix_power()
{
  CALL_SUBTEST_2(test2dRotation<double>(1e-13));
  CALL_SUBTEST_1(test2dRotation<float>(2e-5));  // was 1e-5, relaxed for clang 2.8 / linux / x86-64
  CALL_SUBTEST_9(test2dRotation<long double>(1e-13)); 
  CALL_SUBTEST_2(test2dHyperbolicRotation<double>(1e-14));
  CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5));
  CALL_SUBTEST_9(test2dHyperbolicRotation<long double>(1e-14));

  CALL_SUBTEST_10(test3dRotation<double>(1e-13));
  CALL_SUBTEST_11(test3dRotation<float>(1e-5));
  CALL_SUBTEST_12(test3dRotation<long double>(1e-13));

  CALL_SUBTEST_2(testGeneral(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testGeneral(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testGeneral(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testGeneral(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testGeneral(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testGeneral(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testGeneral(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testGeneral(MatrixXf(2,2),      1e-3)); // see bug 614
  CALL_SUBTEST_9(testGeneral(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testGeneral(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testGeneral(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testGeneral(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testSingular(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testSingular(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testSingular(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testSingular(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testSingular(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testSingular(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testSingular(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testSingular(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testSingular(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testSingular(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testSingular(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testSingular(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testLogThenExp(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testLogThenExp(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testLogThenExp(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testLogThenExp(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testLogThenExp(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testLogThenExp(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testLogThenExp(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testLogThenExp(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testLogThenExp(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testLogThenExp(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testLogThenExp(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testLogThenExp(Matrix3e(),        1e-13));
}
开发者ID:EVERTims,项目名称:auralization_engine_evertims,代码行数:52,代码来源:matrix_power.cpp


示例13: Matrix4f

/* Handles mouse motion events. */
void UI::handleMouseMotion(int x, int y) {
    UI *ui = UI::getSingleton();

    // If the left button is being clicked, and the mouse has moved, and the
    // mouse is in the window, then update the arcball UI
    if (ui->mouse_down && (x != ui->mouse_x || y != ui->mouse_y) &&
        (x >= 0 && x < ui->xres && y >= 0 && y < ui->yres))
    {
        // Set up some matrices we need
        Matrix4f camera_to_ndc = Matrix4f();
        Matrix4f world_to_camera = Matrix4f();
        glGetFloatv(GL_PROJECTION_MATRIX, camera_to_ndc.data());
        glGetFloatv(GL_MODELVIEW_MATRIX, world_to_camera.data());
        Matrix3f ndc_to_world = camera_to_ndc.topLeftCorner(3, 3).inverse();

        // Get the two arcball vectors by transforming from NDC to camera
        // coordinates, ignoring translation components
        Vector3f va =
            (ndc_to_world * ui->getArcballVector(ui->mouse_x, ui->mouse_y)).normalized();
        Vector3f vb = (ndc_to_world * ui->getArcballVector(x, y)).normalized();
        
        // Compute the angle between them and the axis to rotate around
        // (this time rotated into world space, where the matrix is applied)
        Vector3f arcball_axis =
            (world_to_camera.topLeftCorner(3, 3).transpose() * va.cross(vb)).normalized();
        float arcball_angle = acos(fmax(fmin(va.dot(vb), 1.0), -1.0));

        // Update current arcball rotation and overall object rotation matrices
        makeRotateMat(ui->arcball_rotate_mat.data(), arcball_axis[0],
            arcball_axis[1], arcball_axis[2], arcball_angle);
        ui->arcball_object_mat =
            ui->arcball_rotate_mat * ui->arcball_object_mat;
        
        // If the arcball should rotate the entire scene, update the light
        // rotation matrix too 
        if (ui->arcball_scene) {
            ui->arcball_light_mat =
                ui->arcball_rotate_mat * ui->arcball_light_mat;
        }
        
        // Update the arcball start position
        ui->mouse_x = x;
        ui->mouse_y = y;
        
        // Update the image
        glutPostRedisplay();
    }
}
开发者ID:jjoo172,项目名称:CS171,代码行数:49,代码来源:UI.cpp


示例14: assert

void RenderingEngine::ApplyFilter(const Shader& filter, const Texture& source, const Texture* dest)
{
	assert(&source != dest);
	if(dest == 0)
	{
		m_window->BindAsRenderTarget();
	}
	else
	{
		dest->BindAsRenderTarget();
	}
	
	SetTexture("filterTexture", source);
	
	m_altCamera.SetProjection(Matrix4f().InitIdentity());
	m_altCamera.GetTransform()->SetPos(Vector3f(0,0,0));
	m_altCamera.GetTransform()->SetRot(Quaternion(Vector3f(0,1,0),ToRadians(180.0f)));
	
//	const Camera* temp = m_mainCamera;
//	m_mainCamera = m_altCamera;

	glClear(GL_DEPTH_BUFFER_BIT);
	filter.Bind();
	filter.UpdateUniforms(m_planeTransform, m_planeMaterial, *this, m_altCamera);
	m_plane.Draw();
	
//	m_mainCamera = temp;
	SetTexture("filterTexture", 0);
}
开发者ID:ClockTeam,项目名称:ClockworkEngine,代码行数:29,代码来源:renderingEngine.cpp


示例15: Matrix4f

Scale::Scale(float x, float y, float z){
	mat = Matrix4f();
	mat(0, 0) = x;
	mat(1, 1) = y;
	mat(2, 2) = z;
	mat(3, 3) = 1;
}
开发者ID:akrolsmir,项目名称:Raytracer,代码行数:7,代码来源:transform.cpp


示例16: RecalcRotationMatrix

/// Recalculates the transformation matrix. All parts by default. If recursively, will update children (or parents?) recursively upon update.
void Entity::RecalculateMatrix(int whichParts/*= true*/, bool recursively /* = false*/)
{
	if (whichParts > TRANSLATION_ONLY || hasRotated)
	{
		if (whichParts == ALL_PARTS || hasRotated)
		{
			RecalcRotationMatrix(true);
		}
		localTransform = Matrix4f();
#ifdef USE_SSE
		// Translation should be just pasting in position.. no?
		localTransform.col3.data = localPosition.data;
		localTransform.col3.w = 1;
#else
		localTransform.Multiply((Matrix4f::Translation(position)));
#endif
		localTransform.Multiply(localRotation);
		// No use multiplying if not new scale.
		if (hasRescaled || whichParts)
			UPDATE_SCALING_MATRIX
		if (relevantScale)
			localTransform.Multiply(scalingMatrix);
			// Ensure it has a scale..?
	//	assert(transformationMatrix.HasValidScale());
	}
	// No rotation? -> 
	else 
	{
开发者ID:erenik,项目名称:engine,代码行数:29,代码来源:Entity.cpp


示例17: testInversion

	void testInversion()
	{
		float data1[] =
		{
			1,2,3,4,
			2,3,4,1,
			3,4,1,2,
			4,1,2,3
		};

		float data2[] =
		{
			-9,  1,  1, 11,
			 1,  1, 11, -9,
			 1, 11, -9,  1,
			11, -9,  1,  1
		};

		mi1 = Matrix4f(data1);
		mi2 = mi1.inverse();
		Matrix4f imr(data2);
		imr = imr * 1/40.0f;

		/*
		std::cout << "mi1 = \n" << mi1 << std::endl;
		std::cout << "mi2 = \n" << mi2 << std::endl;
		std::cout << "imr = \n" << imr << std::endl;
		*/
		CPPUNIT_ASSERT(mi2 == imr);

	}
开发者ID:Whitestar,项目名称:vmath,代码行数:31,代码来源:test3.cpp


示例18: Matrix4f

	Matrix4f Transform::getTransformation() {
		Matrix4f transMat = Matrix4f();
		transMat.initTranslation(translation.getX(),
					 translation.getY(),
					 translation.getZ() );
		Matrix4f rotMat = Matrix4f();
		rotMat.initRotation(rotation.getX(),
				    rotation.getY(),
				    rotation.getZ() );
		Matrix4f scaleMat = Matrix4f();
		scaleMat.initScale(scale.getX(),
				   scale.getY(),
				   scale.getZ() );

		return (transMat * (rotMat * scaleMat));
	}
开发者ID:JoshuaBrockschmidt,项目名称:doit_engine,代码行数:16,代码来源:transform.cpp


示例19: GetScene

Matrix4f MeganekkoActivity::Frame( const VrFrame & vrFrame )
{
    Scene * scene = GetScene();
    JNIEnv * jni = app->GetJava()->Env;

    jni->CallVoidMethod(app->GetJava()->ActivityObject, frameMethodId, (jlong)(intptr_t)&vrFrame);

    const bool headsetIsMounted = vrFrame.DeviceStatus.HeadsetIsMounted;
    if (!HmdMounted && headsetIsMounted) {
        jni->CallVoidMethod(app->GetJava()->ActivityObject, onHmdMountedMethodId);
    } else if (HmdMounted && !headsetIsMounted) {
        jni->CallVoidMethod(app->GetJava()->ActivityObject, onHmdUnmountedMethodId);
    }
    HmdMounted = headsetIsMounted;

    // Apply Camera movement to centerViewMatrix
    ovrMatrix4f input = vrFrame.DeviceStatus.DeviceIsDocked
            ? Matrix4f::Translation(scene->GetViewPosition())
            : Matrix4f::Translation(scene->GetViewPosition()) * Matrix4f(internalSensorRotation);
    Matrix4f centerViewMatrix = vrapi_GetCenterEyeViewMatrix( &app->GetHeadModelParms(), &vrFrame.Tracking, &input );

    scene->SetCenterViewMatrix(centerViewMatrix);

    // Update GUI systems last, but before rendering anything.
    GuiSys->Frame( vrFrame, centerViewMatrix);

    gl_delete.processQueues();
    scene->PrepareForRendering();


    return centerViewMatrix;
}
开发者ID:3660628,项目名称:Meganekko,代码行数:32,代码来源:MeganekkoActivity.cpp


示例20: test_stdvector_overload

void test_stdvector_overload()
{
  // some non vectorizable fixed sizes
  CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));
  CALL_SUBTEST_2(check_stdvector_matrix(Matrix3d()));

  // some vectorizable fixed sizes
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix2f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));
  CALL_SUBTEST_1(check_stdvector_matrix(Matrix4f()));
  CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));

  // some dynamic sizes
  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));
  CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));
  CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));
  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));

  // some Transform
  CALL_SUBTEST_4(check_stdvector_transform(Affine2f())); // does not need the specialization (2+1)^2 = 9
  CALL_SUBTEST_4(check_stdvector_transform(Affine3f()));
  CALL_SUBTEST_4(check_stdvector_transform(Affine3d()));

  // some Quaternion
  CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));
  CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));
}
开发者ID:13221325403,项目名称:openbr,代码行数:28,代码来源:stdvector_overload.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MatrixMultiply函数代码示例发布时间:2022-05-30
下一篇:
C++ Matrix4d函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap