示例#1
0
        public void CreateTextureResource(string name)
        {
            var             typeResource = typeList["Texture"];
            TextureResource resource     = new TextureResource();

            resource.HasMIP = 0;
            resource.SetEntryVersion(typeResource.GetSerializationVersion());
            resource.SetFileName(name);
            AddResource("Texture", BuildResourceTreeNode(name, resource));

            // Try and add the Mipmap only if it exists in the parent folder.
            string MippedTexture = "MIP_" + name;
            string MippedPath    = GetParentFolder() + "//" + MippedTexture;

            if (File.Exists(MippedPath))
            {
                // See if we can construct MipMap resource.
                var      MipMapTypeResource = typeList["Mipmap"];
                FileInfo MipInfo            = new FileInfo(MippedPath);
                CreateBaseResource("Mipmap", MipInfo);

                // Set 'HasMIP' because we have one now.
                resource.HasMIP = 1;
            }
        }
示例#2
0
        private void AutoAddFilesButton_Click(object sender, EventArgs e)
        {
            resources["VertexBufferPool"].Clear();
            resources["IndexBufferPool"].Clear();
            resources["Texture"].Clear();
            foreach (FileInfo info in parent.GetFiles())
            {
                if (info.Extension.Contains("vbp"))
                {
                    var          typeResource = types["VertexBufferPool"];
                    var          version      = typeResource.GetSerializationVersion();
                    BaseResource resource     = new BaseResource();
                    resource.SetFileName(info.Name);
                    resource.SetEntryVersion(version);
                    resources[typeResource.GetTypeName()].Add(BuildTreeNode(info.Name, resource));
                }

                if (info.Extension.Contains("ibp"))
                {
                    var          typeResource = types["IndexBufferPool"];
                    var          version      = typeResource.GetSerializationVersion();
                    BaseResource resource     = new BaseResource();
                    resource.SetFileName(info.Name);
                    resource.SetEntryVersion(version);
                    resources[typeResource.GetTypeName()].Add(BuildTreeNode(info.Name, resource));
                }

                if (info.Extension.Contains("dds") && !info.Extension.Contains("MIP_"))
                {
                    var             typeResource = types["Texture"];
                    var             version      = typeResource.GetSerializationVersion();
                    TextureResource resource     = new TextureResource();
                    resource.SetFileName(info.Name);
                    resource.SetEntryVersion(version);
                    resource.HasMIP = 0;
                    resources[typeResource.GetTypeName()].Add(BuildTreeNode(info.Name, resource));
                }
            }
        }