Beispiel #1
0
 public static void PushStringArray(string[] texts)
 {
     DllTool.ExecuteNullTailStringArray(texts, (pointers) =>
     {
         Love2dDll.wrap_love_dll_luasupport_pushStringArray(pointers, pointers.Length);
     });
 }
        static void InitGraphicsShader()
        {
            InitGLSLStrings();

            var langs_index       = new string[] { "glsl1", "essl1", "glsl3", "essl3", };
            var langs_dictionnary = new Dictionary <string, Tuple <string, bool> >();

            langs_dictionnary.Add("glsl1", Tuple.Create("glsl1", false));
            langs_dictionnary.Add("essl1", Tuple.Create("glsl1", true));
            langs_dictionnary.Add("glsl3", Tuple.Create("glsl3", false));
            langs_dictionnary.Add("essl3", Tuple.Create("glsl3", true));

            var gammacorrects = new bool[] { false, true };

            string[] codeStr = new string[2 * 4 * 4];

            int index = 0;

            foreach (var gammacorrect in gammacorrects)
            {
                foreach (var langIndex in langs_index)
                {
                    var    lang   = langs_dictionnary[langIndex];
                    string target = lang.Item1;
                    bool   gles   = lang.Item2;

                    // vertex
                    codeStr[index++] = createShaderStageCode("VERTEX", defaultcode_vertex, target, gles, false, gammacorrect, false);
                    // pixel
                    codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_pixel, target, gles, false, gammacorrect, false);
                    // videopixel
                    codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_videopixel, target, gles, false, gammacorrect, true);
                    // arraypixel
                    codeStr[index++] = createShaderStageCode("PIXEL", defaultcode_arraypixel, target, gles, false, gammacorrect, true);
                }
            }

            DllTool.ExecuteNullTailStringArray(codeStr, (tmp) =>
            {
                Love2dDll.wrap_love_dll_graphics_setDefaultShaderCode(tmp);
            });
        }