本文整理汇总了C++中D3DXMatrixMultiply函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DXMatrixMultiply函数的具体用法?C++ D3DXMatrixMultiply怎么用?C++ D3DXMatrixMultiply使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D3DXMatrixMultiply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: D3DXMatrixRotationY
void CCamera::YRotate ( int iID, float fY )
{
// rotate the camera on it's y axis
// update internal pointer
if ( !this->UpdatePtr ( iID ) )
return;
D3DXMatrixLookAtLH
(
&m_ptr->matView,
&D3DXVECTOR3 ( m_ptr->fX, m_ptr->fY, m_ptr->fZ ),
&D3DXVECTOR3 ( 0.0f, 0.0f, 0.0f ),
&D3DXVECTOR3 ( 0.0f, 1.0f, 0.0f )
);
D3DXMatrixRotationY ( &m_ptr->matRotateY, fY );
D3DXMatrixMultiply ( &m_ptr->matView, &m_ptr->matView, &m_ptr->matRotateY );
m_pD3D->SetTransform ( D3DTS_VIEW, &m_ptr->matView );
}
示例2: D3DXMatrixMultiply
//-----------------------------------------------------------------------------
// Name:
// Desc:
//-----------------------------------------------------------------------------
HRESULT CD3DFrame::Render( LPDIRECT3DDEVICE8 pd3dDevice, BOOL bDrawOpaqueSubsets,
BOOL bDrawAlphaSubsets )
{
D3DXMATRIX matSavedWorld, matWorld;
pd3dDevice->GetTransform( D3DTS_WORLD, &matSavedWorld );
D3DXMatrixMultiply( &matWorld, &m_mat, &matSavedWorld );
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
if( m_pMesh )
m_pMesh->Render( pd3dDevice, bDrawOpaqueSubsets, bDrawAlphaSubsets );
if( m_pChild )
m_pChild->Render( pd3dDevice, bDrawOpaqueSubsets, bDrawAlphaSubsets );
pd3dDevice->SetTransform( D3DTS_WORLD, &matSavedWorld );
if( m_pNext )
m_pNext->Render( pd3dDevice, bDrawOpaqueSubsets, bDrawAlphaSubsets );
return S_OK;
}
示例3: renderchain_set_mvp
static void renderchain_set_mvp(
cg_renderchain_t *chain,
void *vertex_program,
unsigned vp_width, unsigned vp_height,
unsigned rotation)
{
D3DXMATRIX proj, ortho, rot, tmp;
CGprogram vPrg = (CGprogram)vertex_program;
if (!chain)
return;
D3DXMatrixOrthoOffCenterLH(&ortho, 0, vp_width, 0, vp_height, 0, 1);
D3DXMatrixIdentity(&rot);
D3DXMatrixRotationZ(&rot, rotation * (M_PI / 2.0));
D3DXMatrixMultiply(&proj, &ortho, &rot);
D3DXMatrixTranspose(&tmp, &proj);
renderchain_set_shader_mvp(chain, &vPrg, &tmp);
}
示例4: D3DXQuaternionNormalize
void DisplayObject::MoveMesh(){
//D3DXMATRIX matRotateX;
//D3DXMATRIX matRotateY;
D3DXMATRIX matRotate;
D3DXMATRIX matTrans;
D3DXMATRIX matFinal;
D3DXQuaternionNormalize(&_m_rotation, &_m_rotation);
D3DXMatrixRotationQuaternion(&matRotate, &_m_rotation);
//D3DXMatrixRotationX(&matRotateX, rotation.x);
//D3DXMatrixRotationY(&matRotateY, rotation.y);
//D3DXMatrixRotationZ(&matRotateZ, rotation.z);
D3DXMatrixTranslation(&matTrans, _m_pos.x, _m_pos.y, _m_pos.z);
D3DXMatrixMultiply(&matFinal, &matRotate, &matTrans);
//matFinal = matRotate * matTrans;
//matRotate = matRotateZ * matRotateY * matRotateX * matTrans;
m_world = matFinal;
//DXUTGetD3D9Device()->SetTransform(m_world, &(matRotate));
}
示例5: D3DXMatrixMultiply
void CUtilities::ComputeVQSSkeleton( LPD3DXFRAME pRootFrame, LPD3DXFRAME pParentFrame, std::vector<D3DXVECTOR3>& rSkeletonList )
{
//This is going to be recursive
if( pRootFrame == NULL )
{
return;
}
if( !pRootFrame->pFrameFirstChild && !pRootFrame->pFrameSibling )
{
return;
}
if( pParentFrame != NULL )
{
Extra_Frame* parent = (Extra_Frame*)pParentFrame;
Extra_Frame* current = (Extra_Frame*)pRootFrame;
D3DXMATRIX mat_parent = pParentFrame->TransformationMatrix;
D3DXMatrixMultiply( &pRootFrame->TransformationMatrix, ¤t->m_vqsTransform.toMatrix(), &pParentFrame->TransformationMatrix );
D3DXMATRIX mat_current = pRootFrame->TransformationMatrix;
rSkeletonList.push_back( D3DXVECTOR3( mat_parent._41, mat_parent._42, mat_parent._43 ) );
rSkeletonList.push_back( D3DXVECTOR3( mat_current._41, mat_current._42, mat_current._43 ) );
parent->m_vqsTransformToRoot.SetVQS( mat_parent );
current->m_vqsTransformToRoot.SetVQS( mat_current );
}
if( pRootFrame->pFrameFirstChild )
{
ComputeVQSSkeleton( pRootFrame->pFrameFirstChild, pRootFrame, rSkeletonList );
}
if( pRootFrame->pFrameSibling )
{
ComputeVQSSkeleton( pRootFrame->pFrameSibling, pParentFrame, rSkeletonList );
}
}
示例6: UpdateInput
//-------------------------------------------------------------
// Name: FrameMove()
// Desc: �� �����Ӹ��� ȣ���. �ִϸ��̼� ó���� ���
//-------------------------------------------------------------
HRESULT CMyD3DApplication::FrameMove()
{
UpdateInput( &m_UserInput );// ���̓f�[�^�̍X�V
//---------------------------------------------------------
// �Է¿� ���� ��ǥ�踦 �����Ѵ�
//---------------------------------------------------------
// ȸ��
D3DXMATRIX m;
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, &matRotX, &matRotY );
// �����
D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 2.73f, -8.0f );
D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 2.73f, 0.0f );
D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtLH( &m_mView, &vFromPt, &vLookatPt, &vUpVec );
m_mView = m * m_mView;
m_pd3dDevice->SetTransform( D3DTS_VIEW, &m_mView );
return S_OK;
}
示例7: Render
VOID Render()
{
g_pD3DDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 0, 0, 255 ), 1.0f, 0 );
if ( SUCCEEDED( g_pD3DDevice->BeginScene() ) )
{
SetupLights();
SetupMatrices();
g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
g_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );
//soldier
D3DXMATRIXA16 matFirstTiger, matTrans, matRotate;
//D3DXMatrixIdentity(&matFirstTiger);
//g_pD3DDevice->GetTransform(D3DTS_WORLD, &matFirstTiger);
D3DXMatrixTranslation( &matTrans, 0.f, -2.f, 0.f );
D3DXMatrixRotationY( &matRotate, timeGetTime() / 1000.0f );
D3DXMatrixMultiply( &matFirstTiger, &matRotate, &matTrans );
g_pD3DDevice->SetTransform( D3DTS_WORLD, &matFirstTiger );
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
g_pD3DDevice->SetMaterial( &g_pMeshMaterials0[i] );
g_pD3DDevice->SetTexture( 0, g_pMeshTextures0[i] );
g_pMesh0->DrawSubset( i );
}
g_pD3DDevice->EndScene();
}
g_pD3DDevice->Present( NULL, NULL, NULL, NULL );
g_tick++;
}
示例8: yAxis
BoundingCone::BoundingCone(const BoundingBox& box, const D3DXMATRIX& projection, const D3DXVECTOR3& apex, const D3DXVECTOR3& direction )
{
m_direction = direction;
const D3DXVECTOR3 yAxis(0.f, 1.f, 0.f);
const D3DXVECTOR3 zAxis(0.f, 0.f, 1.f);
D3DXVec3Normalize(&m_direction, &m_direction);
D3DXVECTOR3 axis = yAxis;
if ( fabsf(D3DXVec3Dot(&yAxis, &m_direction))>0.99f )
{
axis = zAxis;
}
D3DXMatrixLookAtLH( &m_lookAt, &apex, &(apex+m_direction), &axis );
float maxx = 0.f, maxy = 0.f;
m_near = 1e32f;
m_far = 0.f;
D3DXMATRIX concatMatrix;
D3DXMatrixMultiply( &concatMatrix, &projection, &m_lookAt );
D3DXVECTOR3 ppPts[ box.CornerCount ];
box.GetCorners( ppPts );
for(int index=0; index<box.CornerCount; index++)
{
D3DXVECTOR3 vec = ppPts[index];
D3DXVec3TransformCoord(&vec, &vec, &concatMatrix);
maxx = max(maxx, fabsf(vec.x / vec.z));
maxy = max(maxy, fabsf(vec.y / vec.z));
m_near = min(m_near, vec.z);
m_far = max(m_far, vec.z);
}
m_fovx = atanf(maxx);
m_fovy = atanf(maxy);
}
示例9: drawCursor
void drawCursor()
{
double pos[3];
gHaptics.synchFromServo();
gHaptics.getPosition(pos);
pos[2] *= -1; // Reverse Z for DirectX
// Check button state
if (gHaptics.isButtonDown())
{
// Red when button is down
gCursorMaterial.MatD3D.Diffuse.r = 1.0f;
gCursorMaterial.MatD3D.Diffuse.g = 0.0f;
gCursorMaterial.MatD3D.Diffuse.b = 0.0f;
gCursorMaterial.MatD3D.Ambient.r = 1.0f;
gCursorMaterial.MatD3D.Ambient.g = 0.0f;
gCursorMaterial.MatD3D.Ambient.b = 0.0f;
}
else
{
// Teal when button is up
gCursorMaterial.MatD3D.Diffuse.r = 0.0f;
gCursorMaterial.MatD3D.Diffuse.g = 0.5f;
gCursorMaterial.MatD3D.Diffuse.b = 0.5f;
gCursorMaterial.MatD3D.Ambient.r = 0.0f;
gCursorMaterial.MatD3D.Ambient.g = 0.5f;
gCursorMaterial.MatD3D.Ambient.b = 0.5f;
}
//Now position cursor
D3DXMATRIX matXlt;
D3DXMatrixTranslation(&matXlt, (float)pos[0], (float)pos[1], (float)pos[2]);
D3DXMATRIX matWorld;
D3DXMatrixMultiply(&matWorld, &matXlt, &gMatView);
pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
drawMesh(gCursor, gCursorMaterial);
}
示例10: D3DXMatrixMultiply
bool RainParticleSystem::Render(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix,
D3DXMATRIX viewMatrix, D3DXMATRIX projectionMatrix,
float frameTime, float gameTime, XMFLOAT3 camEyePos )
{
HRESULT result;
D3DXMATRIX* ViewProj = new D3DXMATRIX;
cout<< "FireParticle:" << frameTime << "||" << gameTime << "||\n";
//D3DXMatrixTranspose(&worldMatrix, &worldMatrix);
//D3DXMatrixTranspose(&viewMatrix, &viewMatrix);
//D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);
D3DXMatrixMultiply(ViewProj, &viewMatrix, &projectionMatrix);
D3DXMatrixTranspose(ViewProj, ViewProj);
setEmit_Position(camEyePos);
///////// STREAM_OUT/////////
// Set the shader parameters that it will use for rendering.
result = SetShaderParameters_StreamOut(deviceContext, frameTime,gameTime,camEyePos,ViewProj);
if(!result)
{
//return false;
}
// Now render the prepared buffers with the shader.
RenderShader_StreamOut(deviceContext);
result = SetShaderParameters_Draw(deviceContext, frameTime,gameTime,camEyePos,ViewProj);
if(!result)
{
return false;
}
//RenderShader_Draw(deviceContext);
return true;
}
示例11: Vector3
// @brief : 行列の作成
//--------------------------------------------------------------------
void TransLookCameraDx9::CreateMatrix(void)
{
const D3DXVECTOR3 pos = Vector3(Position);
const Camera *cam = Cam();
D3DXMATRIX mtx_rot;
{
D3DXVECTOR3 eye = -Vector3(cam->Eye);
D3DXVECTOR3 at = -Vector3(cam->At);
D3DXVECTOR3 up = -Vector3(cam->Up);
D3DXMatrixLookAtLH(&mtx_rot,&eye,&at,&up);
D3DXMatrixInverse(&mtx_rot,NULL,&mtx_rot);
mtx_rot._14 = mtx_rot._24 = mtx_rot._34 =
mtx_rot._41 = mtx_rot._42 = mtx_rot._43 = 0.0f;
mtx_rot._44 = 1.0f;
}
D3DXMATRIX mtx_pos;
D3DXMatrixTranslation(&mtx_pos,pos.x,pos.y,pos.z);
D3DXMatrixMultiply(&m_Matrix,&mtx_rot,&mtx_pos);
}
示例12: D3DXMatrixRotationYawPitchRoll
bool SpecmapShaderClass::Render(ID3D11DeviceContext* context, int indexCount, D3DXMATRIX world, D3DXMATRIX view, D3DXMATRIX proj, ID3D11ShaderResourceView** texarr, D3DXVECTOR3 lightdir, D3DXVECTOR4 difcolor,D3DXVECTOR3 camerapos, D3DXVECTOR4 speccolor,float specpow)
{
bool result;
D3DXMATRIX rolworld = world;
D3DXMATRIX transworld = world;
D3DXMatrixRotationYawPitchRoll(&rolworld, yaw, pitch, roll);
D3DXMatrixTranslation(&transworld, posx, posy, posz);
D3DXMatrixMultiply(&world, &rolworld, &transworld);
result = SetShaderParameters(context, world, view, proj, texarr, lightdir, difcolor,camerapos,speccolor,specpow);
if (!result)
{
return false;
}
RenderShader(context, indexCount);
return true;
}
示例13: D3DXMatrixMultiply
void SkinnedMesh::Render(Bone *bone) {
if (bone == NULL) bone = (Bone*) m_pRootBone;
//If there is a mesh to render...
if (bone->pMeshContainer != NULL) {
BoneMesh *boneMesh = (BoneMesh*) bone->pMeshContainer;
if (boneMesh->pSkinInfo != NULL) {
// set up bone transforms
int numBones = boneMesh->pSkinInfo->GetNumBones();
for (int i=0; i < numBones; i++)
D3DXMatrixMultiply(&boneMesh->currentBoneMatrices[i],
&boneMesh->boneOffsetMatrices[i],
boneMesh->boneMatrixPtrs[i]);
//Update the skinned mesh
BYTE *src = NULL, *dest = NULL;
boneMesh->OriginalMesh->LockVertexBuffer(D3DLOCK_READONLY, (VOID**)&src);
boneMesh->MeshData.pMesh->LockVertexBuffer(0, (VOID**)&dest);
boneMesh->pSkinInfo->UpdateSkinnedMesh(boneMesh->currentBoneMatrices, NULL, src, dest);
boneMesh->MeshData.pMesh->UnlockVertexBuffer();
boneMesh->OriginalMesh->UnlockVertexBuffer();
//Render the mesh
for (int i = 0; i < (int) boneMesh->NumAttributeGroups; i++) {
int mtrlIndex = boneMesh->attributeTable[i].AttribId;
g_pDevice->SetMaterial(&(boneMesh->materials[mtrlIndex]));
g_pDevice->SetTexture(0, boneMesh->textures[mtrlIndex]);
boneMesh->MeshData.pMesh->DrawSubset(mtrlIndex);
}
}
}
if (bone->pFrameSibling != NULL) Render((Bone*) bone->pFrameSibling);
if (bone->pFrameFirstChild != NULL) Render((Bone*) bone->pFrameFirstChild);
}
示例14: eye
//----------------------------------------------------------------------------//
void Direct3D10RenderTarget::updateMatrix() const
{
const float fov = 0.523598776f;
const float w = d_area.getWidth();
const float h = d_area.getHeight();
const float aspect = w / h;
const float midx = w * 0.5f;
const float midy = h * 0.5f;
d_viewDistance = midx / (aspect * 0.267949192431123f);
D3DXVECTOR3 eye(midx, midy, -d_viewDistance);
D3DXVECTOR3 at(midx, midy, 1);
D3DXVECTOR3 up(0, -1, 0);
D3DXMATRIX tmp;
D3DXMatrixMultiply(&d_matrix,
D3DXMatrixLookAtRH(&d_matrix, &eye, &at, &up),
D3DXMatrixPerspectiveFovRH(&tmp, fov, aspect,
d_viewDistance * 0.5f,
d_viewDistance * 2.0f));
d_matrixValid = false;
}
示例15: sizeof
void SkinnedMeshNode::UpdateMatrixPallete()
{
D3DXMATRIX* pDst=NULL;
DWORD offset_bytes = 0;
DWORD offset_line = 0;
DWORD bytesMatrix = sizeof(D3DXMATRIX);
D3DLOCKED_RECT lock;
m_pMatrixPalleteTexture->GetD3DTexture()->LockRect(0,&lock,NULL,D3DLOCK_DISCARD);
DWORD boneSize = m_vecBoneRef.size();
for (DWORD boneIndex=0;boneIndex<boneSize;boneIndex++)
{
pDst = (D3DXMATRIX*)((LPBYTE)lock.pBits + offset_line*lock.Pitch + offset_bytes);
BONEREFINFO& refItem=m_vecBoneRef[boneIndex];
// = refItem.SkinOffset * refItem.pNode->GetWorldTM(); // WorldTM = LocalTM * Parent.WorldTM
D3DXMatrixMultiply(pDst,&refItem.SkinOffset,&refItem.pNode->m_matWorld);
offset_bytes += bytesMatrix;
}
m_pMatrixPalleteTexture->GetD3DTexture()->UnlockRect(0);
m_updateMatrixPallete = true;
}