Ejemplo n.º 1
0
        void genericMaterial_StatusUpdated(object sender, EventArgs e)
        {
            GenericMaterial g = (sender as GenericMaterial);
            Material        currentMaterial = g.GetCurrentMaterial();

            currentObject.SetTexture(g.Index, currentMaterial.FullPath, openGLControl.OpenGL);
        }
Ejemplo n.º 2
0
        void customizeMaterial_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            int             index           = (sender as CustomizeMaterial).Index;
            Material        oldMaterial     = (sender as CustomizeMaterial).GetCurrentMaterial();
            GenericMaterial genericMaterial = new GenericMaterial(materials, index, false);

            genericMaterial.StatusUpdated += genericMaterial_StatusUpdated;
            genericMaterial.ShowDialog();
            Material currentMaterial = genericMaterial.GetCurrentMaterial();

            if (GenericCategory.GetMaterialByImagePath(materials, currentMaterial.FullPath) != null)
            {
                int i = GetIndexOfMaterial(oldMaterial);
                if (i == -1)
                {
                    i = currentObjectMaterials.Count;
                    currentObjectMaterials.Add(new WorldObjectMaterial(currentMaterial, currentObject.GetTotalAreaPerTextureByPath(currentMaterial.FullPath)));
                }
                else
                {
                    currentObjectMaterials[i] = new WorldObjectMaterial(currentMaterial, currentObjectMaterials[i].SurfaceNeeded);
                }
            }

            currentObject.SetMaterials(currentObjectMaterials);
            //importedObject.Materials[
            //importedObject.Materials.Add(currentMaterial);
            InitializeMaterials();
        }