本文整理汇总了C++中LPDIRECT3DDEVICE8::GetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DDEVICE8::GetTexture方法的具体用法?C++ LPDIRECT3DDEVICE8::GetTexture怎么用?C++ LPDIRECT3DDEVICE8::GetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DDEVICE8
的用法示例。
在下文中一共展示了LPDIRECT3DDEVICE8::GetTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCentering
void RageDisplay_D3D::SendCurrentMatrices()
{
RageMatrix m;
RageMatrixMultiply( &m, GetCentering(), GetProjectionTop() );
// Convert to OpenGL-style "pixel-centered" coords
RageMatrix m2 = GetCenteringMatrix( -0.5f, -0.5f, 0, 0 );
RageMatrix projection;
RageMatrixMultiply( &projection, &m2, &m );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)&projection );
g_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)GetViewTop() );
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)GetWorldTop() );
FOREACH_ENUM( TextureUnit, tu )
{
// Optimization opportunity: Turn off texture transform if not using texture coords.
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );
// If no texture is set for this texture unit, don't bother setting it up.
IDirect3DBaseTexture8* pTexture = NULL;
g_pd3dDevice->GetTexture( tu, &pTexture );
if( pTexture == NULL )
continue;
pTexture->Release();
if( g_bSphereMapping[tu] )
{
static const RageMatrix tex = RageMatrix
(
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.0f, 1.0f
);
g_pd3dDevice->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex );
// Tell D3D to use transformed reflection vectors as texture co-ordinate 0
// and then transform this coordinate by the specified texture matrix.
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR );
}
else
{
/* Direct3D is expecting a 3x3 matrix loaded into the 4x4 in order
* to transform the 2-component texture coordinates. We currently
* only use translate and scale, and ignore the z component entirely,
* so convert the texture matrix from 4x4 to 3x3 by dropping z. */
const RageMatrix &tex1 = *GetTextureTop();
const RageMatrix tex2 = RageMatrix
(
tex1.m[0][0], tex1.m[0][1], tex1.m[0][3], 0,
tex1.m[1][0], tex1.m[1][1], tex1.m[1][3], 0,
tex1.m[3][0], tex1.m[3][1], tex1.m[3][3], 0,
0, 0, 0, 0
);
g_pd3dDevice->SetTransform( D3DTRANSFORMSTATETYPE(D3DTS_TEXTURE0+tu), (D3DMATRIX*)&tex2 );
g_pd3dDevice->SetTextureStageState( tu, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_PASSTHRU );
}
}