public Game() { machWindow = new MachWindow(); ModelReader mr = new ModelReader(); GraphicsDeviceOptions options = new GraphicsDeviceOptions( debug: false, swapchainDepthFormat: PixelFormat.R16_UNorm, syncToVerticalBlank: false, resourceBindingModel: ResourceBindingModel.Improved, preferDepthRangeZeroToOne: true, preferStandardClipSpaceYDirection: false); _graphicsDevice = VeldridStartup.CreateGraphicsDevice(machWindow.window, options); machCamera = new MachCamera(machWindow); _indices = Cube.GetCubeIndices(); _vertices = Cube.GetCubeVertices(); CreateResources(); while (machWindow.window.Exists) { machWindow.window.PumpEvents(); Draw(); } DisposeResources(); }
public MachCamera(MachWindow mWindow) { _position = new Vector3(0f, -1f, 2f); _direction = Vector3.Normalize(_position - _target); _near = 0.1F; _far = 100F; _height = mWindow.window.Height; _width = mWindow.window.Width; var up = new Vector3(0, 1, 0); _cameraRight = Vector3.Cross(up, _direction); _cameraUp = Vector3.Cross(_direction, _cameraRight); }