Example #1
0
        public RenderSystem(PresentationParameters parameters)
        {
            Adapters = GraphicsAdapter.EnumerateGraphicsAdapter();

            Device = new GraphicsDevice(Adapters[0]);

            SwapChain = new GraphicsSwapChain(parameters, Device);

            CommandList = new CommandList(Device);

            Texture = new Texture(Device, SwapChain);

            Shaders = new Shaders(Device, "Shaders/VertexShader.hlsl", "Shaders/PixelShader.hlsl");

            StateWireframe = new PipelineState(Device, FillMode.Wireframe, CullMode.None);

            StateSolid = new PipelineState(Device, FillMode.Solid, CullMode.None);

            Grid = new Grid(1, 1, 8, 8);

            VertexBuffer = new Buffer(Grid.SizeInBytes, Grid.Size, Device, ResourceInfo.VertexBuffer);

            IndexBuffer = new Buffer(Grid.IndexSizeInBytes, Grid.IndexSize, Device, ResourceInfo.IndexBuffer);

            ConstantBuffer = new Buffer(Utilities.SizeOf <Transform>(), Utilities.SizeOf <Transform>(), Device, ResourceInfo.ConstantBuffer);

            Camera = new Camera(CameraType.Static);

            Camera.Position = new Vector3(0.0f, 0.0f, -2.5f);

            Camera.SetLens((float)Math.PI / 4, 1.2f, 1.0f, 1000.0f);

            World = new Matrix[2];
        }
Example #2
0
        public RenderSystem(PresentationParameters parameters)
        {
            Adapters = GraphicsAdapter.EnumerateGraphicsAdapter();

            Device = new GraphicsDevice(Adapters[0]);

            SwapChain = new GraphicsSwapChain(parameters, Device);

            CommandList = new CommandList(Device);

            Texture = new Texture(Device, SwapChain);

            Shaders = new Shaders(Device, "Shaders/VertexShader.hlsl", "Shaders/PixelShader.hlsl");

            Mesh = new Mesh();

            VertexBuffer = new Buffer(Mesh.SizeInBytes, Mesh.Size, Device, ResourceInfo.VertexBuffer);

            IndexBuffer = new Buffer(Mesh.IndexSizeInBytes, Mesh.IndexSize, Device, ResourceInfo.IndexBuffer);

            ConstantBuffer = new Buffer(Utilities.SizeOf <Transform>(), Utilities.SizeOf <Transform>(), Device, ResourceInfo.ConstantBuffer);

            Camera = new Camera(CameraType.Static);

            Camera.SetLens((float)Math.PI / 4, 1.2f, 1.0f, 1000.0f);
        }
        public RenderSystem(PresentationParameters parameters)
        {
            Adapters = GraphicsAdapter.EnumerateGraphicsAdapter();

            Device = new GraphicsDevice(Adapters[0]);

            SwapChain = new GraphicsSwapChain(parameters, Device);

            CommandList = new CommandList(Device);

            Texture = new Texture(Device, SwapChain);

            Shaders = new Shaders(Device, "Shaders/VertexShader.hlsl", "Shaders/PixelShader.hlsl");


            StateSolid = new PipelineState(Device, FillMode.Solid, CullMode.None);


            Mesh = new Mesh("Models/mitsuba-sphere.obj");

            VertexBuffer   = new Buffer[1];
            IndexBuffer    = new Buffer[1];
            ConstantBuffer = new Buffer[2];



            VertexBuffer[0] = new Buffer(Mesh.SizeInBytes, Mesh.Size, Device, ResourceInfo.VertexBuffer);
            IndexBuffer[0]  = new Buffer(Mesh.IndexSizeInBytes, Mesh.IndexSize, Device, ResourceInfo.IndexBuffer);


            ConstantBuffer[0] = new Buffer(Utilities.SizeOf <Transform>(), Utilities.SizeOf <Transform>(), Device, ResourceInfo.ConstantBuffer);
            ConstantBuffer[1] = new Buffer(Utilities.SizeOf <LightBuffer>(), Utilities.SizeOf <LightBuffer>(), Device, ResourceInfo.ConstantBuffer);


            TextureAddressMode Wrap = TextureAddressMode.Wrap;

            SamplerState = new SamplerState(Device, Wrap, Wrap, Wrap, Filter.MinMagMipLinear);


            Camera = new Camera(CameraType.Static);

            Camera.Position = new Vector3(0.0f, 1.2f, -8.0f);

            Camera.SetLens((float)Math.PI / 4, 1.2f, 1.0f, 1000.0f);


            World = new Matrix[3];

            Textures    = new ShaderResourceView[3];
            Textures[0] = Texture.LoadFromFile(Device, "Text/cracked_c.png");
            Textures[1] = Texture.LoadFromFile(Device, "Text/mtl01_c.png");
            Textures[2] = Texture.LoadFromFile(Device, "Text/wall_stone04_c2.png");
        }
Example #4
0
        public RenderSystem(PresentationParameters parameters)
        {
            Adapters = GraphicsAdapter.EnumerateGraphicsAdapter();

            Device = new GraphicsDevice(Adapters[0]);

            SwapChain = new GraphicsSwapChain(parameters, Device);

            CommandList = new CommandList(Device);

            Texture = new Texture(Device, SwapChain);

            Shaders = new Shaders(Device, "Shaders/VertexShader.hlsl", "Shaders/PixelShader.hlsl");

            StateWireframe = new PipelineState(Device, FillMode.Wireframe, CullMode.None);

            StateSolid = new PipelineState(Device, FillMode.Solid, CullMode.None);

            Grid = new Grid(1, 1, 8, 8);

            Mesh = new Mesh("suzanne.obj");

            VertexBuffer = new Buffer[2];
            IndexBuffer  = new Buffer[2];

            VertexBuffer[0] = new Buffer(Grid.SizeInBytes, Grid.Size, Device, ResourceInfo.VertexBuffer);
            IndexBuffer[0]  = new Buffer(Grid.IndexSizeInBytes, Grid.IndexSize, Device, ResourceInfo.IndexBuffer);

            VertexBuffer[1] = new Buffer(Mesh.SizeInBytes, Mesh.Size, Device, ResourceInfo.VertexBuffer);
            IndexBuffer[1]  = new Buffer(Mesh.IndexSizeInBytes, Mesh.IndexSize, Device, ResourceInfo.IndexBuffer);

            ConstantBuffer = new Buffer(Utilities.SizeOf <Transform>(), Utilities.SizeOf <Transform>(), Device, ResourceInfo.ConstantBuffer);

            TextureAddressMode Wrap = TextureAddressMode.Wrap;

            SamplerState = new SamplerState(Device, Wrap, Wrap, Wrap, Filter.MinMagMipLinear);

            Camera = new Camera(CameraType.Static);

            Camera.Position = new Vector3(0.0f, 0.15f, -1.5f);

            Camera.SetLens((float)Math.PI / 4, 1.2f, 1.0f, 1000.0f);

            World = new Matrix[2];

            Textures    = new ShaderResourceView[2];
            Textures[0] = Texture.LoadFromFile(Device, "Text/UV_Grid_Sm.jpg");
            Textures[1] = Texture.LoadFromFile(Device, "Text/UV_Grid_Lrg.jpg");
        }
Example #5
0
        public RenderSystem(PresentationParameters parameters)
        {
            Adapters = GraphicsAdapter.EnumerateGraphicsAdapter();

            Device = new GraphicsDevice(Adapters[0]);

            SwapChain = new GraphicsSwapChain(parameters, Device);

            CommandList = new CommandList(Device);

            Texture = new Texture(Device, SwapChain);

            Shaders = new Shaders(Device, "Shaders/VertexShader.hlsl", "Shaders/PixelShader.hlsl");

            Triangle = new Mesh();

            VertexBuffer = new Buffer(Triangle.SizeInBytes, Triangle.Size, Device, ResourceInfo.VertexBuffer());
        }