Пример #1
0
 public XbfShader(AssetManager assetManager, IReadableFileSystem fileSystem, string path)
     : base(XbfShader.VertexShader, XbfShader.FragmentShader)
 {
     this.normal         = GL.GetUniformLocation(this.Program, "uNormal");
     this.light          = GL.GetUniformLocation(this.Program, "uLight");
     this.vertexPosition = GL.GetAttribLocation(this.Program, "aPosition");
     this.vertexNormal   = GL.GetAttribLocation(this.Program, "aNormal");
     this.vertexUv       = GL.GetAttribLocation(this.Program, "aUv");
 }
Пример #2
0
        public Texture(AssetManager assetManager, IReadableFileSystem fileSystem, string path)
        {
            this.Id = GL.GenTexture();
            GL.BindTexture(TextureTarget.Texture2D, this.Id);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (uint)TextureWrapMode.Repeat);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (uint)TextureWrapMode.Repeat);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (uint)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (uint)TextureMagFilter.Linear);

            var tga = new Tga(fileSystem.Read(path) !);

            GL.TexImage2D(
                TextureTarget.Texture2D,
                0,
                PixelInternalFormat.Rgba8,
                tga.Width,
                tga.Height,
                0,
                PixelFormat.Rgba,
                PixelType.UnsignedByte,
                tga.Pixels
                );
        }
Пример #3
0
        public XbfMesh(AssetManager assetManager, IReadableFileSystem fileSystem, string path)
        {
            this.assetManager = assetManager;

            var xbf = new Xbf(fileSystem.Read(path) !);

            this.Name = Path.GetFileNameWithoutExtension(path);

            // TODO: Some textures are using additional flags by prefixing their filenames:
            // TODO: = => apply player color to 0000?? pixels
            // TODO: ! => render additive
            // TODO: % might be ""
            // TODO: @ might be ""

            this.Children = xbf.Objects.Select(
                xbfObject => XbfMesh.LoadXbfObject(
                    xbfObject,
                    this.assetManager.Load <XbfShader>(this),
                    xbf.Textures.Select(
                        name =>
            {
                try
                {
                    return(this.assetManager.Load <Texture>(this, $"Textures/{name}").Id);
                }
                catch (Exception)
                {
                    return(this.assetManager.Load <Texture>(this, "Textures/white.tga").Id);
                }
            }
                        )
                    .ToArray()
                    )
                )
                            .ToArray();
        }
Пример #4
0
 public void Add(IReadableFileSystem fileSystem)
 {
     this.fileSystems.Add(fileSystem);
 }
 public DokanFileSystemAdapter(IReadableFileSystem fileSystem)
 {
     _ReadableFileSystem  = fileSystem;
     _WriteableFileSystem = fileSystem as IWriteableFileSystem;
 }