Пример #1
0
        public JToken GetCubemaps([Url] string mapName)
        {
            if (CheckNotExpired(mapName))
            {
                return(null);
            }

            var bsp = GetBspFile(Request, mapName);

            var array = new JArray();

            foreach (var cubemap in bsp.Cubemaps)
            {
                var fileName = $"materials/maps/{mapName}/c{cubemap.OriginX}_{cubemap.OriginY}_{cubemap.OriginZ}.hdr.vtf";
                array.Add(new JObject
                {
                    { "origin", new Vector3(cubemap.OriginX, cubemap.OriginY, cubemap.OriginZ).ToJson() },
                    { "vtfUrl", VtfController.GetUrl(Request, fileName, mapName) }
                });
            }

            return(new JObject
            {
                { "cubemaps", array }
            });
        }
Пример #2
0
        public static string GetTextureUrl(HttpListenerRequest request, ValveBspFile bsp, string filePath, string vmtDir)
        {
            filePath = filePath.Replace('\\', '/');

            foreach (var variant in GetTexturePathVariants(filePath, vmtDir))
            {
                if (bsp != null && bsp.PakFile.ContainsFile(variant))
                {
                    return(VtfController.GetUrl(request, variant, bsp.Name));
                }
                if (Program.Loader.ContainsFile(variant))
                {
                    return(VtfController.GetUrl(request, variant));
                }
            }

            return(null);
        }