public void GetTextureProperties()
        {
            bool srgb = IGCore.GetTextureSrgb(sTextureName);

            model.InitSrgb(srgb);
            TextureControl.DataContext = model;
        }
Esempio n. 2
0
 public void GetSceneObjectProperties()
 {
     float[] trans = new float[9];
     IGCore.GetSceneObjectTransform(sObjectName, trans);
     model.SetTransform(trans);
     TransformControl.DataContext = model;
 }
Esempio n. 3
0
        private void CreateMaterial(object sender, RoutedEventArgs e)
        {
            string materialName = string.Empty;

            for (int i = 0; ; i++)
            {
                string tryName = "NewMaterial";
                if (i > 0)
                {
                    tryName = tryName + "_" + Convert.ToString(i);
                }
                if (!File.Exists(currentDirectory + @"\" + tryName + ".gmat"))
                {
                    materialName = currentDirectory + @"\" + tryName + ".gmat";
                    break;
                }
            }
            string UniqueName = materialName.Substring(workDirectory.Length);
            string fileName   = System.IO.Path.GetFileName(materialName);

            IGCore.CreateMaterial(UniqueName);

            GetFiles(currentDirectory);
            browserListBox.SelectedItem = GetListBoxItemByName(fileName);
            mainWindow.GetMaterialPropertiesByUniqueName(UniqueName);
        }
        private void SetTextureBySelectedFile(int index)
        {
            string selectedPath       = mainWindow.GetBrowserSelectedFilePath();
            string selectedUniqueName = mainWindow.GetBrowserSelectedFileUniqueName();

            if (selectedPath == string.Empty)
            {
                return;
            }
            if (!System.IO.File.Exists(selectedPath))
            {
                return;
            }
            if (System.IO.Path.GetExtension(selectedPath).ToLower() == ".dds" ||
                System.IO.Path.GetExtension(selectedPath).ToLower() == ".png" ||
                System.IO.Path.GetExtension(selectedPath).ToLower() == ".jpg" ||
                System.IO.Path.GetExtension(selectedPath).ToLower() == ".tga")
            {
                if (IGCore.SetMaterialTexture(sMaterialUniqueName, index, selectedUniqueName))
                {
                    if (index == 0)
                    {
                        model.AlbedoTextureName = selectedUniqueName;
                    }
                    if (index == 1)
                    {
                        model.NormalTextureName = selectedUniqueName;
                    }
                    if (index == 2)
                    {
                        model.OrmTextureName = selectedUniqueName;
                    }
                }
            }
        }
        public void GetSettings()
        {
            string cubemapName = Marshal.PtrToStringUni(IGCore.GetSkyCubemapUniqueName());

            model.InitSkyCubemapName(cubemapName);
            ProjectSettingsControl.DataContext = model;
        }
        /*
         * public void SetTextureName(string albedoName, string normalName, string ormName)
         * {
         *
         * }
         */

        public void SetScale(float scaleX, float scaleY)
        {
            float[] scale = new float[2];
            scale[0] = scaleX;
            scale[1] = scaleY;
            IGCore.SetMaterialScale(sMaterialUniqueName, scale);
        }
Esempio n. 7
0
        void item_Selected(object sender, RoutedEventArgs e)
        {
            OutlinerItemModel selected = (OutlinerItemModel)outlinerTreeView.SelectedItem;

            if (selected.ObjectType == "Mesh")
            {
                mainWindow.GetSceneObjectProperties(selected.Name);
                IGCore.SelectSceneObject(selected.Name);
            }
        }
Esempio n. 8
0
 private void OnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         OutlinerItemModel sObjModel = outlinerTreeView.SelectedItem as OutlinerItemModel;
         mainWindow.RemovePropertiesPanel();
         IGCore.DeleteSceneObject(sObjModel.Name);
         Refresh();
     }
 }
Esempio n. 9
0
        public Outliner()
        {
            InitializeComponent();

            LoadImages();

            mSetSceneObjectsCallback = new IGCore.VoidFuncPointerType(SetSceneObjects);

            IGCore.SetSetSceneObjectsCallback(mSetSceneObjectsCallback);
        }
Esempio n. 10
0
 public void GetSceneObjectProperties()
 {
     float[] trans = new float[9];
     IGCore.GetSceneObjectTransform(sObjectName, trans);
     model.SetTransform(trans);
     model.InitName(sObjectName);
     model.InitMeshName(Marshal.PtrToStringUni(IGCore.GetSceneObjectMeshName(sObjectName)));
     model.InitMaterialName(Marshal.PtrToStringUni(IGCore.GetSceneObjectMaterialName(sObjectName)));
     CommonControl.DataContext    = model;
     TransformControl.DataContext = model;
     RenderControl.DataContext    = model;
 }
        public void GetMaterialProperties()
        {
            //model.Name = System.IO.Path.GetFileNameWithoutExtension(sMaterialUniqueName);
            model.InitName(System.IO.Path.GetFileNameWithoutExtension(sMaterialUniqueName));
            float[] scale = new float[2];
            IGCore.GetMaterialScale(sMaterialUniqueName, scale);
            model.MatScaleX         = scale[0].ToString();
            model.MatScaleY         = scale[1].ToString();
            model.AlbedoTextureName = Marshal.PtrToStringUni(IGCore.GetMaterialTextureUniqueName(sMaterialUniqueName, 0));
            model.NormalTextureName = Marshal.PtrToStringUni(IGCore.GetMaterialTextureUniqueName(sMaterialUniqueName, 1));
            model.OrmTextureName    = Marshal.PtrToStringUni(IGCore.GetMaterialTextureUniqueName(sMaterialUniqueName, 2));

            MaterialCommonControl.DataContext  = model;
            MaterialTextureControl.DataContext = model;
        }
        public void SetName(string matName)
        {
            // check and rename the material file.
            string oldPath       = mainWindow.GetWorkDirectory() + sMaterialUniqueName;
            string newUniqueName = System.IO.Path.GetDirectoryName(sMaterialUniqueName) + @"\" + matName + ".gmat";
            string newPath       = mainWindow.GetWorkDirectory() + newUniqueName;

            if (!System.IO.File.Exists(newPath))
            {
                //  rename the .gmat file and the material.
                System.IO.FileInfo fi = new System.IO.FileInfo(oldPath);
                fi.MoveTo(newPath);
                IGCore.RenameMaterial(sMaterialUniqueName, newUniqueName);
                sMaterialUniqueName = newUniqueName;
            }
            mainWindow.RefreshBrowser();
        }
Esempio n. 13
0
        public void Set(UserControl selfRef, string type, string id)
        {
            string selectedPath       = mainWindow.GetBrowserSelectedFilePath();
            string selectedUniqueName = mainWindow.GetBrowserSelectedFileUniqueName();

            if (selectedPath == string.Empty)
            {
                return;
            }
            if (!System.IO.File.Exists(selectedPath))
            {
                return;
            }
            if (System.IO.Path.GetExtension(selectedPath).ToLower() == ".gmat")
            {
                //model.SetMaterialUniqueName(id, selectedUniqueName);
                IGCore.SetSceneObjectOverrideMaterial(sObjectName, id, selectedUniqueName);
                ((PathLoader)selfRef).model.MaterialUniqueName = selectedUniqueName;
            }
        }
Esempio n. 14
0
        public void GetMeshProperties()
        {
            //model = new PropertiesModel_Mesh();
            //model.SetParent(this);
            int    submeshCount    = IGCore.GetMeshSubmeshCount(sMeshName);
            IntPtr submeshNamesPtr = IGCore.GetMeshSubmeshNames(sMeshName);// TODO : Manually free memory.
            var    submeshNameList = GetAllStrings(submeshNamesPtr, submeshCount);

            for (var i = 0; i < submeshCount; i++)
            {
                var newPathLoader = new PathLoader();
                newPathLoader.Init();
                newPathLoader.Id = submeshNameList[i];
                newPathLoader.model.LabelText          = submeshNameList[i];
                newPathLoader.model.MaterialUniqueName = Marshal.PtrToStringUni(IGCore.GetMeshSubmeshMaterialUniqueName(sMeshName, submeshNameList[i]));
                newPathLoader.parent = this;
                MaterialPanel.Children.Add(newPathLoader);
                pathLoaders.Add(newPathLoader);
            }
        }
Esempio n. 15
0
        List <OutlinerItemModel> GetAllSceneObjectsInScene()
        {
            List <OutlinerItemModel> sObjects = new List <OutlinerItemModel>();

            int numObj = IGCore.GetSceneObjectNum();

            for (int i = 0; i < numObj; i++)
            {
                IntPtr pName   = IGCore.GetSceneObjectName(i);
                string objName = Marshal.PtrToStringUni(pName);
                //string objName = Marshal.PtrToStringAnsi(pName);
                OutlinerItemModel obj = new OutlinerItemModel();
                obj.Icon       = outlinerIcons["Mesh"];
                obj.Name       = objName;
                obj.Children   = new List <OutlinerItemModel>();
                obj.ObjectType = "Mesh";
                sObjects.Add(obj);
            }

            return(sObjects);
        }
Esempio n. 16
0
        private void CreateSceneObject(string meshUniqueName)
        {
            string sObjName = string.Empty;

            for (int i = 0; ; i++)
            {
                string tryName = "NewSceneObject";
                if (i > 0)
                {
                    tryName = tryName + "_" + Convert.ToString(i);
                }
                if (!IGCore.SceneObjectExists(tryName))
                {
                    sObjName = tryName;
                    break;
                }
            }

            IGCore.CreateSceneObject(sObjName, meshUniqueName);

            GetSceneObjects();
            OutlinerItemModel newModel = null;

            foreach (object item in outlinerTreeView.Items)
            {
                OutlinerItemModel model = item as OutlinerItemModel;
                if (model.Name == sObjName)
                {
                    newModel = model;
                    break;
                }
            }
            if (newModel != null)
            {
                //TreeViewItem tvi = (TreeViewItem)outlinerTreeView.ItemContainerGenerator.ContainerFromItem(newModel);
                //tvi.Focus();
            }
            //mainWindow.GetSceneObjectProperties(sObjName);
        }
 public void SetTestValue2()
 {
     IGCore.SetTestValue(1, model.TestValue2);
 }
 public void SetTestValue1()
 {
     IGCore.SetTestValue(0, model.TestValue1);
 }
 public void SetSkyCubemapName()
 {
     IGCore.SetSkyCubemapUniqueName(model.SkyCubemapName);
 }
Esempio n. 20
0
 public void Reset(UserControl selfRef, string type, string id)
 {
     IGCore.SetSceneObjectOverrideMaterial(sObjectName, id, "None");
     ((PathLoader)selfRef).model.MaterialUniqueName = "None";
 }
 public bool SkyCubemapNameAvailable(string newName)
 {
     return(IGCore.SkyCubemapNameAvailable(newName));
 }
        private void ClearSkyCubemap(object sender, RoutedEventArgs e)
        {
            string defaultSkyCubemapUniqueName = Marshal.PtrToStringUni(IGCore.GetDefaultSkyCubemapUniqueName());

            model.SkyCubemapName = defaultSkyCubemapUniqueName;
        }
Esempio n. 23
0
 public void RefreshTransform()
 {
     float[] trans = new float[9];
     IGCore.GetSceneObjectTransform(sObjectName, trans);
     model.SetTransform(trans);
 }
Esempio n. 24
0
 public bool NameAvailable(string name)
 {
     return(!IGCore.SceneObjectExists(name));
 }
Esempio n. 25
0
 public void SetSceneObjectName()
 {
     IGCore.RenameSceneObject(sObjectName, model.Name);
     sObjectName = model.Name;
     mainWindow.RefreshOutliner();
 }
Esempio n. 26
0
 public void SetSceneObjectTransform()
 {
     IGCore.SetSceneObjectTransform(sObjectName, model.GetTransform());
 }
Esempio n. 27
0
 public void SetSceneObjectMesh()
 {
     IGCore.SetSceneObjectMesh(sObjectName, model.MeshUniqueName);
 }
 public void SetTestValue3()
 {
     IGCore.SetTestValue(2, model.TestValue3);
 }
 public void SetTestBool()
 {
     IGCore.SetTestBool(model.TestBool);
 }
 public void SetTextureProperties()
 {
     IGCore.SetTextureSrgb(sTextureName, model.bSrgb);
     //MessageBox.Show(model.ScaleX + "," + model.ScaleY + "," + model.ScaleZ);
 }