/// <summary> /// Draw this instance of the BasicModel mesh /// </summary> /// <param name="context">Rendering context to use for the draw calls</param> /// <param name="effect">BasicEffect to use for the draw call</param> /// <param name="viewProj">ViewProj combined matrix</param> public void Draw(DeviceContext context, BasicEffect effect, Matrix viewProj) { var world = World; var worldInverseTranspose = MathF.InverseTranspose(world); var worldViewProj = world * viewProj; effect.SetWorld(World); effect.SetWorldInvTranspose(worldInverseTranspose); effect.SetWorldViewProj(worldViewProj); effect.SetTextureTransform(Matrix.Identity); for (int i = 0; i < Model.SubsetCount; ++i) { effect.SetMaterial(Model.Materials[i]); // TODO KAM: Remove this shim if (Model.DiffuseMapSRV.Count > 0) { effect.SetDiffuseMap(Model.DiffuseMapSRV[i]); } effect.ColorTech.GetPassByIndex(0).Apply(context); Model.ModelMesh.Draw(context, i); } }