/// <summary>
        /// Loads a texture
        /// </summary>
        /// <param name="filename">The file name.</param>
        /// <returns>The loaded texture.</returns>
        public override NoesisTexture LoadTexture(string filename)
        {
            Lazy <WaveTexture> lazyTexture;

            if (this.textures.TryGetValue(filename, out lazyTexture))
            {
                var texture = lazyTexture.Value;

                if (WaveServices.Platform.AdapterType == AdapterType.DirectX)
                {
                    return(NoesisTexture.WrapD3D11Texture(null, texture.NativePointer, texture.Width, texture.Height, texture.Levels, Texture.Format.BGRA8, false));
                }
                else
                {
                    return(NoesisTexture.WrapGLTexture(null, texture.NativePointer, texture.Width, texture.Height, texture.Levels, Texture.Format.BGRA8, false));
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public static Texture CreateNoesisTexture(Texture2D texture)
        {
            if (texture == null)
            {
                return(null);
            }

            if (texture.IsDisposed)
            {
                throw new Exception("Cannot wrap the disposed texture: " + texture);
            }

            return(Texture.WrapD3D11Texture(
                       texture,
                       texture.GetNativeTexturePtr(),
                       texture.Width,
                       texture.Height,
                       texture.LevelCount,
                       format: GetTextureFormat(texture),
                       isInverted: false));
        }