Exemplo n.º 1
0
        public int GetMaterial(string name, P3DMaterial type, Lib3dsFile file)
        {
            if (!Materials.ContainsKey(new Tuple <string, P3DMaterial>(name, type)))
            {
                Materials.Add(new Tuple <string, P3DMaterial>(name, type), GetMaterialForNameAndType(name, type, file));

                counter++;
            }
            return(Materials[new Tuple <string, P3DMaterial>(name, type)]);
        }
Exemplo n.º 2
0
        private int GetMaterialForNameAndType(string name, P3DMaterial type, Lib3dsFile file)
        {
            Lib3dsMaterial mat = LIB3DS.lib3ds_material_new(name);

            mat.texture1_map      = new Lib3dsTextureMap();
            mat.texture1_map.name = name;
            mat.diffuse[0]        = 0.9f;
            mat.diffuse[1]        = 0.9f;
            mat.diffuse[2]        = 0.9f;
            //            if (type == P3DMaterial.MAT_FLAT)
            //            {
            //                mat.diffuse[0] = 0.9f;
            //                mat.diffuse[1] = 0.9f;
            //                mat.diffuse[2] = 0.9f;
            //            }
            //            else if (type == P3DMaterial.MAT_GORAUD)
            //            {
            //                mat.diffuse[0] = 0.9f;
            //                mat.diffuse[1] = 0f;
            //                mat.diffuse[2] = 0f;
            //            }
            //            else if (type == P3DMaterial.MAT_GORAUD_METAL_ENV)
            //            {
            //                mat.diffuse[0] = 0f;
            //                mat.diffuse[1] = 0f;
            //                mat.diffuse[2] = 0.9f;
            //            }
            //            else
            //            {
            //                mat.diffuse[0] = 0f;
            //                mat.diffuse[1] = 0.9f;
            //                mat.diffuse[2] = 0f;
            //            }
            LIB3DS.lib3ds_file_insert_material(file, mat, -1);
            return(counter);
        }