示例#1
0
            public void Write(Stream output, FindLogic.Combo.ComboInfo info, FindLogic.Combo.MaterialInfo materialInfo)
            {
                using (BinaryWriter writer = new BinaryWriter(output)) {
                    FindLogic.Combo.MaterialDataInfo materialDataInfo = info.MaterialDatas[materialInfo.MaterialData];
                    writer.Write(VersionMajor);
                    writer.Write(VersionMinor);
                    writer.Write(materialDataInfo.Textures.LongCount());
                    writer.Write((uint)OWMatType.Material);
                    writer.Write(GUID.Index(materialInfo.Shader));
                    writer.Write(materialInfo.IDs.Count);
                    foreach (ulong id in materialInfo.IDs)
                    {
                        writer.Write(id);
                    }

                    foreach (KeyValuePair <ulong, ImageDefinition.ImageType> texture in materialDataInfo.Textures)
                    {
                        if (info.Textures.ContainsKey(texture.Key))
                        {
                            FindLogic.Combo.TextureInfoNew textureInfo = info.Textures[texture.Key];
                            writer.Write($"..\\Textures\\{textureInfo.GetNameIndex()}.dds");
                        }
                        else
                        {
                            writer.Write("");
                        }

                        writer.Write((uint)texture.Value);
                    }
                }
            }
示例#2
0
文件: Combo.cs 项目: Toocanzs/OWLib
        public static void SaveMaterial(ICLIFlags flags, string path, FindLogic.Combo.ComboInfo info, ulong material)
        {
            FindLogic.Combo.MaterialInfo     materialInfo     = info.Materials[material];
            FindLogic.Combo.MaterialDataInfo materialDataInfo = info.MaterialDatas[materialInfo.MaterialData];

            Model.OWMatWriter14 materialWriter = new Model.OWMatWriter14();

            string textureDirectory = Path.Combine(path, "Textures");

            if (info.SaveRuntimeData.Threads)
            {
                info.SaveRuntimeData.Tasks.Add(Task.Run(() => {
                    SaveOWMaterialFile(path, materialInfo, materialWriter, info);
                }));
            }
            else
            {
                SaveOWMaterialFile(path, materialInfo, materialWriter, info);
            }

            foreach (KeyValuePair <ulong, ImageDefinition.ImageType> texture in materialDataInfo.Textures)
            {
                SaveTexture(flags, textureDirectory, info, texture.Key);
            }
        }
示例#3
0
        public static void SaveMaterial(ICLIFlags flags, string path, FindLogic.Combo.ComboInfo info, ulong material)
        {
            FindLogic.Combo.MaterialInfo     materialInfo     = info.Materials[material];
            FindLogic.Combo.MaterialDataInfo materialDataInfo = info.MaterialDatas[materialInfo.MaterialData];

            string textureDirectory = Path.Combine(path, "Textures");

            SaveOWMaterialFile(path, materialInfo, info);

            if (materialDataInfo.Textures != null)
            {
                foreach (KeyValuePair <ulong, uint> texture in materialDataInfo.Textures)
                {
                    SaveTexture(flags, textureDirectory, info, texture.Key);
                }
            }
        }
示例#4
0
文件: Model.cs 项目: ipud2/OWLib
            public void Write(Stream stream)
            {
                using (BinaryWriter writer = new BinaryWriter(stream)) {
                    FindLogic.Combo.MaterialDataInfo materialDataInfo = Info.MaterialDatas[MaterialInfo.MaterialData];
                    writer.Write(VersionMajor);
                    writer.Write(VersionMinor);
                    if (materialDataInfo.Textures != null)
                    {
                        writer.Write(materialDataInfo.Textures.LongCount());
                    }
                    else
                    {
                        writer.Write(0L);
                    }
                    writer.Write((uint)OWMatType.Material);
                    writer.Write(teResourceGUID.Index(MaterialInfo.ShaderSource));
                    writer.Write(MaterialInfo.MaterialIDs.Count);
                    foreach (ulong id in MaterialInfo.MaterialIDs)
                    {
                        writer.Write(id);
                    }

                    if (materialDataInfo.Textures != null)
                    {
                        foreach (KeyValuePair <ulong, uint> texture in materialDataInfo.Textures)
                        {
                            FindLogic.Combo.TextureInfoNew textureInfo = Info.Textures[texture.Key];
                            if (stream is FileStream fs)
                            {
                                writer.Write(Combo.GetScratchRelative(textureInfo.GUID, Path.GetDirectoryName(fs.Name), $@"..\Textures\{textureInfo.GetNameIndex()}.dds"));
                            }
                            else
                            {
                                writer.Write($@"..\Textures\{textureInfo.GetNameIndex()}.dds");
                            }
                            writer.Write(texture.Value);
                        }
                    }
                }
            }