1/****************************************************************************
2**
3** Copyright (C) 2014-2015 NVIDIA Corporation.
4** Copyright (C) 2019 The Qt Company Ltd.
5** Contact: https://www.qt.io/licensing/
6**
7** This file is part of Qt 3D Studio.
8**
9** $QT_BEGIN_LICENSE:GPL$
10** Commercial License Usage
11** Licensees holding valid commercial Qt licenses may use this file in
12** accordance with the commercial license agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and The Qt Company. For licensing terms
15** and conditions see https://www.qt.io/terms-conditions. For further
16** information use the contact form at https://www.qt.io/contact-us.
17**
18** GNU General Public License Usage
19** Alternatively, this file may be used under the terms of the GNU
20** General Public License version 3 or (at your option) any later version
21** approved by the KDE Free Qt Foundation. The licenses are as published by
22** the Free Software Foundation and appearing in the file LICENSE.GPL3
23** included in the packaging of this file. Please review the following
24** information to ensure the GNU General Public License requirements will
25** be met: https://www.gnu.org/licenses/gpl-3.0.html.
26**
27** $QT_END_LICENSE$
28**
29****************************************************************************/
30
31
32// TODO: real implementation
33anisotropy_return anisotropyConversion( in float roughness, in float anisotropy, in float anisotropyRotation, in vec3 tangentU, bool miaAnisotropySemantic )
34{
35  anisotropy_return aniso;
36  float angle = 2.0 * PI * anisotropyRotation;
37  float cos_angle = cos(angle);
38  float sin_angle = sin(angle);
39  aniso.tangent_u = normalize( cos_angle * tangentU + sin_angle * binormal );
40  // roughness
41  float anisoFac = 1.0 - clamp(anisotropy, 0.0, 0.999);
42  aniso.roughness_v = clamp( roughness / anisoFac, 0.0001, 1.0);
43  aniso.roughness_u = clamp( aniso.roughness_v * anisoFac, 0.0001, 1.0);
44  return( aniso );
45}
46
47