/// <summary> /// Prepare for rendering /// </summary> /// <param name="information">Rendering Information</param> public void Apply(SkinShaderInformation information) { Shader.Apply(); if (IsAnimated) { SkinShaderInformation info = new SkinShaderInformation(); info.World = Node.PreComputed * information.World; info.Trasform = information.Trasform; Device.DeviceContext.UpdateSubresource(ref info, transformBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(0, transformBuffer); Matrix[] m = Node.Skinning.GetPalette(); Device.DeviceContext.UpdateSubresource(m, paletteBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(1, paletteBuffer); } else { Matrix currentMat = Node.GetNodeMatrix(); SkinShaderInformation info = new SkinShaderInformation(); info.World = currentMat * information.World; info.Trasform = currentMat * information.Trasform; Device.DeviceContext.UpdateSubresource(ref info, transformBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(0, transformBuffer); } Device.DeviceContext.PixelShader.SetShaderResource(0, Material.DiffuseTexture); Device.DeviceContext.PixelShader.SetShaderResource(1, Material.NormalTexture); }
/// <summary> /// Draw Animated Model /// </summary> /// <param name="device">Device</param> /// <param name="information">Information</param> public void Draw(SharpDevice device, SkinShaderInformation information) { //Iterate each geometry foreach (Geometry g in Geometries) { g.Apply(information); g.Draw(device.DeviceContext); } }
/// <summary> /// Draw Animated Model /// </summary> /// <param name="device">Device</param> /// <param name="information">Information</param> public void Draw(SharpDevice device,SkinShaderInformation information) { //Iterate each geometry foreach (Geometry g in Geometries) { g.Apply(information); g.Draw(device.DeviceContext); } }
/// <summary> /// Prepare for rendering /// </summary> /// <param name="information">Rendering Information</param> public void Apply(SkinShaderInformation information) { Shader.Apply(); if (IsAnimated) { SkinShaderInformation info = new SkinShaderInformation(); info.World = Node.PreComputed * information.World; info.Trasform = information.Trasform; Device.DeviceContext.UpdateSubresource(ref info, transformBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(0, transformBuffer); Matrix[] m = Node.Skinning.GetPalette(); Device.DeviceContext.UpdateSubresource(m, paletteBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(1, paletteBuffer); } else { Matrix currentMat = Node.GetNodeMatrix(); SkinShaderInformation info = new SkinShaderInformation(); info.World = currentMat * information.World; info.Trasform = currentMat * information.Trasform; Device.DeviceContext.UpdateSubresource(ref info, transformBuffer); Device.DeviceContext.VertexShader.SetConstantBuffer(0, transformBuffer); } Device.DeviceContext.PixelShader.SetShaderResource(0, Material.DiffuseTexture); Device.DeviceContext.PixelShader.SetShaderResource(1, Material.NormalTexture); }