public ScreenBuffer(GraphicsContext graphics, FrameBuffer deviceScreen, int width, int height, PixelFormat colorFormat, PixelFormat depthFormat, MultiSampleMode multiSampleMode) { if (width == 0) { width = deviceScreen.Width; } if (height == 0) { height = deviceScreen.Height; } colorFormat = deviceScreen.ColorFormat; depthFormat = deviceScreen.DepthFormat; this.AdjustAspect(graphics, deviceScreen, width, height); this.shaderProgram = new ShaderProgram(ScreenBuffer.programData); this.vertexBuffer = new VertexBuffer(12, 18, new VertexFormat[] { VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4 }); this.vertexBuffer.SetVertices(ScreenBuffer.vertexData); this.vertexBuffer.SetIndices(ScreenBuffer.indexData); this.colorTexture = new Texture2D(width, height, false, colorFormat, PixelBufferOption.Renderable, InternalOption.SystemResource); this.depthBuffer = new DepthBuffer(width, height, depthFormat, PixelBufferOption.Renderable, InternalOption.SystemResource); base.SetColorTarget(this.colorTexture, 0); base.SetDepthTarget(this.depthBuffer); }
/// <summary>Sets a value to the structure representing the rendering result storage destination</summary> /// <param name="buffer">Depth buffer (release when NULL)</param> public void Set(DepthBuffer buffer) { this.Buffer = buffer; this.Level = 0; this.CubeFace = TextureCubeFace.PositiveX; }
/// <summary>Creates a structure representing the rendering result storage destination</summary> /// <param name="buffer">Depth buffer (release when NULL)</param> public RenderTarget(DepthBuffer buffer) { this.Buffer = buffer; this.Level = 0; this.CubeFace = TextureCubeFace.PositiveX; }
/// <summary>Creates a copy of the depth buffer</summary> /// <returns>Clones the depth buffer</returns> /// <remarks>Creates a copy of the depth buffer. The 2 depth buffers will then share unmanaged resources. When Dispose() is called for all copies, the shared unmanaged resources will be freed.</remarks> protected DepthBuffer(DepthBuffer buffer) : base(buffer) { }
/// <summary>Sets the depth storage destination (for the depth buffer)</summary> /// <param name="buffer">Depth buffer (release when NULL)</param> /// <remarks>Sets the depth buffer to the depth storage destination.</remarks> public void SetDepthTarget(DepthBuffer buffer) { this.SetDepthTarget(new RenderTarget(buffer)); }