private VmtInfo GetVmtInfo(string vmtPath)
        {
            if (!_resourceLoader.ContainsFile(vmtPath))
            {
                return(null);
            }

            using var fs = _resourceLoader.OpenFile(vmtPath);
            var vmt    = ValveMaterialFile.FromStream(fs);
            var result = new VmtInfo(vmtPath, vmt);

            return(result);
        }
        private Material CreateMaterial(VmtInfo vmtInfo)
        {
            if (vmtInfo == null)
            {
                return(Options.MissingMaterial);
            }

            if (vmtInfo.CompileSky > 0 && Options.SkyMaterial)
            {
                return(Options.SkyMaterial);
            }

            if (!string.IsNullOrEmpty(vmtInfo.Include))
            {
                return(CreateMaterial(GetVmtInfo(vmtInfo.Include)));
            }

            if (vmtInfo.SurfaceProp == "water")
            {
                return(Options.WaterMaterial);
            }

            var result = GameObject.Instantiate(Options.GetShaderMaterial(vmtInfo.VmtShader));

            result.mainTexture = LoadTexture(vmtInfo.BaseTex);
            result.SetFloat("_Smoothness", 0);
            result.SetFloat("_Metallic", 0f);
            result.name = vmtInfo.VmtName;

            if (!string.IsNullOrEmpty(vmtInfo.BumpMap))
            {
                //result.SetTexture("_BumpMap", LoadTexture(vmtInfo.BumpMap));
            }

            if (vmtInfo.Transition)
            {
                //result.SetTexture("_MainTex2", LoadTexture(vmtInfo.BaseTex2));
            }

            if (vmtInfo.Translucent || vmtInfo.AlphaTest)
            {
                //result.shader = Shader.Find("Fragsurf/BSP/Transparent Colored");
                //var baseColor = result.GetColor("_Color");
                //baseColor.a = vmtInfo.Alpha;
                //result.SetColor("_Color", baseColor);
                //result.SetFloat("_SurfaceType", 1);
            }

            return(result);
        }