<commit_before>﻿using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES30;

using SPICA.Renderer.GUI;

using System;

namespace SPICA.Renderer
{
    public static class RenderUtils
    {
        public static void SetupShaderForPosCol(int ShaderHandle)
        {
            //Set the fragment shader to a state capable of rendering our Vertex Buffer
            //In this case we set all stages to the default values (output = Vertex Color)
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "AlphaTestEnb"), 0);

            for (int Index = 0; Index < 6; Index++)
            {
                int ColorCombLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].ColorCombine");
                int AlphaCombLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].AlphaCombine");

                int ColorScaleLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].ColorScale");
                int AlphaScaleLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].AlphaScale");

                int UpColorBuffLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].UpColorBuff");
                int UpAlphaBuffLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].UpAlphaBuff");

                GL.Uniform1(ColorCombLocation, 0);
                GL.Uniform1(AlphaCombLocation, 0);

                GL.Uniform1(ColorScaleLocation, 1f);
                GL.Uniform1(AlphaScaleLocation, 1f);

                GL.Uniform1(UpColorBuffLocation, 1);
                GL.Uniform1(UpAlphaBuffLocation, 1);

                for (int Param = 0; Param < 3; Param++)
                {
                    int ColorSrcLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].ColorSrc");
                    int AlphaSrcLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].AlphaSrc");
                    int ColorOpLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].ColorOp");
                    int AlphaOpLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].AlphaOp");

                    GL.Uniform1(ColorSrcLocation, 0);
                    GL.Uniform1(AlphaSrcLocation, 0);
                    GL.Uniform1(ColorOpLocation, 0);
                    GL.Uniform1(AlphaOpLocation, 0);
                }

                int ColorLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Color");

                GL.Uniform4(ColorLocation, new Color4(0, 0, 0, 0));
            }

            int FixedColorLocation = GL.GetUniformLocation(ShaderHandle, "FixedColor");
            int FixedBoneLocation = GL.GetUniformLocation(ShaderHandle, "FixedBone");
            int FixedWeightLocation = GL.GetUniformLocation(ShaderHandle, "FixedWeight");

            GL.Uniform4(FixedColorLocation, new Vector4(-1));
            GL.Uniform4(FixedBoneLocation, new Vector4(0));
            GL.Uniform4(FixedWeightLocation, new Vector4(0));

            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "PosOffset"), Vector4.Zero);
            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "Scales0"), Vector4.One);
            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "Scales1"), Vector4.One);
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "ColorScale"), 0f);

            Matrix4 RootTransform = Matrix4.Identity;

            int RootTransformLocation = GL.GetUniformLocation(ShaderHandle, "Transforms[0]");

            GL.UniformMatrix4(RootTransformLocation, false, ref RootTransform);

            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "BoolUniforms"), 0);
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "FixedAttr"), 0);
        }

        public static Tuple<int, int> UploadQuad(Vector2 Position, Vector2 Size, GUIDockMode DockMode)
        {
            int[] Viewport = new int[4];

            GL.GetInteger(GetPName.Viewport, Viewport);<commit_msg>Color scale is 1, not 0<commit_after>﻿using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.ES30;

using SPICA.Renderer.GUI;

using System;

namespace SPICA.Renderer
{
    public static class RenderUtils
    {
        public static void SetupShaderForPosCol(int ShaderHandle)
        {
            //Set the fragment shader to a state capable of rendering our Vertex Buffer
            //In this case we set all stages to the default values (output = Vertex Color)
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "AlphaTestEnb"), 0);

            for (int Index = 0; Index < 6; Index++)
            {
                int ColorCombLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].ColorCombine");
                int AlphaCombLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].AlphaCombine");

                int ColorScaleLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].ColorScale");
                int AlphaScaleLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].AlphaScale");

                int UpColorBuffLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].UpColorBuff");
                int UpAlphaBuffLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].UpAlphaBuff");

                GL.Uniform1(ColorCombLocation, 0);
                GL.Uniform1(AlphaCombLocation, 0);

                GL.Uniform1(ColorScaleLocation, 1f);
                GL.Uniform1(AlphaScaleLocation, 1f);

                GL.Uniform1(UpColorBuffLocation, 1);
                GL.Uniform1(UpAlphaBuffLocation, 1);

                for (int Param = 0; Param < 3; Param++)
                {
                    int ColorSrcLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].ColorSrc");
                    int AlphaSrcLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].AlphaSrc");
                    int ColorOpLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].ColorOp");
                    int AlphaOpLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Args[{Param}].AlphaOp");

                    GL.Uniform1(ColorSrcLocation, 0);
                    GL.Uniform1(AlphaSrcLocation, 0);
                    GL.Uniform1(ColorOpLocation, 0);
                    GL.Uniform1(AlphaOpLocation, 0);
                }

                int ColorLocation = GL.GetUniformLocation(ShaderHandle, $"Combiners[{Index}].Color");

                GL.Uniform4(ColorLocation, new Color4(0, 0, 0, 0));
            }

            int FixedColorLocation = GL.GetUniformLocation(ShaderHandle, "FixedColor");
            int FixedBoneLocation = GL.GetUniformLocation(ShaderHandle, "FixedBone");
            int FixedWeightLocation = GL.GetUniformLocation(ShaderHandle, "FixedWeight");

            GL.Uniform4(FixedColorLocation, new Vector4(-1));
            GL.Uniform4(FixedBoneLocation, new Vector4(0));
            GL.Uniform4(FixedWeightLocation, new Vector4(0));

            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "PosOffset"), Vector4.Zero);
            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "Scales0"), Vector4.One);
            GL.Uniform4(GL.GetUniformLocation(ShaderHandle, "Scales1"), Vector4.One);
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "ColorScale"), 1f);

            Matrix4 RootTransform = Matrix4.Identity;

            int RootTransformLocation = GL.GetUniformLocation(ShaderHandle, "Transforms[0]");

            GL.UniformMatrix4(RootTransformLocation, false, ref RootTransform);

            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "BoolUniforms"), 0);
            GL.Uniform1(GL.GetUniformLocation(ShaderHandle, "FixedAttr"), 0);
        }

        public static Tuple<int, int> UploadQuad(Vector2 Position, Vector2 Size, GUIDockMode DockMode)
        {
            int[] Viewport = new int[4];

            GL.GetInteger(GetPName.Viewport, Viewport);
{'fraction_non_alphanumeric': 0.11165169660678642, 'fraction_numerical': 0.01621756487025948, 'mean_word_length': 2.684283088235294, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '96616', 'n_tokens_mistral': 2297, 'n_tokens_neox': 2120, 'n_words': 406}