This commit is contained in:
Branimir Karadžić
2018-11-25 20:10:24 -08:00
parent a89331575a
commit 3a67e19e99
9 changed files with 26 additions and 21 deletions

View File

@@ -10,8 +10,7 @@
namespace bx
{
/// Reference:
/// http://msdn.microsoft.com/en-us/library/a1y7w461.aspx
///
StringView tokenizeCommandLine(const StringView& _commandLine, char* _buffer, uint32_t& _bufferSize, int32_t& _argc, char* _argv[], int32_t _maxArgvs, char _term = '\0');
///

View File

@@ -8,10 +8,6 @@
#include "math.h"
// Reference:
// http://easings.net/
// http://robertpenner.com/easing/
namespace bx
{
///

View File

@@ -9,8 +9,9 @@
namespace bx
{
// Reference:
// https://web.archive.org/web/20181115035420/http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/
// Reference(S):
// - https://web.archive.org/web/20181115035420/http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/
//
template<typename Ty, size_t Num>
char(&CountOfRequireArrayArgumentT(const Ty(&)[Num]))[Num];

View File

@@ -7,6 +7,10 @@
# error "Must be included from bx/easing.h!"
#endif // BX_EASING_H_HEADER_GUARD
// Reference(s):
// - https://web.archive.org/web/20181126040153/https://easings.net/
// - https://web.archive.org/web/20181126040212/http://robertpenner.com/easing/
//
namespace bx
{
template<EaseFn ease>

View File

@@ -49,8 +49,9 @@ namespace bx
inline BX_CONST_FUNC uint32_t floatFlip(uint32_t _value)
{
// Reference:
// http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html
// Reference(s):
// - http://archive.fo/2012.12.08-212402/http://stereopsis.com/radix.html
//
const uint32_t tmp0 = uint32_sra(_value, 31);
const uint32_t tmp1 = uint32_neg(tmp0);
const uint32_t mask = uint32_or(tmp1, 0x80000000);
@@ -259,8 +260,9 @@ namespace bx
inline constexpr BX_CONST_FUNC bool equal(float _a, float _b, float _epsilon)
{
// Reference:
// https://web.archive.org/web/20181103180318/http://realtimecollisiondetection.net/blog/?p=89
// Reference(s):
// - https://web.archive.org/web/20181103180318/http://realtimecollisiondetection.net/blog/?p=89
//
const float lhs = abs(_a - _b);
const float rhs = _epsilon * max(1.0f, abs(_a), abs(_b) );
return lhs <= rhs;
@@ -305,6 +307,11 @@ namespace bx
inline constexpr BX_CONST_FUNC float gain(float _time, float _gain)
{
// Reference(s):
// - Bias And Gain Are Your Friend
// https://web.archive.org/web/20181126040535/https://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
// https://web.archive.org/web/20181126040558/http://demofox.org/biasgain.html
//
if (_time < 0.5f)
{
return bias(_time * 2.0f, _gain) * 0.5f;

View File

@@ -707,8 +707,9 @@ namespace bx
template<int32_t MantissaBits, int32_t ExpBits>
inline void encodeRgbE(float* _dst, const float* _src)
{
// Reference:
// https://www.opengl.org/registry/specs/EXT/texture_shared_exponent.txt
// Reference(s):
// - https://web.archive.org/web/20181126040035/https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_shared_exponent.txt
//
const int32_t expMax = (1<<ExpBits) - 1;
const int32_t expBias = (1<<(ExpBits - 1) ) - 1;
const float sharedExpMax = float(expMax) / float(expMax + 1) * float(1 << (expMax - expBias) );

View File

@@ -250,10 +250,6 @@ namespace bx
///
constexpr BX_CONST_FUNC float smoothStep(float _a);
// References:
// - Bias And Gain Are Your Friend
// http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
// - http://demofox.org/biasgain.html
///
constexpr BX_CONST_FUNC float bias(float _time, float _bias);