Ejemplo n.º 1
0
 //============================================================
 // <T>加载模型信息。</T>
 //
 // @param model 模型对象
 //============================================================
 public void SaveModel()
 {
     // 隐藏几何体属性
     if (qdrModelGeometryProperty.Visible)
     {
         qdrModelGeometryProperty.SaveGeometry();
     }
     // 存储几何体信息
     foreach (DataGridViewRow row in dgvGeometries.Rows)
     {
         FDrGeometry geometry = row.Tag as FDrGeometry;
         if (null != geometry)
         {
             geometry.OptionInstanced  = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometryInstanced"].Value);
             geometry.OptionDynamic    = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometryDynamic"].Value);
             geometry.OptionShadow     = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometryShadow"].Value);
             geometry.OptionSelfShadow = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometrySelfShadow"].Value);
             geometry.OptionNormalFull = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometryNormal"].Value);
             geometry.OptionDouble     = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometryDouble"].Value);
             geometry.OptionSelect     = EDrFlag.FromBoolean((bool)row.Cells["dgcGeometrySelect"].Value);
         }
     }
 }
Ejemplo n.º 2
0
        //============================================================
        // <T>加载配置信息。</T>
        //
        // @param xconfig 配置信息
        //============================================================
        public void LoadOrignConfig(FXmlNode xconfig)
        {
            // 读取属性
            _name       = xconfig.Nvl("name");
            _effectName = xconfig.Nvl("effect_name");
            if (xconfig.Contains("option_double"))
            {
                _optionDouble = EDrFlag.FromBoolean(xconfig.GetBoolean("option_double"));
            }
            if (xconfig.Contains("option_opacity"))
            {
                _optionOpacity = EDrFlag.FromBoolean(xconfig.GetBoolean("option_opacity"));
            }
            if (xconfig.Contains("option_shadow"))
            {
                _optionShadow = EDrFlag.FromBoolean(xconfig.GetBoolean("option_shadow"));
            }
            if (xconfig.Contains("option_transmittance"))
            {
                _optionTransmittance = EDrFlag.FromBoolean(xconfig.GetBoolean("option_transmittance"));
            }
            // 读取颜色
            FXmlNode xcolor = xconfig.Find("Color");

            if (null != xcolor)
            {
                _colorMin = xcolor.GetFloat("min");
                _colorMax = xcolor.GetFloat("max");
                if (xcolor.Contains("merge"))
                {
                    _colorMerge = xcolor.GetFloat("merge");
                }
                if (xcolor.Contains("rate"))
                {
                    _colorRate = xcolor.GetFloat("rate");
                }
            }
            // 读取环境光
            FXmlNode xalpha = xconfig.Find("Alpha");

            if (null != xalpha)
            {
                _optionAlpha = EDrFlag.FromBoolean(xalpha.GetBoolean("enable"));
                _alphaBase   = xalpha.GetFloat("base");
                _alphaRate   = xalpha.GetFloat("rate");
                _alphaLevel  = xalpha.GetFloat("level");
                _alphaMerge  = xalpha.GetFloat("merge");
            }
            // 读取环境光
            FXmlNode xambient = xconfig.Find("Ambient");

            if (null != xambient)
            {
                _ambientColor.LoadConfig(xambient, "r", "g", "b", "power");
                _ambientShadow = xambient.GetFloat("shadow", _ambientShadow);
            }
            // 读取散射光
            FXmlNode xdiffuse = xconfig.Find("Diffuse");

            if (null != xdiffuse)
            {
                _diffuseColor.LoadConfig(xdiffuse, "r", "g", "b", "power");
                _diffuseShadow = xdiffuse.GetFloat("shadow", _diffuseShadow);
                _diffuseViewColor.LoadConfig(xdiffuse, "camera_r", "camera_g", "camera_b", "camera_power");
                _diffuseViewShadow = xdiffuse.GetFloat("camera_shadow", _diffuseViewShadow);
            }
            // 读取反射光
            FXmlNode xspecular = xconfig.Find("Specular");

            if (null != xspecular)
            {
                _specularColor.LoadConfig(xspecular, "r", "g", "b", "power");
                _specularBase    = xspecular.GetFloat("base", _specularBase);
                _specularRate    = xspecular.GetFloat("rate", _specularRate);
                _specularAverage = xspecular.GetFloat("average", _specularAverage);
                _specularShadow  = xspecular.GetFloat("shadow", _specularShadow);
                _specularViewColor.LoadConfig(xspecular, "camera_r", "camera_g", "camera_b", "camera_power");
                _specularViewBase    = xspecular.GetFloat("camera_base", _specularViewBase);
                _specularViewRate    = xspecular.GetFloat("camera_rate", _specularViewRate);
                _specularViewAverage = xspecular.GetFloat("camera_average", _specularViewAverage);
                _specularViewShadow  = xspecular.GetFloat("camera_shadow", _specularViewShadow);
            }
            // 读取自发光
            FXmlNode xreflect = xconfig.Find("Reflect");

            if (null != xreflect)
            {
                _reflectColor.LoadConfig(xreflect, "r", "g", "b", "power");
                _reflectMerge  = xreflect.GetFloat("merge", _reflectMerge);
                _reflectShadow = xreflect.GetFloat("shadow", _reflectShadow);
            }
            // 读取折射
            FXmlNode xrefract = xconfig.Find("Refract");

            if (null != xrefract)
            {
                _refractFrontColor.LoadConfig(xrefract, "front_r", "front_g", "front_b", "front_power");
                _refractFrontMerge  = xrefract.GetFloat("front_merge", _refractFrontMerge);
                _refractFrontShadow = xrefract.GetFloat("front_shadow", _refractFrontShadow);
                _refractBackColor.LoadConfig(xrefract, "back_r", "back_g", "back_b", "back_power");
                _refractBackMerge  = xrefract.GetFloat("back_merge", _refractBackMerge);
                _refractBackShadow = xrefract.GetFloat("back_shadow", _refractBackShadow);
            }
            // 读取不透明度
            FXmlNode xopacity = xconfig.Find("Opacity");

            if (null != xopacity)
            {
                _optionOpacity = EDrFlag.FromBoolean(xopacity.GetBoolean("enable"));
                _opacityColorColor.LoadConfigPower(xopacity);
                _opacityRate          = xopacity.GetFloat("rate", _opacityRate);
                _opacityAlpha         = xopacity.GetFloat("alpha", _opacityAlpha);
                _opacityDepth         = xopacity.GetFloat("depth", _opacityDepth);
                _opacityTransmittance = xopacity.GetFloat("transmittance", _opacityTransmittance);
            }
            // 读取自发光
            FXmlNode xemissive = xconfig.Find("Emissive");

            if (null != xemissive)
            {
                _emissiveColor.LoadConfigPower(xemissive);
            }
            // 读取高度
            FXmlNode xheight = xconfig.Find("Height");

            if (null != xheight)
            {
                //_optionHeight = EDrFlag.FromBoolean(xheight.GetBoolean("enable"));
                _heightDepth = xheight.GetFloat("depth", _heightDepth);
            }
            // 读取表面
            FXmlNode xsurface = xconfig.Find("Surface");

            if (null != xsurface)
            {
                _surfaceRate        = xsurface.GetFloat("rate", _surfaceRate);
                _surfaceReflect     = xsurface.GetFloat("reflect", _surfaceReflect);
                _surfaceBright      = xsurface.GetFloat("bright", _surfaceBright);
                _surfaceBrightLevel = xsurface.GetFloat("bright_level", _surfaceBrightLevel);
                _surfaceCoarse      = xsurface.GetFloat("coarse", _surfaceCoarse);
                _surfaceCoarseLevel = xsurface.GetFloat("coarse_level", _surfaceCoarseLevel);
                _surfaceMerge       = xsurface.GetFloat("merge", _surfaceMerge);
                _surfacePower       = xsurface.GetFloat("power", _surfacePower);
            }
        }