コード例 #1
0
        //============================================================
        // <T>导入材质信息。</T>
        //============================================================
        public void ImportMaterial()
        {
            Open();
            // 获得显示列表
            FObjects <FDrSceneDisplay> displays = new FObjects <FDrSceneDisplay>();

            displays.Append(_sky.Displays);
            displays.Append(_map.Displays);
            displays.Append(_space.Displays);
            // 压缩文件
            foreach (FDrSceneDisplay display in displays)
            {
                foreach (FDrSceneMaterial sceneMaterial in display.Materials)
                {
                    // 获得场景
                    FDrMaterialGroup group    = RContent3dManager.MaterialConsole.FindGroup(sceneMaterial.Name);
                    FDrMaterial      material = group.SyncMaterial(_themeName);
                    _logger.Debug(this, "ImportMaterial", "Import material. (material={0}, theme={1})", group.Code, _themeName);
                    // 设置颜色
                    material.ColorMin   = sceneMaterial.ColorMin;
                    material.ColorMax   = sceneMaterial.ColorMax;
                    material.ColorMerge = sceneMaterial.ColorMerge;
                    material.ColorRate  = sceneMaterial.ColorRate;
                    // 设置透明
                    material.AlphaBase  = sceneMaterial.AlphaBase;
                    material.AlphaRate  = sceneMaterial.AlphaRate;
                    material.AlphaLevel = sceneMaterial.AlphaLevel;
                    material.AlphaMerge = sceneMaterial.AlphaMerge;
                    // 设置颜色
                    material.AmbientColor.Assign(sceneMaterial.AmbientColor);
                    material.DiffuseColor.Assign(sceneMaterial.DiffuseColor);
                    material.DiffuseViewColor.Assign(sceneMaterial.DiffuseViewColor);
                    material.SpecularColor.Assign(sceneMaterial.SpecularColor);
                    material.SpecularBase    = sceneMaterial.SpecularBase;
                    material.SpecularRate    = sceneMaterial.SpecularRate;
                    material.SpecularAverage = sceneMaterial.SpecularAverage;
                    material.SpecularShadow  = sceneMaterial.SpecularShadow;
                    material.SpecularViewColor.Assign(sceneMaterial.SpecularViewColor);
                    material.SpecularViewBase    = sceneMaterial.SpecularViewBase;
                    material.SpecularViewRate    = sceneMaterial.SpecularViewRate;
                    material.SpecularViewAverage = sceneMaterial.SpecularViewAverage;
                    material.SpecularViewShadow  = sceneMaterial.SpecularViewShadow;
                    // 存储资源组
                    group.Store();
                }
            }
            _logger.Debug(this, "Export", "Export scene success. (file_name={0})", _exportFileName);
        }
コード例 #2
0
        //============================================================
        // <T>按照选中保存。</T>
        //============================================================
        public void SaveSelect()
        {
            FObjects <TreeNode> checkeds = tvwCatalog.FetchCheckedNodes();

            foreach (TreeNode node in checkeds)
            {
                FCfgFolder folder = node.Tag as FCfgFolder;
                if (folder != null)
                {
                    FDrMaterialGroup material = folder.Tag as FDrMaterialGroup;
                    if (null != material)
                    {
                        material.Store();
                    }
                }
            }
        }
コード例 #3
0
 //============================================================
 // <T>保存按键按下处理。</T>
 //============================================================
 private void tspSave_Click(object sender, EventArgs e)
 {
     SaveMaterial(_materialGroup);
     _materialGroup.Store();
     MessageBox.Show("已经保存成功。", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
 }