Exemple #1
0
        private BaseMaterial CreateMaterial(XbimColour colour)
        {
            string name = colour.Name;
            //we need a name so make from values
            if (string.IsNullOrEmpty(name))
            {
                name = colour.Red.ToString() + "," + colour.Green.ToString() + "," + colour.Blue.ToString() + "," + colour.Alpha.ToString() + ","
                       + colour.SpecularFactor.ToString() + "," + colour.ReflectionFactor.ToString() + "," + colour.DiffuseFactor.ToString();
            }
            _Description = "Colour " + name;

            Int32 id = 0;
            BaseMaterial mat = new BaseMaterial
            {
                Name = name,
                MaterialID = id,
                Red = colour.Red,
                Green = colour.Green,
                Blue = colour.Blue,
                Alpha = colour.Alpha
            };
            if (colour.SpecularFactor > 0)
                mat.Specular = colour.SpecularFactor * 100; //not sure on 100, copy from WpfMaterial class so might need adjusting
            if (colour.ReflectionFactor > 0)
                mat.Emit = colour.ReflectionFactor;
            if (colour.DiffuseFactor > 0)
                mat.Diffusion = colour.DiffuseFactor;
            return mat;
        }
Exemple #2
0
 private BaseMaterial EditMaterial(BaseMaterial mat, XbimColour colour)
 {
     if (colour.SpecularFactor > 0)
         mat.Specular = colour.SpecularFactor * 100; //not sure on 100, copy from WpfMaterial class so might need adjusting
     if (colour.ReflectionFactor > 0)
         mat.Emit = colour.ReflectionFactor;
     if (colour.DiffuseFactor > 0)
         mat.Diffusion = colour.DiffuseFactor;
     return mat;
 }
Exemple #3
0
 public void Add(BaseMaterial mat)
 {
     if (mat != null)
     {
         Materials.Add(mat);
     }
 }