Пример #1
0
        public static Link.Visual.Material ExportMaterialData(Material material)
        {
            if (material == null)
            {
                return(null);
            }

            if (!Materials.ContainsKey(material.name))
            {
                if (material.mainTexture != null)
                {
                    Link.Visual.Material.Texture texture = ExportTextureData(material.mainTexture);
                    Materials[material.name] = new Link.Visual.Material(material.name, null, texture);
                }
                else if (!material.color.Equals(Color.clear))
                {
                    Link.Visual.Material.Color color = new Link.Visual.Material.Color(ExportRgbaData(material));
                    Materials[material.name] = new Link.Visual.Material(material.name, color);
                }
                else
                {
                    return(null);
                }
            }

            return(new Link.Visual.Material(material.name));
        }
Пример #2
0
 private static Color CreateColor(Link.Visual.Material.Color urdfColor)
 {
     return(new Color(
                (float)urdfColor.rgba[0],
                (float)urdfColor.rgba[1],
                (float)urdfColor.rgba[2],
                (float)urdfColor.rgba[3]));
 }