public VertexMetadata(float x, float y, float z, float u, float v, Color color, uint faceIndex, uint triangleIndex)
 {
     Position = new Vector4(x, y, z, 1f);
     TextureCoordinate = new Vector2(u, v);
     Color = color;
     FaceIndex = faceIndex;
     TriangleIndex = triangleIndex;
 }
Esempio n. 2
0
 public void Operation(Operations operation)
 {
     Random rand = new Random(84329);
     Vector4 v1 = new Vector4(Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()));
     Vector4 v2 = new Vector4(Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()));
     foreach (var iteration in Benchmark.Iterations)
         using (iteration.StartMeasurement())
             ExecuteTest(operation, 1000000, v1, v2);
 }
Esempio n. 3
0
 public void ExecuteTest(Operations operation, int innerIterations, Vector4 v1, Vector4 v2)
 {
     Vector4 res;
     switch (operation)
     {
         case Operations.Add_Operator:
             for (int i = 0; i < innerIterations; i++)
             { res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; res = v1 + v2; }
             break;
         case Operations.Add_Function:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); Vector4.Add(v1, v2); }
             break;
         case Operations.Sub_Operator:
             for (int i = 0; i < innerIterations; i++)
             { res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; res = v1 - v2; }
             break;
         case Operations.Sub_Function:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); Vector4.Subtract(v1, v2); }
             break;
         case Operations.Mul_Operator:
             for (int i = 0; i < innerIterations; i++)
             { res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; res = v1 * v2; }
             break;
         case Operations.Mul_Function:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); Vector4.Multiply(v1, v2); }
             break;
         case Operations.Dot:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); Vector4.Dot(v1, v2); }
             break;
         case Operations.SquareRoot:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); Vector4.SquareRoot(v1); }
             break;
         case Operations.Length_Squared:
             for (int i = 0; i < innerIterations; i++)
             { v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); v1.LengthSquared(); }
             break;
         case Operations.Normalize:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); Vector4.Normalize(v1); }
             break;
         case Operations.Distance_Squared:
             for (int i = 0; i < innerIterations; i++)
             { Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); Vector4.DistanceSquared(v1, v2); }
             break;
     }
 }
Esempio n. 4
0
 static int Main(string[] args)
 {
     Point a = new Point(11, 13, 8, 4);
     Point b = new Point(11, 13, 2, 1);
     Point d = a * b;
     Point s = Point.SquareRoot(d);
     s *= -1;
     s = Point.Abs(s);
     if ((int)(s.X) == 11 && (int)(s.Y) == 13 && (int)(s.Z) == 4 && (int)(s.W) == 2)
     {
         return 100;
     }
     return 0;
 }
Esempio n. 5
0
 static int Main(string[] args)
 {
     {
         var a = new System.Numerics.Vector<int>(1);
         object b = a;
         if (b is System.Numerics.Vector<int>)
         {
             var c = (System.Numerics.Vector<int>)b;
             if (a != c)
             {
                 return 0;
             }
         }
         else
         {
             return 0;
         }
     }
     {
         var a = new System.Numerics.Vector4(1);
         object b = a;
         if (b is System.Numerics.Vector4)
         {
             var c = (System.Numerics.Vector4)b;
             if (a != c)
             {
                 return 0;
             }
         }
         else
         {
             return 0;
         }
     }
     return 100;
 }
 public VertexPosColTex(Vector4 position, Color4 color, TextureCoordinate textureCoordinate)
 {
     Position = position;
     Color = color;
     TextureCoordinate = textureCoordinate;
 }
Esempio n. 7
0
 public static void SetValue(this EffectParameter collection, Vector4 value)
 {
     collection.SetValue(value.ToXNA());
 }
Esempio n. 8
0
 private Color(Vector4 vec)
 {
     this.backingVector = vec;
 }
Esempio n. 9
0
    /// <summary>Creates a vector from a two-dimensional vector, a Y-component, and a Z-component</summary>
    /// <param name="vector">The value of the x and y dimensions.</param>
    /// <param name="z">The value of the z-component.</param>
    /// <param name="w">The value of the w-component.</param>
    public static Vector4 Create(Vector2 vector, float z, float w)
    {
        var value = new SysVector4(vector.AsSystemVector2(), z, w);

        return(new Vector4(value.AsVector128()));
    }
Esempio n. 10
0
        public void Initialize(DalamudPluginInterface pluginInterface)
        {
            // Initializing plugin, hooking into chat.
            this.pluginInterface = pluginInterface;
            Configuration        = pluginInterface.GetPluginConfig() as ChatExtenderPluginConfiguration ?? new ChatExtenderPluginConfiguration();

            tab_ind       = UintCol(255, 50, 70, 50);
            tab_ind_text  = UintCol(255, 150, 150, 150);
            tab_norm      = UintCol(255, 50, 50, 50);
            tab_norm_text = UintCol(255, 150, 150, 150);
            tab_sel       = UintCol(255, 90, 90, 90);
            tab_sel_text  = UintCol(255, 250, 255, 255);

            try
            { rTr = Configuration.RTr.ToString(); }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load right Translate Surround!");
            }

            try
            { lTr = Configuration.LTr.ToString(); }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load left Translate Surround!");
            }

            try
            { chanColour = Configuration.ChanColour.ToArray(); }
            catch (Exception)
            { PluginLog.LogError("No ChanColour to load!"); }

            try
            { logColour = Configuration.LogColour.ToArray(); }
            catch (Exception)
            { PluginLog.LogError("No LogColour to load!"); }

            try
            { injectChat = Configuration.Inject; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Inject Status!");
                injectChat = false;
            }

            try
            { translator = Configuration.Translator; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Translator Choice!");
                translator = 1;
            }

            try
            { yandex = Configuration.YandexKey.ToString(); }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Yandex Key!");
                yandex = "";
            }

            try
            { chatWindow = Configuration.Extender; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Extender Choice!");
                chatWindow = false;
            }

            try
            { alpha = Configuration.Alpha; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Alpha!");
                alpha = 0.2f;
            }

            try
            { no_move = Configuration.NoMove; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load NoMove Config!");
                no_move = false;
            }

            try
            { no_resize = Configuration.NoResize; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load NoMove Config!");
                no_resize = false;
            }

            try
            { no_mouse = Configuration.NoMouse; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load NoMouse Config!");
                no_mouse = false;
            }

            try
            {
                high     = Configuration.High;
                tempHigh = String.Join(",", high.highlights);
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Highlighter");
                high = new Highlighter();
            }

            try
            {
                if (high.highlights.Length < 1)
                {
                    high = new Highlighter();
                }
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Highlighter");
                high = new Highlighter();
            }


            try
            { no_mouse2 = Configuration.NoMouse2; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load NoMouse2 Config!");
                no_mouse2 = false;
            }

            try
            { no_scrollbar = Configuration.NoScrollBar; }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load ScrollBar Config!");
                no_scrollbar = false;
            }

            try
            {
                if (Configuration.Space_Hor.HasValue)
                {
                    space_hor = Configuration.Space_Hor.Value;
                }
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Horizontal Spacing!");
                space_hor = 4;
            }

            try
            {
                if (Configuration.Space_Ver.HasValue)
                {
                    space_ver = Configuration.Space_Ver.Value;
                }
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Vertical Spacing!");
                space_ver = 0;
            }

            try
            {
                if (Configuration.TimeColour.Z > 0)
                {
                    timeColour = Configuration.TimeColour;
                }
                else
                {
                    timeColour = new Num.Vector4(255, 255, 255, 255);
                }
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Time Colour!");
                timeColour = new Num.Vector4(255, 255, 255, 255);
            }

            try
            {
                if (Configuration.NameColour.Z > 0)
                {
                    nameColour = Configuration.NameColour;
                }
                else
                {
                    nameColour = new Num.Vector4(255, 255, 255, 255);
                }
            }
            catch (Exception)
            {
                PluginLog.LogError("Failed to Load Name Colour!");
                nameColour = new Num.Vector4(255, 255, 255, 255);
            }

            //TODO: try/catch this?
            if (Configuration.Items == null)
            {
                //Serilog.Log.Information("Null DynTab List");
                items.Add(new DynTab("XXX", new List <ChatText>(), true));
            }
            else
            {
                //Serilog.Log.Information("Not Null DynTab List");
                if (Configuration.Items.Count == 0)
                {
                    //Serilog.Log.Information("Empty DynTab List");
                    items.Add(new DynTab("YYY", new List <ChatText>(), true));
                }
                else
                {
                    //Serilog.Log.Information("Normal DynTab List");
                    items = Configuration.Items.ToList();
                }
            }

            if (items[0].Config.Length == 3)
            {
                foreach (TabBase item in items)
                {
                    bool[] temp = { false, false, false, false, false, false, false, false, false, false };
                    temp[0]     = item.Config[0];
                    temp[1]     = item.Config[1];
                    temp[2]     = item.Config[2];
                    item.Config = temp;
                }
            }

            if (items[0].Filter == null)
            {
                foreach (TabBase item in items)
                {
                    item.Filter   = "";
                    item.FilterOn = false;
                }
            }

            try
            {
                if (Configuration.Items[0].Logs.Length < Channels.Length)
                {
                    int            l        = 0;
                    List <TabBase> templist = new List <TabBase>();
                    foreach (TabBase items in Configuration.Items)
                    {
                        TabBase temp = new TabBase();
                        temp.AutoScroll = items.AutoScroll;
                        temp.Chat       = items.Chat;
                        temp.Config     = items.Config;
                        temp.Enabled    = items.Enabled;
                        temp.Scroll     = items.Scroll;
                        temp.Title      = items.Title;
                        int i = 0;
                        foreach (bool set in items.Logs)
                        {
                            //PluginLog.Log(i.ToString());
                            temp.Logs[i] = set;
                            i++;
                        }
                        //PluginLog.Log("bool length:" + temp.Logs.Length.ToString());
                        templist.Add(temp);
                        l++;
                    }

                    items = templist;

                    Num.Vector4[] logColour_temp =
                    {
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255)
                    };

                    int j = 0;
                    foreach (Num.Vector4 vec in logColour)
                    {
                        logColour_temp[j] = vec;
                        j++;
                    }
                    logColour = logColour_temp;

                    Num.Vector4[] chanColour_temp =
                    {
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255),
                        new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255), new Num.Vector4(255, 255, 255, 255)
                    };

                    int k = 0;
                    foreach (Num.Vector4 vec in chanColour)
                    {
                        chanColour_temp[k] = vec;
                        k++;
                    }
                    chanColour = chanColour_temp;
                }
            }
            catch (Exception)
            {
                PluginLog.Log("Fresh install, no log to fix!");
            }

            //Adding in Chans
            try
            {
                if (Configuration.Items[0].Chans.Length < Channels.Length)
                {
                    int            l        = 0;
                    List <TabBase> templist = new List <TabBase>();
                    foreach (TabBase items in Configuration.Items)
                    {
                        TabBase temp = new TabBase();
                        temp.AutoScroll = items.AutoScroll;
                        temp.Chat       = items.Chat;
                        temp.Config     = items.Config;
                        temp.Enabled    = items.Enabled;
                        temp.Scroll     = items.Scroll;
                        temp.Title      = items.Title;
                        temp.Logs       = items.Logs.ToArray();
                        temp.Chans      =
                            new bool[] {
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true, true,
                            true, true, true, true
                        };
                        templist.Add(temp);
                        l++;
                    }

                    items = templist;
                }
            }
            catch (Exception)
            {
                PluginLog.Log("Fresh install, no Chans to fix!");
            }

            try
            {
                if (Configuration.Chan.Length > 30)
                {
                    Chan = Configuration.Chan.ToArray();
                }
            }
            catch (Exception)
            {
                PluginLog.Log("No Chan list to load");
            }

            SaveConfig();

            TransY.Make("https://translate.yandex.net/api/v1.5/tr.json/translate", Configuration.YandexKey);

            // Set up command handlers
            this.pluginInterface.CommandManager.AddHandler("/cht", new CommandInfo(OnTranslateCommand)
            {
                HelpMessage = "Open config with '/cht c', and the extender with '/cht w'"
            });

            this.pluginInterface.Framework.Gui.Chat.OnChatMessage += Chat_OnChatMessage;
            this.pluginInterface.UiBuilder.OnBuildUi      += ChatUI;
            this.pluginInterface.UiBuilder.OnOpenConfigUi += Chat_ConfigWindow;

            //ImGui.GetIO().Fonts.Build();
        }
Esempio n. 11
0
        public void DrawSettingsMenu()
        {
            if (ImGui.Combo("Select Theme", ref SelectedThemeId, coreSettings.Theme.Values.ToArray(), coreSettings.Theme.Values.Count))
            {
                if (SelectedThemeName != coreSettings.Theme.Values[SelectedThemeId])
                {
                    SelectedThemeName = coreSettings.Theme.Values[SelectedThemeId];
                    LoadedTheme       = LoadTheme(coreSettings.Theme.Values[SelectedThemeId], false);
                    ApplyTheme(LoadedTheme);
                }
            }

            if (ImGui.Button("Save current theme settings to selected"))
            {
                var currentThemeNew = ReadThemeFromCurrent();
                SaveTheme(currentThemeNew, SelectedThemeName);
            }

            ImGui.Text("");
            ImGui.InputText("New theme name", ref NewThemeName, 200, ImGuiInputTextFlags.None);

            if (ImGui.Button("Create new theme from current"))
            {
                if (!string.IsNullOrEmpty(NewThemeName))
                {
                    var regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
                    var r           = new Regex($"[{Regex.Escape(regexSearch)}]");
                    NewThemeName = r.Replace(NewThemeName, "");

                    var currentThemeNew = ReadThemeFromCurrent();
                    SaveTheme(currentThemeNew, NewThemeName);
                    SelectedThemeName = NewThemeName;
                    LoadThemeFilesList();
                }
            }

            ImGui.Text("");

            var style = ImGui.GetStyle();

            if (ImGui.TreeNode("Theme settings"))
            {
                style.AntiAliasedFill  = DrawBoolSetting("AntiAliasedFill", style.AntiAliasedFill);
                style.AntiAliasedLines = DrawBoolSetting("AntiAliasedLines", style.AntiAliasedLines);

                style.Alpha = DrawFloatSetting("Alpha", style.Alpha * 100, 0, 100) / 100f;

                style.DisplayWindowPadding   = DrawVectorSetting("DisplayWindowPadding", style.DisplayWindowPadding, 0, 20);
                style.TouchExtraPadding      = DrawVectorSetting("TouchExtraPadding", style.TouchExtraPadding, 0, 10);
                style.WindowPadding          = DrawVectorSetting("WindowPadding", style.WindowPadding, 0, 20);
                style.FramePadding           = DrawVectorSetting("FramePadding", style.FramePadding, 0, 20);
                style.DisplaySafeAreaPadding = DrawVectorSetting("DisplaySafeAreaPadding", style.DisplaySafeAreaPadding, 0, 20);

                style.ItemInnerSpacing = DrawVectorSetting("ItemInnerSpacing", style.ItemInnerSpacing, 0, 20);
                style.ItemSpacing      = DrawVectorSetting("ItemSpacing", style.ItemSpacing, 0, 20);

                style.GrabMinSize   = DrawFloatSetting("GrabMinSize", style.GrabMinSize, 0, 20);
                style.GrabRounding  = DrawFloatSetting("GrabRounding", style.GrabRounding, 0, 12);
                style.IndentSpacing = DrawFloatSetting("IndentSpacing", style.IndentSpacing, 0, 30);

                style.ScrollbarRounding = DrawFloatSetting("ScrollbarRounding", style.ScrollbarRounding, 0, 19);
                style.ScrollbarSize     = DrawFloatSetting("ScrollbarSize", style.ScrollbarSize, 0, 20);

                style.WindowTitleAlign  = DrawVectorSetting("WindowTitleAlign", style.WindowTitleAlign, 0, 1, 0.1f);
                style.WindowRounding    = DrawFloatSetting("WindowRounding", style.WindowRounding, 0, 14);
                style.ChildRounding     = DrawFloatSetting("ChildWindowRounding", style.ChildRounding, 0, 16);
                style.FrameRounding     = DrawFloatSetting("FrameRounding", style.FrameRounding, 0, 12);
                style.ColumnsMinSpacing = DrawFloatSetting("ColumnsMinSpacing", style.ColumnsMinSpacing, 0, 30);

                style.CurveTessellationTol = DrawFloatSetting("CurveTessellationTolerance", style.CurveTessellationTol * 100, 0, 100) / 100;
            }

            ImGui.Text("");
            ImGui.Text("Colors:");
            ImGui.Columns(2, "Columns", true);

            var colorTypes = Enum.GetValues(typeof(ImGuiCol)).Cast <ImGuiCol>();
            var count      = colorTypes.Count() / 2;

            foreach (var type in colorTypes)
            {
                unsafe
                {
                    var nameFixed = Regex.Replace(type.ToString(), "(\\B[A-Z])", " $1");

                    var styleColorVec4 = ImGui.GetStyleColorVec4(type);
                    var colorValue     = new Vector4(styleColorVec4->X, styleColorVec4->Y, styleColorVec4->Z, styleColorVec4->W);

                    if (ImGui.ColorEdit4(nameFixed, ref colorValue,
                                         ImGuiColorEditFlags.AlphaBar | ImGuiColorEditFlags.NoInputs |
                                         ImGuiColorEditFlags.AlphaPreviewHalf))
                    {
                        //    style.SetColor(type, colorValue);
                        ImGui.PushStyleColor(type, colorValue);
                    }

                    if (count-- == -1)
                    {
                        ImGui.NextColumn();
                    }
                }
            }
        }
Esempio n. 12
0
 public RGBA128F(Luminance32F luma) : this()
 {
     RGBA = new XYZA(luma.L, luma.L, luma.L, 1);
 }
Esempio n. 13
0
 public RGBA128F(Luminance16 luma) : this()
 {
     RGBA = new XYZA(luma.L, luma.L, luma.L, 65565) / 65535f;
 }
Esempio n. 14
0
 public RGBA128F(Luminance8 luma) : this()
 {
     RGBA = new XYZA(luma.L, luma.L, luma.L, 255) / 255f;
 }
Esempio n. 15
0
 public RGBA128F(Alpha8 alpha) : this()
 {
     RGBA = new XYZA(255, 255, 255, alpha.A) / 255f;
 }
Esempio n. 16
0
 public BGRA128F(Single red, Single green, Single blue, Single alpha) : this()
 {
     BGRA = new XYZA(blue, green, red, alpha);
 }
Esempio n. 17
0
 public BGRA128F(RGBA128F color) : this()
 {
     BGRA = new XYZA(color.B, color.G, color.R, color.A);
 }
Esempio n. 18
0
 public BGRA128F(BGRA32 color) : this()
 {
     BGRA = new XYZA(color.B, color.G, color.R, color.A) / 255f;
 }
Esempio n. 19
0
 public static VertexPosColTex From(Vector4 pos, TextureCoordinate coord)
 {
     return From(pos, Primitives.Color.White, coord);
 }
Esempio n. 20
0
 public static VertexPosColTex From(Vector4 pos, Color color, TextureCoordinate coord)
 {
     return new VertexPosColTex(pos, color, coord);
 }
Esempio n. 21
0
 public RGBA128F(BGRA4444 color) : this()
 {
     RGBA = new XYZA(color.R, color.G, color.B, color.A) / 255f;
 }
        public static void SetValue(this EffectParameter collection, Vector4 value)
        {
            Contract.Requires(collection != null);

            collection.SetValue(value.ToXNA());
        }
Esempio n. 23
0
 public RGBA128F(RGB24 color) : this()
 {
     RGBA = new XYZA(color.R, color.G, color.B, 255) / 255f;
 }
Esempio n. 24
0
 public static Color ToXNAColor(this Num.Vector4 self) => new Color(self.X * 1.0f, self.Y * 1.0f, self.Z * 1.0f, self.W * 1.0f);
Esempio n. 25
0
 public RGBA128F(ARGB32 color) : this()
 {
     RGBA = new XYZA(color.R, color.G, color.B, color.A) / 255f;
 }
Esempio n. 26
0
 /// <summary>
 /// Constructs a color from the given component values.
 /// </summary>
 /// <param name="r">The color's red value</param>
 /// <param name="g">The color's green value</param>
 /// <param name="b">The color's blue value</param>
 /// <param name="a">The color's alpha value</param>
 public Color(float r, float g, float b, float a)
 {
     this.backingVector = new Vector4(r, g, b, a);
 }
Esempio n. 27
0
 public RGBA128F(Single red, Single green, Single blue, Single alpha) : this()
 {
     RGBA = new XYZA(red, green, blue, alpha);
 }
Esempio n. 28
0
 /// <summary>Creates a quaternion from a system vector.</summary>
 /// <param name="value">The value of the quaternion.</param>
 public static Quaternion Create(SysVector4 value) => new Quaternion(value.AsVector128());
Esempio n. 29
0
 private static UInt16 _PackRGBA(XYZA rgba)
 {
     rgba *= 255f;
     return(_PackRGBA((int)rgba.X, (int)rgba.Y, (int)rgba.Z, (int)rgba.W));
 }
Esempio n. 30
0
 public static Color ToXenkoColor(this System.Numerics.Vector4 v)
 => new Color(v.X, v.Y, v.Z, v.W);
Esempio n. 31
0
        void RenderDeferredPathway()
        {
            var screenDim = vec2(Width, Height) / 2;

            Matrix4x4.Invert(ProjectionView, out var invProjView);
            Vector2 screenPos(Vector3 wpos)
            {
                var ipos = Vector4.Transform(vec4(wpos, 1), ProjectionView);

                return((ipos.XY() / ipos.W).Add(1) * screenDim);
            }

            Profile("- G-buffer render", () => {
                GL.Viewport(0, 0, Width, Height);
                FBO.Bind();
                GL.ClearColor(0, 0, 0, 1);
                GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

                GL.Enable(EnableCap.CullFace);
                GL.Enable(EnableCap.DepthTest);
                GL.Disable(EnableCap.Blend);

                Models.ForEach(model => model.Draw(ProjectionView, forward: false));

                FrameBuffer.Unbind();
                GL.Finish();
            });

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            const int tileSize = 256;
            var       tw       = (int)Math.Ceiling((float)Width / tileSize);
            var       th       = (int)Math.Ceiling((float)Height / tileSize);
            IReadOnlyList <IEnumerable <(double Dist, PointLight Light)> > tiles = null;

            Profile("- Tile determination", () => {
                var cforward  = Vector3.Transform(FpsCamera.Forward, Camera.LookRotation).Normalized();
                var cp        = cforward.Y != 0 || cforward.Z != 0 ? vec3(1, 0, 0) : vec3(0, 1, 0);
                var perp      = cforward.Cross(cp).Normalized();
                var tileLists = Enumerable.Range(0, tw * th).Select(i => new List <(double Dist, PointLight Light)>()).ToArray();
                foreach (var light in Lights)
                {
                    var toLight = Camera.Position - light.Position;
                    var tll     = toLight.Length();
                    if (tll > light.Radius)
                    {
                        var lspos   = screenPos(light.Position);
                        var ppos    = Camera.Position + cforward * tll;
                        var pradius = (screenDim - screenPos(ppos + perp * light.Radius)).Length();
                        if (lspos.X + pradius < 0 || lspos.Y + pradius < 0 || lspos.X - pradius > Width || lspos.Y - pradius > Height)
                        {
                            continue;
                        }
                        pradius *= pradius;
                        for (var x = 0; x < tw; ++x)
                        {
                            for (var y = 0; y < th; ++y)
                            {
                                var tilePos = (x * tileSize, y * tileSize);
                                var delta   = (lspos.X - max(tilePos.Item1, min(lspos.X, tilePos.Item1 + tileSize)), lspos.Y - max(tilePos.Item2, min(lspos.Y, tilePos.Item2 + tileSize)));
                                if (delta.Item1 * delta.Item1 + delta.Item2 * delta.Item2 < pradius)
                                {
                                    tileLists[x * th + y].Add((tll, light));
                                }
                            }
                        }
                    }
                    else
                    {
                        tileLists.ForEach(tile => tile.Add((tll, light)));
                    }
                }

                tiles = tileLists.Select(tile => tile.Count <= maxLights ? tile : tile.OrderBy(x => x.Item1).Take(maxLights)).ToList();
            });
Esempio n. 32
0
 public VertexPosColTex(Vector4 position, Color color, TextureCoordinate textureCoordinate)
     : this(position, color.ToColor4(), textureCoordinate)
 {
 }
Esempio n. 33
0
 public bool Equals(Vector4 other)
 {
     return this.X == other.X
         && this.Y == other.Y
         && this.Z == other.Z
         && this.W == other.W;
 }
Esempio n. 34
0
 public static VertexPosColTex From(Vector4 pos)
 {
     return From(pos, Primitives.Color.White);
 }
Esempio n. 35
0
 public static Vector4 Min(Vector4 value1, Vector4 value2)
 {
     return new Vector4(
         (value1.X < value2.X) ? value1.X : value2.X,
         (value1.Y < value2.Y) ? value1.Y : value2.Y,
         (value1.Z < value2.Z) ? value1.Z : value2.Z,
         (value1.W < value2.W) ? value1.W : value2.W);
 }
Esempio n. 36
0
 public static VertexPosColTex From(Vector4 pos, Color color)
 {
     return From(pos, color, TextureCoordinate.From(0.0f, 0.0f));
 }
Esempio n. 37
0
 public static Vector4 Abs(Vector4 value)
 {
     return new Vector4(Math.Abs(value.X), Math.Abs(value.Y), Math.Abs(value.Z), Math.Abs(value.W));
 }
Esempio n. 38
0
 public static Vector4 ToXNA(this Num.Vector4 self)
 {
     return(new Vector4(self.X, self.Y, self.Z, self.W));
 }
Esempio n. 39
0
 public bool Intersects(Vector4 bounds)
 => bounds.Intersects(Center);
Esempio n. 40
0
 public static float Dot(Vector4 vector1, Vector4 vector2)
 {
     return vector1.X * vector2.X +
            vector1.Y * vector2.Y +
            vector1.Z * vector2.Z +
            vector1.W * vector2.W;
 }
Esempio n. 41
0
 public static Color ToXNAColor(this Num.Vector4 self)
 {
     return(new Color(self.X * 1.0f, self.Y * 1.0f, self.Z * 1.0f, self.W * 1.0f));
 }
Esempio n. 42
0
 public static Vector4 Max(Vector4 value1, Vector4 value2)
 {
     return new Vector4(
         (value1.X > value2.X) ? value1.X : value2.X,
         (value1.Y > value2.Y) ? value1.Y : value2.Y,
         (value1.Z > value2.Z) ? value1.Z : value2.Z,
         (value1.W > value2.W) ? value1.W : value2.W);
 }
Esempio n. 43
0
 /// <summary>
 /// Convert a vector to a string.
 /// </summary>
 /// <param name="vec">Vector.</param>
 /// <returns>Vector as a string.</returns>
 static string ConvVec(Num.Vector4 vec)
 {
     return("(" + vec.X + ", " + vec.Y + ", " + vec.Z + ", " + vec.W + ")");
 }
Esempio n. 44
0
 public static Vector4 SquareRoot(Vector4 value)
 {
     return new Vector4((Single)Math.Sqrt(value.X), (Single)Math.Sqrt(value.Y), (Single)Math.Sqrt(value.Z), (Single)Math.Sqrt(value.W));
 }
Esempio n. 45
0
 public static WinCompData.Wui.Color Color(Sn.Vector4 color) => WinCompData.Wui.Color.FromArgb((byte)color.W, (byte)color.X, (byte)color.Y, (byte)color.Z);
Esempio n. 46
0
        private Vector4 CalcValueVect(int i, int j) {

            var A = new Vector4();
            var B = new Vector4();
            var C = new Vector4();
            var D = new Vector4();
            var F = new Vector4();
            var G = new Vector4();
            var H = new Vector4();
            var I = new Vector4();

            A.X = GetPointSafe(i - 1, j - 3);
            B.X = GetPointSafe(i - 1, j);
            C.X = GetPointSafe(i - 1, j + 3);
            D.X = GetPointSafe(i, j - 1);    
            F.X = GetPointSafe(i, j + 1);
            G.X = GetPointSafe(i + 1, j - 3);
            H.X = GetPointSafe(i + 1, j);
            I.X = GetPointSafe(i + 1, j + 3);

            j += 1;

            A.Y = GetPointSafe(i - 1, j - 3);
            B.Y = GetPointSafe(i - 1, j);
            C.Y = GetPointSafe(i - 1, j + 3);
            D.Y = GetPointSafe(i, j - 1);
            F.Y = GetPointSafe(i, j + 1);
            G.Y = GetPointSafe(i + 1, j - 3);
            H.Y = GetPointSafe(i + 1, j);
            I.Y = GetPointSafe(i + 1, j + 3);

            j += 1;

            A.Z = GetPointSafe(i - 1, j - 3);
            B.Z = GetPointSafe(i - 1, j);
            C.Z = GetPointSafe(i - 1, j + 3);
            D.Z = GetPointSafe(i, j - 1);
            F.Z = GetPointSafe(i, j + 1);
            G.Z = GetPointSafe(i + 1, j - 3);
            H.Z = GetPointSafe(i + 1, j);
            I.Z = GetPointSafe(i + 1, j + 3);

            j += 1;

            A.W = GetPointSafe(i - 1, j - 3);
            B.W = GetPointSafe(i - 1, j);
            C.W = GetPointSafe(i - 1, j + 3);
            D.W = GetPointSafe(i, j - 1);
            F.W = GetPointSafe(i, j + 1);
            G.W = GetPointSafe(i + 1, j - 3);
            H.W = GetPointSafe(i + 1, j);
            I.W = GetPointSafe(i + 1, j + 3);

            var t1 = A - I;
            var t2 = C - G;
            var Hh = 2 * (D - F) + t1 - t2;
            var Hv = 2 * (B - H) + t1 + t2;
            Hh *= Hh;
            Hv *= Hv;
            var d = Vector4.SquareRoot(Hh + Hv) * 256 / 1140;

            return d;
        }
Esempio n. 47
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, Vector4 value)
 {
     _stylePtr->Colors[(int)target * 4 + 0] = value.X;
     _stylePtr->Colors[(int)target * 4 + 1] = value.Y;
     _stylePtr->Colors[(int)target * 4 + 2] = value.Z;
     _stylePtr->Colors[(int)target * 4 + 3] = value.W;
 }
Esempio n. 48
0
 /// <summary>Creates a vector from a system vector.</summary>
 /// <param name="value">The value of the vector.</param>
 public static Vector4 Create(SysVector4 value) => new Vector4(value.AsVector128());
Esempio n. 49
0
 public static Vector4 ToXNA(this Num.Vector4 self) => new Vector4(self.X, self.Y, self.Z, self.W);