protected override void BindSurfaceImpl( int attachment, RenderTexture target ) { Contract.Requires( attachment < Config.MaxMultipleRenderTargets ); // Get buffer and surface to bind to var buffer = (D3D9HardwarePixelBuffer)( target[ "BUFFER" ] ); Proclaim.NotNull( buffer ); // Find first non null target int y; for ( y = 0; y < Config.MaxMultipleRenderTargets && this._renderTargets[ y ] == null; ++y ) { ; } if ( y != Config.MaxMultipleRenderTargets ) { // If there is another target bound, compare sizes if ( this._renderTargets[ y ].Width != buffer.Width || this._renderTargets[ y ].Height != buffer.Height ) { throw new AxiomException( "MultiRenderTarget surfaces are not the same size." ); } if ( !Root.Instance.RenderSystem.Capabilities.HasCapability( Capabilities.MRTDifferentBitDepths ) && ( PixelUtil.GetNumElemBits( this._renderTargets[ y ].Format ) != PixelUtil.GetNumElemBits( buffer.Format ) ) ) { throw new AxiomException( "MultiRenderTarget surfaces are not of same bit depth and hardware requires it" ); } } this._renderTargets[ attachment ] = buffer; _checkAndUpdate(); }
/// <summary> /// Bind a surface to a certain attachment point. /// </summary> /// <param name="attachment">0 .. capabilities.MultiRenderTargetCount-1</param> /// <param name="target">RenderTexture to bind.</param> /// <remarks> /// It does not bind the surface and fails with an exception (ERR_INVALIDPARAMS) if: /// - Not all bound surfaces have the same size /// - Not all bound surfaces have the same internal format /// </remarks> public override void BindSurface( int attachment, RenderTexture target ) { Contract.Requires( attachment < Config.MaxMultipleRenderTargets ); // Get buffer and surface to bind to D3DHardwarePixelBuffer buffer = (D3DHardwarePixelBuffer)( target[ "BUFFER" ] ); Proclaim.NotNull( buffer ); // Find first non null target int y; for ( y = 0; y < Config.MaxMultipleRenderTargets && this._targets[ y ] == null; y++ ) ; if ( y != Config.MaxMultipleRenderTargets ) { if ( this._targets[ y ].Width != buffer.Width && this._targets[ y ].Height != buffer.Height && PixelUtil.GetNumElemBits( this._targets[ y ].Format ) != PixelUtil.GetNumElemBits( this._targets[ y ].Format ) ) { throw new AxiomException( "MultiRenderTarget surfaces are not the same size or bit depth." ); } } this._targets[ attachment ] = buffer; this.CheckAndUpdate(); }
/// <summary> /// </summary> /// <param name="attachment"> </param> /// <param name="target"> </param> public override void BindSurface( int attachment, RenderTexture target ) { /// Check if the render target is in the rendertarget->FBO map var fbobj = target[ "FBO" ] as GLESFrameBufferObject; Utilities.Contract.Requires( fbobj != null ); this._fbo.BindSurface( attachment, fbobj.GetSurface( 0 ) ); GLESConfig.GlCheckError( this ); Width = this._fbo.Width; Height = this._fbo.Height; }
protected override void BindSurfaceImpl( int attachment, RenderTexture target ) { /// Check if the render target is in the rendertarget->FBO map var fbObject = (GLFrameBufferObject)target[ "FBO" ]; Proclaim.NotNull( fbObject ); this._fbo.BindSurface( attachment, fbObject.SurfaceDesc ); // Initialize? // Set width and height width = this._fbo.Width; height = this._fbo.Height; }
protected void DestroyRenderTexture() { if ( this.renderTexture != null ) { Root.Instance.RenderSystem.DestroyRenderTarget( this.renderTexture.Name ); this.renderTexture = null; } }
protected void UpdateRenderTexture( bool writeGamma, int fsaa, string srcName ) { if ( this.renderTexture == null ) { //romeoxbm: in Ogre, there was an (int)this instead of that this.ID // Check if we should use that id or, alternatively, the hashcode var name = string.Format( "rtt/{0}/{1}", ID, srcName ); this.renderTexture = new D3D9RenderTexture( name, this, writeGamma, fsaa ); Root.Instance.RenderSystem.AttachRenderTarget( this.renderTexture ); } }
public override void ClearSliceRTT( int zoffset ) { this.renderTexture = null; }
protected abstract void BindSurfaceImpl( int attachment, RenderTexture target );
public virtual void BindSurface( int attachment, RenderTexture target ) { for ( var i = this.boundSurfaces.Count; i <= attachment; ++i ) { this.boundSurfaces.Add( null ); } this.boundSurfaces[ attachment ] = target; BindSurfaceImpl( attachment, target ); }
protected override void BindSurfaceImpl( int attachment, RenderTexture target ) { //Check if the render target is in the rendertarget.FBO map GLES2FrameBufferObject fboojb = null; fboojb = (GLES2FrameBufferObject) target[ "FBO" ]; this.fbo.BindSurface( attachment, fboojb.GetSurface( 0 ) ); width = this.fbo.Width; height = this.fbo.Height; }