Esempio n. 1
0
void RendererCommon::ApplyMaterial(const Material& Material, Mesh* const pMesh,
                                   const View& View) {
  SetShaderProgram(Material.GetShaderProgram());

  ApplyRenderState(Material.GetRenderState());

  const uint NumSamplers = Material.GetNumSamplers();
  for (uint SamplerIndex = 0; SamplerIndex < NumSamplers; ++SamplerIndex) {
    ApplySamplerState(SamplerIndex, Material.GetSamplerState(SamplerIndex));
  }

  DEBUGASSERT(Material.GetSDP());
  Material.GetSDP()->SetShaderParameters(this, pMesh, View);
}
Esempio n. 2
0
VOID DMeshRender::Run()
{
	if (!m_isEnabled)
		return ;
	//DDEInitialize::gRootDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
	//DDEInitialize::gRootDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
	//DDEInitialize::gRootDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
	//DDEInitialize::gRootDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
	ApplyRenderState();

	DWORD NumMaterials = m_matRenders.size();
	for (DWORD runIndex = 0; runIndex < NumMaterials; runIndex++)
	{
		m_matRenders[runIndex]->Run();
		m_pMess->DrawSubset(runIndex);
	}

	ApplyOrignRenderState();
}