本文整理汇总了C++中CTexture::pGetTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::pGetTexture方法的具体用法?C++ CTexture::pGetTexture怎么用?C++ CTexture::pGetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::pGetTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void CTriangle::Render( uint32 i_iPass )
{
switch( i_iPass )
{
case ePass_Lighting: break;
}
CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics();
CCamera *pCurCamera = pGraphics->pGetCurCamera();
matrix44 matWorld; matMatrix44Identity( matWorld );
pCurCamera->SetWorldMatrix( matWorld );
m_pVertexShader->SetMatrix( m3dsc_worldmatrix, pCurCamera->matGetWorldMatrix() );
m_pVertexShader->SetMatrix( m3dsc_viewmatrix, pCurCamera->matGetViewMatrix() );
m_pVertexShader->SetMatrix( m3dsc_projectionmatrix, pCurCamera->matGetProjectionMatrix() );
m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() );
vector3 vCamPos = pCurCamera->vGetPosition();
m_pVertexShader->SetVector( 0, vector4( vCamPos.x, vCamPos.y, vCamPos.z, 0 ) );
CLight *pLight = m_pParent->pGetCurrentLight();
vector3 vLightPos = pLight->vGetPosition();
m_pVertexShader->SetVector( 1, vector4( vLightPos.x, vLightPos.y, vLightPos.z, 0 ) );
m_pPixelShader->SetVector( 0, pLight->vGetColor() );
pGraphics->SetVertexFormat( m_pVertexFormat );
pGraphics->SetVertexStream( 0, m_pVertexBuffer, 0, sizeof( vertexformat ) );
pGraphics->SetVertexShader( m_pVertexShader );
pGraphics->SetPixelShader( m_pPixelShader );
CResManager *pResManager = m_pParent->pGetParent()->pGetResManager();
CTexture *pTexture = (CTexture *)pResManager->pGetResource( m_hTexture );
pGraphics->SetTexture( 0, pTexture->pGetTexture() );
CTexture *pNormalmap = (CTexture *)pResManager->pGetResource( m_hNormalmap );
pGraphics->SetTexture( 1, pNormalmap->pGetTexture() );
for( uint32 i = 0; i < 2; ++i )
{
pGraphics->SetTextureSamplerState( i, m3dtss_addressu, m3dta_clamp );
pGraphics->SetTextureSamplerState( i, m3dtss_addressv, m3dta_clamp );
}
pGraphics->pGetM3DDevice()->DrawPrimitive( m3dpt_trianglelist, 0, 1 );
}
示例2: Render
void CBubble::Render( uint32 i_iPass )
{
switch( i_iPass )
{
case ePass_Default: break;
}
CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics();
CCamera *pCurCamera = pGraphics->pGetCurCamera();
matrix44 matWorld; matMatrix44Identity( matWorld );
pCurCamera->SetWorldMatrix( matWorld );
m_pVertexShader->SetMatrix( m3dsc_worldmatrix, pCurCamera->matGetWorldMatrix() );
m_pVertexShader->SetMatrix( m3dsc_viewmatrix, pCurCamera->matGetViewMatrix() );
m_pVertexShader->SetMatrix( m3dsc_projectionmatrix, pCurCamera->matGetProjectionMatrix() );
m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() );
CResManager *pResManager = m_pParent->pGetParent()->pGetResManager();
CTexture *pRainbowFilm = (CTexture *)pResManager->pGetResource( m_hRainbowFilm );
pGraphics->SetTexture( 0, pRainbowFilm->pGetTexture() );
CTexture *pEnvironment = (CTexture *)pResManager->pGetResource( m_hEnvironment );
pGraphics->SetTexture( 1, pEnvironment->pGetTexture() );
m_pVertexShader->SetFloat( 0, pGraphics->pGetParent()->fGetElapsedTime() );
m_pVertexShader->SetVector( 0, pCurCamera->vGetPosition() );
pGraphics->SetVertexFormat( m_pVertexFormat );
pGraphics->SetVertexStream( 0, m_pVertexBuffer, 0, sizeof( vertexformat ) );
pGraphics->SetIndexBuffer( m_pIndexBuffer );
pGraphics->SetVertexShader( m_pVertexShader );
pGraphics->SetPixelShader( m_pPixelShader );
pGraphics->SetRenderState( m3drs_cullmode, m3dcull_cw );
pGraphics->pGetM3DDevice()->DrawIndexedPrimitive( m3dpt_trianglelist,
0, 0, m_iNumVertices, 0, m_iNumPrimitives );
pGraphics->SetRenderState( m3drs_cullmode, m3dcull_ccw );
pGraphics->pGetM3DDevice()->DrawIndexedPrimitive( m3dpt_trianglelist,
0, 0, m_iNumVertices, 0, m_iNumPrimitives );
}
示例3: Render
void CSphericalLight::Render( uint32 i_iPass )
{
switch( i_iPass )
{
case ePass_Leaf: return;
case ePass_SphericalLight: break;
}
CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics();
float32 fX = 1.2f * sinf( 1.5f * pGraphics->pGetParent()->fGetElapsedTime() );
CCamera *pCurCamera = pGraphics->pGetCurCamera();
matrix44 matWorld; matMatrix44Translation( matWorld, fX, 0.0f, 0.0f );
pCurCamera->SetWorldMatrix( matWorld );
m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() );
m_pPixelShader->SetVector( 0, m_vColor );
m_pVertexShader->SetFloat( 0, 0.0f );
m_pPixelShader->SetFloat( 0, 0.0f );
pGraphics->SetVertexFormat( m_pVertexFormatSphere );
pGraphics->SetVertexStream( 0, m_pVertexBufferSphere, 0, sizeof( vertexformatsphere ) );
pGraphics->SetVertexShader( m_pVertexShader );
pGraphics->SetPixelShader( m_pPixelShader );
pGraphics->SetPrimitiveAssembler( m_pPrimitiveAssemblerSphere );
if( !m_iMaxVisiblePixels )
{
// determine maximum number of pixels that can be rendered - colorwriteenable is false
pGraphics->SetRenderState( m3drs_zenable, false );
pGraphics->SetRenderState( m3drs_colorwriteenable, false );
pGraphics->pGetM3DDevice()->DrawDynamicPrimitive( 0, m_iNumVertices );
m_iMaxVisiblePixels = pGraphics->pGetM3DDevice()->iGetRenderedPixels();
pGraphics->SetRenderState( m3drs_zenable, true );
pGraphics->SetRenderState( m3drs_colorwriteenable, true );
}
pGraphics->pGetM3DDevice()->DrawDynamicPrimitive( 0, m_iNumVertices );
uint32 iRenderedPixels = pGraphics->pGetM3DDevice()->iGetRenderedPixels();
if( !iRenderedPixels )
return;
// Now render the flare ---------------------------------------------------
m_pVertexShader->SetFloat( 0, 1.0f );
m_pPixelShader->SetFloat( 0, 1.0f );
pGraphics->SetVertexFormat( m_pVertexFormatFlare );
pGraphics->SetVertexStream( 0, m_pVertexBufferFlare, 0, sizeof( vertexformatflare ) );
CResManager *pResManager = m_pParent->pGetParent()->pGetResManager();
CTexture *pFlare = (CTexture *)pResManager->pGetResource( m_hFlare );
pGraphics->SetTexture( 0, pFlare->pGetTexture() );
pGraphics->SetTextureSamplerState( 0, m3dtss_addressu, m3dta_clamp );
pGraphics->SetTextureSamplerState( 0, m3dtss_addressv, m3dta_clamp );
pGraphics->SetRenderState( m3drs_zenable, false );
m_pPixelShader->SetFloat( 1, (float32)iRenderedPixels / (float32)m_iMaxVisiblePixels );
pGraphics->pGetM3DDevice()->DrawPrimitive( m3dpt_trianglefan, 0, 2 );
}