tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

glsl-function-refract.html (1985B)


      1 <!--
      2 Copyright (c) 2019 The Khronos Group Inc.
      3 Use of this source code is governed by an MIT-style license that can be
      4 found in the LICENSE.txt file.
      5 -->
      6 
      7 <!DOCTYPE html>
      8 <html>
      9 <head>
     10 <meta charset="utf-8">
     11 <title>GLSL refract function test</title>
     12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
     13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
     14 <script src="../../../js/js-test-pre.js"></script>
     15 <script src="../../../js/webgl-test-utils.js"> </script>
     16 <script src="../../../js/glsl-generator.js"> </script>
     17 </head>
     18 <body>
     19 <div id="description"></div>
     20 <div id="console"></div>
     21 <script>
     22 "use strict";
     23 GLSLGenerator.runFeatureTest({
     24  feature: "refract",
     25  args: "$(type) I, $(type) N, float eta",
     26  baseArgs: "value$(field)",
     27  testFunc: "$(func)($(type),$(type),float)",
     28  simpleEmu: [
     29      "$(type) $(func)_emu($(args)) {",
     30      "   float dotNI = dot(N, I);",
     31      "   float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);",
     32      "   if (k < 0.0) {",
     33      "     return $(type)(0.0);",
     34      "   }",
     35      "   return eta * I - (eta * dotNI * sqrt(k)) * N;",
     36      "}"].join("\n"),
     37  gridRes: 8,
     38  tests: [
     39    ["$(output) = vec4(",
     40     "    $(func)(",
     41     "        $(input).x * 2.0 - 1.0,",
     42     "        $(input).y * 2.0 - 1.0,",
     43     "        $(input).w),",
     44     "    0,",
     45     "    0,",
     46     "    1);"].join("\n"),
     47    ["$(output) = vec4(",
     48     "    $(func)(",
     49     "        $(input).xy * 2.0 - 1.0,",
     50     "        $(input).yz * 2.0 - 1.0,",
     51     "        $(input).w),",
     52     "    0, 1);"].join("\n"),
     53    ["$(output) = vec4(",
     54     "    $(func)(",
     55     "        $(input).xyz * 2.0 - 1.0,",
     56     "        $(input).yzw * 2.0 - 1.0,",
     57     "        $(input).w),",
     58     "    1);"].join("\n"),
     59    ["$(output) = ",
     60     "    $(func)(",
     61     "        $(input).xyzw * 2.0 - 1.0,",
     62     "        $(input).yzwx * 2.0 - 1.0,",
     63     "        $(input).w);"
     64    ].join("\n")
     65  ]
     66 });
     67 var successfullyParsed = true;
     68 </script>
     69 </body>
     70 </html>