Example #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);
        }
Example #2
0
 //============================================================
 // <T>加载配置信息。</T>
 //
 // @param xconfig 配置信息
 //============================================================
 public void LoadConfig(FXmlNode xconfig)
 {
     _nodes.Clear();
     _displays.Clear();
     // 读取所有信息
     foreach (FXmlNode xnode in xconfig.Nodes)
     {
         // 创建节点对象
         if (xnode.IsName("Node"))
         {
             FDrSceneNode nodeNode = new FDrSceneNode();
             nodeNode.Parent = this;
             nodeNode.Scene  = _scene;
             nodeNode.LoadConfig(xnode);
             _displays.Append(nodeNode.Displays);
             _nodes.Push(nodeNode);
         }
         // 创建显示对象
         if (xnode.IsName("Display"))
         {
             FDrSceneDisplay display = new FDrSceneDisplay();
             display.Parent = this;
             display.Scene  = _scene;
             display.LoadConfig(xnode);
             _displays.Push(display);
         }
     }
     // 获得所有显示对象
     foreach (FDrSceneNode node in _nodes)
     {
         node.FilterDisplays(_displays);
     }
     foreach (FDrSceneDisplay display in _displays)
     {
         display.UpdateMatrix();
     }
 }
Example #3
0
 //============================================================
 // <T>过滤所有显示对象集合。</T>
 //============================================================
 public void FilterDisplays(FObjects <FDrSceneDisplay> displays)
 {
     displays.Append(_displays);
 }