public CommonMaterial CreateLimeMaterial(FbxMaterial material, string modelPath, Target target) { var commonMaterial = new CommonMaterial { Name = material.Name }; if (!string.IsNullOrEmpty(material.Path)) { var tex = CreateSerializableTexture(modelPath, material.Path); commonMaterial.DiffuseTexture = tex; var rulesPath = tex.SerializationPath + ".png"; // TODO: implement U and V wrapping modes separately for cooking rules. // Set "Repeat" wrpap mode if wrap mode of any of the components is set as "Repeat". var mode = material.WrapModeU == TextureWrapMode.Repeat || material.WrapModeV == TextureWrapMode.Repeat ? TextureWrapMode.Repeat : TextureWrapMode.Clamp; if (cookingRulesMap.ContainsKey(rulesPath)) { var cookingRules = cookingRulesMap[rulesPath] = cookingRulesMap[rulesPath].InheritClone(); if (cookingRules.CommonRules.WrapMode != mode) { cookingRules.CommonRules.WrapMode = mode; cookingRules.SourceFilename = rulesPath + ".txt"; cookingRules.CommonRules.Override(nameof(ParticularCookingRules.WrapMode)); cookingRules.DeduceEffectiveRules(target); cookingRules.Save(); } } } commonMaterial.DiffuseColor = material.DiffuseColor; return(commonMaterial); }
public CommonMaterial ToLime(string path) { var res = new CommonMaterial(); res.Name = Name; if (!string.IsNullOrEmpty(Path)) { res.DiffuseTexture = CreateSerializableTexture(path); } if (DiffuseColor != null) { res.DiffuseColor = DiffuseColor; } return(res); }