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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/canvas/test/webgl-conformance/conformance/glsl/functions/glsl-function-refract.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +<!--
     1.5 +Copyright (c) 2011 The Chromium Authors. All rights reserved.
     1.6 +Use of this source code is governed by a BSD-style license that can be
     1.7 +found in the LICENSE file.
     1.8 + -->
     1.9 +<!DOCTYPE html>
    1.10 +<html>
    1.11 +<head>
    1.12 +<meta charset="utf-8">
    1.13 +  <title>GLSL refract function test</title>
    1.14 +  <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
    1.15 +  <link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
    1.16 +  <script src="../../../resources/js-test-pre.js"></script>
    1.17 +  <script src="../../resources/webgl-test.js"> </script>
    1.18 +  <script src="../../resources/webgl-test-utils.js"> </script>
    1.19 +  <script src="../../resources/glsl-generator.js"> </script>
    1.20 +</head>
    1.21 +<body>
    1.22 +<div id="description"></div>
    1.23 +<div id="console"></div>
    1.24 +<script>
    1.25 +GLSLGenerator.runFeatureTest({
    1.26 +  feature: "refract",
    1.27 +  args: "$(type) I, $(type) N, float eta",
    1.28 +  baseArgs: "value$(field)",
    1.29 +  testFunc: "$(func)($(type),$(type),float)",
    1.30 +  simpleEmu: [
    1.31 +      "$(type) $(func)_emu($(args)) {",
    1.32 +      "   float dotNI = dot(N, I);",
    1.33 +      "   float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);",
    1.34 +      "   if (k < 0.0) {",
    1.35 +      "     return $(type)(0.0);",
    1.36 +      "   }",
    1.37 +      "   return eta * I - (eta * dotNI * sqrt(k)) * N;",
    1.38 +      "}"].join("\n"),
    1.39 +  gridRes: 8,
    1.40 +  tests: [
    1.41 +    ["$(output) = vec4(",
    1.42 +     "    $(func)(",
    1.43 +     "        $(input).x * 2.0 - 1.0,",
    1.44 +     "        $(input).y * 2.0 - 1.0,",
    1.45 +     "        $(input).w),",
    1.46 +     "    0,",
    1.47 +     "    0,",
    1.48 +     "    1);"].join("\n"),
    1.49 +    ["$(output) = vec4(",
    1.50 +     "    $(func)(",
    1.51 +     "        $(input).xy * 2.0 - 1.0,",
    1.52 +     "        $(input).yz * 2.0 - 1.0,",
    1.53 +     "        $(input).w),",
    1.54 +     "    0, 1);"].join("\n"),
    1.55 +    ["$(output) = vec4(",
    1.56 +     "    $(func)(",
    1.57 +     "        $(input).xyz * 2.0 - 1.0,",
    1.58 +     "        $(input).yzw * 2.0 - 1.0,",
    1.59 +     "        $(input).w),",
    1.60 +     "    1);"].join("\n"),
    1.61 +    ["$(output) = ",
    1.62 +     "    $(func)(",
    1.63 +     "        $(input).xyzw * 2.0 - 1.0,",
    1.64 +     "        $(input).yzwx * 2.0 - 1.0,",
    1.65 +     "        $(input).w);"
    1.66 +    ].join("\n")
    1.67 +  ]
    1.68 +});
    1.69 +successfullyParsed = true;
    1.70 +</script>
    1.71 +</body>
    1.72 +</html>
    1.73 +
    1.74 +

mercurial