summaryrefslogtreecommitdiffstats
path: root/src/Runtime/Source/platformspecific
diff options
context:
space:
mode:
authorPasi Keränen <pasi.keranen@qt.io>2019-04-12 12:47:08 +0300
committerPasi Keränen <pasi.keranen@qt.io>2019-04-15 07:10:26 +0000
commitcef006904e875b7424b7fa13ea3dc2f9762081d9 (patch)
tree1e1cb4f9e58c9e692cf5c2f5fc5687db4a313d2a /src/Runtime/Source/platformspecific
parent46000b6fb0fca6594827875695c564cf5d7d070c (diff)
Flatten OpenGL source directory hierarchy
Flatten Source,Include and PrivateInclude directories away. Replace camelcase directory names with lowercase names. Remove random Qt3DS prefixes from directory names. Task-number: QT3DS-16 Change-Id: I5b23349232c760afa9a8efcc5e8945ee19d2e31a Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
Diffstat (limited to 'src/Runtime/Source/platformspecific')
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/NvVec.h316
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/misc.h130
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.cpp64
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.h45
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.cpp1030
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.h117
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.cpp199
-rw-r--r--src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.h63
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.ddsbin0 -> 87509 bytes
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.ddsbin0 -> 349653 bytes
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/font.frag39
-rw-r--r--src/Runtime/Source/platformspecific/linux/assets/font.vert49
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_color.h107
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_debug.h86
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_global.h36
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/NvVec.h316
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/misc.h130
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.cpp64
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.h45
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.cpp1030
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.h118
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.cpp203
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.h64
-rw-r--r--src/Runtime/Source/platformspecific/linux/libs/nv_types.h81
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.ddsbin0 -> 87509 bytes
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.ddsbin0 -> 349653 bytes
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/font.frag39
-rw-r--r--src/Runtime/Source/platformspecific/macos/assets/font.vert49
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_color.h107
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_debug.h86
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_global.h36
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/NvVec.h316
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/misc.h130
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.cpp64
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.h45
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.cpp1030
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.h117
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.cpp199
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.h63
-rw-r--r--src/Runtime/Source/platformspecific/macos/libs/nv_types.h81
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.ddsbin0 -> 87509 bytes
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.abcbin0 -> 2048 bytes
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.ddsbin0 -> 349653 bytes
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/font.frag39
-rw-r--r--src/Runtime/Source/platformspecific/windows/assets/font.vert49
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_color.h107
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_config/nv_config.h278
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_debug.h86
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_global.h36
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/NvVec.h316
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/misc.h130
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.cpp64
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.h45
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.cpp1030
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.h117
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.cpp199
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.h63
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/nv_types.h81
-rw-r--r--src/Runtime/Source/platformspecific/windows/libs/qt3ds_launcher_defs.h92
-rw-r--r--src/Runtime/Source/platformspecific/windows/viewer/Resource.h43
65 files changed, 9469 insertions, 0 deletions
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/NvVec.h b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/NvVec.h
new file mode 100644
index 00000000..4e5b09ce
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/NvVec.h
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_VEC_H
+#define INCLUDED_QT3DS_MATH_CPP_VEC_H
+
+#include "misc.h"
+
+struct _NvVec3
+{
+ union {
+ struct
+ {
+ float x, y, z;
+ };
+ float v[3];
+ };
+};
+
+struct NvVec3 : public _NvVec3
+{
+ NvVec3() { zero(); }
+
+ NvVec3(float x, float y, float z)
+ {
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+ }
+
+ NvVec3(NvVec3 const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ v[2] = that.v[2];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ v[2] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec3 &operator+=(NvVec3 const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ v[2] += that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator-=(NvVec3 const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ v[2] -= that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ v[2] *= s;
+ return *this;
+ }
+
+ NvVec3 &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ v[2] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec3 const &a, NvVec3 const &b)
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+inline NvVec3 operator+(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] + b.v[0], a.v[1] + b.v[1], a.v[2] + b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] - b.v[0], a.v[1] - b.v[1], a.v[2] - b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a)
+{
+
+ return NvVec3(-a.v[0], -a.v[1], -a.v[2]);
+}
+
+inline NvVec3 operator*(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] * s, a.v[1] * s, a.v[2] * s);
+}
+
+inline NvVec3 operator*(float s, NvVec3 const &a)
+{
+
+ return NvVec3(s * a.v[0], s * a.v[1], s * a.v[2]);
+}
+
+inline NvVec3 operator/(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] / s, a.v[1] / s, a.v[2] / s);
+}
+
+inline float magnitude(NvVec3 const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec3 normalize(NvVec3 const &v)
+{
+ float l = magnitude(v);
+ return NvVec3(v[0] / l, v[1] / l, v[2] / l);
+}
+
+inline NvVec3 cross(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[1] * b.v[2] - a.v[2] * b.v[1], a.v[2] * b.v[0] - a.v[0] * b.v[2],
+ a.v[0] * b.v[1] - a.v[1] * b.v[0]);
+}
+
+inline bool operator==(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] == b.v[0] && a.v[1] == b.v[1] && a.v[2] == b.v[2]);
+}
+
+inline bool operator!=(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] != b.v[0] || a.v[1] != b.v[1] || a.v[2] != b.v[2]);
+}
+
+struct NvVec2f
+{
+ union {
+ struct
+ {
+ float x, y;
+ float v[2];
+ };
+ };
+
+ NvVec2f() { zero(); }
+
+ NvVec2f(float x, float y)
+ {
+ v[0] = x;
+ v[1] = y;
+ }
+
+ NvVec2f(NvVec2f const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec2f &operator+=(NvVec2f const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator-=(NvVec2f const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ return *this;
+ }
+
+ NvVec2f &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+inline NvVec2f operator+(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] + b.v[0], a.v[1] + b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] - b.v[0], a.v[1] - b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a)
+{
+
+ return NvVec2f(-a.v[0], -a.v[1]);
+}
+
+inline NvVec2f operator*(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] * s, a.v[1] * s);
+}
+
+inline NvVec2f operator*(float s, NvVec2f const &a)
+{
+
+ return NvVec2f(s * a.v[0], s * a.v[1]);
+}
+
+inline NvVec2f operator/(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] / s, a.v[1] / s);
+}
+
+inline float magnitude(NvVec2f const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec2f normalize(NvVec2f const &v)
+{
+ float l = dot(v, v);
+ return NvVec2f(v[0] / l, v[1] / l);
+}
+
+inline float cross(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a.v[0] * b.v[1] - b.v[0] * a.v[1];
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/misc.h b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/misc.h
new file mode 100644
index 00000000..983410f3
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/misc.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_MISC_H
+#define INCLUDED_QT3DS_MATH_CPP_MISC_H
+
+inline bool nvIsPowerOfTwo(unsigned int i)
+{
+ return (i & (i - 1)) == 0;
+}
+
+inline float nvDegToRadf(float d)
+{
+ return d * 3.14159265358979323846f / 180.0f;
+}
+
+inline float nvRadToDegf(float r)
+{
+ return r * 180.0f / 3.14159265358979323846f;
+}
+
+/*
+ 'mod' differs from '%' in that it behaves correctly when either the
+ numerator or denominator is negative.
+*/
+
+inline int nvMod(int n, int d)
+{
+ int m = n % d;
+ return (((m < 0) && (d > 0)) || ((m > 0) && (d < 0))) ? (m + d) : m;
+}
+
+inline int nvAbs(int n)
+{
+ if (n < 0)
+ return -n;
+ return n;
+}
+
+inline int nvSign(int n)
+{
+ if (n > 0)
+ return 1;
+ if (n < 0)
+ return -1;
+ return 0;
+}
+
+/*
+ This returns the smallest amplitude value x such that
+ nvMod(b + x, m) == a
+*/
+
+inline int nvDifMod(int a, int b, int m)
+{
+
+ int x1 = a - b;
+ int x2 = (x1 > 0) ? x1 - m : x1 + m;
+ return (nvAbs(x1) < nvAbs(x2)) ? x1 : x2;
+}
+
+inline float nvWrapf(float a, float min, float max)
+{
+
+ assert(max > min);
+
+ float d = max - min;
+ float s = a - min;
+ float q = s / d;
+ float m = q - floorf(q);
+ return m * d + min;
+}
+
+inline float nvClampf(float a, float min, float max)
+{
+ return (a < min) ? min : ((a > max) ? max : a);
+}
+
+inline int nvClampi(int i, int min, int max)
+{
+ return (i < min) ? min : ((i > max) ? max : i);
+}
+
+inline float nvGaussian(float x, float s)
+{
+ float c = s * sqrtf(2.0f * 3.14159265358979323846f);
+ return expf(-(x * x) / (2.0f * s * s)) / c;
+}
+
+inline float nvLerpf(float a, float b, float t)
+{
+ return a * (1.0f - t) + b * t;
+}
+
+inline float nvEasef(float t)
+{
+
+ float t_2 = t * t;
+ float t_3 = t_2 * t;
+ return 3.0f * t_2 - 2.0f * t_3;
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.cpp b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.cpp
new file mode 100644
index 00000000..b83cb39e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_math.h"
+
+static const double a = 16807.0;
+static const double m = 2147483647.0;
+
+static double nextSeed(double seed)
+{
+ double t = a * seed;
+ return t - m * (double)((int)(t / m));
+}
+
+GLfloat NvRandf()
+{
+ static double seed = 1.0;
+ seed = nextSeed(seed);
+ return (GLfloat)(seed * (1 / m));
+}
+
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime)
+{
+ // kdGetTimeUST is never supposed to decrease (i.e. that
+ // means it can't wrap, either. IIRC, it will wrap in
+ // 593 years). So we ignore that option...
+
+ // Used for frame-to-frame diffs, this will fit in 32b
+ // as long as the times are < ~4.3s apart
+ long long int diffTime = newTime - oldTime;
+
+ // Need to find a better way to do this.
+ // However, I believe we will be uSec precise (not run
+ // out of mantissa bits for uSecs) as long as the diff
+ // is < ~16s (1e-6 * (2^24))
+ return ((GLfloat)diffTime) / 1.0e9f;
+}
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.h b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.h
new file mode 100644
index 00000000..cf2d8b30
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_math.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_MATH_H
+#define _QT3DS_MATH_H
+
+#include <GLES2/gl2.h>
+
+GLfloat NvRandf();
+
+/* These are the recommended "safer" ways to use GLfloat for time */
+
+/* Returns the seconds between the two given times */
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime);
+
+#define QT3DS_MILISECS_TO_UST(ms) ((long long int)(ms)*1000000)
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.cpp b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.cpp
new file mode 100644
index 00000000..e208ac31
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.cpp
@@ -0,0 +1,1030 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_matrix.h"
+
+int NvDifferentMatsf(GLfloat a[4][4], const GLfloat b[4][4])
+{
+ return ((&a[3][3] < &b[0][0]) || (&b[3][3] < &a[0][0]));
+}
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+}
+
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+}
+
+GLfloat NvVecLengthf(const GLfloat v[3])
+{
+ return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3])
+{
+ GLfloat const l = NvVecLengthf(v);
+ r[0] = v[0] / l;
+ r[1] = v[1] / l;
+ r[2] = v[2] / l;
+}
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] + b[0];
+ r[1] = a[1] + b[1];
+ r[2] = a[2] + b[2];
+}
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ GLfloat t[3];
+
+ t[0] = a[1] * b[2] - a[2] * b[1];
+ t[1] = a[2] * b[0] - a[0] * b[2];
+ t[2] = a[0] * b[1] - a[1] * b[0];
+
+ r[0] = t[0];
+ r[1] = t[1];
+ r[2] = t[2];
+}
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ GLfloat inv_w = 1.0f / (m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3]);
+
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * inv_w;
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * inv_w;
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * inv_w;
+}
+
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * a[3];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * a[3];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * a[3];
+ r[3] = m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3] * a[3];
+}
+
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2];
+}
+
+static void NvMultMat3x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2];
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x4f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2] + a[3][0] * b[0][3];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2] + a[3][1] * b[0][3];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2] + a[3][2] * b[0][3];
+ r[0][3] = a[0][3] * b[0][0] + a[1][3] * b[0][1] + a[2][3] * b[0][2] + a[3][3] * b[0][3];
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2] + a[3][0] * b[1][3];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2] + a[3][1] * b[1][3];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2] + a[3][2] * b[1][3];
+ r[1][3] = a[0][3] * b[1][0] + a[1][3] * b[1][1] + a[2][3] * b[1][2] + a[3][3] * b[1][3];
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2] + a[3][0] * b[2][3];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2] + a[3][1] * b[2][3];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2] + a[3][2] * b[2][3];
+ r[2][3] = a[0][3] * b[2][0] + a[1][3] * b[2][1] + a[2][3] * b[2][2] + a[3][3] * b[2][3];
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0] * b[3][3];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1] * b[3][3];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2] * b[3][3];
+ r[3][3] = a[0][3] * b[3][0] + a[1][3] * b[3][1] + a[2][3] * b[3][2] + a[3][3] * b[3][3];
+}
+
+void NvMultMatf(GLfloat result[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((a[0][3] == 0.0f) && (a[1][3] == 0.0f) && (a[2][3] == 0.0f) && (a[2][3] == 1.0f)
+ && (b[0][3] == 0.0f) && (b[1][3] == 0.0f) && (b[2][3] == 0.0f) && (b[2][3] == 1.0f)) {
+ if ((a[3][0] == 0.0f) && (a[3][1] == 0.0f) && (a[3][2] == 0.0f) && (b[3][0] == 0.0f)
+ && (b[3][1] == 0.0f) && (b[3][2] == 0.0f)) {
+ NvMultMat3x3f(r, a, b);
+ } else {
+ NvMultMat4x3f(r, a, b);
+ }
+ } else {
+ NvMultMat4x4f(r, a, b);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+static void NvInvMat3x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ /* x */
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ /* y */
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ /* z */
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x4f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] * m[3][3] + m[0][0] * m[1][2] * m[2][3] * m[3][1]
+ + m[0][0] * m[1][3] * m[2][1] * m[3][2] + m[0][1] * m[1][0] * m[2][3] * m[3][2]
+ + m[0][1] * m[1][2] * m[2][0] * m[3][3] + m[0][1] * m[1][3] * m[2][2] * m[3][0]
+ + m[0][2] * m[1][0] * m[2][1] * m[3][3] + m[0][2] * m[1][1] * m[2][3] * m[3][0]
+ + m[0][2] * m[1][3] * m[2][0] * m[3][1] + m[0][3] * m[1][0] * m[2][2] * m[3][1]
+ + m[0][3] * m[1][1] * m[2][0] * m[3][2] + m[0][3] * m[1][2] * m[2][1] * m[3][0]
+ + -m[0][0] * m[1][1] * m[2][3] * m[3][2] + -m[0][0] * m[1][2] * m[2][1] * m[3][3]
+ + -m[0][0] * m[1][3] * m[2][2] * m[3][1] + -m[0][1] * m[1][0] * m[2][2] * m[3][3]
+ + -m[0][1] * m[1][2] * m[2][3] * m[3][0] + -m[0][1] * m[1][3] * m[2][0] * m[3][2]
+ + -m[0][2] * m[1][0] * m[2][3] * m[3][1] + -m[0][2] * m[1][1] * m[2][0] * m[3][3]
+ + -m[0][2] * m[1][3] * m[2][1] * m[3][0] + -m[0][3] * m[1][0] * m[2][1] * m[3][2]
+ + -m[0][3] * m[1][1] * m[2][2] * m[3][0] + -m[0][3] * m[1][2] * m[2][0] * m[3][1];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] * m[3][3] + m[1][2] * m[2][3] * m[3][1]
+ + m[1][3] * m[2][1] * m[3][2] + -m[1][1] * m[2][3] * m[3][2]
+ + -m[1][2] * m[2][1] * m[3][3] + -m[1][3] * m[2][2] * m[3][1])
+ / d;
+
+ r[0][1] = (m[0][1] * m[2][3] * m[3][2] + m[0][2] * m[2][1] * m[3][3]
+ + m[0][3] * m[2][2] * m[3][1] + -m[0][1] * m[2][2] * m[3][3]
+ + -m[0][2] * m[2][3] * m[3][1] + -m[0][3] * m[2][1] * m[3][2])
+ / d;
+
+ r[0][2] = (m[0][1] * m[1][2] * m[3][3] + m[0][2] * m[1][3] * m[3][1]
+ + m[0][3] * m[1][1] * m[3][2] + -m[0][1] * m[1][3] * m[3][2]
+ + -m[0][2] * m[1][1] * m[3][3] + -m[0][3] * m[1][2] * m[3][1])
+ / d;
+
+ r[0][3] = (m[0][1] * m[1][3] * m[2][2] + m[0][2] * m[1][1] * m[2][3]
+ + m[0][3] * m[1][2] * m[2][1] + -m[0][1] * m[1][2] * m[2][3]
+ + -m[0][2] * m[1][3] * m[2][1] + -m[0][3] * m[1][1] * m[2][2])
+ / d;
+
+ r[1][0] = (m[1][0] * m[2][3] * m[3][2] + m[1][2] * m[2][0] * m[3][3]
+ + m[1][3] * m[2][2] * m[3][0] + -m[1][0] * m[2][2] * m[3][3]
+ + -m[1][2] * m[2][3] * m[3][0] + -m[1][3] * m[2][0] * m[3][2])
+ / d;
+
+ r[1][1] = (m[0][0] * m[2][2] * m[3][3] + m[0][2] * m[2][3] * m[3][0]
+ + m[0][3] * m[2][0] * m[3][2] + -m[0][0] * m[2][3] * m[3][2]
+ + -m[0][2] * m[2][0] * m[3][3] + -m[0][3] * m[2][2] * m[3][0])
+ / d;
+
+ r[1][2] = (m[0][0] * m[1][3] * m[3][2] + m[0][2] * m[1][0] * m[3][3]
+ + m[0][3] * m[1][2] * m[3][0] + -m[0][0] * m[1][2] * m[3][3]
+ + -m[0][2] * m[1][3] * m[3][0] + -m[0][3] * m[1][0] * m[3][2])
+ / d;
+
+ r[1][3] = (m[0][0] * m[1][2] * m[2][3] + m[0][2] * m[1][3] * m[2][0]
+ + m[0][3] * m[1][0] * m[2][2] + -m[0][0] * m[1][3] * m[2][2]
+ + -m[0][2] * m[1][0] * m[2][3] + -m[0][3] * m[1][2] * m[2][0])
+ / d;
+
+ r[2][0] = (m[1][0] * m[2][1] * m[3][3] + m[1][1] * m[2][3] * m[3][0]
+ + m[1][3] * m[2][0] * m[3][1] + -m[1][0] * m[2][3] * m[3][1]
+ + -m[1][1] * m[2][0] * m[3][3] + -m[1][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][1] =
+ (-m[0][0] * m[2][1] * m[3][3] + -m[0][1] * m[2][3] * m[3][0] + -m[0][3] * m[2][0] * m[3][1]
+ + m[0][0] * m[2][3] * m[3][1] + m[0][1] * m[2][0] * m[3][3] + m[0][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][2] = (m[0][0] * m[1][1] * m[3][3] + m[0][1] * m[1][3] * m[3][0]
+ + m[0][3] * m[1][0] * m[3][1] + -m[0][0] * m[1][3] * m[3][1]
+ + -m[0][1] * m[1][0] * m[3][3] + -m[0][3] * m[1][1] * m[3][0])
+ / d;
+
+ r[2][3] = (m[0][0] * m[1][3] * m[2][1] + m[0][1] * m[1][0] * m[2][3]
+ + m[0][3] * m[1][1] * m[2][0] + -m[0][1] * m[1][3] * m[2][0]
+ + -m[0][3] * m[1][0] * m[2][1] + -m[0][0] * m[1][1] * m[2][3])
+ / d;
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = (m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1]
+ + -m[0][1] * m[1][0] * m[2][2] + -m[0][2] * m[1][1] * m[2][0])
+ / d;
+}
+
+void NvInvMatf(GLfloat result[4][4], const GLfloat m[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((m[0][3] == 0.0f) && (m[1][3] == 0.0f) && (m[2][3] == 0.0f) && (m[2][3] == 1.0f)) {
+ if ((m[3][0] == 0.0f) && (m[3][1] == 0.0f) && (m[3][2] == 0.0f)) {
+ NvInvMat3x3f(r, m);
+ } else {
+ NvInvMat4x3f(r, m);
+ }
+ } else {
+ NvInvMat4x4f(r, m);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildIdentityMatf(GLfloat r[4][4])
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = x;
+ r[3][1] = y;
+ r[3][2] = z;
+ r[3][3] = 1.0f;
+}
+
+void NvMultTranslateMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLfloat r[4][4]; /*temporary storage for result */
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[0][0] * x + m[1][0] * y + m[2][0] * z + m[3][0];
+ r[3][1] = m[0][1] * x + m[1][1] * y + m[2][1] * z + m[3][1];
+ r[3][2] = m[0][2] * x + m[1][2] * y + m[2][2] * z + m[3][2];
+ r[3][3] = m[0][3] * x + m[1][3] * y + m[2][3] * z + m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = x;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = y;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = z;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultScaleMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * x;
+ r[0][1] = m[0][1] * x;
+ r[0][2] = m[0][2] * x;
+ r[0][3] = m[0][3] * x;
+
+ r[1][0] = m[1][0] * y;
+ r[1][1] = m[1][1] * y;
+ r[1][2] = m[1][2] * y;
+ r[1][3] = m[1][3] * y;
+
+ r[2][0] = m[2][0] * z;
+ r[2][1] = m[2][1] * z;
+ r[2][2] = m[2][2] * z;
+ r[2][3] = m[2][3] * z;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = c;
+ r[1][2] = s;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = -s;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = 0.0f;
+ r[0][2] = -s;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = s;
+ r[2][1] = 0.0f;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = s;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = -s;
+ r[1][1] = c;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultRotXRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0] * c + m[2][0] * s;
+ r[1][1] = m[1][1] * c + m[2][1] * s;
+ r[1][2] = m[1][2] * c + m[2][2] * s;
+ r[1][3] = m[1][3] * c + m[2][3] * s;
+
+ r[2][0] = m[1][0] * -s + m[2][0] * c;
+ r[2][1] = m[1][1] * -s + m[2][1] * c;
+ r[2][2] = m[1][2] * -s + m[2][2] * c;
+ r[2][3] = m[1][3] * -s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotYRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[2][0] * -s;
+ r[0][1] = m[0][1] * c + m[2][1] * -s;
+ r[0][2] = m[0][2] * c + m[2][2] * -s;
+ r[0][3] = m[0][3] * c + m[2][3] * -s;
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[0][0] * s + m[2][0] * c;
+ r[2][1] = m[0][1] * s + m[2][1] * c;
+ r[2][2] = m[0][2] * s + m[2][2] * c;
+ r[2][3] = m[0][3] * s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotZRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[1][0] * s;
+ r[0][1] = m[0][1] * c + m[1][1] * s;
+ r[0][2] = m[0][2] * c + m[1][2] * s;
+ r[0][3] = m[0][3] * c + m[1][3] * s;
+
+ r[1][0] = m[0][0] * -s + m[1][0] * c;
+ r[1][1] = m[0][1] * -s + m[1][1] * c;
+ r[1][2] = m[0][2] * -s + m[1][2] * c;
+ r[1][3] = m[0][3] * -s + m[1][3] * c;
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotRadMatf(GLfloat result[4][4], const GLfloat axis[3], GLfloat radians)
+{
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ /* build a matrix from the quat */
+
+ result[0][0] = 1.0f - 2.0f * (j * j + k * k);
+ result[0][1] = 2.0f * (i * j + r * k);
+ result[0][2] = 2.0f * (i * k - r * j);
+ result[0][3] = 0.0f;
+
+ result[1][0] = 2.0f * (i * j - r * k);
+ result[1][1] = 1.0f - 2.0f * (i * i + k * k);
+ result[1][2] = 2.0f * (j * k + r * i);
+ result[1][3] = 0.0f;
+
+ result[2][0] = 2.0f * (i * k + r * j);
+ result[2][1] = 2.0f * (j * k - r * i);
+ result[2][2] = 1.0f - 2.0f * (i * i + j * j);
+ result[2][3] = 0.0f;
+
+ result[3][0] = 0.0f;
+ result[3][1] = 0.0f;
+ result[3][2] = 0.0f;
+ result[3][3] = 1.0f;
+}
+
+void NvMultRotRadMatf(GLfloat result[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians)
+{
+ GLfloat r[4][4];
+
+ {
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat const dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ {
+ /* build a matrix from the quat */
+
+ GLfloat const a00 = 1.0f - 2.0f * (j * j + k * k);
+ GLfloat const a01 = 2.0f * (i * j + r * k);
+ GLfloat const a02 = 2.0f * (i * k - r * j);
+
+ GLfloat const a10 = 2.0f * (i * j - r * k);
+ GLfloat const a11 = 1.0f - 2.0f * (i * i + k * k);
+ GLfloat const a12 = 2.0f * (j * k + r * i);
+
+ GLfloat const a20 = 2.0f * (i * k + r * j);
+ GLfloat const a21 = 2.0f * (j * k - r * i);
+ GLfloat const a22 = 1.0f - 2.0f * (i * i + j * j);
+
+ result[0][0] = m[0][0] * a00 + m[1][0] * a01 + m[2][0] * a02;
+ result[0][1] = m[0][1] * a00 + m[1][1] * a01 + m[2][1] * a02;
+ result[0][2] = m[0][2] * a00 + m[1][2] * a01 + m[2][2] * a02;
+ result[0][3] = m[0][3] * a00 + m[1][3] * a01 + m[2][3] * a02;
+
+ result[1][0] = m[0][0] * a10 + m[1][0] * a11 + m[2][0] * a12;
+ result[1][1] = m[0][1] * a10 + m[1][1] * a11 + m[2][1] * a12;
+ result[1][2] = m[0][2] * a10 + m[1][2] * a11 + m[2][2] * a12;
+ result[1][3] = m[0][3] * a10 + m[1][3] * a11 + m[2][3] * a12;
+
+ result[2][0] = m[0][0] * a20 + m[1][0] * a21 + m[2][0] * a22;
+ result[2][1] = m[0][1] * a20 + m[1][1] * a21 + m[2][1] * a22;
+ result[2][2] = m[0][2] * a20 + m[1][2] * a21 + m[2][2] * a22;
+ result[2][3] = m[0][3] * a20 + m[1][3] * a21 + m[2][3] * a22;
+
+ result[3][0] = m[3][0];
+ result[3][1] = m[3][1];
+ result[3][2] = m[3][2];
+ result[3][3] = m[3][3];
+ }
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotXRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotYRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotZRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotXRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotYRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotZRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees)
+{
+ NvBuildRotRadMatf(r, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees)
+{
+ NvMultRotRadMatf(r, m, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3])
+{
+ GLfloat ev[3];
+ GLfloat z[3];
+ GLfloat x_tmp[3];
+ GLfloat x[3];
+ GLfloat y[3];
+
+ NvSubVecf(ev, eye, obj);
+
+ NvNormalizeVecf(z, ev);
+
+ NvCrossProductf(x_tmp, up, z);
+
+ NvNormalizeVecf(x, x_tmp);
+
+ NvCrossProductf(y, z, x);
+
+ r[0][0] = x[0];
+ r[0][1] = y[0];
+ r[0][2] = z[0];
+ r[0][3] = 0.0f;
+
+ r[1][0] = x[1];
+ r[1][1] = y[1];
+ r[1][2] = z[1];
+ r[1][3] = 0.0f;
+
+ r[2][0] = x[2];
+ r[2][1] = y[2];
+ r[2][2] = z[2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = -x[0] * eye[0] + -x[1] * eye[1] + -x[2] * eye[2];
+ r[3][1] = -y[0] * eye[0] + -y[1] * eye[1] + -y[2] * eye[2];
+ r[3][2] = -z[0] * eye[0] + -z[1] * eye[1] + -z[2] * eye[2];
+ r[3][3] = 1.0f;
+}
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const m00 = znear * 2.0f / (right - left);
+ GLfloat const m11 = znear * 2.0f / (top - bottom);
+ GLfloat const m22 = -(zfar + znear) / (zfar - znear);
+
+ GLfloat const m20 = (right + left) / (right - left);
+ GLfloat const m21 = (top + bottom) / (top - bottom);
+
+ GLfloat const m32 = -(2.0f * zfar * znear) / (zfar - znear);
+ GLfloat const m23 = -1.0f;
+
+ r[0][0] = m00;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = m11;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = m20;
+ r[2][1] = m21;
+ r[2][2] = m22;
+ r[2][3] = m23;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = m32;
+ r[3][3] = 0.0f;
+}
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+ GLfloat const sz = -2.0f / (zfar - znear);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+ GLfloat const tz = -(zfar + znear) / (zfar - znear);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = sz;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = tz;
+ r[3][3] = 1.0f;
+}
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.h b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.h
new file mode 100644
index 00000000..2a8e186e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_matrix.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_MATRIX_H
+#define INCLUDED_MATRIX_H
+
+#include <GLES2/gl2.h>
+#include <math.h>
+#include <assert.h>
+
+#define KD_FLT_EPSILON 1.19209290E-07F
+#define KD_DEG_TO_RAD_F 0.0174532924F
+#define KD_RAD_TO_DEG_F 57.2957802F
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4]);
+
+/* vector utilities */
+
+GLfloat NvVecLengthf(const GLfloat v[3]);
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3]);
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4]);
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+
+/* matrix utilities */
+
+void NvMultMatf(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4]);
+
+void NvInvMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+
+/* matrix building utilities */
+
+void NvBuildIdentityMatf(GLfloat r[4][4]);
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees);
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees);
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians);
+
+void NvBuildRotRadMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat radians);
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3]);
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+/* matrix concatenation utilities */
+
+void NvMultTranslateMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+void NvMultScaleMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees);
+
+void NvMultRotXRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotYRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotZRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+
+void NvMultRotRadMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.cpp b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.cpp
new file mode 100644
index 00000000..6dc6d1a7
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_quat.h"
+#include <stdlib.h>
+#include <cstring>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4])
+{
+ memcpy(r, q, 4 * sizeof(GLfloat));
+}
+
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4])
+{
+ // Assumes that the quaternion is normalized!
+ GLfloat x2 = q[0] * 2.0f;
+ GLfloat y2 = q[1] * 2.0f;
+ GLfloat z2 = q[2] * 2.0f;
+ GLfloat xSq2 = x2 * q[0];
+ GLfloat ySq2 = y2 * q[1];
+ GLfloat zSq2 = z2 * q[2];
+ GLfloat xy2 = x2 * q[1];
+ GLfloat xz2 = x2 * q[2];
+ GLfloat xw2 = x2 * q[3];
+ GLfloat yz2 = y2 * q[2];
+ GLfloat yw2 = y2 * q[3];
+ GLfloat zw2 = z2 * q[3];
+
+ /* Matrix is
+ * | 1 - 2y^2 - 2z^2 2xy - 2zw 2xz + 2yw |
+ * | 2xy + 2zw 1 - 2x^2 - 2z^2 2yz - 2xw |
+ * | 2xz - 2yw 2yz + 2xw 1 - 2x^2 - 2y^2 |
+ */
+ r[0][0] = 1.0f - ySq2 - zSq2;
+ r[0][1] = xy2 - zw2;
+ r[0][2] = xz2 + yw2;
+
+ r[1][0] = xy2 + zw2;
+ r[1][1] = 1.0f - xSq2 - zSq2;
+ r[1][2] = yz2 - xw2;
+
+ r[2][0] = xz2 - yw2;
+ r[2][1] = yz2 + xw2;
+ r[2][2] = 1.0f - xSq2 - ySq2;
+}
+
+void NvQuatIdentity(GLfloat r[4])
+{
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = 1.0f;
+}
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3])
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = axis[0] * sina;
+ r[1] = axis[1] * sina;
+ r[2] = axis[2] * sina;
+ r[3] = cosa;
+}
+
+void NvQuatX(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = sina;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatY(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = sina;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatZ(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = sina;
+ r[3] = cosa;
+}
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatY(h, heading);
+ NvQuatX(p, pitch);
+ NvQuatZ(ro, roll);
+
+ NvQuatMult(r, h, p);
+ NvQuatMult(r, ro, r);
+}
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatZ(ro, roll);
+ NvQuatX(p, pitch);
+ NvQuatY(h, heading);
+
+ NvQuatMult(r, p, h);
+ NvQuatMult(r, r, ro);
+}
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4])
+{
+ return q1[0] * q2[0] + q1[1] * q2[1] + q1[2] * q2[2] + q1[3] * q2[3];
+}
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4])
+{
+ const GLfloat q1x = q1[0];
+ const GLfloat q1y = q1[1];
+ const GLfloat q1z = q1[2];
+ const GLfloat q1w = q1[3];
+ const GLfloat q2x = q2[0];
+ const GLfloat q2y = q2[1];
+ const GLfloat q2z = q2[2];
+ const GLfloat q2w = q2[3];
+
+ r[0] = q1y * q2z - q2y * q1z + q1w * q2x + q2w * q1x;
+ r[1] = q1z * q2x - q2z * q1x + q1w * q2y + q2w * q1y;
+ r[2] = q1x * q2y - q2x * q1y + q1w * q2z + q2w * q1z;
+ r[3] = q1w * q2w - q1x * q2x - q1y * q2y - q1z * q2z;
+}
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t)
+{
+ GLfloat omt = 1.0f - t;
+
+ if (NvQuatDot(q1, q2) < 0.0f) {
+ r[0] = -q1[0] * omt + q2[0] * t;
+ r[1] = -q1[1] * omt + q2[1] * t;
+ r[2] = -q1[2] * omt + q2[2] * t;
+ r[3] = -q1[3] * omt + q2[3] * t;
+ } else {
+ r[0] = q1[0] * omt + q2[0] * t;
+ r[1] = q1[1] * omt + q2[1] * t;
+ r[2] = q1[2] * omt + q2[2] * t;
+ r[3] = q1[3] * omt + q2[3] * t;
+ }
+
+ NvQuatNormalize(r, r);
+}
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4])
+{
+ GLfloat invLength = 1.0f / sqrtf(NvQuatDot(q, q));
+
+ r[0] = invLength * q[0];
+ r[1] = invLength * q[1];
+ r[2] = invLength * q[2];
+ r[3] = invLength * q[3];
+}
diff --git a/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.h b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.h
new file mode 100644
index 00000000..688c30a7
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/android/jni/libs/nv_math/nv_quat.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QUAT_H
+#define INCLUDED_QUAT_H
+
+#include <GLES2/gl2.h>
+#include <math.h>
+#include <assert.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4]);
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4]);
+
+void NvQuatIdentity(GLfloat r[4]);
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3]);
+
+void NvQuatX(GLfloat r[4], GLfloat radians);
+
+void NvQuatY(GLfloat r[4], GLfloat radians);
+
+void NvQuatZ(GLfloat r[4], GLfloat radians);
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t);
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4]);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.abc b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.abc
new file mode 100644
index 00000000..f7e3c2f6
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.dds b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.dds
new file mode 100644
index 00000000..5bde760b
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_256.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.abc b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.abc
new file mode 100644
index 00000000..2ff78757
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.dds b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.dds
new file mode 100644
index 00000000..f9e76d94
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/courier+lucida_512.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/linux/assets/font.frag b/src/Runtime/Source/platformspecific/linux/assets/font.frag
new file mode 100644
index 00000000..e4673cf8
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/font.frag
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+uniform sampler2D fontTex;
+
+varying lowp vec4 col_var;
+varying lowp vec2 tex_var;
+
+void main()
+{
+ gl_FragColor = texture2D(fontTex, tex_var).a * col_var;
+}
+
diff --git a/src/Runtime/Source/platformspecific/linux/assets/font.vert b/src/Runtime/Source/platformspecific/linux/assets/font.vert
new file mode 100644
index 00000000..9f307a2f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/assets/font.vert
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// this is set from higher level. think of it as the upper model matrix
+uniform mat4 pixelToClipMat;
+
+uniform vec4 col_uni;
+
+attribute vec2 pos_attr;
+attribute vec2 tex_attr;
+attribute vec4 col_attr;
+
+varying vec4 col_var;
+varying vec2 tex_var;
+
+void main()
+{
+ // account for translation and rotation of the primitive into [-1,1] spatial default.
+ gl_Position = pixelToClipMat * vec4(pos_attr.x, pos_attr.y, 0, 1);
+
+ col_var = col_attr * col_uni;
+ tex_var = tex_attr;
+}
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_color.h b/src/Runtime/Source/platformspecific/linux/libs/nv_color.h
new file mode 100644
index 00000000..b9347529
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_color.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_COLOR_H
+#define _QT3DS_COLOR_H
+
+/** @file nv_color.h
+ Simple abstraction for RGBA colors as parameters to various libraries/functions.
+*/
+
+/** Base type for a single color channel (8-bit unsigned). */
+typedef unsigned char NvPCColor8;
+
+//#define NV_COLOR_BREAKOLD
+#ifdef NV_COLOR_BREAKOLD // uses a struct to break backwards-compat and accidental uses
+
+typedef struct
+{
+ NvPCColor8 r;
+ NvPCColor8 g;
+ NvPCColor8 b;
+ NvPCColor8 a;
+} NvPackedColor;
+
+static const NvPackedColor gnvpcwhite = { 255, 255, 255, 255 };
+static const NvPackedColor gnvpcblack = { 0, 0, 0, 255 };
+
+#define NV_PACKED_COLOR(r, g, b, a) \
+ { \
+ (NvPCColor8)(r), (NvPCColor8)(g), (NvPCColor8)(b), (NvPCColor8)(a) \
+ }
+
+#define NV_PC_PREDEF_WHITE gnvpcwhite
+#define NV_PC_PREDEF_BLACK gnvpcblack
+
+#define NV_PC_RED(c) (c.r)
+#define NV_PC_GREEN(c) (c.g)
+#define NV_PC_BLUE(c) (c.b)
+#define NV_PC_ALPHA(c) (c.a)
+
+#define NV_PC_PACK_UINT(c) (*(unsigned int *)(&(c)))
+
+#define NV_PC_EQUAL(x, y) ((x).r == (y).r && (x).g == (y).g && (x).b == (y).b && (x).a == (y).a)
+
+#else /* code that doesn't break old pass-as-uint stuff */
+
+/** Main type declaration for a packed 4-color construct. */
+typedef unsigned int NvPackedColor;
+
+/** A macro to build a packed color, passing in RGBA as four 8-bit integer values. */
+#define NV_PACKED_COLOR(r, g, b, a) \
+ ((NvPackedColor)(((((int)(a)) & 0xFF) << 24) | ((((int)(b)) & 0xFF) << 16) \
+ | ((((int)(g)) & 0xFF) << 8) | ((((int)(r)) & 0xFF))))
+
+/** A predefined constant for WHITE. */
+#define NV_PC_PREDEF_WHITE NV_PACKED_COLOR(0xFF, 0xFF, 0xFF, 0xFF)
+/** A predefined constant for BLACK. */
+#define NV_PC_PREDEF_BLACK NV_PACKED_COLOR(0x00, 0x00, 0x00, 0xFF)
+
+/** A macro for 'extracting' the red value from an NvPackedColor. */
+#define NV_PC_RED(c) ((c >> 0) & 0xff)
+/** A macro for 'extracting' the green value from an NvPackedColor. */
+#define NV_PC_GREEN(c) ((c >> 8) & 0xff)
+/** A macro for 'extracting' the blue value from an NvPackedColor. */
+#define NV_PC_BLUE(c) ((c >> 16) & 0xff)
+/** A macro for 'extracting' the alpha value from an NvPackedColor. */
+#define NV_PC_ALPHA(c) ((c >> 24) & 0xff)
+
+/** A macro requesting the packed color repacked into a 32-bit unsigned int.
+ This is a no-op for the color-as-uint approach.
+*/
+#define NV_PC_PACK_UINT(c) (c)
+/** A macro for testing the equality of two NvPackedColors. */
+#define NV_PC_EQUAL(x, y) (x == y)
+#endif
+
+/** A macro for mapping a single packed color channel into its floating point [0,1] rep. */
+#define NV_PC_TO_FLOAT(c) (c / 255.0f)
+
+#endif /*_QT3DS_COLOR_H*/
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_debug.h b/src/Runtime/Source/platformspecific/linux/libs/nv_debug.h
new file mode 100644
index 00000000..2559dd6f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_debug.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_DEBUG_H
+#define __INCLUDED_QT3DS_DEBUG_H
+
+#define CT_ASSERT(tag, cond) enum { COMPILE_TIME_ASSERT__##tag = 1 / (cond) }
+
+#define dimof(x) (sizeof(x) / sizeof(x[0]))
+#include <android/log.h>
+
+#define DBG_DETAILED 0
+
+#if 0
+
+ // the detailed prefix can be customised by setting DBG_DETAILED_PREFIX. See
+ // below as a reference.
+ // NOTE: fmt is the desired format string and must be in the prefix.
+ //#ifndef DBG_DETAILED_PREFIX
+ // #define DBG_DETAILED_PREFIX "%s, %s, line %d: " fmt, __FILE__, __FUNCTION__, __LINE__,
+ //#endif
+ //#define DEBUG_D_(fmt, args...)
+ //#define DEBUG_D(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, (DBG_DETAILED_PREFIX) ## args)
+
+#else
+
+#ifdef STRINGIFY
+#pragma push_macro("STRINGIFY")
+#undef STRINGIFY
+#define STRINGIFYPUSHED_____
+#endif
+#define STRINGIFY(x) #x
+
+// debug macro, includes file name function name and line number
+#define TO(x) typeof(x)
+#define DEBUG_D_(file, line, fmt, args...) \
+ __android_log_print(ANDROID_LOG_DEBUG, MODULE, file ", %s, line(" STRINGIFY(line) "): " fmt, \
+ __FUNCTION__, ##args)
+#define DEBUG_D(fmt, args...) DEBUG_D_(__FILE__, __LINE__, fmt, ##args)
+
+#ifdef STRINGIFYPUSHED_____
+#undef STRINGIFYPUSHED_____
+#pragma pop_macro("STRINGIFY")
+#endif
+
+#endif
+
+// basic debug macro
+#define DEBUG_(fmt, args...) (__android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args))
+
+// Debug macro that can be switched to spew a file name,
+// function and line number using DEBUG_DETAILED
+#if DBG_DETAILED == 1
+#define DEBUG(fmt, args...) DEBUG_D(fmt, ##args)
+#else
+#define DEBUG(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args)
+#endif
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_global.h b/src/Runtime/Source/platformspecific/linux/libs/nv_global.h
new file mode 100644
index 00000000..9d23d45f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_global.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_GLOBAL_H
+#define __INCLUDED_QT3DS_GLOBAL_H
+
+#include "nv_types.h"
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/NvVec.h b/src/Runtime/Source/platformspecific/linux/libs/nv_math/NvVec.h
new file mode 100644
index 00000000..4e5b09ce
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/NvVec.h
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_VEC_H
+#define INCLUDED_QT3DS_MATH_CPP_VEC_H
+
+#include "misc.h"
+
+struct _NvVec3
+{
+ union {
+ struct
+ {
+ float x, y, z;
+ };
+ float v[3];
+ };
+};
+
+struct NvVec3 : public _NvVec3
+{
+ NvVec3() { zero(); }
+
+ NvVec3(float x, float y, float z)
+ {
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+ }
+
+ NvVec3(NvVec3 const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ v[2] = that.v[2];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ v[2] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec3 &operator+=(NvVec3 const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ v[2] += that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator-=(NvVec3 const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ v[2] -= that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ v[2] *= s;
+ return *this;
+ }
+
+ NvVec3 &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ v[2] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec3 const &a, NvVec3 const &b)
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+inline NvVec3 operator+(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] + b.v[0], a.v[1] + b.v[1], a.v[2] + b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] - b.v[0], a.v[1] - b.v[1], a.v[2] - b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a)
+{
+
+ return NvVec3(-a.v[0], -a.v[1], -a.v[2]);
+}
+
+inline NvVec3 operator*(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] * s, a.v[1] * s, a.v[2] * s);
+}
+
+inline NvVec3 operator*(float s, NvVec3 const &a)
+{
+
+ return NvVec3(s * a.v[0], s * a.v[1], s * a.v[2]);
+}
+
+inline NvVec3 operator/(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] / s, a.v[1] / s, a.v[2] / s);
+}
+
+inline float magnitude(NvVec3 const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec3 normalize(NvVec3 const &v)
+{
+ float l = magnitude(v);
+ return NvVec3(v[0] / l, v[1] / l, v[2] / l);
+}
+
+inline NvVec3 cross(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[1] * b.v[2] - a.v[2] * b.v[1], a.v[2] * b.v[0] - a.v[0] * b.v[2],
+ a.v[0] * b.v[1] - a.v[1] * b.v[0]);
+}
+
+inline bool operator==(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] == b.v[0] && a.v[1] == b.v[1] && a.v[2] == b.v[2]);
+}
+
+inline bool operator!=(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] != b.v[0] || a.v[1] != b.v[1] || a.v[2] != b.v[2]);
+}
+
+struct NvVec2f
+{
+ union {
+ struct
+ {
+ float x, y;
+ float v[2];
+ };
+ };
+
+ NvVec2f() { zero(); }
+
+ NvVec2f(float x, float y)
+ {
+ v[0] = x;
+ v[1] = y;
+ }
+
+ NvVec2f(NvVec2f const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec2f &operator+=(NvVec2f const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator-=(NvVec2f const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ return *this;
+ }
+
+ NvVec2f &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+inline NvVec2f operator+(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] + b.v[0], a.v[1] + b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] - b.v[0], a.v[1] - b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a)
+{
+
+ return NvVec2f(-a.v[0], -a.v[1]);
+}
+
+inline NvVec2f operator*(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] * s, a.v[1] * s);
+}
+
+inline NvVec2f operator*(float s, NvVec2f const &a)
+{
+
+ return NvVec2f(s * a.v[0], s * a.v[1]);
+}
+
+inline NvVec2f operator/(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] / s, a.v[1] / s);
+}
+
+inline float magnitude(NvVec2f const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec2f normalize(NvVec2f const &v)
+{
+ float l = dot(v, v);
+ return NvVec2f(v[0] / l, v[1] / l);
+}
+
+inline float cross(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a.v[0] * b.v[1] - b.v[0] * a.v[1];
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/misc.h b/src/Runtime/Source/platformspecific/linux/libs/nv_math/misc.h
new file mode 100644
index 00000000..983410f3
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/misc.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_MISC_H
+#define INCLUDED_QT3DS_MATH_CPP_MISC_H
+
+inline bool nvIsPowerOfTwo(unsigned int i)
+{
+ return (i & (i - 1)) == 0;
+}
+
+inline float nvDegToRadf(float d)
+{
+ return d * 3.14159265358979323846f / 180.0f;
+}
+
+inline float nvRadToDegf(float r)
+{
+ return r * 180.0f / 3.14159265358979323846f;
+}
+
+/*
+ 'mod' differs from '%' in that it behaves correctly when either the
+ numerator or denominator is negative.
+*/
+
+inline int nvMod(int n, int d)
+{
+ int m = n % d;
+ return (((m < 0) && (d > 0)) || ((m > 0) && (d < 0))) ? (m + d) : m;
+}
+
+inline int nvAbs(int n)
+{
+ if (n < 0)
+ return -n;
+ return n;
+}
+
+inline int nvSign(int n)
+{
+ if (n > 0)
+ return 1;
+ if (n < 0)
+ return -1;
+ return 0;
+}
+
+/*
+ This returns the smallest amplitude value x such that
+ nvMod(b + x, m) == a
+*/
+
+inline int nvDifMod(int a, int b, int m)
+{
+
+ int x1 = a - b;
+ int x2 = (x1 > 0) ? x1 - m : x1 + m;
+ return (nvAbs(x1) < nvAbs(x2)) ? x1 : x2;
+}
+
+inline float nvWrapf(float a, float min, float max)
+{
+
+ assert(max > min);
+
+ float d = max - min;
+ float s = a - min;
+ float q = s / d;
+ float m = q - floorf(q);
+ return m * d + min;
+}
+
+inline float nvClampf(float a, float min, float max)
+{
+ return (a < min) ? min : ((a > max) ? max : a);
+}
+
+inline int nvClampi(int i, int min, int max)
+{
+ return (i < min) ? min : ((i > max) ? max : i);
+}
+
+inline float nvGaussian(float x, float s)
+{
+ float c = s * sqrtf(2.0f * 3.14159265358979323846f);
+ return expf(-(x * x) / (2.0f * s * s)) / c;
+}
+
+inline float nvLerpf(float a, float b, float t)
+{
+ return a * (1.0f - t) + b * t;
+}
+
+inline float nvEasef(float t)
+{
+
+ float t_2 = t * t;
+ float t_3 = t_2 * t;
+ return 3.0f * t_2 - 2.0f * t_3;
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.cpp b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.cpp
new file mode 100644
index 00000000..b83cb39e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_math.h"
+
+static const double a = 16807.0;
+static const double m = 2147483647.0;
+
+static double nextSeed(double seed)
+{
+ double t = a * seed;
+ return t - m * (double)((int)(t / m));
+}
+
+GLfloat NvRandf()
+{
+ static double seed = 1.0;
+ seed = nextSeed(seed);
+ return (GLfloat)(seed * (1 / m));
+}
+
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime)
+{
+ // kdGetTimeUST is never supposed to decrease (i.e. that
+ // means it can't wrap, either. IIRC, it will wrap in
+ // 593 years). So we ignore that option...
+
+ // Used for frame-to-frame diffs, this will fit in 32b
+ // as long as the times are < ~4.3s apart
+ long long int diffTime = newTime - oldTime;
+
+ // Need to find a better way to do this.
+ // However, I believe we will be uSec precise (not run
+ // out of mantissa bits for uSecs) as long as the diff
+ // is < ~16s (1e-6 * (2^24))
+ return ((GLfloat)diffTime) / 1.0e9f;
+}
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.h b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.h
new file mode 100644
index 00000000..2ef7bba0
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_math.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_MATH_H
+#define _QT3DS_MATH_H
+
+#include <QtGui/qopengl.h>
+
+GLfloat NvRandf();
+
+/* These are the recommended "safer" ways to use GLfloat for time */
+
+/* Returns the seconds between the two given times */
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime);
+
+#define QT3DS_MILISECS_TO_UST(ms) ((long long int)(ms)*1000000)
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.cpp b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.cpp
new file mode 100644
index 00000000..e208ac31
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.cpp
@@ -0,0 +1,1030 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_matrix.h"
+
+int NvDifferentMatsf(GLfloat a[4][4], const GLfloat b[4][4])
+{
+ return ((&a[3][3] < &b[0][0]) || (&b[3][3] < &a[0][0]));
+}
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+}
+
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+}
+
+GLfloat NvVecLengthf(const GLfloat v[3])
+{
+ return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3])
+{
+ GLfloat const l = NvVecLengthf(v);
+ r[0] = v[0] / l;
+ r[1] = v[1] / l;
+ r[2] = v[2] / l;
+}
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] + b[0];
+ r[1] = a[1] + b[1];
+ r[2] = a[2] + b[2];
+}
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ GLfloat t[3];
+
+ t[0] = a[1] * b[2] - a[2] * b[1];
+ t[1] = a[2] * b[0] - a[0] * b[2];
+ t[2] = a[0] * b[1] - a[1] * b[0];
+
+ r[0] = t[0];
+ r[1] = t[1];
+ r[2] = t[2];
+}
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ GLfloat inv_w = 1.0f / (m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3]);
+
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * inv_w;
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * inv_w;
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * inv_w;
+}
+
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * a[3];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * a[3];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * a[3];
+ r[3] = m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3] * a[3];
+}
+
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2];
+}
+
+static void NvMultMat3x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2];
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x4f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2] + a[3][0] * b[0][3];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2] + a[3][1] * b[0][3];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2] + a[3][2] * b[0][3];
+ r[0][3] = a[0][3] * b[0][0] + a[1][3] * b[0][1] + a[2][3] * b[0][2] + a[3][3] * b[0][3];
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2] + a[3][0] * b[1][3];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2] + a[3][1] * b[1][3];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2] + a[3][2] * b[1][3];
+ r[1][3] = a[0][3] * b[1][0] + a[1][3] * b[1][1] + a[2][3] * b[1][2] + a[3][3] * b[1][3];
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2] + a[3][0] * b[2][3];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2] + a[3][1] * b[2][3];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2] + a[3][2] * b[2][3];
+ r[2][3] = a[0][3] * b[2][0] + a[1][3] * b[2][1] + a[2][3] * b[2][2] + a[3][3] * b[2][3];
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0] * b[3][3];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1] * b[3][3];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2] * b[3][3];
+ r[3][3] = a[0][3] * b[3][0] + a[1][3] * b[3][1] + a[2][3] * b[3][2] + a[3][3] * b[3][3];
+}
+
+void NvMultMatf(GLfloat result[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((a[0][3] == 0.0f) && (a[1][3] == 0.0f) && (a[2][3] == 0.0f) && (a[2][3] == 1.0f)
+ && (b[0][3] == 0.0f) && (b[1][3] == 0.0f) && (b[2][3] == 0.0f) && (b[2][3] == 1.0f)) {
+ if ((a[3][0] == 0.0f) && (a[3][1] == 0.0f) && (a[3][2] == 0.0f) && (b[3][0] == 0.0f)
+ && (b[3][1] == 0.0f) && (b[3][2] == 0.0f)) {
+ NvMultMat3x3f(r, a, b);
+ } else {
+ NvMultMat4x3f(r, a, b);
+ }
+ } else {
+ NvMultMat4x4f(r, a, b);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+static void NvInvMat3x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ /* x */
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ /* y */
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ /* z */
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x4f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] * m[3][3] + m[0][0] * m[1][2] * m[2][3] * m[3][1]
+ + m[0][0] * m[1][3] * m[2][1] * m[3][2] + m[0][1] * m[1][0] * m[2][3] * m[3][2]
+ + m[0][1] * m[1][2] * m[2][0] * m[3][3] + m[0][1] * m[1][3] * m[2][2] * m[3][0]
+ + m[0][2] * m[1][0] * m[2][1] * m[3][3] + m[0][2] * m[1][1] * m[2][3] * m[3][0]
+ + m[0][2] * m[1][3] * m[2][0] * m[3][1] + m[0][3] * m[1][0] * m[2][2] * m[3][1]
+ + m[0][3] * m[1][1] * m[2][0] * m[3][2] + m[0][3] * m[1][2] * m[2][1] * m[3][0]
+ + -m[0][0] * m[1][1] * m[2][3] * m[3][2] + -m[0][0] * m[1][2] * m[2][1] * m[3][3]
+ + -m[0][0] * m[1][3] * m[2][2] * m[3][1] + -m[0][1] * m[1][0] * m[2][2] * m[3][3]
+ + -m[0][1] * m[1][2] * m[2][3] * m[3][0] + -m[0][1] * m[1][3] * m[2][0] * m[3][2]
+ + -m[0][2] * m[1][0] * m[2][3] * m[3][1] + -m[0][2] * m[1][1] * m[2][0] * m[3][3]
+ + -m[0][2] * m[1][3] * m[2][1] * m[3][0] + -m[0][3] * m[1][0] * m[2][1] * m[3][2]
+ + -m[0][3] * m[1][1] * m[2][2] * m[3][0] + -m[0][3] * m[1][2] * m[2][0] * m[3][1];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] * m[3][3] + m[1][2] * m[2][3] * m[3][1]
+ + m[1][3] * m[2][1] * m[3][2] + -m[1][1] * m[2][3] * m[3][2]
+ + -m[1][2] * m[2][1] * m[3][3] + -m[1][3] * m[2][2] * m[3][1])
+ / d;
+
+ r[0][1] = (m[0][1] * m[2][3] * m[3][2] + m[0][2] * m[2][1] * m[3][3]
+ + m[0][3] * m[2][2] * m[3][1] + -m[0][1] * m[2][2] * m[3][3]
+ + -m[0][2] * m[2][3] * m[3][1] + -m[0][3] * m[2][1] * m[3][2])
+ / d;
+
+ r[0][2] = (m[0][1] * m[1][2] * m[3][3] + m[0][2] * m[1][3] * m[3][1]
+ + m[0][3] * m[1][1] * m[3][2] + -m[0][1] * m[1][3] * m[3][2]
+ + -m[0][2] * m[1][1] * m[3][3] + -m[0][3] * m[1][2] * m[3][1])
+ / d;
+
+ r[0][3] = (m[0][1] * m[1][3] * m[2][2] + m[0][2] * m[1][1] * m[2][3]
+ + m[0][3] * m[1][2] * m[2][1] + -m[0][1] * m[1][2] * m[2][3]
+ + -m[0][2] * m[1][3] * m[2][1] + -m[0][3] * m[1][1] * m[2][2])
+ / d;
+
+ r[1][0] = (m[1][0] * m[2][3] * m[3][2] + m[1][2] * m[2][0] * m[3][3]
+ + m[1][3] * m[2][2] * m[3][0] + -m[1][0] * m[2][2] * m[3][3]
+ + -m[1][2] * m[2][3] * m[3][0] + -m[1][3] * m[2][0] * m[3][2])
+ / d;
+
+ r[1][1] = (m[0][0] * m[2][2] * m[3][3] + m[0][2] * m[2][3] * m[3][0]
+ + m[0][3] * m[2][0] * m[3][2] + -m[0][0] * m[2][3] * m[3][2]
+ + -m[0][2] * m[2][0] * m[3][3] + -m[0][3] * m[2][2] * m[3][0])
+ / d;
+
+ r[1][2] = (m[0][0] * m[1][3] * m[3][2] + m[0][2] * m[1][0] * m[3][3]
+ + m[0][3] * m[1][2] * m[3][0] + -m[0][0] * m[1][2] * m[3][3]
+ + -m[0][2] * m[1][3] * m[3][0] + -m[0][3] * m[1][0] * m[3][2])
+ / d;
+
+ r[1][3] = (m[0][0] * m[1][2] * m[2][3] + m[0][2] * m[1][3] * m[2][0]
+ + m[0][3] * m[1][0] * m[2][2] + -m[0][0] * m[1][3] * m[2][2]
+ + -m[0][2] * m[1][0] * m[2][3] + -m[0][3] * m[1][2] * m[2][0])
+ / d;
+
+ r[2][0] = (m[1][0] * m[2][1] * m[3][3] + m[1][1] * m[2][3] * m[3][0]
+ + m[1][3] * m[2][0] * m[3][1] + -m[1][0] * m[2][3] * m[3][1]
+ + -m[1][1] * m[2][0] * m[3][3] + -m[1][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][1] =
+ (-m[0][0] * m[2][1] * m[3][3] + -m[0][1] * m[2][3] * m[3][0] + -m[0][3] * m[2][0] * m[3][1]
+ + m[0][0] * m[2][3] * m[3][1] + m[0][1] * m[2][0] * m[3][3] + m[0][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][2] = (m[0][0] * m[1][1] * m[3][3] + m[0][1] * m[1][3] * m[3][0]
+ + m[0][3] * m[1][0] * m[3][1] + -m[0][0] * m[1][3] * m[3][1]
+ + -m[0][1] * m[1][0] * m[3][3] + -m[0][3] * m[1][1] * m[3][0])
+ / d;
+
+ r[2][3] = (m[0][0] * m[1][3] * m[2][1] + m[0][1] * m[1][0] * m[2][3]
+ + m[0][3] * m[1][1] * m[2][0] + -m[0][1] * m[1][3] * m[2][0]
+ + -m[0][3] * m[1][0] * m[2][1] + -m[0][0] * m[1][1] * m[2][3])
+ / d;
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = (m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1]
+ + -m[0][1] * m[1][0] * m[2][2] + -m[0][2] * m[1][1] * m[2][0])
+ / d;
+}
+
+void NvInvMatf(GLfloat result[4][4], const GLfloat m[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((m[0][3] == 0.0f) && (m[1][3] == 0.0f) && (m[2][3] == 0.0f) && (m[2][3] == 1.0f)) {
+ if ((m[3][0] == 0.0f) && (m[3][1] == 0.0f) && (m[3][2] == 0.0f)) {
+ NvInvMat3x3f(r, m);
+ } else {
+ NvInvMat4x3f(r, m);
+ }
+ } else {
+ NvInvMat4x4f(r, m);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildIdentityMatf(GLfloat r[4][4])
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = x;
+ r[3][1] = y;
+ r[3][2] = z;
+ r[3][3] = 1.0f;
+}
+
+void NvMultTranslateMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLfloat r[4][4]; /*temporary storage for result */
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[0][0] * x + m[1][0] * y + m[2][0] * z + m[3][0];
+ r[3][1] = m[0][1] * x + m[1][1] * y + m[2][1] * z + m[3][1];
+ r[3][2] = m[0][2] * x + m[1][2] * y + m[2][2] * z + m[3][2];
+ r[3][3] = m[0][3] * x + m[1][3] * y + m[2][3] * z + m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = x;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = y;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = z;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultScaleMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * x;
+ r[0][1] = m[0][1] * x;
+ r[0][2] = m[0][2] * x;
+ r[0][3] = m[0][3] * x;
+
+ r[1][0] = m[1][0] * y;
+ r[1][1] = m[1][1] * y;
+ r[1][2] = m[1][2] * y;
+ r[1][3] = m[1][3] * y;
+
+ r[2][0] = m[2][0] * z;
+ r[2][1] = m[2][1] * z;
+ r[2][2] = m[2][2] * z;
+ r[2][3] = m[2][3] * z;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = c;
+ r[1][2] = s;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = -s;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = 0.0f;
+ r[0][2] = -s;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = s;
+ r[2][1] = 0.0f;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = s;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = -s;
+ r[1][1] = c;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultRotXRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0] * c + m[2][0] * s;
+ r[1][1] = m[1][1] * c + m[2][1] * s;
+ r[1][2] = m[1][2] * c + m[2][2] * s;
+ r[1][3] = m[1][3] * c + m[2][3] * s;
+
+ r[2][0] = m[1][0] * -s + m[2][0] * c;
+ r[2][1] = m[1][1] * -s + m[2][1] * c;
+ r[2][2] = m[1][2] * -s + m[2][2] * c;
+ r[2][3] = m[1][3] * -s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotYRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[2][0] * -s;
+ r[0][1] = m[0][1] * c + m[2][1] * -s;
+ r[0][2] = m[0][2] * c + m[2][2] * -s;
+ r[0][3] = m[0][3] * c + m[2][3] * -s;
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[0][0] * s + m[2][0] * c;
+ r[2][1] = m[0][1] * s + m[2][1] * c;
+ r[2][2] = m[0][2] * s + m[2][2] * c;
+ r[2][3] = m[0][3] * s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotZRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[1][0] * s;
+ r[0][1] = m[0][1] * c + m[1][1] * s;
+ r[0][2] = m[0][2] * c + m[1][2] * s;
+ r[0][3] = m[0][3] * c + m[1][3] * s;
+
+ r[1][0] = m[0][0] * -s + m[1][0] * c;
+ r[1][1] = m[0][1] * -s + m[1][1] * c;
+ r[1][2] = m[0][2] * -s + m[1][2] * c;
+ r[1][3] = m[0][3] * -s + m[1][3] * c;
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotRadMatf(GLfloat result[4][4], const GLfloat axis[3], GLfloat radians)
+{
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ /* build a matrix from the quat */
+
+ result[0][0] = 1.0f - 2.0f * (j * j + k * k);
+ result[0][1] = 2.0f * (i * j + r * k);
+ result[0][2] = 2.0f * (i * k - r * j);
+ result[0][3] = 0.0f;
+
+ result[1][0] = 2.0f * (i * j - r * k);
+ result[1][1] = 1.0f - 2.0f * (i * i + k * k);
+ result[1][2] = 2.0f * (j * k + r * i);
+ result[1][3] = 0.0f;
+
+ result[2][0] = 2.0f * (i * k + r * j);
+ result[2][1] = 2.0f * (j * k - r * i);
+ result[2][2] = 1.0f - 2.0f * (i * i + j * j);
+ result[2][3] = 0.0f;
+
+ result[3][0] = 0.0f;
+ result[3][1] = 0.0f;
+ result[3][2] = 0.0f;
+ result[3][3] = 1.0f;
+}
+
+void NvMultRotRadMatf(GLfloat result[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians)
+{
+ GLfloat r[4][4];
+
+ {
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat const dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ {
+ /* build a matrix from the quat */
+
+ GLfloat const a00 = 1.0f - 2.0f * (j * j + k * k);
+ GLfloat const a01 = 2.0f * (i * j + r * k);
+ GLfloat const a02 = 2.0f * (i * k - r * j);
+
+ GLfloat const a10 = 2.0f * (i * j - r * k);
+ GLfloat const a11 = 1.0f - 2.0f * (i * i + k * k);
+ GLfloat const a12 = 2.0f * (j * k + r * i);
+
+ GLfloat const a20 = 2.0f * (i * k + r * j);
+ GLfloat const a21 = 2.0f * (j * k - r * i);
+ GLfloat const a22 = 1.0f - 2.0f * (i * i + j * j);
+
+ result[0][0] = m[0][0] * a00 + m[1][0] * a01 + m[2][0] * a02;
+ result[0][1] = m[0][1] * a00 + m[1][1] * a01 + m[2][1] * a02;
+ result[0][2] = m[0][2] * a00 + m[1][2] * a01 + m[2][2] * a02;
+ result[0][3] = m[0][3] * a00 + m[1][3] * a01 + m[2][3] * a02;
+
+ result[1][0] = m[0][0] * a10 + m[1][0] * a11 + m[2][0] * a12;
+ result[1][1] = m[0][1] * a10 + m[1][1] * a11 + m[2][1] * a12;
+ result[1][2] = m[0][2] * a10 + m[1][2] * a11 + m[2][2] * a12;
+ result[1][3] = m[0][3] * a10 + m[1][3] * a11 + m[2][3] * a12;
+
+ result[2][0] = m[0][0] * a20 + m[1][0] * a21 + m[2][0] * a22;
+ result[2][1] = m[0][1] * a20 + m[1][1] * a21 + m[2][1] * a22;
+ result[2][2] = m[0][2] * a20 + m[1][2] * a21 + m[2][2] * a22;
+ result[2][3] = m[0][3] * a20 + m[1][3] * a21 + m[2][3] * a22;
+
+ result[3][0] = m[3][0];
+ result[3][1] = m[3][1];
+ result[3][2] = m[3][2];
+ result[3][3] = m[3][3];
+ }
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotXRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotYRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotZRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotXRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotYRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotZRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees)
+{
+ NvBuildRotRadMatf(r, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees)
+{
+ NvMultRotRadMatf(r, m, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3])
+{
+ GLfloat ev[3];
+ GLfloat z[3];
+ GLfloat x_tmp[3];
+ GLfloat x[3];
+ GLfloat y[3];
+
+ NvSubVecf(ev, eye, obj);
+
+ NvNormalizeVecf(z, ev);
+
+ NvCrossProductf(x_tmp, up, z);
+
+ NvNormalizeVecf(x, x_tmp);
+
+ NvCrossProductf(y, z, x);
+
+ r[0][0] = x[0];
+ r[0][1] = y[0];
+ r[0][2] = z[0];
+ r[0][3] = 0.0f;
+
+ r[1][0] = x[1];
+ r[1][1] = y[1];
+ r[1][2] = z[1];
+ r[1][3] = 0.0f;
+
+ r[2][0] = x[2];
+ r[2][1] = y[2];
+ r[2][2] = z[2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = -x[0] * eye[0] + -x[1] * eye[1] + -x[2] * eye[2];
+ r[3][1] = -y[0] * eye[0] + -y[1] * eye[1] + -y[2] * eye[2];
+ r[3][2] = -z[0] * eye[0] + -z[1] * eye[1] + -z[2] * eye[2];
+ r[3][3] = 1.0f;
+}
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const m00 = znear * 2.0f / (right - left);
+ GLfloat const m11 = znear * 2.0f / (top - bottom);
+ GLfloat const m22 = -(zfar + znear) / (zfar - znear);
+
+ GLfloat const m20 = (right + left) / (right - left);
+ GLfloat const m21 = (top + bottom) / (top - bottom);
+
+ GLfloat const m32 = -(2.0f * zfar * znear) / (zfar - znear);
+ GLfloat const m23 = -1.0f;
+
+ r[0][0] = m00;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = m11;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = m20;
+ r[2][1] = m21;
+ r[2][2] = m22;
+ r[2][3] = m23;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = m32;
+ r[3][3] = 0.0f;
+}
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+ GLfloat const sz = -2.0f / (zfar - znear);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+ GLfloat const tz = -(zfar + znear) / (zfar - znear);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = sz;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = tz;
+ r[3][3] = 1.0f;
+}
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.h b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.h
new file mode 100644
index 00000000..5f567f06
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_matrix.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_MATRIX_H
+#define INCLUDED_MATRIX_H
+
+#include <QtGui/qopengl.h>
+
+#include <math.h>
+#include <assert.h>
+
+#define KD_FLT_EPSILON 1.19209290E-07F
+#define KD_DEG_TO_RAD_F 0.0174532924F
+#define KD_RAD_TO_DEG_F 57.2957802F
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4]);
+
+/* vector utilities */
+
+GLfloat NvVecLengthf(const GLfloat v[3]);
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3]);
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4]);
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+
+/* matrix utilities */
+
+void NvMultMatf(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4]);
+
+void NvInvMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+
+/* matrix building utilities */
+
+void NvBuildIdentityMatf(GLfloat r[4][4]);
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees);
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees);
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians);
+
+void NvBuildRotRadMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat radians);
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3]);
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+/* matrix concatenation utilities */
+
+void NvMultTranslateMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+void NvMultScaleMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees);
+
+void NvMultRotXRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotYRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotZRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+
+void NvMultRotRadMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.cpp b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.cpp
new file mode 100644
index 00000000..e66420c6
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.cpp
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_quat.h"
+#include <stdlib.h>
+#ifdef _INTEGRITYPLATFORM
+#include <string.h>
+#else
+#include <memory.h>
+#endif
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4])
+{
+ memcpy(r, q, 4 * sizeof(GLfloat));
+}
+
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4])
+{
+ // Assumes that the quaternion is normalized!
+ GLfloat x2 = q[0] * 2.0f;
+ GLfloat y2 = q[1] * 2.0f;
+ GLfloat z2 = q[2] * 2.0f;
+ GLfloat xSq2 = x2 * q[0];
+ GLfloat ySq2 = y2 * q[1];
+ GLfloat zSq2 = z2 * q[2];
+ GLfloat xy2 = x2 * q[1];
+ GLfloat xz2 = x2 * q[2];
+ GLfloat xw2 = x2 * q[3];
+ GLfloat yz2 = y2 * q[2];
+ GLfloat yw2 = y2 * q[3];
+ GLfloat zw2 = z2 * q[3];
+
+ /* Matrix is
+ * | 1 - 2y^2 - 2z^2 2xy - 2zw 2xz + 2yw |
+ * | 2xy + 2zw 1 - 2x^2 - 2z^2 2yz - 2xw |
+ * | 2xz - 2yw 2yz + 2xw 1 - 2x^2 - 2y^2 |
+ */
+ r[0][0] = 1.0f - ySq2 - zSq2;
+ r[0][1] = xy2 - zw2;
+ r[0][2] = xz2 + yw2;
+
+ r[1][0] = xy2 + zw2;
+ r[1][1] = 1.0f - xSq2 - zSq2;
+ r[1][2] = yz2 - xw2;
+
+ r[2][0] = xz2 - yw2;
+ r[2][1] = yz2 + xw2;
+ r[2][2] = 1.0f - xSq2 - ySq2;
+}
+
+void NvQuatIdentity(GLfloat r[4])
+{
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = 1.0f;
+}
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3])
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = axis[0] * sina;
+ r[1] = axis[1] * sina;
+ r[2] = axis[2] * sina;
+ r[3] = cosa;
+}
+
+void NvQuatX(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = sina;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatY(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = sina;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatZ(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = sina;
+ r[3] = cosa;
+}
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatY(h, heading);
+ NvQuatX(p, pitch);
+ NvQuatZ(ro, roll);
+
+ NvQuatMult(r, h, p);
+ NvQuatMult(r, ro, r);
+}
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatZ(ro, roll);
+ NvQuatX(p, pitch);
+ NvQuatY(h, heading);
+
+ NvQuatMult(r, p, h);
+ NvQuatMult(r, r, ro);
+}
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4])
+{
+ return q1[0] * q2[0] + q1[1] * q2[1] + q1[2] * q2[2] + q1[3] * q2[3];
+}
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4])
+{
+ const GLfloat q1x = q1[0];
+ const GLfloat q1y = q1[1];
+ const GLfloat q1z = q1[2];
+ const GLfloat q1w = q1[3];
+ const GLfloat q2x = q2[0];
+ const GLfloat q2y = q2[1];
+ const GLfloat q2z = q2[2];
+ const GLfloat q2w = q2[3];
+
+ r[0] = q1y * q2z - q2y * q1z + q1w * q2x + q2w * q1x;
+ r[1] = q1z * q2x - q2z * q1x + q1w * q2y + q2w * q1y;
+ r[2] = q1x * q2y - q2x * q1y + q1w * q2z + q2w * q1z;
+ r[3] = q1w * q2w - q1x * q2x - q1y * q2y - q1z * q2z;
+}
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t)
+{
+ GLfloat omt = 1.0f - t;
+
+ if (NvQuatDot(q1, q2) < 0.0f) {
+ r[0] = -q1[0] * omt + q2[0] * t;
+ r[1] = -q1[1] * omt + q2[1] * t;
+ r[2] = -q1[2] * omt + q2[2] * t;
+ r[3] = -q1[3] * omt + q2[3] * t;
+ } else {
+ r[0] = q1[0] * omt + q2[0] * t;
+ r[1] = q1[1] * omt + q2[1] * t;
+ r[2] = q1[2] * omt + q2[2] * t;
+ r[3] = q1[3] * omt + q2[3] * t;
+ }
+
+ NvQuatNormalize(r, r);
+}
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4])
+{
+ GLfloat invLength = 1.0f / sqrtf(NvQuatDot(q, q));
+
+ r[0] = invLength * q[0];
+ r[1] = invLength * q[1];
+ r[2] = invLength * q[2];
+ r[3] = invLength * q[3];
+}
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.h b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.h
new file mode 100644
index 00000000..2e97c717
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_math/nv_quat.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QUAT_H
+#define INCLUDED_QUAT_H
+
+#include <QtGui/qopengl.h>
+
+#include <math.h>
+#include <assert.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4]);
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4]);
+
+void NvQuatIdentity(GLfloat r[4]);
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3]);
+
+void NvQuatX(GLfloat r[4], GLfloat radians);
+
+void NvQuatY(GLfloat r[4], GLfloat radians);
+
+void NvQuatZ(GLfloat r[4], GLfloat radians);
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t);
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4]);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/linux/libs/nv_types.h b/src/Runtime/Source/platformspecific/linux/libs/nv_types.h
new file mode 100644
index 00000000..1d1b0300
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/linux/libs/nv_types.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_TYPES_H
+#define __INCLUDED_QT3DS_TYPES_H
+
+typedef unsigned char NvU8; // 0 to 255
+typedef unsigned short NvU16; // 0 to 65535
+typedef unsigned int NvU32; // 0 to 4294967295
+typedef unsigned long long NvU64; // 0 to 18446744073709551615
+typedef signed char NvS8; // -128 to 127
+typedef signed short NvS16; // -32768 to 32767
+typedef signed int NvS32; // -2147483648 to 2147483647
+typedef signed long long NvS64; // 2^-63 to 2^63-1
+
+// Explicitly sized floats
+typedef float NvF32; // IEEE Single Precision (S1E8M23)
+typedef double NvF64; // IEEE Double Precision (S1E11M52)
+
+// Boolean type
+#define QT3DS_FALSE 0
+#define QT3DS_TRUE 1
+typedef NvU8 NvBool;
+
+// Result of sizeof operator
+typedef unsigned long NvSize;
+
+// Type large enough to hold a relative file offset
+typedef long NvOffset;
+
+// Base NULL type.
+#define QT3DS_NULL 0
+
+// Error related
+typedef enum {
+ NvError_Success = 0,
+ NvError_NotSupported,
+ NvError_NotInitialized,
+ NvError_BadParameter,
+ NvError_InsufficientMemory,
+ NvError_NoEntries,
+ NvError_UnknownError,
+} NvError;
+
+#if 1 // defined(_DEBUG) // !!!!TBD TODO
+#define NvAssert(c)
+#else
+#define NvAssert(c) ((void)((c) ? 0 : (NvHandleAssertion(#c, __FILE__, __LINE__), 0)))
+#endif
+
+// Other standardized typedefs
+typedef NvU64 NvUST; // U64 unadjusted system time value
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.abc b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.abc
new file mode 100644
index 00000000..f7e3c2f6
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.dds b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.dds
new file mode 100644
index 00000000..5bde760b
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_256.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.abc b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.abc
new file mode 100644
index 00000000..2ff78757
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.dds b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.dds
new file mode 100644
index 00000000..f9e76d94
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/courier+lucida_512.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/macos/assets/font.frag b/src/Runtime/Source/platformspecific/macos/assets/font.frag
new file mode 100644
index 00000000..e4673cf8
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/font.frag
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+uniform sampler2D fontTex;
+
+varying lowp vec4 col_var;
+varying lowp vec2 tex_var;
+
+void main()
+{
+ gl_FragColor = texture2D(fontTex, tex_var).a * col_var;
+}
+
diff --git a/src/Runtime/Source/platformspecific/macos/assets/font.vert b/src/Runtime/Source/platformspecific/macos/assets/font.vert
new file mode 100644
index 00000000..9f307a2f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/assets/font.vert
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// this is set from higher level. think of it as the upper model matrix
+uniform mat4 pixelToClipMat;
+
+uniform vec4 col_uni;
+
+attribute vec2 pos_attr;
+attribute vec2 tex_attr;
+attribute vec4 col_attr;
+
+varying vec4 col_var;
+varying vec2 tex_var;
+
+void main()
+{
+ // account for translation and rotation of the primitive into [-1,1] spatial default.
+ gl_Position = pixelToClipMat * vec4(pos_attr.x, pos_attr.y, 0, 1);
+
+ col_var = col_attr * col_uni;
+ tex_var = tex_attr;
+}
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_color.h b/src/Runtime/Source/platformspecific/macos/libs/nv_color.h
new file mode 100644
index 00000000..b9347529
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_color.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_COLOR_H
+#define _QT3DS_COLOR_H
+
+/** @file nv_color.h
+ Simple abstraction for RGBA colors as parameters to various libraries/functions.
+*/
+
+/** Base type for a single color channel (8-bit unsigned). */
+typedef unsigned char NvPCColor8;
+
+//#define NV_COLOR_BREAKOLD
+#ifdef NV_COLOR_BREAKOLD // uses a struct to break backwards-compat and accidental uses
+
+typedef struct
+{
+ NvPCColor8 r;
+ NvPCColor8 g;
+ NvPCColor8 b;
+ NvPCColor8 a;
+} NvPackedColor;
+
+static const NvPackedColor gnvpcwhite = { 255, 255, 255, 255 };
+static const NvPackedColor gnvpcblack = { 0, 0, 0, 255 };
+
+#define NV_PACKED_COLOR(r, g, b, a) \
+ { \
+ (NvPCColor8)(r), (NvPCColor8)(g), (NvPCColor8)(b), (NvPCColor8)(a) \
+ }
+
+#define NV_PC_PREDEF_WHITE gnvpcwhite
+#define NV_PC_PREDEF_BLACK gnvpcblack
+
+#define NV_PC_RED(c) (c.r)
+#define NV_PC_GREEN(c) (c.g)
+#define NV_PC_BLUE(c) (c.b)
+#define NV_PC_ALPHA(c) (c.a)
+
+#define NV_PC_PACK_UINT(c) (*(unsigned int *)(&(c)))
+
+#define NV_PC_EQUAL(x, y) ((x).r == (y).r && (x).g == (y).g && (x).b == (y).b && (x).a == (y).a)
+
+#else /* code that doesn't break old pass-as-uint stuff */
+
+/** Main type declaration for a packed 4-color construct. */
+typedef unsigned int NvPackedColor;
+
+/** A macro to build a packed color, passing in RGBA as four 8-bit integer values. */
+#define NV_PACKED_COLOR(r, g, b, a) \
+ ((NvPackedColor)(((((int)(a)) & 0xFF) << 24) | ((((int)(b)) & 0xFF) << 16) \
+ | ((((int)(g)) & 0xFF) << 8) | ((((int)(r)) & 0xFF))))
+
+/** A predefined constant for WHITE. */
+#define NV_PC_PREDEF_WHITE NV_PACKED_COLOR(0xFF, 0xFF, 0xFF, 0xFF)
+/** A predefined constant for BLACK. */
+#define NV_PC_PREDEF_BLACK NV_PACKED_COLOR(0x00, 0x00, 0x00, 0xFF)
+
+/** A macro for 'extracting' the red value from an NvPackedColor. */
+#define NV_PC_RED(c) ((c >> 0) & 0xff)
+/** A macro for 'extracting' the green value from an NvPackedColor. */
+#define NV_PC_GREEN(c) ((c >> 8) & 0xff)
+/** A macro for 'extracting' the blue value from an NvPackedColor. */
+#define NV_PC_BLUE(c) ((c >> 16) & 0xff)
+/** A macro for 'extracting' the alpha value from an NvPackedColor. */
+#define NV_PC_ALPHA(c) ((c >> 24) & 0xff)
+
+/** A macro requesting the packed color repacked into a 32-bit unsigned int.
+ This is a no-op for the color-as-uint approach.
+*/
+#define NV_PC_PACK_UINT(c) (c)
+/** A macro for testing the equality of two NvPackedColors. */
+#define NV_PC_EQUAL(x, y) (x == y)
+#endif
+
+/** A macro for mapping a single packed color channel into its floating point [0,1] rep. */
+#define NV_PC_TO_FLOAT(c) (c / 255.0f)
+
+#endif /*_QT3DS_COLOR_H*/
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_debug.h b/src/Runtime/Source/platformspecific/macos/libs/nv_debug.h
new file mode 100644
index 00000000..2559dd6f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_debug.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_DEBUG_H
+#define __INCLUDED_QT3DS_DEBUG_H
+
+#define CT_ASSERT(tag, cond) enum { COMPILE_TIME_ASSERT__##tag = 1 / (cond) }
+
+#define dimof(x) (sizeof(x) / sizeof(x[0]))
+#include <android/log.h>
+
+#define DBG_DETAILED 0
+
+#if 0
+
+ // the detailed prefix can be customised by setting DBG_DETAILED_PREFIX. See
+ // below as a reference.
+ // NOTE: fmt is the desired format string and must be in the prefix.
+ //#ifndef DBG_DETAILED_PREFIX
+ // #define DBG_DETAILED_PREFIX "%s, %s, line %d: " fmt, __FILE__, __FUNCTION__, __LINE__,
+ //#endif
+ //#define DEBUG_D_(fmt, args...)
+ //#define DEBUG_D(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, (DBG_DETAILED_PREFIX) ## args)
+
+#else
+
+#ifdef STRINGIFY
+#pragma push_macro("STRINGIFY")
+#undef STRINGIFY
+#define STRINGIFYPUSHED_____
+#endif
+#define STRINGIFY(x) #x
+
+// debug macro, includes file name function name and line number
+#define TO(x) typeof(x)
+#define DEBUG_D_(file, line, fmt, args...) \
+ __android_log_print(ANDROID_LOG_DEBUG, MODULE, file ", %s, line(" STRINGIFY(line) "): " fmt, \
+ __FUNCTION__, ##args)
+#define DEBUG_D(fmt, args...) DEBUG_D_(__FILE__, __LINE__, fmt, ##args)
+
+#ifdef STRINGIFYPUSHED_____
+#undef STRINGIFYPUSHED_____
+#pragma pop_macro("STRINGIFY")
+#endif
+
+#endif
+
+// basic debug macro
+#define DEBUG_(fmt, args...) (__android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args))
+
+// Debug macro that can be switched to spew a file name,
+// function and line number using DEBUG_DETAILED
+#if DBG_DETAILED == 1
+#define DEBUG(fmt, args...) DEBUG_D(fmt, ##args)
+#else
+#define DEBUG(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args)
+#endif
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_global.h b/src/Runtime/Source/platformspecific/macos/libs/nv_global.h
new file mode 100644
index 00000000..9d23d45f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_global.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_GLOBAL_H
+#define __INCLUDED_QT3DS_GLOBAL_H
+
+#include "nv_types.h"
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/NvVec.h b/src/Runtime/Source/platformspecific/macos/libs/nv_math/NvVec.h
new file mode 100644
index 00000000..4e5b09ce
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/NvVec.h
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_VEC_H
+#define INCLUDED_QT3DS_MATH_CPP_VEC_H
+
+#include "misc.h"
+
+struct _NvVec3
+{
+ union {
+ struct
+ {
+ float x, y, z;
+ };
+ float v[3];
+ };
+};
+
+struct NvVec3 : public _NvVec3
+{
+ NvVec3() { zero(); }
+
+ NvVec3(float x, float y, float z)
+ {
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+ }
+
+ NvVec3(NvVec3 const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ v[2] = that.v[2];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ v[2] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec3 &operator+=(NvVec3 const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ v[2] += that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator-=(NvVec3 const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ v[2] -= that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ v[2] *= s;
+ return *this;
+ }
+
+ NvVec3 &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ v[2] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec3 const &a, NvVec3 const &b)
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+inline NvVec3 operator+(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] + b.v[0], a.v[1] + b.v[1], a.v[2] + b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] - b.v[0], a.v[1] - b.v[1], a.v[2] - b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a)
+{
+
+ return NvVec3(-a.v[0], -a.v[1], -a.v[2]);
+}
+
+inline NvVec3 operator*(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] * s, a.v[1] * s, a.v[2] * s);
+}
+
+inline NvVec3 operator*(float s, NvVec3 const &a)
+{
+
+ return NvVec3(s * a.v[0], s * a.v[1], s * a.v[2]);
+}
+
+inline NvVec3 operator/(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] / s, a.v[1] / s, a.v[2] / s);
+}
+
+inline float magnitude(NvVec3 const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec3 normalize(NvVec3 const &v)
+{
+ float l = magnitude(v);
+ return NvVec3(v[0] / l, v[1] / l, v[2] / l);
+}
+
+inline NvVec3 cross(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[1] * b.v[2] - a.v[2] * b.v[1], a.v[2] * b.v[0] - a.v[0] * b.v[2],
+ a.v[0] * b.v[1] - a.v[1] * b.v[0]);
+}
+
+inline bool operator==(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] == b.v[0] && a.v[1] == b.v[1] && a.v[2] == b.v[2]);
+}
+
+inline bool operator!=(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] != b.v[0] || a.v[1] != b.v[1] || a.v[2] != b.v[2]);
+}
+
+struct NvVec2f
+{
+ union {
+ struct
+ {
+ float x, y;
+ float v[2];
+ };
+ };
+
+ NvVec2f() { zero(); }
+
+ NvVec2f(float x, float y)
+ {
+ v[0] = x;
+ v[1] = y;
+ }
+
+ NvVec2f(NvVec2f const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec2f &operator+=(NvVec2f const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator-=(NvVec2f const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ return *this;
+ }
+
+ NvVec2f &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+inline NvVec2f operator+(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] + b.v[0], a.v[1] + b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] - b.v[0], a.v[1] - b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a)
+{
+
+ return NvVec2f(-a.v[0], -a.v[1]);
+}
+
+inline NvVec2f operator*(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] * s, a.v[1] * s);
+}
+
+inline NvVec2f operator*(float s, NvVec2f const &a)
+{
+
+ return NvVec2f(s * a.v[0], s * a.v[1]);
+}
+
+inline NvVec2f operator/(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] / s, a.v[1] / s);
+}
+
+inline float magnitude(NvVec2f const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec2f normalize(NvVec2f const &v)
+{
+ float l = dot(v, v);
+ return NvVec2f(v[0] / l, v[1] / l);
+}
+
+inline float cross(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a.v[0] * b.v[1] - b.v[0] * a.v[1];
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/misc.h b/src/Runtime/Source/platformspecific/macos/libs/nv_math/misc.h
new file mode 100644
index 00000000..983410f3
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/misc.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_MISC_H
+#define INCLUDED_QT3DS_MATH_CPP_MISC_H
+
+inline bool nvIsPowerOfTwo(unsigned int i)
+{
+ return (i & (i - 1)) == 0;
+}
+
+inline float nvDegToRadf(float d)
+{
+ return d * 3.14159265358979323846f / 180.0f;
+}
+
+inline float nvRadToDegf(float r)
+{
+ return r * 180.0f / 3.14159265358979323846f;
+}
+
+/*
+ 'mod' differs from '%' in that it behaves correctly when either the
+ numerator or denominator is negative.
+*/
+
+inline int nvMod(int n, int d)
+{
+ int m = n % d;
+ return (((m < 0) && (d > 0)) || ((m > 0) && (d < 0))) ? (m + d) : m;
+}
+
+inline int nvAbs(int n)
+{
+ if (n < 0)
+ return -n;
+ return n;
+}
+
+inline int nvSign(int n)
+{
+ if (n > 0)
+ return 1;
+ if (n < 0)
+ return -1;
+ return 0;
+}
+
+/*
+ This returns the smallest amplitude value x such that
+ nvMod(b + x, m) == a
+*/
+
+inline int nvDifMod(int a, int b, int m)
+{
+
+ int x1 = a - b;
+ int x2 = (x1 > 0) ? x1 - m : x1 + m;
+ return (nvAbs(x1) < nvAbs(x2)) ? x1 : x2;
+}
+
+inline float nvWrapf(float a, float min, float max)
+{
+
+ assert(max > min);
+
+ float d = max - min;
+ float s = a - min;
+ float q = s / d;
+ float m = q - floorf(q);
+ return m * d + min;
+}
+
+inline float nvClampf(float a, float min, float max)
+{
+ return (a < min) ? min : ((a > max) ? max : a);
+}
+
+inline int nvClampi(int i, int min, int max)
+{
+ return (i < min) ? min : ((i > max) ? max : i);
+}
+
+inline float nvGaussian(float x, float s)
+{
+ float c = s * sqrtf(2.0f * 3.14159265358979323846f);
+ return expf(-(x * x) / (2.0f * s * s)) / c;
+}
+
+inline float nvLerpf(float a, float b, float t)
+{
+ return a * (1.0f - t) + b * t;
+}
+
+inline float nvEasef(float t)
+{
+
+ float t_2 = t * t;
+ float t_3 = t_2 * t;
+ return 3.0f * t_2 - 2.0f * t_3;
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.cpp b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.cpp
new file mode 100644
index 00000000..b83cb39e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_math.h"
+
+static const double a = 16807.0;
+static const double m = 2147483647.0;
+
+static double nextSeed(double seed)
+{
+ double t = a * seed;
+ return t - m * (double)((int)(t / m));
+}
+
+GLfloat NvRandf()
+{
+ static double seed = 1.0;
+ seed = nextSeed(seed);
+ return (GLfloat)(seed * (1 / m));
+}
+
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime)
+{
+ // kdGetTimeUST is never supposed to decrease (i.e. that
+ // means it can't wrap, either. IIRC, it will wrap in
+ // 593 years). So we ignore that option...
+
+ // Used for frame-to-frame diffs, this will fit in 32b
+ // as long as the times are < ~4.3s apart
+ long long int diffTime = newTime - oldTime;
+
+ // Need to find a better way to do this.
+ // However, I believe we will be uSec precise (not run
+ // out of mantissa bits for uSecs) as long as the diff
+ // is < ~16s (1e-6 * (2^24))
+ return ((GLfloat)diffTime) / 1.0e9f;
+}
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.h b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.h
new file mode 100644
index 00000000..e777e409
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_math.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_MATH_H
+#define _QT3DS_MATH_H
+
+#include <OpenGL/gl.h>
+
+GLfloat NvRandf();
+
+/* These are the recommended "safer" ways to use GLfloat for time */
+
+/* Returns the seconds between the two given times */
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime);
+
+#define QT3DS_MILISECS_TO_UST(ms) ((long long int)(ms)*1000000)
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.cpp b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.cpp
new file mode 100644
index 00000000..e208ac31
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.cpp
@@ -0,0 +1,1030 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_matrix.h"
+
+int NvDifferentMatsf(GLfloat a[4][4], const GLfloat b[4][4])
+{
+ return ((&a[3][3] < &b[0][0]) || (&b[3][3] < &a[0][0]));
+}
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+}
+
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+}
+
+GLfloat NvVecLengthf(const GLfloat v[3])
+{
+ return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3])
+{
+ GLfloat const l = NvVecLengthf(v);
+ r[0] = v[0] / l;
+ r[1] = v[1] / l;
+ r[2] = v[2] / l;
+}
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] + b[0];
+ r[1] = a[1] + b[1];
+ r[2] = a[2] + b[2];
+}
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ GLfloat t[3];
+
+ t[0] = a[1] * b[2] - a[2] * b[1];
+ t[1] = a[2] * b[0] - a[0] * b[2];
+ t[2] = a[0] * b[1] - a[1] * b[0];
+
+ r[0] = t[0];
+ r[1] = t[1];
+ r[2] = t[2];
+}
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ GLfloat inv_w = 1.0f / (m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3]);
+
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * inv_w;
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * inv_w;
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * inv_w;
+}
+
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * a[3];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * a[3];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * a[3];
+ r[3] = m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3] * a[3];
+}
+
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2];
+}
+
+static void NvMultMat3x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2];
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x4f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2] + a[3][0] * b[0][3];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2] + a[3][1] * b[0][3];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2] + a[3][2] * b[0][3];
+ r[0][3] = a[0][3] * b[0][0] + a[1][3] * b[0][1] + a[2][3] * b[0][2] + a[3][3] * b[0][3];
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2] + a[3][0] * b[1][3];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2] + a[3][1] * b[1][3];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2] + a[3][2] * b[1][3];
+ r[1][3] = a[0][3] * b[1][0] + a[1][3] * b[1][1] + a[2][3] * b[1][2] + a[3][3] * b[1][3];
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2] + a[3][0] * b[2][3];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2] + a[3][1] * b[2][3];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2] + a[3][2] * b[2][3];
+ r[2][3] = a[0][3] * b[2][0] + a[1][3] * b[2][1] + a[2][3] * b[2][2] + a[3][3] * b[2][3];
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0] * b[3][3];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1] * b[3][3];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2] * b[3][3];
+ r[3][3] = a[0][3] * b[3][0] + a[1][3] * b[3][1] + a[2][3] * b[3][2] + a[3][3] * b[3][3];
+}
+
+void NvMultMatf(GLfloat result[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((a[0][3] == 0.0f) && (a[1][3] == 0.0f) && (a[2][3] == 0.0f) && (a[2][3] == 1.0f)
+ && (b[0][3] == 0.0f) && (b[1][3] == 0.0f) && (b[2][3] == 0.0f) && (b[2][3] == 1.0f)) {
+ if ((a[3][0] == 0.0f) && (a[3][1] == 0.0f) && (a[3][2] == 0.0f) && (b[3][0] == 0.0f)
+ && (b[3][1] == 0.0f) && (b[3][2] == 0.0f)) {
+ NvMultMat3x3f(r, a, b);
+ } else {
+ NvMultMat4x3f(r, a, b);
+ }
+ } else {
+ NvMultMat4x4f(r, a, b);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+static void NvInvMat3x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ /* x */
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ /* y */
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ /* z */
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x4f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] * m[3][3] + m[0][0] * m[1][2] * m[2][3] * m[3][1]
+ + m[0][0] * m[1][3] * m[2][1] * m[3][2] + m[0][1] * m[1][0] * m[2][3] * m[3][2]
+ + m[0][1] * m[1][2] * m[2][0] * m[3][3] + m[0][1] * m[1][3] * m[2][2] * m[3][0]
+ + m[0][2] * m[1][0] * m[2][1] * m[3][3] + m[0][2] * m[1][1] * m[2][3] * m[3][0]
+ + m[0][2] * m[1][3] * m[2][0] * m[3][1] + m[0][3] * m[1][0] * m[2][2] * m[3][1]
+ + m[0][3] * m[1][1] * m[2][0] * m[3][2] + m[0][3] * m[1][2] * m[2][1] * m[3][0]
+ + -m[0][0] * m[1][1] * m[2][3] * m[3][2] + -m[0][0] * m[1][2] * m[2][1] * m[3][3]
+ + -m[0][0] * m[1][3] * m[2][2] * m[3][1] + -m[0][1] * m[1][0] * m[2][2] * m[3][3]
+ + -m[0][1] * m[1][2] * m[2][3] * m[3][0] + -m[0][1] * m[1][3] * m[2][0] * m[3][2]
+ + -m[0][2] * m[1][0] * m[2][3] * m[3][1] + -m[0][2] * m[1][1] * m[2][0] * m[3][3]
+ + -m[0][2] * m[1][3] * m[2][1] * m[3][0] + -m[0][3] * m[1][0] * m[2][1] * m[3][2]
+ + -m[0][3] * m[1][1] * m[2][2] * m[3][0] + -m[0][3] * m[1][2] * m[2][0] * m[3][1];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] * m[3][3] + m[1][2] * m[2][3] * m[3][1]
+ + m[1][3] * m[2][1] * m[3][2] + -m[1][1] * m[2][3] * m[3][2]
+ + -m[1][2] * m[2][1] * m[3][3] + -m[1][3] * m[2][2] * m[3][1])
+ / d;
+
+ r[0][1] = (m[0][1] * m[2][3] * m[3][2] + m[0][2] * m[2][1] * m[3][3]
+ + m[0][3] * m[2][2] * m[3][1] + -m[0][1] * m[2][2] * m[3][3]
+ + -m[0][2] * m[2][3] * m[3][1] + -m[0][3] * m[2][1] * m[3][2])
+ / d;
+
+ r[0][2] = (m[0][1] * m[1][2] * m[3][3] + m[0][2] * m[1][3] * m[3][1]
+ + m[0][3] * m[1][1] * m[3][2] + -m[0][1] * m[1][3] * m[3][2]
+ + -m[0][2] * m[1][1] * m[3][3] + -m[0][3] * m[1][2] * m[3][1])
+ / d;
+
+ r[0][3] = (m[0][1] * m[1][3] * m[2][2] + m[0][2] * m[1][1] * m[2][3]
+ + m[0][3] * m[1][2] * m[2][1] + -m[0][1] * m[1][2] * m[2][3]
+ + -m[0][2] * m[1][3] * m[2][1] + -m[0][3] * m[1][1] * m[2][2])
+ / d;
+
+ r[1][0] = (m[1][0] * m[2][3] * m[3][2] + m[1][2] * m[2][0] * m[3][3]
+ + m[1][3] * m[2][2] * m[3][0] + -m[1][0] * m[2][2] * m[3][3]
+ + -m[1][2] * m[2][3] * m[3][0] + -m[1][3] * m[2][0] * m[3][2])
+ / d;
+
+ r[1][1] = (m[0][0] * m[2][2] * m[3][3] + m[0][2] * m[2][3] * m[3][0]
+ + m[0][3] * m[2][0] * m[3][2] + -m[0][0] * m[2][3] * m[3][2]
+ + -m[0][2] * m[2][0] * m[3][3] + -m[0][3] * m[2][2] * m[3][0])
+ / d;
+
+ r[1][2] = (m[0][0] * m[1][3] * m[3][2] + m[0][2] * m[1][0] * m[3][3]
+ + m[0][3] * m[1][2] * m[3][0] + -m[0][0] * m[1][2] * m[3][3]
+ + -m[0][2] * m[1][3] * m[3][0] + -m[0][3] * m[1][0] * m[3][2])
+ / d;
+
+ r[1][3] = (m[0][0] * m[1][2] * m[2][3] + m[0][2] * m[1][3] * m[2][0]
+ + m[0][3] * m[1][0] * m[2][2] + -m[0][0] * m[1][3] * m[2][2]
+ + -m[0][2] * m[1][0] * m[2][3] + -m[0][3] * m[1][2] * m[2][0])
+ / d;
+
+ r[2][0] = (m[1][0] * m[2][1] * m[3][3] + m[1][1] * m[2][3] * m[3][0]
+ + m[1][3] * m[2][0] * m[3][1] + -m[1][0] * m[2][3] * m[3][1]
+ + -m[1][1] * m[2][0] * m[3][3] + -m[1][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][1] =
+ (-m[0][0] * m[2][1] * m[3][3] + -m[0][1] * m[2][3] * m[3][0] + -m[0][3] * m[2][0] * m[3][1]
+ + m[0][0] * m[2][3] * m[3][1] + m[0][1] * m[2][0] * m[3][3] + m[0][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][2] = (m[0][0] * m[1][1] * m[3][3] + m[0][1] * m[1][3] * m[3][0]
+ + m[0][3] * m[1][0] * m[3][1] + -m[0][0] * m[1][3] * m[3][1]
+ + -m[0][1] * m[1][0] * m[3][3] + -m[0][3] * m[1][1] * m[3][0])
+ / d;
+
+ r[2][3] = (m[0][0] * m[1][3] * m[2][1] + m[0][1] * m[1][0] * m[2][3]
+ + m[0][3] * m[1][1] * m[2][0] + -m[0][1] * m[1][3] * m[2][0]
+ + -m[0][3] * m[1][0] * m[2][1] + -m[0][0] * m[1][1] * m[2][3])
+ / d;
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = (m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1]
+ + -m[0][1] * m[1][0] * m[2][2] + -m[0][2] * m[1][1] * m[2][0])
+ / d;
+}
+
+void NvInvMatf(GLfloat result[4][4], const GLfloat m[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((m[0][3] == 0.0f) && (m[1][3] == 0.0f) && (m[2][3] == 0.0f) && (m[2][3] == 1.0f)) {
+ if ((m[3][0] == 0.0f) && (m[3][1] == 0.0f) && (m[3][2] == 0.0f)) {
+ NvInvMat3x3f(r, m);
+ } else {
+ NvInvMat4x3f(r, m);
+ }
+ } else {
+ NvInvMat4x4f(r, m);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildIdentityMatf(GLfloat r[4][4])
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = x;
+ r[3][1] = y;
+ r[3][2] = z;
+ r[3][3] = 1.0f;
+}
+
+void NvMultTranslateMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLfloat r[4][4]; /*temporary storage for result */
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[0][0] * x + m[1][0] * y + m[2][0] * z + m[3][0];
+ r[3][1] = m[0][1] * x + m[1][1] * y + m[2][1] * z + m[3][1];
+ r[3][2] = m[0][2] * x + m[1][2] * y + m[2][2] * z + m[3][2];
+ r[3][3] = m[0][3] * x + m[1][3] * y + m[2][3] * z + m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = x;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = y;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = z;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultScaleMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * x;
+ r[0][1] = m[0][1] * x;
+ r[0][2] = m[0][2] * x;
+ r[0][3] = m[0][3] * x;
+
+ r[1][0] = m[1][0] * y;
+ r[1][1] = m[1][1] * y;
+ r[1][2] = m[1][2] * y;
+ r[1][3] = m[1][3] * y;
+
+ r[2][0] = m[2][0] * z;
+ r[2][1] = m[2][1] * z;
+ r[2][2] = m[2][2] * z;
+ r[2][3] = m[2][3] * z;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = c;
+ r[1][2] = s;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = -s;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = 0.0f;
+ r[0][2] = -s;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = s;
+ r[2][1] = 0.0f;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = s;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = -s;
+ r[1][1] = c;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultRotXRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0] * c + m[2][0] * s;
+ r[1][1] = m[1][1] * c + m[2][1] * s;
+ r[1][2] = m[1][2] * c + m[2][2] * s;
+ r[1][3] = m[1][3] * c + m[2][3] * s;
+
+ r[2][0] = m[1][0] * -s + m[2][0] * c;
+ r[2][1] = m[1][1] * -s + m[2][1] * c;
+ r[2][2] = m[1][2] * -s + m[2][2] * c;
+ r[2][3] = m[1][3] * -s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotYRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[2][0] * -s;
+ r[0][1] = m[0][1] * c + m[2][1] * -s;
+ r[0][2] = m[0][2] * c + m[2][2] * -s;
+ r[0][3] = m[0][3] * c + m[2][3] * -s;
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[0][0] * s + m[2][0] * c;
+ r[2][1] = m[0][1] * s + m[2][1] * c;
+ r[2][2] = m[0][2] * s + m[2][2] * c;
+ r[2][3] = m[0][3] * s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotZRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[1][0] * s;
+ r[0][1] = m[0][1] * c + m[1][1] * s;
+ r[0][2] = m[0][2] * c + m[1][2] * s;
+ r[0][3] = m[0][3] * c + m[1][3] * s;
+
+ r[1][0] = m[0][0] * -s + m[1][0] * c;
+ r[1][1] = m[0][1] * -s + m[1][1] * c;
+ r[1][2] = m[0][2] * -s + m[1][2] * c;
+ r[1][3] = m[0][3] * -s + m[1][3] * c;
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotRadMatf(GLfloat result[4][4], const GLfloat axis[3], GLfloat radians)
+{
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ /* build a matrix from the quat */
+
+ result[0][0] = 1.0f - 2.0f * (j * j + k * k);
+ result[0][1] = 2.0f * (i * j + r * k);
+ result[0][2] = 2.0f * (i * k - r * j);
+ result[0][3] = 0.0f;
+
+ result[1][0] = 2.0f * (i * j - r * k);
+ result[1][1] = 1.0f - 2.0f * (i * i + k * k);
+ result[1][2] = 2.0f * (j * k + r * i);
+ result[1][3] = 0.0f;
+
+ result[2][0] = 2.0f * (i * k + r * j);
+ result[2][1] = 2.0f * (j * k - r * i);
+ result[2][2] = 1.0f - 2.0f * (i * i + j * j);
+ result[2][3] = 0.0f;
+
+ result[3][0] = 0.0f;
+ result[3][1] = 0.0f;
+ result[3][2] = 0.0f;
+ result[3][3] = 1.0f;
+}
+
+void NvMultRotRadMatf(GLfloat result[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians)
+{
+ GLfloat r[4][4];
+
+ {
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat const dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ {
+ /* build a matrix from the quat */
+
+ GLfloat const a00 = 1.0f - 2.0f * (j * j + k * k);
+ GLfloat const a01 = 2.0f * (i * j + r * k);
+ GLfloat const a02 = 2.0f * (i * k - r * j);
+
+ GLfloat const a10 = 2.0f * (i * j - r * k);
+ GLfloat const a11 = 1.0f - 2.0f * (i * i + k * k);
+ GLfloat const a12 = 2.0f * (j * k + r * i);
+
+ GLfloat const a20 = 2.0f * (i * k + r * j);
+ GLfloat const a21 = 2.0f * (j * k - r * i);
+ GLfloat const a22 = 1.0f - 2.0f * (i * i + j * j);
+
+ result[0][0] = m[0][0] * a00 + m[1][0] * a01 + m[2][0] * a02;
+ result[0][1] = m[0][1] * a00 + m[1][1] * a01 + m[2][1] * a02;
+ result[0][2] = m[0][2] * a00 + m[1][2] * a01 + m[2][2] * a02;
+ result[0][3] = m[0][3] * a00 + m[1][3] * a01 + m[2][3] * a02;
+
+ result[1][0] = m[0][0] * a10 + m[1][0] * a11 + m[2][0] * a12;
+ result[1][1] = m[0][1] * a10 + m[1][1] * a11 + m[2][1] * a12;
+ result[1][2] = m[0][2] * a10 + m[1][2] * a11 + m[2][2] * a12;
+ result[1][3] = m[0][3] * a10 + m[1][3] * a11 + m[2][3] * a12;
+
+ result[2][0] = m[0][0] * a20 + m[1][0] * a21 + m[2][0] * a22;
+ result[2][1] = m[0][1] * a20 + m[1][1] * a21 + m[2][1] * a22;
+ result[2][2] = m[0][2] * a20 + m[1][2] * a21 + m[2][2] * a22;
+ result[2][3] = m[0][3] * a20 + m[1][3] * a21 + m[2][3] * a22;
+
+ result[3][0] = m[3][0];
+ result[3][1] = m[3][1];
+ result[3][2] = m[3][2];
+ result[3][3] = m[3][3];
+ }
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotXRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotYRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotZRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotXRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotYRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotZRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees)
+{
+ NvBuildRotRadMatf(r, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees)
+{
+ NvMultRotRadMatf(r, m, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3])
+{
+ GLfloat ev[3];
+ GLfloat z[3];
+ GLfloat x_tmp[3];
+ GLfloat x[3];
+ GLfloat y[3];
+
+ NvSubVecf(ev, eye, obj);
+
+ NvNormalizeVecf(z, ev);
+
+ NvCrossProductf(x_tmp, up, z);
+
+ NvNormalizeVecf(x, x_tmp);
+
+ NvCrossProductf(y, z, x);
+
+ r[0][0] = x[0];
+ r[0][1] = y[0];
+ r[0][2] = z[0];
+ r[0][3] = 0.0f;
+
+ r[1][0] = x[1];
+ r[1][1] = y[1];
+ r[1][2] = z[1];
+ r[1][3] = 0.0f;
+
+ r[2][0] = x[2];
+ r[2][1] = y[2];
+ r[2][2] = z[2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = -x[0] * eye[0] + -x[1] * eye[1] + -x[2] * eye[2];
+ r[3][1] = -y[0] * eye[0] + -y[1] * eye[1] + -y[2] * eye[2];
+ r[3][2] = -z[0] * eye[0] + -z[1] * eye[1] + -z[2] * eye[2];
+ r[3][3] = 1.0f;
+}
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const m00 = znear * 2.0f / (right - left);
+ GLfloat const m11 = znear * 2.0f / (top - bottom);
+ GLfloat const m22 = -(zfar + znear) / (zfar - znear);
+
+ GLfloat const m20 = (right + left) / (right - left);
+ GLfloat const m21 = (top + bottom) / (top - bottom);
+
+ GLfloat const m32 = -(2.0f * zfar * znear) / (zfar - znear);
+ GLfloat const m23 = -1.0f;
+
+ r[0][0] = m00;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = m11;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = m20;
+ r[2][1] = m21;
+ r[2][2] = m22;
+ r[2][3] = m23;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = m32;
+ r[3][3] = 0.0f;
+}
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+ GLfloat const sz = -2.0f / (zfar - znear);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+ GLfloat const tz = -(zfar + znear) / (zfar - znear);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = sz;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = tz;
+ r[3][3] = 1.0f;
+}
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.h b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.h
new file mode 100644
index 00000000..0709f117
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_matrix.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_MATRIX_H
+#define INCLUDED_MATRIX_H
+
+#include <OpenGL/gl.h>
+#include <math.h>
+#include <assert.h>
+
+#define KD_FLT_EPSILON 1.19209290E-07F
+#define KD_DEG_TO_RAD_F 0.0174532924F
+#define KD_RAD_TO_DEG_F 57.2957802F
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4]);
+
+/* vector utilities */
+
+GLfloat NvVecLengthf(const GLfloat v[3]);
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3]);
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4]);
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+
+/* matrix utilities */
+
+void NvMultMatf(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4]);
+
+void NvInvMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+
+/* matrix building utilities */
+
+void NvBuildIdentityMatf(GLfloat r[4][4]);
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees);
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees);
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians);
+
+void NvBuildRotRadMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat radians);
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3]);
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+/* matrix concatenation utilities */
+
+void NvMultTranslateMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+void NvMultScaleMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees);
+
+void NvMultRotXRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotYRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotZRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+
+void NvMultRotRadMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.cpp b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.cpp
new file mode 100644
index 00000000..ec497941
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_quat.h"
+#include <stdlib.h>
+#include <memory.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4])
+{
+ memcpy(r, q, 4 * sizeof(GLfloat));
+}
+
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4])
+{
+ // Assumes that the quaternion is normalized!
+ GLfloat x2 = q[0] * 2.0f;
+ GLfloat y2 = q[1] * 2.0f;
+ GLfloat z2 = q[2] * 2.0f;
+ GLfloat xSq2 = x2 * q[0];
+ GLfloat ySq2 = y2 * q[1];
+ GLfloat zSq2 = z2 * q[2];
+ GLfloat xy2 = x2 * q[1];
+ GLfloat xz2 = x2 * q[2];
+ GLfloat xw2 = x2 * q[3];
+ GLfloat yz2 = y2 * q[2];
+ GLfloat yw2 = y2 * q[3];
+ GLfloat zw2 = z2 * q[3];
+
+ /* Matrix is
+ * | 1 - 2y^2 - 2z^2 2xy - 2zw 2xz + 2yw |
+ * | 2xy + 2zw 1 - 2x^2 - 2z^2 2yz - 2xw |
+ * | 2xz - 2yw 2yz + 2xw 1 - 2x^2 - 2y^2 |
+ */
+ r[0][0] = 1.0f - ySq2 - zSq2;
+ r[0][1] = xy2 - zw2;
+ r[0][2] = xz2 + yw2;
+
+ r[1][0] = xy2 + zw2;
+ r[1][1] = 1.0f - xSq2 - zSq2;
+ r[1][2] = yz2 - xw2;
+
+ r[2][0] = xz2 - yw2;
+ r[2][1] = yz2 + xw2;
+ r[2][2] = 1.0f - xSq2 - ySq2;
+}
+
+void NvQuatIdentity(GLfloat r[4])
+{
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = 1.0f;
+}
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3])
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = axis[0] * sina;
+ r[1] = axis[1] * sina;
+ r[2] = axis[2] * sina;
+ r[3] = cosa;
+}
+
+void NvQuatX(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = sina;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatY(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = sina;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatZ(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = sina;
+ r[3] = cosa;
+}
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatY(h, heading);
+ NvQuatX(p, pitch);
+ NvQuatZ(ro, roll);
+
+ NvQuatMult(r, h, p);
+ NvQuatMult(r, ro, r);
+}
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatZ(ro, roll);
+ NvQuatX(p, pitch);
+ NvQuatY(h, heading);
+
+ NvQuatMult(r, p, h);
+ NvQuatMult(r, r, ro);
+}
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4])
+{
+ return q1[0] * q2[0] + q1[1] * q2[1] + q1[2] * q2[2] + q1[3] * q2[3];
+}
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4])
+{
+ const GLfloat q1x = q1[0];
+ const GLfloat q1y = q1[1];
+ const GLfloat q1z = q1[2];
+ const GLfloat q1w = q1[3];
+ const GLfloat q2x = q2[0];
+ const GLfloat q2y = q2[1];
+ const GLfloat q2z = q2[2];
+ const GLfloat q2w = q2[3];
+
+ r[0] = q1y * q2z - q2y * q1z + q1w * q2x + q2w * q1x;
+ r[1] = q1z * q2x - q2z * q1x + q1w * q2y + q2w * q1y;
+ r[2] = q1x * q2y - q2x * q1y + q1w * q2z + q2w * q1z;
+ r[3] = q1w * q2w - q1x * q2x - q1y * q2y - q1z * q2z;
+}
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t)
+{
+ GLfloat omt = 1.0f - t;
+
+ if (NvQuatDot(q1, q2) < 0.0f) {
+ r[0] = -q1[0] * omt + q2[0] * t;
+ r[1] = -q1[1] * omt + q2[1] * t;
+ r[2] = -q1[2] * omt + q2[2] * t;
+ r[3] = -q1[3] * omt + q2[3] * t;
+ } else {
+ r[0] = q1[0] * omt + q2[0] * t;
+ r[1] = q1[1] * omt + q2[1] * t;
+ r[2] = q1[2] * omt + q2[2] * t;
+ r[3] = q1[3] * omt + q2[3] * t;
+ }
+
+ NvQuatNormalize(r, r);
+}
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4])
+{
+ GLfloat invLength = 1.0f / sqrtf(NvQuatDot(q, q));
+
+ r[0] = invLength * q[0];
+ r[1] = invLength * q[1];
+ r[2] = invLength * q[2];
+ r[3] = invLength * q[3];
+}
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.h b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.h
new file mode 100644
index 00000000..2afdcb71
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_math/nv_quat.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QUAT_H
+#define INCLUDED_QUAT_H
+
+#include <OpenGL/gl.h>
+#include <math.h>
+#include <assert.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4]);
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4]);
+
+void NvQuatIdentity(GLfloat r[4]);
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3]);
+
+void NvQuatX(GLfloat r[4], GLfloat radians);
+
+void NvQuatY(GLfloat r[4], GLfloat radians);
+
+void NvQuatZ(GLfloat r[4], GLfloat radians);
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t);
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4]);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/macos/libs/nv_types.h b/src/Runtime/Source/platformspecific/macos/libs/nv_types.h
new file mode 100644
index 00000000..1d1b0300
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/macos/libs/nv_types.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_TYPES_H
+#define __INCLUDED_QT3DS_TYPES_H
+
+typedef unsigned char NvU8; // 0 to 255
+typedef unsigned short NvU16; // 0 to 65535
+typedef unsigned int NvU32; // 0 to 4294967295
+typedef unsigned long long NvU64; // 0 to 18446744073709551615
+typedef signed char NvS8; // -128 to 127
+typedef signed short NvS16; // -32768 to 32767
+typedef signed int NvS32; // -2147483648 to 2147483647
+typedef signed long long NvS64; // 2^-63 to 2^63-1
+
+// Explicitly sized floats
+typedef float NvF32; // IEEE Single Precision (S1E8M23)
+typedef double NvF64; // IEEE Double Precision (S1E11M52)
+
+// Boolean type
+#define QT3DS_FALSE 0
+#define QT3DS_TRUE 1
+typedef NvU8 NvBool;
+
+// Result of sizeof operator
+typedef unsigned long NvSize;
+
+// Type large enough to hold a relative file offset
+typedef long NvOffset;
+
+// Base NULL type.
+#define QT3DS_NULL 0
+
+// Error related
+typedef enum {
+ NvError_Success = 0,
+ NvError_NotSupported,
+ NvError_NotInitialized,
+ NvError_BadParameter,
+ NvError_InsufficientMemory,
+ NvError_NoEntries,
+ NvError_UnknownError,
+} NvError;
+
+#if 1 // defined(_DEBUG) // !!!!TBD TODO
+#define NvAssert(c)
+#else
+#define NvAssert(c) ((void)((c) ? 0 : (NvHandleAssertion(#c, __FILE__, __LINE__), 0)))
+#endif
+
+// Other standardized typedefs
+typedef NvU64 NvUST; // U64 unadjusted system time value
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.abc b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.abc
new file mode 100644
index 00000000..f7e3c2f6
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.dds b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.dds
new file mode 100644
index 00000000..5bde760b
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_256.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.abc b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.abc
new file mode 100644
index 00000000..2ff78757
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.abc
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.dds b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.dds
new file mode 100644
index 00000000..f9e76d94
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/courier+lucida_512.dds
Binary files differ
diff --git a/src/Runtime/Source/platformspecific/windows/assets/font.frag b/src/Runtime/Source/platformspecific/windows/assets/font.frag
new file mode 100644
index 00000000..e4673cf8
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/font.frag
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+uniform sampler2D fontTex;
+
+varying lowp vec4 col_var;
+varying lowp vec2 tex_var;
+
+void main()
+{
+ gl_FragColor = texture2D(fontTex, tex_var).a * col_var;
+}
+
diff --git a/src/Runtime/Source/platformspecific/windows/assets/font.vert b/src/Runtime/Source/platformspecific/windows/assets/font.vert
new file mode 100644
index 00000000..9f307a2f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/assets/font.vert
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// this is set from higher level. think of it as the upper model matrix
+uniform mat4 pixelToClipMat;
+
+uniform vec4 col_uni;
+
+attribute vec2 pos_attr;
+attribute vec2 tex_attr;
+attribute vec4 col_attr;
+
+varying vec4 col_var;
+varying vec2 tex_var;
+
+void main()
+{
+ // account for translation and rotation of the primitive into [-1,1] spatial default.
+ gl_Position = pixelToClipMat * vec4(pos_attr.x, pos_attr.y, 0, 1);
+
+ col_var = col_attr * col_uni;
+ tex_var = tex_attr;
+}
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_color.h b/src/Runtime/Source/platformspecific/windows/libs/nv_color.h
new file mode 100644
index 00000000..b9347529
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_color.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_COLOR_H
+#define _QT3DS_COLOR_H
+
+/** @file nv_color.h
+ Simple abstraction for RGBA colors as parameters to various libraries/functions.
+*/
+
+/** Base type for a single color channel (8-bit unsigned). */
+typedef unsigned char NvPCColor8;
+
+//#define NV_COLOR_BREAKOLD
+#ifdef NV_COLOR_BREAKOLD // uses a struct to break backwards-compat and accidental uses
+
+typedef struct
+{
+ NvPCColor8 r;
+ NvPCColor8 g;
+ NvPCColor8 b;
+ NvPCColor8 a;
+} NvPackedColor;
+
+static const NvPackedColor gnvpcwhite = { 255, 255, 255, 255 };
+static const NvPackedColor gnvpcblack = { 0, 0, 0, 255 };
+
+#define NV_PACKED_COLOR(r, g, b, a) \
+ { \
+ (NvPCColor8)(r), (NvPCColor8)(g), (NvPCColor8)(b), (NvPCColor8)(a) \
+ }
+
+#define NV_PC_PREDEF_WHITE gnvpcwhite
+#define NV_PC_PREDEF_BLACK gnvpcblack
+
+#define NV_PC_RED(c) (c.r)
+#define NV_PC_GREEN(c) (c.g)
+#define NV_PC_BLUE(c) (c.b)
+#define NV_PC_ALPHA(c) (c.a)
+
+#define NV_PC_PACK_UINT(c) (*(unsigned int *)(&(c)))
+
+#define NV_PC_EQUAL(x, y) ((x).r == (y).r && (x).g == (y).g && (x).b == (y).b && (x).a == (y).a)
+
+#else /* code that doesn't break old pass-as-uint stuff */
+
+/** Main type declaration for a packed 4-color construct. */
+typedef unsigned int NvPackedColor;
+
+/** A macro to build a packed color, passing in RGBA as four 8-bit integer values. */
+#define NV_PACKED_COLOR(r, g, b, a) \
+ ((NvPackedColor)(((((int)(a)) & 0xFF) << 24) | ((((int)(b)) & 0xFF) << 16) \
+ | ((((int)(g)) & 0xFF) << 8) | ((((int)(r)) & 0xFF))))
+
+/** A predefined constant for WHITE. */
+#define NV_PC_PREDEF_WHITE NV_PACKED_COLOR(0xFF, 0xFF, 0xFF, 0xFF)
+/** A predefined constant for BLACK. */
+#define NV_PC_PREDEF_BLACK NV_PACKED_COLOR(0x00, 0x00, 0x00, 0xFF)
+
+/** A macro for 'extracting' the red value from an NvPackedColor. */
+#define NV_PC_RED(c) ((c >> 0) & 0xff)
+/** A macro for 'extracting' the green value from an NvPackedColor. */
+#define NV_PC_GREEN(c) ((c >> 8) & 0xff)
+/** A macro for 'extracting' the blue value from an NvPackedColor. */
+#define NV_PC_BLUE(c) ((c >> 16) & 0xff)
+/** A macro for 'extracting' the alpha value from an NvPackedColor. */
+#define NV_PC_ALPHA(c) ((c >> 24) & 0xff)
+
+/** A macro requesting the packed color repacked into a 32-bit unsigned int.
+ This is a no-op for the color-as-uint approach.
+*/
+#define NV_PC_PACK_UINT(c) (c)
+/** A macro for testing the equality of two NvPackedColors. */
+#define NV_PC_EQUAL(x, y) (x == y)
+#endif
+
+/** A macro for mapping a single packed color channel into its floating point [0,1] rep. */
+#define NV_PC_TO_FLOAT(c) (c / 255.0f)
+
+#endif /*_QT3DS_COLOR_H*/
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_config/nv_config.h b/src/Runtime/Source/platformspecific/windows/libs/nv_config/nv_config.h
new file mode 100644
index 00000000..fb0b88af
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_config/nv_config.h
@@ -0,0 +1,278 @@
+/****************************************************************************
+**
+** Copyright (C) 2007-2008 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef _QT3DS_CONFIG_H
+#define _QT3DS_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <KD/kd.h>
+
+/** \file nv_config.h
+ Support for block-based text config files.
+
+ Supports:
+ <ul>
+ <li> C-style comment blocks
+ <li> C++-style comment lines
+ <li> Line continuation via backslash
+ <li> Linux, Mac and Windows line endings
+ <li> Arrays of tokens, broken out by line
+ <li> Tokens are split by commas and whitespace
+ <li> Quoted string tokens containing any characters
+ </ul>
+ */
+
+/** The in-memory representation of a loaded config file.
+
+ This opaque data structure is passed by pointer to all of the
+ configuration functions and represents the loaded configuration
+ file. Once loaded, there is no mutable persistent state in this
+ object. It is passed as const to all functions
+*/
+typedef struct NvConfigData NvConfigData;
+
+/** The representation of a sub-range of lines in a config file.
+
+ This structure is application-readable and mutable, and is used to
+ represent a subset of the lines in a config file. Generally, these
+ ranges represent delineated blocks in the config file. Special versions
+ of many of the config file functions take data ranges instead of
+ entire config files
+
+ @see NvConfigFindDelimitedBlock()
+*/
+typedef struct NvConfigDataRange
+{
+ /** A reference to the "parent" config file for this range */
+ NvConfigData *data;
+ /** The first line of the range (inclusive) */
+ KDint startLine;
+ /** The last line of the range (inclusive) */
+ KDint endLine;
+} NvConfigDataRange;
+
+/** Creates a config data object that represents an existing config file
+
+ @return A pointer to the allocated config data, or NULL if the file cannot
+ be found or does not conform to the basic config file format
+ @param filename The path of the config file to be loaded
+ @see NvConfigFree()
+*/
+NvConfigData *NvConfigCreateFromFile(const KDchar *filename);
+
+/** Creates a config data object from an-in memory string
+
+ Useful when the config file is loaded from a larger, packed data file,
+ or generated on-the-fly in the application. Note that the code does not
+ automatically handle NULL-terminated strings
+
+ @return A pointer to the allocated config data, or NULL if the string
+ does not conform to the basic config file format
+ @param fileBuffer A pointer to the start of the string of config data
+ @param fileSize The length of the string in characters
+ @see NvConfigFree()
+*/
+NvConfigData *NvConfigCreateFromBuffer(const KDchar *fileBuffer, KDint fileSize);
+
+/** Deletes an existing config file data object
+
+ @param data A pointer to the data object to delete
+*/
+void NvConfigFree(NvConfigData *data);
+
+/** Returns the number of token-bearing lines in the config data object.
+
+ This does not count merged lines, comment lines, or whitespace. This
+ value is one greater than the maximum valid line index in the file
+
+ @return The line count
+ @param data A pointer to the data object
+*/
+KDint NvConfigGetLineCount(const NvConfigData *data);
+
+/** Returns the number of tokens in the indexed line
+
+ @return The token count
+ @param data A pointer to the data object
+ @param line The line whose count is to be returned. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @see NvConfigGetLineCount
+*/
+KDint NvConfigGetTokenCount(const NvConfigData *data, KDint line);
+
+/** Returns a NULL-terminated string token at the given line and token index
+
+ The parameters are unchecked.
+
+ @return A non-mutable token pointer for the referenced token
+ @param data A pointer to the data object
+ @param line The line whose token is to be returned. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @param token The token index of the token to be returned. This parameter must
+ be at least 0 and must be less than the token count of the line
+ @see NvConfigGetLineCount
+ @see NvConfigGetTokenCount
+*/
+const KDchar *NvConfigGetToken(const NvConfigData *data, KDint line, KDint token);
+
+/** Returns the string token converted to an integer
+
+ Returns the string token at the given line and token index converted to an integer.
+ The parameters are unchecked, and the string token is assumed to be convertible to
+ an integer value.
+
+ @return The integer value of the referenced token
+ @param data A pointer to the data object
+ @param line The line whose token is to be returned. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @param token The token index of the token to be returned. This parameter must
+ be at least 0 and must be less than the token count of the line
+ @see NvConfigGetLineCount
+ @see NvConfigGetTokenCount
+*/
+KDint NvConfigGetIntToken(const NvConfigData *data, KDint line, KDint token);
+
+/** Returns the string token converted to a floating-point value
+
+ Returns the string token at the given line and token index converted to a
+ floating-point number. The parameters are unchecked, and the string token
+ is assumed to be convertible to a real value.
+
+ @return The floating-point value of the referenced token
+ @param data A pointer to the data object
+ @param line The line whose token is to be returned. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @param token The token index of the token to be returned. This parameter must
+ be at least 0 and must be less than the token count of the line
+ @see NvConfigGetLineCount
+ @see NvConfigGetTokenCount
+*/
+KDfloat32 NvConfigGetFloatToken(const NvConfigData *data, KDint line, KDint token);
+
+/** Returns the count of lines in the config data whose leading token
+ matches a given string
+
+ The search starts at the indicated line and continues to the end of the file
+
+ @return The count of matching lines
+ @param data A pointer to the data object
+ @param name The string to be matched (case-sensitive)
+ @param startLine The line at which the search should start. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @see NvConfigGetLineCount
+*/
+KDint NvConfigCountMatchingLines(const NvConfigData *data, const KDchar *name, KDint startLine);
+
+/** Returns the count of lines in the subrange of the config data
+ whose leading token matches a given string
+
+ The search is run only in the given subrange of the file
+
+ @return The count of matching lines
+ @param range A pointer to the subrange of the data object
+ @param name The string to be matched (case-sensitive)
+*/
+KDint NvConfigCountMatchingLinesInRange(const NvConfigDataRange *range, const KDchar *name);
+
+/** Returns the index of the first line in the config data (at or after
+ the given start line) whose leading token matches a given string
+
+ The search starts at the indicated line and continues to the end of the
+ file
+
+ @return The index of the first matching line, or -1 if no match
+ @param data A pointer to the data object
+ @param name The string to be matched (case-sensitive)
+ @param startLine The line at which the search should start. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @see NvConfigGetLineCount
+*/
+KDint NvConfigFindMatchingLine(const NvConfigData *data, const KDchar *name, KDint startLine);
+
+/** Returns the index of the first line in the subrange of the config data
+ whose leading token matches a given string
+
+ The search is run only in the given subrange of the file
+
+ @return The index of the first matching line, or -1 if no match
+ @param range A pointer to the subrange of the data object
+ @param name The string to be matched (case-sensitive)
+*/
+KDint NvConfigFindMatchingLineInRange(const NvConfigDataRange *range, const KDchar *name);
+
+/** Finds a matching token-delimited block in the file and returns it as a subrange.
+
+ Searches for a token-delimited open/close block in the given line range.
+ If the nested parameter is true, then additional nested open/close blocks
+ are tracked and the returned block is the one that properly closes the
+ given open block. If the nested flag is false, then the open/close are
+ treated like C-comments, and the first closing token found is returned
+
+ @return KD_TRUE if a block with both an open and a close token is found,
+ KD_FALSE otherwise
+ @param data A pointer to the data object
+ @param openText The string token to be matched as the start of a block.
+ (case-sensitive) Only the leading token of each line is tested
+ @param closeText The string token to be matched as the end of a block.
+ (case-sensitive) Only the leading token of each line is tested
+ @param nested If KD_TRUE, C-bracket-style nesting is used to determine
+ which end token is matched. If KD_FALSE, C-comment-style flat matching
+ is used to match the end token.
+ @param startLine The index of the first line to search (inclusive)
+ @param endLine The index of the last line to search (inclusive)
+ @param range Output: A pointer to the subrange of the data object. This
+ should be a pointer to an allocated struct
+*/
+KDboolean NvConfigFindDelimitedBlock(const NvConfigData *data, const KDchar *openText,
+ const KDchar *closeText, KDboolean nested, KDint startLine,
+ KDint endLine, NvConfigDataRange *range);
+
+/** Returns the index of the first matching token in the given line
+
+ Returns the index of the first token on the given line (if any) that
+ matches the given string.
+
+ @return The index of the matching string token in the line, or else -1 if
+ the token is not found in the line
+ @param data A pointer to the data object
+ @param token The string to be matched (case-sensitive)
+ @param line The line to search. This parameter must
+ be at least 0 and must be less than the line count of the object
+ @see NvConfigGetLineCount
+*/
+KDint NvConfigFindMatchingTokenInLine(const NvConfigData *data, const KDchar *token, KDint line);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_debug.h b/src/Runtime/Source/platformspecific/windows/libs/nv_debug.h
new file mode 100644
index 00000000..2559dd6f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_debug.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_DEBUG_H
+#define __INCLUDED_QT3DS_DEBUG_H
+
+#define CT_ASSERT(tag, cond) enum { COMPILE_TIME_ASSERT__##tag = 1 / (cond) }
+
+#define dimof(x) (sizeof(x) / sizeof(x[0]))
+#include <android/log.h>
+
+#define DBG_DETAILED 0
+
+#if 0
+
+ // the detailed prefix can be customised by setting DBG_DETAILED_PREFIX. See
+ // below as a reference.
+ // NOTE: fmt is the desired format string and must be in the prefix.
+ //#ifndef DBG_DETAILED_PREFIX
+ // #define DBG_DETAILED_PREFIX "%s, %s, line %d: " fmt, __FILE__, __FUNCTION__, __LINE__,
+ //#endif
+ //#define DEBUG_D_(fmt, args...)
+ //#define DEBUG_D(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, (DBG_DETAILED_PREFIX) ## args)
+
+#else
+
+#ifdef STRINGIFY
+#pragma push_macro("STRINGIFY")
+#undef STRINGIFY
+#define STRINGIFYPUSHED_____
+#endif
+#define STRINGIFY(x) #x
+
+// debug macro, includes file name function name and line number
+#define TO(x) typeof(x)
+#define DEBUG_D_(file, line, fmt, args...) \
+ __android_log_print(ANDROID_LOG_DEBUG, MODULE, file ", %s, line(" STRINGIFY(line) "): " fmt, \
+ __FUNCTION__, ##args)
+#define DEBUG_D(fmt, args...) DEBUG_D_(__FILE__, __LINE__, fmt, ##args)
+
+#ifdef STRINGIFYPUSHED_____
+#undef STRINGIFYPUSHED_____
+#pragma pop_macro("STRINGIFY")
+#endif
+
+#endif
+
+// basic debug macro
+#define DEBUG_(fmt, args...) (__android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args))
+
+// Debug macro that can be switched to spew a file name,
+// function and line number using DEBUG_DETAILED
+#if DBG_DETAILED == 1
+#define DEBUG(fmt, args...) DEBUG_D(fmt, ##args)
+#else
+#define DEBUG(fmt, args...) __android_log_print(ANDROID_LOG_DEBUG, MODULE, fmt, ##args)
+#endif
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_global.h b/src/Runtime/Source/platformspecific/windows/libs/nv_global.h
new file mode 100644
index 00000000..9d23d45f
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_global.h
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_GLOBAL_H
+#define __INCLUDED_QT3DS_GLOBAL_H
+
+#include "nv_types.h"
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/NvVec.h b/src/Runtime/Source/platformspecific/windows/libs/nv_math/NvVec.h
new file mode 100644
index 00000000..4e5b09ce
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/NvVec.h
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_VEC_H
+#define INCLUDED_QT3DS_MATH_CPP_VEC_H
+
+#include "misc.h"
+
+struct _NvVec3
+{
+ union {
+ struct
+ {
+ float x, y, z;
+ };
+ float v[3];
+ };
+};
+
+struct NvVec3 : public _NvVec3
+{
+ NvVec3() { zero(); }
+
+ NvVec3(float x, float y, float z)
+ {
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+ }
+
+ NvVec3(NvVec3 const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ v[2] = that.v[2];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ v[2] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 3) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec3 &operator+=(NvVec3 const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ v[2] += that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator-=(NvVec3 const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ v[2] -= that.v[2];
+ return *this;
+ }
+
+ NvVec3 &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ v[2] *= s;
+ return *this;
+ }
+
+ NvVec3 &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ v[2] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec3 const &a, NvVec3 const &b)
+{
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
+}
+
+inline NvVec3 operator+(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] + b.v[0], a.v[1] + b.v[1], a.v[2] + b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[0] - b.v[0], a.v[1] - b.v[1], a.v[2] - b.v[2]);
+}
+
+inline NvVec3 operator-(NvVec3 const &a)
+{
+
+ return NvVec3(-a.v[0], -a.v[1], -a.v[2]);
+}
+
+inline NvVec3 operator*(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] * s, a.v[1] * s, a.v[2] * s);
+}
+
+inline NvVec3 operator*(float s, NvVec3 const &a)
+{
+
+ return NvVec3(s * a.v[0], s * a.v[1], s * a.v[2]);
+}
+
+inline NvVec3 operator/(NvVec3 const &a, float s)
+{
+
+ return NvVec3(a.v[0] / s, a.v[1] / s, a.v[2] / s);
+}
+
+inline float magnitude(NvVec3 const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec3 normalize(NvVec3 const &v)
+{
+ float l = magnitude(v);
+ return NvVec3(v[0] / l, v[1] / l, v[2] / l);
+}
+
+inline NvVec3 cross(NvVec3 const &a, NvVec3 const &b)
+{
+
+ return NvVec3(a.v[1] * b.v[2] - a.v[2] * b.v[1], a.v[2] * b.v[0] - a.v[0] * b.v[2],
+ a.v[0] * b.v[1] - a.v[1] * b.v[0]);
+}
+
+inline bool operator==(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] == b.v[0] && a.v[1] == b.v[1] && a.v[2] == b.v[2]);
+}
+
+inline bool operator!=(NvVec3 const &a, NvVec3 const &b)
+{
+ return (a.v[0] != b.v[0] || a.v[1] != b.v[1] || a.v[2] != b.v[2]);
+}
+
+struct NvVec2f
+{
+ union {
+ struct
+ {
+ float x, y;
+ float v[2];
+ };
+ };
+
+ NvVec2f() { zero(); }
+
+ NvVec2f(float x, float y)
+ {
+ v[0] = x;
+ v[1] = y;
+ }
+
+ NvVec2f(NvVec2f const &that)
+ {
+ v[0] = that.v[0];
+ v[1] = that.v[1];
+ }
+
+ inline void zero()
+ {
+ v[0] = 0.0f;
+ v[1] = 0.0f;
+ }
+
+ inline float &operator[](int i)
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ inline float const &operator[](int i) const
+ {
+ assert((i < 2) && (i >= 0));
+ return v[i];
+ }
+
+ NvVec2f &operator+=(NvVec2f const &that)
+ {
+ v[0] += that.v[0];
+ v[1] += that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator-=(NvVec2f const &that)
+ {
+ v[0] -= that.v[0];
+ v[1] -= that.v[1];
+ return *this;
+ }
+
+ NvVec2f &operator*=(float s)
+ {
+ v[0] *= s;
+ v[1] *= s;
+ return *this;
+ }
+
+ NvVec2f &operator/=(float s)
+ {
+ v[0] /= s;
+ v[1] /= s;
+ return *this;
+ }
+};
+
+inline float dot(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a[0] * b[0] + a[1] * b[1];
+}
+
+inline NvVec2f operator+(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] + b.v[0], a.v[1] + b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return NvVec2f(a.v[0] - b.v[0], a.v[1] - b.v[1]);
+}
+
+inline NvVec2f operator-(NvVec2f const &a)
+{
+
+ return NvVec2f(-a.v[0], -a.v[1]);
+}
+
+inline NvVec2f operator*(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] * s, a.v[1] * s);
+}
+
+inline NvVec2f operator*(float s, NvVec2f const &a)
+{
+
+ return NvVec2f(s * a.v[0], s * a.v[1]);
+}
+
+inline NvVec2f operator/(NvVec2f const &a, float s)
+{
+
+ return NvVec2f(a.v[0] / s, a.v[1] / s);
+}
+
+inline float magnitude(NvVec2f const &v)
+{
+ return sqrtf(dot(v, v));
+}
+
+inline NvVec2f normalize(NvVec2f const &v)
+{
+ float l = dot(v, v);
+ return NvVec2f(v[0] / l, v[1] / l);
+}
+
+inline float cross(NvVec2f const &a, NvVec2f const &b)
+{
+
+ return a.v[0] * b.v[1] - b.v[0] * a.v[1];
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/misc.h b/src/Runtime/Source/platformspecific/windows/libs/nv_math/misc.h
new file mode 100644
index 00000000..983410f3
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/misc.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QT3DS_MATH_CPP_MISC_H
+#define INCLUDED_QT3DS_MATH_CPP_MISC_H
+
+inline bool nvIsPowerOfTwo(unsigned int i)
+{
+ return (i & (i - 1)) == 0;
+}
+
+inline float nvDegToRadf(float d)
+{
+ return d * 3.14159265358979323846f / 180.0f;
+}
+
+inline float nvRadToDegf(float r)
+{
+ return r * 180.0f / 3.14159265358979323846f;
+}
+
+/*
+ 'mod' differs from '%' in that it behaves correctly when either the
+ numerator or denominator is negative.
+*/
+
+inline int nvMod(int n, int d)
+{
+ int m = n % d;
+ return (((m < 0) && (d > 0)) || ((m > 0) && (d < 0))) ? (m + d) : m;
+}
+
+inline int nvAbs(int n)
+{
+ if (n < 0)
+ return -n;
+ return n;
+}
+
+inline int nvSign(int n)
+{
+ if (n > 0)
+ return 1;
+ if (n < 0)
+ return -1;
+ return 0;
+}
+
+/*
+ This returns the smallest amplitude value x such that
+ nvMod(b + x, m) == a
+*/
+
+inline int nvDifMod(int a, int b, int m)
+{
+
+ int x1 = a - b;
+ int x2 = (x1 > 0) ? x1 - m : x1 + m;
+ return (nvAbs(x1) < nvAbs(x2)) ? x1 : x2;
+}
+
+inline float nvWrapf(float a, float min, float max)
+{
+
+ assert(max > min);
+
+ float d = max - min;
+ float s = a - min;
+ float q = s / d;
+ float m = q - floorf(q);
+ return m * d + min;
+}
+
+inline float nvClampf(float a, float min, float max)
+{
+ return (a < min) ? min : ((a > max) ? max : a);
+}
+
+inline int nvClampi(int i, int min, int max)
+{
+ return (i < min) ? min : ((i > max) ? max : i);
+}
+
+inline float nvGaussian(float x, float s)
+{
+ float c = s * sqrtf(2.0f * 3.14159265358979323846f);
+ return expf(-(x * x) / (2.0f * s * s)) / c;
+}
+
+inline float nvLerpf(float a, float b, float t)
+{
+ return a * (1.0f - t) + b * t;
+}
+
+inline float nvEasef(float t)
+{
+
+ float t_2 = t * t;
+ float t_3 = t_2 * t;
+ return 3.0f * t_2 - 2.0f * t_3;
+}
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.cpp b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.cpp
new file mode 100644
index 00000000..b83cb39e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_math.h"
+
+static const double a = 16807.0;
+static const double m = 2147483647.0;
+
+static double nextSeed(double seed)
+{
+ double t = a * seed;
+ return t - m * (double)((int)(t / m));
+}
+
+GLfloat NvRandf()
+{
+ static double seed = 1.0;
+ seed = nextSeed(seed);
+ return (GLfloat)(seed * (1 / m));
+}
+
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime)
+{
+ // kdGetTimeUST is never supposed to decrease (i.e. that
+ // means it can't wrap, either. IIRC, it will wrap in
+ // 593 years). So we ignore that option...
+
+ // Used for frame-to-frame diffs, this will fit in 32b
+ // as long as the times are < ~4.3s apart
+ long long int diffTime = newTime - oldTime;
+
+ // Need to find a better way to do this.
+ // However, I believe we will be uSec precise (not run
+ // out of mantissa bits for uSecs) as long as the diff
+ // is < ~16s (1e-6 * (2^24))
+ return ((GLfloat)diffTime) / 1.0e9f;
+}
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.h b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.h
new file mode 100644
index 00000000..ec729a79
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_math.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _QT3DS_MATH_H
+#define _QT3DS_MATH_H
+
+#include <QtOpenGL/qgl.h>
+
+GLfloat NvRandf();
+
+/* These are the recommended "safer" ways to use GLfloat for time */
+
+/* Returns the seconds between the two given times */
+GLfloat NvClockDiffInSecs(long long int newTime, long long int oldTime);
+
+#define QT3DS_MILISECS_TO_UST(ms) ((long long int)(ms)*1000000)
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.cpp b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.cpp
new file mode 100644
index 00000000..e208ac31
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.cpp
@@ -0,0 +1,1030 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_matrix.h"
+
+int NvDifferentMatsf(GLfloat a[4][4], const GLfloat b[4][4])
+{
+ return ((&a[3][3] < &b[0][0]) || (&b[3][3] < &a[0][0]));
+}
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+}
+
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4])
+{
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+}
+
+GLfloat NvVecLengthf(const GLfloat v[3])
+{
+ return sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3])
+{
+ GLfloat const l = NvVecLengthf(v);
+ r[0] = v[0] / l;
+ r[1] = v[1] / l;
+ r[2] = v[2] / l;
+}
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] + b[0];
+ r[1] = a[1] + b[1];
+ r[2] = a[2] + b[2];
+}
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ r[0] = a[0] - b[0];
+ r[1] = a[1] - b[1];
+ r[2] = a[2] - b[2];
+}
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3])
+{
+ GLfloat t[3];
+
+ t[0] = a[1] * b[2] - a[2] * b[1];
+ t[1] = a[2] * b[0] - a[0] * b[2];
+ t[2] = a[0] * b[1] - a[1] * b[0];
+
+ r[0] = t[0];
+ r[1] = t[1];
+ r[2] = t[2];
+}
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ GLfloat inv_w = 1.0f / (m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3]);
+
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * inv_w;
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * inv_w;
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * inv_w;
+}
+
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2] + m[3][0] * a[3];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2] + m[3][1] * a[3];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2] + m[3][2] * a[3];
+ r[3] = m[0][3] * a[0] + m[1][3] * a[1] + m[2][3] * a[2] + m[3][3] * a[3];
+}
+
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3])
+{
+ r[0] = m[0][0] * a[0] + m[1][0] * a[1] + m[2][0] * a[2];
+ r[1] = m[0][1] * a[0] + m[1][1] * a[1] + m[2][1] * a[2];
+ r[2] = m[0][2] * a[0] + m[1][2] * a[1] + m[2][2] * a[2];
+}
+
+static void NvMultMat3x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x3f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2];
+ r[0][3] = 0.0f;
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2];
+ r[1][3] = 0.0f;
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2];
+ r[3][3] = 1.0f;
+}
+
+static void NvMultMat4x4f(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ assert(NvDifferentMatsf(r, a) && NvDifferentMatsf(r, b));
+
+ r[0][0] = a[0][0] * b[0][0] + a[1][0] * b[0][1] + a[2][0] * b[0][2] + a[3][0] * b[0][3];
+ r[0][1] = a[0][1] * b[0][0] + a[1][1] * b[0][1] + a[2][1] * b[0][2] + a[3][1] * b[0][3];
+ r[0][2] = a[0][2] * b[0][0] + a[1][2] * b[0][1] + a[2][2] * b[0][2] + a[3][2] * b[0][3];
+ r[0][3] = a[0][3] * b[0][0] + a[1][3] * b[0][1] + a[2][3] * b[0][2] + a[3][3] * b[0][3];
+
+ r[1][0] = a[0][0] * b[1][0] + a[1][0] * b[1][1] + a[2][0] * b[1][2] + a[3][0] * b[1][3];
+ r[1][1] = a[0][1] * b[1][0] + a[1][1] * b[1][1] + a[2][1] * b[1][2] + a[3][1] * b[1][3];
+ r[1][2] = a[0][2] * b[1][0] + a[1][2] * b[1][1] + a[2][2] * b[1][2] + a[3][2] * b[1][3];
+ r[1][3] = a[0][3] * b[1][0] + a[1][3] * b[1][1] + a[2][3] * b[1][2] + a[3][3] * b[1][3];
+
+ r[2][0] = a[0][0] * b[2][0] + a[1][0] * b[2][1] + a[2][0] * b[2][2] + a[3][0] * b[2][3];
+ r[2][1] = a[0][1] * b[2][0] + a[1][1] * b[2][1] + a[2][1] * b[2][2] + a[3][1] * b[2][3];
+ r[2][2] = a[0][2] * b[2][0] + a[1][2] * b[2][1] + a[2][2] * b[2][2] + a[3][2] * b[2][3];
+ r[2][3] = a[0][3] * b[2][0] + a[1][3] * b[2][1] + a[2][3] * b[2][2] + a[3][3] * b[2][3];
+
+ r[3][0] = a[0][0] * b[3][0] + a[1][0] * b[3][1] + a[2][0] * b[3][2] + a[3][0] * b[3][3];
+ r[3][1] = a[0][1] * b[3][0] + a[1][1] * b[3][1] + a[2][1] * b[3][2] + a[3][1] * b[3][3];
+ r[3][2] = a[0][2] * b[3][0] + a[1][2] * b[3][1] + a[2][2] * b[3][2] + a[3][2] * b[3][3];
+ r[3][3] = a[0][3] * b[3][0] + a[1][3] * b[3][1] + a[2][3] * b[3][2] + a[3][3] * b[3][3];
+}
+
+void NvMultMatf(GLfloat result[4][4], const GLfloat a[4][4], const GLfloat b[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((a[0][3] == 0.0f) && (a[1][3] == 0.0f) && (a[2][3] == 0.0f) && (a[2][3] == 1.0f)
+ && (b[0][3] == 0.0f) && (b[1][3] == 0.0f) && (b[2][3] == 0.0f) && (b[2][3] == 1.0f)) {
+ if ((a[3][0] == 0.0f) && (a[3][1] == 0.0f) && (a[3][2] == 0.0f) && (b[3][0] == 0.0f)
+ && (b[3][1] == 0.0f) && (b[3][2] == 0.0f)) {
+ NvMultMat3x3f(r, a, b);
+ } else {
+ NvMultMat4x3f(r, a, b);
+ }
+ } else {
+ NvMultMat4x4f(r, a, b);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+static void NvInvMat3x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x3f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1] + -m[0][1] * m[1][0] * m[2][2]
+ + -m[0][2] * m[1][1] * m[2][0];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] - m[1][2] * m[2][1]) / d;
+ r[0][1] = (m[0][2] * m[2][1] - m[0][1] * m[2][2]) / d;
+ r[0][2] = (m[0][1] * m[1][2] - m[0][2] * m[1][1]) / d;
+ r[0][3] = 0.0f;
+
+ r[1][0] = (m[1][2] * m[2][0] - m[1][0] * m[2][2]) / d;
+ r[1][1] = (m[0][0] * m[2][2] - m[0][2] * m[2][0]) / d;
+ r[1][2] = (m[0][2] * m[1][0] - m[0][0] * m[1][2]) / d;
+ r[1][3] = 0.0f;
+
+ r[2][0] = (m[1][0] * m[2][1] - m[1][1] * m[2][0]) / d;
+ r[2][1] = (m[0][1] * m[2][0] - m[0][0] * m[2][1]) / d;
+ r[2][2] = (m[0][0] * m[1][1] - m[0][1] * m[1][0]) / d;
+ r[2][3] = 0.0f;
+
+ /* x */
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ /* y */
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ /* z */
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = 1.0f;
+}
+
+static void NvInvMat4x4f(GLfloat r[4][4], const GLfloat m[4][4])
+{
+ GLfloat d = m[0][0] * m[1][1] * m[2][2] * m[3][3] + m[0][0] * m[1][2] * m[2][3] * m[3][1]
+ + m[0][0] * m[1][3] * m[2][1] * m[3][2] + m[0][1] * m[1][0] * m[2][3] * m[3][2]
+ + m[0][1] * m[1][2] * m[2][0] * m[3][3] + m[0][1] * m[1][3] * m[2][2] * m[3][0]
+ + m[0][2] * m[1][0] * m[2][1] * m[3][3] + m[0][2] * m[1][1] * m[2][3] * m[3][0]
+ + m[0][2] * m[1][3] * m[2][0] * m[3][1] + m[0][3] * m[1][0] * m[2][2] * m[3][1]
+ + m[0][3] * m[1][1] * m[2][0] * m[3][2] + m[0][3] * m[1][2] * m[2][1] * m[3][0]
+ + -m[0][0] * m[1][1] * m[2][3] * m[3][2] + -m[0][0] * m[1][2] * m[2][1] * m[3][3]
+ + -m[0][0] * m[1][3] * m[2][2] * m[3][1] + -m[0][1] * m[1][0] * m[2][2] * m[3][3]
+ + -m[0][1] * m[1][2] * m[2][3] * m[3][0] + -m[0][1] * m[1][3] * m[2][0] * m[3][2]
+ + -m[0][2] * m[1][0] * m[2][3] * m[3][1] + -m[0][2] * m[1][1] * m[2][0] * m[3][3]
+ + -m[0][2] * m[1][3] * m[2][1] * m[3][0] + -m[0][3] * m[1][0] * m[2][1] * m[3][2]
+ + -m[0][3] * m[1][1] * m[2][2] * m[3][0] + -m[0][3] * m[1][2] * m[2][0] * m[3][1];
+
+ assert(NvDifferentMatsf(r, m));
+
+ r[0][0] = (m[1][1] * m[2][2] * m[3][3] + m[1][2] * m[2][3] * m[3][1]
+ + m[1][3] * m[2][1] * m[3][2] + -m[1][1] * m[2][3] * m[3][2]
+ + -m[1][2] * m[2][1] * m[3][3] + -m[1][3] * m[2][2] * m[3][1])
+ / d;
+
+ r[0][1] = (m[0][1] * m[2][3] * m[3][2] + m[0][2] * m[2][1] * m[3][3]
+ + m[0][3] * m[2][2] * m[3][1] + -m[0][1] * m[2][2] * m[3][3]
+ + -m[0][2] * m[2][3] * m[3][1] + -m[0][3] * m[2][1] * m[3][2])
+ / d;
+
+ r[0][2] = (m[0][1] * m[1][2] * m[3][3] + m[0][2] * m[1][3] * m[3][1]
+ + m[0][3] * m[1][1] * m[3][2] + -m[0][1] * m[1][3] * m[3][2]
+ + -m[0][2] * m[1][1] * m[3][3] + -m[0][3] * m[1][2] * m[3][1])
+ / d;
+
+ r[0][3] = (m[0][1] * m[1][3] * m[2][2] + m[0][2] * m[1][1] * m[2][3]
+ + m[0][3] * m[1][2] * m[2][1] + -m[0][1] * m[1][2] * m[2][3]
+ + -m[0][2] * m[1][3] * m[2][1] + -m[0][3] * m[1][1] * m[2][2])
+ / d;
+
+ r[1][0] = (m[1][0] * m[2][3] * m[3][2] + m[1][2] * m[2][0] * m[3][3]
+ + m[1][3] * m[2][2] * m[3][0] + -m[1][0] * m[2][2] * m[3][3]
+ + -m[1][2] * m[2][3] * m[3][0] + -m[1][3] * m[2][0] * m[3][2])
+ / d;
+
+ r[1][1] = (m[0][0] * m[2][2] * m[3][3] + m[0][2] * m[2][3] * m[3][0]
+ + m[0][3] * m[2][0] * m[3][2] + -m[0][0] * m[2][3] * m[3][2]
+ + -m[0][2] * m[2][0] * m[3][3] + -m[0][3] * m[2][2] * m[3][0])
+ / d;
+
+ r[1][2] = (m[0][0] * m[1][3] * m[3][2] + m[0][2] * m[1][0] * m[3][3]
+ + m[0][3] * m[1][2] * m[3][0] + -m[0][0] * m[1][2] * m[3][3]
+ + -m[0][2] * m[1][3] * m[3][0] + -m[0][3] * m[1][0] * m[3][2])
+ / d;
+
+ r[1][3] = (m[0][0] * m[1][2] * m[2][3] + m[0][2] * m[1][3] * m[2][0]
+ + m[0][3] * m[1][0] * m[2][2] + -m[0][0] * m[1][3] * m[2][2]
+ + -m[0][2] * m[1][0] * m[2][3] + -m[0][3] * m[1][2] * m[2][0])
+ / d;
+
+ r[2][0] = (m[1][0] * m[2][1] * m[3][3] + m[1][1] * m[2][3] * m[3][0]
+ + m[1][3] * m[2][0] * m[3][1] + -m[1][0] * m[2][3] * m[3][1]
+ + -m[1][1] * m[2][0] * m[3][3] + -m[1][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][1] =
+ (-m[0][0] * m[2][1] * m[3][3] + -m[0][1] * m[2][3] * m[3][0] + -m[0][3] * m[2][0] * m[3][1]
+ + m[0][0] * m[2][3] * m[3][1] + m[0][1] * m[2][0] * m[3][3] + m[0][3] * m[2][1] * m[3][0])
+ / d;
+
+ r[2][2] = (m[0][0] * m[1][1] * m[3][3] + m[0][1] * m[1][3] * m[3][0]
+ + m[0][3] * m[1][0] * m[3][1] + -m[0][0] * m[1][3] * m[3][1]
+ + -m[0][1] * m[1][0] * m[3][3] + -m[0][3] * m[1][1] * m[3][0])
+ / d;
+
+ r[2][3] = (m[0][0] * m[1][3] * m[2][1] + m[0][1] * m[1][0] * m[2][3]
+ + m[0][3] * m[1][1] * m[2][0] + -m[0][1] * m[1][3] * m[2][0]
+ + -m[0][3] * m[1][0] * m[2][1] + -m[0][0] * m[1][1] * m[2][3])
+ / d;
+
+ r[3][0] = (m[1][0] * m[2][2] * m[3][1] + m[1][1] * m[2][0] * m[3][2]
+ + m[1][2] * m[2][1] * m[3][0] + -m[1][0] * m[2][1] * m[3][2]
+ + -m[1][1] * m[2][2] * m[3][0] + -m[1][2] * m[2][0] * m[3][1])
+ / d;
+
+ r[3][1] = (m[0][0] * m[2][1] * m[3][2] + m[0][1] * m[2][2] * m[3][0]
+ + m[0][2] * m[2][0] * m[3][1] + -m[0][0] * m[2][2] * m[3][1]
+ + -m[0][1] * m[2][0] * m[3][2] + -m[0][2] * m[2][1] * m[3][0])
+ / d;
+
+ r[3][2] = (m[0][0] * m[1][2] * m[3][1] + m[0][1] * m[1][0] * m[3][2]
+ + m[0][2] * m[1][1] * m[3][0] + -m[0][0] * m[1][1] * m[3][2]
+ + -m[0][1] * m[1][2] * m[3][0] + -m[0][2] * m[1][0] * m[3][1])
+ / d;
+
+ r[3][3] = (m[0][0] * m[1][1] * m[2][2] + m[0][1] * m[1][2] * m[2][0]
+ + m[0][2] * m[1][0] * m[2][1] + -m[0][0] * m[1][2] * m[2][1]
+ + -m[0][1] * m[1][0] * m[2][2] + -m[0][2] * m[1][1] * m[2][0])
+ / d;
+}
+
+void NvInvMatf(GLfloat result[4][4], const GLfloat m[4][4])
+{
+ /*
+ Use a temporary matrix for the result and copy the temporary
+ into the result when finished. Doing this instead of writing
+ the result directly guarantees that the routine will work even
+ if the result overlaps one or more of the arguments in
+ memory.
+ */
+
+ GLfloat r[4][4];
+
+ if ((m[0][3] == 0.0f) && (m[1][3] == 0.0f) && (m[2][3] == 0.0f) && (m[2][3] == 1.0f)) {
+ if ((m[3][0] == 0.0f) && (m[3][1] == 0.0f) && (m[3][2] == 0.0f)) {
+ NvInvMat3x3f(r, m);
+ } else {
+ NvInvMat4x3f(r, m);
+ }
+ } else {
+ NvInvMat4x4f(r, m);
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildIdentityMatf(GLfloat r[4][4])
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = x;
+ r[3][1] = y;
+ r[3][2] = z;
+ r[3][3] = 1.0f;
+}
+
+void NvMultTranslateMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y,
+ GLfloat z)
+{
+ GLfloat r[4][4]; /*temporary storage for result */
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[0][0] * x + m[1][0] * y + m[2][0] * z + m[3][0];
+ r[3][1] = m[0][1] * x + m[1][1] * y + m[2][1] * z + m[3][1];
+ r[3][2] = m[0][2] * x + m[1][2] * y + m[2][2] * z + m[3][2];
+ r[3][3] = m[0][3] * x + m[1][3] * y + m[2][3] * z + m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+ r[0][0] = x;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = y;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = z;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultScaleMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z)
+{
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * x;
+ r[0][1] = m[0][1] * x;
+ r[0][2] = m[0][2] * x;
+ r[0][3] = m[0][3] * x;
+
+ r[1][0] = m[1][0] * y;
+ r[1][1] = m[1][1] * y;
+ r[1][2] = m[1][2] * y;
+ r[1][3] = m[1][3] * y;
+
+ r[2][0] = m[2][0] * z;
+ r[2][1] = m[2][1] * z;
+ r[2][2] = m[2][2] * z;
+ r[2][3] = m[2][3] * z;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = 1.0f;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = c;
+ r[1][2] = s;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = -s;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = 0.0f;
+ r[0][2] = -s;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = 1.0f;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = s;
+ r[2][1] = 0.0f;
+ r[2][2] = c;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ r[0][0] = c;
+ r[0][1] = s;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = -s;
+ r[1][1] = c;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvMultRotXRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0];
+ r[0][1] = m[0][1];
+ r[0][2] = m[0][2];
+ r[0][3] = m[0][3];
+
+ r[1][0] = m[1][0] * c + m[2][0] * s;
+ r[1][1] = m[1][1] * c + m[2][1] * s;
+ r[1][2] = m[1][2] * c + m[2][2] * s;
+ r[1][3] = m[1][3] * c + m[2][3] * s;
+
+ r[2][0] = m[1][0] * -s + m[2][0] * c;
+ r[2][1] = m[1][1] * -s + m[2][1] * c;
+ r[2][2] = m[1][2] * -s + m[2][2] * c;
+ r[2][3] = m[1][3] * -s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotYRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[2][0] * -s;
+ r[0][1] = m[0][1] * c + m[2][1] * -s;
+ r[0][2] = m[0][2] * c + m[2][2] * -s;
+ r[0][3] = m[0][3] * c + m[2][3] * -s;
+
+ r[1][0] = m[1][0];
+ r[1][1] = m[1][1];
+ r[1][2] = m[1][2];
+ r[1][3] = m[1][3];
+
+ r[2][0] = m[0][0] * s + m[2][0] * c;
+ r[2][1] = m[0][1] * s + m[2][1] * c;
+ r[2][2] = m[0][2] * s + m[2][2] * c;
+ r[2][3] = m[0][3] * s + m[2][3] * c;
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvMultRotZRadMatf(GLfloat result[4][4], const GLfloat m[4][4], GLfloat radians)
+{
+
+ GLfloat const s = sinf(radians);
+ GLfloat const c = cosf(radians);
+
+ GLfloat r[4][4];
+
+ r[0][0] = m[0][0] * c + m[1][0] * s;
+ r[0][1] = m[0][1] * c + m[1][1] * s;
+ r[0][2] = m[0][2] * c + m[1][2] * s;
+ r[0][3] = m[0][3] * c + m[1][3] * s;
+
+ r[1][0] = m[0][0] * -s + m[1][0] * c;
+ r[1][1] = m[0][1] * -s + m[1][1] * c;
+ r[1][2] = m[0][2] * -s + m[1][2] * c;
+ r[1][3] = m[0][3] * -s + m[1][3] * c;
+
+ r[2][0] = m[2][0];
+ r[2][1] = m[2][1];
+ r[2][2] = m[2][2];
+ r[2][3] = m[2][3];
+
+ r[3][0] = m[3][0];
+ r[3][1] = m[3][1];
+ r[3][2] = m[3][2];
+ r[3][3] = m[3][3];
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotRadMatf(GLfloat result[4][4], const GLfloat axis[3], GLfloat radians)
+{
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ /* build a matrix from the quat */
+
+ result[0][0] = 1.0f - 2.0f * (j * j + k * k);
+ result[0][1] = 2.0f * (i * j + r * k);
+ result[0][2] = 2.0f * (i * k - r * j);
+ result[0][3] = 0.0f;
+
+ result[1][0] = 2.0f * (i * j - r * k);
+ result[1][1] = 1.0f - 2.0f * (i * i + k * k);
+ result[1][2] = 2.0f * (j * k + r * i);
+ result[1][3] = 0.0f;
+
+ result[2][0] = 2.0f * (i * k + r * j);
+ result[2][1] = 2.0f * (j * k - r * i);
+ result[2][2] = 1.0f - 2.0f * (i * i + j * j);
+ result[2][3] = 0.0f;
+
+ result[3][0] = 0.0f;
+ result[3][1] = 0.0f;
+ result[3][2] = 0.0f;
+ result[3][3] = 1.0f;
+}
+
+void NvMultRotRadMatf(GLfloat result[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians)
+{
+ GLfloat r[4][4];
+
+ {
+ /* build a quat first */
+
+ GLfloat i, j, k, r;
+
+ /* should be */
+ GLfloat const dst_l = sinf(radians / 2.0f);
+
+ /* actually is */
+ GLfloat const src_l = sqrtf(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]);
+
+ if (src_l <= KD_FLT_EPSILON) {
+ i = 0.0f;
+ j = 0.0f;
+ k = 0.0f;
+ r = 1.0f;
+ } else {
+ GLfloat const s = dst_l / src_l;
+ i = axis[0] * s;
+ j = axis[1] * s;
+ k = axis[2] * s;
+ r = cosf(radians / 2.0f);
+ }
+
+ {
+ /* build a matrix from the quat */
+
+ GLfloat const a00 = 1.0f - 2.0f * (j * j + k * k);
+ GLfloat const a01 = 2.0f * (i * j + r * k);
+ GLfloat const a02 = 2.0f * (i * k - r * j);
+
+ GLfloat const a10 = 2.0f * (i * j - r * k);
+ GLfloat const a11 = 1.0f - 2.0f * (i * i + k * k);
+ GLfloat const a12 = 2.0f * (j * k + r * i);
+
+ GLfloat const a20 = 2.0f * (i * k + r * j);
+ GLfloat const a21 = 2.0f * (j * k - r * i);
+ GLfloat const a22 = 1.0f - 2.0f * (i * i + j * j);
+
+ result[0][0] = m[0][0] * a00 + m[1][0] * a01 + m[2][0] * a02;
+ result[0][1] = m[0][1] * a00 + m[1][1] * a01 + m[2][1] * a02;
+ result[0][2] = m[0][2] * a00 + m[1][2] * a01 + m[2][2] * a02;
+ result[0][3] = m[0][3] * a00 + m[1][3] * a01 + m[2][3] * a02;
+
+ result[1][0] = m[0][0] * a10 + m[1][0] * a11 + m[2][0] * a12;
+ result[1][1] = m[0][1] * a10 + m[1][1] * a11 + m[2][1] * a12;
+ result[1][2] = m[0][2] * a10 + m[1][2] * a11 + m[2][2] * a12;
+ result[1][3] = m[0][3] * a10 + m[1][3] * a11 + m[2][3] * a12;
+
+ result[2][0] = m[0][0] * a20 + m[1][0] * a21 + m[2][0] * a22;
+ result[2][1] = m[0][1] * a20 + m[1][1] * a21 + m[2][1] * a22;
+ result[2][2] = m[0][2] * a20 + m[1][2] * a21 + m[2][2] * a22;
+ result[2][3] = m[0][3] * a20 + m[1][3] * a21 + m[2][3] * a22;
+
+ result[3][0] = m[3][0];
+ result[3][1] = m[3][1];
+ result[3][2] = m[3][2];
+ result[3][3] = m[3][3];
+ }
+ }
+
+ NvCopyMatf(result, r);
+}
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotXRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotYRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees)
+{
+ NvBuildRotZRadMatf(r, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotXRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotYRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees)
+{
+ NvMultRotZRadMatf(r, m, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees)
+{
+ NvBuildRotRadMatf(r, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees)
+{
+ NvMultRotRadMatf(r, m, axis, degrees * KD_DEG_TO_RAD_F);
+}
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3])
+{
+ GLfloat ev[3];
+ GLfloat z[3];
+ GLfloat x_tmp[3];
+ GLfloat x[3];
+ GLfloat y[3];
+
+ NvSubVecf(ev, eye, obj);
+
+ NvNormalizeVecf(z, ev);
+
+ NvCrossProductf(x_tmp, up, z);
+
+ NvNormalizeVecf(x, x_tmp);
+
+ NvCrossProductf(y, z, x);
+
+ r[0][0] = x[0];
+ r[0][1] = y[0];
+ r[0][2] = z[0];
+ r[0][3] = 0.0f;
+
+ r[1][0] = x[1];
+ r[1][1] = y[1];
+ r[1][2] = z[1];
+ r[1][3] = 0.0f;
+
+ r[2][0] = x[2];
+ r[2][1] = y[2];
+ r[2][2] = z[2];
+ r[2][3] = 0.0f;
+
+ r[3][0] = -x[0] * eye[0] + -x[1] * eye[1] + -x[2] * eye[2];
+ r[3][1] = -y[0] * eye[0] + -y[1] * eye[1] + -y[2] * eye[2];
+ r[3][2] = -z[0] * eye[0] + -z[1] * eye[1] + -z[2] * eye[2];
+ r[3][3] = 1.0f;
+}
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const m00 = znear * 2.0f / (right - left);
+ GLfloat const m11 = znear * 2.0f / (top - bottom);
+ GLfloat const m22 = -(zfar + znear) / (zfar - znear);
+
+ GLfloat const m20 = (right + left) / (right - left);
+ GLfloat const m21 = (top + bottom) / (top - bottom);
+
+ GLfloat const m32 = -(2.0f * zfar * znear) / (zfar - znear);
+ GLfloat const m23 = -1.0f;
+
+ r[0][0] = m00;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = m11;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = m20;
+ r[2][1] = m21;
+ r[2][2] = m22;
+ r[2][3] = m23;
+
+ r[3][0] = 0.0f;
+ r[3][1] = 0.0f;
+ r[3][2] = m32;
+ r[3][3] = 0.0f;
+}
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = 1.0f;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = 0.0f;
+ r[3][3] = 1.0f;
+}
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar)
+{
+ GLfloat const sx = 2.0f / (right - left);
+ GLfloat const sy = 2.0f / (top - bottom);
+ GLfloat const sz = -2.0f / (zfar - znear);
+
+ GLfloat const tx = -(right + left) / (right - left);
+ GLfloat const ty = -(top + bottom) / (top - bottom);
+ GLfloat const tz = -(zfar + znear) / (zfar - znear);
+
+ r[0][0] = sx;
+ r[0][1] = 0.0f;
+ r[0][2] = 0.0f;
+ r[0][3] = 0.0f;
+
+ r[1][0] = 0.0f;
+ r[1][1] = sy;
+ r[1][2] = 0.0f;
+ r[1][3] = 0.0f;
+
+ r[2][0] = 0.0f;
+ r[2][1] = 0.0f;
+ r[2][2] = sz;
+ r[2][3] = 0.0f;
+
+ r[3][0] = tx;
+ r[3][1] = ty;
+ r[3][2] = tz;
+ r[3][3] = 1.0f;
+}
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.h b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.h
new file mode 100644
index 00000000..0e04568e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_matrix.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_MATRIX_H
+#define INCLUDED_MATRIX_H
+
+#include <QtOpenGL/qgl.h>
+#include <math.h>
+#include <assert.h>
+
+#define KD_FLT_EPSILON 1.19209290E-07F
+#define KD_DEG_TO_RAD_F 0.0174532924F
+#define KD_RAD_TO_DEG_F 57.2957802F
+
+void NvCopyMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+void NvExtract3x3Matf(GLfloat r[3][3], const GLfloat m[4][4]);
+
+/* vector utilities */
+
+GLfloat NvVecLengthf(const GLfloat v[3]);
+
+void NvNormalizeVecf(GLfloat r[3], const GLfloat v[3]);
+
+void NvAddVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvSubVecf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvCrossProductf(GLfloat r[3], const GLfloat a[3], const GLfloat b[3]);
+
+void NvTransformPointf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+void NvTransformHomPointf(GLfloat r[4], const GLfloat m[4][4], const GLfloat a[4]);
+void NvTransformVecf(GLfloat r[3], const GLfloat m[4][4], const GLfloat a[3]);
+
+/* matrix utilities */
+
+void NvMultMatf(GLfloat r[4][4], const GLfloat a[4][4], const GLfloat b[4][4]);
+
+void NvInvMatf(GLfloat r[4][4], const GLfloat m[4][4]);
+
+/* matrix building utilities */
+
+void NvBuildIdentityMatf(GLfloat r[4][4]);
+
+void NvBuildTranslateMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildScaleMatf(GLfloat r[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvBuildRotXDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotYDegMatf(GLfloat r[4][4], GLfloat degrees);
+void NvBuildRotZDegMatf(GLfloat r[4][4], GLfloat degrees);
+
+void NvBuildRotDegMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat degrees);
+
+void NvBuildRotXRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotYRadMatf(GLfloat r[4][4], GLfloat radians);
+void NvBuildRotZRadMatf(GLfloat r[4][4], GLfloat radians);
+
+void NvBuildRotRadMatf(GLfloat r[4][4], const GLfloat axis[3], GLfloat radians);
+
+void NvBuildLookatMatf(GLfloat r[4][4], const GLfloat eye[3], const GLfloat obj[3],
+ const GLfloat up[3]);
+
+void NvBuildFrustumMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+void NvBuildOrtho2Matf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
+
+void NvBuildOrthoMatf(GLfloat r[4][4], GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat znear, GLfloat zfar);
+
+/* matrix concatenation utilities */
+
+void NvMultTranslateMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+void NvMultScaleMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat x, GLfloat y, GLfloat z);
+
+void NvMultRotXDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotYDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+void NvMultRotZDegMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat degrees);
+
+void NvMultRotDegMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat degrees);
+
+void NvMultRotXRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotYRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+void NvMultRotZRadMatf(GLfloat r[4][4], const GLfloat m[4][4], GLfloat radians);
+
+void NvMultRotRadMatf(GLfloat r[4][4], const GLfloat m[4][4], const GLfloat axis[3],
+ GLfloat radians);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.cpp b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.cpp
new file mode 100644
index 00000000..9626eb8c
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "nv_quat.h"
+#include <stdlib.h>
+#include <string.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4])
+{
+ memcpy(r, q, 4 * sizeof(GLfloat));
+}
+
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4])
+{
+ // Assumes that the quaternion is normalized!
+ GLfloat x2 = q[0] * 2.0f;
+ GLfloat y2 = q[1] * 2.0f;
+ GLfloat z2 = q[2] * 2.0f;
+ GLfloat xSq2 = x2 * q[0];
+ GLfloat ySq2 = y2 * q[1];
+ GLfloat zSq2 = z2 * q[2];
+ GLfloat xy2 = x2 * q[1];
+ GLfloat xz2 = x2 * q[2];
+ GLfloat xw2 = x2 * q[3];
+ GLfloat yz2 = y2 * q[2];
+ GLfloat yw2 = y2 * q[3];
+ GLfloat zw2 = z2 * q[3];
+
+ /* Matrix is
+ * | 1 - 2y^2 - 2z^2 2xy - 2zw 2xz + 2yw |
+ * | 2xy + 2zw 1 - 2x^2 - 2z^2 2yz - 2xw |
+ * | 2xz - 2yw 2yz + 2xw 1 - 2x^2 - 2y^2 |
+ */
+ r[0][0] = 1.0f - ySq2 - zSq2;
+ r[0][1] = xy2 - zw2;
+ r[0][2] = xz2 + yw2;
+
+ r[1][0] = xy2 + zw2;
+ r[1][1] = 1.0f - xSq2 - zSq2;
+ r[1][2] = yz2 - xw2;
+
+ r[2][0] = xz2 - yw2;
+ r[2][1] = yz2 + xw2;
+ r[2][2] = 1.0f - xSq2 - ySq2;
+}
+
+void NvQuatIdentity(GLfloat r[4])
+{
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = 1.0f;
+}
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3])
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = axis[0] * sina;
+ r[1] = axis[1] * sina;
+ r[2] = axis[2] * sina;
+ r[3] = cosa;
+}
+
+void NvQuatX(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = sina;
+ r[1] = 0.0f;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatY(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = sina;
+ r[2] = 0.0f;
+ r[3] = cosa;
+}
+
+void NvQuatZ(GLfloat r[4], GLfloat radians)
+{
+ GLfloat cosa = cosf(radians * 0.5f);
+ GLfloat sina = sinf(radians * 0.5f);
+
+ r[0] = 0.0f;
+ r[1] = 0.0f;
+ r[2] = sina;
+ r[3] = cosa;
+}
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatY(h, heading);
+ NvQuatX(p, pitch);
+ NvQuatZ(ro, roll);
+
+ NvQuatMult(r, h, p);
+ NvQuatMult(r, ro, r);
+}
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll)
+{
+ GLfloat h[4], p[4], ro[4];
+
+ NvQuatZ(ro, roll);
+ NvQuatX(p, pitch);
+ NvQuatY(h, heading);
+
+ NvQuatMult(r, p, h);
+ NvQuatMult(r, r, ro);
+}
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4])
+{
+ return q1[0] * q2[0] + q1[1] * q2[1] + q1[2] * q2[2] + q1[3] * q2[3];
+}
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4])
+{
+ const GLfloat q1x = q1[0];
+ const GLfloat q1y = q1[1];
+ const GLfloat q1z = q1[2];
+ const GLfloat q1w = q1[3];
+ const GLfloat q2x = q2[0];
+ const GLfloat q2y = q2[1];
+ const GLfloat q2z = q2[2];
+ const GLfloat q2w = q2[3];
+
+ r[0] = q1y * q2z - q2y * q1z + q1w * q2x + q2w * q1x;
+ r[1] = q1z * q2x - q2z * q1x + q1w * q2y + q2w * q1y;
+ r[2] = q1x * q2y - q2x * q1y + q1w * q2z + q2w * q1z;
+ r[3] = q1w * q2w - q1x * q2x - q1y * q2y - q1z * q2z;
+}
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t)
+{
+ GLfloat omt = 1.0f - t;
+
+ if (NvQuatDot(q1, q2) < 0.0f) {
+ r[0] = -q1[0] * omt + q2[0] * t;
+ r[1] = -q1[1] * omt + q2[1] * t;
+ r[2] = -q1[2] * omt + q2[2] * t;
+ r[3] = -q1[3] * omt + q2[3] * t;
+ } else {
+ r[0] = q1[0] * omt + q2[0] * t;
+ r[1] = q1[1] * omt + q2[1] * t;
+ r[2] = q1[2] * omt + q2[2] * t;
+ r[3] = q1[3] * omt + q2[3] * t;
+ }
+
+ NvQuatNormalize(r, r);
+}
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4])
+{
+ GLfloat invLength = 1.0f / sqrtf(NvQuatDot(q, q));
+
+ r[0] = invLength * q[0];
+ r[1] = invLength * q[1];
+ r[2] = invLength * q[2];
+ r[3] = invLength * q[3];
+}
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.h b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.h
new file mode 100644
index 00000000..4c65cb9e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_math/nv_quat.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef INCLUDED_QUAT_H
+#define INCLUDED_QUAT_H
+
+#include <QtOpenGL/qgl.h>
+#include <math.h>
+#include <assert.h>
+
+void NvQuatCopy(GLfloat r[4], const GLfloat q[4]);
+void NvQuatConvertTo3x3Mat(GLfloat r[3][3], const GLfloat q[4]);
+
+void NvQuatIdentity(GLfloat r[4]);
+
+void NvQuatFromAngleAxis(GLfloat r[4], GLfloat radians, const GLfloat axis[3]);
+
+void NvQuatX(GLfloat r[4], GLfloat radians);
+
+void NvQuatY(GLfloat r[4], GLfloat radians);
+
+void NvQuatZ(GLfloat r[4], GLfloat radians);
+
+void NvQuatFromEuler(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+void NvQuatFromEulerReverse(GLfloat r[4], GLfloat heading, GLfloat pitch, GLfloat roll);
+
+GLfloat NvQuatDot(const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatMult(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4]);
+
+void NvQuatNLerp(GLfloat r[4], const GLfloat q1[4], const GLfloat q2[4], GLfloat t);
+
+void NvQuatNormalize(GLfloat r[4], const GLfloat q[4]);
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/nv_types.h b/src/Runtime/Source/platformspecific/windows/libs/nv_types.h
new file mode 100644
index 00000000..1d1b0300
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/nv_types.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2009-2011 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef __INCLUDED_QT3DS_TYPES_H
+#define __INCLUDED_QT3DS_TYPES_H
+
+typedef unsigned char NvU8; // 0 to 255
+typedef unsigned short NvU16; // 0 to 65535
+typedef unsigned int NvU32; // 0 to 4294967295
+typedef unsigned long long NvU64; // 0 to 18446744073709551615
+typedef signed char NvS8; // -128 to 127
+typedef signed short NvS16; // -32768 to 32767
+typedef signed int NvS32; // -2147483648 to 2147483647
+typedef signed long long NvS64; // 2^-63 to 2^63-1
+
+// Explicitly sized floats
+typedef float NvF32; // IEEE Single Precision (S1E8M23)
+typedef double NvF64; // IEEE Double Precision (S1E11M52)
+
+// Boolean type
+#define QT3DS_FALSE 0
+#define QT3DS_TRUE 1
+typedef NvU8 NvBool;
+
+// Result of sizeof operator
+typedef unsigned long NvSize;
+
+// Type large enough to hold a relative file offset
+typedef long NvOffset;
+
+// Base NULL type.
+#define QT3DS_NULL 0
+
+// Error related
+typedef enum {
+ NvError_Success = 0,
+ NvError_NotSupported,
+ NvError_NotInitialized,
+ NvError_BadParameter,
+ NvError_InsufficientMemory,
+ NvError_NoEntries,
+ NvError_UnknownError,
+} NvError;
+
+#if 1 // defined(_DEBUG) // !!!!TBD TODO
+#define NvAssert(c)
+#else
+#define NvAssert(c) ((void)((c) ? 0 : (NvHandleAssertion(#c, __FILE__, __LINE__), 0)))
+#endif
+
+// Other standardized typedefs
+typedef NvU64 NvUST; // U64 unadjusted system time value
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/libs/qt3ds_launcher_defs.h b/src/Runtime/Source/platformspecific/windows/libs/qt3ds_launcher_defs.h
new file mode 100644
index 00000000..6577fb4a
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/libs/qt3ds_launcher_defs.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* TAGRELEASE: public */
+
+#ifndef _QT3DSLAUNCHERDEFS_H
+#define _QT3DSLAUNCHERDEFS_H
+
+/* Applications should call kdSetWindowPropertyiv with
+ * KD_WINDOWPROPERTY_APP_ID_QT3DS as the pname
+ * and one of the ID's below as the param
+ * Or else define their own in the range starting with
+ * KD_APP_ID_USER_BASE_QT3DS
+ * call must be made _prior_ to window realize
+ */
+
+/* Need to define an NV internal KD property range - defining to a fixed value for now */
+/* But this window property is unused in the current KD spec */
+#define KD_WINDOWPROPERTY_APP_ID_QT3DS 0x1000
+
+#define KD_APP_ID_UNKNOWN_QT3DS 0
+#define KD_APP_ID_KEYBOARD_QT3DS 1 /* QT3DS RESERVED */
+#define KD_APP_ID_CONTACTS_QT3DS 2 /* QT3DS RESERVED */
+#define KD_APP_ID_MESSAGING_QT3DS 3 /* QT3DS RESERVED */
+#define KD_APP_ID_EMAIL_QT3DS 4 /* QT3DS RESERVED */
+#define KD_APP_ID_IM_QT3DS 5 /* QT3DS RESERVED */
+#define KD_APP_ID_PHONEDIALER_QT3DS 6 /* QT3DS RESERVED */
+#define KD_APP_ID_GAME_QT3DS 7
+#define KD_APP_ID_ADDRESSBOOK_QT3DS 8 /* Assigned to NV addrbook demo */
+#define KD_APP_ID_MUSICPLAYER_QT3DS 9 /* Assigned to NV mediaplayer demo */
+#define KD_APP_ID_SMS_QT3DS 10 /* QT3DS RESERVED */
+#define KD_APP_ID_IMAGEBROWSER_QT3DS 11 /* Assigned to NV photoviewer demo */
+#define KD_APP_ID_MAP_QT3DS 12 /* QT3DS RESERVED */
+#define KD_APP_ID_HOME_QT3DS 13 /* Assigned to NV launcher_gui home screen */
+#define KD_APP_ID_CALENDAR_QT3DS 14 /* QT3DS RESERVED */
+#define KD_APP_ID_VIDEO_QT3DS 15 /* Assigned to NV videoplayer demo */
+#define KD_APP_ID_WIDGETS_QT3DS 16 /* QT3DS RESERVED */
+#define KD_APP_ID_CAMERA_QT3DS 19 /* QT3DS RESERVED */
+#define KD_APP_ID_MEDIAWALL_QT3DS 20 /* QT3DS RESERVED */
+#define KD_APP_ID_OPERA_QT3DS 21 /* QT3DS RESERVED */
+#define KD_APP_ID_YOUTUBE_QT3DS 22 /* QT3DS RESERVED */
+#define KD_APP_ID_VISION_QT3DS 23 /* QT3DS RESERVED */
+#define KD_APP_ID_USER_BASE_QT3DS 1024 /* Base of app-reserved */
+
+/* starting orientation support */
+#define KD_WINDOWPROPERTY_ORIENTATION_QT3DS 0x1001
+
+#define KD_WINDOWPROPERTY_STATUSBAR_QT3DS 0x1002
+#define KD_STATUSBAR_HIDEALL_QT3DS 0x0000
+#define KD_STATUSBAR_SHOWBAR_QT3DS 0x0001
+#define KD_STATUSBAR_SHOWBG_QT3DS 0x0002 /* not set as state, just for mask */
+#define KD_STATUSBAR_SHOWALL_QT3DS 0x0003 /* this is showbar+showbg in bits...*/
+
+#define KD_WINDOWPROPERTY_PROCESS_ID_QT3DS 0x1003
+
+/* App-level KD state - if this exists and is nonzero, then the app is */
+/* Running in the launcher */
+
+#define KD_STATE_LAUNCHER_ACTIVE_QT3DS 0x11001
+
+/* Part of GL_NV_log_textures extension */
+/* Not currently supported in external release */
+#define GL_LOG_TEXTURES_QT3DS 0x85FF
+#define GL_LOG_TEXTURES_ZONE_QT3DS 0x85FE
+
+#endif
diff --git a/src/Runtime/Source/platformspecific/windows/viewer/Resource.h b/src/Runtime/Source/platformspecific/windows/viewer/Resource.h
new file mode 100644
index 00000000..58c9336e
--- /dev/null
+++ b/src/Runtime/Source/platformspecific/windows/viewer/Resource.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 1993-2009 NVIDIA Corporation.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt 3D Studio.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define IDI_ICON1 103
+#define IDI_ICON2 105
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 106
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif