当前位置: 首页>>代码示例>>C++>>正文


C++ CShader::getParamBySemantic方法代码示例

本文整理汇总了C++中CShader::getParamBySemantic方法的典型用法代码示例。如果您正苦于以下问题:C++ CShader::getParamBySemantic方法的具体用法?C++ CShader::getParamBySemantic怎么用?C++ CShader::getParamBySemantic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CShader的用法示例。


在下文中一共展示了CShader::getParamBySemantic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawMeshFrame

void CAnimationInstance::DrawMeshFrame( D3DXFRAME_ANIM * pFrame)
{
	//! TODO: Insert code to draw the mesh here.
	HRESULT hr = S_OK;
	D3DXFRAME_ANIM * pAnimFrame = pFrame;
	D3DXMESHCONTAINER_ANIM * pMeshContainer = (D3DXMESHCONTAINER_ANIM *)pFrame->pMeshContainer;
	CShader* pShader;
	CMaterial* pMat;

	unsigned int uiAttrib;
	LPD3DXBONECOMBINATION pBoneCombination;

	unsigned int uiMatrixIndex;
	unsigned int uiPaletteEntry;
	D3DXMATRIXA16 matrixTemp;
	D3DCAPS9 d3dCaps;
	m_pAnimatedMesh->m_pD3DDevice->GetDeviceCaps(&d3dCaps);

	//! Check to see that there is Skinning Information
	if( pFrame->pMeshContainer->pSkinInfo != NULL)
	{
		//! Draw via Indexed HLSL VertexShader
		pBoneCombination = reinterpret_cast<LPD3DXBONECOMBINATION>(pMeshContainer->pBoneCombinationBuffer->GetBufferPointer());

		for( uiAttrib = 0; uiAttrib < pMeshContainer->NumAttributeGroups; uiAttrib++)
		{
			//! Calculate all the world matrices.
			for( uiPaletteEntry = 0; uiPaletteEntry < pMeshContainer->NumPaletteEntries; uiPaletteEntry++)
			{
				uiMatrixIndex = pBoneCombination[uiAttrib].BoneId[uiPaletteEntry];

				if( uiMatrixIndex != UINT_MAX)
				{
					D3DXMatrixMultiply( &m_pAnimatedMesh->m_pBoneMatrices[uiPaletteEntry], &pMeshContainer->pBoneOffsetMatrices[uiMatrixIndex], pMeshContainer->ppBoneMatrixPointers[uiMatrixIndex]);
				}
			}

			// Draw Mesh
			// (MR): Modified rendering code to work with shader management
			if(uiAttrib < pMeshContainer->NumMaterials)
				pMat = pMeshContainer->ppMaterials[uiAttrib];
			else
				pMat = pMeshContainer->ppMaterials[0];
			pShader = pMat->getShader();
			CShaderParam& oMatWorldArray = pShader->getParamBySemantic("WorldMatrixArray");
			if(oMatWorldArray.isValid())
				oMatWorldArray.setMatrixArray(m_pAnimatedMesh->m_pBoneMatrices, pMeshContainer->NumPaletteEntries);
			CShaderParam& oBoneCount = pShader->getParamBySemantic("BlendIndexCount");
			if(oBoneCount.isValid())
				oBoneCount = pMeshContainer->NumInfl - 1;

			//! Start Effect.  All parameters should be updated at this point.
			CShaderManager::getInstance().beginObjectRender();

			pMat->begin();
			for(unsigned int uiPass = 0; uiPass < pMat->getNumPasses(); uiPass++)
			{
				CShaderManager::getInstance().beginPass();
				pMat->beginPass(uiPass);
				//! Draw the subset with the current material and world matrix palette
				pMeshContainer->MeshData.pMesh->DrawSubset(uiAttrib);
				pMat->endPass();
			}
			pMat->end();
		}
	}
	
}
开发者ID:mattrudder,项目名称:AckZombies,代码行数:68,代码来源:AnimationInstance.cpp


注:本文中的CShader::getParamBySemantic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。