本文整理匯總了C++中D3DXMatrixRotationY函數的典型用法代碼示例。如果您正苦於以下問題:C++ D3DXMatrixRotationY函數的具體用法?C++ D3DXMatrixRotationY怎麽用?C++ D3DXMatrixRotationY使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了D3DXMatrixRotationY函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: D3DXMatrixRotationY
void PRTHierarchy::UpdateTransformationMatrices() {
D3DXMATRIX rotX, rotY, rotYInverse;
D3DXMatrixRotationY(&rotY, mRotationY);
D3DXMatrixRotationX(&rotX, mRotationX);
D3DXMatrixIdentity(&mWorldTransform);
D3DXMATRIX rot = rotX * rotY;
mWorldTransform = mScaleMatrix * rot;
mRenderMesh->SetWorldTransformation(mWorldTransform);
mApproxMesh->SetWorldTransformation(mWorldTransform);
mRenderMesh->SetRotationMatrix(rot);
mApproxMesh->SetRotationMatrix(rot);
}
示例2: D3DXMatrixRotationY
void CMesh::SetPosition(float x,float y,float z)
{
m_vPos.x=x;
m_vPos.y=y;
m_vPos.z=z;
m_fScale=1.0f;
m_fAngle=0;
D3DXMatrixRotationY((D3DXMATRIX*)&m_matTrans,m_fAngle);
m_matTrans._41=m_vPos.x;
m_matTrans._42=m_vPos.y;
m_matTrans._43=m_vPos.z;
}
示例3: D3DXMatrixRotationY
void cCamera::yaw(float angle)
{
D3DXMATRIX transform_matrix;
// rotate around world y-axis (0, 1, 0) always for land object
if(m_camera_type == LAND_OBJECT)
D3DXMatrixRotationY(&transform_matrix, angle);
else // rotate around own up vector for aircraft
D3DXMatrixRotationAxis(&transform_matrix, &m_up, angle);
// rotate m_right and m_look around m_up or y-axis
D3DXVec3TransformCoord(&m_right, &m_right, &transform_matrix);
D3DXVec3TransformCoord(&m_look, &m_look, &transform_matrix);
}
示例4: atan2f
void AnimPlayer::Relativize(D3DXVECTOR3* stick_rel,const D3DXVECTOR3* stick_abs,float* rot_rel,const float* rot_abs){
//カメラの回転を求める
D3DXVECTOR3 camVec = cam->lookatPt - cam->eyePt;
float camRot = atan2f(camVec.x,camVec.z);
//カメラ分回転させて相対化
D3DXMATRIX around;
D3DXMatrixRotationY(&around,camRot);
D3DXVec3TransformCoord(stick_rel,stick_abs,&around);
//回転を相対化
*rot_rel = camRot + *rot_abs;
}
示例5: OBJRotY
PUBLIC void OBJRotY(hOBJ obj, float radian)
{
obj->wrldRot[eY] += radian;
D3DXMATRIX mtxR;
//set the rotation matrix
D3DXMatrixRotationY(&mtxR, radian);
D3DXMatrixMultiply(&obj->wrldMtx.mtxRot,&obj->wrldMtx.mtxRot,&mtxR);
//set the world matrix
D3DXMatrixMultiply(&obj->wrldMtx.mtxWrld,&obj->wrldMtx.mtxScale,&obj->wrldMtx.mtxRot);
D3DXMatrixMultiply(&obj->wrldMtx.mtxWrld,&obj->wrldMtx.mtxWrld,&obj->wrldMtx.mtxTrans);
}
示例6: D3DXMatrixTranslation
/**
* Draw()
*/
void Tank::Draw()
{
LPDIRECT3DDEVICE9 pDev = GameMain::GetD3DDevice();
D3DXMATRIX m, mPos, mRot;
D3DXMatrixTranslation(&mPos, vPos.x, vPos.y, vPos.z);
D3DXMatrixRotationY(&mRot, rotBody);
// マテリアル設定
pDev->SetMaterial(&material);
// 本體描畫
D3DXMatrixIdentity(&m);
m *= mRot * mPos;
pDev->SetTransform(D3DTS_WORLD, &m);
pMeshBody->DrawSubset(0);
// 頭描畫
D3DXMATRIX mPosHead;
D3DXMATRIX mRotHead;
D3DXMatrixIdentity(&m);
D3DXMatrixTranslation(&mPosHead, 0, TANK_BODY_H, 0);
D3DXMatrixRotationY(&mRotHead, rotHead);
m *= mPosHead * mRot * mRotHead * mPos;
pDev->SetTransform(D3DTS_WORLD, &m);
pMeshHead->DrawSubset(0);
// 砲塔描畫
D3DXMATRIX mPosGun;
D3DXMatrixIdentity(&m);
D3DXMatrixTranslation(&mPosGun, 0,
TANK_BODY_H+(TANK_HEAD_H-TANK_GUN_H)*0.5f,
(TANK_HEAD_D+TANK_GUN_D)*0.5f);
m *= mPosGun * mRot * mRotHead * mPos;
pDev->SetTransform(D3DTS_WORLD, &m);
pMeshGun->DrawSubset(0);
}
示例7: if
void Cube_Textured::Update()
{
float tick = (float)GameManager::GetTick();
jumpTime += tick;
if ((GetAsyncKeyState('A') & 0x8000) != 0)
{
rotationAxisY -= (rotationSpeed * tick);
}
else if ((GetAsyncKeyState('D') & 0x8000) != 0)
{
rotationAxisY += (rotationSpeed * tick);
}
if ((GetAsyncKeyState('W') & 0x8000) != 0)
{
position += (direction * moveSpeed * tick);
}
else if ((GetAsyncKeyState('S') & 0x8000) != 0)
{
position -= (direction * moveSpeed * tick);
}
if ((GetAsyncKeyState(VK_SPACE) & 0x8000) != 0 && isJumping == false )
{
isJumping = true;
jumpTime = 0.0f;
}
D3DXMATRIX rotX, rotY, move;
D3DXMatrixRotationX(&rotX, rotationAxisX);
D3DXMatrixRotationY(&rotY, rotationAxisY);
world = rotX * rotY;
D3DXVECTOR3 baseDirection(0, 0, 1);
D3DXVec3TransformCoord(&direction, &baseDirection, &world);
if (isJumping)
{
position.y = jumpPower * jumpTime - 4.9f/*0.5f * ( 9.8f ) */* jumpTime * jumpTime;
if (position.y < 0.0)
{
isJumping = false;
position.y = 0.0f;
}
}
D3DXMatrixTranslation(&move, position.x, position.y, position.z);
world *= move;
}
示例8: dir
void Camera::Update(float dt, float offsetHeight)
{
mDXInput->Update() ;
// Find the net direction the camera is traveling in (since the
// camera could be running and strafing).
D3DXVECTOR3 dir(0.0f, 0.0f, 0.0f);
if( mDXInput->KeyDown(DIK_W) )
dir += m_vForward;
if( mDXInput->KeyDown(DIK_S) )
dir -= m_vForward;
if( mDXInput->KeyDown(DIK_D) )
dir += m_vRight;
if( mDXInput->KeyDown(DIK_A) )
dir -= m_vRight;
// Move at mSpeed along net direction.
D3DXVec3Normalize(&dir, &dir);
D3DXVECTOR3 newPos = m_vEyePoint + dir * mSpeed * dt;
m_vEyePoint = newPos ;
if (m_vEyePoint.y < 1.0f)
{
m_vEyePoint.y = 1.0f ;
}
if (m_vEyePoint.y > 2.0f)
{
m_vEyePoint.y = 2.0f ;
}
// We rotate at a fixed speed.
float pitch = mDXInput->MouseDY() / 360.0f;
float yAngle = mDXInput->MouseDX() / 360.0f;
// Rotate camera's look and up vectors around the camera's right vector.
D3DXMATRIX R;
D3DXMatrixRotationAxis(&R, &m_vRight, pitch);
D3DXVec3TransformCoord(&m_vForward, &m_vForward, &R);
D3DXVec3TransformCoord(&m_vUp, &m_vUp, &R);
// Rotate camera axes about the world's y-axis.
D3DXMatrixRotationY(&R, yAngle);
D3DXVec3TransformCoord(&m_vRight, &m_vRight, &R);
D3DXVec3TransformCoord(&m_vForward, &m_vForward, &R);
// Rebuild the view matrix to reflect changes.
BuildViewMatrix();
}
示例9: D3DXMatrixRotationY
bool graphics::RenderSceneToTexTure2()
{
D3DXMATRIX worldMatrix, lightViewMatrix, lightProjectionMatrix, translateMatrix,tempA,tempB,tempC;
float posX, posY, posZ;
// Set the render target to be the render to texture.
_renderTexture2->SetRenderTarget(_D3D->GetDevice());
// Clear the render to texture.
_renderTexture2->ClearRenderTarget(_D3D->GetDevice(), 0.0f, 0.0f, 0.0f, 1.0f);
// Generate the light view matrix based on the light's position.
_light2->GenerateViewMatrix();
// Get the world matrix from the d3d object.
_D3D->GetWorldMatrix(worldMatrix);
// Get the view and orthographic matrices from the light object.
_light2->GetViewMatrix(lightViewMatrix);
_light2->GetProjectionMatrix(lightProjectionMatrix);
D3DXMatrixRotationY(&worldMatrix,_rotation1);
// Setup the translation matrix for the cube model.
_model2->RenderToGraphics(_D3D->GetDevice());
_depthShader->Render(_D3D->GetDevice(), _model2->GetIndexCount(), worldMatrix, lightViewMatrix, lightProjectionMatrix);
_D3D->GetWorldMatrix(worldMatrix);
D3DXMatrixTranslation(&tempA,0.0f,1.0f,0.5f);
D3DXMatrixRotationX(&tempB, 90.0f);
D3DXMatrixMultiply(&worldMatrix,&tempA,&tempB);
D3DXMatrixScaling(&tempC,2.0f,2.0f,2.0f);
D3DXMatrixMultiply(&worldMatrix,&worldMatrix,&tempC);
_model->RenderToGraphics(_D3D->GetDevice());
_depthShader->Render(_D3D->GetDevice(), _model->GetIndexCount(), worldMatrix, lightViewMatrix, lightProjectionMatrix);
// Render the cube model with the depth shader.
// Reset the render target back to the original back buffer and not the render to texture anymore.
_D3D->SetBackBufferRenderTarget();
// Reset the viewport back to the original.
_D3D->ResetViewport();
return true;
}
示例10: UpdateInput
//-------------------------------------------------------------
// Name: FrameMove()
// Desc: �� �����Ӹ��� ȣ���. �ִϸ��̼� ó���� ���
//-------------------------------------------------------------
HRESULT CMyD3DApplication::FrameMove()
{
// UFO�� �����δ�
m_pos.x = 1.5f*(FLOAT)cos(1.0f*this->m_fTime)+1.0f;
m_pos.z = 1.5f*(FLOAT)sin(1.0f*this->m_fTime);
m_pos.y = 1.3f;
UpdateInput( &m_UserInput ); // �Էµ����� ����
//---------------------------------------------------------
// �Է¿� ���� ��ǥ�踦 �����Ѵ�
//---------------------------------------------------------
// ȸ��
D3DXMATRIX matRotY;
D3DXMATRIX matRotX;
if( m_UserInput.bRotateLeft && !m_UserInput.bRotateRight )
m_fWorldRotY += m_fElapsedTime;
else
if( m_UserInput.bRotateRight && !m_UserInput.bRotateLeft )
m_fWorldRotY -= m_fElapsedTime;
if( m_UserInput.bRotateUp && !m_UserInput.bRotateDown )
m_fWorldRotX += m_fElapsedTime;
else
if( m_UserInput.bRotateDown && !m_UserInput.bRotateUp )
m_fWorldRotX -= m_fElapsedTime;
D3DXMatrixRotationX( &matRotX, m_fWorldRotX );
D3DXMatrixRotationY( &matRotY, m_fWorldRotY );
D3DXMatrixMultiply( &m_mWorld, &matRotY, &matRotX );
//---------------------------------------------------------
// ����� ����
//---------------------------------------------------------
// ��
if( m_UserInput.bZoomIn && !m_UserInput.bZoomOut )
m_fViewZoom += m_fElapsedTime;
else if( m_UserInput.bZoomOut && !m_UserInput.bZoomIn )
m_fViewZoom -= m_fElapsedTime;
D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 0.0f, -m_fViewZoom );
D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtLH( &m_mView, &vFromPt, &vLookatPt, &vUpVec );
return S_OK;
}
示例11: vLeft
void CAXModel::UpdateMatrix(void)
{
D3DXMATRIX matPosition;
D3DXMATRIX matSize;
D3DXMATRIX matRotate;
D3DXMATRIX matAnchorPoint;
D3DXMATRIX matComplate;
D3DXMATRIX mT;
{
AVector3 vLeft(1.0f, 0.0f, 0.0f);
AVector3 vUp(0.0f, 1.0f, 0.0f);
AVector3 vLook(0.0f, 0.0f, 1.0f);
AVector3 vUpNew, vLeftNew, vLookNew;
D3DXMATRIX mX, mY, mZ;
D3DXMatrixRotationX(&mX, m_fRotX);
D3DXMatrixRotationY(&mY, m_fRotY);
D3DXMatrixRotationZ(&mZ, -m_fRotZ);
D3DXMatrixTranslation(&mT, vUp.x, vUp.y, vUp.z);
mT *= mX; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mY; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mZ; vUpNew = AVector3(mT._41, mT._42, mT._43);
D3DXMatrixTranslation(&mT, vLeft.x, vLeft.y, vLeft.z);
mT *= mX; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mY; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mZ; vLeftNew = AVector3(mT._41, mT._42, mT._43);
D3DXMatrixTranslation(&mT, vLook.x, vLook.y, vLook.z);
mT *= mX; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mY; D3DXMatrixTranslation(&mT, mT._41, mT._42, mT._43);
mT *= mZ; vLookNew = AVector3(mT._41, mT._42, mT._43);
mT._11 = vLeftNew.x; mT._12 = vLeftNew.y; mT._13 = vLeftNew.z; mT._14 = 0.0f; // Left Vector
mT._21 = vUpNew.x; mT._22 = vUpNew.y; mT._23 = vUpNew.z; mT._24 = 0.0f; // Up Vector
mT._31 = vLookNew.x; mT._32 = vLookNew.y; mT._33 = vLookNew.z; mT._34 = 0.0f; // Front Vector
mT._41 = 0.0f; mT._42 = 0.0f; mT._43 = 0.0f; mT._44 = 1.0f; // Translation
}
D3DXMatrixTranslation(&matAnchorPoint, m_vAnchorPoint.x, m_vAnchorPoint.y, m_vAnchorPoint.z);
D3DXMatrixScaling(&matSize, m_vSize.x, m_vSize.y, m_vSize.z);
D3DXMatrixTranslation(&matPosition, m_vPosition.x, m_vPosition.y, m_vPosition.z);
m_matComplate = matAnchorPoint * matSize * mT * matPosition;
m_bUpdateMatrix = false;
}
示例12: SetupTigerSecondMatrices
VOID SetupTigerSecondMatrices()
{
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matRotateWorld;
D3DXMATRIXA16 resultMatrix;
D3DXMatrixIdentity( &matWorld );
D3DXMatrixIdentity( &matRotateWorld );
D3DXMatrixRotationY( &matRotateWorld, timeGetTime() / 1000.0f );
D3DXMatrixTranslation( &matWorld, -1.5f, -1.0f, 0.3f );
// 제자리 돌기
D3DXMatrixMultiply( &resultMatrix, &matRotateWorld , &matWorld );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &resultMatrix );
}
示例13: vEye
/**
* SetCamera()
* カメラを設定する。
*/
void Tank::SetCamera() {
D3DXVECTOR3 vEye(0, 10.0f, -30.0f);
D3DXVECTOR3 vAt(0, 10.0f, 10.0f);
D3DXMATRIX m;
D3DXMatrixRotationY(&m, rotBody);
D3DXVec3TransformCoord(&vEye, &vEye, &m);
D3DXVec3TransformCoord(&vAt, &vAt, &m);
vEye += vPos;
vAt += vPos;
GameMain::GetInstance().SetCamera(vEye, vAt);
}
示例14: Animate
/**-----------------------------------------------------------------------------
* 애니메이션 설정
*------------------------------------------------------------------------------
*/
VOID Animate()
{
D3DXMATRIXA16 matX;
D3DXMATRIXA16 matY;
D3DXMatrixRotationX( &matX, g_xRot );
D3DXMatrixRotationY( &matY, g_yRot );
g_matWorld = matX * matY;
g_pd3dDevice->SetTransform( D3DTS_WORLD, &g_matWorld ); /// 디바이스에 월드행렬 설정
g_pd3dDevice->SetTransform( D3DTS_VIEW, &g_matView );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &g_matProj );
SetupLights();
SetupFX();
LogFPS(); // 로깅
}
示例15: D3DXMatrixRotationY
void CBlock::D(float ang)
{
D3DXMATRIX mat;
D3DXMatrixRotationY(&mat, D3DX_PI*2-ang);
int i;
for (i=0; i<BLOCK_VERTEX_NUM; ++i)
{
D3DXVECTOR3 vec3(m_CubeVertex[i]._x, m_CubeVertex[i]._y, m_CubeVertex[i]._z);
D3DXVECTOR3 vecOut;
D3DXVec3TransformCoord(&vecOut, &vec3, &mat);
m_CubeVertex[i]._x = vecOut.x;
m_CubeVertex[i]._y = vecOut.y;
m_CubeVertex[i]._z = vecOut.z;
}
}