content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-atan-xy.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10   <title>GLSL atan-xy function test</title>
    11   <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
    12   <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
    13   <script src="../../../resources/js-test-pre.js"></script>
    14   <script src="../../resources/webgl-test.js"> </script>
    15   <script src="../../resources/webgl-test-utils.js"> </script>
    16   <script src="../../resources/glsl-generator.js"> </script>
    17 </head>
    18 <body>
    19 <div id="description"></div>
    20 <div id="console"></div>
    21 <script>
    23 var piConstants = [
    24   "const float kPI     = 3.14159265358979323846;",
    25   "const float kHalfPI = (kPI * 0.5);",
    26   "const float k2PI    = (kPI * 2.0);"
    27 ].join("\n");
    29 var kPI = Math.PI;
    30 var kHalfPI = Math.PI * 0.5;
    31 var k2PI = Math.PI * 2.0;
    32 var atan2 = Math.atan2;  // shorthand
    34 GLSLGenerator.runReferenceImageTest({
    35   feature: "atan",
    36   args: "$(type) y, $(type) x",
    37   testFunc: "$(func)($(type), $(type))",
    38   gridRes: 8,
    39   tolerance: 5,
    40   extra: piConstants,
    41   tests: [
    42     {
    43       source: ["$(output) = vec4(",
    44                "    $(func)($(input).x + 0.1, $(input).y) / k2PI + 0.5,",
    45                "    0,",
    46                "    0,",
    47                "    1);"].join("\n"),
    48       generator: function(x, y, z, w) {
    49         return [ atan2(x + 0.1, y) / k2PI + 0.5,
    50                  0,
    51                  0,
    52                  1 ];
    53       },
    54     },
    55     {
    56       source: ["$(output) = vec4(",
    57                "    $(func)($(input).xy + vec2(0.1, 0.1), $(input).yx) / ",
    58                "            k2PI + vec2(0.5, 0.5),",
    59                "    0, 1);"].join("\n"),
    60       generator: function(x, y, z, w) {
    61         return [ atan2(x + 0.1, y) / k2PI + 0.5,
    62                  atan2(y + 0.1, x) / k2PI + 0.5,
    63                  0,
    64                  1 ];
    65       },
    66     },
    67     {
    68       source: ["$(output) = vec4(",
    69                "    $(func)($(input).xyz + vec3(0.1, 0.1, 0.1), $(input).yzx) / ",
    70                "            k2PI + vec3(0.5, 0.5, 0.5),",
    71                "    1);"].join("\n"),
    72       generator: function(x, y, z, w) {
    73         return [ atan2(x + 0.1, y) / k2PI + 0.5,
    74                  atan2(y + 0.1, z) / k2PI + 0.5,
    75                  atan2(z + 0.1, x) / k2PI + 0.5,
    76                  1 ];
    77       },
    78     },
    79     {
    80       source: ["$(output) = ",
    81                "    $(func)($(input) + vec4(0.1, 0.1, 0.1, 0.1), $(input).wzyx) / ",
    82                "            k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
    83               ].join("\n"),
    84       generator: function(x, y, z, w) {
    85         return [ atan2(x + 0.1, w) / k2PI + 0.5,
    86                  atan2(y + 0.1, z) / k2PI + 0.5,
    87                  atan2(z + 0.1, y) / k2PI + 0.5,
    88                  atan2(w + 0.1, x) / k2PI + 0.5 ];
    89       },
    90     },
    91   ]
    92 });
    93 successfullyParsed = true;
    94 </script>
    95 </body>
    96 </html>

mercurial