本文整理汇总了C++中LPDIRECT3DDEVICE9::MultiplyTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE9::MultiplyTransform方法的具体用法?C++ LPDIRECT3DDEVICE9::MultiplyTransform怎么用?C++ LPDIRECT3DDEVICE9::MultiplyTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE9
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE9::MultiplyTransform方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HRESULT HookIDirect3DDevice9::MultiplyTransform(LPVOID _this,
D3DTRANSFORMSTATETYPE Type,
CONST D3DMATRIX* pMatrix)
{
LOG_API();
return pD3Dev->MultiplyTransform(Type, pMatrix);
}
示例2: Render
VOID Render()
{
if ( NULL == g_pd3dDevice )
{
return;
}
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 30, 10, 10 ), 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 );
D3DXMATRIXA16 thisMatrix;
D3DXMatrixTranslation( &thisMatrix, 0.0f, -10.0f, 30.0f );
g_pd3dDevice->MultiplyTransform( D3DTS_WORLD, &thisMatrix );
D3DXMatrixRotationY( &thisMatrix, timeGetTime() / 1000.0f );
g_pd3dDevice->MultiplyTransform( D3DTS_WORLD, &thisMatrix );
D3DXMatrixScaling( &thisMatrix, 1.0f, 1.2f, 1.0f );
g_pd3dDevice->MultiplyTransform( D3DTS_WORLD, &thisMatrix );
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] );
g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
g_pMesh->DrawSubset( i );
}
g_pd3dDevice->EndScene();
}
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
示例3: draw
/**
* モデルを描画する。
* プラットフォームごとの固有設定も行う。
* モデルが設定されてない場合は何もしない。
* @param gl
*/
void LAppModel::draw()
{
if (live2DModel == NULL)return;
// 座標変換退避
D3DXMATRIXA16 buf ;
g_pD3DDevice->GetTransform(D3DTS_WORLD, &buf);//World座標を取得
// モデルの変換を適用
float* tr = modelMatrix->getArray() ;//float[16]
g_pD3DDevice->MultiplyTransform( D3DTS_WORLD , (D3DXMATRIXA16*)tr ) ;
// Live2Dを描画
live2DModel->draw();
g_pD3DDevice->SetTransform(D3DTS_WORLD, &buf);//変換を復元
}
示例4: Render
//.........这里部分代码省略.........
}
// wireframe
if ((_pWBuffer == NULL) && (_pBufVerticesW != NULL))
{
D3DCustomVertexColor* pVAxis(NULL);
pd3dDevice->CreateVertexBuffer(_countVertices*sizeof(D3DCustomVertexColor), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &_pWBuffer, NULL);
_pWBuffer->Lock(0, 0, (void**)&pVAxis, 0);
memcpy(pVAxis, _pBufVerticesW, _countVertices*sizeof(D3DCustomVertexColor));
_pWBuffer->Unlock();
// once used buffers are deleteable
delete[] _pBufVerticesW;
_pBufVerticesW = NULL;
}
// render object
bool renderObject(!glConfig._dxShowWireframe);
// - with texture?
if (glConfig._dxShowTexture)
{
// set texture if given
if (_pTexture != NULL) pd3dDevice->SetTexture(0, _pTexture);
// set solid render state
pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
renderObject = true;
}
// - colored wireframe?
else if (glConfig._dxShowColorWire)
{
// set wireframe render state
pd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
renderObject = true;
}
// - something to render solid/colored?
if (renderObject)
{
pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // show both sides of face
pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); // enable z buffer
// alpha properties?
if (_pAlpha != NULL)
{
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); // enable alpha blending
pd3dDevice->SetRenderState(D3DRS_SRCBLEND, _pAlpha->_source); // source alpha
pd3dDevice->SetRenderState(D3DRS_DESTBLEND, _pAlpha->_destination); // destination alpha
pd3dDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1, _pAlpha->_argument); // alpha source (diffuse/texture)
}
else
{
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false); // disable alpha blending
}
pd3dDevice->SetMaterial (&_material); // set material
pd3dDevice->SetRenderState (D3DRS_LIGHTING, true); // enable light
pd3dDevice->SetTransform (D3DTS_WORLD, &worldMatrix); // set world transformation
pd3dDevice->MultiplyTransform (D3DTS_WORLD, &_transform); // transform local object into world
pd3dDevice->SetStreamSource (0, _pVBuffer, 0, sizeof(D3DCustomVertexColNormTex)); // set vertices source
pd3dDevice->SetIndices (_pIBuffer); // set indices source
pd3dDevice->SetFVF (D3DFVF_CUSTOMVERTEX_COLNORMTEX); // set vertex style
pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, _countVertices, 0, _countIndices/3); // render
pd3dDevice->SetTexture (0, NULL);
} // if (renderObject)
// - something to render pure wireframe?
if (((glConfig._dxShowWireframe && !glConfig._dxShowColorWire) || _isSelected) && (_pWBuffer != NULL))
{
D3DXMATRIX matBias;
// create scale matrix
D3DXMatrixScaling(&matBias, 1.005f, 1.005f, 1.005f);
// set object transformation if not done yet
if (!renderObject)
{
pd3dDevice->SetMaterial (&_material); // set material
pd3dDevice->SetTransform (D3DTS_WORLD, &worldMatrix); // set world transformation
pd3dDevice->MultiplyTransform (D3DTS_WORLD, &_transform); // transform local object into world
}
pd3dDevice->MultiplyTransform (D3DTS_WORLD, &matBias); // re-scale object in world view
pd3dDevice->SetTexture (0, NULL); // no texture
pd3dDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, false); // disable alpha blending
pd3dDevice->SetRenderState (D3DRS_FILLMODE, D3DFILL_WIREFRAME); // forced wireframe
pd3dDevice->SetRenderState (D3DRS_LIGHTING, false); // disable light
pd3dDevice->SetStreamSource (0, _pWBuffer, 0, sizeof(D3DCustomVertexColor)); // set vertices source
pd3dDevice->SetIndices (_pIBuffer); // set indices source
pd3dDevice->SetFVF (D3DFVF_CUSTOMVERTEX_COLOR); // set vertex style
pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, _countVertices, 0, _countIndices/3); // render
} // if (glConfig._dxShowWireframe && !glConfig._dxShowColorWire)
return true;
}
示例5: Render
VOID Render()
{
if ( NULL == g_pd3dDevice )
{
return;
}
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
D3DCOLOR_XRGB( 30, 10, 10 ), 1.0f, 0 );
if ( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
{
SetupLights();
SetupMatrices();
if ( g_Tick )
{
g_pd3dDevice->SetTexture( 0, g_pTexture1 );
}
else
{
g_pd3dDevice->SetTexture( 0, g_pTexture2 );
}
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 );
#ifdef SHOW_HOW_TO_USE_TCI
D3DXMATRIXA16 mTextureTransform;
D3DXMATRIXA16 mProj;
D3DXMATRIXA16 mTrans;
D3DXMATRIXA16 mScale;
g_pd3dDevice->GetTransform( D3DTS_PROJECTION , &mProj );
D3DXMatrixTranslation( &mTrans , 0.5f , 0.5f , 0.0f );
D3DXMatrixScaling( &mScale , 0.5f , -0.5f , 1.0f );
mTextureTransform = mProj * mScale * mTrans;
g_pd3dDevice->SetTransform( D3DTS_TEXTURE0 , &mTextureTransform );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT4 | D3DTTFF_PROJECTED );
g_pd3dDevice->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION );
#endif
g_pd3dDevice->SetStreamSource( 0, g_pVB1, 0, sizeof( CUSTOMVERTEX ) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 * 50 - 2 );
if ( g_Tick )
{
g_pd3dDevice->SetTexture( 0, g_pTexture2 );
}
else
{
g_pd3dDevice->SetTexture( 0, g_pTexture1 );
}
g_pd3dDevice->SetStreamSource( 0, g_pVB2, 0, sizeof( CUSTOMVERTEX ) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 * 50 - 2 );
float scale = sinf( static_cast<float>( D3DX_PI * timeGetTime() / 1000 ) ) * 0.8f;
D3DXMATRIXA16 thisMatrix, prevMatrix;
g_pd3dDevice->GetTransform( D3DTS_WORLD, &prevMatrix );
D3DXMATRIXA16 matFirstTiger, matTrans, matRotate;
D3DXMatrixRotationY( &matRotate, timeGetTime() / 1000.0f );
D3DXMatrixTranslation( &matTrans, -3.f, 2.0f, 5.0f );
D3DXMatrixMultiply( &matFirstTiger, &matRotate, &matTrans );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &matFirstTiger );
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] );
g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
g_pMesh->DrawSubset( i );
}
g_pd3dDevice->SetTransform( D3DTS_WORLD, &prevMatrix );
D3DXMatrixTranslation( &thisMatrix, 3.0f, 2.0f, 5.0f );
g_pd3dDevice->MultiplyTransform( D3DTS_WORLD, &thisMatrix );
D3DXMatrixScaling( &thisMatrix, -scale + 1.0f, 1.0f, 1.0f );
g_pd3dDevice->MultiplyTransform( D3DTS_WORLD, &thisMatrix );
for ( DWORD i = 0; i < g_dwNumMaterials; ++i )
{
g_pd3dDevice->SetMaterial( &g_pMeshMaterials[i] );
g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
g_pMesh->DrawSubset( i );
}
g_pd3dDevice->EndScene();
}
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
示例6: Render
//----- Render() ------------------------------------------------------------
bool DirectXMeshCollision::Render(LPDIRECT3DDEVICE9 pd3dDevice, D3DXMATRIX& worldMatrix)
{
// early return on non rendering
if ((_renderMode == DXRM_NONE) || _forceNoRender) return true;
// create DX parameters if not existing
if (_vecVBuffer.empty())
{
for (unsigned int idxShape(0); idxShape < _vecVertices.size(); ++idxShape)
{
// vertices
LPDIRECT3DVERTEXBUFFER9 pVBuffer (NULL);
D3DCustomVertex* pVModel(NULL);
D3DCustomVertex* pVertices (_vecVertices[idxShape]);
unsigned int countVertices(_vecCountVertices[idxShape]);
pd3dDevice->CreateVertexBuffer(countVertices*sizeof(D3DCustomVertex), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &pVBuffer, NULL);
pVBuffer->Lock(0, 0, (void**)&pVModel, 0);
for (unsigned int i(0); i < countVertices; ++i)
{
pVModel[i]._x = pVertices[i]._x;
pVModel[i]._y = pVertices[i]._y;
pVModel[i]._z = pVertices[i]._z;
pVModel[i]._color = _wireframeColor;
}
pVBuffer->Unlock();
_vecVBuffer.push_back(pVBuffer);
// indices
if (_vecIBuffer.size() < _vecVBuffer.size())
{
LPDIRECT3DINDEXBUFFER9 pIBuffer (NULL);
unsigned short* pIModel(NULL);
unsigned short* pIndices (_vecIndices[idxShape]);
unsigned int countIndices(_vecCountIndices[idxShape]);
pd3dDevice->CreateIndexBuffer(countIndices*sizeof(unsigned short), D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_MANAGED, &pIBuffer, NULL);
pIBuffer->Lock(0, 0, (void**)&pIModel, 0);
memcpy(pIModel, pIndices, countIndices*sizeof(unsigned short));
pIBuffer->Unlock();
_vecIBuffer.push_back(pIBuffer);
}
} // for (unsigned int idxShape(0); idxShape < _vesVertices.size(); ++idxShape)
} // if (_vecVBuffer.empty())
// wireframe?
if (_renderMode == DXRM_WIREFRAME)
{
pd3dDevice->SetTransform (D3DTS_WORLD, &worldMatrix); // set world transformation
pd3dDevice->MultiplyTransform (D3DTS_WORLD, &_transform); // transform local object into world
pd3dDevice->SetTexture (0, NULL); // no texture
pd3dDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, false); // disable alpha blending
pd3dDevice->SetRenderState (D3DRS_FILLMODE, D3DFILL_WIREFRAME); // forced wireframe
pd3dDevice->SetRenderState (D3DRS_LIGHTING, false); // disable light
pd3dDevice->SetFVF (D3DFVF_CUSTOMVERTEX_COLOR); // set vertex style
for (unsigned int idxShape(0); idxShape < _vecVBuffer.size(); ++idxShape)
{
pd3dDevice->SetStreamSource (0, _vecVBuffer[idxShape], 0, sizeof(D3DCustomVertex)); // set vertices source
pd3dDevice->SetIndices (_vecIBuffer[idxShape]); // set indices source
unsigned int countIndices (_vecCountIndices[idxShape]);
unsigned int countVertices(_vecCountVertices[idxShape]);
switch (_vecPrimitiveType[idxShape])
{
case D3DPT_TRIANGLELIST:
{
countIndices = countIndices/3;
countVertices = countVertices;
break;
}
case D3DPT_LINELIST:
{
countIndices = countIndices/2;
countVertices = countVertices;
break;
}
}
pd3dDevice->DrawIndexedPrimitive(_vecPrimitiveType[idxShape], 0, 0, countVertices, 0, countIndices); // render
} // for (unsigned int idxShape(0); idxShape < _vecVBuffer.size(); ++idxShape)
}
return true;
}