Ejemplo n.º 1
0
 public TextureRenderTarget(Device device, Size size)
 {
     Texture = new Texture(device, "RenderTarget", size);
     TargetSurface = Texture.RawTexture.GetSurfaceLevel(0);
     DepthStencilSurface = D3D.Surface.CreateDepthStencil(device.RawDevice, (int)size.Width, (int)size.Height, D3D.Format.D16,
         D3D.MultisampleType.None, 0, false);
     Size = size;
 }
Ejemplo n.º 2
0
        public void Layer_Scroll_Test()
        {
            var bufferSize = new Size(300, 300);
            var windowSize = new Size(100, 100);
            var layer = new Layer(Device, bufferSize, windowSize);

            layer.Scroll(100.0f, 150.0f);
            Assert.AreEqual(100.0f, layer.ScrollX);
            Assert.AreEqual(150.0f, layer.ScrollY);
        }
Ejemplo n.º 3
0
        public Texture(Device device, string name, Size size)
        {
            RawTexture = new D3D.Texture(device.RawDevice, (int)size.Width, (int)size.Height, 1, D3D.Usage.RenderTarget,
                D3D.Format.A8R8G8B8, D3D.Pool.Default);

            Name = name;
            Width = (int)size.Width;
            Height = (int)size.Height;
            this.imageFileFormat = D3D.ImageFileFormat.Bmp;
        }
Ejemplo n.º 4
0
        public void Layer_Constructor_Test()
        {
            var bufferSize = new Size(300, 300);
            var windowSize = new Size(100, 100);
            var layer = new Layer(Device, bufferSize, windowSize);

            Assert.AreEqual(bufferSize, layer.BufferSize);
            Assert.AreEqual(windowSize, layer.WindowSize);
            Assert.IsNotNull(layer.RenderTarget);
            Assert.AreEqual(0.0f, layer.ScrollX);
            Assert.AreEqual(0.0f, layer.ScrollY);
            Assert.AreEqual(new Range<float>(0.0f, 199.0f), layer.ScrollRangeX);
            Assert.AreEqual(new Range<float>(0.0f, 199.0f), layer.ScrollRangeY);
        }
Ejemplo n.º 5
0
        public void Layer_SetScrollXY_Test()
        {
            var bufferSize = new Size(300, 300);
            var windowSize = new Size(100, 100);
            var layer = new Layer(Device, bufferSize, windowSize);

            layer.ScrollX = -10.0f;
            Assert.AreEqual(0, layer.ScrollX);
            layer.ScrollY = -10.0f;
            Assert.AreEqual(0.0f, layer.ScrollY);

            layer.ScrollX = layer.ScrollRangeX.Max + 1;
            Assert.AreEqual(layer.ScrollRangeX.Max, layer.ScrollX);
            layer.ScrollY = layer.ScrollRangeY.Max + 1;
            Assert.AreEqual(layer.ScrollRangeY.Max, layer.ScrollY);
        }
Ejemplo n.º 6
0
        private void CreateTextureRenderTargets(Size screenSize)
        {
            var quarterSize = new Size(screenSize.Width / 4, screenSize.Height / 4);
            quarterSize.Width = Math.Max(1, quarterSize.Width);
            quarterSize.Height = Math.Max(1, quarterSize.Height);

            CreateTextureRenderTargetIfRequired(ref this.sceneMapRenderTarget, screenSize);
            CreateTextureRenderTargetIfRequired(ref this.radialSceneMapRenderTarget, screenSize);
            CreateTextureRenderTargetIfRequired(ref this.downsampleMapRenderTarget, quarterSize);
            CreateTextureRenderTargetIfRequired(ref this.blurMap1RenderTarget, quarterSize);
            CreateTextureRenderTargetIfRequired(ref this.blurMap2RenderTarget, quarterSize);
        }
Ejemplo n.º 7
0
 private void CreateTextureRenderTargetIfRequired(ref TextureRenderTarget renderTarget, Size size)
 {
     if (renderTarget == null ||
         renderTarget.Size.Width != size.Width ||
         renderTarget.Size.Height != size.Height)
     {
         renderTarget = new TextureRenderTarget(this.device, size);
     }
 }
Ejemplo n.º 8
0
        private void CreateRenderTarget(Size size)
        {
            //if (this.renderTarget != null)
            //    this.renderTarget.Dispose();

            size.Width = Math.Max(1, size.Width);
            size.Height = Math.Max(1, size.Height);

            this.renderTarget = new TextureRenderTarget(this.framework.Device, size)
            {
                ClearBackGround = true,
                ClearColor = Color.Black
            };

            this.d3dImage.Lock();
            this.d3dImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, this.renderTarget.TargetSurface.ComPointer);
            this.d3dImage.Unlock();

            this.sceneManager.Camera.AspectRatio = (float)this.renderTarget.Size.Width / (float)this.renderTarget.Size.Height;

            SizeChanged(this, EventArgs.Empty);
        }
Ejemplo n.º 9
0
 public void SetRenderSize(Size size)
 {
     this.pendingSize = size;
     this.timer.Start(true);
 }
Ejemplo n.º 10
0
        public void SetD3DImage(D3DImage d3dImage, Size size)
        {
            this.d3dImage = d3dImage;

            CreateRenderTarget(size);
        }