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; }
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); }
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; }
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); }
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); }
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); }
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); } }
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); }
public void SetRenderSize(Size size) { this.pendingSize = size; this.timer.Start(true); }
public void SetD3DImage(D3DImage d3dImage, Size size) { this.d3dImage = d3dImage; CreateRenderTarget(size); }