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


C++ D3DXMatrixRotationZ函数代码示例

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


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

示例1: D3DXMatrixIdentity

/**
* Updates the roll matrix, seems to be senseless right now, just calls D3DXMatrixRotationZ().
* @param roll Angle of rotation, in radians.
***/
void ViewAdjustment::UpdateRoll(float roll)
{
	D3DXMatrixIdentity(&rollMatrix);
	D3DXMatrixRotationZ(&rollMatrix, roll);
	D3DXMatrixRotationZ(&rollMatrixNegative, -roll);
	D3DXMatrixRotationZ(&rollMatrixHalf, roll * 0.5f);
}
开发者ID:DrBeef,项目名称:Perception,代码行数:11,代码来源:ViewAdjustment.cpp

示例2: D3DXMatrixRotationZ

D3DXMATRIX CParticle::GetRotateMatrix()
{
	D3DXMATRIX d3dRotX,d3dRotY,d3dRotZ;
	D3DXMatrixRotationZ(&d3dRotX,D3DXToRadian(m_d3dCurRotation[0]));
	D3DXMatrixRotationZ(&d3dRotY,D3DXToRadian(m_d3dCurRotation[1]));
	D3DXMatrixRotationZ(&d3dRotZ,D3DXToRadian(m_d3dCurRotation[2]));
	return d3dRotX*d3dRotY*d3dRotZ;
}
开发者ID:ianalcid08,项目名称:FinalProject,代码行数:8,代码来源:Particle.cpp

示例3: D3DXMatrixRotationZ

void Tree::LineRender(D3DXVECTOR3 start, D3DXVECTOR3 dir, int deep)
{
	Line line;
	line.Draw(start, start + dir);

	float d = 0.8;
	float angle = 30;	//変更

	D3DXMATRIX right, left;
	D3DXVECTOR3 vec;
	D3DXVECTOR3 vR, vL;

	//start = start + dir;

	vec = dir;
	D3DXMatrixRotationZ(&right, D3DXToRadian(-angle));
	D3DXVec3TransformCoord(&vec, &dir, &right);
	vec *= d;
	line.Draw(start + dir, start + dir + vec);
	vR = vec;

	vec = dir;
	D3DXMatrixRotationZ(&left, D3DXToRadian(angle));
	D3DXVec3TransformCoord(&vec, &dir, &left);
	vec *= d;
	line.Draw(start + dir, start + dir + vec);
	vL = vec;

	if (deep >= 1)
	{
		vec = vR;
		D3DXMatrixRotationZ(&right, D3DXToRadian(-angle));
		D3DXVec3TransformCoord(&vec, &vec, &right);
		vec *= d;
		LineRender(start + dir + vR, vec, deep - 1);

		vec = vL;
		D3DXMatrixRotationZ(&left, D3DXToRadian(angle));
		D3DXVec3TransformCoord(&vec, &vec, &left);
		vec *= d;
		LineRender(start + dir + vL, vec, deep - 1);
	}

	//start = start + vec;
	//Hello
	//メッセージ

}
开发者ID:140447ESASHISEIYA,项目名称:Test,代码行数:48,代码来源:Tree.cpp

示例4: int

void GegnerColumn::DoDraw(void)
{
    D3DXMATRIX	matWorld, matRot, matTrans, matTrans2;	// Rotations und Translations Matrizen
    int			Winkel;									// Rotationswinkel

    Winkel = int(AnimCount);

    // Winkel angleichen, damit er immer zwischen 0° und 360° bleibt
    //
    if (Winkel > 360) Winkel -= 360;
    if (Winkel < 0)	  Winkel += 360;
    D3DXMatrixRotationZ  (&matRot, DegreetoRad[Winkel]);

    D3DXMatrixTranslation(&matTrans, float (-(xPos-pTileEngine->XOffset+40)),float (-(yPos-pTileEngine->YOffset+100)), 0.0f);		// Transformation zum Ursprung
    D3DXMatrixTranslation(&matTrans2,float   (xPos-pTileEngine->XOffset+40), float (  yPos-pTileEngine->YOffset+100),  0.0f);		// Transformation wieder zurück

    D3DXMatrixIdentity	 (&matWorld);
    D3DXMatrixMultiply	 (&matWorld, &matWorld, &matTrans);		// Verschieben
    D3DXMatrixMultiply	 (&matWorld, &matWorld, &matRot);			// rotieren
    D3DXMatrixMultiply	 (&matWorld, &matWorld, &matTrans2);		// und wieder zurück verschieben

    // rotierte Matrix setzen
#if defined(PLATFORM_DIRECTX)
    lpD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
#elif defined(PLATFORM_SDL)
    g_matModelView = matWorld * g_matView;
#if defined(USE_GL1)
    load_matrix( GL_MODELVIEW, g_matModelView.data() );
#endif
#endif


    pGegnerGrafix[GegnerArt]->RenderSprite ((float)(xPos-pTileEngine->XOffset),
                                            (float)(yPos-pTileEngine->YOffset), 0, 0xFFFFFFFF);

    // Normale Projektions-Matrix wieder herstellen
    D3DXMatrixRotationZ (&matWorld, 0.0f);
#if defined(PLATFORM_DIRECTX)
    lpD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
#elif defined(PLATFORM_SDL)
    g_matModelView = matWorld * g_matView;
#if defined(USE_GL1)
    load_matrix( GL_MODELVIEW, g_matModelView.data() );
#endif
#endif

    SetScreenShake();
}
开发者ID:NebuPookins,项目名称:hurrican,代码行数:48,代码来源:Trigger_Column.cpp

示例5: D3DXMatrixTranslation

void GameObject::Update( float fDT )
{
	if( m_pMeshObject )
	{
		if( !m_bUseMatrix )
		{
			D3DXMATRIX MatrixTrans;			
			D3DXMatrixTranslation( &MatrixTrans, m_vPosition.x, m_vPosition.y, m_vPosition.z );

			D3DXMATRIX MatrixRotateX, MatrixRotateY, MatrixRotateZ;
			D3DXMatrixRotationX( &MatrixRotateX, m_AngleXYZ.x );
			D3DXMatrixRotationY( &MatrixRotateY, m_AngleXYZ.y );
			D3DXMatrixRotationZ( &MatrixRotateZ, m_AngleXYZ.z );
			D3DXMATRIX MatrixRotate  = MatrixRotateX * MatrixRotateY * MatrixRotateZ;
			m_MatrixRelease = MatrixRotate * MatrixTrans;

			// если есть предок, то сначала берём его матрицу
			if( m_pObjectParent )
				m_MatrixRelease = m_MatrixRelease * m_pObjectParent->GetReleaseMatrix();
		}		
	}

	for( std::list< GameObject* >::iterator iter = m_ObjectChild.begin(); iter != m_ObjectChild.end(); ++iter )
	{
		(*iter)->Update( fDT );
	}	
}
开发者ID:Dimiondark,项目名称:testxo,代码行数:27,代码来源:GameObject.cpp

示例6: SetTransform

//---------------------------------------
//NAME : SetTransform()
//DESC : 坐标转换
//---------------------------------------
void SetTransform()
{
	//设置世界变换矩阵
	D3DXMATRIX matWorld,Rx,Ry,Rz;
	D3DXMatrixIdentity(&matWorld);//单位矩阵
	D3DXMatrixRotationX(&Rx,::timeGetTime()/1000.f);//绕x轴旋转
	D3DXMatrixRotationY(&Ry,::timeGetTime()/1000.f);//绕y轴旋转
	D3DXMatrixRotationZ(&Rz,::timeGetTime()/1000.f);//绕z轴旋转

	matWorld=Rx*Ry*Rz*matWorld;
	g_pd3dDevice->SetTransform(D3DTS_WORLD,&matWorld);

	//设置取景变换矩阵
	D3DXMATRIX matView;
	D3DXVECTOR3 vEye(0.0f,0.0f,-30.0f);
	D3DXVECTOR3 vAt(0.0f,0.0f,0.0f);
	D3DXVECTOR3 vUp(0.0f,1.0f,0.0f);
	D3DXMatrixLookAtLH(&matView,&vEye,&vAt,&vUp);
	g_pd3dDevice->SetTransform(D3DTS_VIEW,&matView);

	//设置投影变换矩阵
	D3DXMATRIX matProj;
	D3DXMatrixPerspectiveFovLH(&matProj,D3DX_PI/4.0f,1.0f,1.0f,1000.0f);
	g_pd3dDevice->SetTransform(D3DTS_PROJECTION,&matProj);
}
开发者ID:haozzzzzzzz,项目名称:Direct3D_Transform,代码行数:29,代码来源:transform.cpp

示例7: D3DXMatrixScaling

void MenuObjects::Update()
{
	if(mScale.x > 1.0f)
	{
		mScale.x -= gDeltaTime * 0.5f;
		mScale.y -= gDeltaTime * 0.5f;
		mScale.z -= gDeltaTime * 0.5f;
	}
	if(miniSelector == mId - 1)
	{
		mRotated = false;
	}

	if(miniSelector != mId - 1)
	{
		if(((int)(mRotation.y * (180 / PI)) % 90) == 0)
		{
			mRotated = true;
		}
	}
	D3DXMatrixScaling(&S, mScale.x, mScale.y, mScale.z);
	D3DXMatrixRotationX(&Rx, mRotation.x);
	D3DXMatrixRotationY(&Ry, mRotation.y);
	D3DXMatrixRotationZ(&Rz, mRotation.z);
	D3DXMatrixTranslation(&T, mPosition.x, mPosition.y, mPosition.z);
	W = S * Rx * Ry * Rz * T;
}
开发者ID:WhaleCurrent,项目名称:Projektet,代码行数:27,代码来源:MenuObjects.cpp

示例8: D3DXMatrixIdentity

void MyMesh::RotateZ(FLOAT q)
{
	D3DXMATRIX rot;
	D3DXMatrixIdentity(&rot);
	D3DXMatrixRotationZ(&rot, q);
	rotationMatrix = rotationMatrix * rot;
}
开发者ID:koguz,项目名称:DirectX-Space-Game,代码行数:7,代码来源:MyMesh.cpp

示例9: SetMatrix

void SetMatrix(void)
{
	//世界变换矩阵的设置  
	D3DXMATRIX matWorld, rx, ry, rz;
	D3DXMatrixIdentity(&matWorld);
	D3DXMatrixRotationX(&rx, PI * (timeGetTime() / 1000.0f));
	D3DXMatrixRotationY(&ry, PI * (timeGetTime() / 1000.0f) / 2.0f);
	D3DXMatrixRotationZ(&rz, PI * (timeGetTime() / 1000.0f) / 3.0f);
	matWorld = rx * ry * rz * matWorld;
	g_pDevice->SetTransform(D3DTS_WORLD, &matWorld);

	//取景变换矩阵的设置  
	D3DXMATRIX matView;
	D3DXVECTOR3 eye(0.0f, 0.0f, -50.0f);
	D3DXVECTOR3 at(0.0f, 0.0f, 0.0f);
	D3DXVECTOR3 up(0.0f, 1.0f, 0.0f);
	D3DXMatrixLookAtLH(&matView, &eye, &at, &up);
	g_pDevice->SetTransform(D3DTS_VIEW, &matView);

	//投影变换矩阵的设置  
	D3DXMATRIX matProjection;
	D3DXMatrixPerspectiveFovLH(&matProjection, PI / 4.0f, 800.0f / 600.0f, 1.0f, 1000.0f);
	g_pDevice->SetTransform(D3DTS_PROJECTION, &matProjection);

	//视口变换的设置 
	D3DVIEWPORT9 vp;
	vp.X = 0;
	vp.Y = 0;
	vp.Width = SCREEN_WIDTH;
	vp.Height = SCREEN_HEIGHT;
	vp.MinZ = 0.0f;
	vp.MaxZ = 1.0f;
	g_pDevice->SetViewport(&vp);
}
开发者ID:liyongfa,项目名称:DirectX,代码行数:34,代码来源:demo4.cpp

示例10: D3DXMatrixIdentity

void RenderModel::render() {
	// negative id are for invisible/container objects
	if(modelId >= 0)
	{
		Point_t pos = ref->getPos();
		Rot_t rot = ref->getRot();

		//Get translation/rotation matrix
		D3DXMATRIX trans, rotX, rotY, rotZ, scaleMat;
		D3DXMatrixIdentity(&trans);
		D3DXMatrixIdentity(&rotX);
		D3DXMatrixIdentity(&rotY);
		D3DXMatrixIdentity(&rotZ);

		D3DXMatrixTranslation(&trans, pos.x, pos.y, pos.z);
		D3DXMatrixRotationX(&rotX, rot.x);
		D3DXMatrixRotationY(&rotY, rot.y);
		D3DXMatrixRotationZ(&rotZ, rot.z);

		D3DXMatrixScaling(&scaleMat,scale.x,scale.y,scale.z);  

		//DC::get()->print("(%f,%f,%f), (%f,%f,%f)\n", pos.x, pos.y, pos.z, rot.x, rot.y, rot.z);

		//Render
		RE::get()->animate(modelId, scaleMat * rotX * rotY * rotZ * trans);
	}
}
开发者ID:Sudoka,项目名称:NinjaCoders125,代码行数:27,代码来源:RenderModel.cpp

示例11: D3DXMatrixRotationX

/*
 * constructor
 */
Transformable::Transformable(void) {
	D3DXMatrixRotationX(&rotateX, D3DXToRadian(0.0f));
	D3DXMatrixRotationY(&rotateY, D3DXToRadian(0.0f));
	D3DXMatrixRotationZ(&rotateZ, D3DXToRadian(0.0f));
	D3DXMatrixScaling(&scale, 1.0f, 1.0f, 1.0f);
	D3DXMatrixTranslation(&translate, 0.0f, 0.0f, 0.0f);
}
开发者ID:WhatIsHeDoing,项目名称:Lego,代码行数:10,代码来源:Transformable.cpp

示例12: renderchain_set_mvp

static void renderchain_set_mvp(void *data, unsigned vp_width,
      unsigned vp_height, unsigned rotation)
{
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_HLSL)
   video_shader_ctx_mvp_t mvp;
#endif
   d3d_video_t      *d3d = (d3d_video_t*)data;
   LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->dev;

#if defined(_XBOX360) && defined(HAVE_HLSL)
   hlsl_set_proj_matrix(XMMatrixRotationZ(rotation * (M_PI / 2.0)));

   mvp.data   = d3d;
   mvp.matrix = NULL;

   video_shader_driver_set_mvp(mvp);
#elif defined(HAVE_D3D8)
   D3DXMATRIX p_out, p_rotate, mat;
   D3DXMatrixOrthoOffCenterLH(&mat, 0, vp_width,  vp_height, 0, 0.0f, 1.0f);
   D3DXMatrixIdentity(&p_out);
   D3DXMatrixRotationZ(&p_rotate, rotation * (M_PI / 2.0));

   d3d_set_transform(d3dr, D3DTS_WORLD, &p_rotate);
   d3d_set_transform(d3dr, D3DTS_VIEW, &p_out);
   d3d_set_transform(d3dr, D3DTS_PROJECTION, &p_out);
#endif
}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:27,代码来源:xdk_renderchain.cpp

示例13: D3DXMatrixIdentity

VOID CameraWorkBase::SetMatrix( LPD3DXVECTOR3 _pvecScale, LPD3DXVECTOR3 _pvecRotate, LPD3DXVECTOR3 _pvecTranslate )
{
	//	Set World Matrix
	D3DXMATRIX matScale;
	D3DXMatrixIdentity( &matScale );
	D3DXMatrixScaling( &matScale, _pvecScale->x, _pvecScale->y, _pvecScale->z );

	D3DXMATRIX matRotateX;
	D3DXMatrixIdentity( &matRotateX );
	D3DXMatrixRotationX( &matRotateX, _pvecRotate->x );

	D3DXMATRIX matRotateY;
	D3DXMatrixIdentity( &matRotateY );
	D3DXMatrixRotationY( &matRotateY, _pvecRotate->y );

	D3DXMATRIX matRotateZ;
	D3DXMatrixIdentity( &matRotateZ );
	D3DXMatrixRotationZ( &matRotateZ, _pvecRotate->z );

	D3DXMATRIX matTranslate;
	D3DXMatrixIdentity( &matTranslate );
	D3DXMatrixTranslation( &matTranslate, _pvecTranslate->x, _pvecTranslate->y, _pvecTranslate->z );

	D3DXMATRIX matWorld;
	D3DXMatrixIdentity( &matWorld );
	matWorld = matScale * matRotateX * matRotateY * matRotateZ * matTranslate;

	m_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
}
开发者ID:yoonhada,项目名称:nlinelast,代码行数:29,代码来源:CameraWorkBase.cpp

示例14: D3DXMatrixScaling

void RollingBall::drawObject(IDirect3DDevice9 *d3dDev)
{
	D3DXMATRIX worldMat, viewMat, matTransform, matProjection, matScale, matTranslate,  matRotation;

	if(actor == NULL)
	{
		return;
	}
	
	//scaling
	D3DXMatrixScaling(&matScale,1.0f, 1.0f, 1.0f);
	worldMat = matScale;

	//rotation
	if(xRot)
		D3DXMatrixRotationX(&matRotation, getRotX());
	else
		D3DXMatrixRotationZ(&matRotation, getRotZ());
	worldMat *= matRotation;

	//translation
	D3DXMatrixTranslation(&matTranslate, getX(), getY(), getZ());
	worldMat *= matTranslate;

	//final matrix = ISROT, identity * scale * rotation * orbit * translation
	d3dDev->SetTransform(D3DTS_WORLD, &worldMat);
	//set texture
	d3dDev->SetTexture(0, texture);
	
	//draw object
	mesh->DrawSubset(0);
}
开发者ID:nickapopolis,项目名称:Labyrinthian,代码行数:32,代码来源:RollingBall.cpp

示例15: SetBlockPosition

void SetBlockPosition ( BRUSH* pBrush, float fX, float fY, float fZ, float fScale )
{
		D3DXMATRIX	matTranslation;										// translation ( position )
	D3DXMATRIX	matRotation, matRotateX, matRotateY, matRotateZ;	// rotation
	D3DXMATRIX	matScale;											// scale
	D3DXMATRIX	matViewInverse;
	D3DXMATRIX	matView;
	
	// use this for the inverse function
	float fDet;

	// apply scaling to the object
	D3DXMatrixScaling ( &matScale, fScale, fScale, fScale );
	
	// apply translation to the object
	D3DXMatrixTranslation ( &matTranslation, fX, fY, fZ );

	// setup rotation matrices
	D3DXMatrixRotationX ( &matRotateX, D3DXToRadian ( 0.0f ) );	// x rotation
	D3DXMatrixRotationY ( &matRotateY, D3DXToRadian ( 0.0f ) );	// y rotation
	D3DXMatrixRotationZ ( &matRotateZ, D3DXToRadian ( 0.0f ) );	// z rotation

	// build final rotation matrix
	matRotation = matRotateX * matRotateY * matRotateZ;

	pBrush->Matrix = matRotation * matScale * matTranslation;

}
开发者ID:Fliper12,项目名称:darkbasicpro,代码行数:28,代码来源:xmain.cpp


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