//---------------------------------------------------------------------------- void SEOpenGLRenderer::OnDisableTexture(SEResourceIdentifier*) { SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; CGparameter hParam = (CGparameter)pSI->GetID(); cgGLDisableTextureParameter(hParam); SE_GL_DEBUG_CG_PROGRAM; }
//---------------------------------------------------------------------------- void SEDX9Renderer::OnDisableTexture(SEResourceIdentifier*) { SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; CGparameter hParam = (CGparameter)pSI->GetID(); ms_hResult = cgD3D9SetTexture(hParam, 0); SE_ASSERT( SUCCEEDED(ms_hResult) ); }
//---------------------------------------------------------------------------- void SEDX10Renderer::OnDisableTexture(SEResourceIdentifier* pID) { SETextureID* pResource = (SETextureID*)pID; SETexture* pTexture = pResource->TextureObject; SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; CGparameter hParam = (CGparameter)pSI->GetID(); cgD3D10SetTextureParameter(hParam, 0); }
//---------------------------------------------------------------------------- void SEOpenGLRenderer::OnEnableTexture(SEResourceIdentifier* pID) { SETextureID* pResource = (SETextureID*)pID; SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; CGparameter hParam = (CGparameter)pSI->GetID(); cgGLSetTextureParameter(hParam, pResource->ID); SE_GL_DEBUG_CG_PROGRAM; cgGLEnableTextureParameter(hParam); SE_GL_DEBUG_CG_PROGRAM; }
//---------------------------------------------------------------------------- void SEDX10Renderer::OnEnableTexture(SEResourceIdentifier* pID) { SETextureID* pResource = (SETextureID*)pID; SETexture* pTexture = pResource->TextureObject; SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; SESamplerInformation::Type eSType = pSI->GetType(); CGparameter hParam = (CGparameter)pSI->GetID(); cgD3D10SetTextureParameter(hParam, pResource->ID); SE_DX10_DEBUG_CG_PROGRAM; cgD3D10SetSamplerStateParameter(hParam, 0); SE_DX10_DEBUG_CG_PROGRAM; }
//---------------------------------------------------------------------------- void SEDX9Renderer::OnEnableTexture(SEResourceIdentifier* pID) { SETextureID* pResource = (SETextureID*)pID; SETexture* pTexture = pResource->TextureObject; SESamplerInformation* pSI = m_apActiveSamplers[m_iCurrentSampler]; SESamplerInformation::Type eSType = pSI->GetType(); CGparameter hParam = (CGparameter)pSI->GetID(); // Set the filter mode. SETexture::FilterType eFType = pTexture->GetFilterType(); if( eFType == SETexture::NEAREST ) { ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_MAGFILTER, D3DTEXF_POINT); SE_ASSERT( SUCCEEDED(ms_hResult) ); } else { ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); SE_ASSERT( SUCCEEDED(ms_hResult) ); } // Set the mipmap mode. ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_MINFILTER, ms_adwTexMinFilter[eFType]); SE_ASSERT( SUCCEEDED(ms_hResult) ); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_MIPFILTER, ms_adwTexMipFilter[eFType]); SE_ASSERT( SUCCEEDED(ms_hResult) ); // Set the border color (for clamp to border). const SEColorRGBA& rBorderColor = pTexture->GetBorderColor(); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_BORDERCOLOR, D3DCOLOR_COLORVALUE(rBorderColor.R, rBorderColor.G, rBorderColor.B, rBorderColor.A)); SE_ASSERT( SUCCEEDED(ms_hResult) ); switch( eSType ) { case SESamplerInformation::SAMPLER_1D: { ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSU, ms_adwTexWrapMode[pTexture->GetWrapType(0)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSV, ms_adwTexWrapMode[pTexture->GetWrapType(0)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); break; } case SESamplerInformation::SAMPLER_2D: case SESamplerInformation::SAMPLER_PROJ: case SESamplerInformation::SAMPLER_CUBE: { ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSU, ms_adwTexWrapMode[pTexture->GetWrapType(0)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSV, ms_adwTexWrapMode[pTexture->GetWrapType(1)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); break; } case SESamplerInformation::SAMPLER_3D: { ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSU, ms_adwTexWrapMode[pTexture->GetWrapType(0)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSV, ms_adwTexWrapMode[pTexture->GetWrapType(1)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); ms_hResult = cgD3D9SetSamplerState(hParam, D3DSAMP_ADDRESSW, ms_adwTexWrapMode[pTexture->GetWrapType(2)]); SE_ASSERT( SUCCEEDED(ms_hResult) ); break; } default: SE_ASSERT( false ); break; } ms_hResult = cgD3D9SetTexture(hParam, pResource->ID); SE_ASSERT( SUCCEEDED(ms_hResult) ); }