static void Export_Color(Material m, TextureExportManager textureManager, GLTFMaterial material) { if (m.HasProperty("_Color")) { material.pbrMetallicRoughness.baseColorFactor = m.color.ToArray(); } if (m.HasProperty("_MainTex")) { var index = textureManager.CopyAndGetIndex(m.GetTexture("_MainTex"), RenderTextureReadWrite.sRGB); if (index != -1) { material.pbrMetallicRoughness.baseColorTexture = new GLTFMaterialBaseColorTextureInfo() { index = index, }; } } }
static void Export_Emission(Material m, TextureExportManager textureManager, GLTFMaterial material) { if (m.HasProperty("_EmissionColor")) { var color = m.GetColor("_EmissionColor"); material.emissiveFactor = new float[] { color.r, color.g, color.b }; } if (m.HasProperty("_EmissionMap")) { var index = textureManager.CopyAndGetIndex(m.GetTexture("_EmissionMap"), RenderTextureReadWrite.sRGB); if (index != -1) { material.emissiveTexture = new GLTFMaterialEmissiveTextureInfo() { index = index, }; } } }