public Renderable(GraphicsDevice graphicsDevice, Sdl2Window contextWindow) { _graphicsDevice = graphicsDevice; _contextWindow = contextWindow; _factory = new DisposeCollectorResourceFactory(_graphicsDevice.ResourceFactory); _commandList = _factory.CreateCommandList(); _sceneRuntimeState = new SceneRuntimeDescriptor(); _modelPNTTBDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionNormalTextureTangentBitangent> >(); _modelPNDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionNormal> >(); _modelPTDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionTexture> >(); _modelPCDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionColor> >(); _modelPDescriptorList = new List <ModelRuntimeDescriptor <VertexPosition> >(); PNTTBRuntimeGeometry = new GeometryDescriptor <VertexPositionNormalTextureTangentBitangent>(); PNRuntimeGeometry = new GeometryDescriptor <VertexPositionNormal>(); PTRuntimeGeometry = new GeometryDescriptor <VertexPositionTexture>(); PCRuntimeGeometry = new GeometryDescriptor <VertexPositionColor>(); PRuntimeGeometry = new GeometryDescriptor <VertexPosition>(); // Tick every millisecond _frameTimer = new FrameTimer(1.0); _running = false; }
public Renderable(string title, Resolution windowSize, GraphicsDeviceOptions graphicsDeviceOptions, RenderOptions renderOptions) { WindowCreateInfo windowCI = new WindowCreateInfo() { X = 100, Y = 100, WindowWidth = windowSize.Horizontal, WindowHeight = windowSize.Vertical, WindowTitle = title }; _contextWindow = VeldridStartup.CreateWindow(ref windowCI); if (renderOptions.UsePreferredGraphicsBackend) { _graphicsDevice = VeldridStartup.CreateGraphicsDevice(_contextWindow, graphicsDeviceOptions, renderOptions.PreferredGraphicsBackend); } else { _graphicsDevice = VeldridStartup.CreateGraphicsDevice(_contextWindow, graphicsDeviceOptions); } _renderOptions = renderOptions; _contextWindow.Title = $"{title} / {_graphicsDevice.BackendType.ToString()}"; _factory = new DisposeCollectorResourceFactory(_graphicsDevice.ResourceFactory); _commandList = _factory.CreateCommandList(); _sceneRuntimeState = new SceneRuntimeDescriptor(); _modelPNTTBDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionNormalTextureTangentBitangent> >(); _modelPNDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionNormal> >(); _modelPTDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionTexture> >(); _modelPCDescriptorList = new List <ModelRuntimeDescriptor <VertexPositionColor> >(); _modelPDescriptorList = new List <ModelRuntimeDescriptor <VertexPosition> >(); PNTTBRuntimeGeometry = new GeometryDescriptor <VertexPositionNormalTextureTangentBitangent>(); PNRuntimeGeometry = new GeometryDescriptor <VertexPositionNormal>(); PTRuntimeGeometry = new GeometryDescriptor <VertexPositionTexture>(); PCRuntimeGeometry = new GeometryDescriptor <VertexPositionColor>(); PRuntimeGeometry = new GeometryDescriptor <VertexPosition>(); // Tick every millisecond _frameTimer = new FrameTimer(1.0); _running = false; }