public void RenderCollisionModel(SharpRenderer renderer) { if (collisionMesh == null) { return; } sceneInformation = new CollisionRenderData() { viewProjection = renderer.viewProjection, ambientColor = new Vector4(0.1f, 0.1f, 0.3f, 1f), lightDirection = new Vector4(-renderer.Camera.GetForward(), 1f), lightDirection2 = new Vector4(renderer.Camera.GetUp(), 1f) }; renderer.Device.SetDefaultBlendState(); renderer.Device.SetCullModeDefault(); renderer.Device.SetFillModeDefault(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.Device.UpdateData(renderer.collisionBuffer, sceneInformation); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.collisionBuffer); renderer.collisionShader.Apply(); collisionMesh.Draw(renderer.Device); }
public static void RenderCollisionModel(Matrix viewProjection, Vector3 lightDirection, Vector3 lightDirection2) { if (collisionMesh == null) { return; } sceneInformation = new CollisionRenderData() { viewProjection = viewProjection, ambientColor = new Vector4(0.1f, 0.1f, 0.3f, 1f), lightDirection = new Vector4(lightDirection, 1f), lightDirection2 = new Vector4(lightDirection2, 1f) }; device.SetDefaultBlendState(); device.SetCullModeDefault(); device.SetFillModeDefault(); device.ApplyRasterState(); device.UpdateAllStates(); device.UpdateData(collisionBuffer, sceneInformation); device.DeviceContext.VertexShader.SetConstantBuffer(0, collisionBuffer); collisionShader.Apply(); collisionMesh.Draw(); }