tor-browser

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

glsl-function-atan.html (2722B)


      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 atan 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 
     24 var piConstants = [
     25  "const float kPI     = 3.14159265358979323846;",
     26  "const float kHalfPI = (kPI * 0.5);",
     27  "const float k2PI    = (kPI * 2.0);"
     28 ].join("\n");
     29 
     30 var kPI = Math.PI;
     31 var kHalfPI = Math.PI * 0.5;
     32 var k2PI = Math.PI * 2.0;
     33 var atan = Math.atan;  // shorthand
     34 
     35 GLSLGenerator.runReferenceImageTest({
     36  feature: "atan",
     37  args: "$(type) value",
     38  testFunc: "$(func)($(type))",
     39  gridRes: 8,
     40  tolerance: 4,
     41  extra: piConstants,
     42  tests: [
     43    {
     44      source: ["$(output) = vec4(",
     45               "    $(func)($(input).x * 8.0 - 4.0) / k2PI + 0.5,",
     46               "    0.5,",
     47               "    0,",
     48               "    1);"].join("\n"),
     49      generator: function(x, y, z, w) {
     50        return [ atan(x * 8.0 - 4.0) / k2PI + 0.5,
     51                 0.5,
     52                 0,
     53                 1 ];
     54      },
     55    },
     56    {
     57      source: ["$(output) = vec4(",
     58               "    $(func)($(input).xy * 8.0 - vec2(4, 4)) / k2PI + vec2(0.5, 0.5),",
     59               "    0, 1);"].join("\n"),
     60      generator: function(x, y, z, w) {
     61        return [ atan(x * 8.0 - 4) / k2PI + 0.5,
     62                 atan(y * 8.0 - 4) / k2PI + 0.5,
     63                 0,
     64                 1 ];
     65      },
     66    },
     67    {
     68      source: ["$(output) = vec4(",
     69               "    $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / k2PI + vec3(0.5, 0.5, 0.5),",
     70               "    1);"].join("\n"),
     71      generator: function(x, y, z, w) {
     72        return [ atan(x * 8.0 - 4) / k2PI + 0.5,
     73                 atan(y * 8.0 - 4) / k2PI + 0.5,
     74                 atan(z * 8.0 - 4) / k2PI + 0.5,
     75                 1 ];
     76      },
     77    },
     78    {
     79      source: ["$(output) = ",
     80               "    $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
     81              ].join("\n"),
     82      generator: function(x, y, z, w) {
     83        return [ atan(x * 8.0 - 4) / k2PI + 0.5,
     84                 atan(y * 8.0 - 4) / k2PI + 0.5,
     85                 atan(z * 8.0 - 4) / k2PI + 0.5,
     86                 atan(w * 8.0 - 4) / k2PI + 0.5 ];
     87      },
     88    },
     89  ]
     90 });
     91 var successfullyParsed = true;
     92 </script>
     93 </body>
     94 </html>