| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/base.html"> | 7 <link rel="import" href="/tracing/base/base.html"> |
| 8 <script src="/gl-matrix-min.js"></script> | 8 <script src="/gl-matrix-min.js"></script> |
| 9 | 9 |
| 10 <script> | 10 <script> |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 tr.exportTo('tr.b', function() { | 13 tr.exportTo('tr.b', function() { |
| 14 function round(number, opt_ndigits) { |
| 15 opt_ndigits = opt_ndigits || 1; |
| 16 var k = Math.pow(10, opt_ndigits); |
| 17 return Math.round(number * k) / k; |
| 18 } |
| 19 |
| 14 function clamp(x, lo, hi) { | 20 function clamp(x, lo, hi) { |
| 15 return Math.min(Math.max(x, lo), hi); | 21 return Math.min(Math.max(x, lo), hi); |
| 16 } | 22 } |
| 17 | 23 |
| 18 function lerp(percentage, lo, hi) { | 24 function lerp(percentage, lo, hi) { |
| 19 var range = hi - lo; | 25 var range = hi - lo; |
| 20 return lo + percentage * range; | 26 return lo + percentage * range; |
| 21 } | 27 } |
| 22 | 28 |
| 23 function normalize(value, lo, hi) { | 29 function normalize(value, lo, hi) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 out[3] = 1; | 103 out[3] = 1; |
| 98 return out; | 104 return out; |
| 99 } | 105 } |
| 100 | 106 |
| 101 vec2.copyFromVec4 = function(out, a) { | 107 vec2.copyFromVec4 = function(out, a) { |
| 102 vec4.unitize(tmp_vec4, a); | 108 vec4.unitize(tmp_vec4, a); |
| 103 vec2.copy(out, tmp_vec4); | 109 vec2.copy(out, tmp_vec4); |
| 104 } | 110 } |
| 105 | 111 |
| 106 return { | 112 return { |
| 113 round: round, |
| 107 clamp: clamp, | 114 clamp: clamp, |
| 108 lerp: lerp, | 115 lerp: lerp, |
| 109 normalize: normalize, | 116 normalize: normalize, |
| 110 deg2rad: deg2rad | 117 deg2rad: deg2rad |
| 111 }; | 118 }; |
| 112 | 119 |
| 113 }); | 120 }); |
| 114 </script> | 121 </script> |
| OLD | NEW |