Пример #1
0
        public static void ReplaceMaterial(xxParser parser, ImportedMaterial material)
        {
            xxMaterial mat = xx.CreateMaterial(material);

            bool found = false;

            for (int i = 0; i < parser.MaterialList.Count; i++)
            {
                if (parser.MaterialList[i].Name == material.Name)
                {
                    CopyUnknowns(parser.MaterialList[i], mat);

                    parser.MaterialList.RemoveAt(i);
                    parser.MaterialList.Insert(i, mat);
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                CreateUnknowns(mat, parser.Format);
                parser.MaterialList.Add(mat);
            }
        }
Пример #2
0
        public static xxMaterial CreateMaterial(ImportedMaterial material)
        {
            xxMaterial xxMat = new xxMaterial();

            xxMat.Name     = material.Name;
            xxMat.Diffuse  = material.Diffuse;
            xxMat.Ambient  = material.Ambient;
            xxMat.Specular = material.Specular;
            xxMat.Emissive = material.Emissive;
            xxMat.Power    = material.Power;

            xxMat.Textures = new xxMaterialTexture[4];
            for (int i = 0; i < xxMat.Textures.Length; i++)
            {
                xxMat.Textures[i] = new xxMaterialTexture();
                if ((material.Textures != null) && (i < material.Textures.Length) && (material.Textures[i] != null))
                {
                    xxMat.Textures[i].Name = material.Textures[i];
                }
                else
                {
                    xxMat.Textures[i].Name = String.Empty;
                }
            }
            return(xxMat);
        }
Пример #3
0
        public WorkspaceMaterial(ImportedMaterial importedMat) :
            base()
        {
            this.Name = importedMat.Name;

            mapping = Mapping.DEFAULT;
        }
Пример #4
0
 public void MergeMaterial(ImportedMaterial mat)
 {
     xx.ReplaceMaterial(Parser, mat);
 }
Пример #5
0
 public void MergeMaterial(ImportedMaterial mat)
 {
     xx.ReplaceMaterial(Parser, mat);
     Changed = true;
 }