コード例 #1
0
        private bool Initialize(TextureManager manager, D3d.Format format, int width, int height, bool dynamic, bool mipmap)
        {
            D3d.Pool d3dPool = D3d.Pool.Managed;
            D3d.Usage d3dUsage = manager.GetUsageFlags( dynamic,mipmap,false );

            try
            {
                d3dTexture = new D3d.Texture(   manager.Device.D3dDevice,
                                                width,
                                                height,
                                                manager.GetMipLevelCount(mipmap),
                                                d3dUsage,
                                                format,
                                                d3dPool );
                this.Initialize(manager, format, width, height, 1, d3dTexture);

                return true;
            }
            catch (D3d.InvalidCallException e)
            {
                log.Warning("Unable to create texture: {0}", e.Message);
            }
            catch (D3d.OutOfVideoMemoryException e)
            {
                log.Warning("Unable to create texture: {0}", e.Message);
            }
            catch (OutOfMemoryException e)
            {
                log.Warning("Unable to create texture: {0}", e.Message);
            }

            return false;
        }
コード例 #2
0
        private bool Initialize(TextureManager manager, D3d.Format format, int size, bool mipmap,int multisample )
        {
            D3d.Pool d3dPool = D3d.Pool.Default;
            D3d.Usage d3dUsage = manager.GetUsageFlags( false,mipmap,true );

            try
            {
                d3dTexture = new D3d.CubeTexture( manager.Device.D3dDevice,size,manager.GetMipLevelCount(mipmap),d3dUsage,format,d3dPool);

                // Create depth buffer.
                d3dDepthBuffer = manager.Device.D3dDevice.CreateDepthStencilSurface(size, size, manager.Device.Settings.depthBufferFormat, (D3d.MultiSampleType)multisample, 0, true);

                this.Initialize(manager, format, size,size,6, d3dTexture);

                return true;
            }
            catch (D3d.InvalidCallException e)
            {
                log.Warning("Unable to create render cube texture: {0}", e.Message);
            }
            catch (D3d.OutOfVideoMemoryException e)
            {
                log.Warning("Unable to create render cube texture: {0}", e.Message);
            }
            catch (OutOfMemoryException e)
            {
                log.Warning("Unable to create render cube texture: {0}", e.Message);
            }

            return false;
        }
コード例 #3
0
        public static RenderTextureCube Create(TextureManager manager,D3d.Format format, int size, bool mipmap,int multisample )
        {
            RenderTextureCube newTexture = new RenderTextureCube();
            if ( newTexture.Initialize( manager,format,size,mipmap,multisample ) )
                return newTexture;

            return null;
        }
コード例 #4
0
        public static Texture2d Create(TextureManager manager,D3d.Format format, int width, int height, bool dynamic, bool mipmap)
        {
            Texture2d newTexture = new Texture2d();
            if ( newTexture.Initialize( manager,format,width,height,dynamic,mipmap ) )
                return newTexture;

            return null;
        }
コード例 #5
0
        public static RenderTexture2d Create(TextureManager manager,D3d.Format format, int width, int height, bool mipmap,int multisample)
        {
            RenderTexture2d newTexture = new RenderTexture2d();
            if ( newTexture.Initialize( manager,format,width,height,mipmap,multisample ) )
                return newTexture;

            return null;
        }
コード例 #6
0
        public static TextureManager Create(Device _device)
        {
            TextureManager textureManager = new TextureManager();
            if (textureManager.Initialize(_device))
                return textureManager;

            return null;
        }
コード例 #7
0
        public static TextureCube Create(TextureManager manager,D3d.Format format, int size, bool dynamic, bool mipmap)
        {
            TextureCube newTexture = new TextureCube();
            if ( newTexture.Initialize( manager,format,size,dynamic,mipmap ) )
                return newTexture;

            return null;
        }
コード例 #8
0
 protected void Initialize(TextureManager manager, D3d.Format format, int width, int height, int depth,D3d.BaseTexture d3dBase )
 {
     textureManager  = manager;
     textureFormat   = format;
     textureWidth    = width;
     textureHeight   = height;
     textureDepth    = depth;
     textureBase     = d3dBase;
 }
コード例 #9
0
        private bool Initialize(System.Windows.Forms.Control renderWindow )
        {
            d3dSettings     = new Settings();
            d3dDevice       = DeviceUtility.CreateDevice( d3dSettings,renderWindow );

            if (d3dDevice != null)
            {
                d3dCapabilities         = new Capabilities(this);

                // Create subsystems.
                d3dPrimaryFrameBuffer   = FrameBuffer.Create( this );
                d3dGeometryManager      = GeometryManager.Create( this );
                d3dTextureManager       = TextureManager.Create(this);
                d3dQueryManager         = QueryManager.Create(this);
                d3dCompiler             = Compiler.Create(this);

                return true;
            }
            return false;
        }