本文整理汇总了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);
}
示例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;
}
示例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
//メッセージ
}
示例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();
}
示例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 );
}
}
示例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);
}
示例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;
}
示例8: D3DXMatrixIdentity
void MyMesh::RotateZ(FLOAT q)
{
D3DXMATRIX rot;
D3DXMatrixIdentity(&rot);
D3DXMatrixRotationZ(&rot, q);
rotationMatrix = rotationMatrix * rot;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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
}
示例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 );
}
示例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);
}
示例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;
}