private void InitTest()
        {
            var device = dcRenderView.GetDevice();

            if (canvasview == null)
            {
                canvasview = new CSRect(device, 512, 512);
                canvasview.SetPixelShader(dcRenderView.DefaultResource.default2DPixelShader);
                canvasview.SetVertexShader(dcRenderView.DefaultResource.default2DVertexShader);
            }
        }
Example #2
0
 public void SetCanvasCase(CanvasCase canvasCase)
 {
     CanvasCase = canvasCase;
     CanvasRect = new CSRect(CanvasCase.DeviceResources, CanvasCase.Width, CanvasCase.Height);
     CanvasRect.SetVertexShader(AppController.CurrentController.default2DVertexShader);
     CanvasRect.SetPixelShader(AppController.CurrentController.PS2DTex1);
     CanvasRect.Position = new Vector2(
         ((float)swapChainPanel.ActualWidth * logicScale - CanvasCase.Width) * 0.5f,
         ((float)swapChainPanel.ActualHeight * logicScale - CanvasCase.Height) * 0.5f);
     paintAgent = CanvasCase.PaintAgent;
     canvasCase.ViewRenderer.RenderAll();
     PresentContent();
 }
        private async void Test3_Click(object sender, RoutedEventArgs e)
        {
            InitTest();
            FileOpenPicker picker1 = new FileOpenPicker();

            picker1.FileTypeFilter.Add("*");
            var file = await picker1.PickSingleFileAsync();

            if (file == null)
            {
                return;
            }
            var fOpen = (await file.OpenReadAsync()).AsStream();

            byte[] bData = new byte[fOpen.Length];
            fOpen.Read(bData, 0, (int)fOpen.Length);
            var task2 = await VertexShader.CompileAndCreateAsync(dcRenderView.GetDevice(), bData);

            VertexShader shader = task2;

            canvasview.SetVertexShader(shader);

            TestRender();//测试通过
        }