private static void LoadAndFuzzifyData(string fileName)
        {
            var developerParams = JObject.Parse(File.ReadAllText(fileName));

            var legal = (double)developerParams["legal"];

            Variables["Правовое состояние"]       = LegalStateType.CreateVariable("Правовое состояние");
            Variables["Правовое состояние"].Value = LegalStateType.GetValue(legal);

            var finance = (double)developerParams["finance"];

            Variables["Финансовое состояние"]       = FinanceStateType.CreateVariable("Финансовое состояние");
            Variables["Финансовое состояние"].Value = FinanceStateType.GetValue(finance);

            var transparent = (double)developerParams["transparent"];

            Variables["Прозрачность"]       = TransparencyType.CreateVariable("Прозрачность");
            Variables["Прозрачность"].Value = TransparencyType.GetValue(transparent);

            var honest = (double)developerParams["honest"];

            Variables["Честность"]       = HonestyType.CreateVariable("Честность");
            Variables["Честность"].Value = HonestyType.GetValue(honest);

            var plan = (double)developerParams["plan"];

            Variables["Соблюдение планов"]       = PlanType.CreateVariable("Соблюдение планов");
            Variables["Соблюдение планов"].Value = PlanType.GetValue(plan);
        }
Example #2
0
 /// <summary>
 /// Deserializes this SceneHints.
 /// </summary>
 /// <param name="input">Input to read from</param>
 public void Read(ISavableReader input)
 {
     _cullHint   = input.ReadEnum <CullHint>();
     _pickHint   = input.ReadEnum <PickingHint>();
     _lightHint  = input.ReadEnum <LightCombineHint>();
     _transHint  = input.ReadEnum <TransparencyType>();
     _bucketType = input.ReadEnum <RenderBucketType>();
     _orthoOrder = input.ReadInt();
 }
Example #3
0
 /// <summary>
 /// Creates a new scene hints object with the specified source hintable.
 /// </summary>
 /// <param name="source">Source hintable</param>
 public SceneHints(IHintable source)
 {
     _source     = source;
     _cullHint   = CullHint.Inherit;
     _lightHint  = LightCombineHint.Inherit;
     _transHint  = TransparencyType.Default;
     _pickHint   = PickingHint.Inherit;
     _orthoOrder = 0;
 }
Example #4
0
 public ColorsAndFontChangedEventArgs(ThemeType themeSetting, TransparencyType transparencySetting, Color managedColor, string fontFamily, float fontSize, bool isFontBold, bool isFontItalic)
 {
     this.ThemeSetting        = themeSetting;
     this.TransparencySetting = transparencySetting;
     this.ManagedColor        = managedColor;
     this.FontFamily          = fontFamily;
     this.FontSize            = fontSize;
     this.IsFontBold          = isFontBold;
     this.IsFontItalic        = isFontItalic;
 }
Example #5
0
        /// <summary>
        /// Gets resulting color when blending two others.
        /// </summary>
        /// <param name="overlaying">
        /// Foreground color.
        /// </param>
        /// <param name="underlaying">
        /// Background color.
        /// </param>
        /// <param name="type">
        /// Type of blending.
        /// </param>
        /// <returns>Blended color index.</returns>
        public byte GetResultingColorIndex(byte overlaying, byte underlaying, TransparencyType type)
        {
            switch (type)
            {
            case TransparencyType.None:
                return(overlaying);

            case TransparencyType.Dark:
                return(dark[underlaying * 256 + overlaying]);

            case TransparencyType.Main:
                return(main[underlaying * 256 + overlaying]);

            case TransparencyType.Light:
                return(light[underlaying * 256 + overlaying]);

            default:
                throw new ArgumentException("Unknown type.", "type");
            }
        }
Example #6
0
		void Paint (WidgetType widgetType, Rectangle bounds, IDeviceContext dc, TransparencyType transparencyType, Color background, DeviceContextType deviceContextType, Rectangle clippingArea, Painter painter, Rectangle excludedArea)
		{
			Rectangle painted_area = Rectangle.Intersect (bounds, clippingArea);
			if (painted_area.Width == 0 || painted_area.Height == 0)
				return;
			painted_area.Offset (-bounds.X, -bounds.Y);
			excludedArea.Offset (-bounds.X, -bounds.Y);
			GdkDrawablePointer drawable = gdk_pixmap_new (IntPtr.Zero, bounds.Width, bounds.Height, 24);
			painter.AttachStyle (widgetType, drawable, this);
			GdkPixbufPointer pixbuf;
			IntPtr pixel_data;
			int rowstride;
			GdkGCPointer gc = gdk_gc_new (drawable);
			GdkColor color = new GdkColor (background);
			gdk_gc_set_rgb_fg_color (gc, ref color);
			Paint (drawable, gc, bounds, widgetType, out pixbuf, out pixel_data, out rowstride, painted_area, painter, excludedArea);
			GdkPixbufPointer white_pixbuf = IntPtr.Zero;
			IntPtr white_pixel_data = IntPtr.Zero;
			int white_rowstride = 0;
			GdkColor white_color = new GdkColor();
			if (transparencyType == TransparencyType.Alpha) {
				white_color.red = guint16.MaxValue;
				white_color.green = guint16.MaxValue;
				white_color.blue = guint16.MaxValue;
				gdk_gc_set_rgb_fg_color (gc, ref white_color);
				Paint (drawable, gc, bounds, widgetType, out white_pixbuf, out white_pixel_data, out white_rowstride, painted_area, painter, excludedArea);
			}
			g_object_unref (gc);
			unsafe {
				byte* row = (byte*)pixel_data;
				byte* pixel;
				byte* white_row = (byte*)white_pixel_data;
				byte* white_pixel;

				for (int row_index = 0; row_index < painted_area.Height; row_index++) {
					pixel = row;
					white_pixel = white_row;
					for (int pixel_index = 0; pixel_index < painted_area.Width; pixel_index++) {
						const int GdkRedOffset = 0;
						const int GdkGreenOffset = 1;
						const int GdkBlueOffset = 2;
						const int BitmapAlphaOffset = 3;
						const int BitmapRedOffset = 2;
						const int BitmapBlueOffset = 0;
						switch (transparencyType) {
						case TransparencyType.Alpha:
							pixel [BitmapAlphaOffset] = (byte)(pixel [GdkRedOffset] - white_pixel [GdkRedOffset] + byte.MaxValue);
							break;
						case TransparencyType.Color:
							if (
								pixel [GdkRedOffset] == background.R &&
								pixel [GdkGreenOffset] == background.G &&
								pixel [GdkBlueOffset] == background.B) {
								const int AlphaFullyTransparent = 0;
								pixel [BitmapAlphaOffset] = AlphaFullyTransparent;
							}
							break;
						}

						byte temporary = pixel [GdkRedOffset];
						pixel [BitmapBlueOffset] = pixel [GdkBlueOffset];
						pixel [BitmapRedOffset] = temporary;

						const int PixelSize = 4;
						pixel += PixelSize;
						white_pixel += PixelSize;
					}
					row += rowstride;
					white_row += white_rowstride;
				}
			}
			if (transparencyType == TransparencyType.Alpha)
				g_object_unref (white_pixbuf);
			g_object_unref (drawable);
			Bitmap bitmap = new Bitmap (painted_area.Width, painted_area.Height, rowstride, PixelFormat.Format32bppPArgb, pixel_data);
			Graphics g;
			bool graphics_is_from_hdc = false;
			switch (deviceContextType) {
			case DeviceContextType.Graphics:
				g = (Graphics)dc;
				break;
			case DeviceContextType.Native:
				g = Graphics.FromHdc (dc.GetHdc ());
				break;
			default:
				g = dc as Graphics;
				if (g == null) {
					graphics_is_from_hdc = true;
					g = Graphics.FromHdc (dc.GetHdc ());
				} else
					graphics_is_from_hdc = false;
				break;
			}
			painted_area.Offset (bounds.X, bounds.Y);
			g.DrawImage (bitmap, painted_area.Location);
			switch (deviceContextType) {
			case DeviceContextType.Graphics:
				break;
			case DeviceContextType.Native:
				g.Dispose ();
				dc.ReleaseHdc ();
				break;
			default:
				if (graphics_is_from_hdc) {
					g.Dispose ();
					dc.ReleaseHdc ();
				}
				break;
			}
			bitmap.Dispose ();
			g_object_unref (pixbuf);
		}
        /// <summary>
        /// Called when deserializing
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected BillboardGroupShape(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            //      if (SerializationHelper.HasElement(info,"_instances"))
              _instances = (BillboardInstance[])info.GetValue("_instances", typeof(BillboardInstance[]));

              _fBaseSizeX = info.GetSingle("_fBaseSizeX");
              _fBaseSizeY = info.GetSingle("_fBaseSizeY");
              _fRelCenterX = info.GetSingle("_fRelCenterX");
              _fRelCenterY = info.GetSingle("_fRelCenterY");
              _textureFile = info.GetString("_textureFile");
              _blendMode = (TransparencyType)info.GetValue("_blendMode", typeof(TransparencyType));
              _color = (Color)info.GetValue("_color", typeof(Color));
              _bUseSceneBrightness = info.GetBoolean("_bUseSceneBrightness");
              if (SerializationHelper.HasElement(info, "_atlasFilename"))
            _atlasFilename = info.GetString("_atlasFilename");
              if (SerializationHelper.HasElement(info, "_fNearClip"))
            _fNearClip = info.GetSingle("_fNearClip");
              if (SerializationHelper.HasElement(info, "_fFarClip"))
            _fFarClip = info.GetSingle("_fFarClip");
              if (SerializationHelper.HasElement(info, "_bCastStaticShadows"))
            _bCastStaticShadows = info.GetBoolean("_bCastStaticShadows");
              if (SerializationHelper.HasElement(info, "_objectKey"))
              _objectKey = info.GetString("_objectKey");
        }
 /// <summary>
 /// Called when deserializing
 /// </summary>
 /// <param name="info"></param>
 /// <param name="context"></param>
 protected ProjectorShape(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _textureFile = info.GetString("_textureFile");
       _transp = (TransparencyType)info.GetValue("_transp",typeof(TransparencyType));
       _fConeAngleX = info.GetSingle("_fConeAngleX");
       _fConeAngleY = info.GetSingle("_fConeAngleY");
       _fLength = info.GetSingle("_fLength");
       _fFadeOutDist = info.GetSingle("_fFadeOutDist");
       _iIntensity = info.GetByte("_iIntensity");
       _color = (Color)info.GetValue("_color",typeof(Color));
       if (SerializationHelper.HasElement(info,"_bLightmapped"))
     _bLightmapped = info.GetBoolean("_bLightmapped");
       if (SerializationHelper.HasElement(info, "_geomTypeFilter"))
     _geomTypeFilter = (GeometryTypeMask)info.GetValue("_geomTypeFilter", typeof(GeometryTypeMask));
       else _geomTypeFilter = GeometryTypeMask.All; // backwards compatibility
       if (SerializationHelper.HasElement(info, "_fFarClipDistance"))
     _fFarClipDistance = info.GetSingle("_fFarClipDistance");
       // backwards compatibility
       if (!SerializationHelper.HasElement(info, "SupportScaling"))
     SetScaling_Internal(1.0f, 1.0f, 1.0f);
       if (SerializationHelper.HasElement(info, "_iInfluenceBitmask"))
     _iInfluenceBitmask = (FlagsInt32_e)info.GetValue("_iInfluenceBitmask", typeof(FlagsInt32_e));
       else
     _iInfluenceBitmask = FlagsInt32_e.All;
       if (SerializationHelper.HasElement(info, "_shaderFX"))
     _shaderFX = (ShaderEffectConfig)info.GetValue("_shaderFX", typeof(ShaderEffectConfig));
 }
Example #9
0
 /// <summary>
 /// Gets resulting color when blending two others.
 /// </summary>
 /// <param name="overlaying">
 /// Foreground color.
 /// </param>
 /// <param name="underlaying">
 /// Background color.
 /// </param>
 /// <param name="type">
 /// Type of blending.
 /// </param>
 /// <returns>Blended color index.</returns>
 public byte GetResultingColorIndex(byte overlaying, byte underlaying, TransparencyType type)
 {
     switch(type)
     {
         case TransparencyType.None:
             return overlaying;
         case TransparencyType.Dark:
             return dark[underlaying*256+overlaying];
         case TransparencyType.Main:
             return main[underlaying*256+overlaying];
         case TransparencyType.Light:
             return light[underlaying*256+overlaying];
         default:
             throw new ArgumentException("Unknown type.", "type");
     }
 }
Example #10
0
        /// <summary>
        /// Renders all renderables in the bucket.
        /// </summary>
        public override void Render()
        {
            if (_defaultPass1RS == null)
            {
                Init();
            }
            for (int i = 0; i < Count; i++)
            {
                IRenderable renderable = this[i];
                if (renderable != null)
                {
                    TransparencyType type = renderable.TransparencyType;
                    //Account for a renderable with default type or if not a single-pass material
                    if (type == TransparencyType.Default || renderable.Material.PassCount != 1)
                    {
                        type = TransparencyType.OneSided;
                    }

                    //If one sided, render as usual
                    if (renderable.TransparencyType == TransparencyType.OneSided)
                    {
                        renderable.Render(Renderer);

                        //Otherwise, do the two-pass render
                    }
                    else
                    {
                        //See if we have an enforced RS state already.
                        RasterizerState oldEnRS = Renderer.EnforcedRasterizerState;

                        //Draw normally if we have an enforced state with CullMode none or FillMode wireframe,
                        //since these are probably meant to be enforced.
                        if (oldEnRS != null && (oldEnRS.Cull == CullMode.None || oldEnRS.Fill == FillMode.WireFrame))
                        {
                            renderable.Render(Renderer);
                            continue;
                        }

                        //Grab old enforced state if it exists too, so we can put these back afterwards.
                        DepthStencilState oldEnDSS = Renderer.EnforcedDepthStencilState;

                        //Enforce first pass states
                        Renderer.EnforcedDepthStencilState = _pass1DSS;
                        Renderer.EnforcedRasterizerState   = _pass1RS;

                        //Render back faces
                        renderable.Render(Renderer);

                        //Enforce old DSS or clear
                        if (oldEnDSS != null)
                        {
                            Renderer.EnforcedDepthStencilState = oldEnDSS;
                        }
                        else
                        {
                            Renderer.ClearEnforcedState(RenderStateType.DepthStencilState);
                        }

                        //Enforce second pass RS
                        Renderer.EnforcedRasterizerState = _pass2RS;

                        //Render front faces
                        renderable.Render(Renderer);

                        //Enforce old RS or clear
                        if (oldEnRS != null)
                        {
                            Renderer.EnforcedRasterizerState = oldEnRS;
                        }
                        else
                        {
                            Renderer.ClearEnforcedState(RenderStateType.RasterizerState);
                        }
                    }
                }
            }
        }