// THIS Function should be removed when we go to the full render object implementation - it's // temporary on the path to full render objects. The D3D pipe render model path call this guy to do // the transform and lighting stuff. void CD3DSkelMesh::Render(ModelInstance *pInstance, D3DMATRIX* pD3DTransforms, CD3DRenderStyle* pRenderStyle, uint32 iRenderPass) { switch (m_eRenderMethod) { case eD3DRenderDirect : { // We need to do the bone walk, but we can render direct (they've been pre-processed into triangle group/bone group order)... uint32 iCurrentPolyIndex = 0; int32 nNumActiveBones = -1; for( int32 iBoneSet = 0; (iBoneSet < (int32)m_iBoneSetCount) ; ++iBoneSet ) { BoneSetListItem* pBoneSet = &m_pBoneSetArray[iBoneSet]; nNumActiveBones = SetTransformsToBoneSet(pBoneSet,pD3DTransforms, nNumActiveBones); // Set the vertex shader constants. if (m_pVertexShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnVertexShaderSetConstants(m_pVertexShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTVertexShaderMgr::GetSingleton().SetVertexShaderConstants(m_pVertexShader); } // Set the pixel shader constants. if (m_pPixelShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnPixelShaderSetConstants(m_pPixelShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTPixelShaderMgr::GetSingleton().SetPixelShaderConstants(m_pPixelShader); } RSD3DOptions rsD3DOptions; pRenderStyle->GetDirect3D_Options(&rsD3DOptions); if(rsD3DOptions.bUseEffectShader) { LTEffectImpl* _pEffect = (LTEffectImpl*)LTEffectShaderMgr::GetSingleton().GetEffectShader(rsD3DOptions.EffectShaderID); ID3DXEffect* pEffect = _pEffect->GetEffect(); if(pEffect) { i_client_shell->OnEffectShaderSetParams((LTEffectShader*)_pEffect, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); pEffect->SetInt("BoneCount", nNumActiveBones); pEffect->CommitChanges(); } } m_VBController.Render( pBoneSet->iFirstVertIndex, iCurrentPolyIndex, pBoneSet->iVertCount, (pBoneSet->iIndexIntoIndexBuff - iCurrentPolyIndex)/3); iCurrentPolyIndex = pBoneSet->iIndexIntoIndexBuff; IncFrameStat(eFS_ModelRender_NumSkeletalRenderObjects, 1); } break; } case eD3DRenderMatrixPalettes : { uint32 nNumActiveBones = SetMatrixPalette(m_iMinBone,m_iMaxBone,pD3DTransforms); // Set the vertex shader constants. if (m_pVertexShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnVertexShaderSetConstants(m_pVertexShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTVertexShaderMgr::GetSingleton().SetVertexShaderConstants(m_pVertexShader); } // Set the pixel shader constants. if (m_pPixelShader != NULL) { // Let the client set some constants. if (NULL != i_client_shell) { i_client_shell->OnPixelShaderSetConstants(m_pPixelShader, iRenderPass, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); } // Send the constants to the video card. LTPixelShaderMgr::GetSingleton().SetPixelShaderConstants(m_pPixelShader); } RSD3DOptions rsD3DOptions; pRenderStyle->GetDirect3D_Options(&rsD3DOptions); if(rsD3DOptions.bUseEffectShader) { LTEffectImpl* _pEffect = (LTEffectImpl*)LTEffectShaderMgr::GetSingleton().GetEffectShader(rsD3DOptions.EffectShaderID); ID3DXEffect* pEffect = _pEffect->GetEffect(); if(pEffect) { i_client_shell->OnEffectShaderSetParams((LTEffectShader*)_pEffect, pRenderStyle, pInstance, LTShaderDeviceStateImp::GetSingleton()); pEffect->SetInt("BoneCount", nNumActiveBones); pEffect->CommitChanges(); } } m_VBController.Render(0,0,m_iVertCount,m_iPolyCount); break; } } }
void ShaderParamInt< EffectShader >::setParam( Renderer& renderer, void* shaderPtr ) { ID3DXEffect* dxEffect = reinterpret_cast< ID3DXEffect* >( shaderPtr ); dxEffect->SetInt( m_name.c_str(), m_val ); }