internal XNATexture3DImplementation(XFG.GraphicsDevice device, int width, int height, int depth, bool genMipmap, SurfaceFormat format) : base(width, height, depth, format) { _graphicsDevice = device; _texture3D = new XFG.Texture3D(device, width, height, depth, genMipmap, XNAHelper.ToXNASurfaceFormat(format)); }
///<summary> /// Call this to associate a Xna Texture3D with this pixel buffer ///</summary> public void Bind( XFG.GraphicsDevice device, XFG.Texture3D volume, bool update ) { this.device = device; this.volume = volume; Width = volume.Width; Height = volume.Height; Depth = volume.Depth; Format = XnaHelper.Convert( volume.Format ); // Default RowPitch = Width; SlicePitch = Height * Width; sizeInBytes = PixelUtil.GetMemorySize( Width, Height, Depth, Format ); if ( ( (int)usage & (int)TextureUsage.RenderTarget ) != 0 ) CreateRenderTextures( update ); }
public XnaHardwarePixelBuffer( BufferUsage usage ) : base( 0, 0, 0, Axiom.Media.PixelFormat.Unknown, usage, false, false ) { device = null; surface = null; volume = null; tempSurface = null; tempVolume = null; doMipmapGen = false; HWMipmaps = false; mipTex = null; sliceTRT = new List<RenderTexture>(); }
/// <summary> /// /// </summary> private void LoadVolumeTexture() { Debug.Assert( this.TextureType == TextureType.ThreeD ); if ( Root.Instance.RenderSystem.ConfigOptions[ "Use Content Pipeline" ].Value == "Yes" ) { AxiomContentManager acm = new AxiomContentManager( (XnaRenderSystem)Root.Instance.RenderSystem, "" ); _volumeTexture = acm.Load<XFG.Texture3D>( Name ); _texture = _volumeTexture; internalResourcesCreated = true; } #if !( XBOX || XBOX360 ) //TODO: XNA40 removed Texture3D.FromFile //else //{ // Stream stream = ResourceGroupManager.Instance.OpenResource( Name ); // // load the cube texture from the image data stream directly // _volumeTexture = XFG.Texture3D.FromFile( _device, stream ); // // store off a base reference // _texture = _volumeTexture; // // set src and dest attributes to the same, we can't know // stream.Position = 0; // SetSrcAttributes(_volumeTexture.Width, _volumeTexture.Height, _volumeTexture.Depth, XnaHelper.Convert(_volumeTexture.Format)); // SetFinalAttributes(_volumeTexture.Width, _volumeTexture.Height, _volumeTexture.Depth, XnaHelper.Convert(_volumeTexture.Format)); // stream.Close(); // internalResourcesCreated = true; //} #endif }
protected override void freeInternalResources() { if ( this._texture != null ) { this._texture.Dispose(); this._texture = null; } if ( this._normTexture != null ) { this._normTexture.Dispose(); this._normTexture = null; } if ( this._cubeTexture != null ) { this._cubeTexture.Dispose(); this._cubeTexture = null; } if ( this._volumeTexture != null ) { this._volumeTexture.Dispose(); this._volumeTexture = null; } }