/// <summary> /// Import additional custom components of material. /// </summary> /// <param name="archive">Archive index</param> /// <param name="record">Record index</param> /// <param name="frame">Texture frame</param> /// <param name="material">Material.</param> static public void CustomizeMaterial(int archive, int record, int frame, Material material) { // MetallicGloss map if (CustomMetallicGlossExist(archive, record, frame)) { material.EnableKeyword("_METALLICGLOSSMAP"); material.SetTexture("_MetallicGlossMap", LoadCustomMetallicGloss(archive, record, frame)); } // Properties string path = Path.Combine(texturesPath, GetName(archive, record, frame)); if (XMLManager.XmlFileExists(path)) { var xml = new XMLManager(path); // Metallic parameter float metallic; if (xml.TryGetFloat("metallic", out metallic)) { material.SetFloat("_Metallic", metallic); } // Smoothness parameter float smoothness; if (xml.TryGetFloat("smoothness", out smoothness)) { material.SetFloat("_Glossiness", smoothness); } } }
/// <summary> /// Import additional custom components of material. /// </summary> /// <param name="archive">Archive index</param> /// <param name="record">Record index</param> /// <param name="frame">Texture frame</param> /// <param name="material">Material.</param> static public void CustomizeMaterial(int archive, int record, int frame, Material material) { // MetallicGloss map Texture2D metallicGloss; if (TryImportTextureFromLooseFiles(archive, record, frame, TextureMap.MetallicGloss, out metallicGloss)) { metallicGloss.filterMode = MainFilterMode; material.EnableKeyword(KeyWords.MetallicGlossMap); material.SetTexture(Uniforms.MetallicGlossMap, metallicGloss); } // Properties string path = Path.Combine(texturesPath, GetName(archive, record, frame)); if (XMLManager.XmlFileExists(path)) { var xml = new XMLManager(path); // Metallic parameter float metallic; if (xml.TryGetFloat("metallic", out metallic)) { material.SetFloat(Uniforms.Metallic, metallic); } // Smoothness parameter float smoothness; if (xml.TryGetFloat("smoothness", out smoothness)) { material.SetFloat(Uniforms.Glossiness, smoothness); } } }
/// <summary> /// Import additional custom components of material. /// </summary> /// <param name="archive">Archive index</param> /// <param name="record">Record index</param> /// <param name="frame">Texture frame</param> /// <param name="material">Material.</param> static public void CustomizeMaterial(int archive, int record, int frame, Material material) { // MetallicGloss map if (CustomMetallicGlossExist(archive, record, frame)) { material.EnableKeyword("_METALLICGLOSSMAP"); material.SetTexture("_MetallicGlossMap", LoadCustomMetallicGloss(archive, record, frame)); } // Properties if (XMLManager.XmlFileExist(archive, record, frame)) { string fileName = GetName(archive, record, frame); float value; // Metallic parameter if (XMLManager.TryGetFloat(fileName, "metallic", out value, texturesPath)) { material.SetFloat("_Metallic", value); } // Smoothness parameter if (XMLManager.TryGetFloat(fileName, "smoothness", out value, texturesPath)) { material.SetFloat("_Glossiness", value); } } }