aboutsummaryrefslogtreecommitdiff
path: root/dep
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-01 00:26:53 +0100
committerShauren <shauren.trinity@gmail.com>2023-08-12 14:24:24 +0200
commitb7287e85e4bc8acb2b95271ece9dd8a5b93873cd (patch)
tree6088602ac914ef69573ce551d7fc4f0613beb5ce /dep
parentf9033a5dbd559fde3030a21d83d664983d95f39f (diff)
Core/Misc: Fixed deprecation warnings for c++20
(cherry picked from commit ba9bbbc9d0c3b80d8954ad6390d23ae3d0f804b2)
Diffstat (limited to 'dep')
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix10.diff20
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix11.diff13
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix12.diff192
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix15.diff288
-rw-r--r--dep/g3dlite/G3D-v9.0 hotfix17.diff13
-rw-r--r--dep/g3dlite/Readme.txt1
-rw-r--r--dep/g3dlite/include/G3D/AABox.h10
-rw-r--r--dep/g3dlite/include/G3D/Array.h4
-rw-r--r--dep/g3dlite/include/G3D/AtomicInt32.h4
-rw-r--r--dep/g3dlite/include/G3D/HashTrait.h1
-rw-r--r--dep/g3dlite/include/G3D/Random.h1
-rw-r--r--dep/g3dlite/include/G3D/System.h4
-rw-r--r--dep/g3dlite/include/G3D/Vector2.h7
-rw-r--r--dep/g3dlite/include/G3D/Vector3.h12
-rw-r--r--dep/g3dlite/include/G3D/Vector4.h1
-rw-r--r--dep/g3dlite/include/G3D/debugAssert.h3
-rw-r--r--dep/g3dlite/include/G3D/platform.h3
-rw-r--r--dep/g3dlite/source/FileSystem.cpp2
-rw-r--r--dep/g3dlite/source/Random.cpp5
-rw-r--r--dep/g3dlite/source/Vector2.cpp1
-rw-r--r--dep/g3dlite/source/Vector3.cpp1
-rw-r--r--dep/g3dlite/source/debugAssert.cpp1
22 files changed, 565 insertions, 22 deletions
diff --git a/dep/g3dlite/G3D-v9.0 hotfix10.diff b/dep/g3dlite/G3D-v9.0 hotfix10.diff
new file mode 100644
index 00000000000..343ac7090fa
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix10.diff
@@ -0,0 +1,20 @@
+diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h
+index c562f5c920f7..c86b20fd7e97 100644
+--- a/dep/g3dlite/include/G3D/Array.h
++++ b/dep/g3dlite/include/G3D/Array.h
+@@ -346,6 +346,7 @@ class Array {
+
+ /** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
+ void copyPOD(const Array<T>& other) {
++ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "copyPOD called on non-POD type");
+ if (numAllocated < other.num) {
+ m_memoryManager->free(data);
+ data = NULL;
+@@ -364,6 +365,7 @@ class Array {
+ /** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
+ This is only safe for POD types */
+ void appendPOD(const Array<T>& other) {
++ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "appendPOD called on non-POD type");
+ const size_t oldSize = num;
+ num += other.num;
+ if (numAllocated < num) {
diff --git a/dep/g3dlite/G3D-v9.0 hotfix11.diff b/dep/g3dlite/G3D-v9.0 hotfix11.diff
new file mode 100644
index 00000000000..5c94416d649
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix11.diff
@@ -0,0 +1,13 @@
+diff --git a/dep/g3dlite/source/fileutils.cpp b/dep/g3dlite/source/fileutils.cpp
+index 2788adad3bcd..f5310084cec7 100644
+--- a/dep/g3dlite/source/fileutils.cpp
++++ b/dep/g3dlite/source/fileutils.cpp
+@@ -490,7 +490,7 @@ void parseFilename(
+
+ }
+
+- } else if ((f.size() >= 2) & isSlash(f[0]) && isSlash(f[1])) {
++ } else if ((f.size() >= 2) && isSlash(f[0]) && isSlash(f[1])) {
+
+ // e.g. //foo
+ root = f.substr(0, 2);
diff --git a/dep/g3dlite/G3D-v9.0 hotfix12.diff b/dep/g3dlite/G3D-v9.0 hotfix12.diff
new file mode 100644
index 00000000000..6594539f245
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix12.diff
@@ -0,0 +1,192 @@
+diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
+index 7b56e001ae29..9824d426d741 100644
+--- a/dep/g3dlite/include/G3D/AtomicInt32.h
++++ b/dep/g3dlite/include/G3D/AtomicInt32.h
+@@ -76,12 +76,16 @@ class AtomicInt32 {
+
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD)
+
+- int32 old;
+- asm volatile ("lock; xaddl %0,%1"
+- : "=r"(old), "=m"(m_value) /* outputs */
+- : "0"(x), "m"(m_value) /* inputs */
+- : "memory", "cc");
+- return old;
++# if defined(__aarch64__)
++ return __sync_fetch_and_add(&m_value, x);
++# else
++ int32 old;
++ asm volatile ("lock; xaddl %0,%1"
++ : "=r"(old), "=m"(m_value) /* outputs */
++ : "0"(x), "m"(m_value) /* inputs */
++ : "memory", "cc");
++ return old;
++# endif
+
+ # elif defined(G3D_OSX)
+
+@@ -115,14 +119,18 @@ class AtomicInt32 {
+ // Note: returns the newly decremented value
+ return InterlockedDecrement(&m_value);
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD)
+- unsigned char nz;
+-
+- asm volatile ("lock; decl %1;\n\t"
+- "setnz %%al"
+- : "=a" (nz)
+- : "m" (m_value)
+- : "memory", "cc");
+- return nz;
++# if defined(__aarch64__)
++ return __sync_sub_and_fetch(&m_value, 1);
++# else
++ unsigned char nz;
++
++ asm volatile ("lock; decl %1;\n\t"
++ "setnz %%al"
++ : "=a" (nz)
++ : "m" (m_value)
++ : "memory", "cc");
++ return nz;
++# endif
+ # elif defined(G3D_OSX)
+ // Note: returns the newly decremented value
+ return OSAtomicDecrement32(&m_value);
+@@ -143,17 +151,21 @@ class AtomicInt32 {
+ # if defined(G3D_WINDOWS)
+ return InterlockedCompareExchange(&m_value, exchange, comperand);
+ # elif defined(G3D_LINUX) || defined(G3D_FREEBSD) || defined(G3D_OSX)
+- // Based on Apache Portable Runtime
+- // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
+- int32 ret;
+- asm volatile ("lock; cmpxchgl %1, %2"
+- : "=a" (ret)
+- : "r" (exchange), "m" (m_value), "0"(comperand)
+- : "memory", "cc");
+- return ret;
+-
+- // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
+- // so it can't satisfy the cmpxchgl contract.
++# if defined(__aarch64__)
++ return __sync_val_compare_and_swap(&m_value, comperand, exchange);
++# else
++ // Based on Apache Portable Runtime
++ // http://koders.com/c/fid3B6631EE94542CDBAA03E822CA780CBA1B024822.aspx
++ int32 ret;
++ asm volatile ("lock; cmpxchgl %1, %2"
++ : "=a" (ret)
++ : "r" (exchange), "m" (m_value), "0"(comperand)
++ : "memory", "cc");
++ return ret;
++
++ // Note that OSAtomicCompareAndSwap32 does not return a useful value for us
++ // so it can't satisfy the cmpxchgl contract.
++# endif
+ # endif
+ }
+
+diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
+index 4624dd916474..9ed88957d755 100644
+--- a/dep/g3dlite/include/G3D/System.h
++++ b/dep/g3dlite/include/G3D/System.h
+@@ -21,6 +21,10 @@
+ #include "G3D/FileNotFound.h"
+ #include <string>
+
++#if defined(__aarch64__)
++#include <sys/time.h>
++#endif
++
+ #ifdef G3D_OSX
+ #define Zone OSX_Zone
+ # include <CoreServices/CoreServices.h>
+@@ -497,15 +501,37 @@ class System {
+ #elif defined(G3D_LINUX)
+
+ inline uint64 System::getCycleCount() {
+- uint32 timehi, timelo;
++# if defined(__aarch64__)
++# if (__ARM_ARCH >= 6) // V6 is the earliest arch that has a standard cyclecount
++ uint32_t pmccntr;
++ uint32_t pmuseren;
++ uint32_t pmcntenset;
++ // Read the user mode perf monitor counter access permissions.
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c14, 0" : "=r"(pmuseren));
++ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code.
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c12, 1" : "=r"(pmcntenset));
++ if (pmcntenset & 0x80000000ul) { // Is it counting?
++ __asm__ __volatile__("mrc p15, 0, %w0, c9, c13, 0" : "=r"(pmccntr));
++ // The counter is set up to count every 64th cycle
++ return static_cast<uint64>(pmccntr) * 64; // Should optimize to << 6
++ }
++ }
++# endif
+
+- __asm__ __volatile__ (
+- "rdtsc "
+- : "=a" (timelo),
+- "=d" (timehi)
+- : );
++ struct timeval tv;
++ gettimeofday(&tv, nullptr);
++ return static_cast<uint64>(tv.tv_sec) * 1000000 + tv.tv_usec;
++# else
++ uint32 timehi, timelo;
++
++ __asm__ __volatile__ (
++ "rdtsc "
++ : "=a" (timelo),
++ "=d" (timehi)
++ : );
+
+- return ((uint64)timehi << 32) + (uint64)timelo;
++ return ((uint64)timehi << 32) + (uint64)timelo;
++# endif
+ }
+
+ #elif defined(G3D_OSX)
+diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
+index 439495ab1315..d043f21491ad 100644
+--- a/dep/g3dlite/include/G3D/platform.h
++++ b/dep/g3dlite/include/G3D/platform.h
+@@ -273,7 +273,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw) {\
+ # define __stdcall __attribute__((stdcall))
+ # endif
+
+-# elif defined(__x86_64__)
++# elif defined(__x86_64__) || defined(__arm) || defined(__aarch64__)
+
+ # ifndef __cdecl
+ # define __cdecl
+diff --git a/dep/g3dlite/source/System.cpp b/dep/g3dlite/source/System.cpp
+index b841e23c497e..4a75d320b8d3 100644
+--- a/dep/g3dlite/source/System.cpp
++++ b/dep/g3dlite/source/System.cpp
+@@ -79,8 +79,9 @@
+ #endif
+
+ // SIMM include
++#if !defined(__aarch64__)
+ #include <xmmintrin.h>
+-
++#endif
+
+ namespace G3D {
+
+@@ -1697,6 +1698,16 @@ void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, ui
+ edx = regs[3];
+ }
+
++#elif defined(__aarch64__) || defined(G3D_OSX) && ! defined(G3D_OSX_INTEL)
++
++// non-x86 CPU; no CPUID
++void System::cpuid(CPUIDFunction func, uint32& eax, uint32& ebx, uint32& ecx, uint32& edx) {
++ eax = 0;
++ ebx = 0;
++ ecx = 0;
++ edx = 0;
++}
++
+ #else
+
+ // See http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
diff --git a/dep/g3dlite/G3D-v9.0 hotfix15.diff b/dep/g3dlite/G3D-v9.0 hotfix15.diff
new file mode 100644
index 00000000000..d385def554a
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix15.diff
@@ -0,0 +1,288 @@
+diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h
+index 7a47ea63aa..97a47cf986 100644
+--- a/dep/g3dlite/include/G3D/AABox.h
++++ b/dep/g3dlite/include/G3D/AABox.h
+@@ -17,14 +17,14 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/debug.h"
+-#include "G3D/Array.h"
+-#include "G3D/Plane.h"
+-#include "G3D/Sphere.h"
+ #include "G3D/Vector3.h"
+
+ namespace G3D {
+
+ class Any;
++template <class T, size_t MIN_ELEMENTS> class Array;
++class Plane;
++class Sphere;
+
+ /**
+ An axis-aligned box.
+@@ -221,7 +221,7 @@ public:
+
+ */
+ bool culledBy
+- (const Array<Plane>& plane,
++ (const Array<Plane, 10>& plane,
+ int32& cullingPlaneIndex,
+ const uint32 testMask,
+ uint32& childMask) const;
+@@ -230,7 +230,7 @@ public:
+ Conservative culling test that does not produce a mask for children.
+ */
+ bool culledBy
+- (const Array<Plane>& plane,
++ (const Array<Plane, 10>& plane,
+ int32& cullingPlaneIndex = dummy,
+ const uint32 testMask = 0xFFFFFFFF) const;
+
+diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
+index 9824d426d7..51561e3dcc 100644
+--- a/dep/g3dlite/include/G3D/AtomicInt32.h
++++ b/dep/g3dlite/include/G3D/AtomicInt32.h
+@@ -12,7 +12,9 @@
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+
+-#if defined(G3D_OSX)
++#if defined(G3D_WINDOWS)
++# include <Windows.h>
++#elif defined(G3D_OSX)
+ # include <libkern/OSAtomic.h>
+ #endif
+
+diff --git a/dep/g3dlite/include/G3D/HashTrait.h b/dep/g3dlite/include/G3D/HashTrait.h
+index 1de3777bae..6199f4504e 100644
+--- a/dep/g3dlite/include/G3D/HashTrait.h
++++ b/dep/g3dlite/include/G3D/HashTrait.h
+@@ -13,7 +13,6 @@
+ #define G3D_HashTrait_h
+
+ #include "G3D/platform.h"
+-#include "G3D/Crypto.h"
+ #include "G3D/g3dmath.h"
+ #include "G3D/uint128.h"
+ #include <typeinfo>
+diff --git a/dep/g3dlite/include/G3D/Random.h b/dep/g3dlite/include/G3D/Random.h
+index 9d911806a9..359755044a 100644
+--- a/dep/g3dlite/include/G3D/Random.h
++++ b/dep/g3dlite/include/G3D/Random.h
+@@ -159,6 +159,7 @@ public:
+ static Random& common();
+ };
+
++Random& commonRandom();
+ }
+
+ #endif
+diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
+index 9ed88957d7..81c83527c9 100644
+--- a/dep/g3dlite/include/G3D/System.h
++++ b/dep/g3dlite/include/G3D/System.h
+@@ -21,6 +21,10 @@
+ #include "G3D/FileNotFound.h"
+ #include <string>
+
++#ifdef G3D_WINDOWS
++#include <Windows.h>
++#endif
++
+ #if defined(__aarch64__)
+ #include <sys/time.h>
+ #endif
+diff --git a/dep/g3dlite/include/G3D/Vector2.h b/dep/g3dlite/include/G3D/Vector2.h
+index 65cf7fa8f2..696889d630 100644
+--- a/dep/g3dlite/include/G3D/Vector2.h
++++ b/dep/g3dlite/include/G3D/Vector2.h
+@@ -19,20 +19,21 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/Vector2int16.h"
+ #include "G3D/Vector2unorm16.h"
+-#include "G3D/Random.h"
+
+ namespace G3D {
+
++class Random;
+ class Vector2;
+ class Vector3;
+ class Vector4;
+ class Vector2int32;
+ class Any;
+
++Random& commonRandom();
++
+ /**
+ Do not subclass-- this implementation makes assumptions about the
+ memory layout.
+@@ -210,7 +211,7 @@ public:
+ }
+
+ /** Uniformly distributed random vector on the unit sphere */
+- static Vector2 random(Random& r = Random::common());
++ static Vector2 random(Random& r = commonRandom());
+
+ // Special values.
+ // Intentionally not inlined: see Matrix3::identity() for details.
+diff --git a/dep/g3dlite/include/G3D/Vector3.h b/dep/g3dlite/include/G3D/Vector3.h
+index 05d9b11ed5..c79f70b916 100644
+--- a/dep/g3dlite/include/G3D/Vector3.h
++++ b/dep/g3dlite/include/G3D/Vector3.h
+@@ -17,9 +17,7 @@
+
+ #include "G3D/platform.h"
+ #include "G3D/g3dmath.h"
+-#include "G3D/Random.h"
+ #include "G3D/Vector2.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/PositionTrait.h"
+ #include "G3D/Vector2.h"
+@@ -365,7 +363,7 @@ public:
+ Distribution rendered by G3D::DirectionHistogram:
+ \image html vector3-random.png
+ */
+- static Vector3 random(Random& r = Random::common());
++ static Vector3 random(Random& r = commonRandom());
+
+ /** \brief Random unit vector, distributed according to \f$\max(\cos \theta,0)\f$.
+
+@@ -380,9 +378,9 @@ public:
+
+ @cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24
+ */
+- static Vector3 cosHemiRandom(const Vector3& n, Random& r = Random::common());
++ static Vector3 cosHemiRandom(const Vector3& n, Random& r = commonRandom());
+
+- static Vector3 cosSphereRandom(const Vector3& n, Random& r = Random::common());
++ static Vector3 cosSphereRandom(const Vector3& n, Random& r = commonRandom());
+
+ /** \brief Random unit vector, distributed according to \f$\max(\cos^k \theta,0)\f$.
+
+@@ -397,7 +395,7 @@ public:
+
+ @cite Ashikhmin and Shirley, An anisotropic Phong BRDF model, Journal of Graphics Tools, 2002
+ */
+- static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = Random::common());
++ static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = commonRandom());
+
+ /**
+ \brief Random vector distributed over the hemisphere about normal.
+@@ -405,7 +403,7 @@ public:
+ Distribution rendered by G3D::DirectionHistogram:
+ \image html vector3-hemirandom.png
+ */
+- static Vector3 hemiRandom(const Vector3& normal, Random& r = Random::common());
++ static Vector3 hemiRandom(const Vector3& normal, Random& r = commonRandom());
+
+ inline float sum() const {
+ return x + y + z;
+diff --git a/dep/g3dlite/include/G3D/Vector4.h b/dep/g3dlite/include/G3D/Vector4.h
+index 24521efc93..0f0ea459df 100644
+--- a/dep/g3dlite/include/G3D/Vector4.h
++++ b/dep/g3dlite/include/G3D/Vector4.h
+@@ -19,7 +19,6 @@
+ #include "G3D/g3dmath.h"
+ #include "G3D/Vector3.h"
+ #include "G3D/Vector2.h"
+-#include "G3D/Table.h"
+ #include "G3D/HashTrait.h"
+ #include "G3D/PositionTrait.h"
+ #include <string>
+diff --git a/dep/g3dlite/include/G3D/debugAssert.h b/dep/g3dlite/include/G3D/debugAssert.h
+index edff671061..197312bd12 100644
+--- a/dep/g3dlite/include/G3D/debugAssert.h
++++ b/dep/g3dlite/include/G3D/debugAssert.h
+@@ -32,6 +32,7 @@
+ #include <cstdlib>
+
+ #ifdef _MSC_VER
++#include <intrin.h>
+ // conditional expression is constant
+ # pragma warning (disable : 4127)
+ #endif
+@@ -116,7 +117,7 @@ namespace _internal {
+ #ifdef G3D_DEBUG
+
+ # if defined(_MSC_VER)
+-# define rawBreak() ::DebugBreak();
++# define rawBreak() ::__debugbreak();
+ # elif defined(__i386__)
+ // gcc on intel
+ # define rawBreak() __asm__ __volatile__ ( "int $3" );
+diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
+index d043f21491..9202fe41d0 100644
+--- a/dep/g3dlite/include/G3D/platform.h
++++ b/dep/g3dlite/include/G3D/platform.h
+@@ -190,6 +190,7 @@ These control the version of Winsock used by G3D.
+ // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_Compiler_Reference.asp
+ //
+
++#if 0
+ // DLL runtime
+ #ifndef _DLL
+ #define _DLL
+@@ -227,6 +228,8 @@ These control the version of Winsock used by G3D.
+ # undef WIN32_LEAN_AND_MEAN
+ # undef NOMINMAX
+
++#endif // 0
++
+ # ifdef _G3D_INTERNAL_HIDE_WINSOCK_
+ # undef _G3D_INTERNAL_HIDE_WINSOCK_
+ # undef _WINSOCKAPI_
+diff --git a/dep/g3dlite/source/Random.cpp b/dep/g3dlite/source/Random.cpp
+index cbfa07dec0..a31d52a557 100644
+--- a/dep/g3dlite/source/Random.cpp
++++ b/dep/g3dlite/source/Random.cpp
+@@ -227,4 +227,9 @@ void Random::sphere(float& x, float& y, float& z) {
+ z *= s;
+ }
+
++Random& commonRandom()
++{
++ return Random::common();
++}
++
+ } // G3D
+diff --git a/dep/g3dlite/source/Vector2.cpp b/dep/g3dlite/source/Vector2.cpp
+index a6edea9a83..194cd3090d 100644
+--- a/dep/g3dlite/source/Vector2.cpp
++++ b/dep/g3dlite/source/Vector2.cpp
+@@ -23,6 +23,7 @@
+ #include "G3D/TextInput.h"
+ #include "G3D/TextOutput.h"
+ #include "G3D/Any.h"
++#include "G3D/Random.h"
+
+ namespace G3D {
+
+diff --git a/dep/g3dlite/source/Vector3.cpp b/dep/g3dlite/source/Vector3.cpp
+index e2d9643e5c..ccbf7d6a0b 100644
+--- a/dep/g3dlite/source/Vector3.cpp
++++ b/dep/g3dlite/source/Vector3.cpp
+@@ -28,6 +28,7 @@
+ #include "G3D/Vector4.h"
+ #include "G3D/Vector3int32.h"
+ #include "G3D/Any.h"
++#include "G3D/Random.h"
+
+ namespace G3D {
+
+diff --git a/dep/g3dlite/source/debugAssert.cpp b/dep/g3dlite/source/debugAssert.cpp
+index 3c3e43a0af..ff843fb7ee 100644
+--- a/dep/g3dlite/source/debugAssert.cpp
++++ b/dep/g3dlite/source/debugAssert.cpp
+@@ -23,6 +23,7 @@
+ #include <cstdlib>
+
+ #ifdef _MSC_VER
++#include <Windows.h>
+ // disable: "C++ exception handler used"
+ # pragma warning (push)
+ # pragma warning (disable : 4530)
diff --git a/dep/g3dlite/G3D-v9.0 hotfix17.diff b/dep/g3dlite/G3D-v9.0 hotfix17.diff
new file mode 100644
index 00000000000..cb5367c65f4
--- /dev/null
+++ b/dep/g3dlite/G3D-v9.0 hotfix17.diff
@@ -0,0 +1,13 @@
+diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp
+index 0898af7953..ff5da02344 100644
+--- a/dep/g3dlite/source/FileSystem.cpp
++++ b/dep/g3dlite/source/FileSystem.cpp
+@@ -35,7 +35,7 @@
+ # include <fnmatch.h>
+ # include <unistd.h>
+ # define _getcwd getcwd
+-# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
++# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
+ # define stat64 stat
+ # endif
+ # define _stat stat
diff --git a/dep/g3dlite/Readme.txt b/dep/g3dlite/Readme.txt
index 5477030e5cb..3318bcbb3ed 100644
--- a/dep/g3dlite/Readme.txt
+++ b/dep/g3dlite/Readme.txt
@@ -24,4 +24,5 @@ G3D-v9.0 hotfix11.diff - 2017-11-11 - static analysis issue fix
G3D-v9.0 hotfix12.diff - 2020-02-23 - ARM64 build fix
G3D-v9.0 hotfix13.diff - 2020-08-04 - MSVC build fix with /permissive-
G3D-v9.0 hotfix14.diff - 2022-01-16 - warning fixes
+G3D-v9.0 hotfix15.diff - 2022-02-11 - purge Windows.h includes from public headers
G3D-v9.0 hotfix16.diff - 2022-02-11 - Fix *BSD compile errors
diff --git a/dep/g3dlite/include/G3D/AABox.h b/dep/g3dlite/include/G3D/AABox.h
index 7a47ea63aa2..97a47cf9865 100644
--- a/dep/g3dlite/include/G3D/AABox.h
+++ b/dep/g3dlite/include/G3D/AABox.h
@@ -17,14 +17,14 @@
#include "G3D/platform.h"
#include "G3D/debug.h"
-#include "G3D/Array.h"
-#include "G3D/Plane.h"
-#include "G3D/Sphere.h"
#include "G3D/Vector3.h"
namespace G3D {
class Any;
+template <class T, size_t MIN_ELEMENTS> class Array;
+class Plane;
+class Sphere;
/**
An axis-aligned box.
@@ -221,7 +221,7 @@ public:
*/
bool culledBy
- (const Array<Plane>& plane,
+ (const Array<Plane, 10>& plane,
int32& cullingPlaneIndex,
const uint32 testMask,
uint32& childMask) const;
@@ -230,7 +230,7 @@ public:
Conservative culling test that does not produce a mask for children.
*/
bool culledBy
- (const Array<Plane>& plane,
+ (const Array<Plane, 10>& plane,
int32& cullingPlaneIndex = dummy,
const uint32 testMask = 0xFFFFFFFF) const;
diff --git a/dep/g3dlite/include/G3D/Array.h b/dep/g3dlite/include/G3D/Array.h
index c86b20fd7e9..788237dce54 100644
--- a/dep/g3dlite/include/G3D/Array.h
+++ b/dep/g3dlite/include/G3D/Array.h
@@ -346,7 +346,7 @@ public:
/** Resizes this to match the size of \a other and then copies the data from other using memcpy. This is only safe for POD types */
void copyPOD(const Array<T>& other) {
- static_assert(std::is_pod<T>::value, "copyPOD called on non-POD type");
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "copyPOD called on non-POD type");
if (numAllocated < other.num) {
m_memoryManager->free(data);
data = NULL;
@@ -365,7 +365,7 @@ public:
/** Resizes this to just barely match the size of \a other + itself and then copies the data to the end of the array from other using memcpy.
This is only safe for POD types */
void appendPOD(const Array<T>& other) {
- static_assert(std::is_pod<T>::value, "appendPOD called on non-POD type");
+ static_assert(std::is_standard_layout_v<T> && std::is_trivial_v<T>, "appendPOD called on non-POD type");
const size_t oldSize = num;
num += other.num;
if (numAllocated < num) {
diff --git a/dep/g3dlite/include/G3D/AtomicInt32.h b/dep/g3dlite/include/G3D/AtomicInt32.h
index 9824d426d74..51561e3dcc4 100644
--- a/dep/g3dlite/include/G3D/AtomicInt32.h
+++ b/dep/g3dlite/include/G3D/AtomicInt32.h
@@ -12,7 +12,9 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#if defined(G3D_OSX)
+#if defined(G3D_WINDOWS)
+# include <Windows.h>
+#elif defined(G3D_OSX)
# include <libkern/OSAtomic.h>
#endif
diff --git a/dep/g3dlite/include/G3D/HashTrait.h b/dep/g3dlite/include/G3D/HashTrait.h
index 1de3777baec..6199f4504ed 100644
--- a/dep/g3dlite/include/G3D/HashTrait.h
+++ b/dep/g3dlite/include/G3D/HashTrait.h
@@ -13,7 +13,6 @@
#define G3D_HashTrait_h
#include "G3D/platform.h"
-#include "G3D/Crypto.h"
#include "G3D/g3dmath.h"
#include "G3D/uint128.h"
#include <typeinfo>
diff --git a/dep/g3dlite/include/G3D/Random.h b/dep/g3dlite/include/G3D/Random.h
index 9d911806a97..359755044a8 100644
--- a/dep/g3dlite/include/G3D/Random.h
+++ b/dep/g3dlite/include/G3D/Random.h
@@ -159,6 +159,7 @@ public:
static Random& common();
};
+Random& commonRandom();
}
#endif
diff --git a/dep/g3dlite/include/G3D/System.h b/dep/g3dlite/include/G3D/System.h
index 9ed88957d75..81c83527c9c 100644
--- a/dep/g3dlite/include/G3D/System.h
+++ b/dep/g3dlite/include/G3D/System.h
@@ -21,6 +21,10 @@
#include "G3D/FileNotFound.h"
#include <string>
+#ifdef G3D_WINDOWS
+#include <Windows.h>
+#endif
+
#if defined(__aarch64__)
#include <sys/time.h>
#endif
diff --git a/dep/g3dlite/include/G3D/Vector2.h b/dep/g3dlite/include/G3D/Vector2.h
index 65cf7fa8f2f..696889d6302 100644
--- a/dep/g3dlite/include/G3D/Vector2.h
+++ b/dep/g3dlite/include/G3D/Vector2.h
@@ -19,20 +19,21 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/Vector2int16.h"
#include "G3D/Vector2unorm16.h"
-#include "G3D/Random.h"
namespace G3D {
+class Random;
class Vector2;
class Vector3;
class Vector4;
class Vector2int32;
class Any;
+Random& commonRandom();
+
/**
Do not subclass-- this implementation makes assumptions about the
memory layout.
@@ -210,7 +211,7 @@ public:
}
/** Uniformly distributed random vector on the unit sphere */
- static Vector2 random(Random& r = Random::common());
+ static Vector2 random(Random& r = commonRandom());
// Special values.
// Intentionally not inlined: see Matrix3::identity() for details.
diff --git a/dep/g3dlite/include/G3D/Vector3.h b/dep/g3dlite/include/G3D/Vector3.h
index 05d9b11ed57..c79f70b916b 100644
--- a/dep/g3dlite/include/G3D/Vector3.h
+++ b/dep/g3dlite/include/G3D/Vector3.h
@@ -17,9 +17,7 @@
#include "G3D/platform.h"
#include "G3D/g3dmath.h"
-#include "G3D/Random.h"
#include "G3D/Vector2.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/PositionTrait.h"
#include "G3D/Vector2.h"
@@ -365,7 +363,7 @@ public:
Distribution rendered by G3D::DirectionHistogram:
\image html vector3-random.png
*/
- static Vector3 random(Random& r = Random::common());
+ static Vector3 random(Random& r = commonRandom());
/** \brief Random unit vector, distributed according to \f$\max(\cos \theta,0)\f$.
@@ -380,9 +378,9 @@ public:
@cite Henrik Wann Jensen, Realistic Image Synthesis using Photon Mapping eqn 2.24
*/
- static Vector3 cosHemiRandom(const Vector3& n, Random& r = Random::common());
+ static Vector3 cosHemiRandom(const Vector3& n, Random& r = commonRandom());
- static Vector3 cosSphereRandom(const Vector3& n, Random& r = Random::common());
+ static Vector3 cosSphereRandom(const Vector3& n, Random& r = commonRandom());
/** \brief Random unit vector, distributed according to \f$\max(\cos^k \theta,0)\f$.
@@ -397,7 +395,7 @@ public:
@cite Ashikhmin and Shirley, An anisotropic Phong BRDF model, Journal of Graphics Tools, 2002
*/
- static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = Random::common());
+ static Vector3 cosPowHemiRandom(const Vector3& n, const float k, Random& r = commonRandom());
/**
\brief Random vector distributed over the hemisphere about normal.
@@ -405,7 +403,7 @@ public:
Distribution rendered by G3D::DirectionHistogram:
\image html vector3-hemirandom.png
*/
- static Vector3 hemiRandom(const Vector3& normal, Random& r = Random::common());
+ static Vector3 hemiRandom(const Vector3& normal, Random& r = commonRandom());
inline float sum() const {
return x + y + z;
diff --git a/dep/g3dlite/include/G3D/Vector4.h b/dep/g3dlite/include/G3D/Vector4.h
index 24521efc93c..0f0ea459dfa 100644
--- a/dep/g3dlite/include/G3D/Vector4.h
+++ b/dep/g3dlite/include/G3D/Vector4.h
@@ -19,7 +19,6 @@
#include "G3D/g3dmath.h"
#include "G3D/Vector3.h"
#include "G3D/Vector2.h"
-#include "G3D/Table.h"
#include "G3D/HashTrait.h"
#include "G3D/PositionTrait.h"
#include <string>
diff --git a/dep/g3dlite/include/G3D/debugAssert.h b/dep/g3dlite/include/G3D/debugAssert.h
index edff671061d..197312bd12e 100644
--- a/dep/g3dlite/include/G3D/debugAssert.h
+++ b/dep/g3dlite/include/G3D/debugAssert.h
@@ -32,6 +32,7 @@
#include <cstdlib>
#ifdef _MSC_VER
+#include <intrin.h>
// conditional expression is constant
# pragma warning (disable : 4127)
#endif
@@ -116,7 +117,7 @@ namespace _internal {
#ifdef G3D_DEBUG
# if defined(_MSC_VER)
-# define rawBreak() ::DebugBreak();
+# define rawBreak() ::__debugbreak();
# elif defined(__i386__)
// gcc on intel
# define rawBreak() __asm__ __volatile__ ( "int $3" );
diff --git a/dep/g3dlite/include/G3D/platform.h b/dep/g3dlite/include/G3D/platform.h
index d043f21491a..9202fe41d0b 100644
--- a/dep/g3dlite/include/G3D/platform.h
+++ b/dep/g3dlite/include/G3D/platform.h
@@ -190,6 +190,7 @@ These control the version of Winsock used by G3D.
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_Compiler_Reference.asp
//
+#if 0
// DLL runtime
#ifndef _DLL
#define _DLL
@@ -227,6 +228,8 @@ These control the version of Winsock used by G3D.
# undef WIN32_LEAN_AND_MEAN
# undef NOMINMAX
+#endif // 0
+
# ifdef _G3D_INTERNAL_HIDE_WINSOCK_
# undef _G3D_INTERNAL_HIDE_WINSOCK_
# undef _WINSOCKAPI_
diff --git a/dep/g3dlite/source/FileSystem.cpp b/dep/g3dlite/source/FileSystem.cpp
index 0898af79534..ff5da023443 100644
--- a/dep/g3dlite/source/FileSystem.cpp
+++ b/dep/g3dlite/source/FileSystem.cpp
@@ -35,7 +35,7 @@
# include <fnmatch.h>
# include <unistd.h>
# define _getcwd getcwd
-# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
# define stat64 stat
# endif
# define _stat stat
diff --git a/dep/g3dlite/source/Random.cpp b/dep/g3dlite/source/Random.cpp
index cbfa07dec0b..a31d52a557c 100644
--- a/dep/g3dlite/source/Random.cpp
+++ b/dep/g3dlite/source/Random.cpp
@@ -227,4 +227,9 @@ void Random::sphere(float& x, float& y, float& z) {
z *= s;
}
+Random& commonRandom()
+{
+ return Random::common();
+}
+
} // G3D
diff --git a/dep/g3dlite/source/Vector2.cpp b/dep/g3dlite/source/Vector2.cpp
index a6edea9a83f..194cd3090de 100644
--- a/dep/g3dlite/source/Vector2.cpp
+++ b/dep/g3dlite/source/Vector2.cpp
@@ -23,6 +23,7 @@
#include "G3D/TextInput.h"
#include "G3D/TextOutput.h"
#include "G3D/Any.h"
+#include "G3D/Random.h"
namespace G3D {
diff --git a/dep/g3dlite/source/Vector3.cpp b/dep/g3dlite/source/Vector3.cpp
index e2d9643e5cc..ccbf7d6a0bd 100644
--- a/dep/g3dlite/source/Vector3.cpp
+++ b/dep/g3dlite/source/Vector3.cpp
@@ -28,6 +28,7 @@
#include "G3D/Vector4.h"
#include "G3D/Vector3int32.h"
#include "G3D/Any.h"
+#include "G3D/Random.h"
namespace G3D {
diff --git a/dep/g3dlite/source/debugAssert.cpp b/dep/g3dlite/source/debugAssert.cpp
index 3c3e43a0af9..ff843fb7ee0 100644
--- a/dep/g3dlite/source/debugAssert.cpp
+++ b/dep/g3dlite/source/debugAssert.cpp
@@ -23,6 +23,7 @@
#include <cstdlib>
#ifdef _MSC_VER
+#include <Windows.h>
// disable: "C++ exception handler used"
# pragma warning (push)
# pragma warning (disable : 4530)