private void DoPresent() { var customPresent = CustomPresent; if (customPresent != null) { var customPresentArgs = new CustomPresentEventArgs(_time); customPresent(this, customPresentArgs); if (!customPresentArgs.Handled) { Present(_time); } } else { Present(_time); } }
private void OnCustomPresent(object sender, CustomPresentEventArgs e) { var time = e.Time; if (!_isDragging) { _worldMatrix *= Matrix.CreateRotationY(-(float)time.ElapsedGameTime.Milliseconds / 1000f); } Clear(); Model model; lock (_modelLock) model = _model; if (model != null) { // Draw the model. A model can have multiple meshes, so loop. foreach (var mesh in model.Meshes) { // This is where the mesh orientation is set, as well // as our camera and projection. foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = _worldMatrix; effect.View = _viewMatrix; effect.Projection = _projectionMatrix; } // Draw the mesh, using the effects set above. mesh.Draw(); } } e.Handled = true; }