From 54904957f292586ab761a08a8120bdb600f86a81 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Wed, 24 Apr 2024 14:33:06 +0100 Subject: [PATCH] [+] IRandomDevice.NextArrayVec2Fast [+] IRandomDevice.NextArrayVec3Fast [+] IRandomDevice.NextArrayVec4Fast [+] AuRNG.RngArrayVec2Fast [+] AuRNG.RngArrayVec3Fast [+] AuRNG.RngArrayVec4Fast --- Include/Aurora/RNG/IRandomDevice.hpp | 3 +++ Include/Aurora/RNG/RNG.hpp | 3 +++ Source/RNG/AuRNGStaticUtilities.cpp | 15 ++++++++++++ Source/RNG/AuRandomDevice.cpp | 36 ++++++++++++++++++++++++++++ Source/RNG/AuRandomDevice.hpp | 3 +++ 5 files changed, 60 insertions(+) diff --git a/Include/Aurora/RNG/IRandomDevice.hpp b/Include/Aurora/RNG/IRandomDevice.hpp index d1b62939..01a0947d 100644 --- a/Include/Aurora/RNG/IRandomDevice.hpp +++ b/Include/Aurora/RNG/IRandomDevice.hpp @@ -52,12 +52,15 @@ namespace Aurora::RNG virtual AuList NextArrayI64(AuUInt32 uCount) = 0; virtual AuList NextArrayU64(AuUInt32 uCount) = 0; virtual AuList NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) = 0; + virtual AuList NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) = 0; virtual AuList NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) = 0; virtual AuList NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) = 0; virtual AuList NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) = 0; + virtual AuList NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) = 0; virtual AuList NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) = 0; virtual AuList NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) = 0; virtual AuList NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) = 0; + virtual AuList NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) = 0; virtual AuList NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) = 0; virtual AuList NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) = 0; virtual AuList NextArrayDouble(AuUInt32 uCount) = 0; diff --git a/Include/Aurora/RNG/RNG.hpp b/Include/Aurora/RNG/RNG.hpp index 91725857..56d1e6a1 100644 --- a/Include/Aurora/RNG/RNG.hpp +++ b/Include/Aurora/RNG/RNG.hpp @@ -61,12 +61,15 @@ namespace Aurora::RNG AUKN_SYM AuList RngArrayI64(AuUInt32 uCount); AUKN_SYM AuList RngArrayU64(AuUInt32 uCount); AUKN_SYM AuList RngArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB); + AUKN_SYM AuList RngArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB); AUKN_SYM AuList RngArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max); AUKN_SYM AuList RngArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max); AUKN_SYM AuList RngArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB); + AUKN_SYM AuList RngArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB); AUKN_SYM AuList RngArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max); AUKN_SYM AuList RngArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max); AUKN_SYM AuList RngArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB); + AUKN_SYM AuList RngArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB); AUKN_SYM AuList RngArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max); AUKN_SYM AuList RngArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max); AUKN_SYM AuList RngArrayDouble(AuUInt32 uCount); diff --git a/Source/RNG/AuRNGStaticUtilities.cpp b/Source/RNG/AuRNGStaticUtilities.cpp index f0224fa1..7460db92 100644 --- a/Source/RNG/AuRNGStaticUtilities.cpp +++ b/Source/RNG/AuRNGStaticUtilities.cpp @@ -188,6 +188,11 @@ namespace Aurora::RNG return gFastDevice->NextArrayVec2(uCount, boundA, boundB); } + AUKN_SYM AuList RngArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) + { + return gFastDevice->NextArrayVec2Fast(uCount, boundA, boundB); + } + AUKN_SYM AuList RngArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) { return gFastDevice->NextArrayVec2Sorted(uCount, min, max); @@ -198,6 +203,11 @@ namespace Aurora::RNG return gFastDevice->NextArrayVec3(uCount, boundA, boundB); } + AUKN_SYM AuList RngArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) + { + return gFastDevice->NextArrayVec3Fast(uCount, boundA, boundB); + } + AUKN_SYM AuList RngArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) { return gFastDevice->NextArrayVec3Sorted(uCount, min, max); @@ -208,6 +218,11 @@ namespace Aurora::RNG return gFastDevice->NextArrayVec4(uCount, boundA, boundB); } + AUKN_SYM AuList RngArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) + { + return gFastDevice->NextArrayVec4Fast(uCount, boundA, boundB); + } + AUKN_SYM AuList RngArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) { return gFastDevice->NextArrayVec4Sorted(uCount, min, max); diff --git a/Source/RNG/AuRandomDevice.cpp b/Source/RNG/AuRandomDevice.cpp index e3fbb2de..2fa04b7a 100644 --- a/Source/RNG/AuRandomDevice.cpp +++ b/Source/RNG/AuRandomDevice.cpp @@ -747,6 +747,16 @@ namespace Aurora::RNG return NextArrayVec2Sorted(uCount, mins, maxs); } + AuList RandomDevice::NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) + { + AuVec2 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + return NextArrayVec2SortedFast(uCount, mins, maxs); + } + AuList RandomDevice::NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) { AuVec2 range; @@ -813,6 +823,18 @@ namespace Aurora::RNG return NextArrayVec3Sorted(uCount, mins, maxs); } + AuList RandomDevice::NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) + { + AuVec3 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + return NextArrayVec3SortedFast(uCount, mins, maxs); + } + AuList RandomDevice::NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) { AuVec3 range; @@ -887,6 +909,20 @@ namespace Aurora::RNG return NextArrayVec4Sorted(uCount, mins, maxs); } + AuList RandomDevice::NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) + { + AuVec4 mins, maxs; + mins[0] = AuMin(boundA[0], boundB[0]); + mins[1] = AuMin(boundA[1], boundB[1]); + mins[2] = AuMin(boundA[2], boundB[2]); + mins[3] = AuMin(boundA[3], boundB[3]); + maxs[0] = AuMax(boundA[0], boundB[0]); + maxs[1] = AuMax(boundA[1], boundB[1]); + maxs[2] = AuMax(boundA[2], boundB[2]); + maxs[3] = AuMax(boundA[3], boundB[3]); + return NextArrayVec4SortedFast(uCount, mins, maxs); + } + AuList RandomDevice::NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) { AuVec4 range; diff --git a/Source/RNG/AuRandomDevice.hpp b/Source/RNG/AuRandomDevice.hpp index a7efeca3..7730661e 100644 --- a/Source/RNG/AuRandomDevice.hpp +++ b/Source/RNG/AuRandomDevice.hpp @@ -50,12 +50,15 @@ namespace Aurora::RNG AuList NextArrayI64(AuUInt32 uCount) override; AuList NextArrayU64(AuUInt32 uCount) override; AuList NextArrayVec2(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override; + AuList NextArrayVec2Fast(AuUInt32 uCount, AuVec2 boundA, AuVec2 boundB) override; AuList NextArrayVec2Sorted(AuUInt32 uCount, AuVec2 min, AuVec2 max) override; AuList NextArrayVec2SortedFast(AuUInt32 uCount, AuVec2 min, AuVec2 max) override; AuList NextArrayVec3(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override; + AuList NextArrayVec3Fast(AuUInt32 uCount, AuVec3 boundA, AuVec3 boundB) override; AuList NextArrayVec3Sorted(AuUInt32 uCount, AuVec3 min, AuVec3 max) override; AuList NextArrayVec3SortedFast(AuUInt32 uCount, AuVec3 min, AuVec3 max) override; AuList NextArrayVec4(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override; + AuList NextArrayVec4Fast(AuUInt32 uCount, AuVec4 boundA, AuVec4 boundB) override; AuList NextArrayVec4Sorted(AuUInt32 uCount, AuVec4 min, AuVec4 max) override; AuList NextArrayVec4SortedFast(AuUInt32 uCount, AuVec4 min, AuVec4 max) override; AuList NextArrayDouble(AuUInt32 uCount) override;