本文整理汇总了C++中D3DXMatrixRotationYawPitchRoll函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DXMatrixRotationYawPitchRoll函数的具体用法?C++ D3DXMatrixRotationYawPitchRoll怎么用?C++ D3DXMatrixRotationYawPitchRoll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D3DXMatrixRotationYawPitchRoll函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetRotation
void LineModel::RotateVertsAroundOrigin( Vector3 Rotation )
{
SetRotation(Rotation);
Vector3 tempOrigin = newOrigin;
ChangeOrigin(-newOrigin);
for (int i = 0; i < FinalList.size(); i++)
{
D3DXVECTOR3 outv;
D3DXVECTOR3 temp (FinalList[i].X,FinalList[i].Y,FinalList[i].Z);
D3DXMatrixRotationYawPitchRoll(&rotationMatrix,Rotation.Y,Rotation.X,Rotation.Z);
D3DXVec3TransformCoord(&outv, &temp, &rotationMatrix);
FinalList[i] = Vector3(outv.x,outv.y,outv.z);
}
ChangeOrigin(tempOrigin);
}
示例2: GetMatrixWorld
void GetMatrixWorld(MyMath::MatrixF* pWorld) const
{
// スケーリングは考慮しない。
#if 0
D3DXMatrixRotationYawPitchRoll(pWorld,
m_vRotation.y,
m_vRotation.x,
m_vRotation.z);
#else
MyMath::CreateMatrixRotationZXY(pWorld, &m_vRotation);
#endif
pWorld->_41 = m_vTranslation.x;
pWorld->_42 = m_vTranslation.y;
pWorld->_43 = m_vTranslation.z;
}
示例3: D3DXMatrixScaling
Missile1::Missile1(D3DXVECTOR3 spawnPosition, D3DXVECTOR3 direction,float scale)
{
position = startPosition = spawnPosition;
this->direction = direction;
D3DXMatrixScaling(&scaleMat, scale, scale, scale);
D3DXMatrixRotationYawPitchRoll(&rotateMat, 0, 0,-1.55f);
destroyObject = isExpanding = false;
m_rotateAngle = 0;
projectileType = MISSILE1;
isBlastMesh = false;
blastRadiusScale = 0.0f;
radiusTimeTrack = 0.0;
Initialize();
}
示例4: D3DXMatrixRotationYawPitchRoll
void Camera::updateView(float dt)
{
//rotation
D3DXMatrixRotationYawPitchRoll(&rotationMatrix, heading, pitch, 0);
D3DXVec3TransformCoord(&view,&dV,&rotationMatrix);
D3DXVec3TransformCoord(&up,&dU,&rotationMatrix);
D3DXVec3Normalize(&forward,&view);
D3DXVec3Cross(&strafeRight,&up,&view);
D3DXVec3Normalize(&strafeRight,&strafeRight);
view = eye + view;
D3DXMatrixLookAtLH(&viewMatrix,&eye,&view,&up);
}
示例5: D3DXMatrixRotationYawPitchRoll
void CameraClass::Render()
{
D3DXVECTOR3 lookAt;
float yaw, pitch, roll;
D3DXMATRIX rotationMatrix;
// Setup the vector that points upwards.
m_up.x = 0.0f;
m_up.y = 1.0f;
m_up.z = 0.0f;
// Setup the position of the camera in the world.
//position.x = m_positionX;
//position.y = m_positionY;
//position.z = m_positionZ;
// Setup where the camera is looking by default.
m_direction.x = 0.0f;
m_direction.y = 0.0f;
m_direction.z = 1.0f;
// Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
pitch = m_rotationX * 0.0174532925f;
yaw = m_rotationY * 0.0174532925f;
roll = m_rotationZ * 0.0174532925f;
// Create the rotation matrix from the yaw, pitch, and roll values.
D3DXMatrixRotationYawPitchRoll(&rotationMatrix, yaw, pitch, roll);
// Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
D3DXVec3TransformCoord(&m_direction, &m_direction, &rotationMatrix);
D3DXVec3TransformCoord(&m_up, &m_up, &rotationMatrix);
//m_direction = D3DXVECTOR3(lookAt);
m_right.x = -(m_direction.y*m_up.z - m_direction.z*m_up.y);
m_right.y = -(m_direction.z*m_up.x - m_direction.x*m_up.z);
m_right.z = -(m_direction.x*m_up.y - m_direction.y*m_up.x);
// Translate the rotated camera position to the location of the viewer.
lookAt = m_position + m_direction;
// Finally create the view matrix from the three updated vectors.
D3DXMatrixLookAtLH(&m_viewMatrix, &m_position, &lookAt, &m_up);
return;
}
示例6: D3DXMatrixTranslation
void MESHINSTANCE::Render()
{
//Set World-Transform, then render the mesh
if(m_pMesh != NULL)
{
D3DXMATRIX p, r, s;
D3DXMatrixTranslation(&p, m_pos.x, m_pos.y, m_pos.z);
D3DXMatrixRotationYawPitchRoll(&r, m_rot.y, m_rot.x, m_rot.z);
D3DXMatrixScaling(&s, m_sca.x, m_sca.y, m_sca.z);
D3DXMATRIX world = s * r * p;
m_pMesh->m_pDevice->SetTransform(D3DTS_WORLD, &world);
m_pMesh->Render();
}
}
示例7: D3DXMatrixIdentity
// 座標変換
void Camera::TransForm(D3DXVECTOR3 pos, D3DXVECTOR3 rota)
{
D3DXMATRIX *m_temp = new D3DXMATRIX;
D3DXMatrixIdentity(&m_view);
D3DXMatrixIdentity(m_temp);
// 行列を回転する
D3DXMatrixRotationYawPitchRoll(m_temp, rota.y, rota.x, rota.z);
m_view *= *m_temp;
// 行列を平行移動させる
D3DXMatrixTranslation(m_temp, pos.x, pos.y, pos.z);
m_view *= *m_temp;
delete m_temp;
}
示例8: D3DXMatrixRotationYawPitchRoll
void EffectSwirl::apply()
{
D3DXVECTOR3 pos;
D3DXMATRIX mat;
for (int i = 0; i < swirlImages; i++)
{
float offset = (float)i * 2*3.14159f / (float)swirlImages;
D3DXMatrixRotationYawPitchRoll(&mat, 0,0,offset);
pos.z = 3.0f+2.5f*sin(m_pSettings->frame*0.007f+offset);
//Pretty sinusoidal swimming
pos.x = minx + scalex/2.0f + (float)7.0f/20.0f*minscale*sin(m_pSettings->frame*0.035f);
pos.y = miny + scaley/2.0f +(float)7.0f/20.0f*minscale*cos(m_pSettings->frame*0.045f);
TransformCoord(&pos,&pos,&mat);
m_pSettings->waterField->SetHeight(pos.x,pos.y,2.5f,-2.5f*(invertSwirls ? (i%2)*2-1:1), palette[i]);
}
}
示例9: D3DXVECTOR3
Map::Map(void)
{
//マップ登録
D3DXMATRIX cube_rot_mat;
D3DXVECTOR3 cube_vec[3];
cube_vec[0] = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
cube_vec[1] = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
cube_vec[2] = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
D3DXMatrixRotationYawPitchRoll( &cube_rot_mat, 0, 0, 0 );
D3DXVec3TransformCoord(&cube_vec[0], &cube_vec[0], &cube_rot_mat);
D3DXVec3TransformCoord(&cube_vec[1], &cube_vec[1], &cube_rot_mat);
D3DXVec3TransformCoord(&cube_vec[2], &cube_vec[2], &cube_rot_mat);
obb->SetNormDirect(cube_vec[0], cube_vec[1], cube_vec[2]);
D3DXVECTOR3 cube_length(1.0f, 1.0f, 1.0f);
obb->SetLength(cube_length.x, cube_length.y, cube_length.z);
}
示例10: MoveShell
/////////////////////////////////////////////////////////////////////////
// ’e”ŽË
/////////////////////////////////////////////////////////////////////////
void MoveShell(Shell &shell, Tank(&tank)[myTANKNUM], float speed, float cd)
{
D3DXVECTOR3 vec;
if (shell.fireOK == false)
{
if (shell.time < cd / FPS * 60.f)
{
shell.time += fpTimeDelta;
}
else
{
shell.fireOK = true;
shell.time = cd / FPS * 60.f;
}
}
if (shell.fireOK &&key&mLbtn)
{
shell.hitmax += 1;
shell.active = true;
shell.fireOK = false;
shell.time = 0.f;
}
if (shell.active == false)
{
shell.position = tank[myGUN].position;
shell.prePos = tank[myGUN].position;
D3DXMatrixRotationYawPitchRoll(&shell.mat, D3DXToRadian(tank[myGUN].direction), tank[myGUN].pitch, tank[myGUN].roll);
D3DXMatrixMultiply(&shell.mat, &shell.mat, &tank[myGUN].mat);
D3DXVec3TransformCoord(&vec, &D3DXVECTOR3(0.f, 0.f, 0.5f), &shell.mat);
D3DXVec3Add(&shell.position, &tank[myGUN].position, &vec);
}
else if (shell.active)
{
shell.prePos = shell.position;
D3DXVECTOR3 dist(0.0f, 0.0f, speed / 150.f);
D3DXVec3TransformCoord(&dist, &dist, &shell.mat);
D3DXVec3Add(&shell.position, &shell.position, &dist);
if (D3DXVec3Length(D3DXVec3Subtract(&vec, &shell.position, &tank[myGUN].position)) > 600.f)
{
shell.active = false;
}
}
}
示例11: D3DXToDegree
void CDofEditing::UpdateAngles(void)
{
CString Angle;
Angle.Format("%05.2f", D3DXToDegree(m_Yaw));
m_YawAngle.SetWindowText(Angle);
Angle.Format("%05.2f", D3DXToDegree(m_Pitch));
m_PitchAngle.SetWindowText(Angle);
Angle.Format("%05.2f", D3DXToDegree(m_Roll));
m_RollAngle.SetWindowText(Angle);
D3DXMatrixRotationYawPitchRoll(&m_Dof->dof.rotation, m_Yaw, m_Pitch, m_Roll);
Angle.Format("%7.3f", m_Dof->dof.translation.x);
m_XPos.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.translation.y);
m_YPos.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.translation.z);
m_ZPos.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.scale.x);
m_XScale.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.scale.y);
m_YScale.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.scale.z);
m_ZScale.SetWindowText(Angle);
Angle.Format("%7.3f", m_Dof->dof.multiplier);
m_DofCx.SetWindowText(Angle);
m_DofInvCheck.SetCheck(m_Dof->dof.flags&XDOF_NEGATE);
m_DofLimits.SetCheck(m_Dof->dof.flags&XDOF_MINMAX);
m_DofDegrees.SetCheck(m_Dof->dof.flags&XDOF_ISDOF);
m_DofScale.SetCheck(m_Dof->dof.flags&XDOF_SUBRANGE);
Angle.Format("%7.3f", (m_Dof->dof.flags&XDOF_ISDOF)?D3DXToDegree(m_Dof->dof.max):m_Dof->dof.max);
m_DofMax.SetWindowText(Angle);
Angle.Format("%7.3f", (m_Dof->dof.flags&XDOF_ISDOF)?D3DXToDegree(m_Dof->dof.min):m_Dof->dof.min);
m_DofMin.SetWindowText(Angle);
CString Caption;
Caption.Format("DOF Nr : %03d", m_Dof->dof.dofNumber);
SetWindowText(Caption);
m_DofList.SetCurSel(m_Dof->dof.Type);
}
示例12: D3DXMatrixRotationYawPitchRoll
void Meshes::draw_meshes(LPDIRECT3DDEVICE9 pD3DDevice)
{
D3DXMatrixRotationYawPitchRoll(&matRotate, D3DXToRadian(rot.y), D3DXToRadian(rot.x), D3DXToRadian(rot.z));
D3DXMatrixScaling(&matScale, scale.x, scale.y, scale.z);
D3DXMatrixTranslation(&matTranslate, pos.x, pos.y, pos.z);
pD3DDevice->SetTransform(D3DTS_WORLD, &(matRotate* matScale * matTranslate));
for(DWORD i = 0; i < numMaterials; i++)
{
pD3DDevice->SetMaterial(&material[i]);
pD3DDevice->SetTexture(0,texture[i]);
Model->DrawSubset(i);
//return;
}
}
示例13: D3DXMatrixScaling
//----[ getTransform ]-------------------------------------------------------
void Mesh::getTransform(D3DXMATRIX* matrix) {
D3DXMATRIX s, r, t;
D3DXMatrixScaling(&s,
scaling_.getX()->getValue(),
scaling_.getY()->getValue(),
scaling_.getZ()->getValue());
D3DXMatrixRotationYawPitchRoll(&r,
D3DXToRadian(rotation_.getY()->getValue()),
D3DXToRadian(rotation_.getX()->getValue()),
D3DXToRadian(rotation_.getZ()->getValue()));
D3DXMatrixTranslation(&t,
translation_.getX()->getValue(),
translation_.getY()->getValue(),
translation_.getZ()->getValue());
D3DXMatrixMultiply(matrix, &s, &r);
D3DXMatrixMultiply(matrix, matrix, &t);
}
示例14: D3DXMatrixIdentity
void DXFrame::rotateCam(cam& camr, float dist, float rot, float angle) {
D3DXMATRIX total;
D3DXMATRIX temp;
D3DXVECTOR3 out;
D3DXVECTOR3 scal;
D3DXQUATERNION r;
D3DXMatrixIdentity(&total);
temp = total;
D3DXMatrixTranslation(&total,0,0,-dist);
D3DXMatrixRotationYawPitchRoll(&temp,D3DXToRadian(rot),D3DXToRadian(angle),0);
total *= temp;
D3DXMatrixIdentity(&temp);
D3DXMatrixTranslation(&temp,camr.cam_look_pos.x,camr.cam_look_pos.y,camr.cam_look_pos.z);
total *= temp;
D3DXMatrixDecompose(&scal,&r,&out,&total);
camr.cam_pos = out;
}
示例15: D3DXMatrixRotationYawPitchRoll
void DXCamera::Update(float _dt)
{
D3DXMatrixRotationYawPitchRoll(&m_matrixRotation, m_yaw, m_pitch, 0);
D3DXVec3TransformCoord(&m_vec3Target, &m_vec3DefaultForward, &m_matrixRotation);
D3DXVec3Normalize(&m_vec3Target, &m_vec3Target);
switch (m_type)
{
case eCamera::ECAMERA_DEFAULT:
{
D3DXVec3TransformNormal(&m_vec3Right, &m_vec3DefaultRight, &m_matrixRotation);
D3DXVec3TransformNormal(&m_vec3Forward, &m_vec3DefaultForward, &m_matrixRotation);
D3DXVec3Cross(&m_vec3Up, &m_vec3Forward, &m_vec3Right);
}
break;
case eCamera::ECAMERA_FPS:
{
D3DXMATRIX RotateYTempMatrix;
D3DXMatrixRotationY(&RotateYTempMatrix, m_yaw);
D3DXVec3TransformNormal(&m_vec3Right, &m_vec3DefaultRight, &RotateYTempMatrix);
D3DXVec3TransformNormal(&m_vec3Up, &m_vec3DefaultUp, &RotateYTempMatrix);
D3DXVec3TransformNormal(&m_vec3Forward, &m_vec3DefaultForward, &RotateYTempMatrix);
}
break;
case eCamera::ECAMERA_THIRD:
{
// TODO
}
break;
}
// Update position
m_vec3Position += m_moveLR * m_vec3Right * _dt;
m_vec3Position += m_moveFB * m_vec3Forward * _dt;
// Reset the movement
m_moveLR = 0.0f;
m_moveFB = 0.0f;
// Adjust the target
m_vec3Target = m_vec3Position + m_vec3Target;
D3DXMatrixLookAtLH(&m_matrixView, &m_vec3Position, &m_vec3Target, &m_vec3Up);
}